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

ERC20 private collateral_token

Instance for the collateral token in the pool.

address private collateral_address

Address of the collateral token.

address[] private owners

List of the pool owners.

address private oracle_address

Address of the oracle contract.

address private frax_contract_address

Address of the FRAX contract.

address private fxs_contract_address

Address of the FXS contract.

address private timelock_address

Address of the timelock contract.

FRAXShares private FXS

Instance of the FXS contract.

FRAXStablecoin private FRAX

Instance of the FRAX contract.

UniswapPairOracle private oracle

Instance of the oracle contract.

mapping (address => uint256) private redeemFXSBalances

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.

mapping (address => uint256) private redeemCollateralBalances

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.

uint256 public unclaimedPoolCollateral

Sum of the redeemCollateralBalances.

uint256 public unclaimedPoolFXS

Sum of the redeemFXSBalances.

mapping (address => uint256) lastRedeemed

Keeps track of the last block a given address redeemed.

uint256 private pool_ceiling

Maximum amount of collateral the pool can take.

bytes32 private constant MINT_PAUSER

AccessControl role for the mint pauser.

bytes32 private constant REDEEM_PAUSER

AccessControl role for the redeem pauser.

bytes32 private constant BUYBACK_PAUSER

AccessControl role for the buyback pauser.

bool mintPaused = false

Whether or not minting is paused.

bool redeemPaused = false

Whether or not redeem is paused.

bool buyBackPaused = false

Whether or not buyback is paused.

View Functions

unclaimedFXS

unclaimedFXS(address _account) public view returns (uint256)

Return the total amount of unclaimed FXS.

unclaimedCollateral

unclaimedCollateral(address _account) public view returns (uint256)

Return the total amount of unclaimed collateral.

collatDollarBalance

collatDollarBalance() public view returns (uint256)

Return the pool's total balance of the collateral token, in USD.

availableExcessCollatDV

availableExcessCollatDV() public view returns (uint256)

Return the pool's excess balance of the collateral token (over that required by the collateral ratio), in USD.

getCollateralPrice

getCollateralPrice() public view returns (uint256)

Return the price of the pool's collateral in USD.

Public Functions

mint1t1FRAX

mint1t1FRAX(uint256 collateral_amount_d18) external notMintPaused

Mint FRAX from collateral. Valid only when the collateral ratio is 1.

mintFractionalFRAX

mintFractionalFRAX(uint256 collateral_amount, uint256 fxs_amount) external notMintPaused

Mint FRAX from collateral and FXS. Valid only when the collateral ratio is between 0 and 1.

mintAlgorithmicFRAX

mintAlgorithmicFRAX(uint256 fxs_amount_d18) external notMintPaused

Mint FRAX from FXS. Valid only when the collateral ratio is 0.

redeem1t1FRAX

redeem1t1FRAX(uint256 FRAX_amount) external notRedeemPaused

Redeem collateral from FRAX. Valid only when the collateral ratio is 1. Must call collectionRedemption() later to collect.

redeemFractionalFRAX

redeemFractionalFRAX(uint256 FRAX_amount) external notRedeemPaused

Redeem collateral and FXS from FRAX. Valid only when the collateral ratio is between 0 and 1. Must call collectionRedemption() later to collect.

redeemAlgorithmicFRAX

redeemAlgorithmicFRAX(uint256 FRAX_amount) external notRedeemPaused

Redeem FXS from FRAX. Valid only when the collateral ratio is 0. Must call collectionRedemption() later to collect.

collectRedemption

collectRedemption() public

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

buyBackFXS(uint256 FXS_amount) external

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

recollateralizeAmount() public view returns (uint256 recollateralization_left)

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

recollateralizeFrax(uint256 collateral_amount_d18) public

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

toggleMinting() external onlyMintPauser

Toggle the ability to mint.

toggleRedeeming

toggleRedeeming() external onlyRedeemPauser

Toggle the ability to redeem.

toggleBuyBack

toggleBuyBack() external onlyBuyBackPauser

Toggle the ability to buyback.

setPoolCeiling

setPoolCeiling(uint256 new_ceiling) external onlyByOwnerOrGovernance

Set the pool_ceiling, which is the total units of collateral that the pool contract can hold.

setOracle

setOracle(address new_oracle) external onlyByOwnerOrGovernance

Set the oracle_address.

setCollateralAdd

setCollateralAdd(address _collateral_address) external onlyByOwnerOrGovernance

Set the collateral_address.

addOwner

addOwner(address owner_address) external onlyByOwnerOrGovernance

Add an address to the array of owners.

removeOwner

removeOwner(address owner_address) external onlyByOwnerOrGovernance

Remove an owner from the owners array.

Modifiers

onlyByOwnerOrGovernance

onlyByOwnerOrGovernance()

Restrict actions to the governance contract or the owner(s).

notRedeemPaused

notRedeemPaused()

Ensure redemption is not paused.

notMintPaused

notMintPaused()

Ensure minting is not paused.

Last updated