Frax V1 Pool ABI & Addresses
Contract used for minting and redeeming FRAX, as well as buying back excess collateral.
⚠️ This pool has been deprecated in favor of FRAX V2 and later mechanisms ⚠️
Deployment
Frax Pool contracts are deployed and permissioned from the governance system, meaning that a new type of collateral may be added at any time after a governance proposal succeeds and is executed. The current pool is USDC, with further collateral types open for future pools.
USDC: 0x3C2982CA260e870eee70c423818010DfeF212659
Description
A Frax Pool is the smart contract that mints FRAX tokens to users for placing collateral or returns collateral by redeeming FRAX sent into the contract. Each Frax Pool has a different type of accepted collateral. Frax Pools can be in any kind of cryptocurrency, but stablecoins are easiest to implement due to their small fluctuations in price. Frax is designed to accept any type of cryptocurrency as collateral, but low volatility pools are preferred at inception since they do not change the collateral ratio erratically. There are promising new projects, such as Reflex Bonds, which dampen the volatility of their underlying crypto assets. Reflex Bonds could make for ideal FRAX collateral in the future. New Frax Pools can be added through FXS governance votes.
Each pool contract has a pool ceiling (the maximum allowable collateral that can be stored to mint FRAX) and a price feed for the asset. The initial Frax Pool at genesis will be USDC (USD Coin) and USDT (Tether) due to their large market capitalization, stability, and availability on Ethereum.
The pools operate through permissioned calls to the FRAXStablecoin (FRAX) and FRAXShare (FXS) contracts to mint and redeem the protocol tokens.
Minting and Redeeming FRAX
The contract has 3 minting functions: mint1t1FRAX(), mintFractionalFRAX(), and mintAlgorithmicFRAX(). The contract also has 3 redemption functions that mirror the minting functions: redeem1t1FRAX(), redeemFractionalFRAX(), redeemAlgorithmicFRAX(). The functions are separated into 1 to 1, fractional, and algorithmic phases to optimize gas usage. The 1 to 1 minting and redemption functions are only available when the collateral ratio is 100%. The fractional minting and redemption functions are only available between a collateral ratio of 99.99% and 0.01%. The algorithmic minting and redemption functions are only available at a ratio of 0%.
Slippage
Each of the minting and redeeming functions also has an AMOUNT_out_min
parameter that specifies the minimum units of tokens expected from the transaction. This acts as a limit for slippage tolerance when submitting transactions, as the prices may update from the time a transaction is created to the time it is included in a block.
State Variables
AccessControl (Inherited)
https://docs.openzeppelin.com/contracts/3.x/api/access#AccessControl
FraxPool-Specific
Instance for the collateral token in the pool.
Address of the collateral token.
List of the pool owners.
Address of the oracle contract.
Address of the FRAX contract.
Address of the FXS contract.
Address of the timelock contract.
Instance of the FXS contract.
Instance of the FRAX contract.
Instance of the oracle contract.
Keeps track of redemption balances for a given address. A redeemer cannot both request redemption and actually redeem their FRAX in the same block. This is to prevent flash loan exploits that could crash FRAX and/or FXS prices. They have to wait until the next block. This particular variable is for the FXS portion of the redemption.
Keeps track of redemption balances for a given address. A redeemer cannot both request redemption and actually redeem their FRAX in the same block. This is to prevent flash loan exploits that could crash FRAX and/or FXS prices. They have to wait until the next block. This particular variable is for the collateral portion of the redemption.
Sum of the redeemCollateralBalances
.
Sum of the redeemFXSBalances
.
Keeps track of the last block a given address redeemed.
Maximum amount of collateral the pool can take.
AccessControl
role for the mint pauser.
AccessControl
role for the redeem pauser.
AccessControl
role for the buyback pauser.
Whether or not minting is paused.
Whether or not redeem is paused.
Whether or not buyback is paused.
View Functions
unclaimedFXS
Return the total amount of unclaimed FXS.
unclaimedCollateral
Return the total amount of unclaimed collateral.
collatDollarBalance
Return the pool's total balance of the collateral token, in USD.
availableExcessCollatDV
Return the pool's excess balance of the collateral token (over that required by the collateral ratio), in USD.
getCollateralPrice
Return the price of the pool's collateral in USD.
Public Functions
mint1t1FRAX
Mint FRAX from collateral. Valid only when the collateral ratio is 1.
mintFractionalFRAX
Mint FRAX from collateral and FXS. Valid only when the collateral ratio is between 0 and 1.
mintAlgorithmicFRAX
Mint FRAX from FXS. Valid only when the collateral ratio is 0.
redeem1t1FRAX
Redeem collateral from FRAX. Valid only when the collateral ratio is 1. Must call collectionRedemption()
later to collect.
redeemFractionalFRAX
Redeem collateral and FXS from FRAX. Valid only when the collateral ratio is between 0 and 1. Must call collectionRedemption()
later to collect.
redeemAlgorithmicFRAX
Redeem FXS from FRAX. Valid only when the collateral ratio is 0. Must call collectionRedemption()
later to collect.
collectRedemption
After a redemption happens, transfer the newly minted FXS and owed collateral from this pool contract to the user. Redemption is split into two functions to prevent flash loans from being able to take out FRAX / collateral from the system, use an AMM to trade the new price, and then mint back into the system.
buyBackFXS
Function can be called by an FXS holder to have the protocol buy back FXS with excess collateral value from a desired collateral pool. This can also happen if the collateral ratio > 1
recollateralizeAmount
When the protocol is recollateralizing, we need to give a discount of FXS to hit the new CR target. Returns value of collateral that must increase to reach recollateralization target (if 0 means no recollateralization)
recollateralizeFrax
Thus, if the target collateral ratio is higher than the actual value of collateral, minters get FXS for adding collateral. This function simply rewards anyone that sends collateral to a pool with the same amount of FXS + .75%. Anyone can call this function to recollateralize the protocol and take the hardcoded .75% arb opportunity
Restricted Functions
toggleMinting
Toggle the ability to mint.
toggleRedeeming
Toggle the ability to redeem.
toggleBuyBack
Toggle the ability to buyback.
setPoolCeiling
Set the pool_ceiling
, which is the total units of collateral that the pool contract can hold.
setOracle
Set the oracle_address
.
setCollateralAdd
Set the collateral_address
.
addOwner
Add an address to the array of owners.
removeOwner
Remove an owner from the owners array.
Modifiers
onlyByOwnerOrGovernance
Restrict actions to the governance contract or the owner(s).
notRedeemPaused
Ensure redemption is not paused.
notMintPaused
Ensure minting is not paused.
Last updated