Skip to content
/ curta Public
forked from waterfall-mkt/curta

A CTF protocol, where players create and solve EVM puzzles to earn NFTs.

License

Notifications You must be signed in to change notification settings

yorhodes/curta

 
 

Repository files navigation

Screen Shot 2023-09-14 at 7 36 25 PM

Curta

Website - Docs - Twitter

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.

Deployments

Chain Chain ID Contract Address
Mainnet 1 Curta 0x0000000006bC8D9e5e9d436217B88De704a9F307
AuthorshipToken 0xC0ffeEb30F5aAA18Cd0a799F6dA1bdcb46f63C44
FlagRenderer 0xf1a9000013303D5641f887C8E1b08D8D60101846
Goerli 5 Curta 0x00000000eCf2b58C296B47caC8C51467c0e307cE
AuthorshipToken 0xC0fFeEe59157d2dd0Ee70d4FABaBCa349b319203
FlagRenderer 0xf1a9000013303D5641f887C8E1b08D8D60101846

Usage

This project uses Foundry as its development/testing framework and a Constellation roll-up for testing.

Installation

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

Testing

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

Coverage

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.

Snapshot

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

Deploying

1. Set environment variables

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_CONSTELLATION An RPC endpoint for the Constellation chain
RPC_URL_GOERLI An RPC endpoint for Goerli
RPC_URL_MAINNET An RPC endpoint for mainnet
API keys ETHERSCAN_KEY An Etherscan 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 :).

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:

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:

forge script script/deploy/DeployConstellation.s.sol:DeployConstellation -f constellation --broadcast --legacy --sender $SENDER_ADDRESS

Acknowledgements

About

A CTF protocol, where players create and solve EVM puzzles to earn NFTs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%