Writing an Ante Test
Four steps to writing your first Ante Test
Writing an Ante Test is easy to do! It's also a fantastic way to level up your Solidity skills as you read and think about the workings of the smart contracts that underlie your favorite DeFi protocols. To guide you through the process, we've listed out the basic steps below.
Is this the face of a liar? I think not.

1. Think of the invariant you want to test

Ante Tests are single-failure tests of on-chain protocol invariants. Invariants should reflect fundamental guarantees that a protocol should satisfy. Some examples of invariants you could write an Ante Test for include:
  • Plunge protection test – Contract assets do not drop below some threshold
  • Loan solvency test – Collateral asset value exceeds issued liabilities by some factor
  • APY guarantee test – APY over a given time period exceeds the rate advertised
For more ideas, check out a longer list below. The possibilities are endless!

2. Fork the Ante community test repository

Forking the antefinance/ante-community-tests repository will allow you to work on your own local copy of the repository that includes all the necessary starter code and other community tests for reference.
On the repository page, click Fork to create a copy of the repository under your GitHub profile.
Once you've forked the repository, you can clone the repository to your local machine.

3. Write your Ante Test

It's time to open up your favorite IDE/text editor and start coding!
All Ante Tests need to implement the IAnteTest.sol interface to work with Ante. To make it easier to work with, we have implemented the abstract class AnteTest.sol that any Ante Test can inherit.
You can start by copying another Ante Test in the repository, or you can use the following skeleton code:
import "@antefinance/contracts/interfaces/AnteTest.sol";
contract MyAnteTest is AnteTest("String descriptor of test") {
// create Ante Test variables & insert logic here
// you can omit your constructor if not defining these optional parameters
constructor () {
protocolName = "My Protocol";
testedContracts = [0x000000000000000000000000000000000000dEaD];
function checkTestPasses() public view override returns (bool) {
// insert logic here to check the My Protocol invariant

4. Create a pull request to the Ante community test repository

If you're comfortable deploying your own smart contracts, you can do it yourself.
If you don't want to go through the hassle of deploying the test yourself, though, you can open a pull request to the ante community test repository:
  1. 1.
    Click Pull request on the repository page.
  2. 2.
    Select the base and head branches you want to merge
  3. 3.
    Add a quick description, and click Create Pull Request.
That's it! A member of the Ante team will review your test and add it to the main community repository.