Frax Finance ¤
English 🇰🇾
Search
⌃K

Frax (FRAX)

Modified ERC-20 Contract representing the FRAX stablecoin.

Deployments

Chain
Address
Arbitrum
0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F
Aurora
0xE4B9e004389d91e4134a28F19BD833cBA1d994B6
Avalanche
0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64
Boba
0x7562F525106F5d54E891e005867Bf489B5988CD9
BSC
0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40
Ethereum
0x853d955aCEf822Db058eb8505911ED77F175b99e
Evmos
0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8
Fantom
0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355
Harmony
0xFa7191D292d5633f702B0bd7E3E3BcCC0e633200
Moonbeam
0x322E86852e492a7Ee17f28a78c663da38FB33bfb
Moonriver
0x1A93B23281CC1CDE4C4741353F3064709A16197d
Optimism
0x2E3D870790dC77A83DD1d18184Acc7439A53f475
Polygon
0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89
Solana
FR87nWEUxVgerFGhZM8Y4AggKGLnaXswr1Pd8wZ4kZcp

State Variables

ERC-20 (Inherited)

AccessControl (Inherited)

https://docs.openzeppelin.com/contracts/3.x/api/access#AccessControl NOTE: FRAX & FXS contracts have no pause or blacklist controls in any way (including system contracts).

FRAX-Specific

enum PriceChoice { FRAX, FXS }
An enum declaring FRAX and FXS. Used with oracles.
ChainlinkETHUSDPriceConsumer eth_usd_pricer
Instance for the Chainlink ETH / USD trading. Combined with FRAX / WETH, FXS / WETH, collateral / FRAX, and collateral / FXS trading pairs, can be used to calculate FRAX/FXS/Collateral prices in USD.
uint8 eth_usd_pricer_decimals
Decimals for the Chainlink ETH / USD trading pair price.
UniswapPairOracle fraxEthOracle
Instance for the FRAX / WETH Uniswap pair price oracle.
UniswapPairOracle fxsEthOracle
Instance for the FXS / WETH Uniswap pair price oracle.
address[] public owners
Array of owner address, who have privileged actions.
address governance_address
Address of the governance contract.
address public creator_address
Address of the contract creator.
address public timelock_address
Address of the timelock contract.
address public fxs_address
Address of the FXS contract
address public frax_eth_oracle_address
Address for the fraxEthOracle .
address public fxs_eth_oracle_address
Address for the fxsEthOracle .
address public weth_address
Address for the canonical wrapped-Ethereum (WETH) contract. Should be 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 for the mainnet.
address public eth_usd_consumer_address
Address for the ChainlinkETHUSDPriceConsumer .
uint256 public genesis_supply
Genesis supply of FRAX. Should be a small nonzero amount. Most of the FRAX supply will come from minting, but a small amount is needed initially to prevent divide-by-zero errors in various functions.
address[] frax_pools_array
Array of all the FraxPool contract addresses.
mapping(address => bool) public frax_pools
Essentially the same as frax_pools_array , but in mapping form. Useful for gas savings in various functions like globalCollateralValue() .
uint256 public global_collateral_ratio
The current ratio of FRAX to collateral, over all FraxPool s.
uint256 public redemption_fee
The fee for redeeming FRAX for FXS and/or collateral. Also the fee for buying back excess collateral with FXS. See the FraxPool contract for usage.
uint256 public minting_fee
The fee for minting FRAX from FXS and/or collateral. See the FraxPool contract for usage.
address public DEFAULT_ADMIN_ADDRESS
Set in the constructor. Used in AccessControl .
bytes32 public constant COLLATERAL_RATIO_PAUSER
A constant used in the pausing of the collateral ratio.
bool public collateral_ratio_paused
Whether or not the collateral ratio is paused.

View Functions

