Frax Shares (FXS)

Modified ERC-20 Contract representing the FXS token, which is used for staking and governance actions surrounding the FRAX stablecoin.

Deployment

Ethereum mainnet: 0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0

Binance Smart Chain (BSC): 0xde2f075f6f14eb9d96755b24e416a53e736ca363

MATIC / Polygon: 0x3e121107F6F22DA4911079845a470757aF4e1A1b

Fantom: 0x82F8Cb20c14F134fe6Ebf7aC3B903B2117aAfa62

State Variables

ERC-20 (Inherited)

https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#ERC20

AccessControl (Inherited)

https://docs.openzeppelin.com/contracts/3.x/api/access#AccessControl

FXS-Specific

address public FRAXStablecoinAdd

Address of the FRAX contract.

uint256 genesis_supply

Genesis supply of FXS.

uint256 public maximum_supply

Maximum supply of FXS.

uint256 public FXS_DAO_min

Minimum FXS required to join DAO groups.

address public owner_address

Address of the contract owner.

address public oracle_address

Address of the oracle.

address public timelock_address

Address of the timelock.

FRAXStablecoin private FRAX

The FRAX contract instance.

struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}

From Compound Finance. Used for governance voting.

mapping (address => mapping (uint32 => Checkpoint)) public checkpoints

List of voting power for a given address, at a given block.

mapping (address => uint32) public numCheckpoints

Checkpoint count for an address.

Restricted Functions

setOracle

setOracle(address new_oracle) external onlyByOracle

Change the address of the price oracle.

setFRAXAddress

setFRAXAddress(address frax_contract_address) external onlyByOracle

Set the address of the FRAX contract.

setFXSMinDAO

setFXSMinDAO(uint256 min_FXS) external onlyByOracle

Set minimum FXS required to join DAO groups.

mint

mint(address to, uint256 amount) public onlyPools

Mint new FXS tokens.

pool_mint

pool_mint(address m_address, uint256 m_amount) external onlyPools

This function is what other FRAX pools will call to mint new FXS (similar to the FRAX mint).

pool_burn_from

pool_burn_from(address b_address, uint256 b_amount) external onlyPools

This function is what other FRAX pools will call to burn FXS.

Overridden Public Functions

transfer

transfer(address recipient, uint256 amount) public virtual override returns (bool)

Transfer FXS tokens.

transferFrom

transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool)

Transfer FXS tokens from another account. Must have an allowance set beforehand.

Public Functions

getCurrentVotes

getCurrentVotes(address account) external view returns (uint96)

Gets the current votes balance for account.

getPriorVotes

getPriorVotes(address account, uint blockNumber) public view returns (uint96)

Determine the prior number of votes for an account as of a block number. Block number must be a finalized block or else this function will revert to prevent misinformation.

Internal Functions

_moveDelegates

_moveDelegates(address srcRep, address dstRep, uint96 amount) internal

Misnomer, from Compound Finance's _moveDelegates. Helps keep track of available voting power for FXS holders.

_writeCheckpoint

_writeCheckpoint(address voter, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal

From Compound Finance's governance scheme. Helps keep track of available voting power for FXS holders at a specific block. Called when a FXS token transfer, mint, or burn occurs.

safe32

safe32(uint n, string memory errorMessage) internal pure returns (uint32)

Make sure the provided int is 32 bits or less, and convert it to a uint32.

safe96

safe96(uint n, string memory errorMessage) internal pure returns (uint96)

Make sure the provided int is 96 bits or less, and convert it to a uint96.

add96

add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96)

Add two uint96 integers safely.

sub96

sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96)

Subtract two uint96 integers safely.

getChainId

getChainId() internal pure returns (uint)

Return the Ethereum chain ID the contract is deployed on

Events

VoterVotesChanged

VoterVotesChanged(address indexed voter, uint previousBalance, uint newBalance)

Emitted when a voters account's vote balance changes

FXSBurned

FXSBurned(address indexed from, address indexed to, uint256 amount)

Emitted when FXS is burned, usually from a redemption by the pool

Modifiers

onlyPools

onlyPools()

Restrict actions to pool contracts, e.g. minting new FXS.

onlyByOracle

onlyByOracle()

Restrict actions to the oracle, such as setting the FRAX and oracle addresses