Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
14994410 | 58 secs ago | 0 ETH | ||||
14994335 | 3 mins ago | 0 ETH | ||||
14994108 | 12 mins ago | 0 ETH | ||||
14993892 | 20 mins ago | 0 ETH | ||||
14993754 | 25 mins ago | 0 ETH | ||||
14993640 | 29 mins ago | 0 ETH | ||||
14993628 | 29 mins ago | 0 ETH | ||||
14993561 | 32 mins ago | 0 ETH | ||||
14993209 | 43 mins ago | 0 ETH | ||||
14993172 | 45 mins ago | 0 ETH | ||||
14992807 | 57 mins ago | 0 ETH | ||||
14992563 | 1 hr ago | 0 ETH | ||||
14992563 | 1 hr ago | 0 ETH | ||||
14991951 | 1 hr ago | 0 ETH | ||||
14991951 | 1 hr ago | 0 ETH | ||||
14991588 | 1 hr ago | 0 ETH | ||||
14991466 | 1 hr ago | 0 ETH | ||||
14991448 | 1 hr ago | 0 ETH | ||||
14991448 | 1 hr ago | 0 ETH | ||||
14991407 | 1 hr ago | 0 ETH | ||||
14991308 | 1 hr ago | 0 ETH | ||||
14991019 | 2 hrs ago | 0 ETH | ||||
14991019 | 2 hrs ago | 0 ETH | ||||
14991014 | 2 hrs ago | 0 ETH | ||||
14990840 | 2 hrs ago | 0 ETH |
Loading...
Loading
Contract Name:
Voter
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 800 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "contracts/interfaces/IFeeDistributor.sol"; import "contracts/interfaces/IFeeDistributorFactory.sol"; import "contracts/interfaces/IGauge.sol"; import "contracts/interfaces/IGaugeFactory.sol"; import "contracts/interfaces/IERC20.sol"; import "contracts/interfaces/IMinter.sol"; import "contracts/interfaces/IPair.sol"; import "contracts/interfaces/IPairFactory.sol"; import "contracts/interfaces/IVoter.sol"; import "contracts/interfaces/IVotingEscrow.sol"; import "contracts/interfaces/IXToken.sol"; import "contracts/interfaces/IPairFees.sol"; import "contracts/interfaces/ICustomGaugeFactory.sol"; import "contracts/interfaces/ICustomGauge.sol"; import "./v2/interfaces/IClPoolFactory.sol"; import "./v2/interfaces/IClPool.sol"; import "./v2-staking/interfaces/IClGaugeFactory.sol"; import "./v2-staking/interfaces/INonfungiblePositionManager.sol"; import "./v2-staking/interfaces/IGaugeV2.sol"; contract Voter is IVoter, Initializable { address public _ve; // the ve token that governs these contracts address public factory; // the PairFactory address public base; address public gaugefactory; address public feeDistributorFactory; address public minter; address public governor; // should be set to an IGovernor address public emergencyCouncil; // credibly neutral party similar to Curve's Emergency DAO address public clFactory; address public clGaugeFactory; address public nfpManager; address public whitelistOperator; address public xToken; address[] public pools; // all pools viable for incentives address public timelock; uint256 public totalWeight; // total voting weight uint256 internal constant DURATION = 7 days; // rewards are released over 7 days uint256 internal _unlocked; uint256 internal index; uint256 public constant BASIS = 10000; uint256 public xRatio; // default xToken ratio mapping(address => address) public gauges; // pool => gauge mapping(address => address) public poolForGauge; // gauge => pool mapping(address => address) public feeDistributors; // gauge => fees mapping(address => uint256) public weights; // pool => weight mapping(uint256 => mapping(address => uint256)) public votes; // nft => pool => votes mapping(uint256 => address[]) public poolVote; // nft => pools mapping(uint256 => uint256) public usedWeights; // nft => total voting weight of user mapping(uint256 => uint256) public lastVoted; // nft => timestamp of last vote, to ensure one vote per epoch mapping(address => bool) public isGauge; mapping(address => bool) public isWhitelisted; mapping(address => bool) public isAlive; mapping(address => uint256) internal supplyIndex; mapping(address => uint256) public claimable; mapping(address => uint256) _gaugeXRatio; // mapping for specific gauge xToken ratios mapping(address => bool) _gaugeXRatioWritten; // mapping for indicating if a gauge has its own xToken ratio mapping(address => bool) public isForbidden; mapping(uint256 => bool) public stale; address public customGaugeFactory; mapping(address pool => address customGauge) public customGaugeForPool; // End of storage slots // //////////// // Events // //////////// event GaugeCreated( address indexed gauge, address creator, address feeDistributor, address indexed pool ); event GaugeKilled(address indexed gauge); event GaugeRevived(address indexed gauge); event Voted(address indexed voter, uint256 tokenId, uint256 weight); event Abstained(uint256 tokenId, uint256 weight); event Deposit( address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount ); event Withdraw( address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount ); event NotifyReward( address indexed sender, address indexed reward, uint256 amount ); event DistributeReward( address indexed sender, address indexed gauge, uint256 amount ); event Attach(address indexed owner, address indexed gauge, uint256 tokenId); event Detach(address indexed owner, address indexed gauge, uint256 tokenId); event Whitelisted(address indexed whitelister, address indexed token); event Forbidden( address indexed forbidder, address indexed token, bool status ); event EmissionsRatio( address indexed gauge, uint256 oldRatio, uint256 newRatio ); event CustomGaugeCreated( address indexed gauge, address creator, address feeDistributor, address indexed pool, address indexed token ); ////////////////// // Initializers // ////////////////// /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address __ve, address _factory, address _gauges, address _feeDistributorFactory, address _minter, address _msig, address[] calldata _tokens, address _clFactory, address _clGaugeFactory, address _nfpManager, address _xToken ) external initializer { _ve = __ve; factory = _factory; base = IVotingEscrow(__ve).emissionsToken(); gaugefactory = _gauges; feeDistributorFactory = _feeDistributorFactory; minter = _minter; governor = _msig; emergencyCouncil = _msig; timelock = IMinter(minter).timelock(); for (uint256 i = 0; i < _tokens.length; ++i) { _whitelist(_tokens[i]); } clFactory = _clFactory; clGaugeFactory = _clGaugeFactory; nfpManager = _nfpManager; xToken = _xToken; xRatio = 5000; emit EmissionsRatio(address(0), 0, 5000); IERC20(base).approve(_xToken, type(uint256).max); _unlocked = 1; index = 1; } function initializeCustomGaugeFactory( address _factory ) external reinitializer(2) { customGaugeFactory = _factory; } /////////////// // Modifiers // /////////////// // simple re-entrancy check modifier lock() { require(_unlocked == 1); _unlocked = 2; _; _unlocked = 1; } modifier onlyNewEpoch(uint256 _tokenId) { // ensure minter is synced require( block.timestamp < IMinter(minter).activePeriod() + 1 weeks, "!EPOCH" ); _; } modifier onlyTimelock() { require(msg.sender == timelock, "AUTH"); _; } modifier onlyWhitelistOperators() { require( msg.sender == whitelistOperator || msg.sender == governor, "AUTH" ); _; } //////////////////////////////// // Governance Gated Functions // //////////////////////////////// function setGovernor(address _governor) public { require(msg.sender == governor); governor = _governor; } function setEmergencyCouncil(address _council) public { require(msg.sender == emergencyCouncil); emergencyCouncil = _council; } function setWhitelistOperator(address _whitelistOperator) public { require(msg.sender == governor); whitelistOperator = _whitelistOperator; } /// @notice sets the default xTokenRatio function setXRatio(uint256 _xRatio) external onlyWhitelistOperators { require(_xRatio <= BASIS, ">100%"); emit EmissionsRatio(address(0), xRatio, _xRatio); xRatio = _xRatio; } /// @notice sets the xTokenRatio of specifics gauges function setPoolXRatio( address[] calldata _pools, uint256[] calldata _xRatios ) external onlyWhitelistOperators { uint256 _length = _pools.length; require(_length == _xRatios.length, "length mismatch"); for (uint256 i = 0; i < _length; ++i) { uint256 _xRatio = _xRatios[i]; require(_xRatio <= BASIS, ">100%"); // fetch old xToken ratio for later event address _gauge = gauges[_pools[i]]; uint256 oldXRatio = gaugeXRatio(_gauge); // write gauge specific xToken ratio _gaugeXRatio[_gauge] = _xRatio; _gaugeXRatioWritten[_gauge] = true; emit EmissionsRatio(_gauge, oldXRatio, _xRatio); } } /// @notice resets the xTokenRatio of specifics gauges back to default function resetGaugeXRatio( address[] calldata _gauges ) external onlyWhitelistOperators { uint256 _xRatio = xRatio; uint256 _length = _gauges.length; for (uint256 i = 0; i < _length; ++i) { // fetch old xToken ratio for later event address _gauge = _gauges[i]; uint256 oldXTokenRatio = gaugeXRatio(_gauge); // reset _gaugexTokenRatioWritten _gaugeXRatioWritten[_gauge] = false; // it's ok to leave _gaugexTokenRatio dirty, it's going to be overwriten when it's activated again emit EmissionsRatio(_gauge, oldXTokenRatio, _xRatio); } } function whitelist(address _token) public onlyWhitelistOperators { _whitelist(_token); } function forbid( address _token, bool forbidden ) public onlyWhitelistOperators { _forbid(_token, forbidden); } function _whitelist(address _token) internal { require(!isWhitelisted[_token]); isWhitelisted[_token] = true; emit Whitelisted(msg.sender, _token); } function _forbid(address _token, bool _status) internal { // forbid can happen before whitelisting if (isForbidden[_token] != _status) { isForbidden[_token] = _status; emit Forbidden(msg.sender, _token, _status); } } function killGauge(address _gauge) external { require(msg.sender == emergencyCouncil, "!COUNCIL"); require(isAlive[_gauge], "DEAD"); isAlive[_gauge] = false; address pool = poolForGauge[_gauge]; // we call a function that doesn't exist in a CL pool to confirm that it is a legacy pool (bool success, ) = pool.staticcall( abi.encodeWithSelector(IPair.feeSplit.selector) ); // If it is a legacy pool we set activeGauge to false so most fees are compounded into the pool if (success) { IPair(pool).setActiveGauge(false); } emit GaugeKilled(_gauge); } function reviveGauge(address _gauge) external { require(msg.sender == emergencyCouncil, "!COUNCIL"); require(!isAlive[_gauge], "ALIVE"); isAlive[_gauge] = true; address pool = poolForGauge[_gauge]; // we call a function that doesn't exist in a CL pool to confirm that it is a legacy pool (bool success, ) = pool.staticcall( abi.encodeWithSelector(IPair.feeSplit.selector) ); // If it is a legacy pool we set activeGauge to true if (success) { IPair(pool).setActiveGauge(true); } emit GaugeRevived(_gauge); } function recoverFees( address[] calldata fees, address[][] calldata tokens ) external { address _governor = governor; require(msg.sender == _governor, "AUTH"); for (uint256 i; i < fees.length; ++i) { for (uint256 j; j < tokens[i].length; ++j) { IPairFees(fees[i]).recoverFees(tokens[i][j], _governor); } } } ///@dev designates the stale permission function designateStale( uint256 _tokenId, bool _status ) external onlyWhitelistOperators { stale[_tokenId] = _status; _reset(_tokenId); } ///@dev in case of emission stuck due to killed gauges and unsupported operations function stuckEmissionsRecovery(address _gauge) external { require(msg.sender == governor, "!GOV"); IMinter(minter).updatePeriod(); _updateFor(_gauge); if (!isAlive[_gauge]) { uint256 _claimable = claimable[_gauge]; delete claimable[_gauge]; if (_claimable > 0) { IERC20(base).transfer(governor, _claimable); } } } function addInitialRewardPerGauge( address _gauge, address _token ) external onlyWhitelistOperators { IGauge(_gauge).addInitialReward(_token); } function addClGaugeReward( address gauge, address reward ) external onlyWhitelistOperators { IGaugeV2(gauge).addRewards(reward); } function removeClGaugeReward( address gauge, address reward ) external onlyWhitelistOperators { IGaugeV2(gauge).removeRewards(reward); } /// @notice clawback claimable for dead gauges to treasury function clawBackUnusedEmissions( address[] calldata _gauges ) external onlyWhitelistOperators { IMinter(minter).updatePeriod(); for (uint256 i; i < _gauges.length; i++) { _updateFor(_gauges[i]); if (!isAlive[_gauges[i]]) { uint256 _claimable = claimable[_gauges[i]]; delete claimable[_gauges[i]]; if (_claimable > 0) { IERC20(base).transfer(governor, _claimable); } } } } //////////// // Voting // //////////// function reset(uint256 _tokenId) external onlyNewEpoch(_tokenId) { require( IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId) || IVotingEscrow(_ve).isDelegate(msg.sender, _tokenId), "!approved" ); lastVoted[_tokenId] = (block.timestamp / DURATION) * DURATION; _reset(_tokenId); IVotingEscrow(_ve).abstain(_tokenId); } function _reset(uint256 _tokenId) internal { address[] storage _poolVote = poolVote[_tokenId]; uint256 _poolVoteCnt = _poolVote.length; uint256 _totalWeight = 0; for (uint256 i = 0; i < _poolVoteCnt; ++i) { address _pool = _poolVote[i]; uint256 _votes = votes[_tokenId][_pool]; if (_votes != 0) { _updateFor(gauges[_pool]); weights[_pool] -= _votes; votes[_tokenId][_pool] -= _votes; if (_votes > 0) { IFeeDistributor(feeDistributors[gauges[_pool]])._withdraw( uint256(_votes), _tokenId ); _totalWeight += _votes; } else { _totalWeight -= _votes; } emit Abstained(_tokenId, _votes); } } totalWeight -= uint256(_totalWeight); usedWeights[_tokenId] = 0; delete poolVote[_tokenId]; } function poke(uint256 _tokenId) external { address[] memory _poolVote = poolVote[_tokenId]; uint256 _poolCnt = _poolVote.length; uint256[] memory _weights = new uint256[](_poolCnt); for (uint256 i = 0; i < _poolCnt; ++i) { _weights[i] = votes[_tokenId][_poolVote[i]]; } _vote(_tokenId, _poolVote, _weights); } function _vote( uint256 _tokenId, address[] memory _poolVote, uint256[] memory _weights ) internal { require(!stale[_tokenId], "Stale NFT, please contact the team"); _reset(_tokenId); uint256 _poolCnt = _poolVote.length; uint256 _weight = IVotingEscrow(_ve).balanceOfNFT(_tokenId); uint256 _totalVoteWeight = 0; uint256 _totalWeight = 0; uint256 _usedWeight = 0; for (uint256 i = 0; i < _poolCnt; ++i) { _totalVoteWeight += _weights[i]; } for (uint256 i = 0; i < _poolCnt; ++i) { address _pool = _poolVote[i]; address _gauge = gauges[_pool]; if (isGauge[_gauge] && isAlive[_gauge]) { uint256 _poolWeight = (_weights[i] * _weight) / _totalVoteWeight; require(votes[_tokenId][_pool] == 0); require(_poolWeight != 0); _updateFor(_gauge); poolVote[_tokenId].push(_pool); weights[_pool] += _poolWeight; votes[_tokenId][_pool] += _poolWeight; IFeeDistributor(feeDistributors[_gauge])._deposit( uint256(_poolWeight), _tokenId ); _usedWeight += _poolWeight; _totalWeight += _poolWeight; emit Voted(msg.sender, _tokenId, _poolWeight); } } if (_usedWeight > 0) IVotingEscrow(_ve).voting(_tokenId); totalWeight += uint256(_totalWeight); usedWeights[_tokenId] = uint256(_usedWeight); } function vote( uint256 tokenId, address[] calldata _poolVote, uint256[] calldata _weights ) external onlyNewEpoch(tokenId) { require( IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, tokenId) || IVotingEscrow(_ve).isDelegate(msg.sender, tokenId), "!approved" ); require(_poolVote.length == _weights.length); lastVoted[tokenId] = (block.timestamp / DURATION) * DURATION; _vote(tokenId, _poolVote, _weights); } //////////////////// // Gauge Creation // //////////////////// function createGauge(address _pool) external returns (address) { require(gauges[_pool] == address(0x0), "exists"); bool isPair = IPairFactory(factory).isPair(_pool); require(isPair, "!_pool"); address tokenA; address tokenB; address[] memory initialRewards = new address[](2); if (isPair) { (tokenA, tokenB) = IPair(_pool).tokens(); initialRewards[0] = base; initialRewards[1] = address(xToken); } if (msg.sender != governor) { // prevent gauge creation for forbidden tokens require(!isForbidden[tokenA] && !isForbidden[tokenB], "Forbidden"); require( isWhitelisted[tokenA] && isWhitelisted[tokenB], "!whitelisted" ); } address pairFees = IPair(_pool).fees(); address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory) .createFeeDistributor(pairFees); IPairFees(pairFees).initialize(_feeDistributor); IPair(_pool).setActiveGauge(true); address _gauge = IGaugeFactory(gaugefactory).createGauge( _pool, _feeDistributor, _ve, isPair, initialRewards ); IERC20(base).approve(_gauge, type(uint256).max); IERC20(xToken).approve(_gauge, type(uint256).max); feeDistributors[_gauge] = _feeDistributor; gauges[_pool] = _gauge; poolForGauge[_gauge] = _pool; isGauge[_gauge] = true; isAlive[_gauge] = true; _updateFor(_gauge); pools.push(_pool); emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool); return _gauge; } function createCLGauge( address tokenA, address tokenB, uint24 fee ) external returns (address) { address _pool = IClPoolFactory(clFactory).getPool(tokenA, tokenB, fee); require(_pool != address(0), "NO POOL"); (, , , , , , bool unlocked) = IClPool(_pool).slot0(); require(unlocked, "Uninitialized pool!"); require(gauges[_pool] == address(0x0), "EXISTS"); if (msg.sender != governor) { // gov can create for any cl pool // for arbitrary gauges without a pool, use createGauge() // prevent gauge creation for forbidden tokens require(!isForbidden[tokenA] && !isForbidden[tokenB], "FORBIDDEN"); require(isWhitelisted[tokenA] && isWhitelisted[tokenB], "!WL"); } address _feeCollector = IClPoolFactory(clFactory).feeCollector(); address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory) .createFeeDistributor(_feeCollector); // return address(0); address _gauge = IClGaugeFactory(clGaugeFactory).createGauge(_pool); IERC20(base).approve(_gauge, type(uint256).max); IERC20(xToken).approve(_gauge, type(uint256).max); feeDistributors[_gauge] = _feeDistributor; gauges[_pool] = _gauge; poolForGauge[_gauge] = _pool; isGauge[_gauge] = true; isAlive[_gauge] = true; _updateFor(_gauge); pools.push(_pool); IClPoolOwnerActions(_pool).setFeeProtocol(); emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool); return _gauge; } function createCustomGauge( address _token, address _pool, address[] calldata whitelistedRewards ) external returns (address) { require(msg.sender == governor, "!AUTH"); address feeCollector = IClPoolFactory(clFactory).feeCollector(); address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory) .createFeeDistributor(feeCollector); address _gauge = ICustomGaugeFactory(customGaugeFactory) .createCustomGauge(_token); for (uint256 i; i < whitelistedRewards.length; i++) { ICustomGauge(_gauge).whitelistReward(whitelistedRewards[i]); } IERC20(base).approve(_gauge, type(uint256).max); IERC20(xToken).approve(_gauge, type(uint256).max); feeDistributors[_gauge] = _feeDistributor; gauges[_token] = _gauge; poolForGauge[_gauge] = _token; isGauge[_gauge] = true; isAlive[_gauge] = true; _updateFor(_gauge); pools.push(_token); if (_pool != address(0)) { require(!isAlive[gauges[_pool]], "Active gauge"); require(customGaugeForPool[_pool] == address(0), "exists"); customGaugeForPool[_pool] = _gauge; } emit CustomGaugeCreated( _gauge, msg.sender, _feeDistributor, _pool, _token ); return _gauge; } //////////////////// // Event Emitters // //////////////////// function attachTokenToGauge(uint256 tokenId, address account) external { require(isGauge[msg.sender] || isGauge[gauges[msg.sender]]); require(isAlive[msg.sender] || isGauge[gauges[msg.sender]]); // killed gauges cannot attach tokens to themselves if (tokenId > 0) IVotingEscrow(_ve).attach(tokenId); emit Attach(account, msg.sender, tokenId); } function emitDeposit( uint256 tokenId, address account, uint256 amount ) external { require(isGauge[msg.sender]); require(isAlive[msg.sender]); emit Deposit(account, msg.sender, tokenId, amount); } function detachTokenFromGauge(uint256 tokenId, address account) external { require(isGauge[msg.sender] || isGauge[gauges[msg.sender]]); if (tokenId > 0) IVotingEscrow(_ve).detach(tokenId); emit Detach(account, msg.sender, tokenId); } function emitWithdraw( uint256 tokenId, address account, uint256 amount ) external { require(isGauge[msg.sender]); emit Withdraw(account, msg.sender, tokenId, amount); } ///////////////////////////// // One-stop Reward Claimer // ///////////////////////////// function claimClGaugeRewards( address[] calldata _gauges, address[][] calldata _tokens, uint256[][] calldata _nfpTokenIds ) external { address _nfpManager = nfpManager; for (uint256 i = 0; i < _gauges.length; ++i) { for (uint256 j = 0; j < _nfpTokenIds[i].length; ++j) { require( msg.sender == INonfungiblePositionManager(_nfpManager).ownerOf( _nfpTokenIds[i][j] ) || msg.sender == INonfungiblePositionManager(_nfpManager).getApproved( _nfpTokenIds[i][j] ) ); IFeeDistributor(_gauges[i]).getRewardForOwner( _nfpTokenIds[i][j], _tokens[i] ); } } } function claimIncentives( address[] calldata _incentives, address[][] calldata _tokens, uint256 _tokenId ) external { require(IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId)); for (uint256 i = 0; i < _incentives.length; ++i) { IFeeDistributor(_incentives[i]).getRewardForOwner( _tokenId, _tokens[i] ); } } function claimFees( address[] calldata _fees, address[][] calldata _tokens, uint256 _tokenId ) external { require(IVotingEscrow(_ve).isApprovedOrOwner(msg.sender, _tokenId)); for (uint256 i = 0; i < _fees.length; ++i) { IFeeDistributor(_fees[i]).getRewardForOwner(_tokenId, _tokens[i]); } } function claimRewards( address[] calldata _gauges, address[][] calldata _tokens ) external { for (uint256 i = 0; i < _gauges.length; ++i) { IGauge(_gauges[i]).getReward(msg.sender, _tokens[i]); } } ////////////////////////// // Emission Calculation // ////////////////////////// function notifyRewardAmount(uint256 amount) external { if (totalWeight > 0) { _safeTransferFrom(base, msg.sender, address(this), amount); // transfer the distro in uint256 _ratio = (amount * 1e18) / totalWeight; // 1e18 adjustment is removed during claim if (_ratio > 0) { index += _ratio; } emit NotifyReward(msg.sender, base, amount); } } function updateFor(address[] calldata _gauges) external { for (uint256 i = 0; i < _gauges.length; ++i) { _updateFor(_gauges[i]); } } function updateForRange(uint256 start, uint256 end) public { for (uint256 i = start; i < end; ++i) { _updateFor(gauges[pools[i]]); } } function updateAll() external { updateForRange(0, pools.length); } function updateGauge(address _gauge) external { _updateFor(_gauge); } function _updateFor(address _gauge) internal { address _pool = poolForGauge[_gauge]; uint256 _supplyIndex = supplyIndex[_gauge]; // only new pools will have 0 _supplyIndex if (_supplyIndex > 0) { uint256 _supplied = weights[_pool]; uint256 _index = index; // get global index0 for accumulated distro supplyIndex[_gauge] = _index; // update _gauge current position to global position uint256 _delta = _index - _supplyIndex; // see if there is any difference that need to be accrued if (_delta > 0 && _supplied > 0) { uint256 _share = (uint256(_supplied) * _delta) / 1e18; // add accrued difference for each supplied token claimable[_gauge] += _share; } } else { supplyIndex[_gauge] = index; // new users are set to the default global state } } /////////////////////////// // Emission Distribution // /////////////////////////// function distributeFees(address[] memory _gauges) external { for (uint256 i = 0; i < _gauges.length; ++i) { IGauge(_gauges[i]).claimFees(); } } function distribute(address _gauge) public lock { IMinter(minter).updatePeriod(); _updateFor(_gauge); // dead gauges should be handled by a different function if (isAlive[_gauge]) { uint256 _claimable = claimable[_gauge]; if (_claimable == 0) { return; } // calculate _xTokenClaimable address _xToken = address(xToken); uint256 _xTokenClaimable = (_claimable * gaugeXRatio(_gauge)) / BASIS; _claimable -= _xTokenClaimable; // can only distribute if the distributed amount / week > 0 and is > left() bool canDistribute = true; // _claimable could be 0 if emission is 100% xToken if (_claimable > 0) { if ( _claimable / DURATION == 0 || _claimable < IGauge(_gauge).left(base) ) { canDistribute = false; } } // _xTokenClaimable could be 0 if ratio is 100% emissions if (_xTokenClaimable > 0) { if ( _xTokenClaimable / DURATION == 0 || _xTokenClaimable < IGauge(_gauge).left(_xToken) ) { canDistribute = false; } } if (canDistribute) { // reset claimable claimable[_gauge] = 0; if (_claimable > 0) { // notify emissions IGauge(_gauge).notifyRewardAmount(base, _claimable); } if (_xTokenClaimable > 0) { // convert, then notify xToken IXToken(_xToken).convertEmissionsToken(_xTokenClaimable); IGauge(_gauge).notifyRewardAmount( _xToken, _xTokenClaimable ); } emit DistributeReward( msg.sender, _gauge, _claimable + _xTokenClaimable ); } } } function distributeAllUnchecked() external { distributeRangeUnchecked(0, pools.length); } function distributeRangeUnchecked(uint256 start, uint256 finish) public { for (uint256 x = start; x < finish; ) { distribute(gauges[pools[x]]); unchecked { ++x; } } } function distributeGaugeUnchecked(address[] calldata _gauges) external { for (uint256 x = 0; x < _gauges.length; ++x) { distribute(_gauges[x]); } } //////////////////// // View Functions // //////////////////// function length() external view returns (uint256) { return pools.length; } function getVotes( uint256 fromTokenId, uint256 toTokenId ) external view returns ( address[][] memory tokensVotes, uint256[][] memory tokensWeights ) { uint256 tokensCount = toTokenId - fromTokenId + 1; tokensVotes = new address[][](tokensCount); tokensWeights = new uint256[][](tokensCount); for (uint256 i = 0; i < tokensCount; ++i) { uint256 tokenId = fromTokenId + i; tokensVotes[i] = new address[](poolVote[tokenId].length); tokensVotes[i] = poolVote[tokenId]; tokensWeights[i] = new uint256[](poolVote[tokenId].length); for (uint256 j = 0; j < tokensVotes[i].length; ++j) { tokensWeights[i][j] = votes[tokenId][tokensVotes[i][j]]; } } } /// @notice returns the xTokenRatio applicable to a gauge /// @dev for default ratios, call this with address(0) or call xTokenRatio function gaugeXRatio(address gauge) public view returns (uint256) { // return gauge specific xToken Ratio if writter if (_gaugeXRatioWritten[gauge]) { return _gaugeXRatio[gauge]; } // otherwise return default xTokenRatio return xRatio; } ////////////////////// // safeTransferFrom // ////////////////////// function _safeTransferFrom( address token, address from, address to, uint256 value ) internal { require(token.code.length > 0); (bool success, bytes memory data) = token.call( abi.encodeWithSelector( IERC20.transferFrom.selector, from, to, value ) ); require(success && (data.length == 0 || abi.decode(data, (bool)))); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/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] * ```solidity * 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 Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface ICustomGauge { error ZeroAmount(); error NotifyStakingToken(); error RewardTooHigh(); error NotWhitelisted(); error Unauthorized(); event Deposit(address indexed from, uint256 amount); event Withdraw(address indexed from, uint256 amount); event NotifyReward( address indexed from, address indexed reward, uint256 amount ); event ClaimRewards( address indexed from, address indexed reward, uint256 amount ); event RewardWhitelisted(address indexed reward, bool whitelisted); function initialize(address _stake, address _voter) external; function rewardsList() external view returns (address[] memory); function rewardsListLength() external view returns (uint256); function lastTimeRewardApplicable( address token ) external view returns (uint256); function rewardData( address token ) external view returns (Reward memory data); function earned( address token, address account ) external view returns (uint256); function getReward(address account, address[] calldata tokens) external; function rewardPerToken(address token) external view returns (uint256); function depositAll() external; function deposit(uint256 amount) external; function withdrawAll() external; function left(address token) external view returns (uint256); function whitelistReward(address _reward) external; function removeRewardWhitelist(address _reward) external; function notifyRewardAmount(address token, uint256 amount) external; function balanceOf(address) external view returns (uint256); struct Reward { uint256 rewardRate; uint256 periodFinish; uint256 lastUpdateTime; uint256 rewardPerTokenStored; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface ICustomGaugeFactory { function createCustomGauge(address _pool) external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IERC20 { function totalSupply() external view returns (uint256); function transfer( address recipient, uint256 amount ) external returns (bool); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function balanceOf(address) external view returns (uint256); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); function allowance( address owner, address spender ) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); function name() external view returns (string memory); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IFeeDistributor { function initialize(address _voter, address _pairFees) external; function _deposit(uint256 amount, uint256 tokenId) external; function _withdraw(uint256 amount, uint256 tokenId) external; function getRewardForOwner( uint256 tokenId, address[] memory tokens ) external; function notifyRewardAmount(address token, uint256 amount) external; function getRewardTokens() external view returns (address[] memory); function earned( address token, uint256 tokenId ) external view returns (uint256 reward); function incentivize(address token, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IFeeDistributorFactory { function createFeeDistributor(address pairFees) external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IGauge { function initialize( address _stake, address _feeDist, address _ve, address _voter, bool _forPair, address[] memory _initialRewards ) external; function getReward(address account, address[] calldata tokens) external; function claimFees() external returns (uint256 claimed0, uint256 claimed1); function left(address token) external view returns (uint256); function rewardsListLength() external view returns (uint256); function rewardsList() external view returns (address[] memory); function earned( address token, address account ) external view returns (uint256); function balanceOf(address) external view returns (uint256); function derivedBalances(address) external view returns (uint256); function notifyRewardAmount(address token, uint256 amount) external; struct Reward { uint256 rewardRate; uint256 periodFinish; uint256 lastUpdateTime; uint256 rewardPerTokenStored; } function rewardData(address token) external view returns (Reward memory); function addInitialReward(address reward) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IGaugeFactory { function createGauge( address, address, address, bool, address[] calldata ) external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "contracts/interfaces/IRewardsDistributor.sol"; interface IMinter { function updatePeriod() external returns (uint256); function activePeriod() external view returns (uint256); function rewardsDistributor() external view returns (IRewardsDistributor); function timelock() external view returns (address); function updateFlation(uint256 _flation) external; function updateGrowthCap(uint256 _newGrowthCap) external; function updateIncentivesSize(uint256 _newGrowth) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13 || =0.7.6; interface IPair { function initialize( address _factory, address _token0, address _token1, bool _stable, address _voter ) external; function metadata() external view returns ( uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1 ); function claimFees() external returns (uint256, uint256); function tokens() external view returns (address, address); function transferFrom( address src, address dst, uint256 amount ) external returns (bool); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function burn( address to ) external returns (uint256 amount0, uint256 amount1); function mint(address to) external returns (uint256 liquidity); function getReserves() external view returns ( uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast ); function getAmountOut( uint256 amountIn, address tokenIn ) external view returns (uint256); function symbol() external view returns (string memory); function fees() external view returns (address); function setActiveGauge(bool isActive) external; function setFeeSplit() external; function feeSplit() external view returns (uint8 _feeSplit); function stable() external view returns (bool stable); function current( address tokenIn, uint256 amountIn ) external view returns (uint256 amountOut); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13 || =0.7.6; interface IPairFactory { function allPairsLength() external view returns (uint256); function isPair(address pair) external view returns (bool); function pairCodeHash() external view returns (bytes32); function getPair( address tokenA, address token, bool stable ) external view returns (address); function createPair( address tokenA, address tokenB, bool stable ) external returns (address pair); function voter() external view returns (address); function allPairs(uint256) external view returns (address); function pairFee(address) external view returns (uint256); function getFee(bool) external view returns (uint256); function isPaused() external view returns (bool); function setFeeManager(address _feeManager) external; function setPairFee(address _pair, uint256 _fee) external; function setFee(bool _stable, uint256 _fee) external; function treasury() external view returns (address); function feeSplit() external view returns (uint8); function getPoolFeeSplit( address _pool ) external view returns (uint8 _poolFeeSplit); function setFeeSplit(uint8 _toFees, uint8 _toTreasury) external; function setPoolFeeSplit( address _pool, uint8 _toFees, uint8 _toTreasury ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IPairFees { function initialize(address _feeDistributor) external; function recoverFees(address token, address to) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IRewardsDistributor { function checkpointToken() external; function checkpointTotalSupply() external; function claimable(uint256 _tokenId) external view returns (uint256); function claim(uint256 _tokenId) external returns (uint256); function claimMany(uint256[] memory _tokenIds) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6 || ^0.8.13; pragma abicoder v2; interface IVoter { function _ve() external view returns (address); function governor() external view returns (address); function emergencyCouncil() external view returns (address); function attachTokenToGauge(uint256 _tokenId, address account) external; function detachTokenFromGauge(uint256 _tokenId, address account) external; function emitDeposit( uint256 _tokenId, address account, uint256 amount ) external; function emitWithdraw( uint256 _tokenId, address account, uint256 amount ) external; function isWhitelisted(address token) external view returns (bool); function notifyRewardAmount(uint256 amount) external; function distribute(address _gauge) external; function gauges(address pool) external view returns (address); function feeDistributors(address gauge) external view returns (address); function gaugefactory() external view returns (address); function feeDistributorFactory() external view returns (address); function minter() external view returns (address); function factory() external view returns (address); function length() external view returns (uint256); function pools(uint256) external view returns (address); function isAlive(address) external view returns (bool); function setXRatio(uint256 _xRatio) external; function setPoolXRatio( address[] calldata _gauges, uint256[] calldata _xRaRatios ) external; function resetGaugeXRatio(address[] calldata _gauges) external; function whitelist(address _token) external; function forbid(address _token, bool _status) external; function whitelistOperator() external view returns (address); function gaugeXRatio(address gauge) external view returns (uint256); function isGauge(address gauge) external view returns (bool); function killGauge(address _gauge) external; function reviveGauge(address _gauge) external; function stale(uint256 _tokenID) external view returns (bool); function poolForGauge(address gauge) external view returns (address pool); function recoverFees( address[] calldata fees, address[][] calldata tokens ) external; function designateStale(uint256 _tokenId, bool _status) external; function base() external view returns (address); function xToken() external view returns (address); function addClGaugeReward(address gauge, address reward) external; function removeClGaugeReward(address gauge, address reward) external; function addInitialRewardPerGauge(address _gauge, address token) external; function clawBackUnusedEmissions(address[] calldata _gauges) external; function customGaugeForPool( address pool ) external view returns (address customGauge); }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6 || ^0.8.13; pragma abicoder v2; interface IVotingEscrow { struct Point { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block } struct LockedBalance { int128 amount; uint256 end; } function emissionsToken() external view returns (address); function team() external returns (address); function epoch() external view returns (uint256); function pointHistory(uint256 loc) external view returns (Point memory); function userPointHistory( uint256 tokenId, uint256 loc ) external view returns (Point memory); function userPointEpoch(uint256 tokenId) external view returns (uint256); function ownerOf(uint256) external view returns (address); function isApprovedOrOwner(address, uint256) external view returns (bool); function transferFrom(address, address, uint256) external; function voting(uint256 tokenId) external; function abstain(uint256 tokenId) external; function attach(uint256 tokenId) external; function detach(uint256 tokenId) external; function checkpoint() external; function depositFor(uint256 tokenId, uint256 value) external; function createLockFor( uint256, uint256, address ) external returns (uint256); function balanceOfNFT(uint256) external view returns (uint256); function balanceOfNFTAt(uint256, uint256) external view returns (uint256); function totalSupply() external view returns (uint256); function locked__end(uint256) external view returns (uint256); function balanceOf(address) external view returns (uint256); function tokenOfOwnerByIndex( address, uint256 ) external view returns (uint256); function increaseUnlockTime(uint256 tokenID, uint256 duration) external; function locked( uint256 tokenID ) external view returns (uint256 amount, uint256 unlockTime); function increaseAmount(uint256 _tokenId, uint256 _value) external; function isDelegate( address _operator, uint256 _tokenId ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; interface IXToken { event CancelVesting( address indexed user, uint256 indexed vestId, uint256 amount ); event ExitVesting( address indexed user, uint256 indexed vestId, uint256 amount ); event InstantExit(address indexed user, uint256); event NewExitRatios(uint256 exitRatio, uint256 veExitRatio); event NewVest( address indexed user, uint256 indexed vestId, uint256 indexed amount ); event NewVestingTimes(uint256 min, uint256 max, uint256 veMaxVest); event Converted(address indexed user, uint256); event WhitelistStatus(address indexed candidate, bool status); event XTokensRedeemed(address indexed user, uint256); function MAXTIME() external view returns (uint256); function PRECISION() external view returns (uint256); function addWhitelist(address _whitelistee) external; function adjustWhitelist( address[] memory _candidates, bool[] memory _status ) external; function alterExitRatios( uint256 _newExitRatio, uint256 _newVeExitRatio ) external; function changeMaximumVestingLength(uint256 _maxVest) external; function changeMinimumVestingLength(uint256 _minVest) external; function changeVeMaximumVestingLength(uint256 _veMax) external; function changeWhitelistOperator(address _newOperator) external; function convertEmissionsToken(uint256 _amount) external; function createVest(uint256 _amount) external; function protocolWhitelist() external view returns (address); function exitRatio() external view returns (uint256); function exitVest(uint256 _vestID, bool _ve) external returns (bool); function getBalanceResiding() external view returns (uint256); function initialize( address _emissionsToken, address _votingEscrow, address _voter, address _timelock, address _multisig, address _whitelistOperator, address _enneadWhitelist ) external; function instantExit(uint256 _amount, uint256 maxPayAmount) external; function isWhitelisted(address) external view returns (bool); function maxVest() external view returns (uint256); function migrateProtocolWhitelist(address _enneadWhitelist) external; function migrateMultisig(address _multisig) external; function migrateTimelock(address _timelock) external; function minVest() external view returns (uint256); function multisig() external view returns (address); function multisigRedeem(uint256 _amount) external; function emissionsToken() external view returns (address); function reinitializeVestingParameters( uint256 _min, uint256 _max, uint256 _veMax ) external; function removeWhitelist(address _whitelistee) external; function rescueTrappedTokens( address[] memory _tokens, uint256[] memory _amounts ) external; function syncAndCheckIsWhitelisted( address _address ) external returns (bool); function timelock() external view returns (address); function usersTotalVests(address _user) external view returns (uint256); function veExitRatio() external view returns (uint256); function veMaxVest() external view returns (uint256); function votingEscrow() external view returns (address); function vestInfo( address user, uint256 ) external view returns (uint256 amount, uint256 start, uint256 maxEnd, uint256 vestID); function voter() external view returns (address); function whitelistOperator() external view returns (address); function xTokenConvertToNft( uint256 _amount ) external returns (uint256 veRaTokenId); function xTokenIncreaseNft(uint256 _amount, uint256 _tokenID) external; function setPool(address newPool) external; function useLegacyPair(bool legacy) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0 <0.9.0; /// @title Immutable state /// @notice Functions that return immutable state of the router interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Periphery Payments /// @notice Functions to ease deposits and withdrawals of ETH interface IPeripheryPayments { /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users. /// @param amountMinimum The minimum amount of WETH9 to unwrap /// @param recipient The address receiving ETH function unwrapWETH9(uint256 amountMinimum, address recipient) external payable; /// @notice Refunds any ETH balance held by this contract to the `msg.sender` /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps /// that use ether for the input amount function refundETH() external payable; /// @notice Transfers the full amount of a token held by this contract to recipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users /// @param token The contract address of the token which will be transferred to `recipient` /// @param amountMinimum The minimum amount of token required for a transfer /// @param recipient The destination address of the token function sweepToken( address token, uint256 amountMinimum, address recipient ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title The interface for the CL gauge Factory /// @notice Deploys CL gauges interface IClGaugeFactory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted when a gauge is created /// @param pool The address of the pool /// @param pool The address of the created gauge event GaugeCreated(address indexed pool, address gauge); /// @notice Emitted when pairs implementation is changed /// @param oldImplementation The previous implementation /// @param newImplementation The new implementation event ImplementationChanged( address indexed oldImplementation, address indexed newImplementation ); /// @notice Emitted when the fee collector is changed /// @param oldFeeCollector The previous implementation /// @param newFeeCollector The new implementation event FeeCollectorChanged( address indexed oldFeeCollector, address indexed newFeeCollector ); /// @notice Returns the current owner of the factory /// @dev Can be changed by the current owner via setOwner /// @return The address of the factory owner function owner() external view returns (address); /// @notice Returns the NFP Manager address function nfpManager() external view returns (address); /// @notice Returns the votingEscrow address function votingEscrow() external view returns (address); /// @notice Returns Voter function voter() external view returns (address); /// @notice Returns the gauge address for a given pool, or address 0 if it does not exist /// @param pool The pool address /// @return gauge The gauge address function getGauge(address pool) external view returns (address gauge); /// @notice Returns the address of the fee collector contract /// @dev Fee collector decides where the protocol fees go (fee distributor, treasury, etc.) function feeCollector() external view returns (address); /// @notice Creates a gauge for the given pool /// @param pool One of the desired gauge /// @return gauge The address of the newly created gauge function createGauge(address pool) external returns (address gauge); /// @notice Updates the owner of the factory /// @dev Must be called by the current owner /// @param _owner The new owner of the factory function setOwner(address _owner) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; /// @title ERC721 with permit /// @notice Extension to ERC721 that includes a permit function for signature based approvals interface IERC721PermitUpgradeable is IERC721Upgradeable { /// @notice The permit typehash used in the permit signature /// @return The typehash for the permit function PERMIT_TYPEHASH() external pure returns (bytes32); /// @notice The domain separator used in the permit signature /// @return The domain seperator used in encoding of permit signature function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice Approve of a specific token ID for spending by spender via signature /// @param spender The account that is being approved /// @param tokenId The ID of the token that is being approved for spending /// @param deadline The deadline timestamp by which the call must be mined for the approve to work /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0 <0.9.0; interface IGaugeV2 { /// @notice Emitted when a reward notification is made. /// @param from The address from which the reward is notified. /// @param reward The address of the reward token. /// @param amount The amount of rewards notified. /// @param period The period for which the rewards are notified. event NotifyReward( address indexed from, address indexed reward, uint256 amount, uint256 period ); /// @notice Emitted when a bribe is made. /// @param from The address from which the bribe is made. /// @param reward The address of the reward token. /// @param amount The amount of tokens bribed. /// @param period The period for which the bribe is made. event Bribe( address indexed from, address indexed reward, uint256 amount, uint256 period ); /// @notice Emitted when rewards are claimed. /// @param period The period for which the rewards are claimed. /// @param _positionHash The identifier of the NFP for which rewards are claimed. /// @param receiver The address of the receiver of the claimed rewards. /// @param reward The address of the reward token. /// @param amount The amount of rewards claimed. event ClaimRewards( uint256 period, bytes32 _positionHash, address receiver, address reward, uint256 amount ); /// @notice Emitted when a new reward token was pushed to the rewards array event RewardAdded(address reward); /// @notice Emitted when a reward token was removed from the rewards array event RewardRemoved(address reward); /// @notice Initializes the contract with the provided gaugeFactory, voter, and pool addresses. /// @param _gaugeFactory The address of the gaugeFactory to set. /// @param _voter The address of the voter to set. /// @param _nfpManager The address of the NFP manager to set. /// @param _feeCollector The address of the fee collector to set. /// @param _pool The address of the pool to set. function initialize( address _gaugeFactory, address _voter, address _nfpManager, address _feeCollector, address _pool ) external; /// @notice Retrieves the value of the firstPeriod variable. /// @return The value of the firstPeriod variable. function firstPeriod() external returns (uint256); /// @notice Retrieves the total supply of a specific token for a given period. /// @param period The period for which to retrieve the total supply. /// @param token The address of the token for which to retrieve the total supply. /// @return The total supply of the specified token for the given period. function tokenTotalSupplyByPeriod( uint256 period, address token ) external view returns (uint256); /// @notice Retrieves the total boosted seconds for a specific period. /// @param period The period for which to retrieve the total boosted seconds. /// @return The total boosted seconds for the specified period. function periodTotalBoostedSeconds( uint256 period ) external view returns (uint256); /// @notice Retrieves the getTokenTotalSupplyByPeriod of the current period. /// @dev included to support voter's left() check during distribute(). /// @param token The address of the token for which to retrieve the remaining amount. /// @return The amount of tokens left to distribute in this period. function left(address token) external view returns (uint256); /// @notice Retrieves the reward rate for a specific reward address. /// @dev this method returns the base rate without boost /// @param token The address of the reward for which to retrieve the reward rate. /// @return The reward rate for the specified reward address. function rewardRate(address token) external view returns (uint256); /// @notice Retrieves the claimed amount for a specific period, position hash, and user address. /// @param period The period for which to retrieve the claimed amount. /// @param _positionHash The identifier of the NFP for which to retrieve the claimed amount. /// @param reward The address of the token for the claimed amount. /// @return The claimed amount for the specified period, token ID, and user address. function periodClaimedAmount( uint256 period, bytes32 _positionHash, address reward ) external view returns (uint256); /// @notice Retrieves the last claimed period for a specific token, token ID combination. /// @param token The address of the reward token for which to retrieve the last claimed period. /// @param _positionHash The identifier of the NFP for which to retrieve the last claimed period. /// @return The last claimed period for the specified token and token ID. function lastClaimByToken( address token, bytes32 _positionHash ) external view returns (uint256); /// @notice Retrieves the reward address at the specified index in the rewards array. /// @param index The index of the reward address to retrieve. /// @return The reward address at the specified index. function rewards(uint256 index) external view returns (address); /// @notice Checks if a given address is a valid reward. /// @param reward The address to check. /// @return A boolean indicating whether the address is a valid reward. function isReward(address reward) external view returns (bool); /// @notice Returns an array of reward token addresses. /// @return An array of reward token addresses. function getRewardTokens() external view returns (address[] memory); /// @notice Returns the hash used to store positions in a mapping /// @param owner The address of the position owner /// @param index The index of the position /// @param tickLower The lower tick boundary of the position /// @param tickUpper The upper tick boundary of the position /// @return _hash The hash used to store positions in a mapping function positionHash( address owner, uint256 index, int24 tickLower, int24 tickUpper ) external pure returns (bytes32); /// @notice Retrieves the liquidity and boosted liquidity for a specific NFP. /// @param tokenId The identifier of the NFP. /// @return liquidity The liquidity of the position token. /// @return boostedLiquidity The boosted liquidity of the position token. /// @return veNftTokenId The attached veNFT function positionInfo( uint256 tokenId ) external view returns ( uint128 liquidity, uint128 boostedLiquidity, uint256 veNftTokenId ); /// @notice Returns the amount of rewards earned for an NFP. /// @param token The address of the token for which to retrieve the earned rewards. /// @param tokenId The identifier of the specific NFP for which to retrieve the earned rewards. /// @return reward The amount of rewards earned for the specified NFP and tokens. function earned( address token, uint256 tokenId ) external view returns (uint256 reward); /// @notice Returns the amount of rewards earned during a period for an NFP. /// @param period The period for which to retrieve the earned rewards. /// @param token The address of the token for which to retrieve the earned rewards. /// @param tokenId The identifier of the specific NFP for which to retrieve the earned rewards. /// @return reward The amount of rewards earned for the specified NFP and tokens. function periodEarned( uint256 period, address token, uint256 tokenId ) external view returns (uint256); /// @notice Retrieves the earned rewards for a specific period, token, owner, index, tickLower, and tickUpper. /// @param period The period for which to retrieve the earned rewards. /// @param token The address of the token for which to retrieve the earned rewards. /// @param owner The address of the owner for which to retrieve the earned rewards. /// @param index The index for which to retrieve the earned rewards. /// @param tickLower The tick lower bound for which to retrieve the earned rewards. /// @param tickUpper The tick upper bound for which to retrieve the earned rewards. /// @return The earned rewards for the specified period, token, owner, index, tickLower, and tickUpper. function periodEarned( uint256 period, address token, address owner, uint256 index, int24 tickLower, int24 tickUpper ) external view returns (uint256); /// @notice Retrieves the earned rewards for a specific period, token, owner, index, tickLower, and tickUpper. /// @dev used by getReward() and saves gas by saving states /// @param period The period for which to retrieve the earned rewards. /// @param token The address of the token for which to retrieve the earned rewards. /// @param owner The address of the owner for which to retrieve the earned rewards. /// @param index The index for which to retrieve the earned rewards. /// @param tickLower The tick lower bound for which to retrieve the earned rewards. /// @param tickUpper The tick upper bound for which to retrieve the earned rewards. /// @param caching Whether to cache the results or not. /// @return The earned rewards for the specified period, token, owner, index, tickLower, and tickUpper. function cachePeriodEarned( uint256 period, address token, address owner, uint256 index, int24 tickLower, int24 tickUpper, bool caching ) external returns (uint256); /// @notice Notifies the contract about the amount of rewards to be distributed for a specific token. /// @param token The address of the token for which to notify the reward amount. /// @param amount The amount of rewards to be distributed. function notifyRewardAmount(address token, uint256 amount) external; /// @notice Retrieves the reward amount for a specific period, NFP, and token addresses. /// @param period The period for which to retrieve the reward amount. /// @param tokens The addresses of the tokens for which to retrieve the reward amount. /// @param tokenId The identifier of the specific NFP for which to retrieve the reward amount. /// @param receiver The address of the receiver of the reward amount. function getPeriodReward( uint256 period, address[] calldata tokens, uint256 tokenId, address receiver ) external; /// @notice Retrieves the rewards for a specific period, set of tokens, owner, index, tickLower, tickUpper, and receiver. /// @param period The period for which to retrieve the rewards. /// @param tokens An array of token addresses for which to retrieve the rewards. /// @param owner The address of the owner for which to retrieve the rewards. /// @param index The index for which to retrieve the rewards. /// @param tickLower The tick lower bound for which to retrieve the rewards. /// @param tickUpper The tick upper bound for which to retrieve the rewards. /// @param receiver The address of the receiver of the rewards. function getPeriodReward( uint256 period, address[] calldata tokens, address owner, uint256 index, int24 tickLower, int24 tickUpper, address receiver ) external; function getRewardForOwner( uint256 tokenId, address[] memory tokens ) external; /// @notice Notifies rewards for periods greater than current period /// @dev does not push fees /// @dev requires reward token to be whitelisted function notifyRewardAmountForPeriod( address token, uint256 amount, uint256 period ) external; /// @notice Notifies rewards for the next period /// @dev does not push fees /// @dev requires reward token to be whitelisted function notifyRewardAmountNextPeriod( address token, uint256 amount ) external; function addRewards(address reward) external; function removeRewards(address reward) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol"; import "./IERC721PermitUpgradeable.sol"; import "../../v2-periphery/interfaces/IPeripheryPayments.sol"; import "../../v2-periphery/interfaces/IPeripheryImmutableState.sol"; import "../libraries/PoolAddress.sol"; /// @title Non-fungible token for positions /// @notice Wraps RA V2 positions in a non-fungible token interface which allows for them to be transferred /// and authorized. interface INonfungiblePositionManager is IPeripheryPayments, IPeripheryImmutableState, IERC721MetadataUpgradeable, IERC721EnumerableUpgradeable, IERC721PermitUpgradeable { /// @notice Emitted when liquidity is increased for a position NFT /// @dev Also emitted when a token is minted /// @param tokenId The ID of the token for which liquidity was increased /// @param liquidity The amount by which liquidity for the NFT position was increased /// @param amount0 The amount of token0 that was paid for the increase in liquidity /// @param amount1 The amount of token1 that was paid for the increase in liquidity event IncreaseLiquidity( uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); /// @notice Emitted when liquidity is decreased for a position NFT /// @param tokenId The ID of the token for which liquidity was decreased /// @param liquidity The amount by which liquidity for the NFT position was decreased /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity event DecreaseLiquidity( uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); /// @notice Emitted when tokens are collected for a position NFT /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior /// @param tokenId The ID of the token for which underlying tokens were collected /// @param recipient The address of the account that received the collected tokens /// @param amount0 The amount of token0 owed to the position that was collected /// @param amount1 The amount of token1 owed to the position that was collected event Collect( uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1 ); /// @notice The address of the veNFTs function votingEscrow() external view returns (address); /// @notice Returns the position information associated with a given token ID. /// @dev Throws if the token ID is not valid. /// @param tokenId The ID of the token that represents the position /// @return nonce The nonce for permits /// @return operator The address that is approved for spending /// @return token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific pool /// @return fee The fee associated with the pool /// @return tickLower The lower end of the tick range for the position /// @return tickUpper The higher end of the tick range for the position /// @return liquidity The liquidity of the position /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation function positions( uint256 tokenId ) external view returns ( uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } // details about the RA position struct Position { // the nonce for permits uint96 nonce; // the address that is approved for spending this token address operator; // the ID of the pool with which this token is connected uint80 poolId; // the tick range of the position int24 tickLower; int24 tickUpper; // the liquidity of the position uint128 liquidity; // the fee growth of the aggregate position as of the last action on the individual position uint256 feeGrowthInside0LastX128; uint256 feeGrowthInside1LastX128; // how many uncollected tokens are owed to the position, as of the last computation uint128 tokensOwed0; uint128 tokensOwed1; // the veNFT tokenId attached uint256 veNftTokenId; } /// @notice Creates a new position wrapped in a NFT /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized /// a method does not exist, i.e. the pool is assumed to be initialized. /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata /// @return tokenId The ID of the token that represents the minted position /// @return liquidity The amount of liquidity for this position /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function mint( MintParams calldata params ) external payable returns ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender` /// @param params tokenId The ID of the token for which liquidity is being increased, /// amount0Desired The desired amount of token0 to be spent, /// amount1Desired The desired amount of token1 to be spent, /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check, /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check, /// deadline The time by which the transaction must be included to effect the change /// @return liquidity The new liquidity amount as a result of the increase /// @return amount0 The amount of token0 to acheive resulting liquidity /// @return amount1 The amount of token1 to acheive resulting liquidity function increaseLiquidity( IncreaseLiquidityParams calldata params ) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1); struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Decreases the amount of liquidity in a position and accounts it to the position /// @param params tokenId The ID of the token for which liquidity is being decreased, /// amount The amount by which liquidity will be decreased, /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity, /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity, /// deadline The time by which the transaction must be included to effect the change /// @return amount0 The amount of token0 accounted to the position's tokens owed /// @return amount1 The amount of token1 accounted to the position's tokens owed function decreaseLiquidity( DecreaseLiquidityParams calldata params ) external payable returns (uint256 amount0, uint256 amount1); struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient /// @param params tokenId The ID of the NFT for which tokens are being collected, /// recipient The account that should receive the tokens, /// amount0Max The maximum amount of token0 to collect, /// amount1Max The maximum amount of token1 to collect /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( CollectParams calldata params ) external payable returns (uint256 amount0, uint256 amount1); /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens /// must be collected first. /// @param tokenId The ID of the token that is being burned function burn(uint256 tokenId) external payable; function isApprovedOrOwner( address spender, uint256 tokenId ) external view returns (bool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0 <0.9.0; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee library PoolAddress { // @dev this has to be changed if the optimization runs are changed // bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; bytes32 internal constant POOL_INIT_CODE_HASH = 0x1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d; // bytes32 internal constant POOL_INIT_CODE_HASH = 0x5698d96123f1258c1416afb173cca764c73725fcf9189ae4fe4552dc4b25ce5b; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress( address factory, PoolKey memory key ) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex"ff", factory, keccak256( abi.encode(key.token0, key.token1, key.fee) ), POOL_INIT_CODE_HASH ) ) ) ) ); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import "./pool/IClPoolImmutables.sol"; import "./pool/IClPoolState.sol"; import "./pool/IClPoolDerivedState.sol"; import "./pool/IClPoolActions.sol"; import "./pool/IClPoolOwnerActions.sol"; import "./pool/IClPoolEvents.sol"; /// @title The interface for a CL V2 Pool /// @notice A CL pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IClPool is IClPoolImmutables, IClPoolState, IClPoolDerivedState, IClPoolActions, IClPoolOwnerActions, IClPoolEvents { /// @notice Initializes a pool with parameters provided function initialize( address _factory, address _nfpManager, address _veRam, address _voter, address _token0, address _token1, uint24 _fee, int24 _tickSpacing ) external; function _advancePeriod() external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; pragma abicoder v2; /// @title The interface for the CL Factory /// @notice The CL Factory facilitates creation of CL pools and control over the protocol fees interface IClPoolFactory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted when a pool is created /// @param token0 The first token of the pool by address sort order /// @param token1 The second token of the pool by address sort order /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @param tickSpacing The minimum number of ticks between initialized ticks /// @param pool The address of the created pool event PoolCreated( address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool ); /// @notice Emitted when a new fee amount is enabled for pool creation via the factory /// @param fee The enabled fee, denominated in hundredths of a bip /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing); /// @notice Emitted when pairs implementation is changed /// @param oldImplementation The previous implementation /// @param newImplementation The new implementation event ImplementationChanged( address indexed oldImplementation, address indexed newImplementation ); /// @notice Emitted when the fee collector is changed /// @param oldFeeCollector The previous implementation /// @param newFeeCollector The new implementation event FeeCollectorChanged( address indexed oldFeeCollector, address indexed newFeeCollector ); /// @notice Emitted when the protocol fee is changed /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol( uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New ); /// @notice Emitted when the protocol fee is changed /// @param pool The pool address /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetPoolFeeProtocol( address pool, uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New ); /// @notice Emitted when the feeSetter of the factory is changed /// @param oldSetter The feeSetter before the setter was changed /// @param newSetter The feeSetter after the setter was changed event FeeSetterChanged( address indexed oldSetter, address indexed newSetter ); /// @notice Returns the current owner of the factory /// @dev Can be changed by the current owner via setOwner /// @return The address of the factory owner function owner() external view returns (address); /// @notice Returns the CL NFP Manager function nfpManager() external view returns (address); /// @notice Returns the votingEscrow address function votingEscrow() external view returns (address); /// @notice Returns Voter address function voter() external view returns (address); /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee /// @return The tick spacing function feeAmountTickSpacing(uint24 fee) external view returns (int24); /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @return pool The pool address function getPool( address tokenA, address tokenB, uint24 fee ) external view returns (address pool); /// @notice Returns the address of the fee collector contract /// @dev Fee collector decides where the protocol fees go (fee distributor, treasury, etc.) function feeCollector() external view returns (address); /// @notice Creates a pool for the given two tokens and fee /// @param tokenA One of the two tokens in the desired pool /// @param tokenB The other of the two tokens in the desired pool /// @param fee The desired fee for the pool /// @param sqrtPriceX96 initial sqrtPriceX96 of the pool /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments /// are invalid. /// @return pool The address of the newly created pool function createPool( address tokenA, address tokenB, uint24 fee, uint160 sqrtPriceX96 ) external returns (address pool); /// @notice Updates the owner of the factory /// @dev Must be called by the current owner /// @param _owner The new owner of the factory function setOwner(address _owner) external; /// @notice Enables a fee amount with the given tickSpacing /// @dev Fee amounts may never be removed once enabled /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6) /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount function enableFeeAmount(uint24 fee, int24 tickSpacing) external; /// @notice returns the default protocol fee. function feeProtocol() external view returns (uint8); /// @notice returns the protocol fee for both tokens of a pool. function poolFeeProtocol(address pool) external view returns (uint8); /// @notice Sets the default protocol's % share of the fees /// @param _feeProtocol new default protocol fee for token0 and token1 function setFeeProtocol(uint8 _feeProtocol) external; /// @notice Sets the fee collector address /// @param _feeCollector the fee collector address function setFeeCollector(address _feeCollector) external; function setFeeSetter(address _newFeeSetter) external; function setFee(address _pool, uint24 _fee) external; /// @notice Sets the default protocol's % share of the fees /// @param pool the pool address /// @param feeProtocol new protocol fee for the pool for token0 and token1 function setPoolFeeProtocol(address pool, uint8 feeProtocol) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IClPoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position at index 0 /// @dev The caller of this method receives a callback in the form of IRamsesV2MintCallback#ramsesV2MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IRamsesV2MintCallback#ramsesV2MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param index The index for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param veNFTTokenId The veNFT tokenId to attach to the position /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, uint256 index, int24 tickLower, int24 tickUpper, uint128 amount, uint256 veNFTTokenId, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param index The index of the position to be collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, uint256 index, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position at index 0 /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param index The index for which the liquidity will be burned /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( uint256 index, int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param index The index for which the liquidity will be burned /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @param veNFTTokenId The veNFT Token Id to attach /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( uint256 index, int24 tickLower, int24 tickUpper, uint128 amount, uint256 veNFTTokenId ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IRamsesV2SwapCallback#ramsesV2SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IRamsesV2FlashCallback#ramsesV2FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext( uint16 observationCardinalityNext ) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IClPoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block timestamp /// @return secondsPerBoostedLiquidityPeriodX128s Cumulative seconds per boosted liquidity-in-range value as of each `secondsAgos` from the current block timestamp function observe( uint32[] calldata secondsAgos ) external view returns ( int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s, uint160[] memory secondsPerBoostedLiquidityPeriodX128s ); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. Boosted data is only valid if it's within the same period /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsPerBoostedLiquidityInsideX128 The snapshot of seconds per boosted liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside( int24 tickLower, int24 tickUpper ) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint160 secondsPerBoostedLiquidityInsideX128, uint32 secondsInside ); /// @notice Returns the seconds per liquidity and seconds inside a tick range for a period /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsPerBoostedLiquidityInsideX128 The snapshot of seconds per boosted liquidity for the range function periodCumulativesInside( uint32 period, int24 tickLower, int24 tickUpper ) external view returns ( uint160 secondsPerLiquidityInsideX128, uint160 secondsPerBoostedLiquidityInsideX128 ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IClPoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IClPoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IClPoolFactory interface /// @return The contract address function factory() external view returns (address); /// @notice The contract that manages CL NFPs, which must adhere to the INonfungiblePositionManager interface /// @return The contract address function nfpManager() external view returns (address); /// @notice The contract that manages veNFTs, which must adhere to the IVotingEscrow interface /// @return The contract address function votingEscrow() external view returns (address); /// @notice The contract that manages RA votes, which must adhere to the IVoter interface /// @return The contract address function voter() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); /// @notice returns the current fee set for the pool function currentFee() external view returns (uint24); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IClPoolOwnerActions { /// @notice Set the protocol's % share of the fees /// @dev Fees start at 50%, with 5% increments function setFeeProtocol() external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); function setFee(uint24 _fee) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IClPoolState { /// @notice reads arbitrary storage slots and returns the bytes /// @param slots The slots to read from /// @return returnData The data read from the slots function readStorage( bytes32[] calldata slots ) external view returns (bytes32[] memory returnData); /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice Returns the last tick of a given period /// @param period The period in question /// @return previousPeriod The period before current period /// @dev this is because there might be periods without trades /// startTick The start tick of the period /// lastTick The last tick of the period, if the period is finished /// endSecondsPerLiquidityPeriodX128 Seconds per liquidity at period's end /// endSecondsPerBoostedLiquidityPeriodX128 Seconds per boosted liquidity at period's end function periods( uint256 period ) external view returns ( uint32 previousPeriod, int24 startTick, int24 lastTick, uint160 endSecondsPerLiquidityCumulativeX128, uint160 endSecondsPerBoostedLiquidityCumulativeX128, uint32 boostedInRange ); /// @notice The last period where a trade or liquidity change happened function lastPeriod() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice The currently in range derived liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function boostedLiquidity() external view returns (uint128); /// @notice Get the boost information for a specific position at a period /// @return boostAmount the amount of boost this position has for this period, /// veNFTAmount the amount of veNFTs attached to this position for this period, /// secondsDebtX96 used to account for changes in the deposit amount during the period /// boostedSecondsDebtX96 used to account for changes in the boostAmount and veNFT locked during the period, function boostInfos( uint256 period, bytes32 key ) external view returns ( uint128 boostAmount, int128 veNFTAmount, int256 secondsDebtX96, int256 boostedSecondsDebtX96 ); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks( int24 tick ) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint128 boostedLiquidityGross, int128 boostedLiquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return liquidity The amount of liquidity in the position, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke /// @return attachedVeNFTId the veNFT tokenId attached to the position function positions( bytes32 key ) external view returns ( uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1, uint256 attachedVeNFTId ); /// @notice Returns a period's total boost amount and total veNFT attached /// @param period Period timestamp /// @return totalBoostAmount The total amount of boost this period has, /// @return totalVeNFTAmount The total amount of veNFTs attached to this period function boostInfos( uint256 period ) external view returns (uint128 totalBoostAmount, int128 totalVeNFTAmount); /// @notice Get the period seconds debt of a specific position /// @param period the period number /// @param recipient recipient address /// @param index position index /// @param tickLower lower bound of range /// @param tickUpper upper bound of range /// @return secondsDebtX96 seconds the position was not in range for the period /// @return boostedSecondsDebtX96 boosted seconds the period function positionPeriodDebt( uint256 period, address recipient, uint256 index, int24 tickLower, int24 tickUpper ) external view returns (int256 secondsDebtX96, int256 boostedSecondsDebtX96); /// @notice get the period seconds in range of a specific position /// @param period the period number /// @param owner owner address /// @param index position index /// @param tickLower lower bound of range /// @param tickUpper upper bound of range /// @return periodSecondsInsideX96 seconds the position was not in range for the period /// @return periodBoostedSecondsInsideX96 boosted seconds the period function positionPeriodSecondsInRange( uint256 period, address owner, uint256 index, int24 tickLower, int24 tickUpper ) external view returns ( uint256 periodSecondsInsideX96, uint256 periodBoostedSecondsInsideX96 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// @return initialized whether the observation has been initialized and the values are safe to use function observations( uint256 index ) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized, uint160 secondsPerBoostedLiquidityPeriodX128 ); }
{ "optimizer": { "enabled": true, "runs": 800 }, "evmVersion": "paris", "viaIR": true, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Attach","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"feeDistributor","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"CustomGaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Detach","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"EmissionsRatio","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"forbidder","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"Forbidden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"feeDistributor","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeKilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeRevived","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":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BASIS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward","type":"address"}],"name":"addClGaugeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"addInitialRewardPerGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"attachTokenToGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"base","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clGaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256[][]","name":"_nfpTokenIds","type":"uint256[][]"}],"name":"claimClGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_incentives","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimIncentives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"clawBackUnusedEmissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createCLGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address[]","name":"whitelistedRewards","type":"address[]"}],"name":"createCustomGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"createGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"customGaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"customGaugeForPool","outputs":[{"internalType":"address","name":"customGauge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"designateStale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"detachTokenFromGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAllUnchecked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeGaugeUnchecked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"distributeRangeUnchecked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyCouncil","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributorFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeDistributors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"forbidden","type":"bool"}],"name":"forbid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"gaugeXRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"getVotes","outputs":[{"internalType":"address[][]","name":"tokensVotes","type":"address[][]"},{"internalType":"uint256[][]","name":"tokensWeights","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_gauges","type":"address"},{"internalType":"address","name":"_feeDistributorFactory","type":"address"},{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_msig","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_clFactory","type":"address"},{"internalType":"address","name":"_clGaugeFactory","type":"address"},{"internalType":"address","name":"_nfpManager","type":"address"},{"internalType":"address","name":"_xToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"initializeCustomGaugeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isForbidden","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nfpManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"fees","type":"address[]"},{"internalType":"address[][]","name":"tokens","type":"address[][]"}],"name":"recoverFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward","type":"address"}],"name":"removeClGaugeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"resetGaugeXRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_council","type":"address"}],"name":"setEmergencyCouncil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint256[]","name":"_xRatios","type":"uint256[]"}],"name":"setPoolXRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_whitelistOperator","type":"address"}],"name":"setWhitelistOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xRatio","type":"uint256"}],"name":"setXRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"stuckEmissionsRecovery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"updateFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"updateForRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"updateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usedWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60808060405234620000c6576000549060ff8260081c1662000074575060ff8082160362000038575b6040516155569081620000cc8239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a13862000028565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe60a0604052600436101561001257600080fd5b60003560e01c8062aca65e146142905780630675f276146141fe57806306d6a1b2146141c3578063075461721461419c578063088b699e146141755780630c340a241461414e5780630e4bf543146141235780631703e5f9146140e45780631f7b6d32146140c657806320b1cb6f146140235780632a3e123514613ef3578063310bd74b14613d0257806332145f9014613c2c5780633af32abf14613bed5780633c6b16ab14613aaf5780633e9529711461344d578063402914f51461341357806340829d6114612f5b578063411b1f7714612e6257806344c4378214612e3b57806347317bad14612dc857806349e4974a14612d8d5780635001f3b514612d6657806350d976fc14612ce2578063528cfa9814612cc557806353d7869314612c9057806363453ae114612c58578063666256aa14612ac957806368c3acb314612c31578063698473e314612ace57806369a9c17314612ac95780636ecbe38a14612aad5780637778960e14612a865780637868f5eb14612a4b57806379e9382414612a1f5780637ac09bf7146127ce5780637bdd4465146127a75780637bebe381146127805780638dd598fb1461275657806391f36633146124005780639647d141146123d957806396c82e57146123bb578063986e471d1461239d57806398bbc3c714612376578063992a7933146122445780639b19251a146121f65780639b6a9d72146121a15780639e37878c146121625780639e9ecc22146120de5780639f06247b14611f8f578063a4b5820614611dc1578063a5f4301e14611611578063a61c713a14611599578063a7cac8461461155f578063a86a366d14611525578063aa79979b146114e6578063ac4afa38146114a5578063b65f512614611474578063b9a09fd514611439578063c42cf535146113f5578063c45a0155146113ce578063c527ee1f14611315578063ca33c048146111b0578063d23254b414611167578063d33219b414611140578063d560b0d7146110e4578063d88b810b14611076578063dce1de4314610b2f578063de7d72e514610a79578063e586875f14610a35578063e5bc3de1146109ac578063e7264b65146108d6578063e74f6166146108af578063e81eb08614610848578063ea94ee44146107e3578063eab37eec14610588578063eddaa0e914610544578063efd9bf92146104b5578063f0b834e6146103bc5763f3594be01461038b57600080fd5b346103b75760203660031901126103b757600435600052601a6020526020604060002054604051908152f35b600080fd5b346103b7576103ca36614370565b9092916001600160a01b03918260065416926103e7843314614810565b6000925b8084106103f457005b8660005b87610404878785614785565b90508210156104a8576104288261043489898961042d610428848c61043a9a6146be565b6146ce565b1697614785565b906146be565b91803b156103b757604051632cf8b47b60e11b81526001600160a01b03938416600482015292881660248401526000908390604490829084905af191821561049c5760019261048d575b500187906103f8565b610496906145fe565b89610484565b6040513d6000823e3d90fd5b50505092600101926103eb565b346103b75760403660031901126103b7576104ce614330565b6104d6614346565b6001600160a01b03809281600b541633148015610537575b6104f790614810565b1691823b156103b75760246000928360405195869485936339ced26d60e21b85521660048401525af1801561049c5761052c57005b610535906145fe565b005b50600654821633146104ee565b346103b75760203660031901126103b75761055d614330565b6001600160a01b0390816006541633036103b757166001600160a01b0319600b541617600b55600080f35b346103b75760603660031901126103b75767ffffffffffffffff6004358181116103b7576105ba9036906004016142ff565b916024358181116103b7576105d39036906004016142ff565b9390916044359081116103b7576105ee9036906004016142ff565b90946001600160a01b03600a5416946000925b84841061060a57005b60005b61061885838b614785565b90508110156107d8576106308161043487858d614785565b6040516331a9108f60e11b8152903560048201526020816024818c5afa801561049c57600090610798575b6001600160a01b039150163314801561070b575b156103b7578061069c8a9261043488866001600160a01b03610695610428848f8d6146be565b1696614785565b356106a887878b614785565b93803b156103b7576106e29460008094604051978895869485936353c2957d60e11b855260048501526040602485015260448401916147ca565b03925af191821561049c576001926106fc575b500161060d565b610705906145fe565b8a6106f5565b5061071b8161043487858d614785565b60405163020604bf60e21b8152903560048201526020816024818c5afa801561049c57600090610758575b6001600160a01b03915016331461066f565b506020813d602011610790575b816107726020938361462e565b810103126103b75761078b6001600160a01b03916149b9565b610746565b3d9150610765565b506020813d6020116107d0575b816107b26020938361462e565b810103126103b7576107cb6001600160a01b03916149b9565b61065b565b3d91506107a5565b509260010192610601565b346103b7576107f136614585565b91909133600052601b60205260ff60406000205416156103b75760405191825260208201527ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760406001600160a01b0333941692a3005b346103b7576108563661456f565b905b81811061086157005b61086a816145af565b906001600160a01b03918291549060031b1c16600052601360205260406000205416906001916010838154036103b7576108a8849260028355614a2c565b5501610858565b346103b75760003660031901126103b75760206001600160a01b0360085416604051908152f35b346103b7576020806003193601126103b75760043567ffffffffffffffff81116103b7576109089036906004016142ff565b916001600160a01b039182600b54163314801561099f575b61092990614810565b6012549360005b81811061093957005b8061094a61042860019385876146be565b7fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60408861097784614754565b93169283600052602189528160002060ff19815416905581519081528a89820152a201610930565b5060065483163314610920565b346103b75760203660031901126103b7576004356109e06001600160a01b0380600b54163314908115610a27575b50614810565b6109ee612710821115614842565b60007fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60406012548151908152846020820152a2601255005b9050600654163314836109da565b346103b75760203660031901126103b757610a4e614330565b600754906001600160a01b0380831633036103b7576001600160a01b03199116911617600755600080f35b346103b75760403660031901126103b757610a92614330565b610a9a6143bb565b906001600160a01b039081600b541633148015610b22575b610abb90614810565b1690816000526022602052604060002060ff815416918015158093151503610adf57005b610af4919060ff801983541691151516179055565b6040519081527fc226090c79560682a4254f61540d22465b1f23522ee477acb0a520160d3c3e0460203392a3005b5060065482163314610ab2565b346103b75760603660031901126103b757610b48614330565b610b50614346565b9060443567ffffffffffffffff81116103b757610b719036906004016142ff565b6001600160a01b036006939293541633036110315760049260206001600160a01b0360085416604051958680926331056e5760e21b82525afa93841561049c57600094610ff5575b5060206001600160a01b03602481600454169660006040519889948593630317318f60e11b85521660048401525af191821561049c57600092610fb9575b6000945060206001600160a01b03602454166024604051809881936301126ca960e21b83526001600160a01b038a1660048401525af194851561049c57600095610f7d575b5060005b818110610f10575050506001600160a01b036002541660405163095ea7b360e01b81526001600160a01b038516600482015260208160448160008019968760248401525af1801561049c57610ed1575b50602060009160446001600160a01b03600c541691604051948593849263095ea7b360e01b84526001600160a01b038b16600485015260248401525af1801561049c57610e98575b506001600160a01b03831660005260156020526001600160a01b036040600020946001600160a01b0319958284168782541617905581841660005260136020526040600020828616878254161790558185166000526014602052604060002082851687825416179055601b602052604060002060ff1990600182825416179055601d6020526001604060002091825416179055610d748561543f565b610d7d846149dc565b169081610ddf575b604080513381526001600160a01b03928316602080830191909152965093821693918516917f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a79190a46001600160a01b0360405191168152f35b8160005260136020526001600160a01b0360406000205416600052601d60205260ff60406000205416610e53576020948260005260258652610e2f6001600160a01b036040600020541615614e60565b82600052602586526040600020906001600160a01b03861690825416179055610d85565b60405162461bcd60e51b815260206004820152600c60248201527f41637469766520676175676500000000000000000000000000000000000000006044820152606490fd5b6020813d602011610ec9575b81610eb16020938361462e565b810103126103b757610ec2906148e7565b5084610cd8565b3d9150610ea4565b6020813d602011610f08575b81610eea6020938361462e565b810103126103b757600091610f006020926148e7565b509150610c90565b3d9150610edd565b6001600160a01b03861690610f296104288285876146be565b823b156103b7576001600160a01b03602460009283604051968794859363db89461b60e01b85521660048401525af191821561049c57600192610f6e575b5001610c40565b610f77906145fe565b88610f67565b9094506020813d602011610fb1575b81610f996020938361462e565b810103126103b757610faa906149b9565b9386610c3c565b3d9150610f8c565b91506020843d602011610fed575b81610fd46020938361462e565b810103126103b757610fe76000946149b9565b91610bf7565b3d9150610fc7565b9093506020813d602011611029575b816110116020938361462e565b810103126103b757611022906149b9565b9285610bb9565b3d9150611004565b60405162461bcd60e51b815260206004820152600560248201527f21415554480000000000000000000000000000000000000000000000000000006044820152606490fd5b346103b75760003660031901126103b757600d5460005b81811061109657005b61109f816145af565b906001600160a01b03918291549060031b1c16600052601360205260406000205416906001916010838154036103b7576110dd849260028355614a2c565b550161108d565b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b7576111159036906004016142ff565b60005b81811061112157005b8061113a61113561042860019486886146be565b61543f565b01611118565b346103b75760003660031901126103b75760206001600160a01b03600e5416604051908152f35b346103b75760403660031901126103b757611180614346565b60043560005260176020526001600160a01b03604060002091166000526020526020604060002054604051908152f35b346103b7576020806003193601126103b7576111ca614330565b906001600160a01b0391826006541633036112ea5760009082846005541660046040518095819363541b13ef60e11b83525af1801561049c57849284916112bb575b50506112178161543f565b16600052601d815260ff604060002054161561122f57005b601f81526040600020916000835493558261124657005b60025460065460405163a9059cbb60e01b81529083166001600160a01b0316600482015260248101949094528291849116816000816044810103925af1801561049c5761128f57005b81813d83116112b4575b6112a3818361462e565b810103126103b757610535906148e7565b503d611299565b90809293503d83116112e3575b6112d2818361462e565b810103126103b7578290828561120c565b503d6112c8565b60405162461bcd60e51b8152600480820184905260248201526310a3a7ab60e11b6044820152606490fd5b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b757366023820112156103b757611357903690602481600401359101614668565b60005b815181101561053557600060406001600160a01b0361137984866149a5565b5116600482518094819363d294f09360e01b83525af1801561049c576113a3575b5060010161135a565b604090813d83116113c7575b6113b9818361462e565b810103126103b7578261139a565b503d6113af565b346103b75760003660031901126103b75760206001600160a01b0360015416604051908152f35b346103b75760203660031901126103b75761140e614330565b600654906001600160a01b0380831633036103b7576001600160a01b03199116911617600655600080f35b346103b75760203660031901126103b75760206001600160a01b038061145d614330565b166000526013825260406000205416604051908152f35b346103b75760203660031901126103b7576004356000526023602052602060ff604060002054166040519015158152f35b346103b75760203660031901126103b757600435600d548110156103b7576001600160a01b036114d66020926145af565b9190546040519260031b1c168152f35b346103b75760203660031901126103b7576001600160a01b03611507614330565b16600052601b602052602060ff604060002054166040519015158152f35b346103b7576115333661456f565b90600052601860205260406000209081548110156103b7576114d66001600160a01b03916020936145e6565b346103b75760203660031901126103b7576001600160a01b03611580614330565b1660005260166020526020604060002054604051908152f35b346103b7576115a736614585565b91909133600052601b60205260ff60406000205416156103b757601d60205260ff60406000205416156103b75760405191825260208201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760406001600160a01b0333941692a3005b346103b75760203660031901126103b757602461162c614330565b6001600160a01b03811660005260136020526116566001600160a01b036040600020541615614e60565b60206001600160a01b03600154166040519384809263e5e31b1360e01b82526001600160a01b03861660048301525afa91821561049c57600092611d85575b508115611d4057604051916000806060850167ffffffffffffffff811186821017611d2a576040526002855260208501926040368537611c64575b6001600160a01b03600654163303611b54575b5050604051634d78e9ad60e11b8152906020826004816001600160a01b0387165afa801561049c57600090611b1a575b6000925060206001600160a01b0360248160045416936040519687938492630317318f60e11b845216958660048401525af192831561049c57600093611ade575b50803b156103b7576000809160246040518094819363189acdbd60e31b83526001600160a01b03891660048401525af1801561049c57611acf575b506001600160a01b0383163b156103b757604051635b8d276760e11b815260016004820152600081602481836001600160a01b0389165af1801561049c57611ac0575b5060035460008054604051630f6f2d4760e11b81526001600160a01b038781166004830152868116602483015260109290921c821660448201526001606482015260a06084820152965160a48801819052921692869260c48401925b818110611a9e57505050918160008160209503925af192831561049c57600093611a62575b506001600160a01b03600254169160405163095ea7b360e01b908181526001600160a01b0386169485600483015260208260448160008019958660248401525af1801561049c57611a28575b6020915060446001600160a01b03600c5416936000604051958694859384528a600485015260248401525af1801561049c576119b9575b507f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d6001600160a01b038492611985602097856000526015895260406000206001600160a01b0319908589168282541617905584841660005260138a52604060002087828254161790558660005260148a5260406000209085851690825416179055601b8952604060002060ff1990600182825416179055601d8a52600160406000209182541617905561543f565b61198e816149dc565b604080513381526001600160a01b03909616602087015291169390819081015b0390a3604051908152f35b6020813d602011611a20575b816119d26020938361462e565b810103126103b7576001600160a01b038492611985602097611a147f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d956148e7565b509750509250506118d6565b3d91506119c5565b6020823d602011611a5a575b81611a416020938361462e565b810103126103b757611a546020926148e7565b5061189f565b3d9150611a34565b9092506020813d602011611a96575b81611a7e6020938361462e565b810103126103b757611a8f906149b9565b9183611853565b3d9150611a71565b82516001600160a01b031684528894506020938401939092019160010161182e565b611ac9906145fe565b846117d2565b611ad8906145fe565b8461178f565b9092506020813d602011611b12575b81611afa6020938361462e565b810103126103b757611b0b906149b9565b9185611754565b3d9150611aed565b506020823d602011611b4c575b81611b346020938361462e565b810103126103b757611b476000926149b9565b611713565b3d9150611b27565b6001600160a01b031680600052602260205260ff604060002054161580611c47575b15611c0257600052601c60205260ff604060002054169081611be5575b5015611ba05783806116e3565b60405162461bcd60e51b815260206004820152600c60248201527f2177686974656c697374656400000000000000000000000000000000000000006044820152606490fd5b6001600160a01b0391501660005260ff6040600020541684611b93565b60405162461bcd60e51b815260206004820152600960248201527f466f7262696464656e00000000000000000000000000000000000000000000006044820152606490fd5b506001600160a01b03821660005260ff6040600020541615611b76565b505060408051634eb1c24560e11b815290816004816001600160a01b0387165afa801561049c57600091600091611ce3575b50906001600160a01b0360025416855115611ccd5783526001600160a01b03600c5416855160011015611ccd5760408601526116d0565b634e487b7160e01b600052603260045260246000fd5b9150506040813d604011611d22575b81611cff6040938361462e565b810103126103b757611d1c6020611d15836149b9565b92016149b9565b85611c96565b3d9150611cf2565b634e487b7160e01b600052604160045260246000fd5b60405162461bcd60e51b815260206004820152600660248201527f215f706f6f6c00000000000000000000000000000000000000000000000000006044820152606490fd5b9091506020813d602011611db9575b81611da16020938361462e565b810103126103b757611db2906148e7565b9082611695565b3d9150611d94565b346103b7576020806003193601126103b75760043567ffffffffffffffff81116103b757611df39036906004016142ff565b90916001600160a01b0380600b541633148015611f82575b611e1490614810565b600082826005541660046040518094819363541b13ef60e11b83525af190811561049c578391611f59575b505060005b838110611e4d57005b611e5e6111356104288387896146be565b81611e6d6104288387896146be565b16600052601d835260ff6040600020541615611e8c575b600101611e44565b81611e9b6104288387896146be565b16600052601f908184526040600020549183611ebb61042884898b6146be565b166000528452600060408120558382611ed7575b509050611e84565b60025460065460405163a9059cbb60e01b81529086166001600160a01b03166004820152602481019490945283908516816000816044810103925af1801561049c57611f24575b83611ecf565b8382813d8311611f52575b611f39818361462e565b810103126103b757611f4c6001926148e7565b50611f1e565b503d611f2f565b813d8311611f7b575b611f6c818361462e565b810103126103b7578185611e3f565b503d611f62565b5060065481163314611e0b565b346103b7576020806003193601126103b757611fa9614330565b906001600160a01b038092611fc382600754163314614dd4565b169182600052601d825260ff604060002054166120995760008091848252601d845260408220600160ff19825416179055601484526040822054169260405190810190636373ea6960e01b82526004815261201d81614612565b5190845afa61202a614e20565b50612058575b507fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa600080a2005b803b156103b75760008091602460405180948193635b8d276760e11b8352600160048401525af1801561049c571561203057612093906145fe565b81612030565b60405162461bcd60e51b815260048101839052600560248201527f414c4956450000000000000000000000000000000000000000000000000000006044820152606490fd5b346103b75760403660031901126103b7576120f7614330565b6120ff614346565b6001600160a01b03809281600b541633148015612155575b61212090614810565b1691823b156103b75760246000928360405195869485936316d2246760e31b85521660048401525af1801561049c5761052c57005b5060065482163314612117565b346103b75760203660031901126103b7576001600160a01b03612183614330565b166000526022602052602060ff604060002054166040519015158152f35b346103b7576121af3661456f565b905b8181106121ba57005b806121f06121c96001936145af565b906001600160a01b03918291549060031b1c1660005260136020526040600020541661543f565b016121b1565b346103b75760203660031901126103b757610535612212614330565b6122316001600160a01b0380600b541633149081156122365750614810565b6154f7565b9050600654163314846109da565b346103b7576020806003193601126103b75761225e614330565b906001600160a01b03809261227882600754163314614dd4565b169182600052601d825260ff604060002054161561234b5760008091848252601d84526040822060ff198154169055601484526040822054169260405190810190636373ea6960e01b8252600481526122d081614612565b5190845afa6122dd614e20565b5061230b575b507f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7600080a2005b803b156103b75760008091602460405180948193635b8d276760e11b83528160048401525af1801561049c57156122e357612345906145fe565b816122e3565b60405162461bcd60e51b815260048082018490526024820152631111505160e21b6044820152606490fd5b346103b75760003660031901126103b75760206001600160a01b03600a5416604051908152f35b346103b75760003660031901126103b7576020601254604051908152f35b346103b75760003660031901126103b7576020600f54604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360045416604051908152f35b346103b75761241a6124113661456f565b90809291614a1f565b600191828201809211612740579161244261243483614650565b60405160805260805161462e565b816080515261245082614650565b6020806080510190612467601f1980940183614db7565b61247085614650565b9461247e604051968761462e565b80865261248a81614650565b9661249a85848901990189614db7565b60005b8281106125c85750505060405194604086016040875260805151809152606087019060608160051b89010194916000905b82821061255f5750505050858303828701525191828152818101828460051b83010197946000925b85841061250357888a0389f35b90919293949596898383839c030185528689518180825194858152019101926000905b85818310612548575050508192509901940194019295949391909896986124f6565b919380919386518152019401920189929391612526565b90919296949597809a98605f198b82030183528789518180825194858152019101926000905b858183106125a857505050819250990192019201909291999799969594966124ce565b91938091936001600160a01b03875116815201940192018a929391612585565b9086826125dc829b9994849997989961488e565b8060005260188089526125f3604060002054614973565b6125ff846080516149a5565b5261260c836080516149a5565b5081600052808952604060002060405190818b82549182815201916000528b600020906000905b8d81831061272057505050508161264b91038261462e565b612657846080516149a5565b52612664836080516149a5565b50816000528852612679604060002054614973565b612683838d6149a5565b5261268e828c6149a5565b506000835b6126aa575b5050019091509795979493929461249d565b6126ba83608095939495516149a5565b51518110156127175781908360005260178a5260406000206001600160a01b036126f0836126ea896080516149a5565b516149a5565b51166000528a528c61270c826126ea88604060002054946149a5565b520181939291612693565b81939250612698565b83546001600160a01b031685528b99940193928301929190910190612633565b634e487b7160e01b600052601160045260246000fd5b346103b75760003660031901126103b75760206001600160a01b0360005460101c16604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360095416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360245416604051908152f35b346103b75760603660031901126103b75767ffffffffffffffff6004356024358281116103b7576128039036906004016142ff565b90926044359081116103b75761281d9036906004016142ff565b9290916001600160a01b0394856005541691604051968793630a441f7b60e01b855284600460209a8b935afa93841561049c576000946129f0575b5062093a80938481018091116127405761287390421061489b565b60005460405163430c208160e01b81523360048201526024810187905260109190911c91909116908881604481855afa90811561049c576000916129bb575b508015612946575b6128c491506148f4565b8581036103b757824204838102938185041490151715612740576128f79284600052601a88526040600020553691614668565b9161290184614650565b9361290f604051958661462e565b8085528585019060051b8201913683116103b757905b828210612937576105358686866150b3565b81358152908601908601612925565b50604051633d21fc9b60e21b815233600482015260248101869052908890829060449082905afa801561049c57600090612985575b6128c491506128ba565b508781813d83116129b4575b61299b818361462e565b810103126103b7576129af6128c4916148e7565b61297b565b503d612991565b90508881813d83116129e9575b6129d2818361462e565b810103126103b7576129e3906148e7565b896128b2565b503d6129c8565b9093508781813d8311612a18575b612a08818361462e565b810103126103b757519288612858565b503d6129fe565b346103b75760203660031901126103b75760043560005260196020526020604060002054604051908152f35b346103b75760203660031901126103b75760206001600160a01b0380612a6f614330565b166000526025825260406000205416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360075416604051908152f35b346103b75760203660031901126103b757610535611135614330565b6143ca565b346103b75760403660031901126103b757600435612aea614346565b90336000526020601b815260ff604060002054168015612c08575b156103b75733600052601d815260ff604060002054168015612bdf575b156103b75781612b64575b7f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd906040519283526001600160a01b0333941692a3005b6001600160a01b0360005460101c1690813b156103b7576000809260246040518095819363fbd3a29d60e01b83528860048401525af191821561049c577f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd92612bd0575b509050612b2d565b612bd9906145fe565b84612bc8565b50601381526001600160a01b0360406000205416600052601b815260ff60406000205416612b22565b50601381526001600160a01b0360406000205416600052601b815260ff60406000205416612b05565b346103b75760003660031901126103b75760206001600160a01b0360035416604051908152f35b346103b75760203660031901126103b757612c71614330565b6001601054036103b757612c89906002601055614a2c565b6001601055005b346103b75760003660031901126103b757600d5460005b818110612cb057005b80612cbf6121c96001936145af565b01612ca7565b346103b75760003660031901126103b75760206040516127108152f35b346103b75760403660031901126103b757612cfb614330565b612d03614346565b6001600160a01b03809281600b541633148015612d59575b612d2490614810565b1691823b156103b7576024600092836040519586948593639dfb338160e01b85521660048401525af1801561049c5761052c57005b5060065482163314612d1b565b346103b75760003660031901126103b75760206001600160a01b0360025416604051908152f35b346103b75760203660031901126103b75760206001600160a01b0380612db1614330565b166000526015825260406000205416604051908152f35b346103b75760403660031901126103b757610535600435612e28612dea6143bb565b612e096001600160a01b0380600b54163314908115612e2d5750614810565b82600052602360205260406000209060ff801983541691151516179055565b614eac565b9050600654163314866109da565b346103b75760003660031901126103b75760206001600160a01b03600b5416604051908152f35b346103b75760403660031901126103b757600435612e7e614346565b9033600052601b60205260ff604060002054168015612f30575b156103b75780612edb575b6040519081527fae268d9aab12f3605f58efd74fd3801fa812b03fdb44317eb70f46dff0e19e2260206001600160a01b0333941692a3005b6001600160a01b0360005460101c16803b156103b75760008091602460405180948193634c35bec560e11b83528760048401525af1801561049c57612f21575b50612ea3565b612f2a906145fe565b82612f1b565b5060136020526001600160a01b0360406000205416600052601b60205260ff60406000205416612e98565b346103b7576101603660031901126103b757612f75614330565b612f7d614346565b906044356001600160a01b03811681036103b7576064356001600160a01b03811681036103b7576084356001600160a01b03811681036103b75760a435906001600160a01b03821682036103b75760c43567ffffffffffffffff81116103b757612feb9036906004016142ff565b909160e435936001600160a01b03851685036103b75761010435956001600160a01b03871687036103b75761012435976001600160a01b03891689036103b75761014435996001600160a01b038b168b036103b757600054908160081c60ff16159081809e8f946001600160a01b03956020958794613406575b80156133ef575b613075906146e2565b60ff1982166001176000556133dd575b506000547fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff00008560101b16911617600055166001600160a01b0319600154161760015560046040518094819363210ca05d60e01b8352165afa90811561049c57600091613386575b50926001600160a01b0380959381809481602098166001600160a01b03196002541617600255166001600160a01b03196003541617600355166001600160a01b031960045416176004558183166001600160a01b031960055416176005558181166001600160a01b03196006541617600655166001600160a01b031960075416176007556004604051809481936334cc866d60e21b8352165afa801561049c57600090613346575b6001600160a01b039150166001600160a01b0319600e541617600e5560005b81811061332c575050506001600160a01b039291838092166001600160a01b03196008541617600855166001600160a01b03196009541617600955166001600160a01b0319600a541617600a556001600160a01b0381166001600160a01b0319600c541617600c5560007fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d6040611388806012558151908482526020820152a260206001600160a01b0360448160025416936000604051958694859363095ea7b360e01b8552166004840152811960248401525af1801561049c576132f3575b50600160105560016011556132bb57005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b6020813d602011613324575b8161330c6020938361462e565b810103126103b75761331d906148e7565b50816132aa565b3d91506132ff565b8061334061223161042860019486886146be565b016131ca565b506020813d60201161337e575b816133606020938361462e565b810103126103b7576133796001600160a01b03916149b9565b6131ab565b3d9150613353565b9194929390506020823d6020116133d5575b816133a56020938361462e565b810103126103b7576001600160a01b03602094818097816133c681976149b9565b95985050945050939550613103565b3d9150613398565b61ffff19166101011760005538613085565b50303b15801561306c575060ff821660011461306c565b50600160ff831610613065565b346103b75760203660031901126103b7576001600160a01b03613434614330565b16600052601f6020526020604060002054604051908152f35b346103b75760603660031901126103b757613466614330565b61346e614346565b604490813562ffffff81168091036103b7576001600160a01b038060085416948160405191630b4c774160e11b8352169384600483015282602491169384828401528683015260209660649488848781855afa93841561049c57600094613a78575b50848416968715613a3657604051633850c7bd60e01b815260e0816004818c5afa90811561049c576000916139ad575b501561396b578760005260138a52856040600020541661392957908992918660065416330361384b575b50506040516331056e5760e21b81529550859060049082905afa93841561049c57600094613814575b5086838281600454169660006040519889948593630317318f60e11b85521660048401525af193841561049c576000946137db575b5060009087846009541682604051809581936352fa180f60e11b83528b60048401525af191821561049c576000926137a4575b5083600254166040519063095ea7b360e01b98898352868516998a60048501528b8483816000801997888b8401525af192831561049c578c948c94613768575b5060009089600c5416906040519788968795865260048601528401525af1801561049c5761372a575b506136a4906136a993876000526015895260406000206001600160a01b031991871682825416179055866000526013895260406000208882825416179055876000526014895286604060002091825416179055601b8852604060002060ff1990600182825416179055601d8952600160406000209182541617905561543f565b6149dc565b813b156103b757604051637b7d549d60e01b815260008160048183875af1801561049c5784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d926119ae9261371b575b50604080513381526001600160a01b03909216602083015290918291820190565b613724906145fe565b876136fa565b908782813d8311613761575b613740818361462e565b810103126103b7576136a9936137586136a4936148e7565b50935090613624565b503d613736565b8581969295503d831161379d575b613780818361462e565b810103126103b75760008b936137968e966148e7565b50906135fb565b503d613776565b9091508781813d83116137d4575b6137bc818361462e565b810103126103b7576137cd906149b9565b90886135bb565b503d6137b2565b9093508681813d831161380d575b6137f3818361462e565b810103126103b7576138066000916149b9565b9390613588565b503d6137e9565b9093508681813d8311613844575b61382c818361462e565b810103126103b75761383d906149b9565b9287613553565b503d613822565b80919294959697935060005260228a5260ff604060002054161580613915575b156138d357600052601c895260ff6040600020541690816138bf575b5015613899578493929181899261352a565b60405162461bcd60e51b815260048101899052600381850152620855d360ea1b81890152fd5b905060005260ff6040600020541689613887565b60405162461bcd60e51b8152600481018b90526009818701527f464f5242494444454e0000000000000000000000000000000000000000000000818b01528390fd5b508160005260ff604060002054161561386b565b60405162461bcd60e51b8152600481018b90526006818601527f4558495354530000000000000000000000000000000000000000000000000000818b01528790fd5b60405162461bcd60e51b8152600481018b90526013818601527f556e696e697469616c697a656420706f6f6c2100000000000000000000000000818b01528790fd5b905060e0813d60e011613a2e575b816139c860e0938361462e565b810103126103b7578051878116036103b7578a8101518060020b036103b7576139f3604082016149cd565b50613a00606082016149cd565b50613a0d608082016149cd565b5060a081015160ff8116036103b75760c0613a2891016148e7565b8b613500565b3d91506139bb565b60405162461bcd60e51b8152600481018b90526007818601527f4e4f20504f4f4c00000000000000000000000000000000000000000000000000818b01528790fd5b9093508881813d8311613aa8575b613a90818361462e565b810103126103b757613aa1906149b9565b92896134d0565b503d613a86565b346103b75760203660031901126103b757600435600f54613acc57005b6001600160a01b038060025416803b156103b75760405160208101916323b872dd60e01b83523360248301523060448301528460648301526064825260a082019282841067ffffffffffffffff851117611d2a576000809493819460405251925af1613b36614e20565b81613bb6575b50156103b757670de0b6b3a764000080830290838204148315171561274057600f54613b6791614940565b80613ba1575b5060025416906040519081527ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082660203392a3005b613bad9060115461488e565b60115582613b6d565b8051801592508215613bcb575b505083613b3c565b81925090602091810103126103b7576020613be691016148e7565b8380613bc3565b346103b75760203660031901126103b7576001600160a01b03613c0e614330565b16600052601c602052602060ff604060002054166040519015158152f35b346103b7576020806003193601126103b7576004359081600052601881526040600020604051808284829454938481520190600052846000209260005b86828210613ce357505050613c809250038261462e565b805192613c8c84614973565b9260005b858110613ca357505061053593506150b3565b600190836000526017835260406000206001600160a01b03613cc583886149a5565b51166000528352604060002054613cdc82886149a5565b5201613c90565b85546001600160a01b0316845260019586019587955093019201613c69565b346103b7576020806003193601126103b7576004359060046001600160a01b039180836005541660405193848092630a441f7b60e01b82525afa91821561049c57600092613ec4575b5062093a809182810180911161274057613d6690421061489b565b60005460405163430c208160e01b81523360048201526024810186905260109190911c8416908281604481855afa90811561049c57600091613e8f575b508015613e1a575b613db591506148f4565b81420482810292818404149015171561274057601a908460005252604060002055613ddf82614eac565b60005460101c1690813b156103b75760009160248392604051948593849263c1f0fb9f60e01b845260048401525af1801561049c5761052c57005b50604051633d21fc9b60e21b815233600482015260248101869052908290829060449082905afa801561049c57600090613e59575b613db59150613dab565b508181813d8311613e88575b613e6f818361462e565b810103126103b757613e83613db5916148e7565b613e4f565b503d613e65565b90508281813d8311613ebd575b613ea6818361462e565b810103126103b757613eb7906148e7565b86613da3565b503d613e9c565b9080925081813d8311613eec575b613edc818361462e565b810103126103b757519084613d4b565b503d613ed2565b346103b757613f0136614370565b916001600160a01b039391939283600b541633148015614016575b613f2590614810565b808203613fd15760005b828110613f3857005b80613f4660019284896146be565b35613f55612710821115614842565b86613f6461042884888a6146be565b166000527fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60406020601381528982600020541693613fa285614754565b918560005280805281846000205560218152836000208860ff198254161790558351928352820152a201613f2f565b60405162461bcd60e51b815260206004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152606490fd5b5060065484163314613f1c565b346103b75761403136614370565b91909260005b82811061404057005b6001600160a01b036140566104288386866146be565b1690614063818688614785565b90833b156103b75761409d93600092836040518097819582946331279d3d60e01b84523360048501526040602485015260448401916147ca565b03925af191821561049c576001926140b7575b5001614037565b6140c0906145fe565b866140b0565b346103b75760003660031901126103b7576020600d54604051908152f35b346103b75760203660031901126103b7576001600160a01b03614105614330565b16600052601d602052602060ff604060002054166040519015158152f35b346103b75760203660031901126103b7576020614146614141614330565b614754565b604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360065416604051908152f35b346103b75760003660031901126103b75760206001600160a01b03600c5416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360055416604051908152f35b346103b75760203660031901126103b75760206001600160a01b03806141e7614330565b166000526014825260406000205416604051908152f35b346103b75760203660031901126103b7576002614219614330565b6001600160a01b036000549160ff8360081c161580614284575b61423c906146e2565b166001600160a01b0319602454161760245561ffff1916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160028152a1005b5060ff83168411614233565b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b7576142c19036906004016142ff565b9060005b8281106142ce57005b6142dc6104288285856146be565b9060016010818154036103b7576142f860019460028355614a2c565b55016142c5565b9181601f840112156103b75782359167ffffffffffffffff83116103b7576020808501948460051b0101116103b757565b600435906001600160a01b03821682036103b757565b602435906001600160a01b03821682036103b757565b35906001600160a01b03821682036103b757565b60406003198201126103b75767ffffffffffffffff916004358381116103b7578261439d916004016142ff565b939093926024359182116103b7576143b7916004016142ff565b9091565b6024359081151582036103b757565b346103b75760603660031901126103b75767ffffffffffffffff600480358281116103b7576143fd9036906004016142ff565b90926024906024359081116103b75761441a9036906004016142ff565b9290916044926044356001600160a01b0396600098899589875460101c16986040996020604051809263430c208160e01b825281806144738b3360048401602090939291936001600160a01b0360408201951681520152565b03915afa908115614564578991614526575b501561452257875b828110614498578880f35b8b6144a76104288386886146be565b166144b382848a614785565b90823b1561451e578d92898d8f6144ea8f9583978e938a519a8b998a9889976353c2957d60e11b89528801528601528401916147ca565b03925af18015614514579060019291614505575b500161448d565b61450e906145fe565b386144fe565b8c513d8c823e3d90fd5b8b80fd5b8780fd5b90506020813d60201161455c575b816145416020938361462e565b8101031261455857614552906148e7565b38614485565b8880fd5b3d9150614534565b6040513d8b823e3d90fd5b60409060031901126103b7576004359060243590565b60609060031901126103b757600435906024356001600160a01b03811681036103b7579060443590565b600d54811015611ccd57600d6000527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50190600090565b8054821015611ccd5760005260206000200190600090565b67ffffffffffffffff8111611d2a57604052565b6040810190811067ffffffffffffffff821117611d2a57604052565b90601f8019910116810190811067ffffffffffffffff821117611d2a57604052565b67ffffffffffffffff8111611d2a5760051b60200190565b929161467382614650565b91614681604051938461462e565b829481845260208094019160051b81019283116103b757905b8282106146a75750505050565b8380916146b38461435c565b81520191019061469a565b9190811015611ccd5760051b0190565b356001600160a01b03811681036103b75790565b156146e957565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b6001600160a01b0316600052602160205260ff604060002054166147785760125490565b6020805260406000205490565b9190811015611ccd5760051b81013590601e19813603018212156103b757019081359167ffffffffffffffff83116103b7576020018260051b360381136103b7579190565b91908082526020809201929160005b8281106147e7575050505090565b9091929382806001926001600160a01b036148018961435c565b168152019501939291016147d9565b1561481757565b606460405162461bcd60e51b8152602060048201526004602482015263082aaa8960e31b6044820152fd5b1561484957565b60405162461bcd60e51b815260206004820152600560248201527f3e313030250000000000000000000000000000000000000000000000000000006044820152606490fd5b9190820180921161274057565b156148a257565b60405162461bcd60e51b815260206004820152600660248201527f2145504f434800000000000000000000000000000000000000000000000000006044820152606490fd5b519081151582036103b757565b156148fb57565b60405162461bcd60e51b815260206004820152600960248201527f21617070726f76656400000000000000000000000000000000000000000000006044820152606490fd5b811561494a570490565b634e487b7160e01b600052601260045260246000fd5b8181029291811591840414171561274057565b9061497d82614650565b61498a604051918261462e565b828152809261499b601f1991614650565b0190602036910137565b8051821015611ccd5760209160051b010190565b51906001600160a01b03821682036103b757565b519061ffff821682036103b757565b600d5468010000000000000000811015611d2a57806001614a009201600d556145af565b6001600160a01b039291928084549260031b9316831b921b1916179055565b9190820391821161274057565b6005546000906001600160a01b03806040938451809463541b13ef60e11b8252602095869181856004988993165af18015614bdf57908591614d8e575b5050614a748661543f565b81861695868252601d855260ff8683205416614a94575b50505050505050565b601f855285822054938415614d8457614ac8612710614ac0614aba87600c541695614754565b88614960565b048096614a1f565b9360019085151580614cf9575b8715159283614c76575b614aed575b50505050614a8b565b8a8652601f8952858a812055614c0b575b50614b4b575b5050507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b179291614b339161488e565b92519283523392a33880808080808080808080614ae4565b813b15614be95786516304ba099d60e21b8152818101869052838160248183875af18015614c0157908491614bed575b5050873b15614be957865163b66503cf60e01b81526001600160a01b03909216908201908152602081018590528290829081906040010381838b5af18015614bdf57614bc8575b80614b04565b614bd282916145fe565b614bdc5780614bc2565b80fd5b86513d84823e3d90fd5b8280fd5b614bf6906145fe565b614be9578238614b7b565b88513d86823e3d90fd5b60025416893b15614c7257885163b66503cf60e01b81526001600160a01b0391909116838201908152602081018790528590829081900360400181838e5af18015614c685715614afe57614c61909491946145fe565b9238614afe565b89513d87823e3d90fd5b8480fd5b62093a808904158015614c90575b15614adf575085614adf565b5060248a8d8d5192838092634cde602960e11b82528b8b8301525afa908115614cef578891614cc2575b508910614c84565b90508a81813d8311614ce8575b614cd9818361462e565b81010312614522575138614cba565b503d614ccf565b8c513d8a823e3d90fd5b62093a808704158015614d14575b15614ad557859250614ad5565b506002548a51634cde602960e11b81529083168582015289816024818f5afa908115614d7a578791614d49575b508710614d07565b90508981813d8311614d73575b614d60818361462e565b81010312614d6f575138614d41565b8680fd5b503d614d56565b8b513d89823e3d90fd5b5050505050505050565b813d8311614db0575b614da1818361462e565b81010312614bdc578338614a69565b503d614d97565b60005b828110614dc657505050565b606082820152602001614dba565b15614ddb57565b60405162461bcd60e51b815260206004820152600860248201527f21434f554e43494c0000000000000000000000000000000000000000000000006044820152606490fd5b3d15614e5b573d9067ffffffffffffffff8211611d2a5760405191614e4f601f8201601f19166020018461462e565b82523d6000602084013e565b606090565b15614e6757565b60405162461bcd60e51b815260206004820152600660248201527f65786973747300000000000000000000000000000000000000000000000000006044820152606490fd5b60008181526020916018835260409081832080548491855b828110614f2257505050614eda90600f54614a1f565b600f5582526019835281818120556018835281209182549282815583614f01575b50505050565b82528120918201915b828110614f175780614efb565b818155600101614f0a565b8785614f2e83856145e6565b91906001600160a01b03928391549060031b1c16818b528960178086528c83838220915286528c82812054968715159283614f75575b505050505050505050600101614ec4565b918491899d999493601398898352614f918b868620541661543f565b88845260168352848420614fa6888254614a1f565b905583528152828220908783525220614fc0838254614a1f565b9055156150795750508a528a5280888a205416895260158a528789205416803b156145585788809160448a518094819363278afc8b60e21b83528b60048401528c60248401525af1801561506f5761504587600195947fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db948c94615060575b5061488e565b965b8151908982528c820152a19038868189818c8e82614f64565b615069906145fe565b3861503f565b88513d8b823e3d90fd5b9092507fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db93506150ad915060019594614a1f565b96615047565b909181600052602360205260ff604060002054166153ef576150d482614eac565b82516001600160a01b0360206000546024604051809481936339f890b560e21b835289600484015260101c165afa90811561049c576000916153bd575b5060009260009360009660005b85811061539e575060005b8581106151b8575050505050508261515b575b61514890600f5461488e565b600f556000526019602052604060002055565b6001600160a01b0360005460101c1690813b156103b7576000809260246040518095819363fd4a77f160e01b83528860048401525af191821561049c57615148926151a9575b50905061513c565b6151b2906145fe565b386151a1565b6001600160a01b036151ca82846149a5565b51168060005260136020526001600160a01b036040600020541680600052601b60205260ff604060002054168061538a575b61520b575b5050600101615129565b61522e8561522989615223879d9f978b9e979e6149a5565b51614960565b614940565b988a60005260176020526040600020816000526020526040600020546103b75789156103b75761525d8261543f565b8a60005260186020526040600020805468010000000000000000811015611d2a5761528d916001820181556145e6565b81549060031b906001600160a01b0384831b921b191617905580600052601660205260406000206152bf8b825461488e565b90558a600052601760205260406000209060005260205260406000206152e68a825461488e565b905560005260156020526001600160a01b036040600020541691823b156103b75760008a60448b83604051978894859363f320772360e01b8552600485015260248401525af190811561049c5761534a8a809260019661535095615060575061488e565b9b61488e565b97604051908a825260208201527fea66f58e474bc09f580000e81f31b334d171db387d0c6098ba47bd897741679b60403392a29038615201565b50601d60205260ff604060002054166151fc565b916153b66001916153af85876149a5565b519061488e565b920161511e565b90506020813d6020116153e7575b816153d86020938361462e565b810103126103b7575138615111565b3d91506153cb565b60405162461bcd60e51b815260206004820152602260248201527f5374616c65204e46542c20706c6561736520636f6e7461637420746865207465604482015261616d60f01b6064820152608490fd5b6001600160a01b03809116906000908282526014602052604082205416601e60205260408220908154918215156000146154ec57508252601660205261549a604083205491601154858552601e602052806040862055614a1f565b91821515806154e3575b6154ae5750505050565b670de0b6b3a76400006154c66154d894604094614960565b04938152601f6020522091825461488e565b905538808080614efb565b508115156154a4565b601154905550505050565b6001600160a01b03166000818152601c60205260408120805460ff8116614be95760ff1916600117905533907f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de9080a356fea164736f6c6343000816000a
Deployed Bytecode
0x60a0604052600436101561001257600080fd5b60003560e01c8062aca65e146142905780630675f276146141fe57806306d6a1b2146141c3578063075461721461419c578063088b699e146141755780630c340a241461414e5780630e4bf543146141235780631703e5f9146140e45780631f7b6d32146140c657806320b1cb6f146140235780632a3e123514613ef3578063310bd74b14613d0257806332145f9014613c2c5780633af32abf14613bed5780633c6b16ab14613aaf5780633e9529711461344d578063402914f51461341357806340829d6114612f5b578063411b1f7714612e6257806344c4378214612e3b57806347317bad14612dc857806349e4974a14612d8d5780635001f3b514612d6657806350d976fc14612ce2578063528cfa9814612cc557806353d7869314612c9057806363453ae114612c58578063666256aa14612ac957806368c3acb314612c31578063698473e314612ace57806369a9c17314612ac95780636ecbe38a14612aad5780637778960e14612a865780637868f5eb14612a4b57806379e9382414612a1f5780637ac09bf7146127ce5780637bdd4465146127a75780637bebe381146127805780638dd598fb1461275657806391f36633146124005780639647d141146123d957806396c82e57146123bb578063986e471d1461239d57806398bbc3c714612376578063992a7933146122445780639b19251a146121f65780639b6a9d72146121a15780639e37878c146121625780639e9ecc22146120de5780639f06247b14611f8f578063a4b5820614611dc1578063a5f4301e14611611578063a61c713a14611599578063a7cac8461461155f578063a86a366d14611525578063aa79979b146114e6578063ac4afa38146114a5578063b65f512614611474578063b9a09fd514611439578063c42cf535146113f5578063c45a0155146113ce578063c527ee1f14611315578063ca33c048146111b0578063d23254b414611167578063d33219b414611140578063d560b0d7146110e4578063d88b810b14611076578063dce1de4314610b2f578063de7d72e514610a79578063e586875f14610a35578063e5bc3de1146109ac578063e7264b65146108d6578063e74f6166146108af578063e81eb08614610848578063ea94ee44146107e3578063eab37eec14610588578063eddaa0e914610544578063efd9bf92146104b5578063f0b834e6146103bc5763f3594be01461038b57600080fd5b346103b75760203660031901126103b757600435600052601a6020526020604060002054604051908152f35b600080fd5b346103b7576103ca36614370565b9092916001600160a01b03918260065416926103e7843314614810565b6000925b8084106103f457005b8660005b87610404878785614785565b90508210156104a8576104288261043489898961042d610428848c61043a9a6146be565b6146ce565b1697614785565b906146be565b91803b156103b757604051632cf8b47b60e11b81526001600160a01b03938416600482015292881660248401526000908390604490829084905af191821561049c5760019261048d575b500187906103f8565b610496906145fe565b89610484565b6040513d6000823e3d90fd5b50505092600101926103eb565b346103b75760403660031901126103b7576104ce614330565b6104d6614346565b6001600160a01b03809281600b541633148015610537575b6104f790614810565b1691823b156103b75760246000928360405195869485936339ced26d60e21b85521660048401525af1801561049c5761052c57005b610535906145fe565b005b50600654821633146104ee565b346103b75760203660031901126103b75761055d614330565b6001600160a01b0390816006541633036103b757166001600160a01b0319600b541617600b55600080f35b346103b75760603660031901126103b75767ffffffffffffffff6004358181116103b7576105ba9036906004016142ff565b916024358181116103b7576105d39036906004016142ff565b9390916044359081116103b7576105ee9036906004016142ff565b90946001600160a01b03600a5416946000925b84841061060a57005b60005b61061885838b614785565b90508110156107d8576106308161043487858d614785565b6040516331a9108f60e11b8152903560048201526020816024818c5afa801561049c57600090610798575b6001600160a01b039150163314801561070b575b156103b7578061069c8a9261043488866001600160a01b03610695610428848f8d6146be565b1696614785565b356106a887878b614785565b93803b156103b7576106e29460008094604051978895869485936353c2957d60e11b855260048501526040602485015260448401916147ca565b03925af191821561049c576001926106fc575b500161060d565b610705906145fe565b8a6106f5565b5061071b8161043487858d614785565b60405163020604bf60e21b8152903560048201526020816024818c5afa801561049c57600090610758575b6001600160a01b03915016331461066f565b506020813d602011610790575b816107726020938361462e565b810103126103b75761078b6001600160a01b03916149b9565b610746565b3d9150610765565b506020813d6020116107d0575b816107b26020938361462e565b810103126103b7576107cb6001600160a01b03916149b9565b61065b565b3d91506107a5565b509260010192610601565b346103b7576107f136614585565b91909133600052601b60205260ff60406000205416156103b75760405191825260208201527ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760406001600160a01b0333941692a3005b346103b7576108563661456f565b905b81811061086157005b61086a816145af565b906001600160a01b03918291549060031b1c16600052601360205260406000205416906001916010838154036103b7576108a8849260028355614a2c565b5501610858565b346103b75760003660031901126103b75760206001600160a01b0360085416604051908152f35b346103b7576020806003193601126103b75760043567ffffffffffffffff81116103b7576109089036906004016142ff565b916001600160a01b039182600b54163314801561099f575b61092990614810565b6012549360005b81811061093957005b8061094a61042860019385876146be565b7fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60408861097784614754565b93169283600052602189528160002060ff19815416905581519081528a89820152a201610930565b5060065483163314610920565b346103b75760203660031901126103b7576004356109e06001600160a01b0380600b54163314908115610a27575b50614810565b6109ee612710821115614842565b60007fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60406012548151908152846020820152a2601255005b9050600654163314836109da565b346103b75760203660031901126103b757610a4e614330565b600754906001600160a01b0380831633036103b7576001600160a01b03199116911617600755600080f35b346103b75760403660031901126103b757610a92614330565b610a9a6143bb565b906001600160a01b039081600b541633148015610b22575b610abb90614810565b1690816000526022602052604060002060ff815416918015158093151503610adf57005b610af4919060ff801983541691151516179055565b6040519081527fc226090c79560682a4254f61540d22465b1f23522ee477acb0a520160d3c3e0460203392a3005b5060065482163314610ab2565b346103b75760603660031901126103b757610b48614330565b610b50614346565b9060443567ffffffffffffffff81116103b757610b719036906004016142ff565b6001600160a01b036006939293541633036110315760049260206001600160a01b0360085416604051958680926331056e5760e21b82525afa93841561049c57600094610ff5575b5060206001600160a01b03602481600454169660006040519889948593630317318f60e11b85521660048401525af191821561049c57600092610fb9575b6000945060206001600160a01b03602454166024604051809881936301126ca960e21b83526001600160a01b038a1660048401525af194851561049c57600095610f7d575b5060005b818110610f10575050506001600160a01b036002541660405163095ea7b360e01b81526001600160a01b038516600482015260208160448160008019968760248401525af1801561049c57610ed1575b50602060009160446001600160a01b03600c541691604051948593849263095ea7b360e01b84526001600160a01b038b16600485015260248401525af1801561049c57610e98575b506001600160a01b03831660005260156020526001600160a01b036040600020946001600160a01b0319958284168782541617905581841660005260136020526040600020828616878254161790558185166000526014602052604060002082851687825416179055601b602052604060002060ff1990600182825416179055601d6020526001604060002091825416179055610d748561543f565b610d7d846149dc565b169081610ddf575b604080513381526001600160a01b03928316602080830191909152965093821693918516917f89db950816d6b0f68e51bad00bf438fa35268fcbe53cc183011d7c9b9baaa2a79190a46001600160a01b0360405191168152f35b8160005260136020526001600160a01b0360406000205416600052601d60205260ff60406000205416610e53576020948260005260258652610e2f6001600160a01b036040600020541615614e60565b82600052602586526040600020906001600160a01b03861690825416179055610d85565b60405162461bcd60e51b815260206004820152600c60248201527f41637469766520676175676500000000000000000000000000000000000000006044820152606490fd5b6020813d602011610ec9575b81610eb16020938361462e565b810103126103b757610ec2906148e7565b5084610cd8565b3d9150610ea4565b6020813d602011610f08575b81610eea6020938361462e565b810103126103b757600091610f006020926148e7565b509150610c90565b3d9150610edd565b6001600160a01b03861690610f296104288285876146be565b823b156103b7576001600160a01b03602460009283604051968794859363db89461b60e01b85521660048401525af191821561049c57600192610f6e575b5001610c40565b610f77906145fe565b88610f67565b9094506020813d602011610fb1575b81610f996020938361462e565b810103126103b757610faa906149b9565b9386610c3c565b3d9150610f8c565b91506020843d602011610fed575b81610fd46020938361462e565b810103126103b757610fe76000946149b9565b91610bf7565b3d9150610fc7565b9093506020813d602011611029575b816110116020938361462e565b810103126103b757611022906149b9565b9285610bb9565b3d9150611004565b60405162461bcd60e51b815260206004820152600560248201527f21415554480000000000000000000000000000000000000000000000000000006044820152606490fd5b346103b75760003660031901126103b757600d5460005b81811061109657005b61109f816145af565b906001600160a01b03918291549060031b1c16600052601360205260406000205416906001916010838154036103b7576110dd849260028355614a2c565b550161108d565b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b7576111159036906004016142ff565b60005b81811061112157005b8061113a61113561042860019486886146be565b61543f565b01611118565b346103b75760003660031901126103b75760206001600160a01b03600e5416604051908152f35b346103b75760403660031901126103b757611180614346565b60043560005260176020526001600160a01b03604060002091166000526020526020604060002054604051908152f35b346103b7576020806003193601126103b7576111ca614330565b906001600160a01b0391826006541633036112ea5760009082846005541660046040518095819363541b13ef60e11b83525af1801561049c57849284916112bb575b50506112178161543f565b16600052601d815260ff604060002054161561122f57005b601f81526040600020916000835493558261124657005b60025460065460405163a9059cbb60e01b81529083166001600160a01b0316600482015260248101949094528291849116816000816044810103925af1801561049c5761128f57005b81813d83116112b4575b6112a3818361462e565b810103126103b757610535906148e7565b503d611299565b90809293503d83116112e3575b6112d2818361462e565b810103126103b7578290828561120c565b503d6112c8565b60405162461bcd60e51b8152600480820184905260248201526310a3a7ab60e11b6044820152606490fd5b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b757366023820112156103b757611357903690602481600401359101614668565b60005b815181101561053557600060406001600160a01b0361137984866149a5565b5116600482518094819363d294f09360e01b83525af1801561049c576113a3575b5060010161135a565b604090813d83116113c7575b6113b9818361462e565b810103126103b7578261139a565b503d6113af565b346103b75760003660031901126103b75760206001600160a01b0360015416604051908152f35b346103b75760203660031901126103b75761140e614330565b600654906001600160a01b0380831633036103b7576001600160a01b03199116911617600655600080f35b346103b75760203660031901126103b75760206001600160a01b038061145d614330565b166000526013825260406000205416604051908152f35b346103b75760203660031901126103b7576004356000526023602052602060ff604060002054166040519015158152f35b346103b75760203660031901126103b757600435600d548110156103b7576001600160a01b036114d66020926145af565b9190546040519260031b1c168152f35b346103b75760203660031901126103b7576001600160a01b03611507614330565b16600052601b602052602060ff604060002054166040519015158152f35b346103b7576115333661456f565b90600052601860205260406000209081548110156103b7576114d66001600160a01b03916020936145e6565b346103b75760203660031901126103b7576001600160a01b03611580614330565b1660005260166020526020604060002054604051908152f35b346103b7576115a736614585565b91909133600052601b60205260ff60406000205416156103b757601d60205260ff60406000205416156103b75760405191825260208201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760406001600160a01b0333941692a3005b346103b75760203660031901126103b757602461162c614330565b6001600160a01b03811660005260136020526116566001600160a01b036040600020541615614e60565b60206001600160a01b03600154166040519384809263e5e31b1360e01b82526001600160a01b03861660048301525afa91821561049c57600092611d85575b508115611d4057604051916000806060850167ffffffffffffffff811186821017611d2a576040526002855260208501926040368537611c64575b6001600160a01b03600654163303611b54575b5050604051634d78e9ad60e11b8152906020826004816001600160a01b0387165afa801561049c57600090611b1a575b6000925060206001600160a01b0360248160045416936040519687938492630317318f60e11b845216958660048401525af192831561049c57600093611ade575b50803b156103b7576000809160246040518094819363189acdbd60e31b83526001600160a01b03891660048401525af1801561049c57611acf575b506001600160a01b0383163b156103b757604051635b8d276760e11b815260016004820152600081602481836001600160a01b0389165af1801561049c57611ac0575b5060035460008054604051630f6f2d4760e11b81526001600160a01b038781166004830152868116602483015260109290921c821660448201526001606482015260a06084820152965160a48801819052921692869260c48401925b818110611a9e57505050918160008160209503925af192831561049c57600093611a62575b506001600160a01b03600254169160405163095ea7b360e01b908181526001600160a01b0386169485600483015260208260448160008019958660248401525af1801561049c57611a28575b6020915060446001600160a01b03600c5416936000604051958694859384528a600485015260248401525af1801561049c576119b9575b507f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d6001600160a01b038492611985602097856000526015895260406000206001600160a01b0319908589168282541617905584841660005260138a52604060002087828254161790558660005260148a5260406000209085851690825416179055601b8952604060002060ff1990600182825416179055601d8a52600160406000209182541617905561543f565b61198e816149dc565b604080513381526001600160a01b03909616602087015291169390819081015b0390a3604051908152f35b6020813d602011611a20575b816119d26020938361462e565b810103126103b7576001600160a01b038492611985602097611a147f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d956148e7565b509750509250506118d6565b3d91506119c5565b6020823d602011611a5a575b81611a416020938361462e565b810103126103b757611a546020926148e7565b5061189f565b3d9150611a34565b9092506020813d602011611a96575b81611a7e6020938361462e565b810103126103b757611a8f906149b9565b9183611853565b3d9150611a71565b82516001600160a01b031684528894506020938401939092019160010161182e565b611ac9906145fe565b846117d2565b611ad8906145fe565b8461178f565b9092506020813d602011611b12575b81611afa6020938361462e565b810103126103b757611b0b906149b9565b9185611754565b3d9150611aed565b506020823d602011611b4c575b81611b346020938361462e565b810103126103b757611b476000926149b9565b611713565b3d9150611b27565b6001600160a01b031680600052602260205260ff604060002054161580611c47575b15611c0257600052601c60205260ff604060002054169081611be5575b5015611ba05783806116e3565b60405162461bcd60e51b815260206004820152600c60248201527f2177686974656c697374656400000000000000000000000000000000000000006044820152606490fd5b6001600160a01b0391501660005260ff6040600020541684611b93565b60405162461bcd60e51b815260206004820152600960248201527f466f7262696464656e00000000000000000000000000000000000000000000006044820152606490fd5b506001600160a01b03821660005260ff6040600020541615611b76565b505060408051634eb1c24560e11b815290816004816001600160a01b0387165afa801561049c57600091600091611ce3575b50906001600160a01b0360025416855115611ccd5783526001600160a01b03600c5416855160011015611ccd5760408601526116d0565b634e487b7160e01b600052603260045260246000fd5b9150506040813d604011611d22575b81611cff6040938361462e565b810103126103b757611d1c6020611d15836149b9565b92016149b9565b85611c96565b3d9150611cf2565b634e487b7160e01b600052604160045260246000fd5b60405162461bcd60e51b815260206004820152600660248201527f215f706f6f6c00000000000000000000000000000000000000000000000000006044820152606490fd5b9091506020813d602011611db9575b81611da16020938361462e565b810103126103b757611db2906148e7565b9082611695565b3d9150611d94565b346103b7576020806003193601126103b75760043567ffffffffffffffff81116103b757611df39036906004016142ff565b90916001600160a01b0380600b541633148015611f82575b611e1490614810565b600082826005541660046040518094819363541b13ef60e11b83525af190811561049c578391611f59575b505060005b838110611e4d57005b611e5e6111356104288387896146be565b81611e6d6104288387896146be565b16600052601d835260ff6040600020541615611e8c575b600101611e44565b81611e9b6104288387896146be565b16600052601f908184526040600020549183611ebb61042884898b6146be565b166000528452600060408120558382611ed7575b509050611e84565b60025460065460405163a9059cbb60e01b81529086166001600160a01b03166004820152602481019490945283908516816000816044810103925af1801561049c57611f24575b83611ecf565b8382813d8311611f52575b611f39818361462e565b810103126103b757611f4c6001926148e7565b50611f1e565b503d611f2f565b813d8311611f7b575b611f6c818361462e565b810103126103b7578185611e3f565b503d611f62565b5060065481163314611e0b565b346103b7576020806003193601126103b757611fa9614330565b906001600160a01b038092611fc382600754163314614dd4565b169182600052601d825260ff604060002054166120995760008091848252601d845260408220600160ff19825416179055601484526040822054169260405190810190636373ea6960e01b82526004815261201d81614612565b5190845afa61202a614e20565b50612058575b507fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa600080a2005b803b156103b75760008091602460405180948193635b8d276760e11b8352600160048401525af1801561049c571561203057612093906145fe565b81612030565b60405162461bcd60e51b815260048101839052600560248201527f414c4956450000000000000000000000000000000000000000000000000000006044820152606490fd5b346103b75760403660031901126103b7576120f7614330565b6120ff614346565b6001600160a01b03809281600b541633148015612155575b61212090614810565b1691823b156103b75760246000928360405195869485936316d2246760e31b85521660048401525af1801561049c5761052c57005b5060065482163314612117565b346103b75760203660031901126103b7576001600160a01b03612183614330565b166000526022602052602060ff604060002054166040519015158152f35b346103b7576121af3661456f565b905b8181106121ba57005b806121f06121c96001936145af565b906001600160a01b03918291549060031b1c1660005260136020526040600020541661543f565b016121b1565b346103b75760203660031901126103b757610535612212614330565b6122316001600160a01b0380600b541633149081156122365750614810565b6154f7565b9050600654163314846109da565b346103b7576020806003193601126103b75761225e614330565b906001600160a01b03809261227882600754163314614dd4565b169182600052601d825260ff604060002054161561234b5760008091848252601d84526040822060ff198154169055601484526040822054169260405190810190636373ea6960e01b8252600481526122d081614612565b5190845afa6122dd614e20565b5061230b575b507f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7600080a2005b803b156103b75760008091602460405180948193635b8d276760e11b83528160048401525af1801561049c57156122e357612345906145fe565b816122e3565b60405162461bcd60e51b815260048082018490526024820152631111505160e21b6044820152606490fd5b346103b75760003660031901126103b75760206001600160a01b03600a5416604051908152f35b346103b75760003660031901126103b7576020601254604051908152f35b346103b75760003660031901126103b7576020600f54604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360045416604051908152f35b346103b75761241a6124113661456f565b90809291614a1f565b600191828201809211612740579161244261243483614650565b60405160805260805161462e565b816080515261245082614650565b6020806080510190612467601f1980940183614db7565b61247085614650565b9461247e604051968761462e565b80865261248a81614650565b9661249a85848901990189614db7565b60005b8281106125c85750505060405194604086016040875260805151809152606087019060608160051b89010194916000905b82821061255f5750505050858303828701525191828152818101828460051b83010197946000925b85841061250357888a0389f35b90919293949596898383839c030185528689518180825194858152019101926000905b85818310612548575050508192509901940194019295949391909896986124f6565b919380919386518152019401920189929391612526565b90919296949597809a98605f198b82030183528789518180825194858152019101926000905b858183106125a857505050819250990192019201909291999799969594966124ce565b91938091936001600160a01b03875116815201940192018a929391612585565b9086826125dc829b9994849997989961488e565b8060005260188089526125f3604060002054614973565b6125ff846080516149a5565b5261260c836080516149a5565b5081600052808952604060002060405190818b82549182815201916000528b600020906000905b8d81831061272057505050508161264b91038261462e565b612657846080516149a5565b52612664836080516149a5565b50816000528852612679604060002054614973565b612683838d6149a5565b5261268e828c6149a5565b506000835b6126aa575b5050019091509795979493929461249d565b6126ba83608095939495516149a5565b51518110156127175781908360005260178a5260406000206001600160a01b036126f0836126ea896080516149a5565b516149a5565b51166000528a528c61270c826126ea88604060002054946149a5565b520181939291612693565b81939250612698565b83546001600160a01b031685528b99940193928301929190910190612633565b634e487b7160e01b600052601160045260246000fd5b346103b75760003660031901126103b75760206001600160a01b0360005460101c16604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360095416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360245416604051908152f35b346103b75760603660031901126103b75767ffffffffffffffff6004356024358281116103b7576128039036906004016142ff565b90926044359081116103b75761281d9036906004016142ff565b9290916001600160a01b0394856005541691604051968793630a441f7b60e01b855284600460209a8b935afa93841561049c576000946129f0575b5062093a80938481018091116127405761287390421061489b565b60005460405163430c208160e01b81523360048201526024810187905260109190911c91909116908881604481855afa90811561049c576000916129bb575b508015612946575b6128c491506148f4565b8581036103b757824204838102938185041490151715612740576128f79284600052601a88526040600020553691614668565b9161290184614650565b9361290f604051958661462e565b8085528585019060051b8201913683116103b757905b828210612937576105358686866150b3565b81358152908601908601612925565b50604051633d21fc9b60e21b815233600482015260248101869052908890829060449082905afa801561049c57600090612985575b6128c491506128ba565b508781813d83116129b4575b61299b818361462e565b810103126103b7576129af6128c4916148e7565b61297b565b503d612991565b90508881813d83116129e9575b6129d2818361462e565b810103126103b7576129e3906148e7565b896128b2565b503d6129c8565b9093508781813d8311612a18575b612a08818361462e565b810103126103b757519288612858565b503d6129fe565b346103b75760203660031901126103b75760043560005260196020526020604060002054604051908152f35b346103b75760203660031901126103b75760206001600160a01b0380612a6f614330565b166000526025825260406000205416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360075416604051908152f35b346103b75760203660031901126103b757610535611135614330565b6143ca565b346103b75760403660031901126103b757600435612aea614346565b90336000526020601b815260ff604060002054168015612c08575b156103b75733600052601d815260ff604060002054168015612bdf575b156103b75781612b64575b7f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd906040519283526001600160a01b0333941692a3005b6001600160a01b0360005460101c1690813b156103b7576000809260246040518095819363fbd3a29d60e01b83528860048401525af191821561049c577f60940192810a6fb3bce3fd3e2e3a13fd6ccc7605e963fb87ee971aba829989bd92612bd0575b509050612b2d565b612bd9906145fe565b84612bc8565b50601381526001600160a01b0360406000205416600052601b815260ff60406000205416612b22565b50601381526001600160a01b0360406000205416600052601b815260ff60406000205416612b05565b346103b75760003660031901126103b75760206001600160a01b0360035416604051908152f35b346103b75760203660031901126103b757612c71614330565b6001601054036103b757612c89906002601055614a2c565b6001601055005b346103b75760003660031901126103b757600d5460005b818110612cb057005b80612cbf6121c96001936145af565b01612ca7565b346103b75760003660031901126103b75760206040516127108152f35b346103b75760403660031901126103b757612cfb614330565b612d03614346565b6001600160a01b03809281600b541633148015612d59575b612d2490614810565b1691823b156103b7576024600092836040519586948593639dfb338160e01b85521660048401525af1801561049c5761052c57005b5060065482163314612d1b565b346103b75760003660031901126103b75760206001600160a01b0360025416604051908152f35b346103b75760203660031901126103b75760206001600160a01b0380612db1614330565b166000526015825260406000205416604051908152f35b346103b75760403660031901126103b757610535600435612e28612dea6143bb565b612e096001600160a01b0380600b54163314908115612e2d5750614810565b82600052602360205260406000209060ff801983541691151516179055565b614eac565b9050600654163314866109da565b346103b75760003660031901126103b75760206001600160a01b03600b5416604051908152f35b346103b75760403660031901126103b757600435612e7e614346565b9033600052601b60205260ff604060002054168015612f30575b156103b75780612edb575b6040519081527fae268d9aab12f3605f58efd74fd3801fa812b03fdb44317eb70f46dff0e19e2260206001600160a01b0333941692a3005b6001600160a01b0360005460101c16803b156103b75760008091602460405180948193634c35bec560e11b83528760048401525af1801561049c57612f21575b50612ea3565b612f2a906145fe565b82612f1b565b5060136020526001600160a01b0360406000205416600052601b60205260ff60406000205416612e98565b346103b7576101603660031901126103b757612f75614330565b612f7d614346565b906044356001600160a01b03811681036103b7576064356001600160a01b03811681036103b7576084356001600160a01b03811681036103b75760a435906001600160a01b03821682036103b75760c43567ffffffffffffffff81116103b757612feb9036906004016142ff565b909160e435936001600160a01b03851685036103b75761010435956001600160a01b03871687036103b75761012435976001600160a01b03891689036103b75761014435996001600160a01b038b168b036103b757600054908160081c60ff16159081809e8f946001600160a01b03956020958794613406575b80156133ef575b613075906146e2565b60ff1982166001176000556133dd575b506000547fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff00008560101b16911617600055166001600160a01b0319600154161760015560046040518094819363210ca05d60e01b8352165afa90811561049c57600091613386575b50926001600160a01b0380959381809481602098166001600160a01b03196002541617600255166001600160a01b03196003541617600355166001600160a01b031960045416176004558183166001600160a01b031960055416176005558181166001600160a01b03196006541617600655166001600160a01b031960075416176007556004604051809481936334cc866d60e21b8352165afa801561049c57600090613346575b6001600160a01b039150166001600160a01b0319600e541617600e5560005b81811061332c575050506001600160a01b039291838092166001600160a01b03196008541617600855166001600160a01b03196009541617600955166001600160a01b0319600a541617600a556001600160a01b0381166001600160a01b0319600c541617600c5560007fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d6040611388806012558151908482526020820152a260206001600160a01b0360448160025416936000604051958694859363095ea7b360e01b8552166004840152811960248401525af1801561049c576132f3575b50600160105560016011556132bb57005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b6020813d602011613324575b8161330c6020938361462e565b810103126103b75761331d906148e7565b50816132aa565b3d91506132ff565b8061334061223161042860019486886146be565b016131ca565b506020813d60201161337e575b816133606020938361462e565b810103126103b7576133796001600160a01b03916149b9565b6131ab565b3d9150613353565b9194929390506020823d6020116133d5575b816133a56020938361462e565b810103126103b7576001600160a01b03602094818097816133c681976149b9565b95985050945050939550613103565b3d9150613398565b61ffff19166101011760005538613085565b50303b15801561306c575060ff821660011461306c565b50600160ff831610613065565b346103b75760203660031901126103b7576001600160a01b03613434614330565b16600052601f6020526020604060002054604051908152f35b346103b75760603660031901126103b757613466614330565b61346e614346565b604490813562ffffff81168091036103b7576001600160a01b038060085416948160405191630b4c774160e11b8352169384600483015282602491169384828401528683015260209660649488848781855afa93841561049c57600094613a78575b50848416968715613a3657604051633850c7bd60e01b815260e0816004818c5afa90811561049c576000916139ad575b501561396b578760005260138a52856040600020541661392957908992918660065416330361384b575b50506040516331056e5760e21b81529550859060049082905afa93841561049c57600094613814575b5086838281600454169660006040519889948593630317318f60e11b85521660048401525af193841561049c576000946137db575b5060009087846009541682604051809581936352fa180f60e11b83528b60048401525af191821561049c576000926137a4575b5083600254166040519063095ea7b360e01b98898352868516998a60048501528b8483816000801997888b8401525af192831561049c578c948c94613768575b5060009089600c5416906040519788968795865260048601528401525af1801561049c5761372a575b506136a4906136a993876000526015895260406000206001600160a01b031991871682825416179055866000526013895260406000208882825416179055876000526014895286604060002091825416179055601b8852604060002060ff1990600182825416179055601d8952600160406000209182541617905561543f565b6149dc565b813b156103b757604051637b7d549d60e01b815260008160048183875af1801561049c5784927f48d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0d926119ae9261371b575b50604080513381526001600160a01b03909216602083015290918291820190565b613724906145fe565b876136fa565b908782813d8311613761575b613740818361462e565b810103126103b7576136a9936137586136a4936148e7565b50935090613624565b503d613736565b8581969295503d831161379d575b613780818361462e565b810103126103b75760008b936137968e966148e7565b50906135fb565b503d613776565b9091508781813d83116137d4575b6137bc818361462e565b810103126103b7576137cd906149b9565b90886135bb565b503d6137b2565b9093508681813d831161380d575b6137f3818361462e565b810103126103b7576138066000916149b9565b9390613588565b503d6137e9565b9093508681813d8311613844575b61382c818361462e565b810103126103b75761383d906149b9565b9287613553565b503d613822565b80919294959697935060005260228a5260ff604060002054161580613915575b156138d357600052601c895260ff6040600020541690816138bf575b5015613899578493929181899261352a565b60405162461bcd60e51b815260048101899052600381850152620855d360ea1b81890152fd5b905060005260ff6040600020541689613887565b60405162461bcd60e51b8152600481018b90526009818701527f464f5242494444454e0000000000000000000000000000000000000000000000818b01528390fd5b508160005260ff604060002054161561386b565b60405162461bcd60e51b8152600481018b90526006818601527f4558495354530000000000000000000000000000000000000000000000000000818b01528790fd5b60405162461bcd60e51b8152600481018b90526013818601527f556e696e697469616c697a656420706f6f6c2100000000000000000000000000818b01528790fd5b905060e0813d60e011613a2e575b816139c860e0938361462e565b810103126103b7578051878116036103b7578a8101518060020b036103b7576139f3604082016149cd565b50613a00606082016149cd565b50613a0d608082016149cd565b5060a081015160ff8116036103b75760c0613a2891016148e7565b8b613500565b3d91506139bb565b60405162461bcd60e51b8152600481018b90526007818601527f4e4f20504f4f4c00000000000000000000000000000000000000000000000000818b01528790fd5b9093508881813d8311613aa8575b613a90818361462e565b810103126103b757613aa1906149b9565b92896134d0565b503d613a86565b346103b75760203660031901126103b757600435600f54613acc57005b6001600160a01b038060025416803b156103b75760405160208101916323b872dd60e01b83523360248301523060448301528460648301526064825260a082019282841067ffffffffffffffff851117611d2a576000809493819460405251925af1613b36614e20565b81613bb6575b50156103b757670de0b6b3a764000080830290838204148315171561274057600f54613b6791614940565b80613ba1575b5060025416906040519081527ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082660203392a3005b613bad9060115461488e565b60115582613b6d565b8051801592508215613bcb575b505083613b3c565b81925090602091810103126103b7576020613be691016148e7565b8380613bc3565b346103b75760203660031901126103b7576001600160a01b03613c0e614330565b16600052601c602052602060ff604060002054166040519015158152f35b346103b7576020806003193601126103b7576004359081600052601881526040600020604051808284829454938481520190600052846000209260005b86828210613ce357505050613c809250038261462e565b805192613c8c84614973565b9260005b858110613ca357505061053593506150b3565b600190836000526017835260406000206001600160a01b03613cc583886149a5565b51166000528352604060002054613cdc82886149a5565b5201613c90565b85546001600160a01b0316845260019586019587955093019201613c69565b346103b7576020806003193601126103b7576004359060046001600160a01b039180836005541660405193848092630a441f7b60e01b82525afa91821561049c57600092613ec4575b5062093a809182810180911161274057613d6690421061489b565b60005460405163430c208160e01b81523360048201526024810186905260109190911c8416908281604481855afa90811561049c57600091613e8f575b508015613e1a575b613db591506148f4565b81420482810292818404149015171561274057601a908460005252604060002055613ddf82614eac565b60005460101c1690813b156103b75760009160248392604051948593849263c1f0fb9f60e01b845260048401525af1801561049c5761052c57005b50604051633d21fc9b60e21b815233600482015260248101869052908290829060449082905afa801561049c57600090613e59575b613db59150613dab565b508181813d8311613e88575b613e6f818361462e565b810103126103b757613e83613db5916148e7565b613e4f565b503d613e65565b90508281813d8311613ebd575b613ea6818361462e565b810103126103b757613eb7906148e7565b86613da3565b503d613e9c565b9080925081813d8311613eec575b613edc818361462e565b810103126103b757519084613d4b565b503d613ed2565b346103b757613f0136614370565b916001600160a01b039391939283600b541633148015614016575b613f2590614810565b808203613fd15760005b828110613f3857005b80613f4660019284896146be565b35613f55612710821115614842565b86613f6461042884888a6146be565b166000527fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60406020601381528982600020541693613fa285614754565b918560005280805281846000205560218152836000208860ff198254161790558351928352820152a201613f2f565b60405162461bcd60e51b815260206004820152600f60248201527f6c656e677468206d69736d6174636800000000000000000000000000000000006044820152606490fd5b5060065484163314613f1c565b346103b75761403136614370565b91909260005b82811061404057005b6001600160a01b036140566104288386866146be565b1690614063818688614785565b90833b156103b75761409d93600092836040518097819582946331279d3d60e01b84523360048501526040602485015260448401916147ca565b03925af191821561049c576001926140b7575b5001614037565b6140c0906145fe565b866140b0565b346103b75760003660031901126103b7576020600d54604051908152f35b346103b75760203660031901126103b7576001600160a01b03614105614330565b16600052601d602052602060ff604060002054166040519015158152f35b346103b75760203660031901126103b7576020614146614141614330565b614754565b604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360065416604051908152f35b346103b75760003660031901126103b75760206001600160a01b03600c5416604051908152f35b346103b75760003660031901126103b75760206001600160a01b0360055416604051908152f35b346103b75760203660031901126103b75760206001600160a01b03806141e7614330565b166000526014825260406000205416604051908152f35b346103b75760203660031901126103b7576002614219614330565b6001600160a01b036000549160ff8360081c161580614284575b61423c906146e2565b166001600160a01b0319602454161760245561ffff1916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160028152a1005b5060ff83168411614233565b346103b75760203660031901126103b75760043567ffffffffffffffff81116103b7576142c19036906004016142ff565b9060005b8281106142ce57005b6142dc6104288285856146be565b9060016010818154036103b7576142f860019460028355614a2c565b55016142c5565b9181601f840112156103b75782359167ffffffffffffffff83116103b7576020808501948460051b0101116103b757565b600435906001600160a01b03821682036103b757565b602435906001600160a01b03821682036103b757565b35906001600160a01b03821682036103b757565b60406003198201126103b75767ffffffffffffffff916004358381116103b7578261439d916004016142ff565b939093926024359182116103b7576143b7916004016142ff565b9091565b6024359081151582036103b757565b346103b75760603660031901126103b75767ffffffffffffffff600480358281116103b7576143fd9036906004016142ff565b90926024906024359081116103b75761441a9036906004016142ff565b9290916044926044356001600160a01b0396600098899589875460101c16986040996020604051809263430c208160e01b825281806144738b3360048401602090939291936001600160a01b0360408201951681520152565b03915afa908115614564578991614526575b501561452257875b828110614498578880f35b8b6144a76104288386886146be565b166144b382848a614785565b90823b1561451e578d92898d8f6144ea8f9583978e938a519a8b998a9889976353c2957d60e11b89528801528601528401916147ca565b03925af18015614514579060019291614505575b500161448d565b61450e906145fe565b386144fe565b8c513d8c823e3d90fd5b8b80fd5b8780fd5b90506020813d60201161455c575b816145416020938361462e565b8101031261455857614552906148e7565b38614485565b8880fd5b3d9150614534565b6040513d8b823e3d90fd5b60409060031901126103b7576004359060243590565b60609060031901126103b757600435906024356001600160a01b03811681036103b7579060443590565b600d54811015611ccd57600d6000527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50190600090565b8054821015611ccd5760005260206000200190600090565b67ffffffffffffffff8111611d2a57604052565b6040810190811067ffffffffffffffff821117611d2a57604052565b90601f8019910116810190811067ffffffffffffffff821117611d2a57604052565b67ffffffffffffffff8111611d2a5760051b60200190565b929161467382614650565b91614681604051938461462e565b829481845260208094019160051b81019283116103b757905b8282106146a75750505050565b8380916146b38461435c565b81520191019061469a565b9190811015611ccd5760051b0190565b356001600160a01b03811681036103b75790565b156146e957565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608490fd5b6001600160a01b0316600052602160205260ff604060002054166147785760125490565b6020805260406000205490565b9190811015611ccd5760051b81013590601e19813603018212156103b757019081359167ffffffffffffffff83116103b7576020018260051b360381136103b7579190565b91908082526020809201929160005b8281106147e7575050505090565b9091929382806001926001600160a01b036148018961435c565b168152019501939291016147d9565b1561481757565b606460405162461bcd60e51b8152602060048201526004602482015263082aaa8960e31b6044820152fd5b1561484957565b60405162461bcd60e51b815260206004820152600560248201527f3e313030250000000000000000000000000000000000000000000000000000006044820152606490fd5b9190820180921161274057565b156148a257565b60405162461bcd60e51b815260206004820152600660248201527f2145504f434800000000000000000000000000000000000000000000000000006044820152606490fd5b519081151582036103b757565b156148fb57565b60405162461bcd60e51b815260206004820152600960248201527f21617070726f76656400000000000000000000000000000000000000000000006044820152606490fd5b811561494a570490565b634e487b7160e01b600052601260045260246000fd5b8181029291811591840414171561274057565b9061497d82614650565b61498a604051918261462e565b828152809261499b601f1991614650565b0190602036910137565b8051821015611ccd5760209160051b010190565b51906001600160a01b03821682036103b757565b519061ffff821682036103b757565b600d5468010000000000000000811015611d2a57806001614a009201600d556145af565b6001600160a01b039291928084549260031b9316831b921b1916179055565b9190820391821161274057565b6005546000906001600160a01b03806040938451809463541b13ef60e11b8252602095869181856004988993165af18015614bdf57908591614d8e575b5050614a748661543f565b81861695868252601d855260ff8683205416614a94575b50505050505050565b601f855285822054938415614d8457614ac8612710614ac0614aba87600c541695614754565b88614960565b048096614a1f565b9360019085151580614cf9575b8715159283614c76575b614aed575b50505050614a8b565b8a8652601f8952858a812055614c0b575b50614b4b575b5050507f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b179291614b339161488e565b92519283523392a33880808080808080808080614ae4565b813b15614be95786516304ba099d60e21b8152818101869052838160248183875af18015614c0157908491614bed575b5050873b15614be957865163b66503cf60e01b81526001600160a01b03909216908201908152602081018590528290829081906040010381838b5af18015614bdf57614bc8575b80614b04565b614bd282916145fe565b614bdc5780614bc2565b80fd5b86513d84823e3d90fd5b8280fd5b614bf6906145fe565b614be9578238614b7b565b88513d86823e3d90fd5b60025416893b15614c7257885163b66503cf60e01b81526001600160a01b0391909116838201908152602081018790528590829081900360400181838e5af18015614c685715614afe57614c61909491946145fe565b9238614afe565b89513d87823e3d90fd5b8480fd5b62093a808904158015614c90575b15614adf575085614adf565b5060248a8d8d5192838092634cde602960e11b82528b8b8301525afa908115614cef578891614cc2575b508910614c84565b90508a81813d8311614ce8575b614cd9818361462e565b81010312614522575138614cba565b503d614ccf565b8c513d8a823e3d90fd5b62093a808704158015614d14575b15614ad557859250614ad5565b506002548a51634cde602960e11b81529083168582015289816024818f5afa908115614d7a578791614d49575b508710614d07565b90508981813d8311614d73575b614d60818361462e565b81010312614d6f575138614d41565b8680fd5b503d614d56565b8b513d89823e3d90fd5b5050505050505050565b813d8311614db0575b614da1818361462e565b81010312614bdc578338614a69565b503d614d97565b60005b828110614dc657505050565b606082820152602001614dba565b15614ddb57565b60405162461bcd60e51b815260206004820152600860248201527f21434f554e43494c0000000000000000000000000000000000000000000000006044820152606490fd5b3d15614e5b573d9067ffffffffffffffff8211611d2a5760405191614e4f601f8201601f19166020018461462e565b82523d6000602084013e565b606090565b15614e6757565b60405162461bcd60e51b815260206004820152600660248201527f65786973747300000000000000000000000000000000000000000000000000006044820152606490fd5b60008181526020916018835260409081832080548491855b828110614f2257505050614eda90600f54614a1f565b600f5582526019835281818120556018835281209182549282815583614f01575b50505050565b82528120918201915b828110614f175780614efb565b818155600101614f0a565b8785614f2e83856145e6565b91906001600160a01b03928391549060031b1c16818b528960178086528c83838220915286528c82812054968715159283614f75575b505050505050505050600101614ec4565b918491899d999493601398898352614f918b868620541661543f565b88845260168352848420614fa6888254614a1f565b905583528152828220908783525220614fc0838254614a1f565b9055156150795750508a528a5280888a205416895260158a528789205416803b156145585788809160448a518094819363278afc8b60e21b83528b60048401528c60248401525af1801561506f5761504587600195947fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db948c94615060575b5061488e565b965b8151908982528c820152a19038868189818c8e82614f64565b615069906145fe565b3861503f565b88513d8b823e3d90fd5b9092507fa9f3ca5f8a9e1580edb2741e0ba560084ec72e0067ba3423f9e9327a176882db93506150ad915060019594614a1f565b96615047565b909181600052602360205260ff604060002054166153ef576150d482614eac565b82516001600160a01b0360206000546024604051809481936339f890b560e21b835289600484015260101c165afa90811561049c576000916153bd575b5060009260009360009660005b85811061539e575060005b8581106151b8575050505050508261515b575b61514890600f5461488e565b600f556000526019602052604060002055565b6001600160a01b0360005460101c1690813b156103b7576000809260246040518095819363fd4a77f160e01b83528860048401525af191821561049c57615148926151a9575b50905061513c565b6151b2906145fe565b386151a1565b6001600160a01b036151ca82846149a5565b51168060005260136020526001600160a01b036040600020541680600052601b60205260ff604060002054168061538a575b61520b575b5050600101615129565b61522e8561522989615223879d9f978b9e979e6149a5565b51614960565b614940565b988a60005260176020526040600020816000526020526040600020546103b75789156103b75761525d8261543f565b8a60005260186020526040600020805468010000000000000000811015611d2a5761528d916001820181556145e6565b81549060031b906001600160a01b0384831b921b191617905580600052601660205260406000206152bf8b825461488e565b90558a600052601760205260406000209060005260205260406000206152e68a825461488e565b905560005260156020526001600160a01b036040600020541691823b156103b75760008a60448b83604051978894859363f320772360e01b8552600485015260248401525af190811561049c5761534a8a809260019661535095615060575061488e565b9b61488e565b97604051908a825260208201527fea66f58e474bc09f580000e81f31b334d171db387d0c6098ba47bd897741679b60403392a29038615201565b50601d60205260ff604060002054166151fc565b916153b66001916153af85876149a5565b519061488e565b920161511e565b90506020813d6020116153e7575b816153d86020938361462e565b810103126103b7575138615111565b3d91506153cb565b60405162461bcd60e51b815260206004820152602260248201527f5374616c65204e46542c20706c6561736520636f6e7461637420746865207465604482015261616d60f01b6064820152608490fd5b6001600160a01b03809116906000908282526014602052604082205416601e60205260408220908154918215156000146154ec57508252601660205261549a604083205491601154858552601e602052806040862055614a1f565b91821515806154e3575b6154ae5750505050565b670de0b6b3a76400006154c66154d894604094614960565b04938152601f6020522091825461488e565b905538808080614efb565b508115156154a4565b601154905550505050565b6001600160a01b03166000818152601c60205260408120805460ff8116614be95760ff1916600117905533907f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de9080a356fea164736f6c6343000816000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.