Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 342 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim Earnings | 19265365 | 300 days ago | IN | 0 ETH | 0.00974025 | ||||
Claim Earnings | 19155606 | 315 days ago | IN | 0 ETH | 0.00845271 | ||||
Claim Earnings | 19138951 | 317 days ago | IN | 0 ETH | 0.01887984 | ||||
Claim Earnings | 19070039 | 327 days ago | IN | 0 ETH | 0.00897187 | ||||
Pool Checkpoint | 19062604 | 328 days ago | IN | 0 ETH | 0.00400942 | ||||
Claim Earnings | 18718281 | 376 days ago | IN | 0 ETH | 0.01941658 | ||||
Claim Earnings | 18714376 | 377 days ago | IN | 0 ETH | 0.02020366 | ||||
Pool Checkpoint | 18714189 | 377 days ago | IN | 0 ETH | 0.0129835 | ||||
Claim Earnings | 18485085 | 409 days ago | IN | 0 ETH | 0.01741405 | ||||
Claim Earnings | 18475220 | 411 days ago | IN | 0 ETH | 0.00553948 | ||||
Claim Earnings | 18460763 | 413 days ago | IN | 0 ETH | 0.00362069 | ||||
Claim Earnings | 18441783 | 415 days ago | IN | 0 ETH | 0.00940543 | ||||
Pool Checkpoint | 18419682 | 418 days ago | IN | 0 ETH | 0.00547626 | ||||
Claim Earnings | 18274661 | 439 days ago | IN | 0 ETH | 0.00302084 | ||||
Claim Earnings | 18248658 | 442 days ago | IN | 0 ETH | 0.00395259 | ||||
Claim Earnings | 18241747 | 443 days ago | IN | 0 ETH | 0.00539885 | ||||
Claim Earnings | 18234555 | 444 days ago | IN | 0 ETH | 0.00522311 | ||||
Claim Earnings | 18225261 | 445 days ago | IN | 0 ETH | 0.003077 | ||||
Claim Earnings | 18199399 | 449 days ago | IN | 0 ETH | 0.00290002 | ||||
Claim Earnings | 18167475 | 454 days ago | IN | 0 ETH | 0.00339122 | ||||
Claim Earnings | 18158309 | 455 days ago | IN | 0 ETH | 0.00402672 | ||||
Claim Earnings | 18115211 | 461 days ago | IN | 0 ETH | 0.01267612 | ||||
Claim Earnings | 18067270 | 468 days ago | IN | 0 ETH | 0.00426488 | ||||
Claim Earnings | 18054483 | 469 days ago | IN | 0 ETH | 0.00412615 | ||||
Claim Earnings | 18048769 | 470 days ago | IN | 0 ETH | 0.00466697 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RewardManagerV2
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "Ownable.sol"; import "Initializable.sol"; import "EnumerableSet.sol"; import "SafeERC20.sol"; import "IERC20Metadata.sol"; import "IConicPool.sol"; import "ILpToken.sol"; import "IRewardManager.sol"; import "IConvexHandler.sol"; import "IController.sol"; import "IOracle.sol"; import "IInflationManager.sol"; import "ILpTokenStaker.sol"; import "ICNCLockerV2.sol"; import "ICurvePoolV2.sol"; import "UniswapRouter02.sol"; import "ScaledMath.sol"; contract RewardManagerV2 is IRewardManager, Ownable, Initializable { using ScaledMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; struct RewardMeta { uint256 earnedIntegral; uint256 lastHoldings; mapping(address => uint256) accountIntegral; mapping(address => uint256) accountShare; } IERC20 public constant CVX = IERC20(0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B); IERC20 public constant CRV = IERC20(0xD533a949740bb3306d119CC777fa900bA034cd52); IERC20 public constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IERC20 public constant CNC = IERC20(0x9aE380F0272E2162340a5bB646c354271c0F5cFC); UniswapRouter02 public constant SUSHISWAP = UniswapRouter02(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); ICurvePoolV2 public constant CNC_ETH_POOL = ICurvePoolV2(0x838af967537350D2C44ABB8c010E49E32673ab94); uint256 public constant MAX_FEE_PERCENTAGE = 3e17; uint256 public constant SLIPPAGE_THRESHOLD = 0.95e18; // 5% slippage as a multiplier bytes32 internal constant _CNC_KEY = "cnc"; bytes32 internal constant _CRV_KEY = "crv"; bytes32 internal constant _CVX_KEY = "cvx"; address public override pool; ILpToken public lpToken; IERC20 public immutable underlying; IController public immutable controller; ICNCLockerV2 public immutable locker; bool internal _claimingCNC; EnumerableSet.AddressSet internal _extraRewards; mapping(address => address) public extraRewardsCurvePool; mapping(bytes32 => RewardMeta) internal _rewardsMeta; bool public feesEnabled; uint256 public feePercentage; constructor(address _controller, address _underlying, address cncLocker) { underlying = IERC20(_underlying); controller = IController(_controller); WETH.safeApprove(address(CNC_ETH_POOL), type(uint256).max); locker = ICNCLockerV2(cncLocker); } function initialize(address _pool) external onlyOwner initializer { pool = _pool; lpToken = IConicPool(_pool).lpToken(); } /// @notice Updates the internal fee accounting state. Returns `true` if rewards were claimed function poolCheckpoint() public override returns (bool) { IConvexHandler convexHandler = IConvexHandler(controller.convexHandler()); (uint256 crvHoldings, uint256 cvxHoldings, uint256 cncHoldings) = _getHoldings( convexHandler ); uint256 crvEarned = crvHoldings - _rewardsMeta[_CRV_KEY].lastHoldings; uint256 cvxEarned = cvxHoldings - _rewardsMeta[_CVX_KEY].lastHoldings; uint256 cncEarned = cncHoldings - _rewardsMeta[_CNC_KEY].lastHoldings; uint256 crvFee; uint256 cvxFee; if (feesEnabled) { crvFee = crvEarned.mulDown(feePercentage); cvxFee = cvxEarned.mulDown(feePercentage); crvEarned -= crvFee; cvxEarned -= cvxFee; crvHoldings -= crvFee; cvxHoldings -= cvxFee; } uint256 _totalStaked = controller.lpTokenStaker().getBalanceForPool(pool); if (_totalStaked > 0) { _updateEarned(_CVX_KEY, cvxHoldings, cvxEarned, _totalStaked); _updateEarned(_CRV_KEY, crvHoldings, crvEarned, _totalStaked); _updateEarned(_CNC_KEY, cncHoldings, cncEarned, _totalStaked); } if (!feesEnabled) { return false; } bool rewardsClaimed = false; if (crvFee > CRV.balanceOf(pool) || cvxFee > CVX.balanceOf(pool)) { _claimPoolEarningsAndSellRewardTokens(); rewardsClaimed = true; } CRV.safeTransferFrom(pool, address(this), crvFee); CVX.safeTransferFrom(pool, address(this), cvxFee); // Fee transfer to the CNC locker CRV.safeApprove(address(locker), crvFee); CVX.safeApprove(address(locker), cvxFee); locker.receiveFees(crvFee, cvxFee); return rewardsClaimed; } function _updateEarned( bytes32 key, uint256 holdings, uint256 earned, uint256 _totalSupply ) internal { _rewardsMeta[key].earnedIntegral += earned.divDown(_totalSupply); _rewardsMeta[key].lastHoldings = holdings; } function _getEarnedRewards() internal view returns (uint256 crvEarned, uint256 cvxEarned, uint256 cncEarned) { IConvexHandler convexHandler = IConvexHandler(controller.convexHandler()); return _getEarnedRewards(convexHandler); } function _getHoldings( IConvexHandler convexHandler ) internal view returns (uint256 crvHoldings, uint256 cvxHoldings, uint256 cncHoldings) { address[] memory curvePools = IConicPool(pool).allCurvePools(); uint256 claimableCRV = convexHandler.getCrvEarnedBatch(pool, curvePools); crvHoldings = CRV.balanceOf(pool) + claimableCRV; uint256 claimableCVX = convexHandler.computeClaimableConvex(claimableCRV); cvxHoldings = CVX.balanceOf(pool) + claimableCVX; cncHoldings = CNC.balanceOf(pool); if (!_claimingCNC) { cncHoldings += controller.lpTokenStaker().claimableCnc(pool); } } function _getEarnedRewards( IConvexHandler convexHandler ) internal view returns (uint256 crvEarned, uint256 cvxEarned, uint256 cncEarned) { ( uint256 currentHoldingsCRV, uint256 currentHoldingsCVX, uint256 currentHoldingsCNC ) = _getHoldings(convexHandler); crvEarned = currentHoldingsCRV - _rewardsMeta[_CRV_KEY].lastHoldings; cvxEarned = currentHoldingsCVX - _rewardsMeta[_CVX_KEY].lastHoldings; cncEarned = currentHoldingsCNC - _rewardsMeta[_CNC_KEY].lastHoldings; } function accountCheckpoint(address account) external { _accountCheckpoint(account); } function _accountCheckpoint(address account) internal { uint256 accountBalance = controller.lpTokenStaker().getUserBalanceForPool(pool, account); poolCheckpoint(); _updateAccountRewardsMeta(_CNC_KEY, account, accountBalance); _updateAccountRewardsMeta(_CRV_KEY, account, accountBalance); _updateAccountRewardsMeta(_CVX_KEY, account, accountBalance); } function _updateAccountRewardsMeta(bytes32 key, address account, uint256 balance) internal { RewardMeta storage meta = _rewardsMeta[key]; uint256 share = balance.mulDown(meta.earnedIntegral - meta.accountIntegral[account]); meta.accountShare[account] += share; meta.accountIntegral[account] = meta.earnedIntegral; } /// @notice Claims all CRV, CVX and CNC earned by a user. All extra reward /// tokens earned will be sold for CNC. /// @dev Conic pool LP tokens need to be staked in the `LpTokenStaker` in /// order to receive a share of the CRV, CVX and CNC earnings. /// after selling all extra reward tokens. function claimEarnings() public override returns (uint256, uint256, uint256) { _accountCheckpoint(msg.sender); uint256 crvAmount = _rewardsMeta[_CRV_KEY].accountShare[msg.sender]; uint256 cvxAmount = _rewardsMeta[_CVX_KEY].accountShare[msg.sender]; uint256 cncAmount = _rewardsMeta[_CNC_KEY].accountShare[msg.sender]; if ( crvAmount > CRV.balanceOf(pool) || cvxAmount > CVX.balanceOf(pool) || cncAmount > CNC.balanceOf(pool) ) { _claimPoolEarningsAndSellRewardTokens(); } _rewardsMeta[_CNC_KEY].accountShare[msg.sender] = 0; _rewardsMeta[_CVX_KEY].accountShare[msg.sender] = 0; _rewardsMeta[_CRV_KEY].accountShare[msg.sender] = 0; CRV.safeTransferFrom(pool, msg.sender, crvAmount); CVX.safeTransferFrom(pool, msg.sender, cvxAmount); CNC.safeTransferFrom(pool, msg.sender, cncAmount); ( uint256 currentHoldingsCRV, uint256 currentHoldingsCVX, uint256 currentHoldingsCNC ) = _getHoldings(IConvexHandler(controller.convexHandler())); _rewardsMeta[_CRV_KEY].lastHoldings = currentHoldingsCRV; _rewardsMeta[_CVX_KEY].lastHoldings = currentHoldingsCVX; _rewardsMeta[_CNC_KEY].lastHoldings = currentHoldingsCNC; emit EarningsClaimed(msg.sender, cncAmount, crvAmount, cvxAmount); return (cncAmount, crvAmount, cvxAmount); } /// @notice Claims all claimable CVX and CRV from Convex for all staked Curve LP tokens. /// Then Swaps all additional rewards tokens for CNC. function claimPoolEarningsAndSellRewardTokens() external override { if (!poolCheckpoint()) { _claimPoolEarningsAndSellRewardTokens(); } } function _claimPoolEarningsAndSellRewardTokens() internal { _claimPoolEarnings(); uint256 cncBalanceBefore_ = CNC.balanceOf(pool); _sellRewardTokens(); uint256 receivedCnc_ = CNC.balanceOf(pool) - cncBalanceBefore_; uint256 _totalStaked = controller.lpTokenStaker().getBalanceForPool(pool); if (_totalStaked > 0) _rewardsMeta[_CNC_KEY].earnedIntegral += receivedCnc_.divDown(_totalStaked); emit SoldRewardTokens(receivedCnc_); } /// @notice Claims all claimable CVX and CRV from Convex for all staked Curve LP tokens function _claimPoolEarnings() internal { _claimingCNC = true; controller.lpTokenStaker().claimCNCRewardsForPool(pool); _claimingCNC = false; uint256 cvxBalance = CVX.balanceOf(pool); uint256 crvBalance = CRV.balanceOf(pool); address convexHandler = controller.convexHandler(); IConvexHandler(convexHandler).claimBatchEarnings(IConicPool(pool).allCurvePools(), pool); uint256 claimedCvx = CVX.balanceOf(pool) - cvxBalance; uint256 claimedCrv = CRV.balanceOf(pool) - crvBalance; emit ClaimedRewards(claimedCrv, claimedCvx); } /// @notice Swaps all additional rewards tokens for CNC. function _sellRewardTokens() internal { uint256 extraRewardsLength_ = _extraRewards.length(); if (extraRewardsLength_ == 0) return; for (uint256 i; i < extraRewardsLength_; i++) { _swapRewardTokenForWeth(_extraRewards.at(i)); } _swapWethForCNC(); } function listExtraRewards() external view returns (address[] memory) { return _extraRewards.values(); } function addExtraReward(address reward) public override onlyOwner returns (bool) { require(reward != address(0), "invalid address"); require( reward != address(CVX) && reward != address(CRV) && reward != address(underlying) && reward != address(CNC), "token not allowed" ); // Checking reward token isn't a Curve Pool LP Token address[] memory curvePools_ = IConicPool(pool).allCurvePools(); for (uint256 i; i < curvePools_.length; i++) { address curveLpToken_ = controller.curveRegistryCache().lpToken(curvePools_[i]); require(reward != curveLpToken_, "token not allowed"); } IERC20(reward).safeApprove(address(SUSHISWAP), 0); IERC20(reward).safeApprove(address(SUSHISWAP), type(uint256).max); emit ExtraRewardAdded(reward); return _extraRewards.add(reward); } function addBatchExtraRewards(address[] memory _rewards) external override onlyOwner { for (uint256 i; i < _rewards.length; i++) { addExtraReward(_rewards[i]); } } function removeExtraReward(address tokenAddress) external onlyOwner { _extraRewards.remove(tokenAddress); emit ExtraRewardRemoved(tokenAddress); } function setExtraRewardsCurvePool(address extraReward_, address curvePool_) external onlyOwner { require(curvePool_ != extraRewardsCurvePool[extraReward_], "must be different to current"); if (curvePool_ != address(0)) { IERC20(extraReward_).safeApprove(curvePool_, 0); IERC20(extraReward_).safeApprove(curvePool_, type(uint256).max); } extraRewardsCurvePool[extraReward_] = curvePool_; emit ExtraRewardsCurvePoolSet(extraReward_, curvePool_); } function setFeePercentage(uint256 _feePercentage) external override onlyOwner { require(_feePercentage < MAX_FEE_PERCENTAGE, "cannot set fee percentage to more than 30%"); require(locker.totalBoosted() > 0); feePercentage = _feePercentage; feesEnabled = true; emit FeesSet(feePercentage); } function claimableRewards( address account ) external view returns (uint256 cncRewards, uint256 crvRewards, uint256 cvxRewards) { uint256 _totalStaked = controller.lpTokenStaker().getBalanceForPool(pool); if (_totalStaked == 0) return (0, 0, 0); (uint256 crvEarned, uint256 cvxEarned, uint256 cncEarned) = _getEarnedRewards(); uint256 userBalance = controller.lpTokenStaker().getUserBalanceForPool(pool, account); cncRewards = _getClaimableReward( account, _CNC_KEY, cncEarned, userBalance, _totalStaked, false ); crvRewards = _getClaimableReward( account, _CRV_KEY, crvEarned, userBalance, _totalStaked, feesEnabled ); cvxRewards = _getClaimableReward( account, _CVX_KEY, cvxEarned, userBalance, _totalStaked, feesEnabled ); } function _getClaimableReward( address account, bytes32 key, uint256 earned, uint256 userBalance, uint256 _totalSupply, bool deductFee ) internal view returns (uint256) { RewardMeta storage meta = _rewardsMeta[key]; uint256 integral = meta.earnedIntegral; if (deductFee) { integral += earned.divDown(_totalSupply).mulDown(ScaledMath.ONE - feePercentage); } else { integral += earned.divDown(_totalSupply); } return meta.accountShare[account] + userBalance.mulDown(integral - meta.accountIntegral[account]); } function _swapRewardTokenForWeth(address rewardToken_) internal { uint256 tokenBalance_ = IERC20(rewardToken_).balanceOf(address(this)); if (tokenBalance_ == 0) return; ICurvePoolV2 curvePool_ = ICurvePoolV2(extraRewardsCurvePool[rewardToken_]); if (address(curvePool_) != address(0)) { (int128 i, int128 j, ) = controller.curveRegistryCache().coinIndices( address(curvePool_), rewardToken_, address(WETH) ); (uint256 from_, uint256 to_) = (uint256(uint128(i)), uint256(uint128(j))); curvePool_.exchange( from_, to_, tokenBalance_, _minAmountOut(address(rewardToken_), address(WETH), tokenBalance_), false, address(this) ); return; } address[] memory path_ = new address[](2); path_[0] = rewardToken_; path_[1] = address(WETH); SUSHISWAP.swapExactTokensForTokens( tokenBalance_, _minAmountOut(address(rewardToken_), address(WETH), tokenBalance_), path_, address(this), block.timestamp ); } function _swapWethForCNC() internal { uint256 wethBalance_ = WETH.balanceOf(address(this)); if (wethBalance_ == 0) return; CNC_ETH_POOL.exchange( 0, 1, wethBalance_, _minAmountOut(address(WETH), address(CNC), wethBalance_), false, pool ); } function _minAmountOut( address tokenIn_, address tokenOut_, uint256 amountIn_ ) internal view returns (uint256) { IOracle oracle_ = controller.priceOracle(); if (tokenIn_ == tokenOut_) { return amountIn_; } // If we don't have a price for either token, we can't calculate the min amount out // This should only ever happen for very minor tokens, so we accept the risk of not having // slippage protection in that case if (!oracle_.isTokenSupported(tokenIn_) || !oracle_.isTokenSupported(tokenOut_)) { return 0; } return amountIn_ .mulDown(oracle_.getUSDPrice(tokenIn_)) .divDown(oracle_.getUSDPrice(tokenOut_)) .convertScale( IERC20Metadata(tokenIn_).decimals(), IERC20Metadata(tokenOut_).decimals() ) .mulDown(SLIPPAGE_THRESHOLD); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "draft-IERC20Permit.sol"; import "Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "ILpToken.sol"; import "IRewardManager.sol"; import "IOracle.sol"; import "IController.sol"; interface IConicPool { event Deposit( address indexed sender, address indexed receiver, uint256 depositedAmount, uint256 lpReceived ); event Withdraw(address indexed account, uint256 amount); event NewWeight(address indexed curvePool, uint256 newWeight); event NewMaxIdleCurveLpRatio(uint256 newRatio); event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx); event HandledDepeggedCurvePool(address curvePool_); event HandledInvalidConvexPid(address curvePool_, uint256 pid_); event CurvePoolAdded(address curvePool_); event CurvePoolRemoved(address curvePool_); event Shutdown(); event DepegThresholdUpdated(uint256 newThreshold); event MaxDeviationUpdated(uint256 newMaxDeviation); struct PoolWeight { address poolAddress; uint256 weight; } struct PoolWithAmount { address poolAddress; uint256 amount; } function underlying() external view returns (IERC20Metadata); function lpToken() external view returns (ILpToken); function rewardManager() external view returns (IRewardManager); function controller() external view returns (IController); function depegThreshold() external view returns (uint256); function maxIdleCurveLpRatio() external view returns (uint256); function getPoolWeight(address curvePool) external view returns (uint256); function setMaxIdleCurveLpRatio(uint256 value) external; function updateDepegThreshold(uint256 value) external; function computeDeviationRatio() external view returns (uint256); function depositFor( address _account, uint256 _amount, uint256 _minLpReceived, bool stake ) external returns (uint256); function deposit(uint256 _amount, uint256 _minLpReceived) external returns (uint256); function deposit( uint256 _amount, uint256 _minLpReceived, bool stake ) external returns (uint256); function exchangeRate() external view returns (uint256); function usdExchangeRate() external view returns (uint256); function allCurvePools() external view returns (address[] memory); function curvePoolsCount() external view returns (uint256); function getCurvePoolAtIndex(uint256 _index) external view returns (address); function unstakeAndWithdraw(uint256 _amount, uint256 _minAmount) external returns (uint256); function withdraw(uint256 _amount, uint256 _minAmount) external returns (uint256); function updateWeights(PoolWeight[] memory poolWeights) external; function getWeight(address curvePool) external view returns (uint256); function getWeights() external view returns (PoolWeight[] memory); function getAllocatedUnderlying() external view returns (PoolWithAmount[] memory); function removeCurvePool(address pool) external; function addCurvePool(address pool) external; function totalCurveLpBalance(address curvePool_) external view returns (uint256); function rebalancingRewardActive() external view returns (bool); function totalDeviationAfterWeightUpdate() external view returns (uint256); function computeTotalDeviation() external view returns (uint256); /// @notice returns the total amount of funds held by this pool in terms of underlying function totalUnderlying() external view returns (uint256); function getTotalAndPerPoolUnderlying() external view returns ( uint256 totalUnderlying_, uint256 totalAllocated_, uint256[] memory perPoolUnderlying_ ); /// @notice same as `totalUnderlying` but returns a cached version /// that might be slightly outdated if oracle prices have changed /// @dev this is useful in cases where we want to reduce gas usage and do /// not need a precise value function cachedTotalUnderlying() external view returns (uint256); function handleInvalidConvexPid(address pool) external; function shutdownPool() external; function isShutdown() external view returns (bool); function handleDepeggedCurvePool(address curvePool_) external; function isBalanced() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IERC20Metadata.sol"; interface ILpToken is IERC20Metadata { function mint(address account, uint256 amount) external returns (uint256); function burn(address _owner, uint256 _amount) external returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IRewardManager { event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx); event SoldRewardTokens(uint256 targetTokenReceived); event ExtraRewardAdded(address reward); event ExtraRewardRemoved(address reward); event ExtraRewardsCurvePoolSet(address extraReward, address curvePool); event FeesSet(uint256 feePercentage); event FeesEnabled(uint256 feePercentage); event EarningsClaimed( address indexed claimedBy, uint256 cncEarned, uint256 crvEarned, uint256 cvxEarned ); function accountCheckpoint(address account) external; function poolCheckpoint() external returns (bool); function addExtraReward(address reward) external returns (bool); function addBatchExtraRewards(address[] memory rewards) external; function pool() external view returns (address); function setFeePercentage(uint256 _feePercentage) external; function claimableRewards( address account ) external view returns (uint256 cncRewards, uint256 crvRewards, uint256 cvxRewards); function claimEarnings() external returns (uint256, uint256, uint256); function claimPoolEarningsAndSellRewardTokens() external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IOracle { event TokenUpdated(address indexed token, address feed, uint256 maxDelay, bool isEthPrice); /// @notice returns the price in USD of symbol. function getUSDPrice(address token) external view returns (uint256); /// @notice returns if the given token is supported for pricing. function isTokenSupported(address token) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IConicPool.sol"; import "IOracle.sol"; import "IInflationManager.sol"; import "ILpTokenStaker.sol"; import "ICurveRegistryCache.sol"; interface IController { event PoolAdded(address indexed pool); event PoolRemoved(address indexed pool); event PoolShutdown(address indexed pool); event ConvexBoosterSet(address convexBooster); event CurveHandlerSet(address curveHandler); event ConvexHandlerSet(address convexHandler); event CurveRegistryCacheSet(address curveRegistryCache); event InflationManagerSet(address inflationManager); event PriceOracleSet(address priceOracle); event WeightUpdateMinDelaySet(uint256 weightUpdateMinDelay); struct WeightUpdate { address conicPoolAddress; IConicPool.PoolWeight[] weights; } // inflation manager function inflationManager() external view returns (IInflationManager); function setInflationManager(address manager) external; // views function curveRegistryCache() external view returns (ICurveRegistryCache); /// lp token staker function setLpTokenStaker(address _lpTokenStaker) external; function lpTokenStaker() external view returns (ILpTokenStaker); // oracle function priceOracle() external view returns (IOracle); function setPriceOracle(address oracle) external; // pool functions function listPools() external view returns (address[] memory); function listActivePools() external view returns (address[] memory); function isPool(address poolAddress) external view returns (bool); function isActivePool(address poolAddress) external view returns (bool); function addPool(address poolAddress) external; function shutdownPool(address poolAddress) external; function removePool(address poolAddress) external; function cncToken() external view returns (address); function lastWeightUpdate(address poolAddress) external view returns (uint256); function updateWeights(WeightUpdate memory update) external; function updateAllWeights(WeightUpdate[] memory weights) external; // handler functions function convexBooster() external view returns (address); function curveHandler() external view returns (address); function convexHandler() external view returns (address); function setConvexBooster(address _convexBooster) external; function setCurveHandler(address _curveHandler) external; function setConvexHandler(address _convexHandler) external; function setCurveRegistryCache(address curveRegistryCache_) external; function emergencyMinter() external view returns (address); function setWeightUpdateMinDelay(uint256 delay) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IInflationManager { event TokensClaimed(address indexed pool, uint256 cncAmount); event RebalancingRewardHandlerAdded(address indexed pool, address indexed handler); event RebalancingRewardHandlerRemoved(address indexed pool, address indexed handler); event PoolWeightsUpdated(); function executeInflationRateUpdate() external; function updatePoolWeights() external; /// @notice returns the weights of the Conic pools to know how much inflation /// each of them will receive, as well as the total amount of USD value in all the pools function computePoolWeights() external view returns (address[] memory _pools, uint256[] memory poolWeights, uint256 totalUSDValue); function computePoolWeight( address pool ) external view returns (uint256 poolWeight, uint256 totalUSDValue); function currentInflationRate() external view returns (uint256); function getCurrentPoolInflationRate(address pool) external view returns (uint256); function handleRebalancingRewards( address account, uint256 deviationBefore, uint256 deviationAfter ) external; function addPoolRebalancingRewardHandler( address poolAddress, address rebalancingRewardHandler ) external; function removePoolRebalancingRewardHandler( address poolAddress, address rebalancingRewardHandler ) external; function rebalancingRewardHandlers( address poolAddress ) external view returns (address[] memory); function hasPoolRebalancingRewardHandlers( address poolAddress, address handler ) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface ILpTokenStaker { event LpTokenStaked(address indexed account, uint256 amount); event LpTokenUnstaked(address indexed account, uint256 amount); event TokensClaimed(address indexed pool, uint256 cncAmount); event Shutdown(); function stake(uint256 amount, address conicPool) external; function unstake(uint256 amount, address conicPool) external; function stakeFor(uint256 amount, address conicPool, address account) external; function unstakeFor(uint256 amount, address conicPool, address account) external; function unstakeFrom(uint256 amount, address account) external; function getUserBalanceForPool( address conicPool, address account ) external view returns (uint256); function getBalanceForPool(address conicPool) external view returns (uint256); function updateBoost(address user) external; function claimCNCRewardsForPool(address pool) external; function claimableCnc(address pool) external view returns (uint256); function checkpoint(address pool) external returns (uint256); function shutdown() external; function getBoost(address user) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IBooster.sol"; import "CurvePoolUtils.sol"; interface ICurveRegistryCache { event PoolInitialized(address indexed pool, uint256 indexed pid); function BOOSTER() external view returns (IBooster); function initPool(address pool_) external; function initPool(address pool_, uint256 pid_) external; function lpToken(address pool_) external view returns (address); function assetType(address pool_) external view returns (CurvePoolUtils.AssetType); function isRegistered(address pool_) external view returns (bool); function hasCoinDirectly(address pool_, address coin_) external view returns (bool); function hasCoinAnywhere(address pool_, address coin_) external view returns (bool); function basePool(address pool_) external view returns (address); function coinIndex(address pool_, address coin_) external view returns (int128); function nCoins(address pool_) external view returns (uint256); function coinIndices( address pool_, address from_, address to_ ) external view returns (int128, int128, bool); function decimals(address pool_) external view returns (uint256[] memory); function interfaceVersion(address pool_) external view returns (uint256); function poolFromLpToken(address lpToken_) external view returns (address); function coins(address pool_) external view returns (address[] memory); function getPid(address _pool) external view returns (uint256); function getRewardPool(address _pool) external view returns (address); function isShutdownPid(uint256 pid_) external view returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface IBooster { function poolInfo( uint256 pid ) external view returns ( address lpToken, address token, address gauge, address crvRewards, address stash, bool shutdown ); function poolLength() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount, bool _stake) external returns (bool); function withdraw(uint256 _pid, uint256 _amount) external returns (bool); function withdrawAll(uint256 _pid) external returns (bool); function depositAll(uint256 _pid, bool _stake) external returns (bool); function earmarkRewards(uint256 _pid) external returns (bool); function isShutdown() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "ICurvePoolV2.sol"; import "ICurvePoolV1.sol"; import "ScaledMath.sol"; library CurvePoolUtils { using ScaledMath for uint256; uint256 internal constant _DEFAULT_IMBALANCE_THRESHOLD = 0.02e18; enum AssetType { USD, ETH, BTC, OTHER, CRYPTO } struct PoolMeta { address pool; uint256 numberOfCoins; AssetType assetType; uint256[] decimals; uint256[] prices; uint256[] thresholds; } function ensurePoolBalanced(PoolMeta memory poolMeta) internal view { uint256 fromDecimals = poolMeta.decimals[0]; uint256 fromBalance = 10 ** fromDecimals; uint256 fromPrice = poolMeta.prices[0]; for (uint256 i = 1; i < poolMeta.numberOfCoins; i++) { uint256 toDecimals = poolMeta.decimals[i]; uint256 toPrice = poolMeta.prices[i]; uint256 toExpectedUnscaled = (fromBalance * fromPrice) / toPrice; uint256 toExpected = toExpectedUnscaled.convertScale( uint8(fromDecimals), uint8(toDecimals) ); uint256 toActual; if (poolMeta.assetType == AssetType.CRYPTO) { // Handling crypto pools toActual = ICurvePoolV2(poolMeta.pool).get_dy(0, i, fromBalance); } else { // Handling other pools toActual = ICurvePoolV1(poolMeta.pool).get_dy(0, int128(uint128(i)), fromBalance); } require( _isWithinThreshold(toExpected, toActual, poolMeta.thresholds[i]), "pool is not balanced" ); } } function _isWithinThreshold( uint256 a, uint256 b, uint256 imbalanceTreshold ) internal pure returns (bool) { if (imbalanceTreshold == 0) imbalanceTreshold = _DEFAULT_IMBALANCE_THRESHOLD; if (a > b) return (a - b).divDown(a) <= imbalanceTreshold; return (b - a).divDown(b) <= imbalanceTreshold; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface ICurvePoolV2 { function token() external view returns (address); function coins(uint256 i) external view returns (address); function factory() external view returns (address); function exchange( uint256 i, uint256 j, uint256 dx, uint256 min_dy, bool use_eth, address receiver ) external returns (uint256); function exchange_underlying( uint256 i, uint256 j, uint256 dx, uint256 min_dy, address receiver ) external returns (uint256); function add_liquidity( uint256[2] memory amounts, uint256 min_mint_amount, bool use_eth, address receiver ) external returns (uint256); function add_liquidity( uint256[2] memory amounts, uint256 min_mint_amount ) external returns (uint256); function add_liquidity( uint256[3] memory amounts, uint256 min_mint_amount, bool use_eth, address receiver ) external returns (uint256); function add_liquidity( uint256[3] memory amounts, uint256 min_mint_amount ) external returns (uint256); function remove_liquidity( uint256 _amount, uint256[2] memory min_amounts, bool use_eth, address receiver ) external; function remove_liquidity(uint256 _amount, uint256[2] memory min_amounts) external; function remove_liquidity( uint256 _amount, uint256[3] memory min_amounts, bool use_eth, address receiver ) external; function remove_liquidity(uint256 _amount, uint256[3] memory min_amounts) external; function remove_liquidity_one_coin( uint256 token_amount, uint256 i, uint256 min_amount, bool use_eth, address receiver ) external returns (uint256); function get_dy(uint256 i, uint256 j, uint256 dx) external view returns (uint256); function calc_token_amount(uint256[] memory amounts) external view returns (uint256); function calc_withdraw_one_coin( uint256 token_amount, uint256 i ) external view returns (uint256); function get_virtual_price() external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface ICurvePoolV1 { function get_virtual_price() external view returns (uint256); function add_liquidity(uint256[8] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[7] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[6] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[5] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount) external; function remove_liquidity_imbalance( uint256[4] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity_imbalance( uint256[3] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity_imbalance( uint256[2] calldata amounts, uint256 max_burn_amount ) external; function lp_token() external view returns (address); function A_PRECISION() external view returns (uint256); function A_precise() external view returns (uint256); function remove_liquidity(uint256 _amount, uint256[3] calldata min_amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function coins(uint256 i) external view returns (address); function balances(uint256 i) external view returns (uint256); function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256); function calc_token_amount( uint256[4] calldata amounts, bool deposit ) external view returns (uint256); function calc_token_amount( uint256[3] calldata amounts, bool deposit ) external view returns (uint256); function calc_token_amount( uint256[2] calldata amounts, bool deposit ) external view returns (uint256); function calc_withdraw_one_coin( uint256 _token_amount, int128 i ) external view returns (uint256); function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_amount ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; library ScaledMath { uint256 internal constant DECIMALS = 18; uint256 internal constant ONE = 10 ** DECIMALS; function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { return (a * b) / ONE; } function mulDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) { return (a * b) / (10 ** decimals); } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { return (a * ONE) / b; } function divDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) { return (a * 10 ** decimals) / b; } function divUp(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } return ((a * ONE) - 1) / b + 1; } function mulDown(int256 a, int256 b) internal pure returns (int256) { return (a * b) / int256(ONE); } function mulDownUint128(uint128 a, uint128 b) internal pure returns (uint128) { return (a * b) / uint128(ONE); } function mulDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) { return (a * b) / int256(10 ** decimals); } function divDown(int256 a, int256 b) internal pure returns (int256) { return (a * int256(ONE)) / b; } function divDownUint128(uint128 a, uint128 b) internal pure returns (uint128) { return (a * uint128(ONE)) / b; } function divDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) { return (a * int256(10 ** decimals)) / b; } function convertScale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { if (fromDecimals == toDecimals) return a; if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals); return upscale(a, fromDecimals, toDecimals); } function convertScale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { if (fromDecimals == toDecimals) return a; if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals); return upscale(a, fromDecimals, toDecimals); } function upscale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { return a * (10 ** (toDecimals - fromDecimals)); } function downscale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { return a / (10 ** (fromDecimals - toDecimals)); } function upscale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { return a * int256(10 ** (toDecimals - fromDecimals)); } function downscale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { return a / int256(10 ** (fromDecimals - toDecimals)); } function intPow(uint256 a, uint256 n) internal pure returns (uint256) { uint256 result = ONE; for (uint256 i; i < n; ) { result = mulDown(result, a); unchecked { ++i; } } return result; } function absSub(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { return a >= b ? a - b : b - a; } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IConvexHandler { function deposit(address _curvePool, uint256 _amount) external; function claimBatchEarnings(address[] memory _curvePools, address _conicPool) external; function getRewardPool(address _curvePool) external view returns (address); function getCrvEarned(address _account, address _curvePool) external view returns (uint256); function getCrvEarnedBatch( address _account, address[] memory _curvePools ) external view returns (uint256); function computeClaimableConvex(uint256 crvAmount) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "MerkleProof.sol"; interface ICNCLockerV2 { event Locked(address indexed account, uint256 amount, uint256 unlockTime, bool relocked); event UnlockExecuted(address indexed account, uint256 amount); event Relocked(address indexed account, uint256 amount); event KickExecuted(address indexed account, address indexed kicker, uint256 amount); event FeesReceived(address indexed sender, uint256 crvAmount, uint256 cvxAmount); event FeesClaimed(address indexed claimer, uint256 crvAmount, uint256 cvxAmount); event AirdropBoostClaimed(address indexed claimer, uint256 amount); event Shutdown(); event TokenRecovered(address indexed token); struct VoteLock { uint256 amount; uint64 unlockTime; uint128 boost; uint64 id; } function lock(uint256 amount, uint64 lockTime) external; function lock(uint256 amount, uint64 lockTime, bool relock) external; function lockFor(uint256 amount, uint64 lockTime, bool relock, address account) external; function relock(uint64 lockId, uint64 lockTime) external; function relock(uint64 lockTime) external; function relockMultiple(uint64[] calldata lockIds, uint64 lockTime) external; function totalBoosted() external view returns (uint256); function shutDown() external; function recoverToken(address token) external; function executeAvailableUnlocks() external returns (uint256); function executeAvailableUnlocksFor(address dst) external returns (uint256); function executeUnlocks(address dst, uint64[] calldata lockIds) external returns (uint256); function claimAirdropBoost(uint256 amount, MerkleProof.Proof calldata proof) external; // This will need to include the boosts etc. function balanceOf(address user) external view returns (uint256); function unlockableBalance(address user) external view returns (uint256); function unlockableBalanceBoosted(address user) external view returns (uint256); function kick(address user, uint64 lockId) external; function receiveFees(uint256 amountCrv, uint256 amountCvx) external; function claimableFees( address account ) external view returns (uint256 claimableCrv, uint256 claimableCvx); function claimFees() external returns (uint256 crvAmount, uint256 cvxAmount); function computeBoost(uint128 lockTime) external view returns (uint128); function airdropBoost(address account) external view returns (uint256); function claimedAirdrop(address account) external view returns (bool); function totalVoteBoost(address account) external view returns (uint256); function totalRewardsBoost(address account) external view returns (uint256); function userLocks(address account) external view returns (VoteLock[] memory); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; library MerkleProof { struct Proof { uint16 nodeIndex; bytes32[] hashes; } function isValid( Proof memory proof, bytes32 node, bytes32 merkleRoot ) internal pure returns (bool) { uint256 length = proof.hashes.length; uint16 nodeIndex = proof.nodeIndex; for (uint256 i = 0; i < length; i++) { if (nodeIndex % 2 == 0) { node = keccak256(abi.encodePacked(node, proof.hashes[i])); } else { node = keccak256(abi.encodePacked(proof.hashes[i], node)); } nodeIndex /= 2; } return node == merkleRoot; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface UniswapRouter02 { function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external returns (uint256 amountIn); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external view returns (uint256 amountOut); function getAmountsIn( uint256 amountOut, address[] calldata path ) external view returns (uint256[] memory amounts); function getAmountsOut( uint256 amountIn, address[] memory path ) external view returns (uint256[] memory amounts); function getReserves( address factory, address tokenA, address tokenB ) external view returns (uint256 reserveA, uint256 reserveB); function WETH() external pure returns (address); } interface UniswapV2Pair { function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast); } interface UniswapV2Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); }
{ "evmVersion": "london", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "RewardManagerV2.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_underlying","type":"address"},{"internalType":"address","name":"cncLocker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"claimedCrv","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimedCvx","type":"uint256"}],"name":"ClaimedRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"claimedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"cncEarned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"crvEarned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cvxEarned","type":"uint256"}],"name":"EarningsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"}],"name":"ExtraRewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"}],"name":"ExtraRewardRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"extraReward","type":"address"},{"indexed":false,"internalType":"address","name":"curvePool","type":"address"}],"name":"ExtraRewardsCurvePoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feePercentage","type":"uint256"}],"name":"FeesEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feePercentage","type":"uint256"}],"name":"FeesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"targetTokenReceived","type":"uint256"}],"name":"SoldRewardTokens","type":"event"},{"inputs":[],"name":"CNC","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CNC_ETH_POOL","outputs":[{"internalType":"contract ICurvePoolV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CRV","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CVX","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUSHISWAP","outputs":[{"internalType":"contract UniswapRouter02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"accountCheckpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_rewards","type":"address[]"}],"name":"addBatchExtraRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"}],"name":"addExtraReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimEarnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimPoolEarningsAndSellRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimableRewards","outputs":[{"internalType":"uint256","name":"cncRewards","type":"uint256"},{"internalType":"uint256","name":"crvRewards","type":"uint256"},{"internalType":"uint256","name":"cvxRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"extraRewardsCurvePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"listExtraRewards","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locker","outputs":[{"internalType":"contract ICNCLockerV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpToken","outputs":[{"internalType":"contract ILpToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolCheckpoint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"removeExtraReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"extraReward_","type":"address"},{"internalType":"address","name":"curvePool_","type":"address"}],"name":"setExtraRewardsCurvePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"setFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b50604051620048e1380380620048e18339810160408190526200003491620004ec565b6200003f33620000aa565b6001600160a01b03828116608052831660a0526200009573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273838af967537350d2c44abb8c010e49e32673ab94600019620000fa602090811b62001afd17901c565b6001600160a01b031660c05250620005f49050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b801580620001785750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801562000150573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000176919062000536565b155b620001f05760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084015b60405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620002489185916200024d16565b505050565b6000620002a9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200032b60201b62001c4a179092919060201c565b805190915015620002485780806020019051810190620002ca919062000550565b620002485760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620001e7565b60606200033c848460008562000344565b949350505050565b606082471015620003a75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620001e7565b600080866001600160a01b03168587604051620003c59190620005a1565b60006040518083038185875af1925050503d806000811462000404576040519150601f19603f3d011682016040523d82523d6000602084013e62000409565b606091505b5090925090506200041d8783838762000428565b979650505050505050565b606083156200049c57825160000362000494576001600160a01b0385163b620004945760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620001e7565b50816200033c565b6200033c8383815115620004b35781518083602001fd5b8060405162461bcd60e51b8152600401620001e79190620005bf565b80516001600160a01b0381168114620004e757600080fd5b919050565b6000806000606084860312156200050257600080fd5b6200050d84620004cf565b92506200051d60208501620004cf565b91506200052d60408501620004cf565b90509250925092565b6000602082840312156200054957600080fd5b5051919050565b6000602082840312156200056357600080fd5b815180151581146200057457600080fd5b9392505050565b60005b83811015620005985781810151838201526020016200057e565b50506000910152565b60008251620005b58184602087016200057b565b9190910192915050565b6020815260008251806020840152620005e08160408501602087016200057b565b601f01601f19169190910160400192915050565b60805160a05160c051614238620006a9600039600081816103e801528181610a9101528181610ad001528181610b12015261105d015260008181610498015281816105f1015281816107b801528181610d4c01528181611643015281816117a6015281816118c501528181611fdf0152818161227c015281816124c4015281816125ff0152818161295801528181612b410152818161329b015261377f0152600081816102da0152610c2b01526142386000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c8063a001ecdd1161010f578063d9ceab13116100a2578063e846500911610071578063e846500914610471578063f2fde38b14610480578063f77c479114610493578063fe09d54d146104ba57600080fd5b8063d9ceab131461040a578063d9e65ced1461042d578063dc01f60d14610456578063e77061831461046957600080fd5b8063ae06c1b7116100de578063ae06c1b7146103aa578063bf928f8b146103bd578063c4d66de8146103d0578063d7b96d4e146103e357600080fd5b8063a001ecdd14610366578063a64e4f8a1461036f578063a80ff90a1461037c578063ad5c46481461038f57600080fd5b8063632473da11610187578063759cb53b11610156578063759cb53b146103045780638da5cb5b1461031f578063945c9142146103305780639c708aab1461034b57600080fd5b8063632473da146102a55780636dc47e1e146102c05780636f307dc3146102d5578063715018a6146102fc57600080fd5b8063558e44d3116101c3578063558e44d31461024a5780635790a0c8146102675780635e43c47b1461027f5780635fcbd2851461029257600080fd5b806303950fb5146101ea57806316f0115b146101ff578063495567091461022f575b600080fd5b6101fd6101f8366004613b75565b6104cd565b005b600154610212906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61021273838af967537350d2c44abb8c010e49e32673ab9481565b610259670429d069189e000081565b604051908152602001610226565b61026f6105ec565b6040519015158152602001610226565b61026f61028d366004613bae565b610b86565b600254610212906001600160a01b031681565b610212739ae380f0272e2162340a5bb646c354271c0f5cfc81565b6102c8610f6e565b6040516102269190613c0f565b6102127f000000000000000000000000000000000000000000000000000000000000000081565b6101fd610f7f565b610212734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b81565b6000546001600160a01b0316610212565b61021273d533a949740bb3306d119cc777fa900ba034cd5281565b61021273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f81565b61025960085481565b60075461026f9060ff1681565b6101fd61038a366004613bae565b610f93565b61021273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6101fd6103b8366004613c22565b610fe7565b6101fd6103cb366004613bae565b61112b565b6101fd6103de366004613bae565b611137565b6102127f000000000000000000000000000000000000000000000000000000000000000081565b6104126112fd565b60408051938452602084019290925290820152606001610226565b61021261043b366004613bae565b6005602052600090815260409020546001600160a01b031681565b610412610464366004613bae565b61179e565b6101fd611a2a565b610259670d2f13f7789f000081565b6101fd61048e366004613bae565b611a3e565b6102127f000000000000000000000000000000000000000000000000000000000000000081565b6101fd6104c8366004613ca6565b611ab4565b6104d5611c63565b6001600160a01b038083166000908152600560205260409020548116908216036105465760405162461bcd60e51b815260206004820152601c60248201527f6d75737420626520646966666572656e7420746f2063757272656e740000000060448201526064015b60405180910390fd5b6001600160a01b038116156105805761056a6001600160a01b038316826000611afd565b6105806001600160a01b03831682600019611afd565b6001600160a01b0382811660008181526005602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f8c529c22babad500cea1516422f2bf23f6e1e7fab884b816062d20a9a0f78fef91015b60405180910390a15050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106719190613d45565b9050600080600061068184611cbd565b6231b93b60e91b600090815260066020527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf644549396509194509250906106c79085613d78565b620c6ecf60eb1b600090815260066020527f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb54919250906107089085613d78565b62636e6360e81b600090815260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f54919250906107499085613d78565b600754909150600090819060ff16156107b45760085461076a9086906120e3565b9150610781600854856120e390919063ffffffff16565b905061078d8286613d78565b94506107998185613d78565b93506107a58289613d78565b97506107b18188613d78565b96505b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190613d8b565b905080156108e3576108bf620c6ecf60eb1b89878461210e565b6108d16231b93b60e91b8a888461210e565b6108e362636e6360e81b88868461210e565b60075460ff166108fe5760009a505050505050505050505090565b6001546040516370a0823160e01b81526001600160a01b03909116600482015260009073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa15801561095d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109819190613d8b565b841180610a0c57506001546040516370a0823160e01b81526001600160a01b039091166004820152734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa1580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190613d8b565b83115b15610a1d57610a19612152565b5060015b600154610a4a9073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b031630876123fb565b600154610a7790734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906001600160a01b031630866123fb565b610ab673d533a949740bb3306d119cc777fa900ba034cd527f000000000000000000000000000000000000000000000000000000000000000086611afd565b610af5734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b7f000000000000000000000000000000000000000000000000000000000000000085611afd565b6040516309e690eb60e31b815260048101859052602481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634f34875890604401600060405180830381600087803b158015610b5e57600080fd5b505af1158015610b72573d6000803e3d6000fd5b50929e9d5050505050505050505050505050565b6000610b90611c63565b6001600160a01b038216610bd85760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015260640161053d565b6001600160a01b038216734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b14801590610c2257506001600160a01b03821673d533a949740bb3306d119cc777fa900ba034cd5214155b8015610c6057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614155b8015610c8957506001600160a01b038216739ae380f0272e2162340a5bb646c354271c0f5cfc14155b610cc95760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08185b1b1bddd959607a1b604482015260640161053d565b600154604080516337c9a55f60e11b815290516000926001600160a01b031691636f934abe91600480830192869291908290030181865afa158015610d12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d3a9190810190613da4565b905060005b8151811015610eca5760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639f82b2176040518163ffffffff1660e01b8152600401602060405180830381865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190613d45565b6001600160a01b03166376a562a4848481518110610dec57610dec613e33565b60200260200101516040518263ffffffff1660e01b8152600401610e1f91906001600160a01b0391909116815260200190565b602060405180830381865afa158015610e3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e609190613d45565b9050806001600160a01b0316856001600160a01b031603610eb75760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08185b1b1bddd959607a1b604482015260640161053d565b5080610ec281613e49565b915050610d3f565b50610ef46001600160a01b03841673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f6000611afd565b610f1e6001600160a01b03841673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f600019611afd565b6040516001600160a01b03841681527fd432e6f46dbf91c120fdfa95a1f4bf5c43f04d957fbc3a32e693be0d29bf17b09060200160405180910390a1610f65600384612439565b9150505b919050565b6060610f7a600361244e565b905090565b610f87611c63565b610f91600061245b565b565b610f9b611c63565b610fa66003826124ab565b506040516001600160a01b03821681527fe0f3b1406ab4dd940a92a081b1bcef51da212a57978cc8f6dde5c89ab41a5aa7906020015b60405180910390a150565b610fef611c63565b670429d069189e000081106110595760405162461bcd60e51b815260206004820152602a60248201527f63616e6e6f7420736574206665652070657263656e7461676520746f206d6f7260448201526965207468616e2033302560b01b606482015260840161053d565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663631516c26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd9190613d8b565b116110e757600080fd5b60088190556007805460ff191660011790556040517f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b90610fdc9083815260200190565b611134816124c0565b50565b61113f611c63565b600054600160a81b900460ff161580801561116757506000546001600160a01b90910460ff16105b806111885750303b1580156111885750600054600160a01b900460ff166001145b6111eb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161053d565b6000805460ff60a01b1916600160a01b1790558015611218576000805460ff60a81b1916600160a81b1790555b600180546001600160a01b0319166001600160a01b03841690811790915560408051635fcbd28560e01b81529051635fcbd285916004808201926020929091908290030181865afa158015611271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112959190613d45565b600280546001600160a01b0319166001600160a01b039290921691909117905580156112f9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016105e0565b5050565b600080600061130b336124c0565b3360009081527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf64660209081526040808320547f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bd8352818420547f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c51909352928190205460015491516370a0823160e01b81526001600160a01b0390921660048301529073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa1580156113e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140d9190613d8b565b83118061149857506001546040516370a0823160e01b81526001600160a01b039091166004820152734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015611471573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114959190613d8b565b82115b8061152157506001546040516370a0823160e01b81526001600160a01b039091166004820152739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa1580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e9190613d8b565b81115b1561152e5761152e612152565b3360008181527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c51602090815260408083208390557f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bd82528083208390557fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6469091528120556001546115df9173d533a949740bb3306d119cc777fa900ba034cd52916001600160a01b031690866123fb565b60015461160c90734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906001600160a01b031633856123fb565b60015461163990739ae380f0272e2162340a5bb646c354271c0f5cfc906001600160a01b031633846123fb565b60008060006116c87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190613d45565b611cbd565b600660209081527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6448490557f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb83905562636e6360e81b6000527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f829055604080518981529182018b90528101899052929550909350915033907f06f39318c760ad4d630f57ba8f8d3c21b8e1deb076e19476d1dece4e3d737e7a9060600160405180910390a25091979396509194509192505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611802573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118269190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa15801561186f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118939190613d8b565b9050806000036118ae57600080600093509350935050611a23565b60008060006118bb6125f7565b92509250925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119459190613d45565b600154604051637d2041e560e11b81526001600160a01b0391821660048201528b8216602482015291169063fa4083ca90604401602060405180830381865afa158015611996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ba9190613d8b565b90506119d18962636e6360e81b8484896000612696565b97506119f6896231b93b60e91b868489600760009054906101000a900460ff16612696565b9650611a1b89620c6ecf60eb1b858489600760009054906101000a900460ff16612696565b955050505050505b9193909250565b611a326105ec565b610f9157610f91612152565b611a46611c63565b6001600160a01b038116611aab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161053d565b6111348161245b565b611abc611c63565b60005b81518110156112f957611aea828281518110611add57611add613e33565b6020026020010151610b86565b5080611af581613e49565b915050611abf565b801580611b775750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611b51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b759190613d8b565b155b611be25760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161053d565b6040516001600160a01b038316602482015260448101829052611c4590849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612763565b505050565b6060611c598484600085612835565b90505b9392505050565b6000546001600160a01b03163314610f915760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161053d565b600080600080600160009054906101000a90046001600160a01b03166001600160a01b0316636f934abe6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d16573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d3e9190810190613da4565b600154604051631b066a0160e31b81529192506000916001600160a01b038881169263d833500892611d7892909116908690600401613e62565b602060405180830381865afa158015611d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db99190613d8b565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909150819073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190613d8b565b611e489190613e86565b60405163323808cd60e01b8152600481018390529095506000906001600160a01b0388169063323808cd90602401602060405180830381865afa158015611e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb79190613d8b565b6001546040516370a0823160e01b81526001600160a01b0390911660048201529091508190734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015611f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3c9190613d8b565b611f469190613e86565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909550739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa158015611fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc99190613d8b565b600254909450600160a01b900460ff166120d9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561203b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205f9190613d45565b6001546040516334d21ea360e21b81526001600160a01b03918216600482015291169063d3487a8c90602401602060405180830381865afa1580156120a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120cc9190613d8b565b6120d69085613e86565b93505b5050509193909250565b60006120f16012600a613f7d565b6120fb8385613f89565b6121059190613fa0565b90505b92915050565b6121188282612912565b60008581526006602052604081208054909190612136908490613e86565b9091555050506000928352506006602052604090912060010155565b61215a61292b565b6001546040516370a0823160e01b81526001600160a01b039091166004820152600090739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa1580156121b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121dd9190613d8b565b90506121e7612e11565b6001546040516370a0823160e01b81526001600160a01b0390911660048201526000908290739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa158015612248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226c9190613d8b565b6122769190613d78565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc9190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa158015612345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123699190613d8b565b905080156123c35761237b8282612912565b62636e6360e81b600090815260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4e80549091906123bd908490613e86565b90915550505b6040518281527ffc8ed0cd46874d9c3cf1425e1b3bbf9c523bc17c4a959c2c2f600e016f4eddef9060200160405180910390a1505050565b6040516001600160a01b03808516602483015283166044820152606481018290526124339085906323b872dd60e01b90608401611c0e565b50505050565b6000612105836001600160a01b038416612e63565b60606000611c5c83612eb2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000612105836001600160a01b038416612f0e565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125449190613d45565b600154604051637d2041e560e11b81526001600160a01b039182166004820152848216602482015291169063fa4083ca90604401602060405180830381865afa158015612595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b99190613d8b565b90506125c36105ec565b506125d562636e6360e81b8383613001565b6125e66231b93b60e91b8383613001565b6112f9620c6ecf60eb1b8383613001565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561265b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267f9190613d45565b905061268a8161309c565b93509350935050909192565b6000858152600660205260408120805483156126ea576008546126d9906126bf6012600a613f7d565b6126c99190613d78565b6126d38988612912565b906120e3565b6126e39082613e86565b9050612701565b6126f48786612912565b6126fe9082613e86565b90505b6001600160a01b03891660009081526002830160205260409020546127319061272a9083613d78565b87906120e3565b6001600160a01b038a1660009081526003840160205260409020546127569190613e86565b9998505050505050505050565b60006127b8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c4a9092919063ffffffff16565b805190915015611c4557808060200190518101906127d69190613fd2565b611c455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161053d565b6060824710156128965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161053d565b600080866001600160a01b031685876040516128b29190614011565b60006040518083038185875af1925050503d80600081146128ef576040519150601f19603f3d011682016040523d82523d6000602084013e6128f4565b606091505b50915091506129058783838761316d565b925050505b949350505050565b6000816129216012600a613f7d565b6120fb9085613f89565b6002805460ff60a01b1916600160a01b17905560408051632421cf3f60e11b815290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916348439e7e9160048083019260209291908290030181865afa1580156129a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c79190613d45565b60015460405163a0190c1760e01b81526001600160a01b03918216600482015291169063a0190c1790602401600060405180830381600087803b158015612a0d57600080fd5b505af1158015612a21573d6000803e3d6000fd5b50506002805460ff60a01b1916905550506001546040516370a0823160e01b81526001600160a01b039091166004820152600090734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015612a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab59190613d8b565b6001546040516370a0823160e01b81526001600160a01b03909116600482015290915060009073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015612b17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3b9190613d8b565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc19190613d45565b9050806001600160a01b031663bc810e26600160009054906101000a90046001600160a01b03166001600160a01b0316636f934abe6040518163ffffffff1660e01b8152600401600060405180830381865afa158015612c25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c4d9190810190613da4565b6001546040516001600160e01b031960e085901b168152612c7b92916001600160a01b03169060040161402d565b600060405180830381600087803b158015612c9557600080fd5b505af1158015612ca9573d6000803e3d6000fd5b50506001546040516370a0823160e01b81526001600160a01b03909116600482015260009250859150734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d329190613d8b565b612d3c9190613d78565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909150600090849073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015612da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc49190613d8b565b612dce9190613d78565b60408051828152602081018590529192507f141d6e75554381bcc1326596e8010e6c432bb0988e14ca0310d85837a211d292910160405180910390a15050505050565b6000612e1d60036131e6565b905080600003612e2a5750565b60005b81811015612e5a57612e48612e436003836131f0565b6131fc565b80612e5281613e49565b915050612e2d565b506111346135c2565b6000818152600183016020526040812054612eaa57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612108565b506000612108565b606081600001805480602002602001604051908101604052809291908181526020018280548015612f0257602002820191906000526020600020905b815481526020019060010190808311612eee575b50505050509050919050565b60008181526001830160205260408120548015612ff7576000612f32600183613d78565b8554909150600090612f4690600190613d78565b9050818114612fab576000866000018281548110612f6657612f66613e33565b9060005260206000200154905080876000018481548110612f8957612f89613e33565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612fbc57612fbc614057565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612108565b6000915050612108565b60008381526006602090815260408083206001600160a01b03861684526002810190925282205481549192916130419161303a91613d78565b84906120e3565b6001600160a01b0385166000908152600384016020526040812080549293508392909190613070908490613e86565b909155505081546001600160a01b03909416600090815260029092016020525060409020919091555050565b6000806000806000806130ae87611cbd565b6231b93b60e91b60005260066020527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6445492955090935091506130f19084613d78565b620c6ecf60eb1b60005260066020527f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb5490965061312f9083613d78565b62636e6360e81b60005260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f549095506120d69082613d78565b606083156131dc5782516000036131d5576001600160a01b0385163b6131d55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161053d565b508161290a565b61290a8383613726565b6000612108825490565b60006121058383613750565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613243573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132679190613d8b565b905080600003613275575050565b6001600160a01b03808316600090815260056020526040902054168015613482576000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639f82b2176040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061331b9190613d45565b604051632feaac8560e11b81526001600160a01b038581166004830152878116602483015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260448301529190911690635fd5590a90606401606060405180830381865afa158015613385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a9919061407f565b5090925090506fffffffffffffffffffffffffffffffff8083169082166001600160a01b03851663ce7d65038383896133f78c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28361377a565b6040516001600160e01b031960e087901b1681526004810194909452602484019290925260448301526064820152600060848201523060a482015260c4016020604051808303816000875af1158015613454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134789190613d8b565b5050505050505050565b60408051600280825260608201835260009260208301908036833701905050905083816000815181106134b7576134b7613e33565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2816001815181106134ff576134ff613e33565b6001600160a01b039092166020928302919091019091015273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f6338ed1739846135518773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28361377a565b8430426040518663ffffffff1660e01b81526004016135749594939291906140c2565b6000604051808303816000875af1158015613593573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526135bb91908101906140fe565b5050505050565b6040516370a0823160e01b815230600482015260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136389190613d8b565b9050806000036136455750565b73838af967537350d2c44abb8c010e49e32673ab9463ce7d6503600060018461369773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2739ae380f0272e2162340a5bb646c354271c0f5cfc8361377a565b60015460405160e087901b6001600160e01b03191681526004810195909552602485019390935260448401919091526064830152600060848301526001600160a01b031660a482015260c4016020604051808303816000875af1158015613702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f99190613d8b565b8151156137365781518083602001fd5b8060405162461bcd60e51b815260040161053d9190614184565b600082600001828154811061376757613767613e33565b9060005260206000200154905092915050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632630c12f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137ff9190613d45565b9050836001600160a01b0316856001600160a01b0316036138235782915050611c5c565b6040516375151b6360e01b81526001600160a01b0386811660048301528216906375151b6390602401602060405180830381865afa158015613869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388d9190613fd2565b158061390057506040516375151b6360e01b81526001600160a01b0385811660048301528216906375151b6390602401602060405180830381865afa1580156138da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138fe9190613fd2565b155b1561390f576000915050611c5c565b613ad4670d2f13f7789f00006126d3876001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561395c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061398091906141b7565b876001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156139be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139e291906141b7565b604051638b2f0f4f60e01b81526001600160a01b038a81166004830152613acd9190881690638b2f0f4f90602401602060405180830381865afa158015613a2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a519190613d8b565b604051638b2f0f4f60e01b81526001600160a01b038d81166004830152613ac791908a1690638b2f0f4f90602401602060405180830381865afa158015613a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac09190613d8b565b8b906120e3565b90612912565b9190613add565b95945050505050565b60008160ff168360ff1603613af3575082611c5c565b8160ff168360ff161115613b1357613b0c848484613b1e565b9050611c5c565b611c59848484613b3f565b6000613b2a82846141da565b613b3590600a6141f3565b611c599085613fa0565b6000613b4b83836141da565b613b5690600a6141f3565b611c599085613f89565b6001600160a01b038116811461113457600080fd5b60008060408385031215613b8857600080fd5b8235613b9381613b60565b91506020830135613ba381613b60565b809150509250929050565b600060208284031215613bc057600080fd5b8135611c5c81613b60565b600081518084526020808501945080840160005b83811015613c045781516001600160a01b031687529582019590820190600101613bdf565b509495945050505050565b6020815260006121056020830184613bcb565b600060208284031215613c3457600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c7a57613c7a613c3b565b604052919050565b600067ffffffffffffffff821115613c9c57613c9c613c3b565b5060051b60200190565b60006020808385031215613cb957600080fd5b823567ffffffffffffffff811115613cd057600080fd5b8301601f81018513613ce157600080fd5b8035613cf4613cef82613c82565b613c51565b81815260059190911b82018301908381019087831115613d1357600080fd5b928401925b82841015613d3a578335613d2b81613b60565b82529284019290840190613d18565b979650505050505050565b600060208284031215613d5757600080fd5b8151611c5c81613b60565b634e487b7160e01b600052601160045260246000fd5b8181038181111561210857612108613d62565b600060208284031215613d9d57600080fd5b5051919050565b60006020808385031215613db757600080fd5b825167ffffffffffffffff811115613dce57600080fd5b8301601f81018513613ddf57600080fd5b8051613ded613cef82613c82565b81815260059190911b82018301908381019087831115613e0c57600080fd5b928401925b82841015613d3a578351613e2481613b60565b82529284019290840190613e11565b634e487b7160e01b600052603260045260246000fd5b600060018201613e5b57613e5b613d62565b5060010190565b6001600160a01b0383168152604060208201819052600090611c5990830184613bcb565b8082018082111561210857612108613d62565b600181815b80851115613ed4578160001904821115613eba57613eba613d62565b80851615613ec757918102915b93841c9390800290613e9e565b509250929050565b600082613eeb57506001612108565b81613ef857506000612108565b8160018114613f0e5760028114613f1857613f34565b6001915050612108565b60ff841115613f2957613f29613d62565b50506001821b612108565b5060208310610133831016604e8410600b8410161715613f57575081810a612108565b613f618383613e99565b8060001904821115613f7557613f75613d62565b029392505050565b60006121058383613edc565b808202811582820484141761210857612108613d62565b600082613fbd57634e487b7160e01b600052601260045260246000fd5b500490565b80518015158114610f6957600080fd5b600060208284031215613fe457600080fd5b61210582613fc2565b60005b83811015614008578181015183820152602001613ff0565b50506000910152565b60008251614023818460208701613fed565b9190910192915050565b6040815260006140406040830185613bcb565b905060018060a01b03831660208301529392505050565b634e487b7160e01b600052603160045260246000fd5b8051600f81900b8114610f6957600080fd5b60008060006060848603121561409457600080fd5b61409d8461406d565b92506140ab6020850161406d565b91506140b960408501613fc2565b90509250925092565b85815284602082015260a0604082015260006140e160a0830186613bcb565b6001600160a01b0394909416606083015250608001529392505050565b6000602080838503121561411157600080fd5b825167ffffffffffffffff81111561412857600080fd5b8301601f8101851361413957600080fd5b8051614147613cef82613c82565b81815260059190911b8201830190838101908783111561416657600080fd5b928401925b82841015613d3a5783518252928401929084019061416b565b60208152600082518060208401526141a3816040850160208701613fed565b601f01601f19169190910160400192915050565b6000602082840312156141c957600080fd5b815160ff81168114611c5c57600080fd5b60ff828116828216039081111561210857612108613d62565b600061210560ff841683613edc56fea2646970667358221220eb3b911f932c44907416896aa3c17f5b21873905e8d582734f2ca200d89cae8764736f6c63430008110033000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063a001ecdd1161010f578063d9ceab13116100a2578063e846500911610071578063e846500914610471578063f2fde38b14610480578063f77c479114610493578063fe09d54d146104ba57600080fd5b8063d9ceab131461040a578063d9e65ced1461042d578063dc01f60d14610456578063e77061831461046957600080fd5b8063ae06c1b7116100de578063ae06c1b7146103aa578063bf928f8b146103bd578063c4d66de8146103d0578063d7b96d4e146103e357600080fd5b8063a001ecdd14610366578063a64e4f8a1461036f578063a80ff90a1461037c578063ad5c46481461038f57600080fd5b8063632473da11610187578063759cb53b11610156578063759cb53b146103045780638da5cb5b1461031f578063945c9142146103305780639c708aab1461034b57600080fd5b8063632473da146102a55780636dc47e1e146102c05780636f307dc3146102d5578063715018a6146102fc57600080fd5b8063558e44d3116101c3578063558e44d31461024a5780635790a0c8146102675780635e43c47b1461027f5780635fcbd2851461029257600080fd5b806303950fb5146101ea57806316f0115b146101ff578063495567091461022f575b600080fd5b6101fd6101f8366004613b75565b6104cd565b005b600154610212906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61021273838af967537350d2c44abb8c010e49e32673ab9481565b610259670429d069189e000081565b604051908152602001610226565b61026f6105ec565b6040519015158152602001610226565b61026f61028d366004613bae565b610b86565b600254610212906001600160a01b031681565b610212739ae380f0272e2162340a5bb646c354271c0f5cfc81565b6102c8610f6e565b6040516102269190613c0f565b6102127f000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e81565b6101fd610f7f565b610212734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b81565b6000546001600160a01b0316610212565b61021273d533a949740bb3306d119cc777fa900ba034cd5281565b61021273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f81565b61025960085481565b60075461026f9060ff1681565b6101fd61038a366004613bae565b610f93565b61021273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6101fd6103b8366004613c22565b610fe7565b6101fd6103cb366004613bae565b61112b565b6101fd6103de366004613bae565b611137565b6102127f0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf81565b6104126112fd565b60408051938452602084019290925290820152606001610226565b61021261043b366004613bae565b6005602052600090815260409020546001600160a01b031681565b610412610464366004613bae565b61179e565b6101fd611a2a565b610259670d2f13f7789f000081565b6101fd61048e366004613bae565b611a3e565b6102127f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e81565b6101fd6104c8366004613ca6565b611ab4565b6104d5611c63565b6001600160a01b038083166000908152600560205260409020548116908216036105465760405162461bcd60e51b815260206004820152601c60248201527f6d75737420626520646966666572656e7420746f2063757272656e740000000060448201526064015b60405180910390fd5b6001600160a01b038116156105805761056a6001600160a01b038316826000611afd565b6105806001600160a01b03831682600019611afd565b6001600160a01b0382811660008181526005602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f8c529c22babad500cea1516422f2bf23f6e1e7fab884b816062d20a9a0f78fef91015b60405180910390a15050565b6000807f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106719190613d45565b9050600080600061068184611cbd565b6231b93b60e91b600090815260066020527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf644549396509194509250906106c79085613d78565b620c6ecf60eb1b600090815260066020527f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb54919250906107089085613d78565b62636e6360e81b600090815260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f54919250906107499085613d78565b600754909150600090819060ff16156107b45760085461076a9086906120e3565b9150610781600854856120e390919063ffffffff16565b905061078d8286613d78565b94506107998185613d78565b93506107a58289613d78565b97506107b18188613d78565b96505b60007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190613d8b565b905080156108e3576108bf620c6ecf60eb1b89878461210e565b6108d16231b93b60e91b8a888461210e565b6108e362636e6360e81b88868461210e565b60075460ff166108fe5760009a505050505050505050505090565b6001546040516370a0823160e01b81526001600160a01b03909116600482015260009073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa15801561095d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109819190613d8b565b841180610a0c57506001546040516370a0823160e01b81526001600160a01b039091166004820152734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa1580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190613d8b565b83115b15610a1d57610a19612152565b5060015b600154610a4a9073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b031630876123fb565b600154610a7790734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906001600160a01b031630866123fb565b610ab673d533a949740bb3306d119cc777fa900ba034cd527f0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf86611afd565b610af5734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b7f0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf85611afd565b6040516309e690eb60e31b815260048101859052602481018490527f0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf6001600160a01b031690634f34875890604401600060405180830381600087803b158015610b5e57600080fd5b505af1158015610b72573d6000803e3d6000fd5b50929e9d5050505050505050505050505050565b6000610b90611c63565b6001600160a01b038216610bd85760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015260640161053d565b6001600160a01b038216734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b14801590610c2257506001600160a01b03821673d533a949740bb3306d119cc777fa900ba034cd5214155b8015610c6057507f000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e6001600160a01b0316826001600160a01b031614155b8015610c8957506001600160a01b038216739ae380f0272e2162340a5bb646c354271c0f5cfc14155b610cc95760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08185b1b1bddd959607a1b604482015260640161053d565b600154604080516337c9a55f60e11b815290516000926001600160a01b031691636f934abe91600480830192869291908290030181865afa158015610d12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d3a9190810190613da4565b905060005b8151811015610eca5760007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b0316639f82b2176040518163ffffffff1660e01b8152600401602060405180830381865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190613d45565b6001600160a01b03166376a562a4848481518110610dec57610dec613e33565b60200260200101516040518263ffffffff1660e01b8152600401610e1f91906001600160a01b0391909116815260200190565b602060405180830381865afa158015610e3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e609190613d45565b9050806001600160a01b0316856001600160a01b031603610eb75760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08185b1b1bddd959607a1b604482015260640161053d565b5080610ec281613e49565b915050610d3f565b50610ef46001600160a01b03841673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f6000611afd565b610f1e6001600160a01b03841673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f600019611afd565b6040516001600160a01b03841681527fd432e6f46dbf91c120fdfa95a1f4bf5c43f04d957fbc3a32e693be0d29bf17b09060200160405180910390a1610f65600384612439565b9150505b919050565b6060610f7a600361244e565b905090565b610f87611c63565b610f91600061245b565b565b610f9b611c63565b610fa66003826124ab565b506040516001600160a01b03821681527fe0f3b1406ab4dd940a92a081b1bcef51da212a57978cc8f6dde5c89ab41a5aa7906020015b60405180910390a150565b610fef611c63565b670429d069189e000081106110595760405162461bcd60e51b815260206004820152602a60248201527f63616e6e6f7420736574206665652070657263656e7461676520746f206d6f7260448201526965207468616e2033302560b01b606482015260840161053d565b60007f0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf6001600160a01b031663631516c26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd9190613d8b565b116110e757600080fd5b60088190556007805460ff191660011790556040517f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b90610fdc9083815260200190565b611134816124c0565b50565b61113f611c63565b600054600160a81b900460ff161580801561116757506000546001600160a01b90910460ff16105b806111885750303b1580156111885750600054600160a01b900460ff166001145b6111eb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161053d565b6000805460ff60a01b1916600160a01b1790558015611218576000805460ff60a81b1916600160a81b1790555b600180546001600160a01b0319166001600160a01b03841690811790915560408051635fcbd28560e01b81529051635fcbd285916004808201926020929091908290030181865afa158015611271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112959190613d45565b600280546001600160a01b0319166001600160a01b039290921691909117905580156112f9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016105e0565b5050565b600080600061130b336124c0565b3360009081527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf64660209081526040808320547f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bd8352818420547f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c51909352928190205460015491516370a0823160e01b81526001600160a01b0390921660048301529073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa1580156113e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140d9190613d8b565b83118061149857506001546040516370a0823160e01b81526001600160a01b039091166004820152734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015611471573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114959190613d8b565b82115b8061152157506001546040516370a0823160e01b81526001600160a01b039091166004820152739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa1580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e9190613d8b565b81115b1561152e5761152e612152565b3360008181527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c51602090815260408083208390557f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bd82528083208390557fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6469091528120556001546115df9173d533a949740bb3306d119cc777fa900ba034cd52916001600160a01b031690866123fb565b60015461160c90734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906001600160a01b031633856123fb565b60015461163990739ae380f0272e2162340a5bb646c354271c0f5cfc906001600160a01b031633846123fb565b60008060006116c87f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190613d45565b611cbd565b600660209081527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6448490557f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb83905562636e6360e81b6000527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f829055604080518981529182018b90528101899052929550909350915033907f06f39318c760ad4d630f57ba8f8d3c21b8e1deb076e19476d1dece4e3d737e7a9060600160405180910390a25091979396509194509192505050565b6000806000807f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611802573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118269190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa15801561186f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118939190613d8b565b9050806000036118ae57600080600093509350935050611a23565b60008060006118bb6125f7565b92509250925060007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119459190613d45565b600154604051637d2041e560e11b81526001600160a01b0391821660048201528b8216602482015291169063fa4083ca90604401602060405180830381865afa158015611996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ba9190613d8b565b90506119d18962636e6360e81b8484896000612696565b97506119f6896231b93b60e91b868489600760009054906101000a900460ff16612696565b9650611a1b89620c6ecf60eb1b858489600760009054906101000a900460ff16612696565b955050505050505b9193909250565b611a326105ec565b610f9157610f91612152565b611a46611c63565b6001600160a01b038116611aab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161053d565b6111348161245b565b611abc611c63565b60005b81518110156112f957611aea828281518110611add57611add613e33565b6020026020010151610b86565b5080611af581613e49565b915050611abf565b801580611b775750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611b51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b759190613d8b565b155b611be25760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161053d565b6040516001600160a01b038316602482015260448101829052611c4590849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612763565b505050565b6060611c598484600085612835565b90505b9392505050565b6000546001600160a01b03163314610f915760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161053d565b600080600080600160009054906101000a90046001600160a01b03166001600160a01b0316636f934abe6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d16573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d3e9190810190613da4565b600154604051631b066a0160e31b81529192506000916001600160a01b038881169263d833500892611d7892909116908690600401613e62565b602060405180830381865afa158015611d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db99190613d8b565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909150819073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190613d8b565b611e489190613e86565b60405163323808cd60e01b8152600481018390529095506000906001600160a01b0388169063323808cd90602401602060405180830381865afa158015611e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb79190613d8b565b6001546040516370a0823160e01b81526001600160a01b0390911660048201529091508190734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015611f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3c9190613d8b565b611f469190613e86565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909550739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa158015611fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc99190613d8b565b600254909450600160a01b900460ff166120d9577f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561203b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205f9190613d45565b6001546040516334d21ea360e21b81526001600160a01b03918216600482015291169063d3487a8c90602401602060405180830381865afa1580156120a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120cc9190613d8b565b6120d69085613e86565b93505b5050509193909250565b60006120f16012600a613f7d565b6120fb8385613f89565b6121059190613fa0565b90505b92915050565b6121188282612912565b60008581526006602052604081208054909190612136908490613e86565b9091555050506000928352506006602052604090912060010155565b61215a61292b565b6001546040516370a0823160e01b81526001600160a01b039091166004820152600090739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa1580156121b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121dd9190613d8b565b90506121e7612e11565b6001546040516370a0823160e01b81526001600160a01b0390911660048201526000908290739ae380f0272e2162340a5bb646c354271c0f5cfc906370a0823190602401602060405180830381865afa158015612248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226c9190613d8b565b6122769190613d78565b905060007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc9190613d45565b600154604051635598b20960e01b81526001600160a01b039182166004820152911690635598b20990602401602060405180830381865afa158015612345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123699190613d8b565b905080156123c35761237b8282612912565b62636e6360e81b600090815260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4e80549091906123bd908490613e86565b90915550505b6040518281527ffc8ed0cd46874d9c3cf1425e1b3bbf9c523bc17c4a959c2c2f600e016f4eddef9060200160405180910390a1505050565b6040516001600160a01b03808516602483015283166044820152606481018290526124339085906323b872dd60e01b90608401611c0e565b50505050565b6000612105836001600160a01b038416612e63565b60606000611c5c83612eb2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000612105836001600160a01b038416612f0e565b60007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b03166348439e7e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125449190613d45565b600154604051637d2041e560e11b81526001600160a01b039182166004820152848216602482015291169063fa4083ca90604401602060405180830381865afa158015612595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b99190613d8b565b90506125c36105ec565b506125d562636e6360e81b8383613001565b6125e66231b93b60e91b8383613001565b6112f9620c6ecf60eb1b8383613001565b6000806000807f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561265b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267f9190613d45565b905061268a8161309c565b93509350935050909192565b6000858152600660205260408120805483156126ea576008546126d9906126bf6012600a613f7d565b6126c99190613d78565b6126d38988612912565b906120e3565b6126e39082613e86565b9050612701565b6126f48786612912565b6126fe9082613e86565b90505b6001600160a01b03891660009081526002830160205260409020546127319061272a9083613d78565b87906120e3565b6001600160a01b038a1660009081526003840160205260409020546127569190613e86565b9998505050505050505050565b60006127b8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c4a9092919063ffffffff16565b805190915015611c4557808060200190518101906127d69190613fd2565b611c455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161053d565b6060824710156128965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161053d565b600080866001600160a01b031685876040516128b29190614011565b60006040518083038185875af1925050503d80600081146128ef576040519150601f19603f3d011682016040523d82523d6000602084013e6128f4565b606091505b50915091506129058783838761316d565b925050505b949350505050565b6000816129216012600a613f7d565b6120fb9085613f89565b6002805460ff60a01b1916600160a01b17905560408051632421cf3f60e11b815290516001600160a01b037f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e16916348439e7e9160048083019260209291908290030181865afa1580156129a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c79190613d45565b60015460405163a0190c1760e01b81526001600160a01b03918216600482015291169063a0190c1790602401600060405180830381600087803b158015612a0d57600080fd5b505af1158015612a21573d6000803e3d6000fd5b50506002805460ff60a01b1916905550506001546040516370a0823160e01b81526001600160a01b039091166004820152600090734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015612a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab59190613d8b565b6001546040516370a0823160e01b81526001600160a01b03909116600482015290915060009073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015612b17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3b9190613d8b565b905060007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663b050ecb86040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc19190613d45565b9050806001600160a01b031663bc810e26600160009054906101000a90046001600160a01b03166001600160a01b0316636f934abe6040518163ffffffff1660e01b8152600401600060405180830381865afa158015612c25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c4d9190810190613da4565b6001546040516001600160e01b031960e085901b168152612c7b92916001600160a01b03169060040161402d565b600060405180830381600087803b158015612c9557600080fd5b505af1158015612ca9573d6000803e3d6000fd5b50506001546040516370a0823160e01b81526001600160a01b03909116600482015260009250859150734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d329190613d8b565b612d3c9190613d78565b6001546040516370a0823160e01b81526001600160a01b039091166004820152909150600090849073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa158015612da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc49190613d8b565b612dce9190613d78565b60408051828152602081018590529192507f141d6e75554381bcc1326596e8010e6c432bb0988e14ca0310d85837a211d292910160405180910390a15050505050565b6000612e1d60036131e6565b905080600003612e2a5750565b60005b81811015612e5a57612e48612e436003836131f0565b6131fc565b80612e5281613e49565b915050612e2d565b506111346135c2565b6000818152600183016020526040812054612eaa57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612108565b506000612108565b606081600001805480602002602001604051908101604052809291908181526020018280548015612f0257602002820191906000526020600020905b815481526020019060010190808311612eee575b50505050509050919050565b60008181526001830160205260408120548015612ff7576000612f32600183613d78565b8554909150600090612f4690600190613d78565b9050818114612fab576000866000018281548110612f6657612f66613e33565b9060005260206000200154905080876000018481548110612f8957612f89613e33565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612fbc57612fbc614057565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612108565b6000915050612108565b60008381526006602090815260408083206001600160a01b03861684526002810190925282205481549192916130419161303a91613d78565b84906120e3565b6001600160a01b0385166000908152600384016020526040812080549293508392909190613070908490613e86565b909155505081546001600160a01b03909416600090815260029092016020525060409020919091555050565b6000806000806000806130ae87611cbd565b6231b93b60e91b60005260066020527fe2ee452672e51ea6a0e1a769beff058add3428c3669348c1314b250e4abcf6445492955090935091506130f19084613d78565b620c6ecf60eb1b60005260066020527f3acadc8a217eebdcf686f20849b9575c123b0b8572285c75a94ddd9d4c51e5bb5490965061312f9083613d78565b62636e6360e81b60005260066020527f7af089d8bde560df8f6fed82c9d27c7cabc5c74f30c79b49f5655e8729cb5c4f549095506120d69082613d78565b606083156131dc5782516000036131d5576001600160a01b0385163b6131d55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161053d565b508161290a565b61290a8383613726565b6000612108825490565b60006121058383613750565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613243573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132679190613d8b565b905080600003613275575050565b6001600160a01b03808316600090815260056020526040902054168015613482576000807f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b0316639f82b2176040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061331b9190613d45565b604051632feaac8560e11b81526001600160a01b038581166004830152878116602483015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260448301529190911690635fd5590a90606401606060405180830381865afa158015613385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a9919061407f565b5090925090506fffffffffffffffffffffffffffffffff8083169082166001600160a01b03851663ce7d65038383896133f78c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28361377a565b6040516001600160e01b031960e087901b1681526004810194909452602484019290925260448301526064820152600060848201523060a482015260c4016020604051808303816000875af1158015613454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134789190613d8b565b5050505050505050565b60408051600280825260608201835260009260208301908036833701905050905083816000815181106134b7576134b7613e33565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2816001815181106134ff576134ff613e33565b6001600160a01b039092166020928302919091019091015273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f6338ed1739846135518773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28361377a565b8430426040518663ffffffff1660e01b81526004016135749594939291906140c2565b6000604051808303816000875af1158015613593573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526135bb91908101906140fe565b5050505050565b6040516370a0823160e01b815230600482015260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa158015613614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136389190613d8b565b9050806000036136455750565b73838af967537350d2c44abb8c010e49e32673ab9463ce7d6503600060018461369773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2739ae380f0272e2162340a5bb646c354271c0f5cfc8361377a565b60015460405160e087901b6001600160e01b03191681526004810195909552602485019390935260448401919091526064830152600060848301526001600160a01b031660a482015260c4016020604051808303816000875af1158015613702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f99190613d8b565b8151156137365781518083602001fd5b8060405162461bcd60e51b815260040161053d9190614184565b600082600001828154811061376757613767613e33565b9060005260206000200154905092915050565b6000807f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b0316632630c12f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137ff9190613d45565b9050836001600160a01b0316856001600160a01b0316036138235782915050611c5c565b6040516375151b6360e01b81526001600160a01b0386811660048301528216906375151b6390602401602060405180830381865afa158015613869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388d9190613fd2565b158061390057506040516375151b6360e01b81526001600160a01b0385811660048301528216906375151b6390602401602060405180830381865afa1580156138da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138fe9190613fd2565b155b1561390f576000915050611c5c565b613ad4670d2f13f7789f00006126d3876001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561395c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061398091906141b7565b876001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156139be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139e291906141b7565b604051638b2f0f4f60e01b81526001600160a01b038a81166004830152613acd9190881690638b2f0f4f90602401602060405180830381865afa158015613a2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a519190613d8b565b604051638b2f0f4f60e01b81526001600160a01b038d81166004830152613ac791908a1690638b2f0f4f90602401602060405180830381865afa158015613a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac09190613d8b565b8b906120e3565b90612912565b9190613add565b95945050505050565b60008160ff168360ff1603613af3575082611c5c565b8160ff168360ff161115613b1357613b0c848484613b1e565b9050611c5c565b611c59848484613b3f565b6000613b2a82846141da565b613b3590600a6141f3565b611c599085613fa0565b6000613b4b83836141da565b613b5690600a6141f3565b611c599085613f89565b6001600160a01b038116811461113457600080fd5b60008060408385031215613b8857600080fd5b8235613b9381613b60565b91506020830135613ba381613b60565b809150509250929050565b600060208284031215613bc057600080fd5b8135611c5c81613b60565b600081518084526020808501945080840160005b83811015613c045781516001600160a01b031687529582019590820190600101613bdf565b509495945050505050565b6020815260006121056020830184613bcb565b600060208284031215613c3457600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c7a57613c7a613c3b565b604052919050565b600067ffffffffffffffff821115613c9c57613c9c613c3b565b5060051b60200190565b60006020808385031215613cb957600080fd5b823567ffffffffffffffff811115613cd057600080fd5b8301601f81018513613ce157600080fd5b8035613cf4613cef82613c82565b613c51565b81815260059190911b82018301908381019087831115613d1357600080fd5b928401925b82841015613d3a578335613d2b81613b60565b82529284019290840190613d18565b979650505050505050565b600060208284031215613d5757600080fd5b8151611c5c81613b60565b634e487b7160e01b600052601160045260246000fd5b8181038181111561210857612108613d62565b600060208284031215613d9d57600080fd5b5051919050565b60006020808385031215613db757600080fd5b825167ffffffffffffffff811115613dce57600080fd5b8301601f81018513613ddf57600080fd5b8051613ded613cef82613c82565b81815260059190911b82018301908381019087831115613e0c57600080fd5b928401925b82841015613d3a578351613e2481613b60565b82529284019290840190613e11565b634e487b7160e01b600052603260045260246000fd5b600060018201613e5b57613e5b613d62565b5060010190565b6001600160a01b0383168152604060208201819052600090611c5990830184613bcb565b8082018082111561210857612108613d62565b600181815b80851115613ed4578160001904821115613eba57613eba613d62565b80851615613ec757918102915b93841c9390800290613e9e565b509250929050565b600082613eeb57506001612108565b81613ef857506000612108565b8160018114613f0e5760028114613f1857613f34565b6001915050612108565b60ff841115613f2957613f29613d62565b50506001821b612108565b5060208310610133831016604e8410600b8410161715613f57575081810a612108565b613f618383613e99565b8060001904821115613f7557613f75613d62565b029392505050565b60006121058383613edc565b808202811582820484141761210857612108613d62565b600082613fbd57634e487b7160e01b600052601260045260246000fd5b500490565b80518015158114610f6957600080fd5b600060208284031215613fe457600080fd5b61210582613fc2565b60005b83811015614008578181015183820152602001613ff0565b50506000910152565b60008251614023818460208701613fed565b9190910192915050565b6040815260006140406040830185613bcb565b905060018060a01b03831660208301529392505050565b634e487b7160e01b600052603160045260246000fd5b8051600f81900b8114610f6957600080fd5b60008060006060848603121561409457600080fd5b61409d8461406d565b92506140ab6020850161406d565b91506140b960408501613fc2565b90509250925092565b85815284602082015260a0604082015260006140e160a0830186613bcb565b6001600160a01b0394909416606083015250608001529392505050565b6000602080838503121561411157600080fd5b825167ffffffffffffffff81111561412857600080fd5b8301601f8101851361413957600080fd5b8051614147613cef82613c82565b81815260059190911b8201830190838101908783111561416657600080fd5b928401925b82841015613d3a5783518252928401929084019061416b565b60208152600082518060208401526141a3816040850160208701613fed565b601f01601f19169190910160400192915050565b6000602082840312156141c957600080fd5b815160ff81168114611c5c57600080fd5b60ff828116828216039081111561210857612108613d62565b600061210560ff841683613edc56fea2646970667358221220eb3b911f932c44907416896aa3c17f5b21873905e8d582734f2ca200d89cae8764736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf
-----Decoded View---------------
Arg [0] : _controller (address): 0x013A3Da6591d3427F164862793ab4e388F9B587e
Arg [1] : _underlying (address): 0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E
Arg [2] : cncLocker (address): 0x5F2e1Ac047E6A8526f8640a7Ed8AB53a0b3f4acF
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e
Arg [1] : 000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e
Arg [2] : 0000000000000000000000005f2e1ac047e6a8526f8640a7ed8ab53a0b3f4acf
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.