Ante Test Series #5: Olympus V2 - Ante Finance - Medium
January 18th, 2022
A bit whale-ish
A bit whale-ish

gm frens! Welcome back to the Ante Test Series (check out our last writeup on Alchemix here). This week’s focus is everyone’s favorite Greco-mythical rebasing token, Olympus (OHM).

Whence OHM?

Olympus is an algorithmic reserve currency backed by decentralized assets that aims to be a standard store of value. Each OHM is backed at least 1:1 by 1 DAI equivalent of assets, and the price is is maintained above that level via buyback-and-burn (kind of the decentralized equivalent of a share repurchase program).

After tremendous growth in its first year (hitting nearly $900M in TVL at point), Olympus V2 was announced in Oct 2021 and migration commenced in Dec 2021. V2 Bonds went live recently with a cornucopia of upgraded features including updated payouts and vesting.

But IS it really backed? Ante Tests can verify.

Any time an upgrade or a new version of product is released, it’s important to verify that any desirable properties of the original still hold true (see our Compound test writeup for an example where a contract upgrade broke existing functionality). In this case, we can use an Ante Test to verify that OHMv2 continues to serve its stated purpose as a reserve currency by checking that it’s backed at least 1:1 by reserves and liquidity tokens in the Olympus treasury.

Checking OHM is backed

The idea for an OHM backing test was originally proposed by Ante contributor grokasm (view their test code for Olympus V1 here). The test works by looping through the list of reserve and liquidity tokens in the Olympus treasury and comparing it to the total supply of OHM.

Checking the OHMv2 token supply is easy enough; we just call totalSupply() on the token contract.

Getting the total treasury backing requires a little more work. The treasury address itself could change in the future and is now read through the OlympusAuthority contract. We implement the following helper function to return the current treasury address:

To sum up the total backing, we can iterate through the list of reserve and liquidity tokens in the treasury and add the value of each to a running total. Normally, we could check the registry of tokens in the Olympus treasury contract to get an up-to-date list of approved liquidity and reserve tokens. Unfortunately, the current version of the treasury contract does not have a functioning token registry, so we need to manually pass in the addresses of the approved liquidity and reserve tokens we want to check. The tokens approved at the time of our test deployment are: DAI (reserve token), FRAX (reserve token), and OHM/FRAX SLP (liquidity token).

*Note: Because the token addresses must be passed in manually through the constructor and cannot be changed after deployment, the Ante Test will not capture any token addresses subsequently added to or removed from the Olympus treasury token registry (a new Ante Test including any updated token addresses could be deployed if one wanted to include any changes in token addresses). ****This means that the Ante Test could fail even if OHM is still fully backed if Olympus changes the composition of their reserve and liquidity tokens. ***If you are considering staking or challenging the OHMv2 Ante Test, as with any smart contract, you should review the code before interacting with it, and never deposit more than you can afford to lose.

summing up reserve token balances

We loop through our list of reserve tokens, then loop through the list of liquidity tokens in a similar fashion to get the total treasury backing. Lastly, we compare the total backing against the supply of OHMv2 and fail the test if the OHM token is not fully backed by the Olympus treasury assets tested.

*scratchy prophetic voice* Should this fail, theomachy draws nigh

Check out the full test code here, and live test on Ante here!

Conclusion

When code is law, it’s important to verify that it works as intended if you don’t want to get rekt. Ante is a piece of Web3 infrastructure that makes on-chain guarantees easier to check. We hope fast-moving projects add Ante Tests to their launch checklist in the future (alongside audits, bug bounties, etc.) to provide their users with peace of mind that their innovative new features are working as specified.

We encourage everyone to write Ante Tests (Check out our community GitHub where other community members have written Ante Tests) and/or ask your favorite protocols to write and stake their own Ante Tests! Together, we can build a safer Web3 community!

What other protocols would you want to see Ante Tests written for? Let us know in the comments or via Twitter, and join our Discord for more Web3 security discussion!

Subscribe to Ante Finance
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from Ante Finance

Skeleton

Skeleton

Skeleton