Ante
Ante v0.5
Ante v0.5
  • Welcome to Ante v0.5
  • How Ante works
  • Why use Ante?
    • How is Ante different?
    • What does Ante cost to use?
  • What's in Ante v0.5?
  • Using the Ante App
    • Navigating Ante
    • How to Stake
    • How to Challenge & Check Tests
    • The Decentralized Trust Score
      • Decentralized Trust Tiers
    • Deposit Limits
  • For Developers
    • Writing an Ante Test
      • Coming up with an invariant
      • Explaining IAnteTest.sol and AnteTest.sol
      • Ante Test Examples
      • Writing and Testing an Ante Test
      • Test an Ante Test Offline
      • Adding an Ante Test to Ante Github
      • Development FAQs
    • Integrating Ante
      • Integrate Ante using React
      • Integrate Ante using HTML
    • Deploying an Ante Test
      • Deploy an Ante Test
      • Create an Ante Pool
      • Verifying an Ante Pool
    • Contracts
  • About Ante
    • FAQs
    • Glossary
    • Security
    • Possible Future Work
    • Changelog
    • Terms of Service
Powered by GitBook
On this page
  1. For Developers
  2. Writing an Ante Test

Coming up with an invariant

Can't think of any tests? Maybe one of these will spark some inspiration!

Ante Tests are single-failure tests of on-chain protocol invariants. Invariants should reflect fundamental guarantees that a protocol should satisfy.

Take care when defining your project's invariants.

Only define invariants you believe will never fail.

It's the guarantee you are making and potentially staking ETH on.

Here is an non-exhaustive list of invariants you might decide to write an Ante Test for (in no particular order):

  • "Rug" test – check that contract-controlled assets are not drained

  • Plunge protection test – check that contract assets do not drop below some threshold

  • Peg test – check to see that two pegged assets stay pegged in price

    • Note: in order to avoid flash loan manipulation of the Ante Test, this should be implemented against time-weighted average prices (TWAP) rather than spot prices

  • Solvency test – Collateral asset value exceeds liabilities by some factor

  • Bonding curve test – check that the bonding curve calculation (e.g. x*y=k) holds for an automated market maker (AMM) protocol

  • APY guarantee test – check that actual rewards issued by a contract over a given time period exceeds the APY rate advertised by the protocol

  • DAO implementation test – check that a proposal passed by a DAO was actually implemented

    • Checking outcomes can be tricky given the complexity and heterogeneity of outcomes. Defining a narrow test can help manage some of the complexity

    • Alternatively, this can be made generalized by having the DAO vote again on their satisfaction with the implementation outcome and having the Ante Test check the vote result

  • Access test – check that funds can be withdrawn from contract in an expected manner

  • Market cap test – check that the total value of contract assets exceeds some threshold

  • Volume test – check that at least X unique wallets/transactions/etc. use a given protocol over a given time period

These are just some of the many possible Ante Tests that could be written. Happy writing!

PreviousWriting an Ante TestNextExplaining IAnteTest.sol and AnteTest.sol

Last updated 3 years ago

Have an idea for a test? We'd love to hear about it! Message us on / or drop us a line at !

Twitter
Discord
hello@ante.finance