Curve AMO

A description of the Curve AMO smart contract

iterate() The iterate function calculates the balances of FRAX and 3CRV in the metapool in the hypothetical worst-case assumption of FRAX price falling to the CR. To start, the function takes the current live balances of the metapool and simulates an external arbitrageur swapping 10% of the current FRAX in the metapool until the price given is equal (or close to) the CR, swapping out the corresponding amount of 3CRV. This simulates the situation wherein the open-market price of FRAX falls to the CR, and the resulting 1-to-1 swap normally offered by the metapool is picked off by arbitrageurs until there is no more profit to be had by buying FRAX elsewhere for the CR price and selling it into the metapool. Line 282 is the specific location where the price of FRAX is checked.

Then, the metapool checks how much its LP tokens would withdraw in that worst-case scenarios in terms of the underlying FRAX and 3CRV. The ratio between the two is normally tilted roughly 10-to-1 in terms of FRAX withdrawable to 3CRV withdrawable. For the protocol's accounting of how much collateral it has, it values each 3CRV withdrawable at the underlying collateral value (i.e. how much USDC it can redeem for it) and each FRAX at the collateral ratio. Since the protocol never actually sends this much FRAX into circulation under normal circumstances, this is a highly conservative estimate on the amount of collateral it is actually entitled to in terms of USDC.

To check scenarios of how much reserves would be indebted to the Curve AMO at other prices, one may simply adjust the fraxFloor() value in local testing through setting a custom_floor.