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.
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-golf.git
cd curta-golf
forge installTo run tests, run the following command:
forge testTo 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 -vvvTo view coverage, run the following command:
forge coverageTo generate a report, run the following command:
forge coverage --report lcovNote
It may be helpful to use an extension like Coverage Gutters to display the coverage over the code.
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> \
--broadcastIf 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>.
