forked from FraxFinance/frax-solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfxs.sol
64 lines (51 loc) · 1.66 KB
/
fxs.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pragma solidity ^0.6.0;
import "./Context.sol";
import "./IERC20.sol";
import "./frax.sol";
import "./SafeMath.sol";
contract FRAXShares is ERC20 {
using SafeMath for uint256;
string public symbol;
uint8 public decimals = 18;
address public FRAXStablecoinAdd;
// address[] public owners;
uint256 genesis_supply;
// uint256 ownerCount; //number of different addresses that hold FXS
// mapping(address => uint256) public balances;
// mapping(address => mapping (address => uint256)) allowed;
address owner_address;
mapping(address => bool) public frax_pools;
address oracle_address;
FRAXStablecoin FRAX;
constructor(
string memory _symbol,
uint256 _genesis_supply,
address _owner_address,
address _oracle_address,
address _FRAXStablecoinAdd)
public
{
symbol = _symbol;
genesis_supply = _genesis_supply;
owner_address = _owner_address;
FRAXStablecoinAdd = _FRAXStablecoinAdd;
oracle_address = _oracle_address;
_mint(owner_address, genesis_supply);
}
function mint(address to, uint256 amount) public {
require(msg.sender == FRAXStablecoinAdd);
_mint(to, amount);
}
modifier onlyPools() {
require(frax_pools[msg.sender] = true, "only frax pools can mint new FRAX");
_;
}
modifier onlyByOracle() {
require(msg.sender == oracle_address, "you're not the oracle :p");
_;
}
//this function is what other frax pools will call to mint new FXS (similar to the FRAX mint)
function pool_mint(address m_address, uint256 m_amount) public onlyPools {
super._mint(m_address, m_amount);
}
}