Skip to content

Commit

Permalink
Add deploys (#22)
Browse files Browse the repository at this point in the history
* chore: update deploy config

* chore: update some deploy config stuff

* docs: add deployments

* docs: add deployments

* docs: remove <code>

* docs: fix script commands

---------

Co-authored-by: e6f4e37l <66016924+e6f4e37l@users.noreply.github.com>
  • Loading branch information
fiveoutofnine and fiveoutofnine committed Mar 3, 2023
1 parent bf1ada9 commit 2d5de33
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 22 deletions.
16 changes: 8 additions & 8 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<table>
<thead>
<tr>
<th>Chain</th>
<th>Chain ID</th>
<th>Contract</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">Mainnet</td>
<td rowspan="3">1</td>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/Curta.sol">Curta</a></code></td>
<td><code><a href="https://etherscan.io/address/0x0000000006bC8D9e5e9d436217B88De704a9F307">0x0000000006bC8D9e5e9d436217B88De704a9F307</code></td>
</tr>
<tr>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/AuthorshipToken.sol">AuthorshipToken</a></code></td>
<td><code><a href="https://etherscan.io/address/0xC0ffeEb30F5aAA18Cd0a799F6dA1bdcb46f63C44">0xC0ffeEb30F5aAA18Cd0a799F6dA1bdcb46f63C44</code></td>
</tr>
<tr>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/FlagRenderer.sol">FlagRenderer</a></code></td>
<td><code><a href="https://etherscan.io/address/0xf1a9000013303D5641f887C8E1b08D8D60101846">0xf1a9000013303D5641f887C8E1b08D8D60101846</code></td>
</tr>
<tr>
<td rowspan="3">Goerli</td>
<td rowspan="3">5</td>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/Curta.sol">Curta</a></code></td>
<td><code><a href="https://goerli.etherscan.io/address/0x00000000eCf2b58C296B47caC8C51467c0e307cE">0x00000000eCf2b58C296B47caC8C51467c0e307cE</code></td>
</tr>
<tr>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/AuthorshipToken.sol">AuthorshipToken</a></code></td>
<td><code><a href="https://goerli.etherscan.io/address/0xC0fFeEe59157d2dd0Ee70d4FABaBCa349b319203">0xC0fFeEe59157d2dd0Ee70d4FABaBCa349b319203</code></td>
</tr>
<tr>
<td><code><a href="https://github.com/waterfall-mkt/curta/blob/main/src/FlagRenderer.sol">FlagRenderer</a></code></td>
<td><code><a href="https://goerli.etherscan.io/address/0xf1a9000013303D5641f887C8E1b08D8D60101846">0xf1a9000013303D5641f887C8E1b08D8D60101846</code></td>
</tr>
</tbody>
<table>

## 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.

Expand Down Expand Up @@ -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
```

Expand Down
7 changes: 5 additions & 2 deletions script/deploy/DeployBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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());
}
}
4 changes: 2 additions & 2 deletions script/deploy/DeployGoerli.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 14 additions & 2 deletions script/deploy/DeployMainnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/AuthorshipToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -------------------------------------------------------------------------
Expand Down
16 changes: 14 additions & 2 deletions src/Curta.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down

0 comments on commit 2d5de33

Please sign in to comment.