Skip to content

A king-of-the-hill style competition, where players optimize gas challenges.

License

Notifications You must be signed in to change notification settings

waterfall-mkt/curta-golf

Repository files navigation

Curta Golf

Website - Docs - Twitter

A king-of-the-hill style competition, where players optimize gas challenges.

The goal of players is to view Courses (challenges) and try to implement the most optimized solution for it. If the solution is valid, a Par Token with the corresponding metadata will be minted to their address. If it's the most efficient, they will be crowned the "King," and King NFT will be transferred to them.

Deployments

Chain Chain ID Contract v0.0.1 v0.0.2
Base 8453 CurtaGolf 0xb8d97B24935C70cD931bbc6150e2596570997cE9 0x8ccd70b1b74ea505dba39d2d11c3ab6a2cb14a8c
Par 0x6B780314f95452E37D88A2F950Bbd3885851fD10 0xde26c7d0a4ae6956bfb893c80c4418d84e389aca
PurityChecker 0xE03Bbdb59444581f54f6823F0091FdF738E3Ce62 0xb2eb169f5f957adf0d78fa7897f72c9be70c56e4
KingArt 0xcD1842728b73611445c87801889CAE24CF5502c6
ParArt 0xBc475ce743B5C331A62d55Ce19A83De47d978e1C
Perlin 0x5499e963931d359553380bCA52077ecB0E2419d6

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-golf.git
cd curta-golf
forge install

Testing

To run tests, run the following command:

forge test

To test the metadata output for King and Art, run the following commands:

forge script script/metadata/PrintKingArt.s.sol:PrintKingArtScript --via-ir -vvv
forge script script/metadata/PrintPartArt.s.sol:PrintPartArtScript --via-ir -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.

Deploying

There are three core contracts that get deployed in Deploy.s.sol: PurityChecker.sol, Par.sol, and CurtaGolf.sol. We also make use of three external libraries. These are: Perlin.sol, ParArt.sol, and KingArt.sol. Perlin.sol is used by KingArt.sol, which is used by KingERC721.sol, which is inherited by CurtaGolf.sol, and ParArt.sol is used by Par.sol. We include these in foundry.toml if we don't want them to be deployed alongside the contracts that use them. Otherwise, as an example, Perlin.sol and KingArt.sol would be deployed alongside CurtaGolf.sol.

A standard example for deploying everything would look like this:

forge script script/Deploy.s.sol:Deploy \
--rpc-url <rpc_url> \
--sender <sender> \
--account <account> \
--broadcast

If libraries have already been deployed we would do:

forge script script/Deploy.s.sol:Deploy \
--rpc-url <rpc_url> \
--sender <sender> \
--account <account> \
--broadcast \
--libraries src/utils/Perlin.sol:Perlin:<address> \
--libraries src/utils/metadata/KingArt.sol:KingArt:<address> \
--libraries src/utils/metadata/ParArt.sol:ParArt:<address>

Note

When using forge verify-contract to verify a contract on a contract with libraries, the --libraries arg needs to be supplied in the form --libraries <remapped path to lib>:<library name>:<address>.

Acknowledgements