From 2d5de33e3e08ff478ad9e33b6a6f00f819224122 Mon Sep 17 00:00:00 2001 From: 5/9 <66016924+fiveoutofnine@users.noreply.github.com> Date: Fri, 3 Mar 2023 14:54:53 -0500 Subject: [PATCH] Add deploys (#22) * chore: update deploy config * chore: update some deploy config stuff * docs: add deployments * docs: add deployments * docs: remove * docs: fix script commands --------- Co-authored-by: e6f4e37l <66016924+e6f4e37l@users.noreply.github.com> --- .gas-snapshot | 16 +++++------ README.md | 45 +++++++++++++++++++++++++++++-- script/deploy/DeployBase.s.sol | 7 +++-- script/deploy/DeployGoerli.s.sol | 4 +-- script/deploy/DeployMainnet.s.sol | 16 +++++++++-- src/AuthorshipToken.sol | 4 --- src/Curta.sol | 16 +++++++++-- 7 files changed, 86 insertions(+), 22 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index be1b3b7..f0e7c3b 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,11 +1,11 @@ -AuthorshipTokenTest:test_curtaMint() (gas: 85670) -AuthorshipTokenTest:test_curtaMint_SenderIsNotCurta_RevertsUnauthorized(address) (runs: 256, μ: 10226, ~: 10226) -AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6512449, ~: 6042550) +AuthorshipTokenTest:test_curtaMint() (gas: 85648) +AuthorshipTokenTest:test_curtaMint_SenderIsNotCurta_RevertsUnauthorized(address) (runs: 256, μ: 10204, ~: 10204) +AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6505633, ~: 6043360) AuthorshipTokenTest:test_ownerMint_SenderIsNotOwner_RevertUnauthorized(address) (runs: 256, μ: 12935, ~: 12935) AuthorshipTokenTest:test_ownerMint_SenderIsOwner_AllowsMint() (gas: 108202) AuthorshipTokenTest:test_tokenURI_MintedToken_Succeeds() (gas: 232) AuthorshipTokenTest:test_tokenURI_UnmintedToken_Fails() (gas: 11055) -CurtaTest:test_Initialization_DeployAddressesMatch() (gas: 11319) +CurtaTest:test_Initialization_DeployAddressesMatch() (gas: 11297) CurtaTest:test_addPuzzle() (gas: 303991) CurtaTest:test_addPuzzle_UseAuthorshipToken_UpdatesStorage() (gas: 297194) CurtaTest:test_addPuzzle_UseSameAuthorshipTokenTwice_Fails() (gas: 298014) @@ -50,20 +50,20 @@ CurtaTest:test_transferFrom_Unauthorized_RevertsUnauthorized() (gas: 411497) CurtaTest:test_transferFrom_WithApprovalForAllTrue_AllowsTransfer() (gas: 459002) CurtaTest:test_transferFrom_WithTokenApproval_AllowsTransfer() (gas: 439426) CurtaTest:test_transferFrom_WrongFrom_Fails() (gas: 406517) -DeployConstellationTest:test_AddressInitializationCorrectness() (gas: 23516) +DeployConstellationTest:test_AddressInitializationCorrectness() (gas: 23494) DeployConstellationTest:test_authorshipTokenAuthorsEquality() (gas: 20777) DeployConstellationTest:test_authorshipTokenIssueLengthEquality() (gas: 11460) DeployConstellationTest:test_authorshipTokenMinting() (gas: 91601) DeployConstellationTest:test_authorshipTokenOwnerEquality() (gas: 13799) DeployConstellationTest:test_curtaOwnerEquality() (gas: 13832) -DeployGoerliTest:test_AddressInitializationCorrectness() (gas: 23516) +DeployGoerliTest:test_AddressInitializationCorrectness() (gas: 23494) DeployGoerliTest:test_authorshipTokenAuthorsEquality() (gas: 13651) DeployGoerliTest:test_authorshipTokenIssueLengthEquality() (gas: 11460) DeployGoerliTest:test_authorshipTokenMinting() (gas: 108701) DeployGoerliTest:test_authorshipTokenOwnerEquality() (gas: 13799) DeployGoerliTest:test_curtaOwnerEquality() (gas: 13832) -DeployMainnetTest:test_AddressInitializationCorrectness() (gas: 23516) -DeployMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 184618) +DeployMainnetTest:test_AddressInitializationCorrectness() (gas: 23494) +DeployMainnetTest:test_authorshipTokenAuthorsEquality() (gas: 227362) DeployMainnetTest:test_authorshipTokenIssueLengthEquality() (gas: 11460) DeployMainnetTest:test_authorshipTokenMinting() (gas: 91601) DeployMainnetTest:test_authorshipTokenOwnerEquality() (gas: 13799) diff --git a/README.md b/README.md index 55ad5e6..bdf88b2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,49 @@ The goal of players is to view the source code of the puzzle, interpret the code Since puzzles are on-chain, everyone can view everyone else's submissions. The generative aspect prevents front-running and allows for multiple winners: even if players view someone else's solution, they still have to figure out what the rules/constraints of the puzzle are and apply the solution to their respective starting position. +## Deployments + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ChainChain IDContractAddress
Mainnet1Curta0x0000000006bC8D9e5e9d436217B88De704a9F307
AuthorshipToken0xC0ffeEb30F5aAA18Cd0a799F6dA1bdcb46f63C44
FlagRenderer0xf1a9000013303D5641f887C8E1b08D8D60101846
Goerli5Curta0x00000000eCf2b58C296B47caC8C51467c0e307cE
AuthorshipToken0xC0fFeEe59157d2dd0Ee70d4FABaBCa349b319203
FlagRenderer0xf1a9000013303D5641f887C8E1b08D8D60101846
+ ## Usage This project uses [**Foundry**](https://github.com/foundry-rs/foundry) as its development/testing framework and a [**Constellation**](https://constellation.so/) roll-up for testing. @@ -112,13 +155,11 @@ Create a file named `.env` at the root of the project and copy the contents of ` #### 2. Run commands to run deploy scripts If you are deploying to a public chain, replace `DeployMainnet` and `mainnet` with your desired chain and run the following commands: ```sh -source .env # Load environment variables forge script script/deploy/DeployMainnet.s.sol:DeployMainnet -f mainnet --broadcast --verify ``` If you are deploying to the Constellation roll-up, remove `--verify` and add `--legacy`: ```sh -source .env # Load environment variables forge script script/deploy/DeployConstellation.s.sol:DeployConstellation -f constellation --broadcast --legacy --sender $SENDER_ADDRESS ``` diff --git a/script/deploy/DeployBase.s.sol b/script/deploy/DeployBase.s.sol index 4c4be6e..b40c95c 100644 --- a/script/deploy/DeployBase.s.sol +++ b/script/deploy/DeployBase.s.sol @@ -122,10 +122,11 @@ contract DeployBase is Script { // Deploy Flag metadata and art renderer contract. flagRenderer = new FlagRenderer(); + console.log("Flag Renderer Address: ", address(flagRenderer)); // Fund each of the other deployer addresses. - payable(authorshipTokenDeployerAddress).transfer(0.25 ether); - payable(curtaDeployerAddress).transfer(0.25 ether); + payable(authorshipTokenDeployerAddress).transfer(0.4 ether); + payable(curtaDeployerAddress).transfer(0.4 ether); vm.stopBroadcast(); @@ -166,5 +167,7 @@ contract DeployBase is Script { curta.transferOwnership(curtaOwner); vm.stopBroadcast(); + console.log("AuthorshipToken Owner: ", authorshipToken.owner()); + console.log("Curta Owner: ", curta.owner()); } } diff --git a/script/deploy/DeployGoerli.s.sol b/script/deploy/DeployGoerli.s.sol index 5770b13..931ab7d 100644 --- a/script/deploy/DeployGoerli.s.sol +++ b/script/deploy/DeployGoerli.s.sol @@ -7,10 +7,10 @@ import { DeployBase } from "./DeployBase.s.sol"; contract DeployGoerli is DeployBase { /// @notice The address to transfer the ownership of the Authorship Token /// to. - address constant AUTHORSHIP_TOKEN_OWNER = 0x7A0E5c5e5E5E5E5E5E5e5E5e5E5E5E5E5E5E5e5E; + address constant AUTHORSHIP_TOKEN_OWNER = 0xA85572Cd96f1643458f17340b6f0D6549Af482F5; /// @notice The address to transfer the ownership of Curta to. - address constant CURTA_OWNER = 0x7A0E5c5e5E5E5E5E5E5e5E5e5E5E5E5E5E5E5e5E; + address constant CURTA_OWNER = 0xA85572Cd96f1643458f17340b6f0D6549Af482F5; /// @notice The number of seconds until an additional token is made /// available for minting by the author. diff --git a/script/deploy/DeployMainnet.s.sol b/script/deploy/DeployMainnet.s.sol index 8b81cfa..c159ac8 100644 --- a/script/deploy/DeployMainnet.s.sol +++ b/script/deploy/DeployMainnet.s.sol @@ -7,10 +7,10 @@ import { DeployBase } from "./DeployBase.s.sol"; contract DeployMainnet is DeployBase { /// @notice The address to transfer the ownership of the Authorship Token /// to. - address constant AUTHORSHIP_TOKEN_OWNER = 0x7A0E5c5e5E5E5E5E5E5e5E5e5E5E5E5E5E5E5e5E; + address constant AUTHORSHIP_TOKEN_OWNER = 0xA85572Cd96f1643458f17340b6f0D6549Af482F5; /// @notice The address to transfer the ownership of Curta to. - address constant CURTA_OWNER = 0x7A0E5c5e5E5E5E5E5E5e5E5e5E5E5E5E5E5E5e5E; + address constant CURTA_OWNER = 0xA85572Cd96f1643458f17340b6f0D6549Af482F5; /// @notice The number of seconds until an additional token is made /// available for minting by the author. @@ -20,6 +20,18 @@ contract DeployMainnet is DeployBase { address[] internal AUTHORS = [ // fiveoutofnine.eth 0xA85572Cd96f1643458f17340b6f0D6549Af482F5, + // fiveoutofnine.eth + 0xA85572Cd96f1643458f17340b6f0D6549Af482F5, + // fiveoutofnine.eth + 0xA85572Cd96f1643458f17340b6f0D6549Af482F5, + // fiveoutofnine.eth + 0xA85572Cd96f1643458f17340b6f0D6549Af482F5, + // fiveoutofnine.eth + 0xA85572Cd96f1643458f17340b6f0D6549Af482F5, + // shanefan.eth + 0xaFDc1A3EF3992f53C10fC798d242E15E2F0DF51A, + // Gitswitch + 0x8FC68A56f9682312953a1730Ae62AFD1a99FdC4F, // t11s.eth 0x7eD52863829AB99354F3a0503A622e82AcD5F7d3, // nick.eth diff --git a/src/AuthorshipToken.sol b/src/AuthorshipToken.sol index 4e47456..1196394 100644 --- a/src/AuthorshipToken.sol +++ b/src/AuthorshipToken.sol @@ -67,10 +67,6 @@ contract AuthorshipToken is ERC721, Owned { /// @notice The total supply of tokens. uint256 public totalSupply; - /// @notice Mapping to keep track of which addresses have claimed from - // the mint list. - mapping(address => bool) public hasClaimed; - // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- diff --git a/src/Curta.sol b/src/Curta.sol index 0e27a60..31a678d 100644 --- a/src/Curta.sol +++ b/src/Curta.sol @@ -293,13 +293,25 @@ contract Curta is ICurta, FlagsERC721, Owned { uint32 solves = getPuzzleColorsAndSolves[_puzzleId].solves; uint120 colors = getPuzzleColorsAndSolves[_puzzleId].colors; + // Phase 0 if + // `tokenData.solveTimestamp == puzzleData.firstSolveTimestamp` + // Phase 1 if + // `tokenData.solveTimestamp == puzzleData.firstSolveTimestamp + PHASE_ONE_LENGTH` + // Phase 2 if + // `tokenData.solveTimestamp == puzzleData.firstSolveTimestamp + SUBMISSION_LENGTH` + uint8 phase = tokenData.solveTimestamp == puzzleData.firstSolveTimestamp + ? 0 + : tokenData.solveTimestamp < puzzleData.firstSolveTimestamp + PHASE_ONE_LENGTH + ? 1 + : 2; + return flagRenderer.render({ _puzzleData: puzzleData, - _tokenId: _tokenId, + _tokenId: _tokenId + 1, // [MIGRATION] Increment to get rank. _author: author, _solveTime: tokenData.solveTimestamp - puzzleData.addedTimestamp, _solveMetadata: tokenData.solveMetadata, - _phase: _computePhase(puzzleData.firstSolveTimestamp, tokenData.solveTimestamp), + _phase: phase, _solves: solves, _colors: colors });