oracle_price
oracle_price(PriceChoice choice) internal view returns (uint256)
Get the FRAX or FXS price, in USD.
frax_price
frax_price() public view returns (uint256)
Returns the price for FRAX from the FRAX-ETH Chainlink price oracle.
fxs_price
fxs_price() public view returns (uint256)
Returns the price for FXS from the FXS-ETH Chainlink price oracle.
frax_info
frax_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256)
Returns some commonly-used state variables and computed values. This is needed to avoid costly repeat calls to different getter functions. It is cheaper gas-wise to just dump everything and only use some of the info.
globalCollateralValue
globalCollateralValue() public view returns (uint256)
Iterate through all FRAX pools and calculate all value of collateral in all pools globally. This uses the oracle price of each collateral.

Public Functions

refreshCollateralRatio
refreshCollateralRatio() public
This function checks the price of FRAX and refreshes the collateral ratio if the price is not $1. If the price is above $1, then the ratio is lowered by .5%. If the price is below $1, then the ratio is increased by .5%. Anyone can poke this function to change the ratio. This function can only be called once every hour.

Restricted Functions

mint
mint(uint256 amount) public virtual onlyByOwnerOrGovernance
Public implementation of internal _mint().
pool_burn_from
pool_burn_from(address b_address, uint256 b_amount) public onlyPools
Used by pools when user redeems.
pool_mint
pool_mint(address m_address, uint256 m_amount) public onlyPools
This function is what other frax pools will call to mint new FRAX.
addPool
addPool(address pool_address) public onlyByOwnerOrGovernance
Adds collateral addresses supported, such as tether and busd, must be ERC20.
removePool
removePool(address pool_address) public onlyByOwnerOrGovernance
Remove a pool.
setOwner
setOwner(address owner_address) public onlyByOwnerOrGovernance
Sets the admin of the contract
setFraxStep
setFraxStep(uint256 _new_step) public onlyByOwnerOrGovernance
Sets the amount that the collateral ratio will change by upon an execution of refreshCollateralRatio(),
setPriceTarget
setPriceTarget(uint256 _new_price_target) public onlyByOwnerOrGovernance
Set the price target to be used for refreshCollateralRatio() (does not affect minting/redeeming).
setRefreshCooldown
setRefreshCooldown(uint256 _new_cooldown) public onlyByOwnerOrGovernance
Set refresh cooldown for refreshCollateralRatio().
setRedemptionFee
setRedemptionFee(uint256 red_fee) public onlyByOwnerOrGovernance
Set the redemption fee.
setMintingFee
setMintingFee(uint256 min_fee) public onlyByOwnerOrGovernance
Set the minting fee.
setFXSAddress
setFXSAddress(address _fxs_address) public onlyByOwnerOrGovernance
Set the FXS address.
setETHUSDOracle
setETHUSDOracle(address _eth_usd_consumer_address) public onlyByOwnerOrGovernance
Set the ETH / USD oracle address.
setFRAXEthOracle
setFRAXEthOracle(address _frax_addr, address _weth_address) public onlyByOwnerOrGovernance
Sets the FRAX / ETH Uniswap oracle address
setFXSEthOracle
setFXSEthOracle(address _fxs_addr, address _weth_address) public onlyByOwnerOrGovernance
Sets the FXS / ETH Uniswap oracle address
toggleCollateralRatio
toggleCollateralRatio() public onlyCollateralRatioPauser
Toggle pausing / unpausing the collateral ratio.

Events

FRAXBurned
FRAXBurned(address indexed from, address indexed to, uint256 amount)
Emitted when FRAX is burned, usually from a redemption by the pool.

Modifiers

onlyCollateralRatioPauser
onlyCollateralRatioPauser()
Restrict actions to the designated collateral ratio pauser.
onlyPools
onlyPools()
Restrict actions to pool contracts, e.g. minting new FRAX.
onlyByGovernance
onlyByGovernance()
Restrict actions to the governance contract, e.g. setting the minting and redemption fees, as well as the oracle and pool addresses.
onlyByOwnerOrGovernance
onlyByOwnerOrGovernance()
Restrict actions to the governance contract or owner account(s), e.g. setting the minting and redemption fees, as well as the oracle and pool addresses.