A CTF protocol, where players create and solve EVM puzzles to earn NFTs.
The goal of players is to view the source code of the puzzle, interpret the code, solve it as if it was a regular puzzle, then verify the solution on-chain. If the solution is valid, a Flag Token with the corresponding metadata will be minted to their address.
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.
This project uses Foundry as its development/testing framework.
First, make sure you have Foundry installed. Then, run the following commands to clone the repo and install its dependencies:
git clone https://github.com/waterfall-mkt/curta.git
cd curta
forge install
To run tests, run the following command:
forge test
If you'd like to test on a mainnet fork or view a sample AuthorshipToken.tokenURI
output, run the following command:
forge test -f mainnet -vvv
Alternatively, to test the metadata output, follow the instructions in PrintAuthorshipTokenScript
, and run the following command:
forge script script/PrintAuthorshipToken.s.sol:PrintAuthorshipTokenScript -f mainnet -vvv
To view coverage, run the following command:
forge coverage
To generate a report, run the following command:
forge coverage --report lcov
Note It may be helpful to use an extension like Coverage Gutters to display the coverage over the code.
To obtain the same .gas-snapshot
output as the CI tests, copy .env.example
into your .env
file, and run the following command:
forge snapshot
Create a file named .env
at the root of the project and copy the contents of .env.example
into it. Then, fill out each of the variables:
Category | Variable | Description |
---|---|---|
Deploy script configuration | DEPLOYER_PRIVATE_KEY |
The account to deploy an instance of FlagRenderer and fund each account below with 0.25 ETH each to deploy the protocol |
AUTHORSHIP_TOKEN_PRIVATE_KEY |
The account to deploy AuthorshipToken |
|
CURTA_PRIVATE_KEY |
The account to deploy Curta |
|
RPC endpoints | RPC_URL_GOERLI |
An RPC endpoint for Goerli |
RPC_URL_MAINNET |
An RPC endpoint for mainnet | |
RPC_URL_BASE_GOERLI |
An RPC endpoint for Base Goerli | |
RPC_URL_BASE_MAINNET |
An RPC endpoint for Base mainnet | |
API keys | ETHERSCAN_KEY |
An Etherscan API key for verifying contracts |
BASESCAN_KEY |
A Basescan API key for verifying contracts |
Warning
If accounts specified by AUTHORSHIP_TOKEN_PRIVATE_KEY
or CURTA_PRIVATE_KEY
have a nonzero account nonce (i.e. they have sent transactions) or are equal, the deploy script will most likely fail due to incorrect contract address precomputation (the script assumes each account has a nonce of 0).
Note
The reason the addresses are precomputed are because AuthorshipToken
and Curta
must know each other's addresses when being deployed. Also, it allows for vanity addresses :).
If you are deploying to a public chain, replace DeployMainnet
and mainnet
with your desired chain and run the following commands:
forge script script/deploy/DeployMainnet.s.sol:DeployMainnet -f mainnet --broadcast --verify