Contract
0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c
16
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
Voter
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IVotingRewardsFactory} from "./interfaces/factories/IVotingRewardsFactory.sol"; import {IGauge} from "./interfaces/IGauge.sol"; import {IGaugeFactory} from "./interfaces/factories/IGaugeFactory.sol"; import {IMinter} from "./interfaces/IMinter.sol"; import {IPool} from "./interfaces/IPool.sol"; import {IPoolFactory} from "./interfaces/factories/IPoolFactory.sol"; import {IReward} from "./interfaces/IReward.sol"; import {IVoter} from "./interfaces/IVoter.sol"; import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol"; import {IFactoryRegistry} from "./interfaces/factories/IFactoryRegistry.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ERC2771Context} from "@openzeppelin/contracts/metatx/ERC2771Context.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {VelodromeTimeLibrary} from "./libraries/VelodromeTimeLibrary.sol"; /// @title Velodrome V2 Voter /// @author velodrome.finance, @figs999, @pegahcarter /// @notice Manage votes, emission distribution, and gauge creation within the Velodrome ecosystem. /// Also provides support for depositing and withdrawing from managed veNFTs. contract Voter is IVoter, ERC2771Context, ReentrancyGuard { using SafeERC20 for IERC20; /// @notice Store trusted forwarder address to pass into factories address public immutable forwarder; /// @notice The ve token that governs these contracts address public immutable ve; /// @notice Factory registry for valid pool / gauge / rewards factories address public immutable factoryRegistry; /// @notice V1 factory address public immutable v1Factory; /// @notice Base token of ve contract address internal immutable rewardToken; /// @notice Rewards are released over 7 days uint256 internal constant DURATION = 7 days; address public minter; /// @notice Standard OZ IGovernor using ve for vote weights. address public governor; /// @notice Custom Epoch Governor using ve for vote weights. address public epochGovernor; /// @notice credibly neutral party similar to Curve's Emergency DAO address public emergencyCouncil; /// @dev Total Voting Weights uint256 public totalWeight; /// @dev Most number of pools one voter can vote for at once uint256 public maxVotingNum; uint256 internal constant MIN_MAXVOTINGNUM = 10; /// @dev All pools viable for incentives address[] public pools; /// @dev Pool => Gauge mapping(address => address) public gauges; /// @dev Gauge => Pool mapping(address => address) public poolForGauge; /// @dev Gauge => Fees Voting Reward mapping(address => address) public gaugeToFees; /// @dev Gauge => Bribes Voting Reward mapping(address => address) public gaugeToBribe; /// @dev Pool => Weights mapping(address => uint256) public weights; /// @dev NFT => Pool => Votes mapping(uint256 => mapping(address => uint256)) public votes; /// @dev NFT => List of pools voted for by NFT mapping(uint256 => address[]) public poolVote; /// @dev NFT => Total voting weight of NFT mapping(uint256 => uint256) public usedWeights; /// @dev Nft => Timestamp of last vote (ensures single vote per epoch) mapping(uint256 => uint256) public lastVoted; /// @dev Address => Gauge mapping(address => bool) public isGauge; /// @dev Token => Whitelisted status mapping(address => bool) public isWhitelistedToken; /// @dev TokenId => Whitelisted status mapping(uint256 => bool) public isWhitelistedNFT; /// @dev Gauge => Liveness status mapping(address => bool) public isAlive; /// @dev Accumulated distributions per vote uint256 internal index; /// @dev Gauge => Accumulated gauge distributions mapping(address => uint256) internal supplyIndex; /// @dev Gauge => Amount claimable mapping(address => uint256) public claimable; constructor( address _forwarder, address _ve, address _factoryRegistry, address _v1Factory ) ERC2771Context(_forwarder) { forwarder = _forwarder; ve = _ve; factoryRegistry = _factoryRegistry; v1Factory = _v1Factory; rewardToken = IVotingEscrow(_ve).token(); address _sender = _msgSender(); minter = _sender; governor = _sender; epochGovernor = _sender; emergencyCouncil = _sender; maxVotingNum = 30; } modifier onlyNewEpoch(uint256 _tokenId) { // ensure new epoch since last vote if (VelodromeTimeLibrary.epochStart(block.timestamp) <= lastVoted[_tokenId]) revert AlreadyVotedOrDeposited(); if (block.timestamp <= VelodromeTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow(); _; } function epochStart(uint256 _timestamp) external pure returns (uint256) { return VelodromeTimeLibrary.epochStart(_timestamp); } function epochNext(uint256 _timestamp) external pure returns (uint256) { return VelodromeTimeLibrary.epochNext(_timestamp); } function epochVoteStart(uint256 _timestamp) external pure returns (uint256) { return VelodromeTimeLibrary.epochVoteStart(_timestamp); } function epochVoteEnd(uint256 _timestamp) external pure returns (uint256) { return VelodromeTimeLibrary.epochVoteEnd(_timestamp); } /// @dev requires initialization with at least rewardToken function initialize(address[] calldata _tokens, address _minter) external { if (_msgSender() != minter) revert NotMinter(); uint256 _length = _tokens.length; for (uint256 i = 0; i < _length; i++) { _whitelistToken(_tokens[i], true); } minter = _minter; } /// @inheritdoc IVoter function setGovernor(address _governor) public { if (_msgSender() != governor) revert NotGovernor(); if (_governor == address(0)) revert ZeroAddress(); governor = _governor; } /// @inheritdoc IVoter function setEpochGovernor(address _epochGovernor) public { if (_msgSender() != governor) revert NotGovernor(); if (_epochGovernor == address(0)) revert ZeroAddress(); epochGovernor = _epochGovernor; } /// @inheritdoc IVoter function setEmergencyCouncil(address _council) public { if (_msgSender() != emergencyCouncil) revert NotEmergencyCouncil(); if (_council == address(0)) revert ZeroAddress(); emergencyCouncil = _council; } function setMaxVotingNum(uint256 _maxVotingNum) external { if (_msgSender() != governor) revert NotGovernor(); if (_maxVotingNum < MIN_MAXVOTINGNUM) revert MaximumVotingNumberTooLow(); if (_maxVotingNum == maxVotingNum) revert SameValue(); maxVotingNum = _maxVotingNum; } /// @inheritdoc IVoter function reset(uint256 _tokenId) external onlyNewEpoch(_tokenId) nonReentrant { if (!IVotingEscrow(ve).isApprovedOrOwner(msg.sender, _tokenId)) revert NotApprovedOrOwner(); _reset(_tokenId); } function _reset(uint256 _tokenId) internal { address[] storage _poolVote = poolVote[_tokenId]; uint256 _poolVoteCnt = _poolVote.length; uint256 _totalWeight = 0; for (uint256 i = 0; i < _poolVoteCnt; i++) { address _pool = _poolVote[i]; uint256 _votes = votes[_tokenId][_pool]; if (_votes != 0) { _updateFor(gauges[_pool]); weights[_pool] -= _votes; delete votes[_tokenId][_pool]; IReward(gaugeToFees[gauges[_pool]])._withdraw(uint256(_votes), _tokenId); IReward(gaugeToBribe[gauges[_pool]])._withdraw(uint256(_votes), _tokenId); _totalWeight += _votes; emit Abstained(_msgSender(), _pool, _tokenId, _votes, weights[_pool], block.timestamp); } } IVotingEscrow(ve).voting(_tokenId, false); totalWeight -= _totalWeight; usedWeights[_tokenId] = 0; delete poolVote[_tokenId]; } /// @inheritdoc IVoter function poke(uint256 _tokenId) external nonReentrant { if (block.timestamp <= VelodromeTimeLibrary.epochVoteStart(block.timestamp)) revert DistributeWindow(); uint256 _weight = IVotingEscrow(ve).balanceOfNFT(_tokenId); _poke(_tokenId, _weight); } function _poke(uint256 _tokenId, uint256 _weight) internal { address[] memory _poolVote = poolVote[_tokenId]; uint256 _poolCnt = _poolVote.length; uint256[] memory _weights = new uint256[](_poolCnt); for (uint256 i = 0; i < _poolCnt; i++) { _weights[i] = votes[_tokenId][_poolVote[i]]; } _vote(_tokenId, _weight, _poolVote, _weights); } function _vote(uint256 _tokenId, uint256 _weight, address[] memory _poolVote, uint256[] memory _weights) internal { _reset(_tokenId); uint256 _poolCnt = _poolVote.length; uint256 _totalVoteWeight = 0; uint256 _totalWeight = 0; uint256 _usedWeight = 0; for (uint256 i = 0; i < _poolCnt; i++) { _totalVoteWeight += _weights[i]; } for (uint256 i = 0; i < _poolCnt; i++) { address _pool = _poolVote[i]; address _gauge = gauges[_pool]; if (_gauge == address(0)) revert GaugeDoesNotExist(_pool); if (!isAlive[_gauge]) revert GaugeNotAlive(_gauge); if (isGauge[_gauge]) { uint256 _poolWeight = (_weights[i] * _weight) / _totalVoteWeight; if (votes[_tokenId][_pool] != 0) revert NonZeroVotes(); if (_poolWeight == 0) revert ZeroBalance(); _updateFor(_gauge); poolVote[_tokenId].push(_pool); weights[_pool] += _poolWeight; votes[_tokenId][_pool] += _poolWeight; IReward(gaugeToFees[_gauge])._deposit(uint256(_poolWeight), _tokenId); IReward(gaugeToBribe[_gauge])._deposit(uint256(_poolWeight), _tokenId); _usedWeight += _poolWeight; _totalWeight += _poolWeight; emit Voted(_msgSender(), _pool, _tokenId, _poolWeight, weights[_pool], block.timestamp); } } if (_usedWeight > 0) IVotingEscrow(ve).voting(_tokenId, true); totalWeight += uint256(_totalWeight); usedWeights[_tokenId] = uint256(_usedWeight); } /// @inheritdoc IVoter function vote( uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights ) external onlyNewEpoch(_tokenId) nonReentrant { address _sender = _msgSender(); if (!IVotingEscrow(ve).isApprovedOrOwner(_sender, _tokenId)) revert NotApprovedOrOwner(); if (_poolVote.length != _weights.length) revert UnequalLengths(); if (_poolVote.length > maxVotingNum) revert TooManyPools(); if (IVotingEscrow(ve).deactivated(_tokenId)) revert InactiveManagedNFT(); uint256 _timestamp = block.timestamp; if ((_timestamp > VelodromeTimeLibrary.epochVoteEnd(_timestamp)) && !isWhitelistedNFT[_tokenId]) revert NotWhitelistedNFT(); lastVoted[_tokenId] = _timestamp; uint256 _weight = IVotingEscrow(ve).balanceOfNFT(_tokenId); _vote(_tokenId, _weight, _poolVote, _weights); } /// @inheritdoc IVoter function depositManaged(uint256 _tokenId, uint256 _mTokenId) external nonReentrant onlyNewEpoch(_tokenId) { address _sender = _msgSender(); if (!IVotingEscrow(ve).isApprovedOrOwner(_sender, _tokenId)) revert NotApprovedOrOwner(); if (IVotingEscrow(ve).deactivated(_mTokenId)) revert InactiveManagedNFT(); uint256 _timestamp = block.timestamp; if (_timestamp > VelodromeTimeLibrary.epochVoteEnd(_timestamp)) revert SpecialVotingWindow(); lastVoted[_tokenId] = _timestamp; IVotingEscrow(ve).depositManaged(_tokenId, _mTokenId); uint256 _weight = IVotingEscrow(ve).balanceOfNFTAt(_mTokenId, block.timestamp); _poke(_mTokenId, _weight); } /// @inheritdoc IVoter function withdrawManaged(uint256 _tokenId) external nonReentrant onlyNewEpoch(_tokenId) { if (!IVotingEscrow(ve).isApprovedOrOwner(_msgSender(), _tokenId)) revert NotApprovedOrOwner(); uint256 _mTokenId = IVotingEscrow(ve).idToManaged(_tokenId); IVotingEscrow(ve).withdrawManaged(_tokenId); // If the NORMAL veNFT was the last tokenId locked into _mTokenId, reset vote as there is // no longer voting power available to the _mTokenId. Otherwise, updating voting power to accurately // reflect the withdrawn voting power. uint256 _weight = IVotingEscrow(ve).balanceOfNFTAt(_mTokenId, block.timestamp); if (_weight == 0) { _reset(_mTokenId); // clear out lastVoted to allow re-voting in the current epoch delete lastVoted[_mTokenId]; } else { _poke(_mTokenId, _weight); } } /// @inheritdoc IVoter function whitelistToken(address _token, bool _bool) external { if (_msgSender() != governor) revert NotGovernor(); _whitelistToken(_token, _bool); } function _whitelistToken(address _token, bool _bool) internal { isWhitelistedToken[_token] = _bool; emit WhitelistToken(_msgSender(), _token, _bool); } /// @inheritdoc IVoter function whitelistNFT(uint256 _tokenId, bool _bool) external { address _sender = _msgSender(); if (_sender != governor) revert NotGovernor(); isWhitelistedNFT[_tokenId] = _bool; emit WhitelistNFT(_sender, _tokenId, _bool); } /// @inheritdoc IVoter function createGauge(address _poolFactory, address _pool) external nonReentrant returns (address) { address sender = _msgSender(); if (!IFactoryRegistry(factoryRegistry).isPoolFactoryApproved(_poolFactory)) revert FactoryPathNotApproved(); if (gauges[_pool] != address(0)) revert GaugeExists(); if ((_poolFactory == v1Factory) && (sender != governor)) revert NotGovernor(); (address votingRewardsFactory, address gaugeFactory) = IFactoryRegistry(factoryRegistry).factoriesToPoolFactory( _poolFactory ); address[] memory rewards = new address[](2); bool isPool = IPoolFactory(_poolFactory).isPair(_pool); // backwards compatibility to v1 { // stack too deep address token0; address token1; if (isPool) { token0 = IPool(_pool).token0(); token1 = IPool(_pool).token1(); rewards[0] = token0; rewards[1] = token1; } if (sender != governor) { if (!isPool) revert NotAPool(); if (!isWhitelistedToken[token0] || !isWhitelistedToken[token1]) revert NotWhitelistedToken(); } } (address _feeVotingReward, address _bribeVotingReward) = IVotingRewardsFactory(votingRewardsFactory) .createRewards(forwarder, rewards); address _gauge = IGaugeFactory(gaugeFactory).createGauge( forwarder, _pool, _feeVotingReward, rewardToken, isPool ); gaugeToFees[_gauge] = _feeVotingReward; gaugeToBribe[_gauge] = _bribeVotingReward; gauges[_pool] = _gauge; poolForGauge[_gauge] = _pool; isGauge[_gauge] = true; isAlive[_gauge] = true; _updateFor(_gauge); pools.push(_pool); emit GaugeCreated( _poolFactory, votingRewardsFactory, gaugeFactory, _pool, _bribeVotingReward, _feeVotingReward, _gauge, sender ); return _gauge; } /// @inheritdoc IVoter function killGauge(address _gauge) external { if (_msgSender() != emergencyCouncil) revert NotEmergencyCouncil(); if (!isAlive[_gauge]) revert GaugeAlreadyKilled(); // Return claimable back to minter uint256 _claimable = claimable[_gauge]; if (_claimable > 0) { IERC20(rewardToken).safeTransfer(minter, _claimable); delete claimable[_gauge]; } isAlive[_gauge] = false; emit GaugeKilled(_gauge); } /// @inheritdoc IVoter function reviveGauge(address _gauge) external { if (_msgSender() != emergencyCouncil) revert NotEmergencyCouncil(); if (isAlive[_gauge]) revert GaugeAlreadyRevived(); isAlive[_gauge] = true; emit GaugeRevived(_gauge); } function length() external view returns (uint256) { return pools.length; } /// @inheritdoc IVoter function notifyRewardAmount(uint256 _amount) external { address sender = _msgSender(); if (sender != minter) revert NotMinter(); IERC20(rewardToken).safeTransferFrom(sender, address(this), _amount); // transfer the distribution in uint256 _ratio = (_amount * 1e18) / Math.max(totalWeight, 1); // 1e18 adjustment is removed during claim if (_ratio > 0) { index += _ratio; } emit NotifyReward(sender, rewardToken, _amount); } /// @inheritdoc IVoter function updateFor(address[] memory _gauges) external { uint256 _length = _gauges.length; for (uint256 i = 0; i < _length; i++) { _updateFor(_gauges[i]); } } /// @inheritdoc IVoter function updateFor(uint256 start, uint256 end) external { for (uint256 i = start; i < end; i++) { _updateFor(gauges[pools[i]]); } } /// @inheritdoc IVoter function updateFor(address _gauge) external { _updateFor(_gauge); } function _updateFor(address _gauge) internal { address _pool = poolForGauge[_gauge]; uint256 _supplied = weights[_pool]; if (_supplied > 0) { uint256 _supplyIndex = supplyIndex[_gauge]; uint256 _index = index; // get global index0 for accumulated distribution supplyIndex[_gauge] = _index; // update _gauge current position to global position uint256 _delta = _index - _supplyIndex; // see if there is any difference that need to be accrued if (_delta > 0) { uint256 _share = (uint256(_supplied) * _delta) / 1e18; // add accrued difference for each supplied token if (isAlive[_gauge]) { claimable[_gauge] += _share; } else { IERC20(rewardToken).safeTransfer(minter, _share); // send rewards back to Minter so they're not stuck in Voter } } } else { supplyIndex[_gauge] = index; // new users are set to the default global state } } /// @inheritdoc IVoter function claimRewards(address[] memory _gauges) external { uint256 _length = _gauges.length; for (uint256 i = 0; i < _length; i++) { IGauge(_gauges[i]).getReward(_msgSender()); } } /// @inheritdoc IVoter function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external { if (!IVotingEscrow(ve).isApprovedOrOwner(_msgSender(), _tokenId)) revert NotApprovedOrOwner(); uint256 _length = _bribes.length; for (uint256 i = 0; i < _length; i++) { IReward(_bribes[i]).getReward(_tokenId, _tokens[i]); } } /// @inheritdoc IVoter function claimFees(address[] memory _fees, address[][] memory _tokens, uint256 _tokenId) external { if (!IVotingEscrow(ve).isApprovedOrOwner(_msgSender(), _tokenId)) revert NotApprovedOrOwner(); uint256 _length = _fees.length; for (uint256 i = 0; i < _length; i++) { IReward(_fees[i]).getReward(_tokenId, _tokens[i]); } } function _distribute(address _gauge) internal { _updateFor(_gauge); // should set claimable to 0 if killed uint256 _claimable = claimable[_gauge]; if (_claimable > IGauge(_gauge).left() && _claimable > DURATION) { claimable[_gauge] = 0; IERC20(rewardToken).safeApprove(_gauge, _claimable); IGauge(_gauge).notifyRewardAmount(_claimable); IERC20(rewardToken).safeApprove(_gauge, 0); emit DistributeReward(_msgSender(), _gauge, _claimable); } } /// @inheritdoc IVoter function distribute(uint256 _start, uint256 _finish) external nonReentrant { IMinter(minter).updatePeriod(); for (uint256 x = _start; x < _finish; x++) { _distribute(gauges[pools[x]]); } } /// @inheritdoc IVoter function distribute(address[] memory _gauges) external nonReentrant { IMinter(minter).updatePeriod(); uint256 _length = _gauges.length; for (uint256 x = 0; x < _length; x++) { _distribute(_gauges[x]); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IVotingRewardsFactory { /// @notice creates a BribeVotingReward and a FeesVotingReward contract for a gauge /// @param _forwarder Address of trusted forwarder /// @param _rewards Addresses of pool tokens to be used as valid rewards tokens /// @return feesVotingReward Address of FeesVotingReward contract created /// @return bribeVotingReward Address of BribeVotingReward contract created function createRewards( address _forwarder, address[] memory _rewards ) external returns (address feesVotingReward, address bribeVotingReward); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGauge { error NotAlive(); error NotAuthorized(); error NotVoter(); error RewardRateTooHigh(); error ZeroAmount(); error ZeroRewardRate(); event Deposit(address indexed from, address indexed to, uint256 amount); event Withdraw(address indexed from, uint256 amount); event NotifyReward(address indexed from, uint256 amount); event ClaimFees(address indexed from, uint256 claimed0, uint256 claimed1); event ClaimRewards(address indexed from, uint256 amount); function rewardPerToken() external view returns (uint256 _rewardPerToken); /// @notice Returns the last time the reward was modified or periodFinish if the reward has ended function lastTimeRewardApplicable() external view returns (uint256 _time); /// @notice Returns accrued balance to date from last claim / first deposit. function earned(address _account) external view returns (uint256 _earned); function left() external view returns (uint256 _left); /// @notice Returns if gauge is linked to a legitimate Velodrome pool function isPool() external view returns (bool _isPool); function stakingToken() external view returns (address _pool); /// @notice Retrieve rewards for an address. /// @dev Throws if not called by same address or voter. /// @param _account . function getReward(address _account) external; /// @notice Deposit LP tokens into gauge for msg.sender /// @param _amount . function deposit(uint256 _amount) external; /// @notice Deposit LP tokens into gauge for any user /// @param _amount . /// @param _recipient Recipient to give balance to function deposit(uint256 _amount, address _recipient) external; /// @notice Withdraw LP tokens for user /// @param _amount . function withdraw(uint256 _amount) external; /// @dev Notifies gauge of gauge rewards. Assumes gauge reward tokens is 18 decimals. /// If not 18 decimals, rewardRate may have rounding issues. function notifyRewardAmount(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGaugeFactory { function createGauge( address _forwarder, address _pool, address _feesVotingReward, address _ve, bool isPool ) external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IMinter { error AlreadyNudged(); error NotEpochGovernor(); error TailEmissionsInactive(); event Mint(address indexed _sender, uint256 _weekly, uint256 _circulating_supply, bool indexed _tail); event Nudge(uint256 indexed _period, uint256 _oldRate, uint256 _newRate); /// @notice Timestamp of start of epoch that updatePeriod was last called in function activePeriod() external returns (uint256); /// @notice Allows epoch governor to modify the tail emission rate by at most 1 basis point /// per epoch to a maximum of 100 basis points or to a minimum of 1 basis point. /// Note: the very first nudge proposal must take place the week prior /// to the tail emission schedule starting. /// @dev Throws if not epoch governor. /// Throws if not currently in tail emission schedule. /// Throws if already nudged this epoch. /// Throws if nudging above maximum rate. /// Throws if nudging below minimum rate. /// This contract is coupled to EpochGovernor as it requires three option simple majority voting. function nudge() external; /// @notice Calculates rebases according to the formula /// weekly * (ve.totalSupply / velo.totalSupply) ^ 3 / 2 /// Note that ve.totalSupply is the locked ve supply /// velo.totalSupply is the total ve supply minted /// @param _minted Amount of VELO minted this epoch /// @return _growth Rebases function calculateGrowth(uint256 _minted) external view returns (uint256 _growth); /// @notice Processes emissions and rebases. Callable once per epoch (1 week). /// @return _period Start of current epoch. function updatePeriod() external returns (uint256 _period); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPool { error DepositsNotEqual(); error BelowMinimumK(); error FactoryAlreadySet(); error InsufficientLiquidity(); error InsufficientLiquidityMinted(); error InsufficientLiquidityBurned(); error InsufficientOutputAmount(); error InsufficientInputAmount(); error IsPaused(); error InvalidTo(); error K(); error NotEmergencyCouncil(); event Fees(address indexed sender, uint256 amount0, uint256 amount1); event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, address indexed to, uint256 amount0, uint256 amount1); event Swap( address indexed sender, address indexed to, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out ); event Sync(uint256 reserve0, uint256 reserve1); event Claim(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1); function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1); function claimFees() external returns (uint256, uint256); function tokens() external view returns (address, address); function token0() external view returns (address); function token1() external view returns (address); function stable() external view returns (bool); function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; function burn(address to) external returns (uint256 amount0, uint256 amount1); function mint(address to) external returns (uint256 liquidity); function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast); function getAmountOut(uint256, address) external view returns (uint256); function skim(address to) external; function initialize(address _token0, address _token1, bool _stable) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPoolFactory { event SetFeeManager(address feeManager); event SetPauser(address pauser); event SetPauseState(bool state); event SetVoter(address voter); event PoolCreated(address indexed token0, address indexed token1, bool indexed stable, address pool, uint256); event SetCustomFee(address indexed pool, uint256 fee); error FeeInvalid(); error FeeTooHigh(); error InvalidPool(); error NotFeeManager(); error NotPauser(); error NotSinkConverter(); error NotVoter(); error PoolAlreadyExists(); error SameAddress(); error ZeroFee(); error ZeroAddress(); /// @notice returns the number of pools created from this factory function allPoolsLength() external view returns (uint256); /// @notice Is a valid pool created by this factory. /// @param . function isPool(address pool) external view returns (bool); /// @notice Support for Velodrome v1 which wraps around isPool(pool); /// @param . function isPair(address pool) external view returns (bool); /// @notice Return address of pool created by this factory /// @param tokenA . /// @param tokenB . /// @param stable True if stable, false if volatile function getPool(address tokenA, address tokenB, bool stable) external view returns (address); /// @notice Support for v3-style pools which wraps around getPool(tokenA,tokenB,stable) /// @dev fee is converted to stable boolean. /// @param tokenA . /// @param tokenB . /// @param fee 1 if stable, 0 if volatile, else returns address(0) function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address); /// @notice Support for Velodrome v1 pools as a "pool" was previously referenced as "pair" /// @notice Wraps around getPool(tokenA,tokenB,stable) function getPair(address tokenA, address tokenB, bool stable) external view returns (address); /// @dev Only called once to set to Voter.sol - Voter does not have a function /// to call this contract method, so once set it's immutable. /// This also follows convention of setVoterAndDistributor() in VotingEscrow.sol /// @param _voter . function setVoter(address _voter) external; function setSinkConverter(address _sinkConvert, address _velo, address _veloV2) external; function setPauser(address _pauser) external; function setPauseState(bool _state) external; function setFeeManager(address _feeManager) external; /// @notice Set default fee for stable and volatile pools. /// @dev Throws if higher than maximum fee. /// Throws if fee is zero. /// @param _stable Stable or volatile pool. /// @param _fee . function setFee(bool _stable, uint256 _fee) external; /// @notice Set overriding fee for a pool from the default /// @dev A custom fee of zero means the default fee will be used. function setCustomFee(address _pool, uint256 _fee) external; /// @notice Returns fee for a pool, as custom fees are possible. function getFee(address _pool, bool _stable) external view returns (uint256); /// @notice Create a pool given two tokens and if they're stable/volatile /// @dev token order does not matter /// @param tokenA . /// @param tokenB . /// @param stable . function createPool(address tokenA, address tokenB, bool stable) external returns (address pool); /// @notice Support for v3-style pools which wraps around createPool(tokena,tokenB,stable) /// @dev fee is converted to stable boolean /// @dev token order does not matter /// @param tokenA . /// @param tokenB . /// @param fee 1 if stable, 0 if volatile, else revert function createPool(address tokenA, address tokenB, uint24 fee) external returns (address pool); /// @notice Support for Velodrome v1 which wraps around createPool(tokenA,tokenB,stable) function createPair(address tokenA, address tokenB, bool stable) external returns (address pool); function isPaused() external view returns (bool); function velo() external view returns (address); function veloV2() external view returns (address); function voter() external view returns (address); function sinkConverter() external view returns (address); function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IReward { error InvalidReward(); error NotAuthorized(); error NotGauge(); error NotEscrowToken(); error NotSingleToken(); error NotVotingEscrow(); error NotWhitelisted(); error ZeroAmount(); event Deposit(address indexed from, uint256 indexed tokenId, uint256 amount); event Withdraw(address indexed from, uint256 indexed tokenId, uint256 amount); event NotifyReward(address indexed from, address indexed reward, uint256 indexed epoch, uint256 amount); event ClaimRewards(address indexed from, address indexed reward, uint256 amount); /// @notice Deposit an amount into the rewards contract to earn future rewards associated to a veNFT /// @dev Internal notation used as only callable internally by `authorized`. /// @param amount Amount deposited for the veNFT /// @param tokenId Unique identifier of the veNFT function _deposit(uint256 amount, uint256 tokenId) external; /// @notice Withdraw an amount from the rewards contract associated to a veNFT /// @dev Internal notation used as only callable internally by `authorized`. /// @param amount Amount deposited for the veNFT /// @param tokenId Unique identifier of the veNFT function _withdraw(uint256 amount, uint256 tokenId) external; /// @notice Claim the rewards earned by a veNFT staker /// @param tokenId Unique identifier of the veNFT /// @param tokens Array of tokens to claim rewards of function getReward(uint256 tokenId, address[] memory tokens) external; /// @notice Add rewards for stakers to earn /// @param token Address of token to reward /// @param amount Amount of token to transfer to rewards function notifyRewardAmount(address token, uint256 amount) external; /// @notice Determine the prior balance for an account as of a block number /// @dev Block number must be a finalized block or else this function will revert to prevent misinformation. /// @param tokenId The token of the NFT to check /// @param timestamp The timestamp to get the balance at /// @return The balance the account had as of the given block function getPriorBalanceIndex(uint256 tokenId, uint256 timestamp) external view returns (uint256); /// @notice Determine the prior index of supply staked by of a timestamp /// @dev Timestamp must be <= current timestamp /// @param timestamp The timestamp to get the index at /// @return Index of supply checkpoint function getPriorSupplyIndex(uint256 timestamp) external view returns (uint256); /// @notice Calculate how much in rewards are earned for a specific token and veNFT /// @param token Address of token to fetch rewards of /// @param tokenId Unique identifier of the veNFT /// @return Amount of token earned in rewards function earned(address token, uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IVoter { error AlreadyVotedOrDeposited(); error DistributeWindow(); error FactoryPathNotApproved(); error GaugeAlreadyKilled(); error GaugeAlreadyRevived(); error GaugeExists(); error GaugeDoesNotExist(address _pool); error GaugeNotAlive(address _gauge); error InactiveManagedNFT(); error MaximumVotingNumberTooLow(); error NonZeroVotes(); error NotAPool(); error NotApprovedOrOwner(); error NotGovernor(); error NotEmergencyCouncil(); error NotMinter(); error NotWhitelistedNFT(); error NotWhitelistedToken(); error SameValue(); error SpecialVotingWindow(); error TooManyPools(); error UnequalLengths(); error ZeroBalance(); error ZeroAddress(); event GaugeCreated( address indexed poolFactory, address indexed votingRewardsFactory, address indexed gaugeFactory, address pool, address bribeVotingReward, address feeVotingReward, address gauge, address creator ); event GaugeKilled(address indexed gauge); event GaugeRevived(address indexed gauge); event Voted( address indexed voter, address indexed pool, uint256 indexed tokenId, uint256 weight, uint256 totalWeight, uint256 timestamp ); event Abstained( address indexed voter, address indexed pool, uint256 indexed tokenId, uint256 weight, uint256 totalWeight, uint256 timestamp ); event NotifyReward(address indexed sender, address indexed reward, uint256 amount); event DistributeReward(address indexed sender, address indexed gauge, uint256 amount); event WhitelistToken(address indexed whitelister, address indexed token, bool indexed _bool); event WhitelistNFT(address indexed whitelister, uint256 indexed tokenId, bool indexed _bool); // mappings function gauges(address pool) external view returns (address); function poolForGauge(address gauge) external view returns (address); function gaugeToFees(address gauge) external view returns (address); function gaugeToBribe(address gauge) external view returns (address); function weights(address pool) external view returns (uint256); function votes(uint256 tokenId, address pool) external view returns (uint256); function usedWeights(uint256 tokenId) external view returns (uint256); function lastVoted(uint256 tokenId) external view returns (uint256); function isGauge(address) external view returns (bool); function isWhitelistedToken(address token) external view returns (bool); function isWhitelistedNFT(uint256 tokenId) external view returns (bool); function isAlive(address gauge) external view returns (bool); function ve() external view returns (address); function governor() external view returns (address); function epochGovernor() external view returns (address); function emergencyCouncil() external view returns (address); function length() external view returns (uint256); /// @notice Called by Minter to distribute weekly emissions rewards for disbursement amongst gauges. /// @dev Assumes totalWeight != 0 (Will never be zero as long as users are voting). /// Throws if not called by minter. /// @param _amount Amount of rewards to distribute. function notifyRewardAmount(uint256 _amount) external; /// @dev Utility to distribute to gauges of pools in range _start to _finish. /// @param _start Starting index of gauges to distribute to. /// @param _finish Ending index of gauges to distribute to. function distribute(uint256 _start, uint256 _finish) external; /// @dev Utility to distribute to gauges of pools in array. /// @param _gauges Array of gauges to distribute to. function distribute(address[] memory _gauges) external; /// @notice Called by users to update voting balances in voting rewards contracts. /// @param _tokenId Id of veNFT whose balance you wish to update. function poke(uint256 _tokenId) external; /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights. /// Can only vote or deposit into a managed NFT once per epoch. /// Can only vote for gauges that have not been killed. /// @dev Weights are distributed proportional to the sum of the weights in the array. /// Throws if length of _poolVote and _weights do not match. /// @param _tokenId Id of veNFT you are voting with. /// @param _poolVote Array of pools you are voting for. /// @param _weights Weights of pools. function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external; /// @notice Called by users to reset voting state. Required if you wish to make changes to /// veNFT state (e.g. merge, split, deposit into managed etc). /// Cannot reset in the same epoch that you voted in. /// Can vote or deposit into a managed NFT again after reset. /// @param _tokenId Id of veNFT you are reseting. function reset(uint256 _tokenId) external; /// @notice Called by users to deposit into a managed NFT. /// Can only vote or deposit into a managed NFT once per epoch. /// Note that NFTs deposited into a managed NFT will be re-locked /// to the maximum lock time on withdrawal. /// @dev Throws if not approved or owner. /// Throws if managed NFT is inactive. /// Throws if depositing within privileged window (one hour prior to epoch flip). function depositManaged(uint256 _tokenId, uint256 _mTokenId) external; /// @notice Called by users to withdraw from a managed NFT. /// Cannot do it in the same epoch that you deposited into a managed NFT. /// Can vote or deposit into a managed NFT again after withdrawing. /// Note that the NFT withdrawn is re-locked to the maximum lock time. function withdrawManaged(uint256 _tokenId) external; /// @notice Claim emissions from gauges. /// @param _gauges Array of gauges to collect emissions from. function claimRewards(address[] memory _gauges) external; /// @notice Claim bribes for a given NFT. /// @dev Utility to help batch bribe claims. /// @param _bribes Array of BribeVotingReward contracts to collect from. /// @param _tokens Array of tokens that are used as bribes. /// @param _tokenId Id of veNFT that you wish to claim bribes for. function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 _tokenId) external; /// @notice Claim fees for a given NFT. /// @dev Utility to help batch fee claims. /// @param _fees Array of FeesVotingReward contracts to collect from. /// @param _tokens Array of tokens that are used as fees. /// @param _tokenId Id of veNFT that you wish to claim fees for. function claimFees(address[] memory _fees, address[][] memory _tokens, uint256 _tokenId) external; /// @notice Set new governor. /// @dev Throws if not called by governor. /// @param _governor . function setGovernor(address _governor) external; /// @notice Set new epoch based governor. /// @dev Throws if not called by governor. /// @param _epochGovernor . function setEpochGovernor(address _epochGovernor) external; /// @notice Set new emergency council. /// @dev Throws if not called by emergency council. /// @param _emergencyCouncil . function setEmergencyCouncil(address _emergencyCouncil) external; /// @notice Whitelist (or unwhitelist) token for use in bribes. /// @dev Throws if not called by governor. /// @param _token . /// @param _bool . function whitelistToken(address _token, bool _bool) external; /// @notice Whitelist (or unwhitelist) token id for voting in last hour prior to epoch flip. /// @dev Throws if not called by governor. /// Throws if already whitelisted. /// @param _tokenId . /// @param _bool . function whitelistNFT(uint256 _tokenId, bool _bool) external; /// @notice Create a new gauge (unpermissioned). /// @dev Governor can create a new gauge for a pool with any address. /// @dev V1 gauges can only be created by governor. /// @param _poolFactory . /// @param _pool . function createGauge(address _poolFactory, address _pool) external returns (address); /// @notice Kills a gauge. The gauge will not receive any new emissions and cannot be deposited into. /// Can still withdraw from gauge. /// @dev Throws if not called by emergency council. /// Throws if gauge already killed. /// @param _gauge . function killGauge(address _gauge) external; /// @notice Revives a killed gauge. Gauge will can receive emissions and deposits again. /// @dev Throws if not called by emergency council. /// Throws if gauge is not killed. /// @param _gauge . function reviveGauge(address _gauge) external; /// @dev Update claims to emissions for an array of gauges. /// @param _gauges Array of gauges to update emissions for. function updateFor(address[] memory _gauges) external; /// @dev Update claims to emissions for gauges based on their pool id as stored in Voter. /// @param _start Starting index of pools. /// @param _end Ending index of pools. function updateFor(uint256 _start, uint256 _end) external; /// @dev Update claims to emissions for single gauge /// @param _gauge . function updateFor(address _gauge) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC721, IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import {IERC4906} from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import {IVotes} from "../governance/IVotes.sol"; interface IVotingEscrow is IVotes, IERC4906, IERC721Metadata { struct LockedBalance { int128 amount; uint256 end; bool isPermanent; } struct UserPoint { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block uint256 permanent; } struct GlobalPoint { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block uint256 permanentLockBalance; } /// @notice A checkpoint for recorded delegated voting weights at a certain timestamp struct Checkpoint { uint256 fromTimestamp; address owner; uint256 delegatedBalance; uint256 delegatee; } enum DepositType { DEPOSIT_FOR_TYPE, CREATE_LOCK_TYPE, INCREASE_LOCK_AMOUNT, INCREASE_UNLOCK_TIME } /// @dev Different types of veNFTs: /// NORMAL - typical veNFT /// LOCKED - veNFT which is locked into a MANAGED veNFT /// MANAGED - veNFT which can accept the deposit of NORMAL veNFTs enum EscrowType { NORMAL, LOCKED, MANAGED } error AlreadyVoted(); error AmountTooBig(); error ERC721ReceiverRejectedTokens(); error ERC721TransferToNonERC721ReceiverImplementer(); error InvalidNonce(); error InvalidSignature(); error InvalidSignatureS(); error InvalidManagedNFTId(); error LockDurationNotInFuture(); error LockDurationTooLong(); error LockExpired(); error LockNotExpired(); error NoLockFound(); error NonExistentToken(); error NotApprovedOrOwner(); error NotDistributor(); error NotEmergencyCouncilOrGovernor(); error NotGovernor(); error NotGovernorOrManager(); error NotManagedNFT(); error NotManagedOrNormalNFT(); error NotLockedNFT(); error NotNormalNFT(); error NotPermanentLock(); error NotOwner(); error NotTeam(); error NotVoter(); error OwnershipChange(); error PermanentLock(); error SameAddress(); error SameNFT(); error SameState(); error SplitNoOwner(); error SplitNotAllowed(); error SignatureExpired(); error TooManyTokenIDs(); error ZeroAddress(); error ZeroAmount(); error ZeroBalance(); event Deposit( address indexed provider, uint256 indexed tokenId, DepositType indexed depositType, uint256 value, uint256 locktime, uint256 ts ); event Withdraw(address indexed provider, uint256 indexed tokenId, uint256 value, uint256 ts); event LockPermanent(address indexed _owner, uint256 indexed _tokenId, uint256 amount, uint256 _ts); event UnlockPermanent(address indexed _owner, uint256 indexed _tokenId, uint256 amount, uint256 _ts); event Supply(uint256 prevSupply, uint256 supply); event Merge( address indexed _sender, uint256 indexed _from, uint256 indexed _to, uint256 _amountFrom, uint256 _amountTo, uint256 _amountFinal, uint256 _locktime, uint256 _ts ); event Split( uint256 indexed _from, uint256 indexed _tokenId1, uint256 indexed _tokenId2, address _sender, uint256 _splitAmount1, uint256 _splitAmount2, uint256 _locktime, uint256 _ts ); event CreateManaged( address indexed _to, uint256 indexed _mTokenId, address indexed _from, address _lockedManagedReward, address _freeManagedReward ); event DepositManaged( address indexed _owner, uint256 indexed _tokenId, uint256 indexed _mTokenId, uint256 _weight, uint256 _ts ); event WithdrawManaged( address indexed _owner, uint256 indexed _tokenId, uint256 indexed _mTokenId, uint256 _weight, uint256 _ts ); event SetAllowedManager(address indexed _allowedManager); // State variables function factoryRegistry() external view returns (address); function token() external view returns (address); function distributor() external view returns (address); function voter() external view returns (address); function team() external view returns (address); function artProxy() external view returns (address); function allowedManager() external view returns (address); function tokenId() external view returns (uint256); /*/////////////////////////////////////////////////////////////// MANAGED NFT STORAGE //////////////////////////////////////////////////////////////*/ /// @dev Mapping of token id to escrow type /// Takes advantage of the fact default value is EscrowType.NORMAL function escrowType(uint256 tokenId) external view returns (EscrowType); /// @dev Mapping of token id to managed id function idToManaged(uint256 tokenId) external view returns (uint256 managedTokenId); /// @dev Mapping of user token id to managed token id to weight of token id function weights(uint256 tokenId, uint256 managedTokenId) external view returns (uint256 weight); /// @dev Mapping of managed id to deactivated state function deactivated(uint256 tokenId) external view returns (bool inactive); /// @dev Mapping from managed nft id to locked managed rewards /// `token` denominated rewards (rebases/rewards) stored in locked managed rewards contract /// to prevent co-mingling of assets function managedToLocked(uint256 tokenId) external view returns (address); /// @dev Mapping from managed nft id to free managed rewards contract /// these rewards can be freely withdrawn by users function managedToFree(uint256 tokenId) external view returns (address); /*/////////////////////////////////////////////////////////////// MANAGED NFT LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Create managed NFT (a permanent lock) for use within ecosystem. /// @dev Throws if address already owns a managed NFT. /// @return _mTokenId managed token id. function createManagedLockFor(address _to) external returns (uint256 _mTokenId); /// @notice Delegates balance to managed nft /// Note that NFTs deposited into a managed NFT will be re-locked /// to the maximum lock time on withdrawal. /// Permanent locks that are deposited will automatically unlock. /// @dev Managed nft will remain max-locked as long as there is at least one /// deposit or withdrawal per week. /// Throws if deposit nft is managed. /// Throws if recipient nft is not managed. /// Throws if deposit nft is already locked. /// Throws if not called by voter. /// @param _tokenId tokenId of NFT being deposited /// @param _mTokenId tokenId of managed NFT that will receive the deposit function depositManaged(uint256 _tokenId, uint256 _mTokenId) external; /// @notice Retrieves locked rewards and withdraws balance from managed nft. /// Note that the NFT withdrawn is re-locked to the maximum lock time. /// @dev Throws if NFT not locked. /// Throws if not called by voter. /// @param _tokenId tokenId of NFT being deposited. function withdrawManaged(uint256 _tokenId) external; /// @notice Permit one address to call createManagedLockFor() that is not Voter.governor() function setAllowedManager(address _allowedManager) external; /// @notice Set Managed NFT state. Inactive NFTs cannot be deposited into. /// @param _mTokenId managed nft state to set /// @param _state true => inactive, false => active function setManagedState(uint256 _mTokenId, bool _state) external; /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ function name() external view returns (string memory); function symbol() external view returns (string memory); function version() external view returns (string memory); function decimals() external view returns (uint8); function setTeam(address _team) external; function setArtProxy(address _proxy) external; /// @inheritdoc IERC721Metadata function tokenURI(uint256 tokenId) external view returns (string memory); /*////////////////////////////////////////////////////////////// ERC721 BALANCE/OWNER STORAGE //////////////////////////////////////////////////////////////*/ /// @dev Mapping from owner address to mapping of index to tokenId function ownerToNFTokenIdList(address _owner, uint256 _index) external view returns (uint256 _tokenId); /// @inheritdoc IERC721 function ownerOf(uint256 tokenId) external view returns (address owner); /// @inheritdoc IERC721 function balanceOf(address owner) external view returns (uint256 balance); /*////////////////////////////////////////////////////////////// ERC721 APPROVAL STORAGE //////////////////////////////////////////////////////////////*/ /// @inheritdoc IERC721 function getApproved(uint256 _tokenId) external view returns (address operator); /// @inheritdoc IERC721 function isApprovedForAll(address owner, address operator) external view returns (bool); /// @notice Check whether spender is owner or an approved user for a given veNFT /// @param _spender . /// @param _tokenId . function isApprovedOrOwner(address _spender, uint256 _tokenId) external returns (bool); /*////////////////////////////////////////////////////////////// ERC721 LOGIC //////////////////////////////////////////////////////////////*/ /// @inheritdoc IERC721 function approve(address to, uint256 tokenId) external; /// @inheritdoc IERC721 function setApprovalForAll(address operator, bool approved) external; /// @inheritdoc IERC721 function transferFrom(address from, address to, uint256 tokenId) external; /// @inheritdoc IERC721 function safeTransferFrom(address from, address to, uint256 tokenId) external; /// @inheritdoc IERC721 function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /*////////////////////////////////////////////////////////////// ERC165 LOGIC //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 _interfaceID) external view returns (bool); /*////////////////////////////////////////////////////////////// ESCROW STORAGE //////////////////////////////////////////////////////////////*/ function epoch() external view returns (uint256); function supply() external view returns (uint256); function userPointEpoch(uint256 _tokenId) external view returns (uint256 _epoch); /// @notice time -> signed slope change function slopeChanges(uint256 _timestamp) external view returns (int128); /// @notice account -> can split function canSplit(address _account) external view returns (bool); /// @notice Global point history at a given index function pointHistory(uint256 _loc) external view returns (GlobalPoint memory); /// @notice Get the LockedBalance (amount, end) of a _tokenId /// @param _tokenId . /// @return LockedBalance of _tokenId function locked(uint256 _tokenId) external view returns (LockedBalance memory); /// @notice User -> UserPoint[userEpoch] function userPointHistory(uint256 _tokenId, uint256 _loc) external view returns (UserPoint memory); /*////////////////////////////////////////////////////////////// ESCROW LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Record global data to checkpoint function checkpoint() external; /// @notice Deposit `_value` tokens for `_tokenId` and add to the lock /// @dev Anyone (even a smart contract) can deposit for someone else, but /// cannot extend their locktime and deposit for a brand new user /// @param _tokenId lock NFT /// @param _value Amount to add to user's lock function depositFor(uint256 _tokenId, uint256 _value) external; /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration` /// @param _value Amount to deposit /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week) /// @return TokenId of created veNFT function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256); /// @notice Deposit `_value` tokens for `_to` and lock for `_lockDuration` /// @param _value Amount to deposit /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week) /// @param _to Address to deposit /// @return TokenId of created veNFT function createLockFor(uint256 _value, uint256 _lockDuration, address _to) external returns (uint256); /// @notice Deposit `_value` additional tokens for `_tokenId` without modifying the unlock time /// @param _value Amount of tokens to deposit and add to the lock function increaseAmount(uint256 _tokenId, uint256 _value) external; /// @notice Extend the unlock time for `_tokenId` /// Cannot extend lock time of permanent locks /// @param _lockDuration New number of seconds until tokens unlock function increaseUnlockTime(uint256 _tokenId, uint256 _lockDuration) external; /// @notice Withdraw all tokens for `_tokenId` /// @dev Only possible if the lock is both expired and not permanent /// This will burn the veNFT. Any rebases or rewards that are unclaimed /// will no longer be claimable. Claim all rebases and rewards prior to calling this. function withdraw(uint256 _tokenId) external; /// @notice Merges `_from` into `_to`. /// @dev Cannot merge `_from` locks that are permanent or have already voted this epoch. /// Cannot merge `_to` locks that have already expired. /// This will burn the veNFT. Any rebases or rewards that are unclaimed /// will no longer be claimable. Claim all rebases and rewards prior to calling this. /// @param _from VeNFT to merge from. /// @param _to VeNFT to merge into. function merge(uint256 _from, uint256 _to) external; /// @notice Splits veNFT into two new veNFTS - one with oldLocked.amount - `_amount`, and the second with `_amount` /// @dev This burns the tokenId of the target veNFT /// Callable by approved or owner /// If this is called by approved, approved will not have permissions to manipulate the newly created veNFTs /// Returns the two new split veNFTs to owner /// If `from` is permanent, will automatically dedelegate. /// This will burn the veNFT. Any rebases or rewards that are unclaimed /// will no longer be claimable. Claim all rebases and rewards prior to calling this. /// @param _from VeNFT to split. /// @param _amount Amount to split from veNFT. /// @return _tokenId1 Return tokenId of veNFT with oldLocked.amount - `_amount`. /// @return _tokenId2 Return tokenId of veNFT with `_amount`. function split(uint256 _from, uint256 _amount) external returns (uint256 _tokenId1, uint256 _tokenId2); /// @notice Toggle split for a specific veNFT. /// @dev Toggle split for address(0) to enable or disable for all. /// @param _account Address to toggle split permissions /// @param _bool True to allow, false to disallow function toggleSplit(address _account, bool _bool) external; /// @notice Permanently lock a veNFT. Voting power will be equal to /// `LockedBalance.amount` with no decay. Required to delegate. /// @dev Only callable by unlocked normal veNFTs. /// @param _tokenId tokenId to lock. function lockPermanent(uint256 _tokenId) external; /// @notice Unlock a permanently locked veNFT. Voting power will decay. /// Will automatically dedelegate if delegated. /// @dev Only callable by permanently locked veNFTs. /// Cannot unlock if already voted this epoch. /// @param _tokenId tokenId to unlock. function unlockPermanent(uint256 _tokenId) external; /*/////////////////////////////////////////////////////////////// GAUGE VOTING STORAGE //////////////////////////////////////////////////////////////*/ /// @notice Get the voting power for _tokenId at the current timestamp /// @dev Returns 0 if called in the same block as a transfer. /// @param _tokenId . /// @return Voting power function balanceOfNFT(uint256 _tokenId) external view returns (uint256); /// @notice Get the voting power for _tokenId at a given timestamp /// @param _tokenId . /// @param _t Timestamp to query voting power /// @return Voting power function balanceOfNFTAt(uint256 _tokenId, uint256 _t) external view returns (uint256); /// @notice Calculate total voting power at current timestamp /// @return Total voting power at current timestamp function totalSupply() external view returns (uint256); /// @notice Calculate total voting power at a given timestamp /// @param _t Timestamp to query total voting power /// @return Total voting power at given timestamp function totalSupplyAt(uint256 _t) external view returns (uint256); /*/////////////////////////////////////////////////////////////// GAUGE VOTING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice See if a queried _tokenId has actively voted /// @param _tokenId . /// @return True if voted, else false function voted(uint256 _tokenId) external view returns (bool); /// @notice Set the global state voter and distributor /// @dev This is only called once, at setup function setVoterAndDistributor(address _voter, address _distributor) external; /// @notice Set `voted` for _tokenId to true or false /// @dev Only callable by voter /// @param _tokenId . /// @param _voted . function voting(uint256 _tokenId, bool _voted) external; /*/////////////////////////////////////////////////////////////// DAO VOTING STORAGE //////////////////////////////////////////////////////////////*/ /// @notice The number of checkpoints for each tokenId function numCheckpoints(uint256 tokenId) external view returns (uint48); /// @notice A record of states for signing / validating signatures function nonces(address account) external view returns (uint256); /// @inheritdoc IVotes function delegates(uint256 delegator) external view returns (uint256); /// @notice A record of delegated token checkpoints for each account, by index /// @param tokenId . /// @param index . /// @return Checkpoint function checkpoints(uint256 tokenId, uint48 index) external view returns (Checkpoint memory); /// @inheritdoc IVotes function getPastVotes(address account, uint256 tokenId, uint256 timestamp) external view returns (uint256); /// @inheritdoc IVotes function getPastTotalSupply(uint256 timestamp) external view returns (uint256); /*/////////////////////////////////////////////////////////////// DAO VOTING LOGIC //////////////////////////////////////////////////////////////*/ /// @inheritdoc IVotes function delegate(uint256 delegator, uint256 delegatee) external; /// @inheritdoc IVotes function delegateBySig( uint256 delegator, uint256 delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IFactoryRegistry { error FallbackFactory(); error InvalidFactoriesToPoolFactory(); error PathAlreadyApproved(); error PathNotApproved(); error SameAddress(); error ZeroAddress(); event Approve(address indexed poolFactory, address indexed votingRewardsFactory, address indexed gaugeFactory); event Unapprove(address indexed poolFactory, address indexed votingRewardsFactory, address indexed gaugeFactory); event SetManagedRewardsFactory(address indexed _newRewardsFactory); /// @notice Approve a set of factories used in Velodrome Protocol. /// Router.sol is able to swap any poolFactories currently approved. /// Cannot approve address(0) factories. /// Cannot aprove path that is already approved. /// Each poolFactory has one unique set and maintains state. In the case a poolFactory is unapproved /// and then re-approved, the same set of factories must be used. In other words, you cannot overwrite /// the factories tied to a poolFactory address. /// VotingRewardsFactories and GaugeFactories may use the same address across multiple poolFactories. /// @dev Callable by onlyOwner /// @param poolFactory . /// @param votingRewardsFactory . /// @param gaugeFactory . function approve(address poolFactory, address votingRewardsFactory, address gaugeFactory) external; /// @notice Unapprove a set of factories used in Velodrome Protocol. /// While a poolFactory is unapproved, Router.sol cannot swap with pools made from the corresponding factory /// Can only unapprove an approved path. /// Cannot unapprove the fallback path (core v2 factories). /// @dev Callable by onlyOwner /// @param poolFactory . function unapprove(address poolFactory) external; /// @notice Factory to create free and locked rewards for a managed veNFT function managedRewardsFactory() external view returns (address); /// @notice Set the rewards factory address /// @dev Callable by onlyOwner /// @param _newManagedRewardsFactory address of new managedRewardsFactory function setManagedRewardsFactory(address _newManagedRewardsFactory) external; /// @notice Get the factories correlated to a poolFactory. /// Once set, this can never be modified. /// Returns the correlated factories even after an approved poolFactory is unapproved. function factoriesToPoolFactory( address poolFactory ) external view returns (address votingRewardsFactory, address gaugeFactory); /// @notice Get all PoolFactories approved by the registry /// @dev The same PoolFactory address cannot be used twice /// @return Array of PoolFactory addresses function poolFactories() external view returns (address[] memory); /// @notice Check if a PoolFactory is approved within the factory registry. Router uses this method to /// ensure a pool swapped from is approved. /// @param poolFactory . /// @return True if PoolFactory is approved, else false function isPoolFactoryApproved(address poolFactory) external view returns (bool); /// @notice Get the length of the poolFactories array function poolFactoriesLength() external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; import "../utils/Context.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771Context is Context { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. /// @solidity memory-safe-assembly assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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 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; 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 require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // 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: BUSL-1.1 pragma solidity 0.8.19; library VelodromeTimeLibrary { uint256 internal constant WEEK = 7 days; /// @dev Returns start of epoch based on current timestamp function epochStart(uint256 timestamp) internal pure returns (uint256) { unchecked { return timestamp - (timestamp % WEEK); } } /// @dev Returns start of next epoch / end of current epoch function epochNext(uint256 timestamp) internal pure returns (uint256) { unchecked { return timestamp - (timestamp % WEEK) + WEEK; } } /// @dev Returns start of voting window function epochVoteStart(uint256 timestamp) internal pure returns (uint256) { unchecked { return timestamp - (timestamp % WEEK) + 1 hours; } } /// @dev Returns end of voting window / beginning of unrestricted voting window function epochVoteEnd(uint256 timestamp) internal pure returns (uint256) { unchecked { return timestamp - (timestamp % WEEK) + WEEK - 1 hours; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../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 pragma solidity ^0.8.0; import "./IERC165.sol"; import "./IERC721.sol"; /// @title EIP-721 Metadata Update Extension interface IERC4906 is IERC165, IERC721 { /// @dev This event emits when the metadata of a token is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFT. event MetadataUpdate(uint256 _tokenId); /// @dev This event emits when the metadata of a range of tokens is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFTs. event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; /// Modified IVotes interface for tokenId based voting interface IVotes { /** * @dev Emitted when an account changes their delegate. */ event DelegateChanged(address indexed delegator, uint256 indexed fromDelegate, uint256 indexed toDelegate); /** * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes. */ event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @dev Returns the amount of votes that `tokenId` had at a specific moment in the past. * If the account passed in is not the owner, returns 0. */ function getPastVotes(address account, uint256 tokenId, uint256 timepoint) external view returns (uint256); /** * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is * configured to use block numbers, this will return the value the end of the corresponding block. * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. */ function getPastTotalSupply(uint256 timepoint) external view returns (uint256); /** * @dev Returns the delegate that `tokenId` has chosen. Can never be equal to the delegator's `tokenId`. * Returns 0 if not delegated. */ function delegates(uint256 tokenId) external view returns (uint256); /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(uint256 delegator, uint256 delegatee) external; /** * @dev Delegates votes from `delegator` to `delegatee`. Signer must own `delegator`. */ function delegateBySig( uint256 delegator, uint256 delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 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 ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface 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[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@opengsn/=lib/gsn/packages/", "@openzeppelin/=lib/openzeppelin-contracts/", "@uniswap/v3-core/=lib/v3-core/", "concentrated-liquidity/=lib/concentrated-liquidity/", "ds-test/=lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "gsn/=lib/gsn/", "hardhat-deploy/=node_modules/hardhat-deploy/", "hardhat/=node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "utils/=test/utils/", "v3-core/=lib/v3-core/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": { "contracts/art/PerlinNoise.sol": { "PerlinNoise": "0x08947e304064b3f3ef2b99fca7e549c5fc3f75d4" }, "contracts/art/Trig.sol": { "Trig": "0xbdd6f9662e904a9176aafcbdded45d076b5170ef" }, "contracts/libraries/BalanceLogicLibrary.sol": { "BalanceLogicLibrary": "0x79bca9bcc19e157cb5f8c5a2f4d6cb951b1f8dce" }, "contracts/libraries/DelegationLogicLibrary.sol": { "DelegationLogicLibrary": "0x73746410b0dd4526e1fa00d0854e99ba54aefd30" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_forwarder","type":"address"},{"internalType":"address","name":"_ve","type":"address"},{"internalType":"address","name":"_factoryRegistry","type":"address"},{"internalType":"address","name":"_v1Factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyVotedOrDeposited","type":"error"},{"inputs":[],"name":"DistributeWindow","type":"error"},{"inputs":[],"name":"FactoryPathNotApproved","type":"error"},{"inputs":[],"name":"GaugeAlreadyKilled","type":"error"},{"inputs":[],"name":"GaugeAlreadyRevived","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"GaugeDoesNotExist","type":"error"},{"inputs":[],"name":"GaugeExists","type":"error"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"GaugeNotAlive","type":"error"},{"inputs":[],"name":"InactiveManagedNFT","type":"error"},{"inputs":[],"name":"MaximumVotingNumberTooLow","type":"error"},{"inputs":[],"name":"NonZeroVotes","type":"error"},{"inputs":[],"name":"NotAPool","type":"error"},{"inputs":[],"name":"NotApprovedOrOwner","type":"error"},{"inputs":[],"name":"NotEmergencyCouncil","type":"error"},{"inputs":[],"name":"NotGovernor","type":"error"},{"inputs":[],"name":"NotMinter","type":"error"},{"inputs":[],"name":"NotWhitelistedNFT","type":"error"},{"inputs":[],"name":"NotWhitelistedToken","type":"error"},{"inputs":[],"name":"SameValue","type":"error"},{"inputs":[],"name":"SpecialVotingWindow","type":"error"},{"inputs":[],"name":"TooManyPools","type":"error"},{"inputs":[],"name":"UnequalLengths","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Abstained","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":"poolFactory","type":"address"},{"indexed":true,"internalType":"address","name":"votingRewardsFactory","type":"address"},{"indexed":true,"internalType":"address","name":"gaugeFactory","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"bribeVotingReward","type":"address"},{"indexed":false,"internalType":"address","name":"feeVotingReward","type":"address"},{"indexed":false,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","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":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWeight","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"_bool","type":"bool"}],"name":"WhitelistNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"bool","name":"_bool","type":"bool"}],"name":"WhitelistToken","type":"event"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_poolFactory","type":"address"},{"internalType":"address","name":"_pool","type":"address"}],"name":"createGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_mTokenId","type":"uint256"}],"name":"depositManaged","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_finish","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyCouncil","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"epochNext","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"epochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"epochVoteEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"epochVoteStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"factoryRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"forwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugeToBribe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugeToFees","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_minter","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":"","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isWhitelistedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxVotingNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"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":"_council","type":"address"}],"name":"setEmergencyCouncil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_epochGovernor","type":"address"}],"name":"setEpochGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxVotingNum","type":"uint256"}],"name":"setMaxVotingNum","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"updateFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"updateFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"updateFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usedWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v1Factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"whitelistNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"whitelistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawManaged","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040523480156200001257600080fd5b50604051620045cd380380620045cd833981016040819052620000359162000171565b6001600160a01b038085166080819052600160005560a05283811660c081905283821660e0529082166101005260408051637e062a3560e11b8152905163fc0c546a916004808201926020929091908290030181865afa1580156200009e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c49190620001ce565b6001600160a01b0316610120526000620000dd6200012c565b600180546001600160a01b039092166001600160a01b031992831681179091556002805483168217905560038054831682179055600480549092161790555050601e60065550620001f3915050565b6080516000906001600160a01b031633036200014f575060131936013560601c90565b503390565b80516001600160a01b03811681146200016c57600080fd5b919050565b600080600080608085870312156200018857600080fd5b620001938562000154565b9350620001a36020860162000154565b9250620001b36040860162000154565b9150620001c36060860162000154565b905092959194509250565b600060208284031215620001e157600080fd5b620001ec8262000154565b9392505050565b60805160a05160c05160e05161010051610120516142bf6200030e60003960008181610f4501528181610fba01528181611b510152818161228001528181612b740152818161327f015261330d01526000818161063e01526117100152600081816104d90152818161164b015261179f01526000818161044001528181610a5a01528181610b4d01528181610c4c01528181610d2801528181610db401528181610e360152818161122f015281816114a001528181611eed01528181611fd2015281816120d201528181612629015281816126cb015281816127b80152818161283a01528181612f5501526137c50152600081816108bd01528181611a830152611b190152600081816105510152612bcb01526142bf6000f3fe608060405234801561001057600080fd5b506004361061035d5760003560e01c80637ac09bf7116101d3578063c42cf53511610104578063e0c11f9a116100a2578063e8b3fd571161007c578063e8b3fd571461088f578063f3594be014610898578063f645d4f9146108b8578063f9f031df146108df57600080fd5b8063e0c11f9a14610856578063e2819d5c14610869578063e586875f1461087c57600080fd5b8063d23254b4116100de578063d23254b4146107e2578063d4e2616f1461080d578063d560b0d714610830578063d58b15d41461084357600080fd5b8063c42cf53514610793578063c4f08165146107a6578063c9ff6f4d146107cf57600080fd5b8063a7cac84611610171578063aa9354a31161014b578063aa9354a314610721578063ab37f48614610734578063ac4afa3814610757578063b9a09fd51461076a57600080fd5b8063a7cac846146106cb578063a86a366d146106eb578063aa79979b146106fe57600080fd5b8063929c8dcd116101ad578063929c8dcd1461067357806396c82e571461069c578063992a7933146106a55780639f06247b146106b857600080fd5b80637ac09bf7146106265780638083f7bb14610639578063880e36fc1461066057600080fd5b80633aae971f116102ad5780636138889b1161024b5780637715ee75116102255780637715ee75146105cd5780637778960e146105e0578063794cea3c146105f357806379e938241461060657600080fd5b80636138889b14610594578063666256aa146105a75780637625391a146105ba57600080fd5b8063402914f511610287578063402914f51461050e578063462d0b2e1461052e578063572b6c0514610541578063598d521b1461058157600080fd5b80633aae971f146104c15780633bf0c9fb146104d45780633c6b16ab146104fb57600080fd5b80631f7b6d321161031a578063310bd74b116102f4578063310bd74b1461047557806332145f9014610488578063370fb5fa1461049b57806339e9f3b6146104ae57600080fd5b80631f7b6d32146104295780631f8507161461043b57806330331b2f1461046257600080fd5b806306d6a1b21461036257806307546172146103a85780630c340a24146103bb5780630e0a5968146103ce5780630ffb1d8b146103e35780631703e5f9146103f6575b600080fd5b61038b610370366004613c4a565b6009602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b60015461038b906001600160a01b031681565b60025461038b906001600160a01b031681565b6103e16103dc366004613c4a565b6108f2565b005b6103e16103f1366004613c75565b6108fe565b610419610404366004613c4a565b60146020526000908152604090205460ff1681565b604051901515815260200161039f565b6007545b60405190815260200161039f565b61038b7f000000000000000000000000000000000000000000000000000000000000000081565b6103e1610470366004613cae565b610947565b6103e1610483366004613cae565b6109cb565b6103e1610496366004613cae565b610aff565b6103e16104a9366004613cae565b610bd7565b61042d6104bc366004613cae565b610ee8565b60035461038b906001600160a01b031681565b61038b7f000000000000000000000000000000000000000000000000000000000000000081565b6103e1610509366004613cae565b610efd565b61042d61051c366004613c4a565b60176020526000908152604090205481565b6103e161053c366004613d13565b61102a565b61041961054f366004613c4a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6103e161058f366004613c4a565b6110da565b6103e16105a2366004613e49565b61115e565b6103e16105b5366004613e7e565b61122d565b6103e16105c8366004613f5b565b6113ab565b6103e16105db366004613e7e565b61149e565b60045461038b906001600160a01b031681565b61038b610601366004613f7d565b611615565b61042d610614366004613cae565b600f6020526000908152604090205481565b6103e1610634366004613fab565b611e47565b61038b7f000000000000000000000000000000000000000000000000000000000000000081565b61042d61066e366004613cae565b6121cb565b61038b610681366004613c4a565b600b602052600090815260409020546001600160a01b031681565b61042d60055481565b6103e16106b3366004613c4a565b6121dc565b6103e16106c6366004613c4a565b61230d565b61042d6106d9366004613c4a565b600c6020526000908152604090205481565b61038b6106f9366004613f5b565b6123ce565b61041961070c366004613c4a565b60116020526000908152604090205460ff1681565b61042d61072f366004613cae565b612406565b610419610742366004613c4a565b60126020526000908152604090205460ff1681565b61038b610765366004613cae565b612415565b61038b610778366004613c4a565b6008602052600090815260409020546001600160a01b031681565b6103e16107a1366004613c4a565b61243f565b61038b6107b4366004613c4a565b600a602052600090815260409020546001600160a01b031681565b6103e16107dd366004613f5b565b6124c3565b61042d6107f0366004614025565b600d60209081526000928352604080842090915290825290205481565b61041961081b366004613cae565b60136020526000908152604090205460ff1681565b6103e161083e366004613e49565b61252e565b61042d610851366004613cae565b61256f565b6103e1610864366004613f5b565b612583565b6103e161087736600461404a565b6128c8565b6103e161088a366004613c4a565b61295a565b61042d60065481565b61042d6108a6366004613cae565b60106020526000908152604090205481565b61038b7f000000000000000000000000000000000000000000000000000000000000000081565b6103e16108ed366004613e49565b6129de565b6108fb81612a87565b50565b6002546001600160a01b0316610912612bc7565b6001600160a01b03161461093957604051633b8d9d7560e21b815260040160405180910390fd5b6109438282612c0b565b5050565b6002546001600160a01b031661095b612bc7565b6001600160a01b03161461098257604051633b8d9d7560e21b815260040160405180910390fd5b600a8110156109a457604051632db4ddc160e11b815260040160405180910390fd5b60065481036109c65760405163c23f6ccb60e01b815260040160405180910390fd5b600655565b60008181526010602052604090205481906109eb4262093a808106900390565b11610a095760405163cade311f60e01b815260040160405180910390fd5b62093a80429081069003610e10014211610a3657604051635a780bad60e01b815260040160405180910390fd5b610a3e612c74565b60405163430c208160e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063430c2081906044016020604051808303816000875af1158015610aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acf919061406f565b610aec5760405163390cdd9b60e21b815260040160405180910390fd5b610af582612cd2565b6109436001600055565b610b07612c74565b62093a80429081069003610e10014211610b3457604051635a780bad60e01b815260040160405180910390fd5b6040516339f890b560e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e7e242d490602401602060405180830381865afa158015610b9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc0919061408c565b9050610bcc8282612ffa565b506108fb6001600055565b610bdf612c74565b6000818152601060205260409020548190610bff4262093a808106900390565b11610c1d5760405163cade311f60e01b815260040160405180910390fd5b62093a80429081069003610e10014211610c4a57604051635a780bad60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663430c2081610c81612bc7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015610cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf2919061406f565b610d0f5760405163390cdd9b60e21b815260040160405180910390fd5b6040516319a0a9d560e01b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906319a0a9d590602401602060405180830381865afa158015610d77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9b919061408c565b604051631b87dafd60e11b8152600481018590529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063370fb5fa90602401600060405180830381600087803b158015610e0057600080fd5b505af1158015610e14573d6000803e3d6000fd5b5050604051637028a55d60e11b815260048101849052426024820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063e0514aba90604401602060405180830381865afa158015610e86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eaa919061408c565b905080600003610ed157610ebd82612cd2565b600082815260106020526040812055610edb565b610edb8282612ffa565b5050506108fb6001600055565b600062093a8082068203610e10015b92915050565b6000610f07612bc7565b6001549091506001600160a01b03808316911614610f3857604051633e34a41b60e21b815260040160405180910390fd5b610f6d6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016823085613145565b6000610f7c60055460016131b0565b610f8e84670de0b6b3a76400006140bb565b610f9891906140d2565b90508015610fb8578060156000828254610fb291906140f4565b90915550505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03167ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508268560405161101d91815260200190565b60405180910390a3505050565b6001546001600160a01b031661103e612bc7565b6001600160a01b03161461106557604051633e34a41b60e21b815260040160405180910390fd5b8160005b818110156110b4576110a285858381811061108657611086614107565b905060200201602081019061109b9190613c4a565b6001612c0b565b806110ac8161411d565b915050611069565b5050600180546001600160a01b0319166001600160a01b03929092169190911790555050565b6002546001600160a01b03166110ee612bc7565b6001600160a01b03161461111557604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811661113c5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b611166612c74565b600160009054906101000a90046001600160a01b03166001600160a01b031663a83627de6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156111bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111df919061408c565b50805160005b818110156112215761120f83828151811061120257611202614107565b60200260200101516131c8565b806112198161411d565b9150506111e5565b50506108fb6001600055565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663430c2081611264612bc7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af11580156112b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d5919061406f565b6112f25760405163390cdd9b60e21b815260040160405180910390fd5b825160005b818110156113a45784818151811061131157611311614107565b60200260200101516001600160a01b031663f5f8d3658486848151811061133a5761133a614107565b60200260200101516040518363ffffffff1660e01b815260040161135f92919061417a565b600060405180830381600087803b15801561137957600080fd5b505af115801561138d573d6000803e3d6000fd5b50505050808061139c9061411d565b9150506112f7565b5050505050565b6113b3612c74565b600160009054906101000a90046001600160a01b03166001600160a01b031663a83627de6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142c919061408c565b50815b8181101561149357611481600860006007848154811061145157611451614107565b60009182526020808320909101546001600160a01b039081168452908301939093526040909101902054166131c8565b8061148b8161411d565b91505061142f565b506109436001600055565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663430c20816114d5612bc7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611522573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611546919061406f565b6115635760405163390cdd9b60e21b815260040160405180910390fd5b825160005b818110156113a45784818151811061158257611582614107565b60200260200101516001600160a01b031663f5f8d365848684815181106115ab576115ab614107565b60200260200101516040518363ffffffff1660e01b81526004016115d092919061417a565b600060405180830381600087803b1580156115ea57600080fd5b505af11580156115fe573d6000803e3d6000fd5b50505050808061160d9061411d565b915050611568565b600061161f612c74565b6000611629612bc7565b60405163d1ea0a1d60e01b81526001600160a01b0386811660048301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063d1ea0a1d90602401602060405180830381865afa158015611694573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b8919061406f565b6116d557604051634fe2017f60e01b815260040160405180910390fd5b6001600160a01b03838116600090815260086020526040902054161561170e576040516348fe415b60e11b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614801561175d57506002546001600160a01b03828116911614155b1561177b57604051633b8d9d7560e21b815260040160405180910390fd5b604051631217afdb60e01b81526001600160a01b03858116600483015260009182917f00000000000000000000000000000000000000000000000000000000000000001690631217afdb906024016040805180830381865afa1580156117e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118099190614193565b604080516002808252606082018352939550919350600092906020830190803683370190505060405163e5e31b1360e01b81526001600160a01b03888116600483015291925060009189169063e5e31b1390602401602060405180830381865afa15801561187b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189f919061406f565b905060008082156119db57886001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190c91906141c2565b9150886001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561194c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197091906141c2565b9050818460008151811061198657611986614107565b60200260200101906001600160a01b031690816001600160a01b03168152505080846001815181106119ba576119ba614107565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6002546001600160a01b03888116911614611a6d5782611a0e57604051632bab424160e01b815260040160405180910390fd5b6001600160a01b03821660009081526012602052604090205460ff161580611a4f57506001600160a01b03811660009081526012602052604090205460ff16155b15611a6d576040516365a9cebb60e01b815260040160405180910390fd5b5050600080856001600160a01b0316634c455a977f0000000000000000000000000000000000000000000000000000000000000000866040518363ffffffff1660e01b8152600401611ac09291906141df565b60408051808303816000875af1158015611ade573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b029190614193565b6040516322a60f9560e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301528c8116602483015283811660448301527f0000000000000000000000000000000000000000000000000000000000000000811660648301528615156084830152929450909250600091871690638a983e549060a4016020604051808303816000875af1158015611bb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd791906141c2565b905082600a6000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600860008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508960096000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600160116000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600160146000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550611d8681612a87565b600780546001810182556000919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319166001600160a01b038c811691821790925560408051918252848316602083015285831690820152828216606082015289821660808201528782169189811691908e16907fef9f7d1ffff3b249c6b9bf2528499e935f7d96bb6d6ec4e7da504d1d3c6279e19060a00160405180910390a4975050505050505050610ef76001600055565b6000858152601060205260409020548590611e674262093a808106900390565b11611e855760405163cade311f60e01b815260040160405180910390fd5b62093a80429081069003610e10014211611eb257604051635a780bad60e01b815260040160405180910390fd5b611eba612c74565b6000611ec4612bc7565b60405163430c208160e01b81526001600160a01b038083166004830152602482018a90529192507f00000000000000000000000000000000000000000000000000000000000000009091169063430c2081906044016020604051808303816000875af1158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c919061406f565b611f795760405163390cdd9b60e21b815260040160405180910390fd5b848314611f995760405163332ac86360e21b815260040160405180910390fd5b600654851115611fbc5760405163ebcfae4b60e01b815260040160405180910390fd5b604051632a266cdb60e21b8152600481018890527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a899b36c90602401602060405180830381865afa158015612021573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612045919061406f565b15612063576040516308910b2560e01b815260040160405180910390fd5b4262093a808106810362092c70018111801561208e575060008881526013602052604090205460ff16155b156120ac57604051630392978d60e41b815260040160405180910390fd5b600088815260106020526040808220839055516339f890b560e21b8152600481018a90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e7e242d490602401602060405180830381865afa158015612121573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612145919061408c565b90506121b689828a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525061338f92505050565b5050506121c36001600055565b505050505050565b600062093a80808306830301610ef7565b6004546001600160a01b03166121f0612bc7565b6001600160a01b0316146122175760405163c560129360e01b815260040160405180910390fd5b6001600160a01b03811660009081526014602052604090205460ff1661225057604051633f88da5160e21b815260040160405180910390fd5b6001600160a01b03811660009081526017602052604090205480156122c3576001546122a9906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691168361385c565b6001600160a01b0382166000908152601760205260408120555b6001600160a01b038216600081815260146020526040808220805460ff19169055517f04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba79190a25050565b6004546001600160a01b0316612321612bc7565b6001600160a01b0316146123485760405163c560129360e01b815260040160405180910390fd5b6001600160a01b03811660009081526014602052604090205460ff161561238257604051635f5a482960e11b815260040160405180910390fd5b6001600160a01b038116600081815260146020526040808220805460ff19166001179055517fed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa9190a250565b600e60205281600052604060002081815481106123ea57600080fd5b6000918252602090912001546001600160a01b03169150829050565b600062093a8082068203610ef7565b6007818154811061242557600080fd5b6000918252602090912001546001600160a01b0316905081565b6002546001600160a01b0316612453612bc7565b6001600160a01b03161461247a57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b0381166124a15760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b815b818110156125295761251760086000600784815481106124e7576124e7614107565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190205416612a87565b806125218161411d565b9150506124c5565b505050565b805160005b818110156125295761255d83828151811061255057612550614107565b6020026020010151612a87565b806125678161411d565b915050612533565b600062093a808206820362092c7001610ef7565b61258b612c74565b60008281526010602052604090205482906125ab4262093a808106900390565b116125c95760405163cade311f60e01b815260040160405180910390fd5b62093a80429081069003610e100142116125f657604051635a780bad60e01b815260040160405180910390fd5b6000612600612bc7565b60405163430c208160e01b81526001600160a01b038083166004830152602482018790529192507f00000000000000000000000000000000000000000000000000000000000000009091169063430c2081906044016020604051808303816000875af1158015612674573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612698919061406f565b6126b55760405163390cdd9b60e21b815260040160405180910390fd5b604051632a266cdb60e21b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a899b36c90602401602060405180830381865afa15801561271a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273e919061406f565b1561275c576040516308910b2560e01b815260040160405180910390fd5b4262093a808106810362092c700181111561278a57604051631f3ecf5b60e21b815260040160405180910390fd5b60008581526010602052604090819020829055516370608fcd60e11b815260048101869052602481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e0c11f9a90604401600060405180830381600087803b15801561280457600080fd5b505af1158015612818573d6000803e3d6000fd5b5050604051637028a55d60e11b815260048101879052426024820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063e0514aba90604401602060405180830381865afa15801561288a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ae919061408c565b90506128ba8582612ffa565b505050506109436001600055565b60006128d2612bc7565b6002549091506001600160a01b0380831691161461290357604051633b8d9d7560e21b815260040160405180910390fd5b600083815260136020526040808220805460ff19168515159081179091559051909185916001600160a01b038516917f8a6ff732c8641e1e34d771e1f8b1673e988c1abdfb694ebdf6c910a5e3d0d85391a4505050565b6004546001600160a01b031661296e612bc7565b6001600160a01b0316146129955760405163c560129360e01b815260040160405180910390fd5b6001600160a01b0381166129bc5760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b805160005b81811015612529578281815181106129fd576129fd614107565b60200260200101516001600160a01b031663c00007b0612a1b612bc7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015612a5c57600080fd5b505af1158015612a70573d6000803e3d6000fd5b505050508080612a7f9061411d565b9150506129e3565b6001600160a01b03808216600090815260096020908152604080832054909316808352600c909152919020548015612ba6576001600160a01b038316600090815260166020526040812080546015549182905591612ae58383614203565b905080156121c3576000670de0b6b3a7640000612b0283876140bb565b612b0c91906140d2565b6001600160a01b03881660009081526014602052604090205490915060ff1615612b63576001600160a01b03871660009081526017602052604081208054839290612b589084906140f4565b90915550612b9d9050565b600154612b9d906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691168361385c565b50505050505050565b6015546001600160a01b038416600090815260166020526040902055505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303612c06575060131936013560601c90565b503390565b6001600160a01b0382166000818152601260205260409020805460ff191683151590811790915590612c3b612bc7565b6001600160a01b03167f44948130cf88523dbc150908a47dd6332c33a01a3869d7f2fa78e51d5a5f9c5760405160405180910390a45050565b600260005403612ccb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055565b6000818152600e6020526040812080549091805b82811015612f37576000848281548110612d0257612d02614107565b6000918252602080832090910154888352600d825260408084206001600160a01b03909216808552919092529120549091508015612f22576001600160a01b03808316600090815260086020526040902054612d5e9116612a87565b6001600160a01b0382166000908152600c602052604081208054839290612d86908490614203565b90915550506000878152600d602090815260408083206001600160a01b038681168552908352818420849055600883528184205481168452600a9092529182902054915163278afc8b60e21b815260048101849052602481018a9052911690639e2bf22c90604401600060405180830381600087803b158015612e0857600080fd5b505af1158015612e1c573d6000803e3d6000fd5b505050506001600160a01b0382811660009081526008602090815260408083205484168352600b9091529081902054905163278afc8b60e21b815260048101849052602481018a9052911690639e2bf22c90604401600060405180830381600087803b158015612e8b57600080fd5b505af1158015612e9f573d6000803e3d6000fd5b505050508084612eaf91906140f4565b935086826001600160a01b0316612ec4612bc7565b6001600160a01b038581166000908152600c6020908152604091829020548251888152918201524281830152905192909116917fadab630928b1d46214641293704a312ee7ad87e03ae14a7fd95e7308b93998df9181900360600190a45b50508080612f2f9061411d565b915050612ce6565b50604051632d27a2cd60e11b815260048101859052600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635a4f459a90604401600060405180830381600087803b158015612fa157600080fd5b505af1158015612fb5573d6000803e3d6000fd5b505050508060056000828254612fcb9190614203565b90915550506000848152600f60209081526040808320839055600e9091528120612ff491613c03565b50505050565b6000828152600e602090815260408083208054825181850281018501909352808352919290919083018282801561305a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161303c575b5050505050905060008151905060008167ffffffffffffffff81111561308257613082613d6a565b6040519080825280602002602001820160405280156130ab578160200160208202803683370190505b50905060005b8281101561313857600d600087815260200190815260200160002060008583815181106130e0576130e0614107565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061311b5761311b614107565b6020908102919091010152806131308161411d565b9150506130b1565b506113a48585858461338f565b6040516001600160a01b0380851660248301528316604482015260648101829052612ff49085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261388c565b60008183116131bf57816131c1565b825b9392505050565b6131d181612a87565b6001600160a01b0381166000818152601760209081526040918290205482516302dcc80960e31b815292519093926316e640489260048083019391928290030181865afa158015613226573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061324a919061408c565b8111801561325a575062093a8081115b15610943576001600160a01b038083166000908152601760205260408120556132a6907f000000000000000000000000000000000000000000000000000000000000000016838361395e565b604051633c6b16ab60e01b8152600481018290526001600160a01b03831690633c6b16ab90602401600060405180830381600087803b1580156132e857600080fd5b505af11580156132fc573d6000803e3d6000fd5b506133379250506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016905083600061395e565b816001600160a01b0316613349612bc7565b6001600160a01b03167f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b178360405161338391815260200190565b60405180910390a35050565b61339884612cd2565b815160008080805b848110156133e1578581815181106133ba576133ba614107565b6020026020010151846133cd91906140f4565b9350806133d98161411d565b9150506133a0565b5060005b848110156137a157600087828151811061340157613401614107565b6020908102919091018101516001600160a01b0380821660009081526008909352604090922054909250168061345557604051634c89018560e01b81526001600160a01b0383166004820152602401612cc2565b6001600160a01b03811660009081526014602052604090205460ff16613499576040516302b0b9ed60e61b81526001600160a01b0382166004820152602401612cc2565b6001600160a01b03811660009081526011602052604090205460ff161561378c576000868b8a86815181106134d0576134d0614107565b60200260200101516134e291906140bb565b6134ec91906140d2565b60008d8152600d602090815260408083206001600160a01b0388168452909152902054909150156135305760405163315f6a3d60e01b815260040160405180910390fd5b806000036135515760405163334ab3f560e11b815260040160405180910390fd5b61355a82612a87565b60008c8152600e6020908152604080832080546001810182559084528284200180546001600160a01b0319166001600160a01b0388169081179091558352600c909152812080548392906135af9084906140f4565b909155505060008c8152600d602090815260408083206001600160a01b0387168452909152812080548392906135e69084906140f4565b90915550506001600160a01b038083166000908152600a60205260409081902054905163f320772360e01b815260048101849052602481018f905291169063f320772390604401600060405180830381600087803b15801561364757600080fd5b505af115801561365b573d6000803e3d6000fd5b50505050600b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a90046001600160a01b03166001600160a01b031663f3207723828e6040518363ffffffff1660e01b81526004016136ce929190918252602082015260400190565b600060405180830381600087803b1580156136e857600080fd5b505af11580156136fc573d6000803e3d6000fd5b50505050808561370c91906140f4565b945061371881876140f4565b95508b836001600160a01b031661372d612bc7565b6001600160a01b038681166000908152600c6020908152604091829020548251888152918201524281830152905192909116917f452d440efc30dfa14a0ef803ccb55936af860ec6a6960ed27f129bef913f296a9181900360600190a4505b505080806137999061411d565b9150506133e5565b50801561382a57604051632d27a2cd60e11b815260048101899052600160248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635a4f459a90604401600060405180830381600087803b15801561381157600080fd5b505af1158015613825573d6000803e3d6000fd5b505050505b816005600082825461383c91906140f4565b90915550506000978852600f602052604090972096909655505050505050565b6040516001600160a01b03831660248201526044810182905261252990849063a9059cbb60e01b90606401613179565b60006138e1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a739092919063ffffffff16565b80519091501561252957808060200190518101906138ff919061406f565b6125295760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401612cc2565b8015806139d85750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156139b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139d6919061408c565b155b613a435760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401612cc2565b6040516001600160a01b03831660248201526044810182905261252990849063095ea7b360e01b90606401613179565b6060613a828484600085613a8a565b949350505050565b606082471015613aeb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401612cc2565b600080866001600160a01b03168587604051613b07919061423a565b60006040518083038185875af1925050503d8060008114613b44576040519150601f19603f3d011682016040523d82523d6000602084013e613b49565b606091505b5091509150613b5a87838387613b65565b979650505050505050565b60608315613bd4578251600003613bcd576001600160a01b0385163b613bcd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401612cc2565b5081613a82565b613a828383815115613be95781518083602001fd5b8060405162461bcd60e51b8152600401612cc29190614256565b50805460008255906000526020600020908101906108fb91905b80821115613c315760008155600101613c1d565b5090565b6001600160a01b03811681146108fb57600080fd5b600060208284031215613c5c57600080fd5b81356131c181613c35565b80151581146108fb57600080fd5b60008060408385031215613c8857600080fd5b8235613c9381613c35565b91506020830135613ca381613c67565b809150509250929050565b600060208284031215613cc057600080fd5b5035919050565b60008083601f840112613cd957600080fd5b50813567ffffffffffffffff811115613cf157600080fd5b6020830191508360208260051b8501011115613d0c57600080fd5b9250929050565b600080600060408486031215613d2857600080fd5b833567ffffffffffffffff811115613d3f57600080fd5b613d4b86828701613cc7565b9094509250506020840135613d5f81613c35565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613da957613da9613d6a565b604052919050565b600067ffffffffffffffff821115613dcb57613dcb613d6a565b5060051b60200190565b600082601f830112613de657600080fd5b81356020613dfb613df683613db1565b613d80565b82815260059290921b84018101918181019086841115613e1a57600080fd5b8286015b84811015613e3e578035613e3181613c35565b8352918301918301613e1e565b509695505050505050565b600060208284031215613e5b57600080fd5b813567ffffffffffffffff811115613e7257600080fd5b613a8284828501613dd5565b600080600060608486031215613e9357600080fd5b833567ffffffffffffffff80821115613eab57600080fd5b613eb787838801613dd5565b9450602091508186013581811115613ece57600080fd5b8601601f81018813613edf57600080fd5b8035613eed613df682613db1565b81815260059190911b8201840190848101908a831115613f0c57600080fd5b8584015b83811015613f4457803586811115613f285760008081fd5b613f368d8983890101613dd5565b845250918601918601613f10565b50979a979950505050604095909501359450505050565b60008060408385031215613f6e57600080fd5b50508035926020909101359150565b60008060408385031215613f9057600080fd5b8235613f9b81613c35565b91506020830135613ca381613c35565b600080600080600060608688031215613fc357600080fd5b85359450602086013567ffffffffffffffff80821115613fe257600080fd5b613fee89838a01613cc7565b9096509450604088013591508082111561400757600080fd5b5061401488828901613cc7565b969995985093965092949392505050565b6000806040838503121561403857600080fd5b823591506020830135613ca381613c35565b6000806040838503121561405d57600080fd5b823591506020830135613ca381613c67565b60006020828403121561408157600080fd5b81516131c181613c67565b60006020828403121561409e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610ef757610ef76140a5565b6000826140ef57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610ef757610ef76140a5565b634e487b7160e01b600052603260045260246000fd5b60006001820161412f5761412f6140a5565b5060010190565b600081518084526020808501945080840160005b8381101561416f5781516001600160a01b03168752958201959082019060010161414a565b509495945050505050565b828152604060208201526000613a826040830184614136565b600080604083850312156141a657600080fd5b82516141b181613c35565b6020840151909250613ca381613c35565b6000602082840312156141d457600080fd5b81516131c181613c35565b6001600160a01b0383168152604060208201819052600090613a8290830184614136565b81810381811115610ef757610ef76140a5565b60005b83811015614231578181015183820152602001614219565b50506000910152565b6000825161424c818460208701614216565b9190910192915050565b6020815260008251806020840152614275816040850160208701614216565b601f01601f1916919091016040019291505056fea264697066735822122005e782f6ef9964113078cc90a55ffe5ec9ff82caada770a76bfe4fbe80b3917164736f6c6343000813003300000000000000000000000006824df38d1d77eadeb6bafcb03904e27429ab74000000000000000000000000faf8fd17d9840595845582fcb047df13f006787d000000000000000000000000f4c67cdeaab8360370f41514d06e32ccd8aa1d7b00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b746
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000006824df38d1d77eadeb6bafcb03904e27429ab74000000000000000000000000faf8fd17d9840595845582fcb047df13f006787d000000000000000000000000f4c67cdeaab8360370f41514d06e32ccd8aa1d7b00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b746
-----Decoded View---------------
Arg [0] : _forwarder (address): 0x06824df38D1D77eADEB6baFCB03904E27429Ab74
Arg [1] : _ve (address): 0xFAf8FD17D9840595845582fCB047DF13f006787d
Arg [2] : _factoryRegistry (address): 0xF4c67CdEAaB8360370F41514d06e32CcD8aA1d7B
Arg [3] : _v1Factory (address): 0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000006824df38d1d77eadeb6bafcb03904e27429ab74
Arg [1] : 000000000000000000000000faf8fd17d9840595845582fcb047df13f006787d
Arg [2] : 000000000000000000000000f4c67cdeaab8360370f41514d06e32ccd8aa1d7b
Arg [3] : 00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b746
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.