More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
11899956 | 1294 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xfdD93976...Ef68B6932 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
StakePoolRewardFund
Compiler Version
v0.7.6+commit.7338295f
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-02-09 */ // SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma abicoder v2; pragma solidity >=0.7.6; interface IStakePoolCreator { function version() external returns (uint256); function create() external returns (address); function initialize( address poolAddress, address pair, address rewardToken, address timelock, address stakePoolRewardFund, bytes calldata data ) external; } interface IStakePoolController { event MasterCreated(address indexed farm, address indexed pair, uint256 version, address timelock, address stakePoolRewardFund, uint256 totalStakePool); event SetWhitelistStakingFor(address indexed contractAddress, bool value); event SetWhitelistStakePool(address indexed contractAddress, int8 value); event SetStakePoolCreator(address indexed contractAddress, uint256 verion); event SetWhitelistRewardRebaser(address indexed contractAddress, bool value); event SetWhitelistRewardMultiplier(address indexed contractAddress, bool value); event SetStakePoolVerifier(address indexed contractAddress, bool value); event ChangeGovernance(address indexed governance); event SetFeeCollector(address indexed feeCollector); event SetFeeToken(address indexed token); event SetFeeAmount(uint256 indexed amount); function allStakePools(uint256) external view returns (address stakePool); function isStakePool(address contractAddress) external view returns (bool); function isStakePoolVerifier(address contractAddress) external view returns (bool); function isWhitelistStakingFor(address contractAddress) external view returns (bool); function isWhitelistStakePool(address contractAddress) external view returns (int8); function setStakePoolVerifier(address contractAddress, bool state) external; function setWhitelistStakingFor(address contractAddress, bool state) external; function setWhitelistStakePool(address contractAddress, int8 state) external; function addStakePoolCreator(address contractAddress) external; function isWhitelistRewardRebaser(address contractAddress) external view returns (bool); function isAllowEmergencyWithdrawStakePool(address _address) external view returns (bool); function setWhitelistRewardRebaser(address contractAddress, bool state) external; function isWhitelistRewardMultiplier(address contractAddress) external view returns (bool); function setAllowEmergencyWithdrawStakePool(address _address, bool state) external; function setWhitelistRewardMultiplier(address contractAddress, bool state) external; function setEnableWhitelistRewardRebaser(bool value) external; function setEnableWhitelistRewardMultiplier(bool value) external; function allStakePoolsLength() external view returns (uint256); function create( uint256 version, address pair, address rewardToken, uint256 rewardFundAmount, uint256 delayTimeLock, bytes calldata data, uint8 flag ) external returns (address); function createPair( uint256 version, address tokenA, address tokenB, uint32 tokenWeightA, uint32 swapFee, address rewardToken, uint256 rewardFundAmount, uint256 delayTimeLock, bytes calldata poolRewardInfo, uint8 flag ) external returns (address); function setGovernance(address) external; function setFeeCollector(address _address) external; function setFeeToken(address _token) external; function setFeeAmount(uint256 _token) external; } interface IValueLiquidRouter { struct Swap { address pool; address tokenIn; address tokenOut; uint256 swapAmount; // tokenInAmount / tokenOutAmount uint256 limitReturnAmount; // minAmountOut / maxAmountIn uint256 maxPrice; bool isBPool; } function factory() external view returns (address); function controller() external view returns (address); function formula() external view returns (address); function WETH() external view returns (address); function addLiquidity( address pair, address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address pair, address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function swapExactTokensForTokens( address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( address tokenIn, address tokenOut, uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline, uint8 flag ) external returns (uint256[] memory amounts); function swapExactETHForTokens( address tokenOut, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( address tokenIn, uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline, uint8 flag ) external returns (uint256[] memory amounts); function swapExactTokensForETH( address tokenIn, uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external returns (uint256[] memory amounts); function swapETHForExactTokens( address tokenOut, uint256 amountOut, address[] calldata path, address to, uint256 deadline, uint8 flag ) external payable returns (uint256[] memory amounts); function swapExactTokensForTokensSupportingFeeOnTransferTokens( address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( address tokenOut, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( address tokenIn, uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline, uint8 flag ) external; function addStakeLiquidity( address stakePool, address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addStakeLiquidityETH( address stakePool, address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function multihopBatchSwapExactIn( Swap[][] memory swapSequences, address tokenIn, address tokenOut, uint256 totalAmountIn, uint256 minTotalAmountOut, uint256 deadline, uint8 flag ) external payable returns (uint256 totalAmountOut); function multihopBatchSwapExactOut( Swap[][] memory swapSequences, address tokenIn, address tokenOut, uint256 maxTotalAmountIn, uint256 deadline, uint8 flag ) external payable returns (uint256 totalAmountIn); function createPair( address tokenA, address tokenB, uint256 amountA, uint256 amountB, uint32 tokenWeightA, uint32 swapFee, address to, uint8 flag ) external returns (uint256 liquidity); function createPairETH( address token, uint256 amountToken, uint32 tokenWeight, uint32 swapFee, address to, uint8 flag ) external payable returns (uint256 liquidity); } interface IValueLiquidFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint32 tokenWeight0, uint32 swapFee, uint256); function feeTo() external view returns (address); function formula() external view returns (address); function protocolFee() external view returns (uint256); function feeToSetter() external view returns (address); function getPair( address tokenA, address tokenB, uint32 tokenWeightA, uint32 swapFee ) external view returns (address pair); function allPairs(uint256) external view returns (address pair); function isPair(address) external view returns (bool); function allPairsLength() external view returns (uint256); function createPair( address tokenA, address tokenB, uint32 tokenWeightA, uint32 swapFee ) external returns (address pair); function getWeightsAndSwapFee(address pair) external view returns ( uint32 tokenWeight0, uint32 tokenWeight1, uint32 swapFee ); function setFeeTo(address) external; function setFeeToSetter(address) external; function setProtocolFee(uint256) external; } interface IStakePool { event Deposit(address indexed account, uint256 amount); event AddRewardPool(uint256 indexed poolId); event UpdateRewardPool(uint256 indexed poolId, uint256 endRewardBlock, uint256 rewardPerBlock); event PayRewardPool( uint256 indexed poolId, address indexed rewardToken, address indexed account, uint256 pendingReward, uint256 rebaseAmount, uint256 paidReward ); event UpdateRewardRebaser(uint256 indexed poolId, address rewardRebaser); event UpdateRewardMultiplier(uint256 indexed poolId, address rewardMultiplier); event Withdraw(address indexed account, uint256 amount); function version() external returns (uint256); function pair() external returns (address); function initialize( address _pair, uint256 _unstakingFrozenTime, address _rewardFund, address _timelock ) external; function stake(uint256) external; function stakeFor(address _account) external; function withdraw(uint256) external; function getReward(uint8 _pid, address _account) external; function getAllRewards(address _account) external; function claimReward() external; function pendingReward(uint8 _pid, address _account) external view returns (uint256); function allowRecoverRewardToken(address _token) external returns (bool); function getRewardPerBlock(uint8 pid) external view returns (uint256); function rewardPoolInfoLength() external view returns (uint256); function unfrozenStakeTime(address _account) external view returns (uint256); function emergencyWithdraw() external; function updateReward() external; function updateReward(uint8 _pid) external; function updateRewardPool( uint8 _pid, uint256 _endRewardBlock, uint256 _rewardPerBlock ) external; function getRewardMultiplier( uint8 _pid, uint256 _from, uint256 _to, uint256 _rewardPerBlock ) external view returns (uint256); function getRewardRebase( uint8 _pid, address _rewardToken, uint256 _pendingReward ) external view returns (uint256); function updateRewardRebaser(uint8 _pid, address _rewardRebaser) external; function updateRewardMultiplier(uint8 _pid, address _rewardMultiplier) external; function getUserInfo(uint8 _pid, address _account) external view returns ( uint256 amount, uint256 rewardDebt, uint256 accumulatedEarned, uint256 lockReward, uint256 lockRewardReleased ); function addRewardPool( address _rewardToken, address _rewardRebaser, address _rewardMultiplier, uint256 _startBlock, uint256 _endRewardBlock, uint256 _rewardPerBlock, uint256 _lockRewardPercent, uint256 _startVestingBlock, uint256 _endVestingBlock ) external; function removeLiquidity( address provider, address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address provider, address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityETHSupportingFeeOnTransferTokens( address provider, address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: APPROVE_FAILED"); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FAILED"); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FROM_FAILED"); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, "TransferHelper: ETH_TRANSFER_FAILED"); } } interface IValueLiquidPair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event PaidProtocolFee(uint112 collectedFee0, uint112 collectedFee1); event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function getCollectedFees() external view returns (uint112 _collectedFee0, uint112 _collectedFee1); function getTokenWeights() external view returns (uint32 tokenWeight0, uint32 tokenWeight1); function getSwapFee() external view returns (uint32); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize( address, address, uint32, uint32 ) external; } // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow"); } function div(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b > 0, "ds-math-division-by-zero"); c = a / b; } } contract TimeLock { using SafeMath for uint256; event NewAdmin(address indexed newAdmin); event NewPendingAdmin(address indexed newPendingAdmin); event NewDelay(uint256 indexed newDelay); event CancelTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta); event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta); event QueueTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta); uint256 public constant GRACE_PERIOD = 14 days; uint256 public constant MINIMUM_DELAY = 1 days; uint256 public constant MAXIMUM_DELAY = 30 days; bool private _initialized; address public admin; address public pendingAdmin; uint256 public delay; bool public admin_initialized; mapping(bytes32 => bool) public queuedTransactions; constructor() { admin_initialized = false; _initialized = false; } function initialize(address _admin, uint256 _delay) public { require(_initialized == false, "Timelock::constructor: Initialized must be false."); require(_delay >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay."); require(_delay <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); delay = _delay; admin = _admin; _initialized = true; emit NewAdmin(admin); emit NewDelay(delay); } receive() external payable {} function setDelay(uint256 _delay) public { require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock."); require(_delay >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay."); require(_delay <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); delay = _delay; emit NewDelay(delay); } function acceptAdmin() public { require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin."); admin = msg.sender; pendingAdmin = address(0); emit NewAdmin(admin); } function setPendingAdmin(address _pendingAdmin) public { // allows one time setting of admin for deployment purposes if (admin_initialized) { require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock."); } else { require(msg.sender == admin, "Timelock::setPendingAdmin: First call must come from admin."); admin_initialized = true; } pendingAdmin = _pendingAdmin; emit NewPendingAdmin(pendingAdmin); } function queueTransaction( address target, uint256 value, string memory signature, bytes memory data, uint256 eta ) public returns (bytes32) { require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin."); require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); queuedTransactions[txHash] = true; emit QueueTransaction(txHash, target, value, signature, data, eta); return txHash; } function cancelTransaction( address target, uint256 value, string memory signature, bytes memory data, uint256 eta ) public { require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); queuedTransactions[txHash] = false; emit CancelTransaction(txHash, target, value, signature, data, eta); } function executeTransaction( address target, uint256 value, string memory signature, bytes memory data, uint256 eta ) public payable returns (bytes memory) { require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued."); require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock."); require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale."); queuedTransactions[txHash] = false; bytes memory callData; if (bytes(signature).length == 0) { callData = data; } else { callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data); } // solium-disable-next-line security/no-call-value (bool success, bytes memory returnData) = target.call{value: value}(callData); require(success, "Timelock::executeTransaction: Transaction execution reverted."); emit ExecuteTransaction(txHash, target, value, signature, data, eta); return returnData; } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } } interface IERC20 { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); } interface IStakePoolRewardFund { function initialize(address _stakePool, address _timelock) external; function safeTransfer( address _token, address _to, uint256 _value ) external; } interface IStakePoolRewardRebaser { function getRebaseAmount(address rewardToken, uint256 baseAmount) external view returns (uint256); } interface IStakePoolRewardMultiplier { function getRewardMultiplier( uint256 _start, uint256 _end, uint256 _from, uint256 _to, uint256 _rewardPerBlock ) external view returns (uint256); } contract StakePoolRewardFund is IStakePoolRewardFund { uint256 public constant BLOCKS_PER_DAY = 6528; address public stakePool; address public timelock; bool private _initialized; function initialize(address _stakePool, address _timelock) external override { require(_initialized == false, "StakePoolRewardFund: already initialized"); stakePool = _stakePool; timelock = _timelock; _initialized = true; } function safeTransfer( address _token, address _to, uint256 _value ) external override { require(msg.sender == stakePool, "StakePoolRewardFund: !stakePool"); TransferHelper.safeTransfer(_token, _to, _value); } function recoverRewardToken( address _token, uint256, address ) external { require(msg.sender == timelock, "StakePoolRewardFund: !timelock"); require(IStakePool(stakePool).allowRecoverRewardToken(_token), "StakePoolRewardFund: not allow recover reward token"); } } interface IFreeFromUpTo { function freeFromUpTo(address from, uint256 value) external returns (uint256 freed); } contract StakePoolController is IStakePoolController { IValueLiquidFactory public swapFactory; address public governance; address public feeCollector; address public feeToken; uint256 public feeAmount; mapping(address => bool) private _stakePools; mapping(address => bool) private _whitelistStakingFor; mapping(address => bool) private _whitelistRewardRebaser; mapping(address => bool) private _whitelistRewardMultiplier; mapping(address => int8) private _whitelistStakePools; mapping(address => bool) public _stakePoolVerifiers; mapping(uint256 => address) public stakePoolCreators; address[] public override allStakePools; bool public enableWhitelistRewardRebaser = true; bool public enableWhitelistRewardMultiplier = true; bool private _initialized = false; IFreeFromUpTo public constant chi = IFreeFromUpTo(0x0000000000004946c0e9F43F4Dee607b0eF1fA1c); mapping(address => bool) public allowEmergencyWithdrawStakePools; modifier discountCHI(uint8 flag) { uint256 gasStart = gasleft(); _; if ((flag & 0x1) == 1) { uint256 gasSpent = 21000 + gasStart - gasleft() + 16 * msg.data.length; chi.freeFromUpTo(msg.sender, (gasSpent + 14154) / 41130); } } function initialize(address _swapFactory) public { require(_initialized == false, "StakePoolController: initialized"); governance = msg.sender; swapFactory = IValueLiquidFactory(_swapFactory); _initialized = true; } function isStakePool(address b) external view override returns (bool) { return _stakePools[b]; } modifier onlyGovernance() { require(msg.sender == governance, "StakePoolController: !governance"); _; } function setFeeCollector(address _address) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); feeCollector = _address; emit SetFeeCollector(_address); } function setEnableWhitelistRewardRebaser(bool value) external override onlyGovernance { enableWhitelistRewardRebaser = value; } function setEnableWhitelistRewardMultiplier(bool value) external override onlyGovernance { enableWhitelistRewardMultiplier = value; } function setFeeToken(address _token) external override onlyGovernance { require(_token != address(0), "StakePoolController: invalid _token"); feeToken = _token; emit SetFeeToken(_token); } function setFeeAmount(uint256 _feeAmount) external override onlyGovernance { feeAmount = _feeAmount; emit SetFeeAmount(_feeAmount); } function isWhitelistStakingFor(address _address) external view override returns (bool) { return _whitelistStakingFor[_address]; } function isWhitelistStakePool(address _address) external view override returns (int8) { return _whitelistStakePools[_address]; } function isStakePoolVerifier(address _address) external view override returns (bool) { return _stakePoolVerifiers[_address]; } function isAllowEmergencyWithdrawStakePool(address _address) external view override returns (bool) { return allowEmergencyWithdrawStakePools[_address]; } function setWhitelistStakingFor(address _address, bool state) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); _whitelistStakingFor[_address] = state; emit SetWhitelistStakingFor(_address, state); } function setAllowEmergencyWithdrawStakePool(address _address, bool state) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); allowEmergencyWithdrawStakePools[_address] = state; } function setStakePoolVerifier(address _address, bool state) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); _stakePoolVerifiers[_address] = state; emit SetStakePoolVerifier(_address, state); } function setWhitelistStakePool(address _address, int8 state) external override { require(_address != address(0), "StakePoolController: invalid address"); require(_stakePoolVerifiers[msg.sender] == true, "StakePoolController: invalid stake pool verifier"); _whitelistStakePools[_address] = state; emit SetWhitelistStakePool(_address, state); } function addStakePoolCreator(address _address) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); uint256 version = IStakePoolCreator(_address).version(); require(version >= 1000, "Invalid stake pool creator version"); stakePoolCreators[version] = _address; emit SetStakePoolCreator(_address, version); } function isWhitelistRewardRebaser(address _address) external view override returns (bool) { if (!enableWhitelistRewardRebaser) return true; return _address == address(0) ? true : _whitelistRewardRebaser[_address]; } function setWhitelistRewardRebaser(address _address, bool state) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); _whitelistRewardRebaser[_address] = state; emit SetWhitelistRewardRebaser(_address, state); } function isWhitelistRewardMultiplier(address _address) external view override returns (bool) { if (!enableWhitelistRewardMultiplier) return true; return _address == address(0) ? true : _whitelistRewardMultiplier[_address]; } function setWhitelistRewardMultiplier(address _address, bool state) external override onlyGovernance { require(_address != address(0), "StakePoolController: invalid address"); _whitelistRewardMultiplier[_address] = state; emit SetWhitelistRewardMultiplier(_address, state); } function setGovernance(address _governance) external override onlyGovernance { require(_governance != address(0), "StakePoolController: invalid governance"); governance = _governance; emit ChangeGovernance(_governance); } function allStakePoolsLength() external view override returns (uint256) { return allStakePools.length; } function createPair( uint256 version, address tokenA, address tokenB, uint32 tokenWeightA, uint32 swapFee, address rewardToken, uint256 rewardFundAmount, uint256 delayTimeLock, bytes calldata poolRewardInfo, uint8 flag ) public override discountCHI(flag) returns (address) { address pair = swapFactory.getPair(tokenA, tokenB, tokenWeightA, swapFee); if (pair == address(0)) { pair = swapFactory.createPair(tokenA, tokenB, tokenWeightA, swapFee); } return create(version, pair, rewardToken, rewardFundAmount, delayTimeLock, poolRewardInfo, 0); } function createInternal( address stakePoolCreator, address pair, address stakePoolRewardFund, address rewardToken, uint256 delayTimeLock, bytes calldata data ) internal returns (address) { TimeLock timelock = new TimeLock(); IStakePool pool = IStakePool(IStakePoolCreator(stakePoolCreator).create()); allStakePools.push(address(pool)); _stakePools[address(pool)] = true; emit MasterCreated(address(pool), pair, pool.version(), address(timelock), stakePoolRewardFund, allStakePools.length); IStakePoolCreator(stakePoolCreator).initialize(address(pool), pair, rewardToken, address(timelock), address(stakePoolRewardFund), data); StakePoolRewardFund(stakePoolRewardFund).initialize(address(pool), address(timelock)); timelock.initialize(msg.sender, delayTimeLock); return address(pool); } function create( uint256 version, address pair, address rewardToken, uint256 rewardFundAmount, uint256 delayTimeLock, bytes calldata data, uint8 flag ) public override discountCHI(flag) returns (address) { require(swapFactory.isPair(pair), "StakePoolController: invalid pair"); address stakePoolCreator = stakePoolCreators[version]; require(stakePoolCreator != address(0), "StakePoolController: Invalid stake pool creator version"); if (feeCollector != address(0) && feeToken != address(0) && feeAmount > 0) { TransferHelper.safeTransferFrom(feeToken, msg.sender, feeCollector, feeAmount); } StakePoolRewardFund stakePoolRewardFund = new StakePoolRewardFund(); if (rewardFundAmount > 0) { require(IERC20(rewardToken).balanceOf(msg.sender) >= rewardFundAmount, "StakePoolController: Not enough rewardFundAmount"); TransferHelper.safeTransferFrom(rewardToken, msg.sender, address(stakePoolRewardFund), rewardFundAmount); } return createInternal(stakePoolCreator, pair, address(stakePoolRewardFund), rewardToken, delayTimeLock, data); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"BLOCKS_PER_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakePool","type":"address"},{"internalType":"address","name":"_timelock","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"recoverRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"safeTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063d1660f9911610050578063d1660f99146100bd578063d33219b4146100d0578063f8ea4756146100e557610072565b8063485cc955146100775780636bb987fe1461008c57806373fc7676146100aa575b600080fd5b61008a6100853660046104fa565b6100ed565b005b6100946101da565b6040516100a191906107a8565b60405180910390f35b61008a6100b8366004610567565b6101e0565b61008a6100cb36600461052c565b610314565b6100d8610370565b6040516100a19190610602565b6100d861038c565b60015474010000000000000000000000000000000000000000900460ff161561014b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014290610649565b60405180910390fd5b600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff948516179091556001805474010000000000000000000000000000000000000000921692909316919091177fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16179055565b61198081565b60015473ffffffffffffffffffffffffffffffffffffffff163314610231576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014290610771565b6000546040517f3468a5b800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633468a5b890610287908690600401610602565b602060405180830381600087803b1580156102a157600080fd5b505af11580156102b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d991906105a2565b61030f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014290610714565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610365576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610142906106dd565b61030f8383836103a8565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016103da929190610623565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161042891906105c9565b6000604051808303816000865af19150503d8060008114610465576040519150601f19603f3d011682016040523d82523d6000602084013e61046a565b606091505b509150915081801561049457508051158061049457508080602001905181019061049491906105a2565b6104ca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610142906106a6565b5050505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146104f557600080fd5b919050565b6000806040838503121561050c578182fd5b610515836104d1565b9150610523602084016104d1565b90509250929050565b600080600060608486031215610540578081fd5b610549846104d1565b9250610557602085016104d1565b9150604084013590509250925092565b60008060006060848603121561057b578283fd5b610584846104d1565b925060208401359150610599604085016104d1565b90509250925092565b6000602082840312156105b3578081fd5b815180151581146105c2578182fd5b9392505050565b60008251815b818110156105e957602081860181015185830152016105cf565b818111156105f75782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b60208082526028908201527f5374616b65506f6f6c52657761726446756e643a20616c726561647920696e6960408201527f7469616c697a6564000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b6020808252601f908201527f5374616b65506f6f6c52657761726446756e643a20217374616b65506f6f6c00604082015260600190565b60208082526033908201527f5374616b65506f6f6c52657761726446756e643a206e6f7420616c6c6f77207260408201527f65636f7665722072657761726420746f6b656e00000000000000000000000000606082015260800190565b6020808252601e908201527f5374616b65506f6f6c52657761726446756e643a202174696d656c6f636b0000604082015260600190565b9081526020019056fea264697066735822122047e058b4105187bafc9b7ce1b901f6fbade94cfd28399b5ae5e845452cf26e9e64736f6c63430007060033
Deployed Bytecode Sourcemap
27275:1071:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27482:264;;;;;;:::i;:::-;;:::i;:::-;;27335:45;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;28026:317;;;;;;:::i;:::-;;:::i;27754:264::-;;;;;;:::i;:::-;;:::i;27418:23::-;;;:::i;:::-;;;;;;;:::i;27387:24::-;;;:::i;27482:264::-;27578:12;;;;;;;:21;27570:74;;;;;;;;;;;;:::i;:::-;;;;;;;;;27655:9;:22;;;;;;;;;;;;;;-1:-1:-1;27688:20:0;;27719:19;27688:20;;;;;;;;;;27719:19;;;;;27482:264::o;27335:45::-;27376:4;27335:45;:::o;28026:317::-;28164:8;;;;28150:10;:22;28142:65;;;;;;;;;;;;:::i;:::-;28237:9;;28226:53;;;;;28237:9;;;;;28226:45;;:53;;28272:6;;28226:53;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;28218:117;;;;;;;;;;;;:::i;:::-;28026:317;;;:::o;27754:264::-;27906:9;;;;27892:10;:23;27884:67;;;;;;;;;;;;:::i;:::-;27962:48;27990:6;27998:3;28003:6;27962:27;:48::i;27418:23::-;;;;;;:::o;27387:24::-;;;;;;:::o;15357:398::-;15543:12;15557:17;15578:5;:10;;15612;15624:2;15628:5;15589:45;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15578:57;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15542:93;;;;15654:7;:57;;;;-1:-1:-1;15666:11:0;;:16;;:44;;;15697:4;15686:24;;;;;;;;;;;;:::i;:::-;15646:101;;;;;;;;;;;;:::i;:::-;15357:398;;;;;:::o;14:198:1:-;84:20;;144:42;133:54;;123:65;;113:2;;202:1;199;192:12;113:2;65:147;;;:::o;217:274::-;;;346:2;334:9;325:7;321:23;317:32;314:2;;;367:6;359;352:22;314:2;395:31;416:9;395:31;:::i;:::-;385:41;;445:40;481:2;470:9;466:18;445:40;:::i;:::-;435:50;;304:187;;;;;:::o;496:342::-;;;;642:2;630:9;621:7;617:23;613:32;610:2;;;663:6;655;648:22;610:2;691:31;712:9;691:31;:::i;:::-;681:41;;741:40;777:2;766:9;762:18;741:40;:::i;:::-;731:50;;828:2;817:9;813:18;800:32;790:42;;600:238;;;;;:::o;843:342::-;;;;989:2;977:9;968:7;964:23;960:32;957:2;;;1010:6;1002;995:22;957:2;1038:31;1059:9;1038:31;:::i;:::-;1028:41;;1116:2;1105:9;1101:18;1088:32;1078:42;;1139:40;1175:2;1164:9;1160:18;1139:40;:::i;:::-;1129:50;;947:238;;;;;:::o;1190:297::-;;1310:2;1298:9;1289:7;1285:23;1281:32;1278:2;;;1331:6;1323;1316:22;1278:2;1368:9;1362:16;1421:5;1414:13;1407:21;1400:5;1397:32;1387:2;;1448:6;1440;1433:22;1387:2;1476:5;1268:219;-1:-1:-1;;;1268:219:1:o;1492:430::-;;1659:6;1653:13;1684:3;1696:129;1710:6;1707:1;1704:13;1696:129;;;1808:4;1792:14;;;1788:25;;1782:32;1769:11;;;1762:53;1725:12;1696:129;;;1843:6;1840:1;1837:13;1834:2;;;1878:3;1869:6;1864:3;1860:16;1853:29;1834:2;-1:-1:-1;1900:16:1;;;;;1629:293;-1:-1:-1;;1629:293:1:o;1927:226::-;2103:42;2091:55;;;;2073:74;;2061:2;2046:18;;2028:125::o;2158:297::-;2362:42;2350:55;;;;2332:74;;2437:2;2422:18;;2415:34;2320:2;2305:18;;2287:168::o;2460:404::-;2662:2;2644:21;;;2701:2;2681:18;;;2674:30;2740:34;2735:2;2720:18;;2713:62;2811:10;2806:2;2791:18;;2784:38;2854:3;2839:19;;2634:230::o;2869:355::-;3071:2;3053:21;;;3110:2;3090:18;;;3083:30;3149:33;3144:2;3129:18;;3122:61;3215:2;3200:18;;3043:181::o;3229:355::-;3431:2;3413:21;;;3470:2;3450:18;;;3443:30;3509:33;3504:2;3489:18;;3482:61;3575:2;3560:18;;3403:181::o;3589:415::-;3791:2;3773:21;;;3830:2;3810:18;;;3803:30;3869:34;3864:2;3849:18;;3842:62;3940:21;3935:2;3920:18;;3913:49;3994:3;3979:19;;3763:241::o;4009:354::-;4211:2;4193:21;;;4250:2;4230:18;;;4223:30;4289:32;4284:2;4269:18;;4262:60;4354:2;4339:18;;4183:180::o;4368:177::-;4514:25;;;4502:2;4487:18;;4469:76::o
Swarm Source
ipfs://47e058b4105187bafc9b7ce1b901f6fbade94cfd28399b5ae5e845452cf26e9e
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.000169 | 1,148,256.2796 | $194 |
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.