Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 4849726 | 7 days ago | IN | 0 S | 0.00041085 |
Loading...
Loading
This contract contains unverified libraries: RewardClaimers
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
Voter
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 100 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.24; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import {RewardClaimers} from "./libraries/RewardClaimers.sol"; import {IGaugeV3} from "./CL/gauge/interfaces/IGaugeV3.sol"; import {IMinter} from "./interfaces/IMinter.sol"; import {IPair} from "./interfaces/IPair.sol"; import {IPairFactory} from "./interfaces/IPairFactory.sol"; import {IFeeRecipient} from "./interfaces/IFeeRecipient.sol"; import {IFeeRecipientFactory} from "./interfaces/IFeeRecipientFactory.sol"; import {IRamsesV3Factory} from "./CL/core/interfaces/IRamsesV3Factory.sol"; import {IRamsesV3Pool} from "./CL/core/interfaces/IRamsesV3Pool.sol"; import {IClGaugeFactory} from "./CL/gauge/interfaces/IClGaugeFactory.sol"; import {IFeeCollector} from "./CL/gauge/interfaces/IFeeCollector.sol"; import {IVoteModule} from "./interfaces/IVoteModule.sol"; import {IVoter} from "./interfaces/IVoter.sol"; import {IFeeDistributor} from "./interfaces/IFeeDistributor.sol"; import {IFeeDistributorFactory} from "./interfaces/IFeeDistributorFactory.sol"; import {IGauge} from "./interfaces/IGauge.sol"; import {IGaugeFactory} from "./interfaces/IGaugeFactory.sol"; import {IXShadow} from "./interfaces/IXShadow.sol"; contract Voter is IVoter, ReentrancyGuard, Initializable { using EnumerableSet for EnumerableSet.AddressSet; address public legacyFactory; address public emissionsToken; address public gaugeFactory; address public feeDistributorFactory; address public minter; address public accessHub; address public governor; address public clFactory; address public clGaugeFactory; address public nfpManager; address public feeRecipientFactory; address public votingEscrow; address public xShadow; address public voteModule; /// @dev launcher address public launcherPlugin; uint256 internal constant DURATION = 7 days; uint256 public constant BASIS = 1_000_000; uint256 public xRatio; EnumerableSet.AddressSet pools; EnumerableSet.AddressSet customPools; EnumerableSet.AddressSet gauges; EnumerableSet.AddressSet feeDistributors; mapping(address pool => address gauge) public gaugeForPool; mapping(address gauge => address pool) public poolForGauge; mapping(address gauge => address feeDistributor) public feeDistributorForGauge; mapping(address pool => mapping(uint256 period => uint256 totalVotes)) public poolTotalVotesPerPeriod; mapping(address user => mapping(uint256 period => mapping(address pool => uint256 totalVote))) public userVotesForPoolPerPeriod; mapping(address user => mapping(uint256 period => address[] pools)) public userVotedPoolsPerPeriod; mapping(address user => mapping(uint256 period => uint256 votingPower)) public userVotingPowerPerPeriod; mapping(address user => uint256 period) public lastVoted; mapping(uint256 period => uint256 rewards) public totalRewardPerPeriod; mapping(uint256 period => uint256 weight) public totalVotesPerPeriod; mapping(address gauge => mapping(uint256 period => uint256 reward)) public gaugeRewardsPerPeriod; mapping(address gauge => mapping(uint256 period => bool distributed)) public gaugePeriodDistributed; mapping(address gauge => uint256 period) public lastDistro; mapping(address gauge => bool legacyGauge) public isLegacyGauge; mapping(address => bool) public isWhitelisted; mapping(address => bool) public isAlive; mapping(address gauge => bool arbitraryGauge) public isArbitraryGauge; mapping(address => bool) public isClGauge; /// @dev How many different CL pools there are for the same token pair mapping(address token0 => mapping(address token1 => int24[])) internal _tickSpacingsForPair; /// @dev what is the main tickspacing mapping(address token0 => mapping(address token1 => int24)) internal _mainTickSpacingForPair; /// @dev specific gauge based on tickspacing mapping(address token0 => mapping(address token1 => mapping(int24 tickSpacing => address gauge))) internal _gaugeForClPool; /// @dev this is only exposed to retrieve addresses, use feeDistributorForGauge for the most up-to-date data mapping(address clGauge => address feeDist) public feeDistributorForClGauge; /// @dev redirects votes from other tick spacings to the main pool mapping(address fromPool => address toPool) public poolRedirect; modifier onlyGovernance() { require( msg.sender == accessHub || msg.sender == governor, NOT_AUTHORIZED(msg.sender) ); _; } constructor() { accessHub = msg.sender; } function initialize( address _accessHub, address _emissionsToken, address _legacyFactory, address _gauges, address _feeDistributorFactory, address _minter, address _msig, address _xShadow, address _clFactory, address _clGaugeFactory, address _nfpManager, address _feeRecipientFactory, address _voteModule, address _launcherPlugin ) external initializer { // @dev making sure who deployed calls initialize require(accessHub == msg.sender, UNAUTHORIZED()); accessHub = _accessHub; legacyFactory = _legacyFactory; emissionsToken = _emissionsToken; gaugeFactory = _gauges; feeDistributorFactory = _feeDistributorFactory; minter = _minter; xShadow = _xShadow; governor = _msig; feeRecipientFactory = _feeRecipientFactory; voteModule = _voteModule; launcherPlugin = _launcherPlugin; clFactory = _clFactory; clGaugeFactory = _clGaugeFactory; nfpManager = _nfpManager; /// @dev default at 100% xRatio xRatio = 1_000_000; /// @dev emits from the zero address since it's the first time emit EmissionsRatio(address(0), 0, 1_000_000); /// @dev perma approval IERC20(emissionsToken).approve(xShadow, type(uint256).max); } /// @inheritdoc IVoter /// @notice sets the default xShadowRatio function setGlobalRatio(uint256 _xRatio) external onlyGovernance { require(_xRatio <= BASIS, RATIO_TOO_HIGH()); emit EmissionsRatio(msg.sender, xRatio, _xRatio); xRatio = _xRatio; } //////////// // Voting // //////////// /// @inheritdoc IVoter function reset(address user) external { /// @dev if the caller isn't the user if (msg.sender != user) { /// @dev check for delegation require( IVoteModule(voteModule).isDelegateFor(msg.sender, user), NOT_AUTHORIZED(msg.sender) ); } _reset(user); } function _reset(address user) internal { /// @dev voting for the next period uint256 nextPeriod = getPeriod() + 1; /// @dev fetch the previously voted pools address[] memory votedPools = userVotedPoolsPerPeriod[user][nextPeriod]; /// @dev fetch the user's stored voting power for the voting period uint256 votingPower = userVotingPowerPerPeriod[user][nextPeriod]; /// @dev if an existing vote is cast if (votingPower > 0) { /// @dev loop through the pools for (uint256 i; i < votedPools.length; ++i) { /// @dev fetch the individual casted for the pool for the next period uint256 userVote = userVotesForPoolPerPeriod[user][nextPeriod][ votedPools[i] ]; /// @dev decrement the total vote by the existing vote poolTotalVotesPerPeriod[votedPools[i]][nextPeriod] -= userVote; /// @dev wipe the mapping delete userVotesForPoolPerPeriod[user][nextPeriod][ votedPools[i] ]; /// @dev call _withdraw on the FeeDistributor IFeeDistributor( feeDistributorForGauge[gaugeForPool[votedPools[i]]] )._withdraw(userVote, user); emit Abstained(address(0), userVote); } /// @dev reduce the overall vote power casted totalVotesPerPeriod[nextPeriod] -= votingPower; /// @dev wipe the mappings delete userVotingPowerPerPeriod[user][nextPeriod]; delete userVotedPoolsPerPeriod[user][nextPeriod]; } } /// @inheritdoc IVoter function poke(address user) external { /// @dev ensure the caller is either the user or the vote module if (msg.sender != user) { /// @dev ...require they are authorized to be a delegate require( IVoteModule(voteModule).isDelegateFor(msg.sender, user) || msg.sender == voteModule, NOT_AUTHORIZED(msg.sender) ); } uint256 _lastVoted = lastVoted[user]; /// @dev has no prior vote, terminate early if (_lastVoted == 0) return; /// @dev fetch the last voted pools since votes are casted into the next week's mapping address[] memory votedPools = userVotedPoolsPerPeriod[user][ _lastVoted + 1 ]; /// @dev fetch the voting power of the user in that period after uint256 userVotePower = userVotingPowerPerPeriod[user][_lastVoted + 1]; /// @dev if nothing, terminate if (userVotePower == 0) return; uint256[] memory voteWeights = new uint256[](votedPools.length); /// @dev loop and fetch weights for (uint256 i; i < votedPools.length; i++) { voteWeights[i] = userVotesForPoolPerPeriod[user][_lastVoted + 1][ votedPools[i] ]; } /// @dev grab current period uint256 period = getPeriod(); /// @dev if the last voted period is the same as the current period if (_lastVoted == period) { /// @dev we reset the votes _reset(user); } /// @dev recast with new voting power and same weights/pools as prior /// @dev we ignore if this succeeds or not _vote(user, votedPools, voteWeights); } /// @inheritdoc IVoter /** important information on the mappings (since it is quite confusing): - userVotedPoolsPerPeriod is stored in the NEXT period when triggered - userVotingPowerPerPeriod is stored in the NEXT period - userVotesForPoolPerPeriod is stored in the NEXT period - poolTotalVotesPerPeriod is stored in the NEXT period - lastVoted is stored in the CURRENT period */ function vote( address user, address[] calldata _pools, uint256[] calldata _weights ) external { /// @dev ensure that the arrays length matches and that the length is > 0 require( _pools.length > 0 && _pools.length == _weights.length, LENGTH_MISMATCH() ); /// @dev if the caller isn't the user... if (msg.sender != user) { /// @dev ...require they are authorized to be a delegate require( IVoteModule(voteModule).isDelegateFor(msg.sender, user), NOT_AUTHORIZED(msg.sender) ); } /// @dev make a memory array of votedPools address[] memory votedPools = new address[](_pools.length); /// @dev loop through and populate the array for (uint256 i = 0; i < _pools.length; ++i) { votedPools[i] = _pools[i]; } /// @dev wipe all votes _reset(user); /// @dev cast new votes and revert if there's an issue require(_vote(user, votedPools, _weights), VOTE_UNSUCCESSFUL()); } function _vote( address user, address[] memory _pools, uint256[] memory _weights ) internal returns (bool) { /// @dev defaults to true bool success = true; /// @dev grab the nextPeriod uint256 nextPeriod = getPeriod() + 1; /// @dev fetch the user's votingPower uint256 votingPower = IVoteModule(voteModule).balanceOf(user); /// @dev set the voting power for the user for the period userVotingPowerPerPeriod[user][nextPeriod] = votingPower; /// @dev update the pools voted for userVotedPoolsPerPeriod[user][nextPeriod] = _pools; /// @dev loop through and add up the amounts, we do this because weights are proportions and not directly the vote power values uint256 totalVoteWeight; for (uint256 i; i < _pools.length; i++) { totalVoteWeight += _weights[i]; } /// @dev loop through all pools for (uint256 i; i < _pools.length; i++) { /// @dev fetch the gauge for the pool address _gauge = gaugeForPool[_pools[i]]; /// @dev set to false if a gauge is dead if (!isAlive[_gauge]) { return false; } /// @dev scale the weight of the pool uint256 _poolWeight = (_weights[i] * votingPower) / totalVoteWeight; /// @dev if weights are ever 0, set success to false if (_weights[i] == 0) { return false; } /// @dev increment to the votes for this pool poolTotalVotesPerPeriod[_pools[i]][nextPeriod] += _poolWeight; /// @dev increment the user's votes for this pool userVotesForPoolPerPeriod[user][nextPeriod][ _pools[i] ] += _poolWeight; /// @dev deposit the votes to the FeeDistributor IFeeDistributor(feeDistributorForGauge[_gauge])._deposit( _poolWeight, user ); /// @dev emit the voted event, passing the user and the raw vote weight given to the pool emit Voted(user, _poolWeight, _pools[i]); } /// @dev increment to the total totalVotesPerPeriod[nextPeriod] += votingPower; /// @dev last vote as current epoch lastVoted[user] = nextPeriod - 1; /// @dev return the result return success; } /////////////////////////// // Emission Distribution // /////////////////////////// function _distribute( address _gauge, uint256 _claimable, uint256 _period ) internal nonReentrant { /// @dev check if the gauge is even alive if (isAlive[_gauge]) { /// @dev if there is 0 claimable terminate if (_claimable == 0) return; /// @dev if the gauge is already distributed for the period, terminate if (gaugePeriodDistributed[_gauge][_period]) return; /// @dev fetch shadow address address _xShadow = address(xShadow); /// @dev fetch the current ratio and multiply by the claimable uint256 _xShadowClaimable = (_claimable * xRatio) / BASIS; /// @dev remove from the regular claimable tokens (SHADOW) _claimable -= _xShadowClaimable; /// @dev can only distribute if the distributed amount / week > 0 and is > left() bool canDistribute = true; /// @dev _claimable could be 0 if emission is 100% xShadow if (_claimable > 0) { if ( _claimable / DURATION == 0 || _claimable < IGauge(_gauge).left(emissionsToken) ) { canDistribute = false; } } /// @dev _xShadowClaimable could be 0 if ratio is 100% emissions if (_xShadowClaimable > 0) { if ( _xShadowClaimable / DURATION == 0 || _xShadowClaimable < IGauge(_gauge).left(_xShadow) ) { canDistribute = false; } } /// @dev if the checks pass and the gauge can be distributed if (canDistribute) { /// @dev set it to true firstly gaugePeriodDistributed[_gauge][_period] = true; /// @dev check SHADOW "claimable" if (_claimable > 0) { /// @dev notify emissions IGauge(_gauge).notifyRewardAmount( emissionsToken, _claimable ); } /// @dev check xSHADOW "claimable" if (_xShadowClaimable > 0) { /// @dev convert, then notify the xShadow IXShadow(_xShadow).convertEmissionsToken(_xShadowClaimable); IGauge(_gauge).notifyRewardAmount( _xShadow, _xShadowClaimable ); } emit DistributeReward( msg.sender, _gauge, _claimable + _xShadowClaimable ); } } } //////////////////// // View Functions // //////////////////// /// @inheritdoc IVoter function getVotes( address user, uint256 period ) external view returns (address[] memory votes, uint256[] memory weights) { /// @dev fetch the user's voted pools for the period votes = userVotedPoolsPerPeriod[user][period]; /// @dev set weights array length equal to the votes length weights = new uint256[](votes.length); /// @dev loop through the votes and populate the weights for (uint256 i; i < votes.length; ++i) { weights[i] = userVotesForPoolPerPeriod[user][period][votes[i]]; } } //////////////////////////////// // Governance Gated Functions // //////////////////////////////// /// @inheritdoc IVoter function setGovernor(address _governor) external onlyGovernance { if (governor != _governor) { governor = _governor; emit NewGovernor(msg.sender, _governor); } } /// @inheritdoc IVoter function whitelist(address _token) public onlyGovernance { require(!isWhitelisted[_token], ALREADY_WHITELISTED()); isWhitelisted[_token] = true; emit Whitelisted(msg.sender, _token); } /// @inheritdoc IVoter function revokeWhitelist(address _token) public onlyGovernance { require(isWhitelisted[_token], NOT_WHITELISTED()); isWhitelisted[_token] = false; emit WhitelistRevoked(msg.sender, _token, true); } /// @inheritdoc IVoter function killGauge(address _gauge) public onlyGovernance { /// @dev ensure the gauge is alive already require(isAlive[_gauge], GAUGE_INACTIVE(_gauge)); /// @dev set the gauge to dead isAlive[_gauge] = false; address pool = poolForGauge[_gauge]; /// @dev check if it's a legacy gauge if (isLegacyGauge[_gauge]) { /// @dev killed legacy gauges behave the same whether it has a main gauge or not bool feeSplitWhenNoGauge = IPairFactory(legacyFactory) .feeSplitWhenNoGauge(); if (feeSplitWhenNoGauge) { /// @dev What used to go to FeeRecipient will go to treasury /// @dev we are assuming voter.governor is the intended receiver (== factory.treasury) IPairFactory(legacyFactory).setFeeRecipient(pool, governor); } else { /// @dev the fees are handed to LPs instead of FeeRecipient IPairFactory(legacyFactory).setFeeRecipient(pool, address(0)); } } /// @dev fetch the last distribution uint256 _lastDistro = lastDistro[_gauge]; /// @dev fetch the current period uint256 currentPeriod = getPeriod(); /// @dev placeholder uint256 _claimable; /// @dev loop through the last distribution period up to and including the current period for (uint256 period = _lastDistro; period <= currentPeriod; ++period) { /// @dev if the gauge isn't distributed for the period if (!gaugePeriodDistributed[_gauge][period]) { uint256 additionalClaimable = _claimablePerPeriod(pool, period); _claimable += additionalClaimable; /// @dev prevent gaugePeriodDistributed being marked true when the minter hasn't updated yet if (additionalClaimable > 0) { gaugePeriodDistributed[_gauge][period] = true; } } } /// @dev if there is anything claimable left if (_claimable > 0) { /// @dev send to the governor contract IERC20(emissionsToken).transfer(governor, _claimable); } /// @dev update last distribution to the current period lastDistro[_gauge] = currentPeriod; emit GaugeKilled(_gauge); } /// @inheritdoc IVoter function reviveGauge(address _gauge) public onlyGovernance { /// @dev ensure the gauge is dead require(!isAlive[_gauge], ACTIVE_GAUGE(_gauge)); /// @dev set the gauge to alive isAlive[_gauge] = true; /// @dev check if it's a legacy gauge if (isLegacyGauge[_gauge]) { address pool = poolForGauge[_gauge]; address feeRecipient = IFeeRecipientFactory(feeRecipientFactory) .feeRecipientForPair(pool); IPairFactory(legacyFactory).setFeeRecipient(pool, feeRecipient); } /// @dev update last distribution to the current period lastDistro[_gauge] = getPeriod(); emit GaugeRevived(_gauge); } /// @inheritdoc IVoter /// @dev in case of emission stuck due to killed gauges and unsupported operations function stuckEmissionsRecovery( address _gauge, uint256 _period ) external onlyGovernance { /// @dev require gauge is dead require(!isAlive[_gauge], ACTIVE_GAUGE(_gauge)); /// @dev check if the period has been distributed already if (!gaugePeriodDistributed[_gauge][_period]) { address pool = poolForGauge[_gauge]; uint256 _claimable = _claimablePerPeriod(pool, _period); /// @dev if there is gt 0 emissions, send to governor if (_claimable > 0) { IERC20(emissionsToken).transfer(governor, _claimable); /// @dev mark period as distributed gaugePeriodDistributed[_gauge][_period] = true; } } } /// @inheritdoc IVoter function whitelistGaugeRewards( address _gauge, address _reward ) external onlyGovernance { /// @dev enforce whitelisted in voter require(isWhitelisted[_reward], NOT_WHITELISTED()); /// @dev if CL if (isClGauge[_gauge]) { IGaugeV3(_gauge).addRewards(_reward); } /// @dev if legacy else { IGauge(_gauge).whitelistReward(_reward); } } /// @inheritdoc IVoter function removeGaugeRewardWhitelist( address _gauge, address _reward ) external onlyGovernance { /// @dev if CL if (isClGauge[_gauge]) { IGaugeV3(_gauge).removeRewards(_reward); } /// @dev if legacy else { IGauge(_gauge).removeRewardWhitelist(_reward); } } /// @inheritdoc IVoter function removeFeeDistributorReward( address _feeDistributor, address reward ) external onlyGovernance { IFeeDistributor(_feeDistributor).removeReward(reward); } /// @inheritdoc IVoter function getPeriod() public view returns (uint256 period) { return (block.timestamp / 1 weeks); } //////////////////// // Gauge Creation // //////////////////// /// @inheritdoc IVoter function createGauge(address _pool) external returns (address) { /// @dev ensure there is no gauge for the pool require( gaugeForPool[_pool] == address(0), ACTIVE_GAUGE(gaugeForPool[_pool]) ); /// @dev check if it's a legacy pair bool isPair = IPairFactory(legacyFactory).isPair(_pool); require(isPair, NOT_POOL()); /// @dev fetch token0 and token1 from the pool's metadata (, , , , , address token0, address token1) = IPair(_pool).metadata(); /// @dev ensure that both tokens are whitelisted require( isWhitelisted[token0] && isWhitelisted[token1], NOT_WHITELISTED() ); /// @dev create the feeRecipient via the factory address feeRecipient = IFeeRecipientFactory(feeRecipientFactory) .createFeeRecipient(_pool); /// @dev create the feeDist via factory from the feeRecipient address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory) .createFeeDistributor(feeRecipient); /// @dev init feeRecipient with the feeDist IFeeRecipient(feeRecipient).initialize(_feeDistributor); /// @dev set the feeRecipient in the factory IPairFactory(legacyFactory).setFeeRecipient(_pool, feeRecipient); /// @dev fetch the feesplit uint256 feeSplit = IPair(_pool).feeSplit(); /// @dev if there is no feeSplit yet if (feeSplit == 0) { /// @dev fetch the legacy factory address _legacyFactory = legacyFactory; /// @dev fetch the feeSplit from the factory feeSplit = IPairFactory(_legacyFactory).feeSplit(); /// @dev set the feeSplit to align with the factory IPairFactory(_legacyFactory).setPairFeeSplit(_pool, feeSplit); } /// @dev create a legacy gauge from the factory address _gauge = IGaugeFactory(gaugeFactory).createGauge(_pool); /// @dev give infinite approvals in advance IERC20(emissionsToken).approve(_gauge, type(uint256).max); IERC20(xShadow).approve(_gauge, type(uint256).max); /// @dev update voter mappings feeDistributorForGauge[_gauge] = _feeDistributor; gaugeForPool[_pool] = _gauge; poolForGauge[_gauge] = _pool; /// @dev set gauge to alive isAlive[_gauge] = true; /// @dev add to the sets pools.add(_pool); gauges.add(_gauge); feeDistributors.add(_feeDistributor); /// @dev set true that it is a legacy gauge isLegacyGauge[_gauge] = true; /// @dev set the last distribution as the current period lastDistro[_gauge] = getPeriod(); /// @dev emit the gauge creation event emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool); /// @dev return the new created gauge address return _gauge; } /// @inheritdoc IVoter function createCLGauge( address tokenA, address tokenB, int24 tickSpacing ) external returns (address) { /// @dev fetch the V3 pool's address address _pool = IRamsesV3Factory(clFactory).getPool( tokenA, tokenB, tickSpacing ); /// @dev require the pool exists require(_pool != address(0), NOT_POOL()); /// @dev check the reentrancy lock (, , , , , , bool unlocked) = IRamsesV3Pool(_pool).slot0(); /// @dev require it is unlocked, else it is considered not initialized require(unlocked, NOT_INIT()); /// @dev ensure a gauge does not already exist for the pool require( gaugeForPool[_pool] == address(0), ACTIVE_GAUGE(gaugeForPool[_pool]) ); /// @dev ensure both tokens are whitelisted require( isWhitelisted[tokenA] && isWhitelisted[tokenB], NOT_WHITELISTED() ); /// @dev fetch the feeCollector address _feeCollector = IRamsesV3Factory(clFactory).feeCollector(); /// @dev create the FeeDistributor address _feeDistributor = IFeeDistributorFactory(feeDistributorFactory) .createFeeDistributor(_feeCollector); /// @dev create the gauge address _gauge = IClGaugeFactory(clGaugeFactory).createGauge(_pool); /// @dev unlimited approve shadow and xShadow to the gauge IERC20(emissionsToken).approve(_gauge, type(uint256).max); IERC20(xShadow).approve(_gauge, type(uint256).max); /// @dev update mappings feeDistributorForClGauge[_gauge] = _feeDistributor; gaugeForPool[_pool] = _gauge; poolForGauge[_gauge] = _pool; lastDistro[_gauge] = getPeriod(); pools.add(_pool); gauges.add(_gauge); feeDistributors.add(_feeDistributor); isClGauge[_gauge] = true; /// @dev fetch the feeProtocol value from the factory IRamsesV3Pool(_pool).setFeeProtocol(); emit GaugeCreated(_gauge, msg.sender, _feeDistributor, _pool); { (address token0, address token1) = _sortTokens(tokenA, tokenB); _tickSpacingsForPair[token0][token1].push(tickSpacing); _gaugeForClPool[token0][token1][tickSpacing] = _gauge; int24 mainTickSpacing = _mainTickSpacingForPair[token0][token1]; if (mainTickSpacing == 0) { /// @dev populate _mainTickSpacingForPair if empty _mainTickSpacingForPair[token0][token1] = tickSpacing; feeDistributorForGauge[_gauge] = _feeDistributor; isAlive[_gauge] = true; emit MainTickSpacingChanged(token0, token1, tickSpacing); } else { require(msg.sender == governor, NOT_AUTHORIZED(msg.sender)); /// @dev redirect future votes and fee distributor to the main tick spacing instead /// @dev if there is already a main tick spacing, new gauges that aren't the main tick spacing aren't alive by default address mainGauge = _gaugeForClPool[token0][token1][ mainTickSpacing ]; poolRedirect[_pool] = poolForGauge[mainGauge]; feeDistributorForGauge[_gauge] = feeDistributorForClGauge[ mainGauge ]; emit GaugeKilled(_gauge); } } return _gauge; } /// @inheritdoc IVoter function createArbitraryGauge( address _token ) external onlyGovernance returns (address _newGauge) { /// @dev if there exists a gauge for the stake token, revert require( gaugeForPool[_token] == address(0), ACTIVE_GAUGE(gaugeForPool[_token]) ); /// @dev create a gauge for the receipt token address _gauge = IGaugeFactory(gaugeFactory).createGauge(_token); /// @dev approve infinite tokens to the gauge in advance IERC20(emissionsToken).approve(_gauge, type(uint256).max); IERC20(xShadow).approve(_gauge, type(uint256).max); /// @dev update mappings gaugeForPool[_token] = _gauge; poolForGauge[_gauge] = _token; isAlive[_gauge] = true; customPools.add(_token); gauges.add(_gauge); isArbitraryGauge[_gauge] = true; lastDistro[_gauge] = getPeriod(); emit CustomGaugeCreated(_gauge, msg.sender, _token); return _gauge; } /// @inheritdoc IVoter function setMainTickSpacing( address tokenA, address tokenB, int24 tickSpacing ) external onlyGovernance { (address token0, address token1) = _sortTokens(tokenA, tokenB); address mainGauge = _gaugeForClPool[token0][token1][tickSpacing]; require(mainGauge != address(0), NO_GAUGE()); address mainPool = poolForGauge[mainGauge]; address mainFeeDist = feeDistributorForClGauge[mainGauge]; _mainTickSpacingForPair[token0][token1] = tickSpacing; uint256 _gaugeLength = _tickSpacingsForPair[token0][token1].length; /// @dev direct future votes to new main gauge /// @dev already cast votes won't be moved, voters should update their votes or call poke() /// @dev change feeDist for gauges to the main feeDist, so FeeCollector sends fees to the right place /// @dev kill from gauge if needed for (uint256 i = 0; i < _gaugeLength; i++) { int24 _fromTickSpacing = _tickSpacingsForPair[token0][token1][i]; address _fromGauge = _gaugeForClPool[token0][token1][ _fromTickSpacing ]; address _fromPool = poolForGauge[_fromGauge]; poolRedirect[_fromPool] = mainPool; feeDistributorForGauge[_fromGauge] = mainFeeDist; /// @dev kill gauges if needed if (_fromGauge != mainGauge && isAlive[_fromGauge]) { killGauge(_fromGauge); } } /// @dev revive main gauge if needed if (!isAlive[mainGauge]) { reviveGauge(mainGauge); } } ///////////////////////////// // One-stop Reward Claimer // ///////////////////////////// /// @inheritdoc IVoter function claimClGaugeRewards( address[] calldata _gauges, address[][] calldata _tokens, uint256[][] calldata _nfpTokenIds ) external { RewardClaimers.claimClGaugeRewards( nfpManager, _gauges, _tokens, _nfpTokenIds ); } /// @inheritdoc IVoter function claimIncentives( address owner, address[] calldata _feeDistributors, address[][] calldata _tokens ) external { RewardClaimers.claimIncentives( votingEscrow, owner, _feeDistributors, _tokens ); } /// @inheritdoc IVoter function claimRewards( address[] calldata _gauges, address[][] calldata _tokens ) external { RewardClaimers.claimRewards(_gauges, _tokens); } ////////////////////////// // Emission Calculation // ////////////////////////// /// @inheritdoc IVoter function notifyRewardAmount(uint256 amount) external { /// @dev gate to minter which prevents bricking distribution require(msg.sender == minter, NOT_AUTHORIZED(msg.sender)); /// @dev transfer the tokens to the voter IERC20(emissionsToken).transferFrom(msg.sender, address(this), amount); /// @dev fetch the current period uint256 period = getPeriod(); /// @dev add to the totalReward for the period totalRewardPerPeriod[period] += amount; /// @dev emit an event emit NotifyReward(msg.sender, emissionsToken, amount); } /////////////////////////// // Emission Distribution // /////////////////////////// /// @inheritdoc IVoter function distribute(address _gauge) public nonReentrant { /// @dev update the period if not already done IMinter(minter).updatePeriod(); /// @dev fetch the last distribution uint256 _lastDistro = lastDistro[_gauge]; /// @dev fetch the current period uint256 currentPeriod = getPeriod(); /// @dev fetch the pool address from the gauge address pool = poolForGauge[_gauge]; /// @dev loop through _lastDistro + 1 up to and including the currentPeriod for ( uint256 period = _lastDistro + 1; period <= currentPeriod; ++period ) { /// @dev fetch the claimable amount uint256 claimable = _claimablePerPeriod(pool, period); /// @dev distribute for the period _distribute(_gauge, claimable, period); } /// @dev if the last distribution wasnt the current period if (_lastDistro != currentPeriod) { /// @dev check if a CL gauge if (isClGauge[_gauge]) { IRamsesV3Pool poolV3 = IRamsesV3Pool(pool); /// @dev attempt period advancing poolV3._advancePeriod(); /// @dev collect fees by calling from the FeeCollector IFeeCollector(IRamsesV3Factory(clFactory).feeCollector()) .collectProtocolFees(poolV3); /// @dev if it's a legacy gauge, fees are handled as LP tokens and thus need to be treated diff } else if (isLegacyGauge[_gauge]) { /// @dev mint the fees IPair(pool).mintFee(); /// @dev notify the fees to the FeeDistributor IFeeRecipient( IFeeRecipientFactory(feeRecipientFactory) .feeRecipientForPair(pool) ).notifyFees(); } /// @dev no actions needed for custom gauge } /// @dev set the last distribution for the gauge as the currentPeriod lastDistro[_gauge] = currentPeriod; } /// @inheritdoc IVoter function distributeForPeriod(address _gauge, uint256 _period) public { /// @dev attempt to update the period IMinter(minter).updatePeriod(); /// @dev fetch the pool address from the gauge address pool = poolForGauge[_gauge]; /// @dev fetch the claimable amount for the period uint256 claimable = _claimablePerPeriod(pool, _period); /// @dev we dont update lastDistro here _distribute(_gauge, claimable, _period); } /// @inheritdoc IVoter function distributeAll() external { /// @dev grab the length of all gauges in the set uint256 gaugesLength = gauges.length(); /// @dev loop through and call distribute for every index for (uint256 i; i < gaugesLength; ++i) { distribute(gauges.at(i)); } } /// @inheritdoc IVoter function batchDistributeByIndex( uint256 startIndex, uint256 endIndex ) external { /// @dev grab the length of all gauges in the set uint256 gaugesLength = gauges.length(); /// @dev if the end value is too high, set to end if (endIndex > gaugesLength) { endIndex = gaugesLength; } /// @dev loop through and distribute for (uint256 i = startIndex; i < endIndex; ++i) { distribute(gauges.at(i)); } } //////////////////// // View Functions // //////////////////// /// @inheritdoc IVoter function getAllCustomPools() external view returns (address[] memory _customPools) { return customPools.values(); } /// @inheritdoc IVoter function getAllGauges() external view returns (address[] memory _gauges) { _gauges = gauges.values(); } /// @inheritdoc IVoter function getAllFeeDistributors() external view returns (address[] memory _feeDistributors) { return feeDistributors.values(); } /// @inheritdoc IVoter function isGauge(address _gauge) external view returns (bool) { return gauges.contains(_gauge); } /// @inheritdoc IVoter function isFeeDistributor( address _feeDistributor ) external view returns (bool) { return feeDistributors.contains(_feeDistributor); } /// @inheritdoc IVoter function tickSpacingsForPair( address tokenA, address tokenB ) public view returns (int24[] memory) { (address token0, address token1) = _sortTokens(tokenA, tokenB); return _tickSpacingsForPair[token0][token1]; } /// @inheritdoc IVoter function mainTickSpacingForPair( address tokenA, address tokenB ) public view returns (int24) { (address token0, address token1) = _sortTokens(tokenA, tokenB); return _mainTickSpacingForPair[token0][token1]; } /// @inheritdoc IVoter function gaugeForClPool( address tokenA, address tokenB, int24 tickSpacing ) public view returns (address) { (address token0, address token1) = _sortTokens(tokenA, tokenB); return _gaugeForClPool[token0][token1][tickSpacing]; } /// @dev shows how much is claimable per period function _claimablePerPeriod( address pool, uint256 period ) internal view returns (uint256) { uint256 numerator = (totalRewardPerPeriod[period] * poolTotalVotesPerPeriod[pool][period]) * 1e18; /// @dev return 0 if this happens, or else there could be a divide by zero next return ( numerator == 0 ? 0 : (numerator / totalVotesPerPeriod[period] / 1e18) ); } /// @dev sorts the two tokens function _sortTokens( address tokenA, address tokenB ) internal pure returns (address token0, address token1) { token0 = tokenA < tokenB ? tokenA : tokenB; token1 = token0 == tokenA ? tokenB : tokenA; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; assembly ("memory-safe") { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly ("memory-safe") { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly ("memory-safe") { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import {INonfungiblePositionManager} from "../CL/periphery/interfaces/INonfungiblePositionManager.sol"; import {IGauge} from "../interfaces/IGauge.sol"; import {IGaugeV3} from "../CL/gauge/interfaces/IGaugeV3.sol"; import {IVoteModule} from "../interfaces/IVoteModule.sol"; import {IFeeDistributor} from "../interfaces/IFeeDistributor.sol"; /// @title RewardClaimers /// @notice Reward claimers logic for Voter /// @dev Used to reduce Voter contract size by moving all reward claiming logic to a library library RewardClaimers { error NOT_AUTHORIZED(); function claimClGaugeRewards( address nfpManager, address[] calldata _gauges, address[][] calldata _tokens, uint256[][] calldata _nfpTokenIds ) external { for (uint256 i; i < _gauges.length; ++i) { for (uint256 j; j < _nfpTokenIds[i].length; ++j) { require( msg.sender == INonfungiblePositionManager(nfpManager).ownerOf( _nfpTokenIds[i][j] ) || msg.sender == INonfungiblePositionManager(nfpManager).getApproved( _nfpTokenIds[i][j] ) || INonfungiblePositionManager(nfpManager) .isApprovedForAll( INonfungiblePositionManager(nfpManager).ownerOf( _nfpTokenIds[i][j] ), msg.sender ) ); IGaugeV3(_gauges[i]).getRewardForOwner( _nfpTokenIds[i][j], _tokens[i] ); } } } function claimIncentives( address voteModule, address owner, address[] calldata _feeDistributors, address[][] calldata _tokens ) external { IVoteModule(voteModule).isAdminFor(msg.sender, owner); for (uint256 i; i < _feeDistributors.length; ++i) { IFeeDistributor(_feeDistributors[i]).getRewardForOwner( owner, _tokens[i] ); } } function claimRewards( address[] calldata _gauges, address[][] calldata _tokens ) external { for (uint256 i; i < _gauges.length; ++i) { IGauge(_gauges[i]).getReward(msg.sender, _tokens[i]); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.26; interface IGaugeV3 { error NOT_AUTHORIZED(); error NOT_VOTER(); error NOT_GT_ZERO(); error CANT_CLAIM_FUTURE(); error RETRO(); /// @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 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 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. function positionInfo( uint256 tokenId ) external view returns (uint128 liquidity); */ /// @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; function addRewards(address reward) external; function removeRewards(address reward) 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; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; interface IMinter { /// @dev error for if epoch 0 has already started error STARTED(); /// @dev error for if update_period is attempted to be called before startEmissions error EMISSIONS_NOT_STARTED(); /// @dev deviation too high error TOO_HIGH(); /// @dev no change in values error NO_CHANGE(); /// @dev when attempting to update emissions more than once per period error SAME_PERIOD(); event SetVeDist(address _value); event SetVoter(address _value); event Mint(address indexed sender, uint256 weekly); event RebaseUnsuccessful(uint256 _current, uint256 _currentPeriod); event EmissionsMultiplierUpdated(uint256 _emissionsMultiplier); /// @notice decay or inflation scaled to 10_000 = 100% /// @return _multiplier the emissions multiplier function emissionsMultiplier() external view returns (uint256 _multiplier); /// @notice unix timestamp of current epoch's start /// @return _activePeriod the active period function activePeriod() external view returns (uint256 _activePeriod); /// @notice update the epoch (period) -- callable once a week at >= Thursday 0 UTC /// @return period the new period function updatePeriod() external returns (uint256 period); /// @notice start emissions for epoch 0 function startEmissions() external; /// @notice updates the decay or inflation scaled to 10_000 = 100% /// @param _emissionsMultiplier multiplier for emissions each week function updateEmissionsMultiplier(uint256 _emissionsMultiplier) external; /// @notice calculates the emissions to be sent to the voter /// @return _weeklyEmissions the amount of emissions for the week function calculateWeeklyEmissions() external view returns (uint256 _weeklyEmissions); /// @notice kicks off the initial minting and variable declarations function kickoff( address _emissionsToken, address _voter, uint256 _initialWeeklyEmissions, uint256 _initialMultiplier ) external; /// @notice returns (block.timestamp / 1 week) for gauge use /// @return period period number function getPeriod() external view returns (uint256 period); /// @notice returns the numerical value of the current epoch /// @return _epoch epoch number function getEpoch() external view returns (uint256 _epoch); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IPair { error NOT_AUTHORIZED(); error UNSTABLE_RATIO(); /// @dev safe transfer failed error STF(); error OVERFLOW(); /// @dev skim disabled error SD(); /// @dev insufficient liquidity minted error ILM(); /// @dev insufficient liquidity burned error ILB(); /// @dev insufficient output amount error IOA(); /// @dev insufficient input amount error IIA(); error IL(); error IT(); error K(); event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); /// @notice initialize the pool, called only once programatically function initialize( address _token0, address _token1, bool _stable ) external; /// @notice calculate the current reserves of the pool and their last 'seen' timestamp /// @return _reserve0 amount of token0 in reserves /// @return _reserve1 amount of token1 in reserves /// @return _blockTimestampLast the timestamp when the pool was last updated function getReserves() external view returns ( uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast ); /// @notice mint the pair tokens (LPs) /// @param to where to mint the LP tokens to /// @return liquidity amount of LP tokens to mint function mint(address to) external returns (uint256 liquidity); /// @notice burn the pair tokens (LPs) /// @param to where to send the underlying /// @return amount0 amount of amount0 /// @return amount1 amount of amount1 function burn( address to ) external returns (uint256 amount0, uint256 amount1); /// @notice direct swap through the pool function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; /// @notice force balances to match reserves, can be used to harvest rebases from rebasing tokens or other external factors /// @param to where to send the excess tokens to function skim(address to) external; /// @notice force reserves to match balances, prevents skim excess if skim is enabled function sync() external; /// @notice set the pair fees contract address function setFeeRecipient(address _pairFees) external; /// @notice set the feesplit variable function setFeeSplit(uint256 _feeSplit) external; /// @notice sets the swap fee of the pair /// @dev max of 10_000 (10%) /// @param _fee the fee function setFee(uint256 _fee) external; /// @notice 'mint' the fees as LP tokens /// @dev this is used for protocol/voter fees function mintFee() external; /// @notice calculates the amount of tokens to receive post swap /// @param amountIn the token amount /// @param tokenIn the address of the token function getAmountOut( uint256 amountIn, address tokenIn ) external view returns (uint256 amountOut); /// @notice returns various metadata about the pair function metadata() external view returns ( uint256 _decimals0, uint256 _decimals1, uint256 _reserve0, uint256 _reserve1, bool _stable, address _token0, address _token1 ); /// @notice returns the feeSplit of the pair function feeSplit() external view returns (uint256); /// @notice returns the fee of the pair function fee() external view returns (uint256); /// @notice returns the feeRecipient of the pair function feeRecipient() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IPairFactory { error FEE_TOO_HIGH(); error ZERO_FEE(); /// @dev invalid assortment error IA(); /// @dev zero address error ZA(); /// @dev pair exists error PE(); error NOT_AUTHORIZED(); error INVALID_FEE_SPLIT(); event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); event SetFee(uint256 indexed fee); event SetPairFee(address indexed pair, uint256 indexed fee); event SetFeeSplit(uint256 indexed _feeSplit); event SetPairFeeSplit(address indexed pair, uint256 indexed _feeSplit); event SkimStatus(address indexed _pair, bool indexed _status); event NewTreasury(address indexed _caller, address indexed _newTreasury); event FeeSplitWhenNoGauge(address indexed _caller, bool indexed _status); event SetFeeRecipient(address indexed pair, address indexed feeRecipient); /// @notice returns the total length of legacy pairs /// @return _length the length function allPairsLength() external view returns (uint256 _length); /// @notice calculates if the address is a legacy pair /// @param pair the address to check /// @return _boolean the bool return function isPair(address pair) external view returns (bool _boolean); /// @notice calculates the pairCodeHash /// @return _hash the pair code hash function pairCodeHash() external view returns (bytes32 _hash); /// @param tokenA address of tokenA /// @param tokenB address of tokenB /// @param stable whether it uses the stable curve /// @return _pair the address of the pair function getPair( address tokenA, address tokenB, bool stable ) external view returns (address _pair); /// @notice creates a new legacy pair /// @param tokenA address of tokenA /// @param tokenB address of tokenB /// @param stable whether it uses the stable curve /// @return pair the address of the created pair function createPair( address tokenA, address tokenB, bool stable ) external returns (address pair); /// @notice the address of the voter /// @return _voter the address of the voter function voter() external view returns (address _voter); /// @notice returns the address of a pair based on the index /// @param _index the index to check for a pair /// @return _pair the address of the pair at the index function allPairs(uint256 _index) external view returns (address _pair); /// @notice the swap fee of a pair /// @param _pair the address of the pair /// @return _fee the fee function pairFee(address _pair) external view returns (uint256 _fee); /// @notice the split of fees /// @return _split the feeSplit function feeSplit() external view returns (uint256 _split); /// @notice sets the swap fee for a pair /// @param _pair the address of the pair /// @param _fee the fee for the pair function setPairFee(address _pair, uint256 _fee) external; /// @notice set the swap fees of the pair /// @param _fee the fee, scaled to MAX 10% of 100_000 function setFee(uint256 _fee) external; /// @notice the address for the treasury /// @return _treasury address of the treasury function treasury() external view returns (address _treasury); /// @notice sets the pairFees contract /// @param _pair the address of the pair /// @param _pairFees the address of the new Pair Fees function setFeeRecipient(address _pair, address _pairFees) external; /// @notice sets the feeSplit for a pair /// @param _pair the address of the pair /// @param _feeSplit the feeSplit function setPairFeeSplit(address _pair, uint256 _feeSplit) external; /// @notice whether there is feeSplit when there's no gauge /// @return _boolean whether there is a feesplit when no gauge function feeSplitWhenNoGauge() external view returns (bool _boolean); /// @notice whether a pair can be skimmed /// @param _pair the pair address /// @return _boolean whether skim is enabled function skimEnabled(address _pair) external view returns (bool _boolean); /// @notice set whether skim is enabled for a specific pair function setSkimEnabled(address _pair, bool _status) external; /// @notice sets a new treasury address /// @param _treasury the new treasury address function setTreasury(address _treasury) external; /// @notice set whether there should be a feesplit without gauges /// @param status whether enabled or not function setFeeSplitWhenNoGauge(bool status) external; /// @notice sets the feesSplit globally /// @param _feeSplit the fee split function setFeeSplit(uint256 _feeSplit) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; interface IFeeRecipient { error STF(); error NOT_AUTHORIZED(); function initialize(address _feeDistributor) external; function notifyFees() external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IFeeRecipientFactory { error INVALID_TREASURY_FEE(); error NOT_AUTHORIZED(); /// @notice the pair fees for a specific pair /// @param pair the pair to check /// @return feeRecipient the feeRecipient contract address for the pair function feeRecipientForPair( address pair ) external view returns (address feeRecipient); /// @notice the last feeRecipient address created /// @return _feeRecipient the address of the last pair fees contract function lastFeeRecipient() external view returns (address _feeRecipient); /// @notice create the pair fees for a pair /// @param pair the address of the pair /// @return _feeRecipient the address of the newly created feeRecipient function createFeeRecipient( address pair ) external returns (address _feeRecipient); /// @notice the fee % going to the treasury /// @return _feeToTreasury the fee % function feeToTreasury() external view returns (uint256 _feeToTreasury); /// @notice get the treasury address /// @return _treasury address of the treasury function treasury() external view returns (address _treasury); /// @notice set the fee % to be sent to the treasury /// @param _feeToTreasury the fee % to be sent to the treasury function setFeeToTreasury(uint256 _feeToTreasury) external; /// @notice set a new treasury address /// @param _treasury the new address function setTreasury(address _treasury) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title The interface for the Ramses V3 Factory /// @notice The Ramses V3 Factory facilitates creation of Ramses V3 pools and control over the protocol fees interface IRamsesV3Factory { error IT(); /// @dev Fee Too Large error FTL(); error A0(); error F0(); error PE(); /// @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 tickspacing amount is enabled for pool creation via the factory /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier /// @param tickSpacing The minimum number of ticks between initialized ticks /// @param fee The fee, denominated in hundredths of a bip event TickSpacingEnabled(int24 indexed tickSpacing, uint24 indexed fee); /// @notice Emitted when the protocol fee is changed /// @param feeProtocolOld The previous value of the protocol fee /// @param feeProtocolNew The updated value of the protocol fee event SetFeeProtocol(uint8 feeProtocolOld, uint8 feeProtocolNew); /// @notice Emitted when the protocol fee is changed /// @param pool The pool address /// @param feeProtocolOld The previous value of the protocol fee /// @param feeProtocolNew The updated value of the protocol fee event SetPoolFeeProtocol(address pool, uint8 feeProtocolOld, uint8 feeProtocolNew); /// @notice Emitted when a pool's fee is changed /// @param pool The pool address /// @param newFee The updated value of the protocol fee event FeeAdjustment(address pool, uint24 newFee); /// @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 PoolDeployer address /// @return The address of the PoolDeployer contract function ramsesV3PoolDeployer() external returns (address); /// @notice Returns the fee amount for a given tickSpacing, if enabled, or 0 if not enabled /// @dev A tickSpacing can never be removed, so this value should be hard coded or cached in the calling context /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier /// @param tickSpacing The enabled tickSpacing. Returns 0 in case of unenabled tickSpacing /// @return initialFee The initial fee function tickSpacingInitialFee(int24 tickSpacing) external view returns (uint24 initialFee); /// @notice Returns the pool address for a given pair of tokens and a tickSpacing, or address 0 if it does not exist /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param tickSpacing The tickSpacing of the pool /// @return pool The pool address function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool); /// @notice Creates a pool for the given two tokens and fee /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier /// @param tokenA One of the two tokens in the desired pool /// @param tokenB The other of the two tokens in the desired pool /// @param tickSpacing The desired tickSpacing 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. /// @dev The call will revert if the pool already exists, the tickSpacing is invalid, or the token arguments are invalid. /// @return pool The address of the newly created pool function createPool( address tokenA, address tokenB, int24 tickSpacing, uint160 sqrtPriceX96 ) external returns (address pool); /// @notice Enables a tickSpacing with the given initialFee amount /// @dev unlike UniswapV3, we map via the tickSpacing rather than the fee tier /// @dev tickSpacings may never be removed once enabled /// @param tickSpacing The spacing between ticks to be enforced for all pools created /// @param initialFee The initial fee amount, denominated in hundredths of a bip (i.e. 1e-6) function enableTickSpacing(int24 tickSpacing, uint24 initialFee) external; /// @notice returns the default protocol fee. /// @return _feeProtocol the default feeProtocol function feeProtocol() external view returns (uint8 _feeProtocol); /// @notice returns the % of fees directed to governance /// @dev if the fee is 0, or the pool is uninitialized this will return the Factory's default feeProtocol /// @param pool the address of the pool /// @return _feeProtocol the feeProtocol for the pool function poolFeeProtocol(address pool) external view returns (uint8 _feeProtocol); /// @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 Get the parameters to be used in constructing the pool, set transiently during pool creation. /// @dev Called by the pool constructor to fetch the parameters of the pool /// @return factory The factory address /// @return token0 The first token of the pool by address sort order /// @return token1 The second token of the pool by address sort order /// @return fee The initialized feetier of the pool, denominated in hundredths of a bip /// @return tickSpacing The minimum number of ticks between initialized ticks function parameters() external view returns (address factory, address token0, address token1, uint24 fee, int24 tickSpacing); /// @notice Sets the fee collector address /// @param _feeCollector the fee collector address function setFeeCollector(address _feeCollector) external; /// @notice sets the swap fee for a specific pool /// @param _pool address of the pool /// @param _fee the fee to be assigned to the pool, scaled to 1_000_000 = 100% function setFee(address _pool, uint24 _fee) external; /// @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 sets the feeProtocol of a specific pool /// @param pool address of the pool /// @param _feeProtocol the fee protocol to assign function setPoolFeeProtocol(address pool, uint8 _feeProtocol) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IRamsesV3PoolImmutables} from './pool/IRamsesV3PoolImmutables.sol'; import {IRamsesV3PoolState} from './pool/IRamsesV3PoolState.sol'; import {IRamsesV3PoolDerivedState} from './pool/IRamsesV3PoolDerivedState.sol'; import {IRamsesV3PoolActions} from './pool/IRamsesV3PoolActions.sol'; import {IRamsesV3PoolOwnerActions} from './pool/IRamsesV3PoolOwnerActions.sol'; import {IRamsesV3PoolErrors} from './pool/IRamsesV3PoolErrors.sol'; import {IRamsesV3PoolEvents} from './pool/IRamsesV3PoolEvents.sol'; /// @title The interface for a Ramses V3 Pool /// @notice A Ramses 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 IRamsesV3Pool is IRamsesV3PoolImmutables, IRamsesV3PoolState, IRamsesV3PoolDerivedState, IRamsesV3PoolActions, IRamsesV3PoolOwnerActions, IRamsesV3PoolErrors, IRamsesV3PoolEvents { /// @notice if a new period, advance on interaction function _advancePeriod() external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; /// @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 Returns the NFP Manager address function nfpManager() 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); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; import {IRamsesV3Pool} from "../../core/interfaces/IRamsesV3Pool.sol"; interface IFeeCollector { error NOT_AUTHORIZED(); error FTL(); /// @notice Emitted when the treasury address is changed. /// @param oldTreasury The previous treasury address. /// @param newTreasury The new treasury address. event TreasuryChanged(address oldTreasury, address newTreasury); /// @notice Emitted when the treasury fees value is changed. /// @param oldTreasuryFees The previous value of the treasury fees. /// @param newTreasuryFees The new value of the treasury fees. event TreasuryFeesChanged(uint256 oldTreasuryFees, uint256 newTreasuryFees); /// @notice Emitted when protocol fees are collected from a pool and distributed to the fee distributor and treasury. /// @param pool The address of the pool from which the fees were collected. /// @param feeDistAmount0 The amount of fee tokens (token 0) distributed to the fee distributor. /// @param feeDistAmount1 The amount of fee tokens (token 1) distributed to the fee distributor. /// @param treasuryAmount0 The amount of fee tokens (token 0) allocated to the treasury. /// @param treasuryAmount1 The amount of fee tokens (token 1) allocated to the treasury. event FeesCollected( address pool, uint256 feeDistAmount0, uint256 feeDistAmount1, uint256 treasuryAmount0, uint256 treasuryAmount1 ); /// @notice Returns the treasury address. function treasury() external returns (address); /// @notice Sets the treasury address to a new value. /// @param newTreasury The new address to set as the treasury. function setTreasury(address newTreasury) external; /// @notice Sets the value of treasury fees to a new amount. /// @param _treasuryFees The new amount of treasury fees to be set. function setTreasuryFees(uint256 _treasuryFees) external; /// @notice Collects protocol fees from a specified pool and distributes them to the fee distributor and treasury. /// @param pool The pool from which to collect the protocol fees. function collectProtocolFees(IRamsesV3Pool pool) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IVoteModule { /** Custom Errors */ /// @dev == 0 error ZERO_AMOUNT(); /// @dev if address is not xShadow error NOT_XSHADOW(); /// @dev error for when the cooldown period has not been passed yet error COOLDOWN_ACTIVE(); /// @dev error for when you try to deposit or withdraw for someone who isn't the msg.sender error NOT_VOTEMODULE(); /// @dev error for when the caller is not authorized error UNAUTHORIZED(); /** Events */ event Deposit(address indexed from, uint256 amount); event Withdraw(address indexed from, uint256 amount); event NotifyReward(address indexed from, uint256 amount); event ClaimRewards(address indexed from, uint256 amount); event Delegate( address indexed delegator, address indexed delegatee, bool indexed isAdded ); event SetAdmin( address indexed owner, address indexed operator, bool indexed isAdded ); /** Functions */ function userLastDeposit( address user ) external view returns (uint256 timestamp); function delegates(address) external view returns (address); /// @notice mapping for admins for a specific address /// @param owner the owner to check against /// @return operator the address that is designated as an admin/operator function admins(address owner) external view returns (address operator); /// @notice returns the last time the reward was modified or periodFinish if the reward has ended function lastTimeRewardApplicable() external view returns (uint256 _ltra); function earned(address account) external view returns (uint256 _reward); /// @notice claims pending rebase rewards function getReward() external; function rewardPerToken() external view returns (uint256 _rewardPerToken); /// @notice deposits all xShadow in the caller's wallet function depositAll() external; /// @notice deposit a specified amount of xShadow function deposit(uint256 amount) external; /// @notice withdraw all xShadow function withdrawAll() external; /// @notice withdraw a specified amount of xShadow function withdraw(uint256 amount) external; /// @notice check for admin perms /// @param operator the address to check /// @param owner the owner to check against for permissions function isAdminFor( address operator, address owner ) external view returns (bool approved); /// @notice check for delegations /// @param delegate the address to check /// @param owner the owner to check against for permissions function isDelegateFor( address delegate, address owner ) external view returns (bool approved); /// @notice rewards pending to be distributed for the reward period /// @return _left rewards remaining in the period function left() external view returns (uint256 _left); /// @notice used by the xShadow contract to notify pending rebases /// @param amount the amount of Shadow to be notified from exit penalties function notifyRewardAmount(uint256 amount) external; /// @notice the address of the xShadow token (staking/voting token) /// @return _xShadow the address function xShadow() external view returns (address _xShadow); /// @notice address of the voter contract /// @return _voter the voter contract address function voter() external view returns (address _voter); /// @notice returns the total voting power (equal to total supply in the VoteModule) /// @return _totalSupply the total voting power function totalSupply() external view returns (uint256 _totalSupply); /// @notice last time the rewards system was updated function lastUpdateTime() external view returns (uint256 _lastUpdateTime); /// @notice rewards per xShadow /// @return _rewardPerToken the amount of rewards per xShadow function rewardPerTokenStored() external view returns (uint256 _rewardPerToken); /// @notice when the 1800 seconds after notifying are up function periodFinish() external view returns (uint256 _periodFinish); /// @notice calculates the rewards per second /// @return _rewardRate the rewards distributed per second function rewardRate() external view returns (uint256 _rewardRate); /// @notice voting power /// @param user the address to check /// @return amount the staked balance function balanceOf(address user) external view returns (uint256 amount); /// @notice rewards per amount of xShadow's staked function userRewardPerTokenStored( address user ) external view returns (uint256 rewardPerToken); /// @notice the amount of rewards claimable for the user /// @param user the address of the user to check /// @return rewards the stored rewards function storedRewardsPerUser( address user ) external view returns (uint256 rewards); /// @notice delegate voting perms to another address /// @param delegatee who you delegate to /// @dev set address(0) to revoke function delegate(address delegatee) external; /// @notice give admin permissions to a another address /// @param operator the address to give administrative perms to /// @dev set address(0) to revoke function setAdmin(address operator) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.26; pragma abicoder v2; interface IVoter { error ACTIVE_GAUGE(address gauge); error GAUGE_INACTIVE(address gauge); error ALREADY_WHITELISTED(); error NOT_AUTHORIZED(address caller); error NOT_WHITELISTED(); error NOT_POOL(); error FORBIDDEN(); error NOT_INIT(); error LENGTH_MISMATCH(); error NO_GAUGE(); error ALREADY_DISTRIBUTED(address gauge, uint256 period); error ZERO_VOTE(address pool); error RATIO_TOO_HIGH(); error NOT_GT_ZERO(); error VOTE_UNSUCCESSFUL(); error UNAUTHORIZED(); 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 owner, uint256 weight, address indexed pool); event Abstained(address indexed owner, uint256 weight); event Deposit( address indexed lp, address indexed gauge, address indexed owner, uint256 amount ); event Withdraw( address indexed lp, address indexed gauge, address indexed owner, uint256 amount ); event NotifyReward( address indexed sender, address indexed reward, uint256 amount ); event DistributeReward( address indexed sender, address indexed gauge, uint256 amount ); event EmissionsRatio( address indexed caller, uint256 oldRatio, uint256 newRatio ); event NewGovernor(address indexed sender, address indexed governor); event Whitelisted(address indexed whitelister, address indexed token); event WhitelistRevoked( address indexed forbidder, address indexed token, bool status ); event CustomGaugeCreated( address indexed gauge, address creator, address indexed token ); event MainTickSpacingChanged( address indexed token0, address indexed token1, int24 indexed newMainTickSpacing ); /// @notice returns the address of the current governor /// @return _governor address of the governor function governor() external view returns (address _governor); /// @notice the address of the vote module /// @return _voteModule the vote module contract address function voteModule() external view returns (address _voteModule); /// @notice the address of the shadow launcher plugin to enable third party launchers /// @return _launcherPlugin the address of the plugin function launcherPlugin() external view returns (address _launcherPlugin); /// @notice distributes emissions from the minter to the voter /// @param amount the amount of tokens to notify function notifyRewardAmount(uint256 amount) external; /// @notice distributes the emissions for a specific gauge /// @param _gauge the gauge address function distribute(address _gauge) external; /// @notice returns the address of the gauge factory /// @param _gaugeFactory gauge factory address function gaugeFactory() external view returns (address _gaugeFactory); /// @notice returns the address of the feeDistributor factory /// @return _feeDistributorFactory feeDist factory address function feeDistributorFactory() external view returns (address _feeDistributorFactory); /// @notice returns the address of the minter contract /// @return _minter address of the minter function minter() external view returns (address _minter); /// @notice check if the gauge is active for governance use /// @param _gauge address of the gauge /// @return _trueOrFalse if the gauge is alive function isAlive(address _gauge) external view returns (bool _trueOrFalse); /// @notice allows the token to be paired with other whitelisted assets to participate in governance /// @param _token the address of the token function whitelist(address _token) external; /// @notice effectively disqualifies a token from governance /// @param _token the address of the token function revokeWhitelist(address _token) external; /// @notice returns if the address is a gauge /// @param gauge address of the gauge /// @return _trueOrFalse boolean if the address is a gauge function isGauge(address gauge) external view returns (bool _trueOrFalse); /// @notice disable a gauge from governance /// @param _gauge address of the gauge function killGauge(address _gauge) external; /// @notice re-activate a dead gauge /// @param _gauge address of the gauge function reviveGauge(address _gauge) external; /// @notice re-cast a tokenID's votes /// @param owner address of the owner function poke(address owner) external; /// @notice sets the main tickspacing of a token pairing /// @param tokenA address of tokenA /// @param tokenB address of tokenB /// @param tickSpacing the main tickspacing to set to function setMainTickSpacing( address tokenA, address tokenB, int24 tickSpacing ) external; /// @notice create a legacy-type gauge for an arbitrary token /// @param _token 'token' to be used /// @return _arbitraryGauge the address of the new custom gauge function createArbitraryGauge( address _token ) external returns (address _arbitraryGauge); /// @notice returns if the address is a fee distributor /// @param _feeDistributor address of the feeDist /// @return _trueOrFalse if the address is a fee distributor function isFeeDistributor( address _feeDistributor ) external view returns (bool _trueOrFalse); /// @notice returns the address of the emission's token /// @return _emissionsToken emissions token contract address function emissionsToken() external view returns (address _emissionsToken); /// @notice returns the address of the pool's gauge, if any /// @param _pool pool address /// @return _gauge gauge address function gaugeForPool(address _pool) external view returns (address _gauge); /// @notice returns the address of the pool's feeDistributor, if any /// @param _gauge address of the gauge /// @return _feeDistributor address of the pool's feedist function feeDistributorForGauge( address _gauge ) external view returns (address _feeDistributor); /// @notice returns the new toPool that was redirected fromPool /// @param fromPool address of the original pool /// @return toPool the address of the redirected pool function poolRedirect( address fromPool ) external view returns (address toPool); /// @notice returns the gauge address of a CL pool /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @param tickSpacing tickspacing of the pool /// @return gauge address of the gauge function gaugeForClPool( address tokenA, address tokenB, int24 tickSpacing ) external view returns (address gauge); /// @notice returns the array of all tickspacings for the tokenA/tokenB combination /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @return _ts array of all the tickspacings function tickSpacingsForPair( address tokenA, address tokenB ) external view returns (int24[] memory _ts); /// @notice returns the main tickspacing used in the gauge/governance process /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @return _ts the main tickspacing function mainTickSpacingForPair( address tokenA, address tokenB ) external view returns (int24 _ts); /// @notice returns the block.timestamp divided by 1 week in seconds /// @return period the period used for gauges function getPeriod() external view returns (uint256 period); /// @notice cast a vote to direct emissions to gauges and earn incentives /// @param owner address of the owner /// @param _pools the list of pools to vote on /// @param _weights an arbitrary weight per pool which will be normalized to 100% regardless of numerical inputs function vote( address owner, address[] calldata _pools, uint256[] calldata _weights ) external; /// @notice reset the vote of an address /// @param owner address of the owner function reset(address owner) external; /// @notice set the governor address /// @param _governor the new governor address function setGovernor(address _governor) external; /// @notice recover stuck emissions /// @param _gauge the gauge address /// @param _period the period function stuckEmissionsRecovery(address _gauge, uint256 _period) external; /// @notice whitelists extra rewards for a gauge /// @param _gauge the gauge to whitelist rewards to /// @param _reward the reward to whitelist function whitelistGaugeRewards(address _gauge, address _reward) external; /// @notice removes a reward from the gauge whitelist /// @param _gauge the gauge to remove the whitelist from /// @param _reward the reward to remove from the whitelist function removeGaugeRewardWhitelist( address _gauge, address _reward ) external; /// @notice creates a legacy gauge for the pool /// @param _pool pool's address /// @return _gauge address of the new gauge function createGauge(address _pool) external returns (address _gauge); /// @notice create a concentrated liquidity gauge /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param tickSpacing the tickspacing of the pool /// @return _clGauge address of the new gauge function createCLGauge( address tokenA, address tokenB, int24 tickSpacing ) external returns (address _clGauge); /// @notice claim concentrated liquidity gauge rewards for specific NFP token ids /// @param _gauges array of gauges /// @param _tokens two dimensional array for the tokens to claim /// @param _nfpTokenIds two dimensional array for the NFPs function claimClGaugeRewards( address[] calldata _gauges, address[][] calldata _tokens, uint256[][] calldata _nfpTokenIds ) external; /// @notice claim arbitrary rewards from specific feeDists /// @param owner address of the owner /// @param _feeDistributors address of the feeDists /// @param _tokens two dimensional array for the tokens to claim function claimIncentives( address owner, address[] calldata _feeDistributors, address[][] calldata _tokens ) external; /// @notice claim arbitrary rewards from specific gauges /// @param _gauges address of the gauges /// @param _tokens two dimensional array for the tokens to claim function claimRewards( address[] calldata _gauges, address[][] calldata _tokens ) external; /// @notice distribute emissions to a gauge for a specific period /// @param _gauge address of the gauge /// @param _period value of the period function distributeForPeriod(address _gauge, uint256 _period) external; /// @notice attempt distribution of emissions to all gauges function distributeAll() external; /// @notice distribute emissions to gauges by index /// @param startIndex start of the loop /// @param endIndex end of the loop function batchDistributeByIndex( uint256 startIndex, uint256 endIndex ) external; /// @notice returns the votes cast for a tokenID /// @param owner address of the owner /// @return votes an array of votes casted /// @return weights an array of the weights casted per pool function getVotes( address owner, uint256 period ) external view returns (address[] memory votes, uint256[] memory weights); /// @notice returns an array of all the gauges /// @return _gauges the array of gauges function getAllGauges() external view returns (address[] memory _gauges); /// @notice returns an array of all the feeDists /// @return _feeDistributors the array of feeDists function getAllFeeDistributors() external view returns (address[] memory _feeDistributors); /// @notice sets the xShadowRatio default function setGlobalRatio(uint256 _xRatio) external; /// @notice returns the array of all custom/arbitrary pools function getAllCustomPools() external view returns (address[] memory _customPools); /// @notice whether the token is whitelisted in governance function isWhitelisted(address _token) external view returns (bool _tf); /// @notice function for removing malicious or stuffed tokens function removeFeeDistributorReward( address _feeDist, address _token ) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.26; interface IFeeDistributor { error NOT_AUTHORIZED(); error ZERO_AMOUNT(); error NOT_FINALIZED(); error TOKEN_ERROR(address); event Deposit(address owner, uint256 amount); event Withdraw(address owner, uint256 amount); event NotifyReward( address indexed from, address indexed reward, uint256 amount, uint256 period ); event VotesIncentivized( address indexed from, address indexed reward, uint256 amount, uint256 period ); event ClaimRewards( uint256 period, address owner, address receiver, address reward, uint256 amount ); event RewardsRemoved(address _reward); /// @notice the address of the voter contract function voter() external view returns (address); /// @notice the address of the voting module function voteModule() external view returns (address); /// @notice the address of the feeRecipient contract function feeRecipient() external view returns (address); /// @notice the first period (epoch) that this contract was deployed function firstPeriod() external view returns (uint256); /// @notice balance of the voting power for a user /// @param owner the owner /// @return amount the amount of voting share function balanceOf(address owner) external view returns (uint256 amount); /// @notice total cumulative amount of voting power per epoch /// @param period the period to check /// @return weight the amount of total voting power function votes(uint256 period) external view returns (uint256 weight); /// @notice "internal" function gated to voter to add votes /// @dev internal notation inherited from original solidly, kept for continuity function _deposit(uint256 amount, address owner) external; /// @notice "internal" function gated to voter to remove votes /// @dev internal notation inherited from original solidly, kept for continuity function _withdraw(uint256 amount, address owner) external; /// @notice function to claim rewards on behalf of another /// @param owner owner's address /// @param tokens an array of the tokens function getRewardForOwner(address owner, address[] memory tokens) external; /// @notice function for sending fees directly to be claimable (in system where fees are distro'd through the week) /// @dev for lumpsum - this would operate similarly to incentivize /// @param token the address of the token to send for notifying /// @param amount the amount of token to send function notifyRewardAmount(address token, uint256 amount) external; /// @notice gives an array of reward tokens for the feedist /// @return _rewards array of rewards function getRewardTokens() external view returns (address[] memory _rewards); /// @notice shows the earned incentives in the feedist /// @param token the token address to check /// @param owner owner's address /// @return reward the amount earned/claimable function earned( address token, address owner ) external view returns (uint256 reward); /// @notice function to submit incentives to voters for the upcoming flip /// @param token the address of the token to send for incentivization /// @param amount the amount of token to send function incentivize(address token, uint256 amount) external; /// @notice get the rewards for a specific period /// @param owner owner's address function getPeriodReward( uint256 period, address owner, address token ) external; /// @notice get the fees and incentives function getReward(address owner, address[] memory tokens) external; /// @notice remove a reward from the set function removeReward(address _token) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IFeeDistributorFactory { function createFeeDistributor(address pairFees) external returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IGauge { error ZERO_AMOUNT(); error CANT_NOTIFY_STAKE(); error REWARD_TOO_HIGH(); error NOT_GREATER_THAN_REMAINING(uint256 amount, uint256 remaining); error TOKEN_ERROR(address token); error NOT_WHITELISTED(); error NOT_AUTHORIZED(); 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); /// @notice returns an array with all the addresses of the rewards /// @return _rewards array of addresses for rewards function rewardsList() external view returns (address[] memory _rewards); /// @notice number of different rewards the gauge has facilitated that are 'active' /// @return _length the number of individual rewards function rewardsListLength() external view returns (uint256 _length); /// @notice returns the last time the reward was modified or periodFinish if the reward has ended /// @param token address of the token /// @return ltra last time reward applicable function lastTimeRewardApplicable( address token ) external view returns (uint256 ltra); /// @notice displays the data struct of rewards for a token /// @param token the address of the token /// @return data rewards struct function rewardData( address token ) external view returns (Reward memory data); /// @notice calculates the amount of tokens earned for an address /// @param token address of the token to check /// @param account address to check /// @return _reward amount of token claimable function earned( address token, address account ) external view returns (uint256 _reward); /// @notice claims rewards (emissionsToken + any external LP Incentives) /// @param account the address to claim for /// @param tokens an array of the tokens to claim function getReward(address account, address[] calldata tokens) external; /// @notice calculates the token amounts earned per lp token /// @param token address of the token to check /// @return rpt reward per token function rewardPerToken(address token) external view returns (uint256 rpt); /// @notice deposit all LP tokens from msg.sender's wallet to the gauge function depositAll() external; /// @param recipient the address of who to deposit on behalf of /// @param amount the amount of LP tokens to withdraw function depositFor(address recipient, uint256 amount) external; /// @notice deposit LP tokens to the gauge /// @param amount the amount of LP tokens to withdraw function deposit(uint256 amount) external; /// @notice withdraws all fungible LP tokens from legacy gauges function withdrawAll() external; /// @notice withdraws fungible LP tokens from legacy gauges /// @param amount the amount of LP tokens to withdraw function withdraw(uint256 amount) external; /// @notice calculates how many tokens are left to be distributed /// @dev reduces per second /// @param token the address of the token function left(address token) external view returns (uint256); /// @notice add a reward to the whitelist /// @param _reward address of the reward function whitelistReward(address _reward) external; /// @notice remove rewards from the whitelist /// @param _reward address of the reward function removeRewardWhitelist(address _reward) external; /** * @notice amount must be greater than left() for the token, this is to prevent griefing attacks * @notice notifying rewards is completely permissionless * @notice if nobody registers for a newly added reward for the period it will remain in the contract indefinitely */ function notifyRewardAmount(address token, uint256 amount) external; struct Reward { /// @dev tokens per second uint256 rewardRate; /// @dev 7 days after start uint256 periodFinish; uint256 lastUpdateTime; uint256 rewardPerTokenStored; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IGaugeFactory { /// @notice create a legacy gauge for a specific pool /// @param pool the address of the pool /// @return newGauge is the address of the created gauge function createGauge(address pool) external returns (address newGauge); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.24; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVoter} from "./IVoter.sol"; interface IXShadow is IERC20 { struct VestPosition { /// @dev amount of xShadow uint256 amount; /// @dev start unix timestamp uint256 start; /// @dev start + MAX_VEST (end timestamp) uint256 maxEnd; /// @dev vest identifier (starting from 0) uint256 vestID; } error NOT_WHITELISTED(address); error NOT_MINTER(); error ZERO(); error NO_VEST(); error ALREADY_EXEMPT(); error NOT_EXEMPT(); error CANT_RESCUE(); error NO_CHANGE(); error ARRAY_LENGTHS(); error TOO_HIGH(); error VEST_OVERLAP(); 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 NewSlashingPenalty(uint256 penalty); event NewVest( address indexed user, uint256 indexed vestId, uint256 indexed amount ); event NewVestingTimes(uint256 min, uint256 max); event Converted(address indexed user, uint256); event Exemption(address indexed candidate, bool status, bool success); event XShadowRedeemed(address indexed user, uint256); event NewOperator(address indexed o, address indexed n); event Rebase(address indexed caller, uint256 amount); /// @notice returns info on a user's vests function vestInfo( address user, uint256 ) external view returns (uint256 amount, uint256 start, uint256 maxEnd, uint256 vestID); /// @notice address of the emissionsToken function SHADOW() external view returns (IERC20); /// @notice address of the voter function VOTER() external view returns (IVoter); function MINTER() external view returns (address); function ACCESS_HUB() external view returns (address); /// @notice address of the operator function operator() external view returns (address); /// @notice address of the VoteModule function VOTE_MODULE() external view returns (address); /// @notice max slashing amount function SLASHING_PENALTY() external view returns (uint256); /// @notice the minimum vesting length function MIN_VEST() external view returns (uint256); /// @notice the maximum vesting length function MAX_VEST() external view returns (uint256); function emissionsToken() external view returns (address); /// @notice the last period rebases were distributed function lastDistributedPeriod() external view returns (uint256); /// @notice amount of pvp rebase penalties accumulated pending to be distributed function pendingRebase() external view returns (uint256); /// @notice pauses the contract function pause() external; /// @notice unpauses the contract function unpause() external; /*****************************************************************/ // General use functions /*****************************************************************/ /// @dev mints xShadows for each emissionsToken. function convertEmissionsToken(uint256 _amount) external; /// @notice function called by the minter to send the rebases once a week function rebase() external; /** * @dev exit instantly with a penalty * @param _amount amount of xShadows to exit */ function exit(uint256 _amount) external; /// @dev vesting xShadows --> emissionToken functionality function createVest(uint256 _amount) external; /// @dev handles all situations regarding exiting vests function exitVest(uint256 _vestID) external; /*****************************************************************/ // Permissioned functions, timelock/operator gated /*****************************************************************/ /// @dev allows the operator to redeem collected xShadows function operatorRedeem(uint256 _amount) external; /// @dev allows rescue of any non-stake token function rescueTrappedTokens( address[] calldata _tokens, uint256[] calldata _amounts ) external; /// @notice migrates the operator to another contract function migrateOperator(address _operator) external; /// @notice set exemption status for an address function setExemption( address[] calldata _exemptee, bool[] calldata _exempt ) external; /*****************************************************************/ // Getter functions /*****************************************************************/ /// @notice returns the amount of SHADOW within the contract function getBalanceResiding() external view returns (uint256); /// @notice returns the total number of individual vests the user has function usersTotalVests( address _who ) external view returns (uint256 _numOfVests); /// @notice whether the address is exempt /// @param _who who to check /// @return _exempt whether it's exempt function isExempt(address _who) external view returns (bool _exempt); /// @notice returns the vest info for a user /// @param _who who to check /// @param _vestID vest ID to check /// @return VestPosition vest info function getVestInfo(address _who, uint256 _vestID) external view returns (VestPosition memory); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import {IPoolInitializer} from './IPoolInitializer.sol'; import {IPeripheryPayments} from './IPeripheryPayments.sol'; import {IPeripheryImmutableState} from './IPeripheryImmutableState.sol'; import {PoolAddress} from '../libraries/PoolAddress.sol'; import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import {IPeripheryErrors} from './IPeripheryErrors.sol'; /// @title Non-fungible token for positions /// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred /// and authorized. interface INonfungiblePositionManager is IPeripheryErrors, IPoolInitializer, IPeripheryPayments, IPeripheryImmutableState, IERC721, IERC721Metadata, IERC721Enumerable { /// @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 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 token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific pool /// @return tickSpacing The tickSpacing 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 ( address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; int24 tickSpacing; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } /// @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; }
// 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 IRamsesV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IRamsesV3Factory interface /// @return The contract address function factory() 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); }
// 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 IRamsesV3PoolState { /// @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 /// @return 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. /// @return observationIndex The index of the last oracle observation that was written, /// @return observationCardinality The current maximum number of observations stored in the pool, /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// @return 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 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 /// @return The liquidity at the current price of the pool function liquidity() external view returns (uint128); /// @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 /// @return liquidityNet how much liquidity changes when the pool price crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick from the current tick, /// @return 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, 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 function positions( bytes32 key ) external view returns ( uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @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 ); /// @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 function positionPeriodSecondsInRange( uint256 period, address owner, uint256 index, int24 tickLower, int24 tickUpper ) external view returns (uint256 periodSecondsInsideX96); }
// 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 IRamsesV3PoolDerivedState { /// @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 function observe( uint32[] calldata secondsAgos ) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @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. /// @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 secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside( int24 tickLower, int24 tickUpper ) external view returns (int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside); }
// 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 IRamsesV3PoolActions { /// @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 /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// 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 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, 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 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 /// @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 Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @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 IUniswapV3FlashCallback#uniswapV3FlashCallback /// @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 Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IRamsesV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees 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 Errors emitted by a pool /// @notice Contains all events emitted by the pool interface IRamsesV3PoolErrors { error LOK(); error TLU(); error TLM(); error TUM(); error AI(); error M0(); error M1(); error AS(); error IIA(); error L(); error F0(); error F1(); error SPL(); }
// 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 IRamsesV3PoolEvents { /// @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.7.5; pragma abicoder v2; /// @title Creates and initializes V3 Pools /// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that /// require the pool to exist. interface IPoolInitializer { /// @notice Creates a new pool if it does not exist, then initializes if not initialized /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool /// @param token0 The contract address of token0 of the pool /// @param token1 The contract address of token1 of the pool /// @param tickSpacing The tickSpacing of the v3 pool for the specified token pair /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary function createAndInitializePoolIfNecessary( address token0, address token1, int24 tickSpacing, uint160 sqrtPriceX96 ) external payable returns (address pool); }
// 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 Immutable state /// @notice Functions that return immutable state of the router interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 deployer function deployer() 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.5.0; /// @title Provides functions for deriving a pool address from the deployer, tokens, and the fee library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0x27c3e2ae1bcb368a6736910a5545ee0e77b18926879503a168ca167c0861fe56; error TokenOrder(); /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; int24 tickSpacing; } /// @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 tickSpacing The tickSpacing of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey(address tokenA, address tokenB, int24 tickSpacing) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, tickSpacing: tickSpacing}); } /// @notice Deterministically computes the pool address given the deployer and PoolKey /// @param deployer The Uniswap V3 deployer contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress(address deployer, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1, TokenOrder()); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex'ff', deployer, keccak256(abi.encodePacked(key.token0, key.token1, key.tickSpacing)), POOL_INIT_CODE_HASH ) ) ) ) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-721 compliant contract. */ interface IERC721 is IERC165 { /** * @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 ERC-721 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 ERC-721 * 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 address zero. * * 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 (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @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 v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @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: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Errors emitted by the NonFungiblePositionManager /// @notice Contains all events emitted by the NfpManager interface IPeripheryErrors { error InvalidTokenId(uint256 tokenId); error CheckSlippage(); error NotCleared(); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @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[ERC 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); }
{ "remappings": [ "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/", "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/", "forge-std/=dependencies/forge-std-1.9.4/src/", "permit2/=lib/permit2/", "@openzeppelin-3.4.2/=node_modules/@openzeppelin-3.4.2/", "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/", "@uniswap/=node_modules/@uniswap/", "base64-sol/=node_modules/base64-sol/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/", "hardhat/=node_modules/hardhat/", "solmate/=node_modules/solmate/" ], "optimizer": { "enabled": true, "runs": 100 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": true, "libraries": { "contracts/libraries/RewardClaimers.sol": { "RewardClaimers": "0x870462D78fa1a5C3D6bBb69bAaD72b97b5f3cB84" } } }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"ACTIVE_GAUGE","type":"error"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"ALREADY_DISTRIBUTED","type":"error"},{"inputs":[],"name":"ALREADY_WHITELISTED","type":"error"},{"inputs":[],"name":"FORBIDDEN","type":"error"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"GAUGE_INACTIVE","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"LENGTH_MISMATCH","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"NOT_AUTHORIZED","type":"error"},{"inputs":[],"name":"NOT_GT_ZERO","type":"error"},{"inputs":[],"name":"NOT_INIT","type":"error"},{"inputs":[],"name":"NOT_POOL","type":"error"},{"inputs":[],"name":"NOT_WHITELISTED","type":"error"},{"inputs":[],"name":"NO_GAUGE","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"RATIO_TOO_HIGH","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UNAUTHORIZED","type":"error"},{"inputs":[],"name":"VOTE_UNSUCCESSFUL","type":"error"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"ZERO_VOTE","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","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":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","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":"caller","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":"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":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"int24","name":"newMainTickSpacing","type":"int24"}],"name":"MainTickSpacingChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"governor","type":"address"}],"name":"NewGovernor","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":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"Voted","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":"WhitelistRevoked","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":true,"internalType":"address","name":"owner","type":"address"},{"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":"accessHub","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"batchDistributeByIndex","outputs":[],"stateMutability":"nonpayable","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":"owner","type":"address"},{"internalType":"address[]","name":"_feeDistributors","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"}],"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":"_token","type":"address"}],"name":"createArbitraryGauge","outputs":[{"internalType":"address","name":"_newGauge","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"createCLGauge","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":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"distributeForPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emissionsToken","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":"clGauge","type":"address"}],"name":"feeDistributorForClGauge","outputs":[{"internalType":"address","name":"feeDist","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"feeDistributorForGauge","outputs":[{"internalType":"address","name":"feeDistributor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipientFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"gaugeForClPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"gaugeForPool","outputs":[{"internalType":"address","name":"gauge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"gaugePeriodDistributed","outputs":[{"internalType":"bool","name":"distributed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"gaugeRewardsPerPeriod","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllCustomPools","outputs":[{"internalType":"address[]","name":"_customPools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllFeeDistributors","outputs":[{"internalType":"address[]","name":"_feeDistributors","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllGauges","outputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPeriod","outputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"getVotes","outputs":[{"internalType":"address[]","name":"votes","type":"address[]"},{"internalType":"uint256[]","name":"weights","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_accessHub","type":"address"},{"internalType":"address","name":"_emissionsToken","type":"address"},{"internalType":"address","name":"_legacyFactory","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":"_xShadow","type":"address"},{"internalType":"address","name":"_clFactory","type":"address"},{"internalType":"address","name":"_clGaugeFactory","type":"address"},{"internalType":"address","name":"_nfpManager","type":"address"},{"internalType":"address","name":"_feeRecipientFactory","type":"address"},{"internalType":"address","name":"_voteModule","type":"address"},{"internalType":"address","name":"_launcherPlugin","type":"address"}],"name":"initialize","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":"gauge","type":"address"}],"name":"isArbitraryGauge","outputs":[{"internalType":"bool","name":"arbitraryGauge","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isClGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDistributor","type":"address"}],"name":"isFeeDistributor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"isLegacyGauge","outputs":[{"internalType":"bool","name":"legacyGauge","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":"address","name":"gauge","type":"address"}],"name":"lastDistro","outputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launcherPlugin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legacyFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"mainTickSpacingForPair","outputs":[{"internalType":"int24","name":"","type":"int24"}],"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":"address","name":"user","type":"address"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fromPool","type":"address"}],"name":"poolRedirect","outputs":[{"internalType":"address","name":"toPool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"poolTotalVotesPerPeriod","outputs":[{"internalType":"uint256","name":"totalVotes","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDistributor","type":"address"},{"internalType":"address","name":"reward","type":"address"}],"name":"removeFeeDistributorReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_reward","type":"address"}],"name":"removeGaugeRewardWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"revokeWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xRatio","type":"uint256"}],"name":"setGlobalRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"setMainTickSpacing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"stuckEmissionsRecovery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"tickSpacingsForPair","outputs":[{"internalType":"int24[]","name":"","type":"int24[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"totalRewardPerPeriod","outputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"totalVotesPerPeriod","outputs":[{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userVotedPoolsPerPeriod","outputs":[{"internalType":"address","name":"pools","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"pool","type":"address"}],"name":"userVotesForPoolPerPeriod","outputs":[{"internalType":"uint256","name":"totalVote","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"userVotingPowerPerPeriod","outputs":[{"internalType":"uint256","name":"votingPower","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_reward","type":"address"}],"name":"whitelistGaugeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xShadow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60808060405234602b5760015f55600680546001600160a01b03191633179055615d6790816100308239f35b5f80fdfe60a0806040526004361015610012575f80fd5b5f905f3560e01c90816248a02714614ae95750806271cdfc1461483b578063060ce5a5146147fe57806306d6a1b2146147be57806307546172146147965780630880b7011461476c5780630c340a24146147445780630d52333c1461471c5780630f147632146146825780631703e5f9146146455780631d9c341e146145f55780631ed24195146145d55780632045be901461459557806320b1cb6f146144bc578063210ca05d14614493578063234823d7146143f3578063270a1b571461416f5780632da5347b14614146578063307f38fa146140a7578063346c440f146140645780633af32abf146140255780633c6b16ab14613f1c5780634256f5e714613ef3578063436596c414613b8957806348feb89b14613ac85780634f2bfe5b14613a9f578063528cfa9814613a815780635397401b14613a465780635824780d146138d957806359b57eb01461352d57806363453ae1146131b85780636b8ab97d146130eb5780637130262714612cde578063721053df14612c9557806377b325c114612c525780637904eeba14612c0f5780637bebe38114612be65780637f9e16e314612ba757806385caf28b14612b7e57806391c6438e14612b4557806393208a2b14612b1c578063942dfa1a14612abb5780639647d14114612a92578063986e471d14612a7457806398bbc3c714612a4b578063992a79331461273d5780639a61df89146127055780639b19251a1461264c5780639bbe33741461260b5780639c7f33151461255b5780639f06247b146123985780639f16daf914612323578063a5a645c1146122f9578063a5f4301e14611c10578063aa79979b14611bd5578063aed8ae9214611b77578063b1a997ac14611b52578063b616eef314611b13578063c42cf53514611a6f578063c61fece914611a01578063c946c5cc14611974578063d1cf58f2146111bb578063d32af6c114611192578063d36f072814611080578063e48bcc7d146109c7578063e4ff5c2f14610800578063e74f6166146107d7578063e7589b39146107ae578063eab37eec14610625578063eb9019d4146104dd578063eda1cb581461049c578063f55858b01461045b5763ffc0a01e1461033f575f80fd5b346103f45760403660031901126103f45780610359614b78565b610361614b8e565b9060018060a01b036006541633148015610447575b610381903390614cd4565b6001600160a01b0316808352602a602052604083205490919060ff161561040657813b1561040257604051639dfb338160e01b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e357505080f35b816103ed91614d24565b6103f45780f35b80fd5b6040513d84823e3d90fd5b5050fd5b813b1561040257604051630c96238f60e01b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e357505080f35b506007546001600160a01b03163314610376565b50346103f45760203660031901126103f4576020906001600160a01b03610480614b78565b168152601b8252604060018060a01b0391205416604051908152f35b50346103f45760203660031901126103f4576020906001600160a01b036104c1614b78565b168152602f8252604060018060a01b0391205416604051908152f35b50346103f45760403660031901126103f4576104f7614b78565b6024359060018060a01b031690818352601e6020526040832081845260205260408320926040518085602082975493848152019084526020842092845b81811061060357505061054992500385614d24565b6105538451614ef6565b91815b85518110156105ac57600190858452601d6020526040842083855260205260408420828060a01b03610588838a614f28565b5116838060a01b03165f5260205260405f20546105a58287614f28565b5201610556565b6105c6868585604051938493604085526040850190614b3c565b8381036020850152602080845192838152019301915b8181106105ea575050500390f35b82518452859450602093840193909201916001016105dc565b84546001600160a01b0316835260019485019489945060209093019201610534565b50346103f45760603660031901126103f4576004356001600160401b0381116107aa57610656903690600401614bba565b6024929192356001600160401b0381116107a657610678903690600401614bba565b6044949194356001600160401b0381116107a25761069a903690600401614bba565b95909173870462d78fa1a5c3d6bbb69baad72b97b5f3cb849360018060a01b03600a541695853b1561079e576107069392916106f49160405198637b36251560e11b8a5260048a0152608060248a01526084890191614db3565b86810360031901604488015291614e37565b90600319848303016064850152858252602082019560208160051b840101928287915b838310610749578880898181808b03818d5af480156103f7576103e35750f35b9091929394601f19828203018a526107618684614e03565b8083529091906001600160fb1b03811161079a5760206001938193829360051b809284830137010197019a019301919098939298610729565b8a80fd5b8780fd5b8480fd5b8280fd5b5080fd5b50346103f457806003193601126103f4576006546040516001600160a01b039091168152602090f35b50346103f457806003193601126103f4576008546040516001600160a01b039091168152602090f35b50346103f45761080f36614bea565b9082949593921515806109be575b156109af576001600160a01b0386163303610918575b61083c85614edf565b9561084a6040519788614d24565b858752601f1961085987614edf565b01366020890137845b8681101561089d57600581901b8501356001600160a01b038116908190036108995790600191610892828b614f28565b5201610862565b8680fd5b50908685926108ab81615563565b6108b485614edf565b926108c26040519485614d24565b858452602084019560051b81019036821161091457955b8187106109045750506108ed939450615809565b156108f55780f35b63fa0e305360e01b8152600490fd5b86358152602096870196016108d9565b8580fd5b600e5460405163c23a246560e01b81529060209082906001600160a01b031681806109478c3360048401614ec5565b03915afa80156109a4578590610969575b61096491503390614cd4565b610833565b506020813d60201161099c575b8161098360209383614d24565b810103126107a25761099761096491614d6d565b610958565b3d9150610976565b6040513d87823e3d90fd5b63899ef10d60e01b8452600484fd5b5081851461081d565b50346103f4576109ff6109d936614c4f565b929160018060a01b03600654163314801561106c575b6109fa903390614cd4565b615158565b6001600160a01b03918216808552602d602090815260408087208585165f908152908352818120600288900b82529092529020549092169290831561105d57838552601a6020908152604080872054868852602e835281882054868952602c84528289206001600160a01b038681165f818152928752858320805462ffffff191662ffffff9a909a1699909917909855888b52602b8652848b2097825296909452919092205494918416931691865b858110610c7e578787808252602860205260ff60408320541615610ad0575080f35b6006546001600160a01b031633148015610c6a575b610af0903390614cd4565b8082526028602052610b0a8160ff60408520541615614cfc565b808252602860205260408220600160ff19825416179055808252602660205260ff604083205416610b70575b62093a804204818352602560205260408320557fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa8280a280f35b808252601a60205281602460018060a01b03604083205416602060018060a01b03600b5416604051938480926308a3a6ad60e11b82528560048301525afa918215610c5f578392610c23575b506001546001600160a01b031691823b15610c1f57610bf49284928360405180968195829463270401cb60e01b845260048401614ec5565b03925af180156103f757610c0a575b5050610b36565b81610c1491614d24565b6107aa578183610c03565b8380fd5b9091506020813d602011610c57575b81610c3f60209383614d24565b810103126107a657610c5090614d59565b9085610bbc565b3d9150610c32565b6040513d85823e3d90fd5b506007546001600160a01b03163314610ae5565b828852602b6020526040882060018060a01b0383165f52602052610ca58160405f20615138565b9054848a52602d60209081526040808c206001600160a01b038781165f90815291845282822060039690961b9490941c60020b815293825292839020548216808c52601a8252838c20549092168b52602f8152828b2080546001600160a01b03199081168a17909155828c52601b909152918a2080549092168617909155908782141580611047575b610d3d575b6001915001610aae565b6006546001600160a01b031633148015611033575b610d5d903390614cd4565b818952602860205260ff60408a2054161561101f5781895260286020526040892060ff198154169055818952601a60205260018060a01b0360408a20541691808a52602660205260ff60408b205416610f03575b808a52602560205260408a20549262093a804204908b80955b83811115610e8f5750505083610e02575b60019350818b52602560205260408b20555f516020615cd25f395f51905f528a80a2610d33565b6020610e3c9460018060a01b03600254168d60018060a01b03600754169060405180998195829463a9059cbb60e01b845260048401614d7a565b03925af18015610e845715610ddb576020843d8211610e7c575b81610e6360209383614d24565b8101031261079a57610e76600194614d6d565b50610ddb565b3d9150610e56565b6040513d8d823e3d90fd5b60ff60408387610eb59552602460205281812084825260205220541615610ebc57614eb7565b8c90610dca565b8d610ed1610eca83866151a5565b8099614e96565b97610edd575b50614eb7565b808660409252602460205281812083825260205220600160ff198254161790558d610ed7565b6001546040516341d93a7960e11b81528b916001600160a01b031690602081600481855afa908115610c5f578391610fe6575b5015610fac57506001546007546001600160a01b039081169116803b156107a65760405163270401cb60e01b81529183918391829084908290610f7d908c60048401614ec5565b03925af180156103f757610f93575b5050610db1565b81610f9d91614d24565b610fa857895f610f8c565b8980fd5b803b156107aa5760405163270401cb60e01b81526001600160a01b03861660048201525f6024820152908290829081838160448101610f7d565b90506020813d8211611017575b8161100060209383614d24565b810103126107a65761101190614d6d565b5f610f36565b3d9150610ff3565b63c5491e0f60e01b89526004829052602489fd5b506007546001600160a01b03163314610d52565b50818952602860205260ff60408a205416610d2e565b6302e6882d60e41b8552600485fd5b506007546001600160a01b031633146109ef565b50346103f45760403660031901126103f45761109a614b78565b906110a3614b8e565b6006546001600160a01b03163314801561117e575b6110c3903390614cd4565b6001600160a01b03168082526027602052604082205460ff161561116f576001600160a01b03909216808252602a60205260408220549192839260ff161561113a57813b156104025782916024839260405194859384926339ced26d60e21b845260048401525af180156103f7576103e357505080f35b813b1561040257829160248392604051948593849263db89461b60e01b845260048401525af180156103f7576103e357505080f35b635ffde35f60e11b8252600482fd5b506007546001600160a01b031633146110b8565b50346103f457806003193601126103f457600b546040516001600160a01b039091168152602090f35b50346103f4576111ca36614c4f565b6008546040516328af8d0b60e01b81526001600160a01b038581166004830181905285821660248401819052600286900b6044850181905291989791969491939290911691602081606481865afa90811561196957889161192f575b506001600160a01b031697881561192057604051633850c7bd60e01b815260e0816004818d5afa908115611915578991611880575b501561187157888852601960208181526040808b20548c8c5292909152892054611292916001600160a01b03918216911615614cfc565b8752602760205260ff604088205416908161185b575b501561184c576020600491604051928380926331056e5760e21b82525afa908115611712579086939291849161180a575b5060048054604051630317318f60e11b81526001600160a01b03938416928101929092529094602092869260249284929091165af19283156117125790869493929185936117c7575b506009546040516352fa180f60e11b8152600481018a90529760209189916024918391906001600160a01b03165af19687156109a457859761178b575b5060025460405163095ea7b360e01b81526001600160a01b03988916600482018190525f196024830152989091602091839160449183918b91165af1801561171257611754575b50600d5460405163095ea7b360e01b8152600481018990525f19602482015290602090829060449082908a906001600160a01b03165af180156117125761171d575b50868552602e6020908152604080872080546001600160a01b03199081166001600160a01b038816179091558a885260198352818820805482168b179055898852601a835281882080549091168b1790558887526025909152852062093a804204905561145488615c31565b5061145e87615be1565b506114716001600160a01b038416615c81565b50868552602a60205260408520805460ff19166001179055873b156107a257604051637b7d549d60e01b81528581600481838d5af18015611712579086916116fd575b5050906114e29188885f516020615d125f395f51905f52604051806114da893383614ec5565b0390a3615158565b919060018060a01b031692838552602b6020526040852060018060a01b0384165f5260205260405f20805490600160401b8210156116e9579861152e8260209b60018c95018155615138565b815462ffffff86811660039390931b92831b921b1916179055858752602d8a5260408088206001600160a01b0387165f818152918d528282208b83528d5282822080546001600160a01b03191686179055888a52602c8d52828a209082528c52205460020b8061163957505050838552602c885260408086206001600160a01b039485165f818152918b5290829020805462ffffff191662ffffff9490941693909317909255878652601b89528086208054939094166001600160a01b031990931692909217909255858452602887528320805460ff19166001179055917fb014c0b8ac335752818c30cf2b458d2ba97dc0f0743e9e04f9f72832f438f4779080a45b604051908152f35b935093915095505f516020615cd25f395f51905f5294936116663360018060a01b03600754163314614cd4565b8452602d885260408085206001600160a01b039283165f908152908a5281812060029490940b815292895291829020548116808552601a895282852054938552602f895282852080546001600160a01b03199081169584169590951790558452602e885281842054868552601b89529184208054909316911617905580a2611631565b634e487b7160e01b87526041600452602487fd5b8161170791614d24565b6107a257845f6114b4565b6040513d88823e3d90fd5b6020813d60201161174c575b8161173660209383614d24565b810103126109145761174790614d6d565b6113e8565b3d9150611729565b6020813d602011611783575b8161176d60209383614d24565b810103126109145761177e90614d6d565b6113a6565b3d9150611760565b9096506020813d6020116117bf575b816117a760209383614d24565b810103126107a2576117b890614d59565b955f61135f565b3d915061179a565b9192509293506020813d602011611802575b816117e660209383614d24565b8101031261091457906117fb86949392614d59565b915f611322565b3d91506117d9565b91929350506020813d602011611844575b8161182860209383614d24565b810103126109145790602061183e879493614d59565b906112d9565b3d915061181b565b635ffde35f60e11b8652600486fd5b8752506027602052604086205460ff165f6112a8565b6359b186bf60e11b8852600488fd5b905060e0813d60e01161190d575b8161189b60e09383614d24565b810103126119095780516001600160a01b038116036119095760208101518060020b03611909576118ce60408201615129565b506118db60608201615129565b506118e860808201615129565b5060a081015160ff8116036119095760c06119039101614d6d565b5f61125b565b8880fd5b3d915061188e565b6040513d8b823e3d90fd5b630cc15fbb60e11b8852600488fd5b90506020813d602011611961575b8161194a60209383614d24565b8101031261079e5761195b90614d59565b5f611226565b3d915061193d565b6040513d8a823e3d90fd5b50346103f457806003193601126103f45760405160158054808352908352909160208301917f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915b8181106119eb576119e7856119d381870382614d24565b604051918291602083526020830190614b3c565b0390f35b82548452602090930192600192830192016119bc565b50346103f45760603660031901126103f457611a1b614b78565b6001600160a01b03168152601e6020908152604080832060243584529091528120805460443592908310156103f4576020611a568484614cbf565b905460405160039290921b1c6001600160a01b03168152f35b50346103f45760203660031901126103f457611a89614b78565b6006546001600160a01b031633148015611aff575b611aa9903390614cd4565b6007546001600160a01b03918216918116829003611ac5578280f35b6001600160a01b0319168117600755337f1ba669d4a78521f2ad26e8e0fcbcdd626a63f34d68f326bc232a3abe2a5d042a8380a35f808280f35b506007546001600160a01b03163314611a9e565b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03611b3e614b78565b168152602684522054166040519015158152f35b50346103f45760203660031901126103f457611b74611b6f614b78565b614f3c565b80f35b50346103f45760603660031901126103f4576040611b93614b78565b91611b9c614ba4565b9260018060a01b03168152601d6020528181206024358252602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346103f45760203660031901126103f4576020906040906001600160a01b03611bfd614b78565b1681526016835220541515604051908152f35b50346103f45760203660031901126103f457611c2a614b78565b6001600160a01b0380821680845260196020818152604080872054848852929091528520549394939192611c62928116911615614cfc565b60015460405163e5e31b1360e01b81526004810183905290602090829060249082906001600160a01b03165afa908115610c5f5783916122bf575b50156122b05760405163392f37e960e01b815260e081600481855afa908115610c5f5783908492612258575b506001600160a01b031683526027602052604083205460ff169081612239575b501561116f57818093602060018060a01b03600b5416602460405180958193631fb45e3160e01b83528860048401525af191821561222e5784926121f2575b5060018060a01b03600454169060405192630317318f60e11b84526020846024818960018060a01b038616978860048401525af19384156117125786946121b6575b50823b156109145760405163189acdbd60e31b815286816024818360018060a01b038a16988960048401525af190811561214c5787916121a1575b50506001546001600160a01b0316803b156108995760405163270401cb60e01b81529187918391829084908290611de0908960048401614ec5565b03925af190811561171257869161218c575b5050604051636373ea6960e01b8152602081600481885afa908115611712578691612157575b5015612082575b506003546040516352fa180f60e11b8152600481018590529460209186916024918391906001600160a01b03165af19384156109a4578594612046575b5060025460405163095ea7b360e01b81526001600160a01b03958616600482018190525f196024830152959091602091839160449183918b91165af180156117125761200f575b50600d5460405163095ea7b360e01b8152600481018690525f19602482015290602090829060449082908a906001600160a01b03165af1801561171257611fb6575b50838552601b6020908152604080872080546001600160a01b03199081168517909155858852601983528188208054821688179055868852601a8352818820805490911686179055858752602882528620805460ff191660011790559484925f516020615d125f395f51905f5292611fab9290611f7590611f6588615c31565b50611f6f87615be1565b50615c81565b508481526026885260408120600160ff19825416179055604062093a8042049186815260258a5220556040519182913383614ec5565b0390a3604051908152f35b6020813d602011612007575b81611fcf60209383614d24565b81010312610914578492602096611f755f516020615d125f395f51905f5294611ffa611fab95614d6d565b5094505096509250611ee5565b3d9150611fc2565b6020813d60201161203e575b8161202860209383614d24565b810103126109145761203990614d6d565b611ea3565b3d915061201b565b9093506020813d60201161207a575b8161206260209383614d24565b810103126107a25761207390614d59565b925f611e5c565b3d9150612055565b600154604051636373ea6960e01b81526001600160a01b039091169190602081600481865afa90811561214c578791612113575b50823b15610899576120e19287928360405180968195829463203e180f60e11b845260048401614d7a565b03925af19081156109a45785916120f9575b50611e1f565b8161210391614d24565b61210e57835f6120f3565b505050fd5b9650506020863d602011612144575b8161212f60209383614d24565b81010312612140578695515f6120b6565b5f80fd5b3d9150612122565b6040513d89823e3d90fd5b9550506020853d602011612184575b8161217360209383614d24565b81010312612140578594515f611e18565b3d9150612166565b8161219691614d24565b6107a257845f611df2565b816121ab91614d24565b61091457855f611da5565b9093506020813d6020116121ea575b816121d260209383614d24565b81010312610914576121e390614d59565b925f611d6a565b3d91506121c5565b9091506020813d602011612226575b8161220e60209383614d24565b8101031261210e5761221f90614d59565b905f611d28565b3d9150612201565b6040513d86823e3d90fd5b6001600160a01b03168352506027602052604082205460ff165f611ce9565b91505060e0813d60e0116122a8575b8161227460e09383614d24565b810103126107a65761228860808201614d6d565b506122a160c061229a60a08401614d59565b9201614d59565b905f611cc9565b3d9150612267565b630cc15fbb60e11b8252600482fd5b90506020813d6020116122f1575b816122da60209383614d24565b810103126107a6576122eb90614d6d565b5f611c9d565b3d91506122cd565b50346103f45760203660031901126103f45760406020916004358152602283522054604051908152f35b50346103f457806003193601126103f45760405160178054808352908352909160208301917fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c15915b818110612382576119e7856119d381870382614d24565b825484526020909301926001928301920161236b565b50346103f45760203660031901126103f4576123b2614b78565b6006546001600160a01b031633148015612547575b6123d2903390614cd4565b6001600160a01b0381168083526028602052604083205490916123f89160ff1615614cfc565b808252602860205260408220600160ff19825416179055808252602660205260ff60408320541661245d5762093a804204818352602560205260408320557fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa8280a280f35b808252601a60205281602460018060a01b03604083205416602060018060a01b03600b5416604051938480926308a3a6ad60e11b82528560048301525afa918215610c5f57839261250b575b506001546001600160a01b031691823b15610c1f576124e19284928360405180968195829463270401cb60e01b845260048401614ec5565b03925af180156103f7576124f6575050610b36565b8161250091614d24565b6107aa57815f610c03565b9091506020813d60201161253f575b8161252760209383614d24565b810103126107a65761253890614d59565b905f6124a9565b3d915061251a565b506007546001600160a01b031633146123c7565b50346103f45760203660031901126103f457612575614b78565b6006546001600160a01b0316331480156125f7575b612595903390614cd4565b6001600160a01b03168082526027602052604082205460ff161561116f5780825260276020526040822060ff198154169055604051600181527f85abc05b04dbd37a6324d72db47d565d98bfa5cafc40ba85ff9747c857cc466160203392a380f35b506007546001600160a01b0316331461258a565b50346103f45760203660031901126103f4576020906001600160a01b03612630614b78565b168152602e8252604060018060a01b0391205416604051908152f35b50346103f45760203660031901126103f457612666614b78565b6006546001600160a01b0316331480156126f1575b612686903390614cd4565b6001600160a01b03168082526027602052604082205460ff166126e257808252602760205260408220805460ff19166001179055337f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de8380a380f35b6350013e0f60e11b8252600482fd5b506007546001600160a01b0316331461267b565b50346103f45760203660031901126103f4576020906040906001600160a01b0361272d614b78565b1681528280522054604051908152f35b50346103f45760203660031901126103f457612757614b78565b6006546001600160a01b031633148015612a37575b612777903390614cd4565b6001600160a01b03168082526028602052604082205460ff1615612a255780825260286020526040822060ff198154169055808252601a60205260018060a01b03604083205416818352602660205260ff60408420541661290c575b8183526025602052604083205462093a8042049184915b8381111561289f5750508061281c575b50818352602560205260408320555f516020615cd25f395f51905f528280a280f35b60025460075460405163a9059cbb60e01b81529260209284926001600160a01b039182169284928a9284926128579290911660048401614d7a565b03925af1801561222e57156127fa576020813d602011612897575b8161287f60209383614d24565b81010312610c1f5761289090614d6d565b505f6127fa565b3d9150612872565b6128c79085875260246020526040872081885260205260ff604088205416156128cc57614eb7565b6127ea565b6128e06128d982856151a5565b8095614e96565b9315614eb75785875260246020526040872081885260205260408720600160ff19825416179055614eb7565b6001546040516341d93a7960e11b815284916001600160a01b031690602081600481855afa908115610c5f5783916129eb575b50156129b157506001546007546001600160a01b039081169116803b156107a65760405163270401cb60e01b81529183918391829084908290612986908a60048401614ec5565b03925af180156103f75761299c575b50506127d3565b816129a691614d24565b6107a657825f612995565b803b156107aa5760405163270401cb60e01b81526001600160a01b03841660048201525f6024820152908290829081838160448101612986565b90506020813d602011612a1d575b81612a0660209383614d24565b810103126107a657612a1790614d6d565b5f61293f565b3d91506129f9565b63c5491e0f60e01b8252600452602490fd5b506007546001600160a01b0316331461276c565b50346103f457806003193601126103f457600a546040516001600160a01b039091168152602090f35b50346103f457806003193601126103f4576020601054604051908152f35b50346103f457806003193601126103f4576004546040516001600160a01b039091168152602090f35b50346103f457612ad7906040612ad036614c4f565b9491615158565b929060018060a01b03168152602d602052209060018060a01b03165f5260205260405f209060020b5f52602052602060405f2060018060a01b03905416604051908152f35b50346103f457806003193601126103f457600f546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f4576020906040906001600160a01b03612b6d614b78565b168152602583522054604051908152f35b50346103f457806003193601126103f457600e546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03612bd2614b78565b168152602984522054166040519015158152f35b50346103f457806003193601126103f4576009546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f4576020906040906001600160a01b03612c37614b78565b168152601f8352818120602435825283522054604051908152f35b50346103f45760403660031901126103f4576020906040906001600160a01b03612c7a614b78565b16815260238352818120602435825283522054604051908152f35b50346103f45760403660031901126103f45760209060ff906040906001600160a01b03612cc0614b78565b16815260248452818120602435825284522054166040519015158152f35b50346103f4576101c03660031901126103f457612cf9614b78565b90612d02614b8e565b91612d0b614ba4565b60643593906001600160a01b0385168503610c1f57608435916001600160a01b03831683036107a25760a435916001600160a01b03831683036109145760c435916001600160a01b03831683036108995760e435946001600160a01b038616860361079e5761010435936001600160a01b0385168503611909576101243560808190526001600160a01b03811690036119095761014435956001600160a01b0387168703610fa85761016435926001600160a01b038416840361079a5761018435946001600160a01b03861686036130e7576101a435966001600160a01b03881688036130e3575f516020615cf25f395f51905f52549b6001600160401b038d16158d816130d3575b6001600160401b031660011490816130c9575b1590816130c0575b506130b15760018d6001600160401b031916175f516020615cf25f395f51905f525560ff8d60401c1615613085575b60065490336001600160a01b03831603613076576001600160a01b03199182166001600160a01b03918216176006556001805483169382169390931790925560028054821693831693841790556003805482169f83169f909f17909e55600480548f1693821693909317909255600580548e1693831693909317909255600d80548d16828b16179055600780548d1693821693909317909255600b80548c1693831693909317909255600e80548b1693821693909317909255600f80548a169383169390931790925560088054891693821693909317909255608051600980548916918416919091179055600a80549097169190921617909455620f4240601081905560408051858152602081810193909352949586959293909260449287917fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d9190a260405163095ea7b360e01b81526001600160a01b0390911660048201525f1960248201529485928391905af18015610c5f5761303c575b60ff915060401c1615612fe95780f35b60ff60401b195f516020615cf25f395f51905f5254165f516020615cf25f395f51905f52557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a180f35b6020823d60201161306e575b8161305560209383614d24565b810103126107a65761306860ff92614d6d565b50612fd9565b3d9150613048565b63075fd2b160e01b8f5260048ffd5b68ffffffffffffffffff198d1668010000000000000001175f516020615cf25f395f51905f5255612e5e565b63f92ee8a960e01b8e5260048efd5b9050155f612e2f565b303b159150612e27565b604081901c60ff16159150612e14565b8c80fd5b8b80fd5b50346103f45760203660031901126103f457613105614b78565b6001600160a01b038116330361311f575b611b7490615563565b600e5460405163c23a246560e01b8152919060209083906001600160a01b0316818061314f863360048401614ec5565b03915afa918215610c5f578392613177575b50613170611b74923390614cd4565b9050613116565b91506020823d6020116131b0575b8161319260209383614d24565b810103126107a6576131706131a9611b7493614d6d565b9250613161565b3d9150613185565b50346103f45760203660031901126103f4576131d2614b78565b6131da615545565b60055460405163541b13ef60e11b8152906020908290600490829087906001600160a01b03165af18015610c5f576134fe575b506001600160a01b0381811680845260256020908152604080862054838752601a90925285205462093a8042049492931691600182018083116134ea579185918794935b838111156134b057505003613274575b5052602560205260408220556001815580f35b828252602a602052604082205460ff161561339457803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f57839161337f575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f578391613345575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f757613330575b50505b825f613261565b8161333a91614d24565b6107a657825f613326565b90506020813d602011613377575b8161336060209383614d24565b810103126107a65761337190614d59565b5f6132ea565b3d9150613353565b8161338991614d24565b6107aa57815f6132b4565b828252602660205260ff6040832054166133b0575b5050613329565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f57839161349b575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f7578291613461575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f757156133a9578161345691614d24565b6107a657825f6133a9565b90506020813d602011613493575b8161347c60209383614d24565b810103126107aa5761348d90614d59565b5f613418565b3d915061346f565b816134a591614d24565b6107aa57815f6133db565b9092508394506134d6816134c8816134df95976151a5565b6134d0615545565b85615239565b60018855614eb7565b918591879493613251565b634e487b7160e01b87526011600452602487fd5b6020813d602011613525575b8161351760209383614d24565b81010312612140575161320d565b3d915061350a565b50346103f45760403660031901126103f4576024356015548082116138d1575b5062093a8042046004355b828110613563578380f35b61356c81614c93565b905460039190911b1c6001600160a01b031690613587615545565b60055460405163541b13ef60e11b815290602090829060049082908a906001600160a01b03165af18015611712576138a3575b5081855260256020908152604080872054848852601a9092528620546001600160a01b0316906001810180821161388f5787929186915b8281111561385c57500361361a575b509160019252602560205282604086205581855501613558565b838252602a602052604082205460ff161561373e57803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f578391613729575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f5783916136f0575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f7576136db575b50506001915b9150845f613600565b816136e591614d24565b6107a257845f6136cc565b90506020813d8211613721575b8161370a60209383614d24565b810103126107a65761371b90614d59565b5f613690565b3d91506136fd565b8161373391614d24565b6107aa57815f61365a565b838252602660205260ff60408320541661375d575b50506001916136d2565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f578391613847575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f757829161380e575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f75715613753578161380391614d24565b6107a257845f613753565b90506020813d821161383f575b8161382860209383614d24565b810103126107aa5761383990614d59565b5f6137c5565b3d915061381b565b8161385191614d24565b6107aa57815f613788565b61388791925061387e8161387081876151a5565b613878615545565b89615239565b60018555614eb7565b9086916135f1565b634e487b7160e01b88526011600452602488fd5b6020813d82116138c9575b816138bb60209383614d24565b8101031261214057516135ba565b3d91506138ae565b90505f61354d565b50346103f45760403660031901126103f4576138f3614b78565b6024359060018060a01b036006541633148015613a32575b613916903390614cd4565b6001600160a01b03811680845260286020526040842054909161393c9160ff1615614cfc565b80835260246020526040832082845260205260ff6040842054161561395f578280f35b808352601a60205260408320546139809083906001600160a01b03166151a5565b8061398a57508280f35b60025460075460405163a9059cbb60e01b81529260209284926001600160a01b039182169284928a9284926139c59290911660048401614d7a565b03925af1801561222e576139fb575b50825260246020526040822090825260205260408120600160ff198254161790555f808280f35b6020813d602011613a2a575b81613a1460209383614d24565b81010312610c1f57613a2590614d6d565b6139d4565b3d9150613a07565b506007546001600160a01b0316331461390b565b50346103f45760203660031901126103f4576020906040906001600160a01b03613a6e614b78565b1681526018835220541515604051908152f35b50346103f457806003193601126103f4576020604051620f42408152f35b50346103f457806003193601126103f457600c546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f45780613ae3614b78565b60055460405163541b13ef60e11b8152926024359291602091859160049183916001600160a01b03165af1801561222e57613b56575b6001600160a01b038181168552601a6020526040852054613b4f9450613b41918491166151a5565b90613b4a615545565b615239565b6001815580f35b6020833d602011613b81575b81613b6f60209383614d24565b8101031261214057613b4f9250613b19565b3d9150613b62565b50346103f457806003193601126103f45760155462093a804204825b828110613bb0578380f35b613bb981614c93565b905460039190911b1c6001600160a01b031690613bd4615545565b60055460405163541b13ef60e11b815290602090829060049082908a906001600160a01b03165af1801561171257613ec5575b5081855260256020908152604080872054848852601a9092528620546001600160a01b0316906001810180821161388f5787929186915b82811115613ea9575003613c67575b509160019252602560205282604086205581855501613ba5565b838252602a602052604082205460ff1615613d8b57803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f578391613d76575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f578391613d3d575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f757613d28575b50506001915b9150845f613c4d565b81613d3291614d24565b6107a257845f613d19565b90506020813d8211613d6e575b81613d5760209383614d24565b810103126107a657613d6890614d59565b5f613cdd565b3d9150613d4a565b81613d8091614d24565b6107aa57815f613ca7565b838252602660205260ff604083205416613daa575b5050600191613d1f565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f578391613e94575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f7578291613e5b575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f75715613da05781613e5091614d24565b6107a257845f613da0565b90506020813d8211613e8c575b81613e7560209383614d24565b810103126107aa57613e8690614d59565b5f613e12565b3d9150613e68565b81613e9e91614d24565b6107aa57815f613dd5565b613ebd91925061387e8161387081876151a5565b908691613c3e565b6020813d8211613eeb575b81613edd60209383614d24565b810103126121405751613c07565b3d9150613ed0565b50346103f457806003193601126103f457600d546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f45760055460043590613f4b9033906001600160a01b03168114614cd4565b6002546040516323b872dd60e01b815233600482015230602482015260448101839052906020908290606490829087906001600160a01b03165af18015610c5f57613fee575b5062093a8042048252602160205260408220613fae828254614e96565b90556002546040519182526001600160a01b03169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082690602090a380f35b6020813d60201161401d575b8161400760209383614d24565b810103126107a65761401890614d6d565b613f91565b3d9150613ffa565b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03614050614b78565b168152602784522054166040519015158152f35b50346103f45760403660031901126103f4576020906040906001600160a01b0361408c614b78565b168152601c8352818120602435825283522054604051908152f35b50346103f457806140b736614bea565b90929373870462d78fa1a5c3d6bbb69baad72b97b5f3cb849160018060a01b03600c541690833b1561079e57879561413591614123604051998a988997889763e55c539160e01b8952600489015260018060a01b03166024880152608060448801526084870191614db3565b84810360031901606486015291614e37565b03915af480156103f7576103e35750f35b50346103f457806003193601126103f4576001546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f45761419a61418c614b78565b614194614b8e565b90615158565b9060018060a01b03168252602b602052604082209060018060a01b03165f5260205260405f20604051808160208454928381520180948652602086209286905b80600983011061436457614243945491818110614350575b818110614339575b818110614322575b81811061430b575b8181106142f4575b8181106142dd575b8181106142c6575b8181106142af575b818110614298575b10614287575b509392930383614d24565b604051928392602084019060208552518091526040840192915b81811061426b575050500390f35b825160020b84528594506020938401939092019160010161425d565b60d81c60020b81526020015f614238565b9260206001918460c01c60020b8152019301614232565b9260206001918460a81c60020b815201930161422a565b9260206001918460901c60020b8152019301614222565b9260206001918460781c60020b815201930161421a565b9260206001918460601c60020b8152019301614212565b9260206001918460481c60020b815201930161420a565b9260206001918460301c60020b8152019301614202565b9260206001918460181c60020b81520193016141fa565b9260206001918460020b81520193016141f2565b91600a91935061014060019186548060020b82528060181c60020b60208301528060301c60020b60408301528060481c60020b60608301528060601c60020b60808301528060781c60020b60a08301528060901c60020b60c08301528060a81c60020b60e08301528060c01c60020b61010083015260d81c60020b6101208201520194019201849293916141da565b50346103f45760403660031901126103f4578061440e614b78565b614416614b8e565b9060018060a01b03600654163314801561447f575b614436903390614cd4565b6001600160a01b031690813b1561040257604051632935799f60e21b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e35750f35b506007546001600160a01b0316331461442b565b50346103f457806003193601126103f4576002546040516001600160a01b039091168152602090f35b5034612140576040366003190112612140576004356001600160401b038111612140576144ed903690600401614bba565b6024356001600160401b0381116121405761450c903690600401614bba565b9273870462d78fa1a5c3d6bbb69baad72b97b5f3cb8490813b15612140575f9361456a61455894604051978896879586956320b1cb6f60e01b8752604060048801526044870191614db3565b84810360031901602486015291614e37565b03915af4801561458a5761457c575080f35b61458891505f90614d24565b005b6040513d5f823e3d90fd5b34612140576020366003190112612140576001600160a01b036145b6614b78565b165f526019602052602060018060a01b0360405f205416604051908152f35b34612140575f36600319011261214057602062093a804204604051908152f35b346121405760403660031901126121405761461161418c614b78565b9060018060a01b03165f52602c60205260405f209060018060a01b03165f52602052602060405f205460020b604051908152f35b34612140576020366003190112612140576001600160a01b03614666614b78565b165f526028602052602060ff60405f2054166040519015158152f35b346121405760203660031901126121405760043560018060a01b036006541633148015614708575b6146b5903390614cd4565b620f424081116146f9576010546040519081528160208201527fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60403392a2601055005b6378d5606f60e01b5f5260045ffd5b506007546001600160a01b031633146146aa565b34612140575f366003190112612140576003546040516001600160a01b039091168152602090f35b34612140575f366003190112612140576007546040516001600160a01b039091168152602090f35b34612140576020366003190112612140576004355f526021602052602060405f2054604051908152f35b34612140575f366003190112612140576005546040516001600160a01b039091168152602090f35b34612140576020366003190112612140576001600160a01b036147df614b78565b165f52601a602052602060018060a01b0360405f205416604051908152f35b34612140576020366003190112612140576001600160a01b0361481f614b78565b165f52602a602052602060ff60405f2054166040519015158152f35b34612140576020366003190112612140575f614855614b78565b6006546001600160a01b031633148015614ad5575b614875903390614cd4565b6001600160a01b03908116808352601960208181526040808620548487529290915284205491926148aa928116911615614cfc565b6003546040516352fa180f60e11b8152600481018390529260209184916024918391906001600160a01b03165af190811561458a575f91614a9a575b60025460405163095ea7b360e01b81526001600160a01b03938416600482018190525f19602483015290945092602091859160449183915f91165af1801561458a57614a61575b600d5460405163095ea7b360e01b8152600481018490525f1960248201529350602090849060449082905f906001600160a01b03165af1801561458a57614a27575b5f81815260196020908152604080832080546001600160a01b03199081168717909155858452601a835281842080549091168517905560288252909120805460ff1916600117905592506149c281615b76565b506149cc82615be1565b50815f526029835260405f20600160ff1982541617905562093a804204825f526025845260405f2055817fda1e0b743f7b4dbe48508aac40b89bdf1a4f9e1803f9bf90203ce6990b99e5a684604051338152a3604051908152f35b6020833d602011614a59575b81614a4060209383614d24565b8101031261214057614a53602093614d6d565b5061496f565b3d9150614a33565b6020833d602011614a92575b81614a7a60209383614d24565b8101031261214057614a8c5f93614d6d565b5061492d565b3d9150614a6d565b90506020823d602011614acd575b81614ab560209383614d24565b8101031261214057614ac75f92614d59565b906148e6565b3d9150614aa8565b506007546001600160a01b0316331461486a565b34612140575f36600319011261214057601354808252602082019060135f5260205f20905f5b818110614b26576119e7856119d381870382614d24565b8254845260209093019260019283019201614b0f565b90602080835192838152019201905f5b818110614b595750505090565b82516001600160a01b0316845260209384019390920191600101614b4c565b600435906001600160a01b038216820361214057565b602435906001600160a01b038216820361214057565b604435906001600160a01b038216820361214057565b9181601f84011215612140578235916001600160401b038311612140576020808501948460051b01011161214057565b906060600319830112612140576004356001600160a01b038116810361214057916024356001600160401b0381116121405781614c2991600401614bba565b92909291604435906001600160401b03821161214057614c4b91600401614bba565b9091565b6060906003190112612140576004356001600160a01b038116810361214057906024356001600160a01b038116810361214057906044358060020b81036121405790565b601554811015614cab5760155f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b8054821015614cab575f5260205f2001905f90565b15614cdc5750565b632bc10c3360e01b5f9081526001600160a01b0391909116600452602490fd5b15614d045750565b63bbfeed9360e01b5f9081526001600160a01b0391909116600452602490fd5b90601f801991011681019081106001600160401b03821117614d4557604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361214057565b5190811515820361214057565b6001600160a01b039091168152602081019190915260400190565b8115614d9f570490565b634e487b7160e01b5f52601260045260245ffd5b916020908281520191905f905b808210614dcd5750505090565b91929091908335906001600160a01b0382168203612140576001600160a01b039091168152602090810193019160010190614dc0565b9035601e19823603018112156121405701602081359101916001600160401b038211612140578160051b3603831361214057565b90602083828152019260208260051b82010193835f925b848410614e5e5750505050505090565b909192939495602080614e86600193601f19868203018852614e808b88614e03565b90614db3565b9801940194019294939190614e4e565b91908201809211614ea357565b634e487b7160e01b5f52601160045260245ffd5b5f198114614ea35760010190565b6001600160a01b0391821681529116602082015260400190565b6001600160401b038111614d455760051b60200190565b90614f0082614edf565b614f0d6040519182614d24565b8281528092614f1e601f1991614edf565b0190602036910137565b8051821015614cab5760209160051b010190565b6001600160a01b038116903382900361508a575b815f526020805260405f205491821561508557805f52601e60205260405f206001840190818511614ea357815f5260205260405f2091604051808460208296549384815201905f5260205f20925f5b818110615063575050614fb492500384614d24565b805f52601f60205260405f20825f5260205260405f20541561505c57614fda8351614ef6565b935f5b845181101561503357600190835f52601d60205260405f20855f5260205260405f20828060a01b0361500f8389614f28565b5116838060a01b03165f5260205260405f205461502c8289614f28565b5201614fdd565b5091505061504b9362093a8042041461504e57615809565b50565b61505781615563565b615809565b5050505050565b84546001600160a01b0316835260019485019488945060209093019201614f9f565b505050565b600e5460405163c23a246560e01b8152906001600160a01b0316602082806150b6863360048401614ec5565b0381845afa90811561458a575f916150ec575b6150dd925081156150e2575b503390614cd4565b614f50565b905033145f6150d5565b90506020823d602011615121575b8161510760209383614d24565b810103126121405761511b6150dd92614d6d565b906150c9565b3d91506150fa565b519061ffff8216820361214057565b9190918054831015614cab575f526003600a60205f208185040193060290565b6001600160a01b0380821693929190821684101561518b5780935b6001600160a01b03851603615186575090565b905090565b8193615173565b81810292918115918404141715614ea357565b6151db90825f52602160205260405f20549060018060a01b03165f52601c60205260405f20835f5260205260405f205490615192565b90670de0b6b3a7640000820291808304670de0b6b3a76400001490151715614ea357816152085750505f90565b670de0b6b3a764000091615228915f52602260205260405f205490614d95565b0490565b91908203918211614ea357565b6001600160a01b03165f8181526028602052604081205491939160ff16615261575b50505050565b821561525b57835f52602460205260405f20825f5260205260ff60405f20541661525b5760018060a01b03600d54166152ab620f42406152a360105487615192565b04809561522c565b9260019084151590816154b8575b8615159283615438575b6152d1575b5050505061525b565b875f52602460205260405f20905f5260205260405f20600160ff198254161790556153d8575b615341575b50509061530891614e96565b6040519081527f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b1760203392a35f808080808080806152c8565b803b156107aa576040516304ba099d60e21b815260048101859052828160248183865af18015610c5f579083916153c3575b5050843b156107aa57818461539d92604051938492839263b66503cf60e01b845260048401614d7a565b038183895af180156103f757156152fc576153b9828092614d24565b6103f457806152fc565b816153cd91614d24565b6107aa57815f615373565b6002546001600160a01b0316863b15612140575f8561540c92604051938492839263b66503cf60e01b845260048401614d7a565b0381838b5af1801561458a57615423575b506152f7565b6154309193505f90614d24565b5f915f61541d565b62093a808804158015615452575b156152c357505f6152c3565b50604051634cde602960e11b8152600481018690526020816024818d5afa90811561458a575f91615486575b508810615446565b90506020813d6020116154b0575b816154a160209383614d24565b8101031261214057515f61547e565b3d9150615494565b62093a8086041580156154d3575b156152b9575f92506152b9565b50600254604051634cde602960e11b81526001600160a01b0390911660048201526020816024818c5afa90811561458a575f91615513575b5086106154c6565b90506020813d60201161553d575b8161552e60209383614d24565b8101031261214057515f61550b565b3d9150615521565b60025f54146155545760025f55565b633ee5aeb560e01b5f5260045ffd5b62093a80420460018101809111614ea35760018060a01b038216805f52601e60205260405f20825f5260205260405f20604051808260208294549384815201905f5260205f20925f5b8181106157e75750506155c192500382614d24565b815f52601f60205260405f20835f5260205260405f205492836155e5575050505050565b90919293945f5b835181101561576957845f52601d60205260405f20835f5260205260405f2060018060a01b0361561c8387614f28565b511660018060a01b03165f5260205260405f20549060018060a01b036156428287614f28565b51165f52601c60205260405f20845f5260205260405f2061566483825461522c565b9055855f52601d60205260405f20845f5260205260405f2060018060a01b0361568d8388614f28565b511660018060a01b03165f526020525f604081205560018060a01b036156b38287614f28565b51165f908152601960209081526040808320546001600160a01b039081168452601b909252909120541691823b156121405760405163293311ab60e01b8152600481018290526001600160a01b038a166024820152925f908490604490829084905af192831561458a5760205f927f433fa8b9e8e2cb00bd714503252e8bfd144f0f318459a2ea8b39c1ae2536171792600196615759575b50604051908152a2016155ec565b8461576391614d24565b5f61574b565b509450929050825f52602260205261578660405f2091825461522c565b9055805f52601f60205260405f20825f526020525f60408120555f52601e60205260405f20905f5260205260405f208054905f8155816157c9575b80808061505c565b5f5260205f20908101905b818110156157c1575f81556001016157d4565b84546001600160a01b03168352600194850194869450602090930192016155ac565b919062093a8042046001810193848211614ea357600e546040516370a0823160e01b81526001600160a01b0383811660048301819052939260209183916024918391165afa90811561458a575f91615b44575b50825f52601f60205260405f20875f526020528060405f2055825f52601e60205260405f20875f5260205260405f208551906001600160401b038211614d4557600160401b8211614d45578054828255808310615b1e575b5060208701905f5260205f205f5b838110615b0157505050505f965f975b86518910156158fa576158f26001916158eb8b8b614f28565b5190614e96565b9801976158d2565b909294975097909294975f5b8951811015615ad0576001600160a01b03615921828c614f28565b51165f52601960205260018060a01b0360405f20541690815f52602860205260ff60405f20541615615ac15761596a836159658861595f858e614f28565b51615192565b614d95565b91615975828b614f28565b5115615ab1576001600160a01b0361598d838e614f28565b51165f52601c60205260405f20865f5260205260405f206159af848254614e96565b90555f898152601d6020908152604080832089845290915290206001600160a01b036159db848f614f28565b511660018060a01b03165f5260205260405f206159f9848254614e96565b90555f908152601b60205260409020546001600160a01b031691823b1561214057604051630463cd9760e41b8152600481018290526001600160a01b0389166024820152925f908490604490829084905af192831561458a577fc2e0f725ed6a663192d51dd063d0ac1cd49139c4b1c7a33d9a58ee09f22d100e60208e8c93600197615aa1575b50615a9186888060a01b0392614f28565b511693604051908152a301615906565b5f615aab91614d24565b5f615a80565b5050505096505050505050505f90565b50505096505050505050505f90565b5050965091509192505f526022602052615aef60405f20918254614e96565b90555f526020805260405f2055600190565b82516001600160a01b0316818301556020909201916001016158c2565b815f528260205f2091820191015b818110615b3957506158b4565b5f8155600101615b2c565b90506020813d602011615b6e575b81615b5f60209383614d24565b8101031261214057515f61585c565b3d9150615b52565b805f52601460205260405f2054155f14615bdc57601354600160401b811015614d4557615bc5615baf8260018594016013556013614cbf565b819391549060031b91821b915f19901b19161790565b9055601354905f52601460205260405f2055600190565b505f90565b805f52601660205260405f2054155f14615bdc57601554600160401b811015614d4557615c1a615baf8260018594016015556015614cbf565b9055601554905f52601660205260405f2055600190565b805f52601260205260405f2054155f14615bdc57601154600160401b811015614d4557615c6a615baf8260018594016011556011614cbf565b9055601154905f52601260205260405f2055600190565b805f52601860205260405f2054155f14615bdc57601754600160401b811015614d4557615cba615baf8260018594016017556017614cbf565b9055601754905f52601860205260405f205560019056fe04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0048d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0da264697066735822122021110a17569e18f2f0495e6475374973cd81cf71350669df551c19c49d26d00e64736f6c634300081c0033
Deployed Bytecode
0x60a0806040526004361015610012575f80fd5b5f905f3560e01c90816248a02714614ae95750806271cdfc1461483b578063060ce5a5146147fe57806306d6a1b2146147be57806307546172146147965780630880b7011461476c5780630c340a24146147445780630d52333c1461471c5780630f147632146146825780631703e5f9146146455780631d9c341e146145f55780631ed24195146145d55780632045be901461459557806320b1cb6f146144bc578063210ca05d14614493578063234823d7146143f3578063270a1b571461416f5780632da5347b14614146578063307f38fa146140a7578063346c440f146140645780633af32abf146140255780633c6b16ab14613f1c5780634256f5e714613ef3578063436596c414613b8957806348feb89b14613ac85780634f2bfe5b14613a9f578063528cfa9814613a815780635397401b14613a465780635824780d146138d957806359b57eb01461352d57806363453ae1146131b85780636b8ab97d146130eb5780637130262714612cde578063721053df14612c9557806377b325c114612c525780637904eeba14612c0f5780637bebe38114612be65780637f9e16e314612ba757806385caf28b14612b7e57806391c6438e14612b4557806393208a2b14612b1c578063942dfa1a14612abb5780639647d14114612a92578063986e471d14612a7457806398bbc3c714612a4b578063992a79331461273d5780639a61df89146127055780639b19251a1461264c5780639bbe33741461260b5780639c7f33151461255b5780639f06247b146123985780639f16daf914612323578063a5a645c1146122f9578063a5f4301e14611c10578063aa79979b14611bd5578063aed8ae9214611b77578063b1a997ac14611b52578063b616eef314611b13578063c42cf53514611a6f578063c61fece914611a01578063c946c5cc14611974578063d1cf58f2146111bb578063d32af6c114611192578063d36f072814611080578063e48bcc7d146109c7578063e4ff5c2f14610800578063e74f6166146107d7578063e7589b39146107ae578063eab37eec14610625578063eb9019d4146104dd578063eda1cb581461049c578063f55858b01461045b5763ffc0a01e1461033f575f80fd5b346103f45760403660031901126103f45780610359614b78565b610361614b8e565b9060018060a01b036006541633148015610447575b610381903390614cd4565b6001600160a01b0316808352602a602052604083205490919060ff161561040657813b1561040257604051639dfb338160e01b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e357505080f35b816103ed91614d24565b6103f45780f35b80fd5b6040513d84823e3d90fd5b5050fd5b813b1561040257604051630c96238f60e01b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e357505080f35b506007546001600160a01b03163314610376565b50346103f45760203660031901126103f4576020906001600160a01b03610480614b78565b168152601b8252604060018060a01b0391205416604051908152f35b50346103f45760203660031901126103f4576020906001600160a01b036104c1614b78565b168152602f8252604060018060a01b0391205416604051908152f35b50346103f45760403660031901126103f4576104f7614b78565b6024359060018060a01b031690818352601e6020526040832081845260205260408320926040518085602082975493848152019084526020842092845b81811061060357505061054992500385614d24565b6105538451614ef6565b91815b85518110156105ac57600190858452601d6020526040842083855260205260408420828060a01b03610588838a614f28565b5116838060a01b03165f5260205260405f20546105a58287614f28565b5201610556565b6105c6868585604051938493604085526040850190614b3c565b8381036020850152602080845192838152019301915b8181106105ea575050500390f35b82518452859450602093840193909201916001016105dc565b84546001600160a01b0316835260019485019489945060209093019201610534565b50346103f45760603660031901126103f4576004356001600160401b0381116107aa57610656903690600401614bba565b6024929192356001600160401b0381116107a657610678903690600401614bba565b6044949194356001600160401b0381116107a25761069a903690600401614bba565b95909173870462d78fa1a5c3d6bbb69baad72b97b5f3cb849360018060a01b03600a541695853b1561079e576107069392916106f49160405198637b36251560e11b8a5260048a0152608060248a01526084890191614db3565b86810360031901604488015291614e37565b90600319848303016064850152858252602082019560208160051b840101928287915b838310610749578880898181808b03818d5af480156103f7576103e35750f35b9091929394601f19828203018a526107618684614e03565b8083529091906001600160fb1b03811161079a5760206001938193829360051b809284830137010197019a019301919098939298610729565b8a80fd5b8780fd5b8480fd5b8280fd5b5080fd5b50346103f457806003193601126103f4576006546040516001600160a01b039091168152602090f35b50346103f457806003193601126103f4576008546040516001600160a01b039091168152602090f35b50346103f45761080f36614bea565b9082949593921515806109be575b156109af576001600160a01b0386163303610918575b61083c85614edf565b9561084a6040519788614d24565b858752601f1961085987614edf565b01366020890137845b8681101561089d57600581901b8501356001600160a01b038116908190036108995790600191610892828b614f28565b5201610862565b8680fd5b50908685926108ab81615563565b6108b485614edf565b926108c26040519485614d24565b858452602084019560051b81019036821161091457955b8187106109045750506108ed939450615809565b156108f55780f35b63fa0e305360e01b8152600490fd5b86358152602096870196016108d9565b8580fd5b600e5460405163c23a246560e01b81529060209082906001600160a01b031681806109478c3360048401614ec5565b03915afa80156109a4578590610969575b61096491503390614cd4565b610833565b506020813d60201161099c575b8161098360209383614d24565b810103126107a25761099761096491614d6d565b610958565b3d9150610976565b6040513d87823e3d90fd5b63899ef10d60e01b8452600484fd5b5081851461081d565b50346103f4576109ff6109d936614c4f565b929160018060a01b03600654163314801561106c575b6109fa903390614cd4565b615158565b6001600160a01b03918216808552602d602090815260408087208585165f908152908352818120600288900b82529092529020549092169290831561105d57838552601a6020908152604080872054868852602e835281882054868952602c84528289206001600160a01b038681165f818152928752858320805462ffffff191662ffffff9a909a1699909917909855888b52602b8652848b2097825296909452919092205494918416931691865b858110610c7e578787808252602860205260ff60408320541615610ad0575080f35b6006546001600160a01b031633148015610c6a575b610af0903390614cd4565b8082526028602052610b0a8160ff60408520541615614cfc565b808252602860205260408220600160ff19825416179055808252602660205260ff604083205416610b70575b62093a804204818352602560205260408320557fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa8280a280f35b808252601a60205281602460018060a01b03604083205416602060018060a01b03600b5416604051938480926308a3a6ad60e11b82528560048301525afa918215610c5f578392610c23575b506001546001600160a01b031691823b15610c1f57610bf49284928360405180968195829463270401cb60e01b845260048401614ec5565b03925af180156103f757610c0a575b5050610b36565b81610c1491614d24565b6107aa578183610c03565b8380fd5b9091506020813d602011610c57575b81610c3f60209383614d24565b810103126107a657610c5090614d59565b9085610bbc565b3d9150610c32565b6040513d85823e3d90fd5b506007546001600160a01b03163314610ae5565b828852602b6020526040882060018060a01b0383165f52602052610ca58160405f20615138565b9054848a52602d60209081526040808c206001600160a01b038781165f90815291845282822060039690961b9490941c60020b815293825292839020548216808c52601a8252838c20549092168b52602f8152828b2080546001600160a01b03199081168a17909155828c52601b909152918a2080549092168617909155908782141580611047575b610d3d575b6001915001610aae565b6006546001600160a01b031633148015611033575b610d5d903390614cd4565b818952602860205260ff60408a2054161561101f5781895260286020526040892060ff198154169055818952601a60205260018060a01b0360408a20541691808a52602660205260ff60408b205416610f03575b808a52602560205260408a20549262093a804204908b80955b83811115610e8f5750505083610e02575b60019350818b52602560205260408b20555f516020615cd25f395f51905f528a80a2610d33565b6020610e3c9460018060a01b03600254168d60018060a01b03600754169060405180998195829463a9059cbb60e01b845260048401614d7a565b03925af18015610e845715610ddb576020843d8211610e7c575b81610e6360209383614d24565b8101031261079a57610e76600194614d6d565b50610ddb565b3d9150610e56565b6040513d8d823e3d90fd5b60ff60408387610eb59552602460205281812084825260205220541615610ebc57614eb7565b8c90610dca565b8d610ed1610eca83866151a5565b8099614e96565b97610edd575b50614eb7565b808660409252602460205281812083825260205220600160ff198254161790558d610ed7565b6001546040516341d93a7960e11b81528b916001600160a01b031690602081600481855afa908115610c5f578391610fe6575b5015610fac57506001546007546001600160a01b039081169116803b156107a65760405163270401cb60e01b81529183918391829084908290610f7d908c60048401614ec5565b03925af180156103f757610f93575b5050610db1565b81610f9d91614d24565b610fa857895f610f8c565b8980fd5b803b156107aa5760405163270401cb60e01b81526001600160a01b03861660048201525f6024820152908290829081838160448101610f7d565b90506020813d8211611017575b8161100060209383614d24565b810103126107a65761101190614d6d565b5f610f36565b3d9150610ff3565b63c5491e0f60e01b89526004829052602489fd5b506007546001600160a01b03163314610d52565b50818952602860205260ff60408a205416610d2e565b6302e6882d60e41b8552600485fd5b506007546001600160a01b031633146109ef565b50346103f45760403660031901126103f45761109a614b78565b906110a3614b8e565b6006546001600160a01b03163314801561117e575b6110c3903390614cd4565b6001600160a01b03168082526027602052604082205460ff161561116f576001600160a01b03909216808252602a60205260408220549192839260ff161561113a57813b156104025782916024839260405194859384926339ced26d60e21b845260048401525af180156103f7576103e357505080f35b813b1561040257829160248392604051948593849263db89461b60e01b845260048401525af180156103f7576103e357505080f35b635ffde35f60e11b8252600482fd5b506007546001600160a01b031633146110b8565b50346103f457806003193601126103f457600b546040516001600160a01b039091168152602090f35b50346103f4576111ca36614c4f565b6008546040516328af8d0b60e01b81526001600160a01b038581166004830181905285821660248401819052600286900b6044850181905291989791969491939290911691602081606481865afa90811561196957889161192f575b506001600160a01b031697881561192057604051633850c7bd60e01b815260e0816004818d5afa908115611915578991611880575b501561187157888852601960208181526040808b20548c8c5292909152892054611292916001600160a01b03918216911615614cfc565b8752602760205260ff604088205416908161185b575b501561184c576020600491604051928380926331056e5760e21b82525afa908115611712579086939291849161180a575b5060048054604051630317318f60e11b81526001600160a01b03938416928101929092529094602092869260249284929091165af19283156117125790869493929185936117c7575b506009546040516352fa180f60e11b8152600481018a90529760209189916024918391906001600160a01b03165af19687156109a457859761178b575b5060025460405163095ea7b360e01b81526001600160a01b03988916600482018190525f196024830152989091602091839160449183918b91165af1801561171257611754575b50600d5460405163095ea7b360e01b8152600481018990525f19602482015290602090829060449082908a906001600160a01b03165af180156117125761171d575b50868552602e6020908152604080872080546001600160a01b03199081166001600160a01b038816179091558a885260198352818820805482168b179055898852601a835281882080549091168b1790558887526025909152852062093a804204905561145488615c31565b5061145e87615be1565b506114716001600160a01b038416615c81565b50868552602a60205260408520805460ff19166001179055873b156107a257604051637b7d549d60e01b81528581600481838d5af18015611712579086916116fd575b5050906114e29188885f516020615d125f395f51905f52604051806114da893383614ec5565b0390a3615158565b919060018060a01b031692838552602b6020526040852060018060a01b0384165f5260205260405f20805490600160401b8210156116e9579861152e8260209b60018c95018155615138565b815462ffffff86811660039390931b92831b921b1916179055858752602d8a5260408088206001600160a01b0387165f818152918d528282208b83528d5282822080546001600160a01b03191686179055888a52602c8d52828a209082528c52205460020b8061163957505050838552602c885260408086206001600160a01b039485165f818152918b5290829020805462ffffff191662ffffff9490941693909317909255878652601b89528086208054939094166001600160a01b031990931692909217909255858452602887528320805460ff19166001179055917fb014c0b8ac335752818c30cf2b458d2ba97dc0f0743e9e04f9f72832f438f4779080a45b604051908152f35b935093915095505f516020615cd25f395f51905f5294936116663360018060a01b03600754163314614cd4565b8452602d885260408085206001600160a01b039283165f908152908a5281812060029490940b815292895291829020548116808552601a895282852054938552602f895282852080546001600160a01b03199081169584169590951790558452602e885281842054868552601b89529184208054909316911617905580a2611631565b634e487b7160e01b87526041600452602487fd5b8161170791614d24565b6107a257845f6114b4565b6040513d88823e3d90fd5b6020813d60201161174c575b8161173660209383614d24565b810103126109145761174790614d6d565b6113e8565b3d9150611729565b6020813d602011611783575b8161176d60209383614d24565b810103126109145761177e90614d6d565b6113a6565b3d9150611760565b9096506020813d6020116117bf575b816117a760209383614d24565b810103126107a2576117b890614d59565b955f61135f565b3d915061179a565b9192509293506020813d602011611802575b816117e660209383614d24565b8101031261091457906117fb86949392614d59565b915f611322565b3d91506117d9565b91929350506020813d602011611844575b8161182860209383614d24565b810103126109145790602061183e879493614d59565b906112d9565b3d915061181b565b635ffde35f60e11b8652600486fd5b8752506027602052604086205460ff165f6112a8565b6359b186bf60e11b8852600488fd5b905060e0813d60e01161190d575b8161189b60e09383614d24565b810103126119095780516001600160a01b038116036119095760208101518060020b03611909576118ce60408201615129565b506118db60608201615129565b506118e860808201615129565b5060a081015160ff8116036119095760c06119039101614d6d565b5f61125b565b8880fd5b3d915061188e565b6040513d8b823e3d90fd5b630cc15fbb60e11b8852600488fd5b90506020813d602011611961575b8161194a60209383614d24565b8101031261079e5761195b90614d59565b5f611226565b3d915061193d565b6040513d8a823e3d90fd5b50346103f457806003193601126103f45760405160158054808352908352909160208301917f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915b8181106119eb576119e7856119d381870382614d24565b604051918291602083526020830190614b3c565b0390f35b82548452602090930192600192830192016119bc565b50346103f45760603660031901126103f457611a1b614b78565b6001600160a01b03168152601e6020908152604080832060243584529091528120805460443592908310156103f4576020611a568484614cbf565b905460405160039290921b1c6001600160a01b03168152f35b50346103f45760203660031901126103f457611a89614b78565b6006546001600160a01b031633148015611aff575b611aa9903390614cd4565b6007546001600160a01b03918216918116829003611ac5578280f35b6001600160a01b0319168117600755337f1ba669d4a78521f2ad26e8e0fcbcdd626a63f34d68f326bc232a3abe2a5d042a8380a35f808280f35b506007546001600160a01b03163314611a9e565b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03611b3e614b78565b168152602684522054166040519015158152f35b50346103f45760203660031901126103f457611b74611b6f614b78565b614f3c565b80f35b50346103f45760603660031901126103f4576040611b93614b78565b91611b9c614ba4565b9260018060a01b03168152601d6020528181206024358252602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346103f45760203660031901126103f4576020906040906001600160a01b03611bfd614b78565b1681526016835220541515604051908152f35b50346103f45760203660031901126103f457611c2a614b78565b6001600160a01b0380821680845260196020818152604080872054848852929091528520549394939192611c62928116911615614cfc565b60015460405163e5e31b1360e01b81526004810183905290602090829060249082906001600160a01b03165afa908115610c5f5783916122bf575b50156122b05760405163392f37e960e01b815260e081600481855afa908115610c5f5783908492612258575b506001600160a01b031683526027602052604083205460ff169081612239575b501561116f57818093602060018060a01b03600b5416602460405180958193631fb45e3160e01b83528860048401525af191821561222e5784926121f2575b5060018060a01b03600454169060405192630317318f60e11b84526020846024818960018060a01b038616978860048401525af19384156117125786946121b6575b50823b156109145760405163189acdbd60e31b815286816024818360018060a01b038a16988960048401525af190811561214c5787916121a1575b50506001546001600160a01b0316803b156108995760405163270401cb60e01b81529187918391829084908290611de0908960048401614ec5565b03925af190811561171257869161218c575b5050604051636373ea6960e01b8152602081600481885afa908115611712578691612157575b5015612082575b506003546040516352fa180f60e11b8152600481018590529460209186916024918391906001600160a01b03165af19384156109a4578594612046575b5060025460405163095ea7b360e01b81526001600160a01b03958616600482018190525f196024830152959091602091839160449183918b91165af180156117125761200f575b50600d5460405163095ea7b360e01b8152600481018690525f19602482015290602090829060449082908a906001600160a01b03165af1801561171257611fb6575b50838552601b6020908152604080872080546001600160a01b03199081168517909155858852601983528188208054821688179055868852601a8352818820805490911686179055858752602882528620805460ff191660011790559484925f516020615d125f395f51905f5292611fab9290611f7590611f6588615c31565b50611f6f87615be1565b50615c81565b508481526026885260408120600160ff19825416179055604062093a8042049186815260258a5220556040519182913383614ec5565b0390a3604051908152f35b6020813d602011612007575b81611fcf60209383614d24565b81010312610914578492602096611f755f516020615d125f395f51905f5294611ffa611fab95614d6d565b5094505096509250611ee5565b3d9150611fc2565b6020813d60201161203e575b8161202860209383614d24565b810103126109145761203990614d6d565b611ea3565b3d915061201b565b9093506020813d60201161207a575b8161206260209383614d24565b810103126107a25761207390614d59565b925f611e5c565b3d9150612055565b600154604051636373ea6960e01b81526001600160a01b039091169190602081600481865afa90811561214c578791612113575b50823b15610899576120e19287928360405180968195829463203e180f60e11b845260048401614d7a565b03925af19081156109a45785916120f9575b50611e1f565b8161210391614d24565b61210e57835f6120f3565b505050fd5b9650506020863d602011612144575b8161212f60209383614d24565b81010312612140578695515f6120b6565b5f80fd5b3d9150612122565b6040513d89823e3d90fd5b9550506020853d602011612184575b8161217360209383614d24565b81010312612140578594515f611e18565b3d9150612166565b8161219691614d24565b6107a257845f611df2565b816121ab91614d24565b61091457855f611da5565b9093506020813d6020116121ea575b816121d260209383614d24565b81010312610914576121e390614d59565b925f611d6a565b3d91506121c5565b9091506020813d602011612226575b8161220e60209383614d24565b8101031261210e5761221f90614d59565b905f611d28565b3d9150612201565b6040513d86823e3d90fd5b6001600160a01b03168352506027602052604082205460ff165f611ce9565b91505060e0813d60e0116122a8575b8161227460e09383614d24565b810103126107a65761228860808201614d6d565b506122a160c061229a60a08401614d59565b9201614d59565b905f611cc9565b3d9150612267565b630cc15fbb60e11b8252600482fd5b90506020813d6020116122f1575b816122da60209383614d24565b810103126107a6576122eb90614d6d565b5f611c9d565b3d91506122cd565b50346103f45760203660031901126103f45760406020916004358152602283522054604051908152f35b50346103f457806003193601126103f45760405160178054808352908352909160208301917fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c15915b818110612382576119e7856119d381870382614d24565b825484526020909301926001928301920161236b565b50346103f45760203660031901126103f4576123b2614b78565b6006546001600160a01b031633148015612547575b6123d2903390614cd4565b6001600160a01b0381168083526028602052604083205490916123f89160ff1615614cfc565b808252602860205260408220600160ff19825416179055808252602660205260ff60408320541661245d5762093a804204818352602560205260408320557fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa8280a280f35b808252601a60205281602460018060a01b03604083205416602060018060a01b03600b5416604051938480926308a3a6ad60e11b82528560048301525afa918215610c5f57839261250b575b506001546001600160a01b031691823b15610c1f576124e19284928360405180968195829463270401cb60e01b845260048401614ec5565b03925af180156103f7576124f6575050610b36565b8161250091614d24565b6107aa57815f610c03565b9091506020813d60201161253f575b8161252760209383614d24565b810103126107a65761253890614d59565b905f6124a9565b3d915061251a565b506007546001600160a01b031633146123c7565b50346103f45760203660031901126103f457612575614b78565b6006546001600160a01b0316331480156125f7575b612595903390614cd4565b6001600160a01b03168082526027602052604082205460ff161561116f5780825260276020526040822060ff198154169055604051600181527f85abc05b04dbd37a6324d72db47d565d98bfa5cafc40ba85ff9747c857cc466160203392a380f35b506007546001600160a01b0316331461258a565b50346103f45760203660031901126103f4576020906001600160a01b03612630614b78565b168152602e8252604060018060a01b0391205416604051908152f35b50346103f45760203660031901126103f457612666614b78565b6006546001600160a01b0316331480156126f1575b612686903390614cd4565b6001600160a01b03168082526027602052604082205460ff166126e257808252602760205260408220805460ff19166001179055337f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de8380a380f35b6350013e0f60e11b8252600482fd5b506007546001600160a01b0316331461267b565b50346103f45760203660031901126103f4576020906040906001600160a01b0361272d614b78565b1681528280522054604051908152f35b50346103f45760203660031901126103f457612757614b78565b6006546001600160a01b031633148015612a37575b612777903390614cd4565b6001600160a01b03168082526028602052604082205460ff1615612a255780825260286020526040822060ff198154169055808252601a60205260018060a01b03604083205416818352602660205260ff60408420541661290c575b8183526025602052604083205462093a8042049184915b8381111561289f5750508061281c575b50818352602560205260408320555f516020615cd25f395f51905f528280a280f35b60025460075460405163a9059cbb60e01b81529260209284926001600160a01b039182169284928a9284926128579290911660048401614d7a565b03925af1801561222e57156127fa576020813d602011612897575b8161287f60209383614d24565b81010312610c1f5761289090614d6d565b505f6127fa565b3d9150612872565b6128c79085875260246020526040872081885260205260ff604088205416156128cc57614eb7565b6127ea565b6128e06128d982856151a5565b8095614e96565b9315614eb75785875260246020526040872081885260205260408720600160ff19825416179055614eb7565b6001546040516341d93a7960e11b815284916001600160a01b031690602081600481855afa908115610c5f5783916129eb575b50156129b157506001546007546001600160a01b039081169116803b156107a65760405163270401cb60e01b81529183918391829084908290612986908a60048401614ec5565b03925af180156103f75761299c575b50506127d3565b816129a691614d24565b6107a657825f612995565b803b156107aa5760405163270401cb60e01b81526001600160a01b03841660048201525f6024820152908290829081838160448101612986565b90506020813d602011612a1d575b81612a0660209383614d24565b810103126107a657612a1790614d6d565b5f61293f565b3d91506129f9565b63c5491e0f60e01b8252600452602490fd5b506007546001600160a01b0316331461276c565b50346103f457806003193601126103f457600a546040516001600160a01b039091168152602090f35b50346103f457806003193601126103f4576020601054604051908152f35b50346103f457806003193601126103f4576004546040516001600160a01b039091168152602090f35b50346103f457612ad7906040612ad036614c4f565b9491615158565b929060018060a01b03168152602d602052209060018060a01b03165f5260205260405f209060020b5f52602052602060405f2060018060a01b03905416604051908152f35b50346103f457806003193601126103f457600f546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f4576020906040906001600160a01b03612b6d614b78565b168152602583522054604051908152f35b50346103f457806003193601126103f457600e546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03612bd2614b78565b168152602984522054166040519015158152f35b50346103f457806003193601126103f4576009546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f4576020906040906001600160a01b03612c37614b78565b168152601f8352818120602435825283522054604051908152f35b50346103f45760403660031901126103f4576020906040906001600160a01b03612c7a614b78565b16815260238352818120602435825283522054604051908152f35b50346103f45760403660031901126103f45760209060ff906040906001600160a01b03612cc0614b78565b16815260248452818120602435825284522054166040519015158152f35b50346103f4576101c03660031901126103f457612cf9614b78565b90612d02614b8e565b91612d0b614ba4565b60643593906001600160a01b0385168503610c1f57608435916001600160a01b03831683036107a25760a435916001600160a01b03831683036109145760c435916001600160a01b03831683036108995760e435946001600160a01b038616860361079e5761010435936001600160a01b0385168503611909576101243560808190526001600160a01b03811690036119095761014435956001600160a01b0387168703610fa85761016435926001600160a01b038416840361079a5761018435946001600160a01b03861686036130e7576101a435966001600160a01b03881688036130e3575f516020615cf25f395f51905f52549b6001600160401b038d16158d816130d3575b6001600160401b031660011490816130c9575b1590816130c0575b506130b15760018d6001600160401b031916175f516020615cf25f395f51905f525560ff8d60401c1615613085575b60065490336001600160a01b03831603613076576001600160a01b03199182166001600160a01b03918216176006556001805483169382169390931790925560028054821693831693841790556003805482169f83169f909f17909e55600480548f1693821693909317909255600580548e1693831693909317909255600d80548d16828b16179055600780548d1693821693909317909255600b80548c1693831693909317909255600e80548b1693821693909317909255600f80548a169383169390931790925560088054891693821693909317909255608051600980548916918416919091179055600a80549097169190921617909455620f4240601081905560408051858152602081810193909352949586959293909260449287917fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d9190a260405163095ea7b360e01b81526001600160a01b0390911660048201525f1960248201529485928391905af18015610c5f5761303c575b60ff915060401c1615612fe95780f35b60ff60401b195f516020615cf25f395f51905f5254165f516020615cf25f395f51905f52557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a180f35b6020823d60201161306e575b8161305560209383614d24565b810103126107a65761306860ff92614d6d565b50612fd9565b3d9150613048565b63075fd2b160e01b8f5260048ffd5b68ffffffffffffffffff198d1668010000000000000001175f516020615cf25f395f51905f5255612e5e565b63f92ee8a960e01b8e5260048efd5b9050155f612e2f565b303b159150612e27565b604081901c60ff16159150612e14565b8c80fd5b8b80fd5b50346103f45760203660031901126103f457613105614b78565b6001600160a01b038116330361311f575b611b7490615563565b600e5460405163c23a246560e01b8152919060209083906001600160a01b0316818061314f863360048401614ec5565b03915afa918215610c5f578392613177575b50613170611b74923390614cd4565b9050613116565b91506020823d6020116131b0575b8161319260209383614d24565b810103126107a6576131706131a9611b7493614d6d565b9250613161565b3d9150613185565b50346103f45760203660031901126103f4576131d2614b78565b6131da615545565b60055460405163541b13ef60e11b8152906020908290600490829087906001600160a01b03165af18015610c5f576134fe575b506001600160a01b0381811680845260256020908152604080862054838752601a90925285205462093a8042049492931691600182018083116134ea579185918794935b838111156134b057505003613274575b5052602560205260408220556001815580f35b828252602a602052604082205460ff161561339457803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f57839161337f575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f578391613345575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f757613330575b50505b825f613261565b8161333a91614d24565b6107a657825f613326565b90506020813d602011613377575b8161336060209383614d24565b810103126107a65761337190614d59565b5f6132ea565b3d9150613353565b8161338991614d24565b6107aa57815f6132b4565b828252602660205260ff6040832054166133b0575b5050613329565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f57839161349b575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f7578291613461575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f757156133a9578161345691614d24565b6107a657825f6133a9565b90506020813d602011613493575b8161347c60209383614d24565b810103126107aa5761348d90614d59565b5f613418565b3d915061346f565b816134a591614d24565b6107aa57815f6133db565b9092508394506134d6816134c8816134df95976151a5565b6134d0615545565b85615239565b60018855614eb7565b918591879493613251565b634e487b7160e01b87526011600452602487fd5b6020813d602011613525575b8161351760209383614d24565b81010312612140575161320d565b3d915061350a565b50346103f45760403660031901126103f4576024356015548082116138d1575b5062093a8042046004355b828110613563578380f35b61356c81614c93565b905460039190911b1c6001600160a01b031690613587615545565b60055460405163541b13ef60e11b815290602090829060049082908a906001600160a01b03165af18015611712576138a3575b5081855260256020908152604080872054848852601a9092528620546001600160a01b0316906001810180821161388f5787929186915b8281111561385c57500361361a575b509160019252602560205282604086205581855501613558565b838252602a602052604082205460ff161561373e57803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f578391613729575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f5783916136f0575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f7576136db575b50506001915b9150845f613600565b816136e591614d24565b6107a257845f6136cc565b90506020813d8211613721575b8161370a60209383614d24565b810103126107a65761371b90614d59565b5f613690565b3d91506136fd565b8161373391614d24565b6107aa57815f61365a565b838252602660205260ff60408320541661375d575b50506001916136d2565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f578391613847575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f757829161380e575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f75715613753578161380391614d24565b6107a257845f613753565b90506020813d821161383f575b8161382860209383614d24565b810103126107aa5761383990614d59565b5f6137c5565b3d915061381b565b8161385191614d24565b6107aa57815f613788565b61388791925061387e8161387081876151a5565b613878615545565b89615239565b60018555614eb7565b9086916135f1565b634e487b7160e01b88526011600452602488fd5b6020813d82116138c9575b816138bb60209383614d24565b8101031261214057516135ba565b3d91506138ae565b90505f61354d565b50346103f45760403660031901126103f4576138f3614b78565b6024359060018060a01b036006541633148015613a32575b613916903390614cd4565b6001600160a01b03811680845260286020526040842054909161393c9160ff1615614cfc565b80835260246020526040832082845260205260ff6040842054161561395f578280f35b808352601a60205260408320546139809083906001600160a01b03166151a5565b8061398a57508280f35b60025460075460405163a9059cbb60e01b81529260209284926001600160a01b039182169284928a9284926139c59290911660048401614d7a565b03925af1801561222e576139fb575b50825260246020526040822090825260205260408120600160ff198254161790555f808280f35b6020813d602011613a2a575b81613a1460209383614d24565b81010312610c1f57613a2590614d6d565b6139d4565b3d9150613a07565b506007546001600160a01b0316331461390b565b50346103f45760203660031901126103f4576020906040906001600160a01b03613a6e614b78565b1681526018835220541515604051908152f35b50346103f457806003193601126103f4576020604051620f42408152f35b50346103f457806003193601126103f457600c546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f45780613ae3614b78565b60055460405163541b13ef60e11b8152926024359291602091859160049183916001600160a01b03165af1801561222e57613b56575b6001600160a01b038181168552601a6020526040852054613b4f9450613b41918491166151a5565b90613b4a615545565b615239565b6001815580f35b6020833d602011613b81575b81613b6f60209383614d24565b8101031261214057613b4f9250613b19565b3d9150613b62565b50346103f457806003193601126103f45760155462093a804204825b828110613bb0578380f35b613bb981614c93565b905460039190911b1c6001600160a01b031690613bd4615545565b60055460405163541b13ef60e11b815290602090829060049082908a906001600160a01b03165af1801561171257613ec5575b5081855260256020908152604080872054848852601a9092528620546001600160a01b0316906001810180821161388f5787929186915b82811115613ea9575003613c67575b509160019252602560205282604086205581855501613ba5565b838252602a602052604082205460ff1615613d8b57803b156107aa576040516361707cd960e11b8152828160048183865af1908115610c5f578391613d76575b50506008546040516331056e5760e21b815290602090829060049082906001600160a01b03165afa908115610c5f578391613d3d575b506001600160a01b031690813b156107a6578291602483926040519485938492632a54db0160e01b845260048401525af180156103f757613d28575b50506001915b9150845f613c4d565b81613d3291614d24565b6107a257845f613d19565b90506020813d8211613d6e575b81613d5760209383614d24565b810103126107a657613d6890614d59565b5f613cdd565b3d9150613d4a565b81613d8091614d24565b6107aa57815f613ca7565b838252602660205260ff604083205416613daa575b5050600191613d1f565b803b156107aa576040516313966db560e01b8152828160048183865af1908115610c5f578391613e94575b5050600b546040516308a3a6ad60e11b81526004810192909252602090829060249082906001600160a01b03165afa9081156103f7578291613e5b575b506001600160a01b0316803b156107aa57818091600460405180948193634c4f2a9560e01b83525af180156103f75715613da05781613e5091614d24565b6107a257845f613da0565b90506020813d8211613e8c575b81613e7560209383614d24565b810103126107aa57613e8690614d59565b5f613e12565b3d9150613e68565b81613e9e91614d24565b6107aa57815f613dd5565b613ebd91925061387e8161387081876151a5565b908691613c3e565b6020813d8211613eeb575b81613edd60209383614d24565b810103126121405751613c07565b3d9150613ed0565b50346103f457806003193601126103f457600d546040516001600160a01b039091168152602090f35b50346103f45760203660031901126103f45760055460043590613f4b9033906001600160a01b03168114614cd4565b6002546040516323b872dd60e01b815233600482015230602482015260448101839052906020908290606490829087906001600160a01b03165af18015610c5f57613fee575b5062093a8042048252602160205260408220613fae828254614e96565b90556002546040519182526001600160a01b03169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf5082690602090a380f35b6020813d60201161401d575b8161400760209383614d24565b810103126107a65761401890614d6d565b613f91565b3d9150613ffa565b50346103f45760203660031901126103f45760209060ff906040906001600160a01b03614050614b78565b168152602784522054166040519015158152f35b50346103f45760403660031901126103f4576020906040906001600160a01b0361408c614b78565b168152601c8352818120602435825283522054604051908152f35b50346103f457806140b736614bea565b90929373870462d78fa1a5c3d6bbb69baad72b97b5f3cb849160018060a01b03600c541690833b1561079e57879561413591614123604051998a988997889763e55c539160e01b8952600489015260018060a01b03166024880152608060448801526084870191614db3565b84810360031901606486015291614e37565b03915af480156103f7576103e35750f35b50346103f457806003193601126103f4576001546040516001600160a01b039091168152602090f35b50346103f45760403660031901126103f45761419a61418c614b78565b614194614b8e565b90615158565b9060018060a01b03168252602b602052604082209060018060a01b03165f5260205260405f20604051808160208454928381520180948652602086209286905b80600983011061436457614243945491818110614350575b818110614339575b818110614322575b81811061430b575b8181106142f4575b8181106142dd575b8181106142c6575b8181106142af575b818110614298575b10614287575b509392930383614d24565b604051928392602084019060208552518091526040840192915b81811061426b575050500390f35b825160020b84528594506020938401939092019160010161425d565b60d81c60020b81526020015f614238565b9260206001918460c01c60020b8152019301614232565b9260206001918460a81c60020b815201930161422a565b9260206001918460901c60020b8152019301614222565b9260206001918460781c60020b815201930161421a565b9260206001918460601c60020b8152019301614212565b9260206001918460481c60020b815201930161420a565b9260206001918460301c60020b8152019301614202565b9260206001918460181c60020b81520193016141fa565b9260206001918460020b81520193016141f2565b91600a91935061014060019186548060020b82528060181c60020b60208301528060301c60020b60408301528060481c60020b60608301528060601c60020b60808301528060781c60020b60a08301528060901c60020b60c08301528060a81c60020b60e08301528060c01c60020b61010083015260d81c60020b6101208201520194019201849293916141da565b50346103f45760403660031901126103f4578061440e614b78565b614416614b8e565b9060018060a01b03600654163314801561447f575b614436903390614cd4565b6001600160a01b031690813b1561040257604051632935799f60e21b81526001600160a01b0390911660048201529082908290602490829084905af180156103f7576103e35750f35b506007546001600160a01b0316331461442b565b50346103f457806003193601126103f4576002546040516001600160a01b039091168152602090f35b5034612140576040366003190112612140576004356001600160401b038111612140576144ed903690600401614bba565b6024356001600160401b0381116121405761450c903690600401614bba565b9273870462d78fa1a5c3d6bbb69baad72b97b5f3cb8490813b15612140575f9361456a61455894604051978896879586956320b1cb6f60e01b8752604060048801526044870191614db3565b84810360031901602486015291614e37565b03915af4801561458a5761457c575080f35b61458891505f90614d24565b005b6040513d5f823e3d90fd5b34612140576020366003190112612140576001600160a01b036145b6614b78565b165f526019602052602060018060a01b0360405f205416604051908152f35b34612140575f36600319011261214057602062093a804204604051908152f35b346121405760403660031901126121405761461161418c614b78565b9060018060a01b03165f52602c60205260405f209060018060a01b03165f52602052602060405f205460020b604051908152f35b34612140576020366003190112612140576001600160a01b03614666614b78565b165f526028602052602060ff60405f2054166040519015158152f35b346121405760203660031901126121405760043560018060a01b036006541633148015614708575b6146b5903390614cd4565b620f424081116146f9576010546040519081528160208201527fbf0e71132a05dec6f7baee9d3684132ceaf80effcca49bd225f7856604f38f7d60403392a2601055005b6378d5606f60e01b5f5260045ffd5b506007546001600160a01b031633146146aa565b34612140575f366003190112612140576003546040516001600160a01b039091168152602090f35b34612140575f366003190112612140576007546040516001600160a01b039091168152602090f35b34612140576020366003190112612140576004355f526021602052602060405f2054604051908152f35b34612140575f366003190112612140576005546040516001600160a01b039091168152602090f35b34612140576020366003190112612140576001600160a01b036147df614b78565b165f52601a602052602060018060a01b0360405f205416604051908152f35b34612140576020366003190112612140576001600160a01b0361481f614b78565b165f52602a602052602060ff60405f2054166040519015158152f35b34612140576020366003190112612140575f614855614b78565b6006546001600160a01b031633148015614ad5575b614875903390614cd4565b6001600160a01b03908116808352601960208181526040808620548487529290915284205491926148aa928116911615614cfc565b6003546040516352fa180f60e11b8152600481018390529260209184916024918391906001600160a01b03165af190811561458a575f91614a9a575b60025460405163095ea7b360e01b81526001600160a01b03938416600482018190525f19602483015290945092602091859160449183915f91165af1801561458a57614a61575b600d5460405163095ea7b360e01b8152600481018490525f1960248201529350602090849060449082905f906001600160a01b03165af1801561458a57614a27575b5f81815260196020908152604080832080546001600160a01b03199081168717909155858452601a835281842080549091168517905560288252909120805460ff1916600117905592506149c281615b76565b506149cc82615be1565b50815f526029835260405f20600160ff1982541617905562093a804204825f526025845260405f2055817fda1e0b743f7b4dbe48508aac40b89bdf1a4f9e1803f9bf90203ce6990b99e5a684604051338152a3604051908152f35b6020833d602011614a59575b81614a4060209383614d24565b8101031261214057614a53602093614d6d565b5061496f565b3d9150614a33565b6020833d602011614a92575b81614a7a60209383614d24565b8101031261214057614a8c5f93614d6d565b5061492d565b3d9150614a6d565b90506020823d602011614acd575b81614ab560209383614d24565b8101031261214057614ac75f92614d59565b906148e6565b3d9150614aa8565b506007546001600160a01b0316331461486a565b34612140575f36600319011261214057601354808252602082019060135f5260205f20905f5b818110614b26576119e7856119d381870382614d24565b8254845260209093019260019283019201614b0f565b90602080835192838152019201905f5b818110614b595750505090565b82516001600160a01b0316845260209384019390920191600101614b4c565b600435906001600160a01b038216820361214057565b602435906001600160a01b038216820361214057565b604435906001600160a01b038216820361214057565b9181601f84011215612140578235916001600160401b038311612140576020808501948460051b01011161214057565b906060600319830112612140576004356001600160a01b038116810361214057916024356001600160401b0381116121405781614c2991600401614bba565b92909291604435906001600160401b03821161214057614c4b91600401614bba565b9091565b6060906003190112612140576004356001600160a01b038116810361214057906024356001600160a01b038116810361214057906044358060020b81036121405790565b601554811015614cab5760155f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b8054821015614cab575f5260205f2001905f90565b15614cdc5750565b632bc10c3360e01b5f9081526001600160a01b0391909116600452602490fd5b15614d045750565b63bbfeed9360e01b5f9081526001600160a01b0391909116600452602490fd5b90601f801991011681019081106001600160401b03821117614d4557604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361214057565b5190811515820361214057565b6001600160a01b039091168152602081019190915260400190565b8115614d9f570490565b634e487b7160e01b5f52601260045260245ffd5b916020908281520191905f905b808210614dcd5750505090565b91929091908335906001600160a01b0382168203612140576001600160a01b039091168152602090810193019160010190614dc0565b9035601e19823603018112156121405701602081359101916001600160401b038211612140578160051b3603831361214057565b90602083828152019260208260051b82010193835f925b848410614e5e5750505050505090565b909192939495602080614e86600193601f19868203018852614e808b88614e03565b90614db3565b9801940194019294939190614e4e565b91908201809211614ea357565b634e487b7160e01b5f52601160045260245ffd5b5f198114614ea35760010190565b6001600160a01b0391821681529116602082015260400190565b6001600160401b038111614d455760051b60200190565b90614f0082614edf565b614f0d6040519182614d24565b8281528092614f1e601f1991614edf565b0190602036910137565b8051821015614cab5760209160051b010190565b6001600160a01b038116903382900361508a575b815f526020805260405f205491821561508557805f52601e60205260405f206001840190818511614ea357815f5260205260405f2091604051808460208296549384815201905f5260205f20925f5b818110615063575050614fb492500384614d24565b805f52601f60205260405f20825f5260205260405f20541561505c57614fda8351614ef6565b935f5b845181101561503357600190835f52601d60205260405f20855f5260205260405f20828060a01b0361500f8389614f28565b5116838060a01b03165f5260205260405f205461502c8289614f28565b5201614fdd565b5091505061504b9362093a8042041461504e57615809565b50565b61505781615563565b615809565b5050505050565b84546001600160a01b0316835260019485019488945060209093019201614f9f565b505050565b600e5460405163c23a246560e01b8152906001600160a01b0316602082806150b6863360048401614ec5565b0381845afa90811561458a575f916150ec575b6150dd925081156150e2575b503390614cd4565b614f50565b905033145f6150d5565b90506020823d602011615121575b8161510760209383614d24565b810103126121405761511b6150dd92614d6d565b906150c9565b3d91506150fa565b519061ffff8216820361214057565b9190918054831015614cab575f526003600a60205f208185040193060290565b6001600160a01b0380821693929190821684101561518b5780935b6001600160a01b03851603615186575090565b905090565b8193615173565b81810292918115918404141715614ea357565b6151db90825f52602160205260405f20549060018060a01b03165f52601c60205260405f20835f5260205260405f205490615192565b90670de0b6b3a7640000820291808304670de0b6b3a76400001490151715614ea357816152085750505f90565b670de0b6b3a764000091615228915f52602260205260405f205490614d95565b0490565b91908203918211614ea357565b6001600160a01b03165f8181526028602052604081205491939160ff16615261575b50505050565b821561525b57835f52602460205260405f20825f5260205260ff60405f20541661525b5760018060a01b03600d54166152ab620f42406152a360105487615192565b04809561522c565b9260019084151590816154b8575b8615159283615438575b6152d1575b5050505061525b565b875f52602460205260405f20905f5260205260405f20600160ff198254161790556153d8575b615341575b50509061530891614e96565b6040519081527f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b1760203392a35f808080808080806152c8565b803b156107aa576040516304ba099d60e21b815260048101859052828160248183865af18015610c5f579083916153c3575b5050843b156107aa57818461539d92604051938492839263b66503cf60e01b845260048401614d7a565b038183895af180156103f757156152fc576153b9828092614d24565b6103f457806152fc565b816153cd91614d24565b6107aa57815f615373565b6002546001600160a01b0316863b15612140575f8561540c92604051938492839263b66503cf60e01b845260048401614d7a565b0381838b5af1801561458a57615423575b506152f7565b6154309193505f90614d24565b5f915f61541d565b62093a808804158015615452575b156152c357505f6152c3565b50604051634cde602960e11b8152600481018690526020816024818d5afa90811561458a575f91615486575b508810615446565b90506020813d6020116154b0575b816154a160209383614d24565b8101031261214057515f61547e565b3d9150615494565b62093a8086041580156154d3575b156152b9575f92506152b9565b50600254604051634cde602960e11b81526001600160a01b0390911660048201526020816024818c5afa90811561458a575f91615513575b5086106154c6565b90506020813d60201161553d575b8161552e60209383614d24565b8101031261214057515f61550b565b3d9150615521565b60025f54146155545760025f55565b633ee5aeb560e01b5f5260045ffd5b62093a80420460018101809111614ea35760018060a01b038216805f52601e60205260405f20825f5260205260405f20604051808260208294549384815201905f5260205f20925f5b8181106157e75750506155c192500382614d24565b815f52601f60205260405f20835f5260205260405f205492836155e5575050505050565b90919293945f5b835181101561576957845f52601d60205260405f20835f5260205260405f2060018060a01b0361561c8387614f28565b511660018060a01b03165f5260205260405f20549060018060a01b036156428287614f28565b51165f52601c60205260405f20845f5260205260405f2061566483825461522c565b9055855f52601d60205260405f20845f5260205260405f2060018060a01b0361568d8388614f28565b511660018060a01b03165f526020525f604081205560018060a01b036156b38287614f28565b51165f908152601960209081526040808320546001600160a01b039081168452601b909252909120541691823b156121405760405163293311ab60e01b8152600481018290526001600160a01b038a166024820152925f908490604490829084905af192831561458a5760205f927f433fa8b9e8e2cb00bd714503252e8bfd144f0f318459a2ea8b39c1ae2536171792600196615759575b50604051908152a2016155ec565b8461576391614d24565b5f61574b565b509450929050825f52602260205261578660405f2091825461522c565b9055805f52601f60205260405f20825f526020525f60408120555f52601e60205260405f20905f5260205260405f208054905f8155816157c9575b80808061505c565b5f5260205f20908101905b818110156157c1575f81556001016157d4565b84546001600160a01b03168352600194850194869450602090930192016155ac565b919062093a8042046001810193848211614ea357600e546040516370a0823160e01b81526001600160a01b0383811660048301819052939260209183916024918391165afa90811561458a575f91615b44575b50825f52601f60205260405f20875f526020528060405f2055825f52601e60205260405f20875f5260205260405f208551906001600160401b038211614d4557600160401b8211614d45578054828255808310615b1e575b5060208701905f5260205f205f5b838110615b0157505050505f965f975b86518910156158fa576158f26001916158eb8b8b614f28565b5190614e96565b9801976158d2565b909294975097909294975f5b8951811015615ad0576001600160a01b03615921828c614f28565b51165f52601960205260018060a01b0360405f20541690815f52602860205260ff60405f20541615615ac15761596a836159658861595f858e614f28565b51615192565b614d95565b91615975828b614f28565b5115615ab1576001600160a01b0361598d838e614f28565b51165f52601c60205260405f20865f5260205260405f206159af848254614e96565b90555f898152601d6020908152604080832089845290915290206001600160a01b036159db848f614f28565b511660018060a01b03165f5260205260405f206159f9848254614e96565b90555f908152601b60205260409020546001600160a01b031691823b1561214057604051630463cd9760e41b8152600481018290526001600160a01b0389166024820152925f908490604490829084905af192831561458a577fc2e0f725ed6a663192d51dd063d0ac1cd49139c4b1c7a33d9a58ee09f22d100e60208e8c93600197615aa1575b50615a9186888060a01b0392614f28565b511693604051908152a301615906565b5f615aab91614d24565b5f615a80565b5050505096505050505050505f90565b50505096505050505050505f90565b5050965091509192505f526022602052615aef60405f20918254614e96565b90555f526020805260405f2055600190565b82516001600160a01b0316818301556020909201916001016158c2565b815f528260205f2091820191015b818110615b3957506158b4565b5f8155600101615b2c565b90506020813d602011615b6e575b81615b5f60209383614d24565b8101031261214057515f61585c565b3d9150615b52565b805f52601460205260405f2054155f14615bdc57601354600160401b811015614d4557615bc5615baf8260018594016013556013614cbf565b819391549060031b91821b915f19901b19161790565b9055601354905f52601460205260405f2055600190565b505f90565b805f52601660205260405f2054155f14615bdc57601554600160401b811015614d4557615c1a615baf8260018594016015556015614cbf565b9055601554905f52601660205260405f2055600190565b805f52601260205260405f2054155f14615bdc57601154600160401b811015614d4557615c6a615baf8260018594016011556011614cbf565b9055601154905f52601260205260405f2055600190565b805f52601860205260405f2054155f14615bdc57601754600160401b811015614d4557615cba615baf8260018594016017556017614cbf565b9055601754905f52601860205260405f205560019056fe04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0048d3c521fd0d5541640f58c6d6381eed7cb2e8c9df421ae165a4f4c2d221ee0da264697066735822122021110a17569e18f2f0495e6475374973cd81cf71350669df551c19c49d26d00e64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ 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.