Frax (FRAX)
Modified ERC-20 Contract representing the FRAX stablecoin.

Deployments

Chain
Address
Arbitrum
0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F
Avalanche
0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64
Boba
0x7562F525106F5d54E891e005867Bf489B5988CD9
BSC
0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40
Ethereum
0x853d955aCEf822Db058eb8505911ED77F175b99e
Fantom
0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355
Harmony
0xFa7191D292d5633f702B0bd7E3E3BcCC0e633200
Moonriver
0x1A93B23281CC1CDE4C4741353F3064709A16197d
Polygon
0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89
Solana
FR87nWEUxVgerFGhZM8Y4AggKGLnaXswr1Pd8wZ4kZcp

State Variables

ERC-20 (Inherited)

AccessControl (Inherited)

FRAX-Specific

1
enum PriceChoice { FRAX, FXS }
Copied!
An enum declaring FRAX and FXS. Used with oracles.
1
ChainlinkETHUSDPriceConsumer eth_usd_pricer
Copied!
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.
1
uint8 eth_usd_pricer_decimals
Copied!
Decimals for the Chainlink ETH / USD trading pair price.
1
UniswapPairOracle fraxEthOracle
Copied!
Instance for the FRAX / WETH Uniswap pair price oracle.
1
UniswapPairOracle fxsEthOracle
Copied!
Instance for the FXS / WETH Uniswap pair price oracle.
1
address[] public owners
Copied!
Array of owner address, who have privileged actions.
1
address governance_address
Copied!
Address of the governance contract.
1
address public creator_address
Copied!
Address of the contract creator.
1
address public timelock_address
Copied!
Address of the timelock contract.
1
address public fxs_address
Copied!
Address of the FXS contract
1
address public frax_eth_oracle_address
Copied!
Address for the fraxEthOracle .
1
address public fxs_eth_oracle_address
Copied!
Address for the fxsEthOracle .
1
address public weth_address
Copied!
Address for the canonical wrapped-Ethereum (WETH) contract. Should be 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 for the mainnet.
1
address public eth_usd_consumer_address
Copied!
Address for the ChainlinkETHUSDPriceConsumer .
1
uint256 public genesis_supply
Copied!
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.
1
address[] frax_pools_array
Copied!
Array of all the FraxPool contract addresses.
1
mapping(address => bool) public frax_pools
Copied!
Essentially the same as frax_pools_array , but in mapping form. Useful for gas savings in various functions like globalCollateralValue() .
1
uint256 public global_collateral_ratio
Copied!
The current ratio of FRAX to collateral, over all FraxPool s.
1
uint256 public redemption_fee
Copied!
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.
1
uint256 public minting_fee
Copied!
The fee for minting FRAX from FXS and/or collateral. See the FraxPool contract for usage.
1
address public DEFAULT_ADMIN_ADDRESS
Copied!
Set in the constructor. Used in AccessControl .
1
bytes32 public constant COLLATERAL_RATIO_PAUSER
Copied!
A constant used in the pausing of the collateral ratio.
1
bool public collateral_ratio_paused
Copied!
Whether or not the collateral ratio is paused.

View Functions

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

Events

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

Modifiers

onlyCollateralRatioPauser
1
onlyCollateralRatioPauser()
Copied!
Restrict actions to the designated collateral ratio pauser.
onlyPools
1
onlyPools()
Copied!
Restrict actions to pool contracts, e.g. minting new FRAX.
onlyByGovernance
1
onlyByGovernance()
Copied!
Restrict actions to the governance contract, e.g. setting the minting and redemption fees, as well as the oracle and pool addresses.
onlyByOwnerOrGovernance
1
onlyByOwnerOrGovernance()
Copied!
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.
Last modified 5d ago