address public timelock_address; // Governance timelock address
address public controller_address; // Controller contract to dynamically adjust system parameters automatically
address public fxs_address;
address public frax_eth_oracle_address;
address public fxs_eth_oracle_address;
address public weth_address;
address public eth_usd_consumer_address;
uint256 public constant genesis_supply = 2000000e18; // 2M FRAX (only for testing, genesis supply will be 5k on Mainnet). This is to help with establishing the Uniswap pools, as they need liquidity
// The addresses in this array are added by the oracle and these contracts are able to mint frax
address[] public frax_pools_array;
// Mapping is also used for faster verification
mapping(address => bool) public frax_pools;
// Constants for various precisions
uint256 private constant PRICE_PRECISION = 1e6;
uint256 public global_collateral_ratio; // 6 decimals of precision, e.g. 924102 = 0.924102
uint256 public redemption_fee; // 6 decimals of precision, divide by 1000000 in calculations for fee
uint256 public minting_fee; // 6 decimals of precision, divide by 1000000 in calculations for fee
uint256 public frax_step; // Amount to change the collateralization ratio by upon refreshCollateralRatio()
uint256 public refresh_cooldown; // Seconds to wait before being able to run refreshCollateralRatio() again
uint256 public price_target; // The price of FRAX at which the collateral ratio will respond to; this value is only used for the collateral ratio mechanism and not for minting and redeeming which are hardcoded at $1
uint256 public price_band; // The bound above and below the price target at which the refreshCollateralRatio() will not change the collateral ratio
address public DEFAULT_ADMIN_ADDRESS;
bytes32 public constant COLLATERAL_RATIO_PAUSER = keccak256("COLLATERAL_RATIO_PAUSER");
bool public collateral_ratio_paused = false;
/* ========== MODIFIERS ========== */
modifier onlyCollateralRatioPauser() {
import { ERC20Permit, ERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import { ERC20Burnable } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
_;
import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";
}
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { StorageSlot } from "@openzeppelin/contracts/utils/StorageSlot.sol";
modifier onlyPools() {
/// @title FrxUSD
require(frax_pools[msg.sender] == true, "Only frax pools can call this function");
/**
_;
* @notice Combines Openzeppelin's ERC20Permit, ERC20Burnable and Ownable2Step.
}
* Also includes a list of authorized minters
*/
modifier onlyByOwnerOrGovernance() {
/// @dev FrxUSD adheres to EIP-712/EIP-2612 and can use permits
require(msg.sender == owner_address || msg.sender == timelock_address || msg.sender == controller_address, "You are not the owner, controller, or the governance timelock");
contract FrxUSD is
_;
ERC20Permit,
}
ERC20Burnable,
Ownable2Step
{
/// @notice Array of the non-bridge minters
address[] public minters_array;
modifier onlyByOwnerGovernanceOrPool() {
/// @notice Mapping of the minters
require(
/// @dev Mapping is used for faster verification
msg.sender == owner_address
mapping(address => bool) public minters;
|| msg.sender == timelock_address
|| frax_pools[msg.sender] == true,
"You are not the owner, the governance timelock, or a pool");