Skip to content

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

License

Notifications You must be signed in to change notification settings

sphinx-labs/curta

 
 

Repository files navigation

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 v0.0.1 v0.0.2
Mainnet 1 Curta 0x0000000006bC8D9e5e9d436217B88De704a9F307 N/A
AuthorshipToken 0xC0ffeEb30F5aAA18Cd0a799F6dA1bdcb46f63C44 N/A
FlagRenderer 0xf1a9000013303D5641f887C8E1b08D8D60101846 N/A
Goerli 5 Curta 0x00000000eCf2b58C296B47caC8C51467c0e307cE N/A
AuthorshipToken 0xC0fFeEe59157d2dd0Ee70d4FABaBCa349b319203 N/A
FlagRenderer 0xf1a9000013303D5641f887C8E1b08D8D60101846 N/A
Base Mainnet 8453 Curta N/A 0x00000000D1329c5cd5386091066d49112e590969
AuthorshipToken N/A 0xC0FFEE8b8e502403e51f37030E32c52bA4b37f7d
FlagRenderer N/A 0xF1a900007c8b1d6266c186Aa2Ef0eE2e95ffCa80
TeamRegistry N/A 0xFacaDE0BCAeBb9B48bd1f613d2fd9B9865A3E61d
Base Goerli 84531 Curta N/A 0x00000000D1329c5cd5386091066d49112e590969
AuthorshipToken N/A 0xC0FFEE8b8e502403e51f37030E32c52bA4b37f7d
FlagRenderer N/A 0xF1a900007c8b1d6266c186Aa2Ef0eE2e95ffCa80
TeamRegistry N/A 0xFacaDE0BCAeBb9B48bd1f613d2fd9B9865A3E61d

Usage

This project uses Foundry as its development/testing framework.

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_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 :).

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

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 99.2%
  • JavaScript 0.8%