Follow this guide to write an Ante Test and submit a PR.
Suggest test ideas or ask questions in Discord.
Learn about Ante: ante.finance | Twitter | YouTube
-
Install Node and NPM (Instructions)
Make sure to use Node version 14 or higher and NPM version 6 or higher
-
Fork the ante-community-tests repository by clicking the
Fork
button in the upper right hand corner of this page, then clone your fork to your local machine withgit clone git@github.com:[YOUR_GITHUB_USERNAME]/ante-community-tests.git
-
Install all required packages
npm install --save-dev
-
Copy the file
.env.example
to a new file named.env
(cp .env.example .env
) and edit it to fill in required values:- To run the testing suite, you'll need a free Alchemy API key (after creating an account, you can copy it from https://auth.alchemy.com/)
- To deploy contracts, you'll need a free Infura API key as well as a mnemonic/private key (if you do not have a mnemonic you can use
test test test test test test test test test test test junk
) - To verify deployed contracts, you'll need free block explorer API keys (e.g. Etherscan)
-
Install Foundry (Instructions)
Write an ante test for your desired protocol and put it in a file called ./contracts/[PROTOCOL_NAME]/[YOUR_TEST_NAME].sol
. For more information on writing Ante Tests, see our docs. Ask questions in Discord!
We recommend writing unit tests to make sure your Ante Test works. Unit tests live in the test
directory.
Using Hardhat
-
Create a file in the
./test/[PROTOCOL_NAME]
folder with filename[YOUR_TEST_NAME].spec.ts
-
Fill in the
NETWORK
fieldin your.env
file with the network you intend to test on. -
Run the following command:
npx hardhat test test/[PROTOCOL_NAME]/[YOUR_TEST_NAME].spec.ts
Troubleshooting: If you are trying to run the testing suite with
npx hardhat test
, you must runnpx hardhat typechain
first to avoid an error where hardhat cannot find the typechain directoryTroubleshooting: If you run into an error about
hardhat-foundry
(eg "Error in plugin hardhat-foundry: Couldn't runforge
. Please check that your foundry installation is correct.") you may need to runyarn add --dev hardhat-foundry
Using Foundry
-
Create a file in the
./test/[PROTOCOL_NAME]
folder with filename[YOUR_TEST_NAME].t.sol
-
Use
forge test
to run all Forge tests, or run a specific test with:forge test --match-path test/[PROTOCOL_NAME]/[YOUR_TEST_NAME].t.sol
-
Push your code to your own GitHub repo and create a pull request against this repo
-
Show off what you've built in our discord or tweet your PR at us on twitter!
-
Once your PR has been merged in, feel free to deploy your test and pool!
VERY IMPORTANT - Make sure to get feedback from our community before deploying your Ante Test to mainnet! Testing and feedback are the best way to catch bugs early (and avoid wasting gas).