# FXS 智能合约及地址

## **部署**

| 区块链                  | 地址                                           |
| -------------------- | -------------------------------------------- |
| Arbitrum             | 0x9d2F299715D94d8A7E6F5eaa8E654E8c74a988A7   |
| Aurora               | 0xBb8831701E68B99616bF940b7DafBeb4CDb23e0b   |
| Avalanche            | 0x214DB107654fF987AD859F34125307783fC8e387   |
| Base (LayerZero)     | 0x23432452B720C80553458496D4D9d7C5003280d0   |
| Blast (LayerZero)    | 0x23432452B720C80553458496D4D9d7C5003280d0   |
| Boba                 | 0xae8871A949F255B12704A98c00C2293354a36013   |
| BSC                  | 0xe48A3d7d0Bc88d552f730B62c006bC925eadB9eE   |
| Ethereum (native)    | 0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0   |
| Ethereum (LayerZero) | 0x23432452B720C80553458496D4D9d7C5003280d0   |
| Evmos                | 0xd8176865DD0D672c6Ab4A427572f80A72b4B4A9C   |
| Fantom               | 0x7d016eec9c25232b01F23EF992D98ca97fc2AF5a   |
| Fraxtal (native)     | 0xFc00000000000000000000000000000000000002   |
| Fraxtal (LayerZero)  | 0x64445f0aecc51e94ad52d8ac56b7190e764e561a   |
| Harmony              | 0x0767D8E1b05eFA8d6A301a65b324B6b66A1CC14c   |
| Metis (LayerZero)    | 0x23432452B720C80553458496D4D9d7C5003280d0   |
| Mode (LayerZero)     | 0x64445f0aecc51e94ad52d8ac56b7190e764e561a   |
| Moonbeam             | 0x2CC0A9D8047A5011dEfe85328a6f26968C8aaA1C   |
| Moonriver            | 0x6f1D1Ee50846Fcbc3de91723E61cb68CFa6D0E98   |
| Optimism             | 0x67CCEA5bb16181E7b4109c9c2143c24a1c2205Be   |
| Polygon              | 0x1a3acf6D19267E2d3e7f898f42803e90C9219062   |
| Sei (LayerZero)      | 0x64445f0aecc51e94ad52d8ac56b7190e764e561a   |
| Solana               | 6LX8BhMQ4Sy2otmAWj7Y5sKd9YTVVUgfMsBzT6B9W7ct |
| X-Layer              | 0x64445f0aecc51e94ad52d8ac56b7190e764e561a   |

## **状态变量**

#### ERC-20 (Inherited)

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

#### 访问控制(Inherited)

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

#### FXS各项细分。

```
address public FRAXStablecoinAdd
```

FRAX 合约地址。

```
uint256 genesis_supply
```

FXS初始供应。

```
uint256 public maximum_supply
```

FXS最大供应。

```
uint256 public FXS_DAO_min
```

加入 DAO 组织所需的最低 FXS 量。

```
address public owner_address
```

合约Owner地址。

```
address public oracle_address
```

oracle合约地址。

```
address public timelock_address
```

时间锁地址。

```
FRAXStablecoin private FRAX
```

FRAX 合约实例。

```
struct Checkpoint {
    uint32 fromBlock;
    uint96 votes;
}
```

借鉴自Compound Finance。用于治理投票。

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

在特定区块下，给定地址的投票权列表。

```
mapping (address => uint32) public numCheckpoints
```

某个地址的Checkpoint计算。

## **受限制的函数**

**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.

## **重写的公共函数**

**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.

## **公共函数**

**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.

## **内部函数**

**\_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

## **事件**

**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

## **修饰符**

**onlyPools**

```
onlyPools()
```

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

**onlyByOracle**

```
onlyByOracle()
```

限制只有预言机可以执行的操作，例如设置 FRAX 和预言机地址。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frax.finance/zh/fxs-zhi-neng-he-yue-ji-di-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
