Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
VotingRewardsFactory
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.19 <0.9.0;
import {IVotingRewardsFactory} from "../interfaces/rewards/IVotingRewardsFactory.sol";
import {IncentiveVotingReward} from "./IncentiveVotingReward.sol";
import {FeesVotingReward} from "./FeesVotingReward.sol";
/// @title Velodrome Superchain Voting Rewards Factory
/// @notice Creates voting rewards contracts for Velodrome pools
contract VotingRewardsFactory is IVotingRewardsFactory {
/// @inheritdoc IVotingRewardsFactory
address public immutable voter;
/// @inheritdoc IVotingRewardsFactory
address public immutable bridge;
constructor(address _voter, address _bridge) {
voter = _voter;
bridge = _bridge;
}
/// @inheritdoc IVotingRewardsFactory
function createRewards(address[] memory _rewards)
external
returns (address feesVotingReward, address incentiveVotingReward)
{
if (msg.sender != voter) revert NotVoter();
feesVotingReward = address(new FeesVotingReward({_voter: voter, _authorized: bridge, _rewards: _rewards}));
incentiveVotingReward =
address(new IncentiveVotingReward({_voter: voter, _authorized: bridge, _rewards: _rewards}));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IVotingRewardsFactory {
error NotVoter();
/// @notice Returns the address of the voter contract
/// @return Address of the voter contract
function voter() external view returns (address);
/// @notice Returns the address of the bridge contract
/// @return Address of the bridge contract
function bridge() external view returns (address);
/// @notice creates an incentiveVotingReward and a FeesVotingReward contract for a gauge
/// @param _rewards Addresses of pool tokens to be used as valid rewards tokens
/// @return feesVotingReward Address of FeesVotingReward contract created
/// @return incentiveVotingReward Address of IncentiveVotingReward contract created
function createRewards(address[] memory _rewards)
external
returns (address feesVotingReward, address incentiveVotingReward);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.19 <0.9.0;
import {ILeafVoter} from "../interfaces/voter/ILeafVoter.sol";
import {VotingReward} from "./VotingReward.sol";
/// @title Superchain Incentive Reward Contract
/// @notice Reward contract for distribution of incentives to voters
contract IncentiveVotingReward is VotingReward {
constructor(address _voter, address _authorized, address[] memory _rewards)
VotingReward(_voter, _authorized, _rewards)
{}
/// @inheritdoc VotingReward
function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {
if (!isReward[token]) {
if (!ILeafVoter(voter).isWhitelistedToken(token)) revert NotWhitelisted();
isReward[token] = true;
rewards.push(token);
}
_notifyRewardAmount(msg.sender, token, amount);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.19 <0.9.0;
import {ILeafVoter} from "../interfaces/voter/ILeafVoter.sol";
import {VotingReward} from "./VotingReward.sol";
/// @title Superchain Fees Reward Contract
/// @notice Reward contract for distribution of fees to voters
contract FeesVotingReward is VotingReward {
constructor(address _voter, address _authorized, address[] memory _rewards)
VotingReward(_voter, _authorized, _rewards)
{}
/// @inheritdoc VotingReward
function notifyRewardAmount(address token, uint256 amount) external override nonReentrant {
if (ILeafVoter(voter).gaugeToFees(msg.sender) != address(this)) revert NotGauge();
if (!isReward[token]) revert InvalidReward();
_notifyRewardAmount(msg.sender, token, amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ILeafVoter {
error NotAGauge();
error ZeroAddress();
error NotAuthorized();
error GaugeAlreadyKilled();
error GaugeAlreadyRevived();
event GaugeCreated(
address indexed poolFactory,
address indexed votingRewardsFactory,
address indexed gaugeFactory,
address pool,
address incentiveVotingReward,
address feeVotingReward,
address gauge
);
event GaugeKilled(address indexed gauge);
event GaugeRevived(address indexed gauge);
event WhitelistToken(address indexed token, bool indexed _bool);
/// @notice Address of bridge contract used to forward x-chain messages
function bridge() external view returns (address);
/// @dev Pool => Gauge
function gauges(address _pool) external view returns (address);
/// @dev Gauge => Pool
function poolForGauge(address _gauge) external view returns (address);
/// @dev Gauge => Fees Voting Reward
function gaugeToFees(address _gauge) external view returns (address);
/// @dev Gauge => Incentives Voting Reward
function gaugeToIncentive(address _gauge) external view returns (address);
/// @notice Check if a given address is a gauge
/// @param _gauge The address to be checked
/// @return Whether the address is a gauge or not
function isGauge(address _gauge) external view returns (bool);
/// @notice Check if a given gauge is alive
/// @param _gauge The address of the gauge to be checked
/// @return Whether the gauge is alive or not
function isAlive(address _gauge) external view returns (bool);
/// @notice Returns the number of times a token has been whitelisted
/// @param _token Address of token to view whitelist count
/// @return Number of times token has been whitelisted
function whitelistTokenCount(address _token) external view returns (uint256);
/// @notice Get all Whitelisted Tokens approved by the Voter
/// @return Array of Whitelisted Token addresses
function whitelistedTokens() external view returns (address[] memory);
/// @notice Paginated view of all Whitelisted Tokens
/// @dev Should not assume the last Token returned is at index matching given `_end`,
/// because if `_end` exceeds `length`, implementation defaults to `length`
/// @param _start Index of first Token to be fetched
/// @param _end End index for pagination
/// @return _tokens Array of whitelisted tokens
function whitelistedTokens(uint256 _start, uint256 _end) external view returns (address[] memory _tokens);
/// @notice Check if a given token is whitelisted
/// @param _token The address of the token to be checked
/// @return Whether the token is whitelisted or not
function isWhitelistedToken(address _token) external view returns (bool);
/// @notice Get the length of the whitelistedTokens array
function whitelistedTokensLength() external view returns (uint256);
/// @notice Create a new gauge
/// @dev Only callable by Message Bridge
/// @param _poolFactory .
/// @param _pool .
/// @param _votingRewardsFactory .
/// @param _gaugeFactory .
function createGauge(address _poolFactory, address _pool, address _votingRewardsFactory, address _gaugeFactory)
external
returns (address _gauge);
/// @notice Kills a gauge. The gauge will not receive any new emissions and cannot be deposited into.
/// Can still withdraw from gauge.
/// @dev Only callable by Message Bridge
/// Throws if gauge already killed.
/// @param _gauge .
function killGauge(address _gauge) external;
/// @notice Revives a killed gauge. Gauge will be able to receive emissions and deposits again.
/// @dev Only callable by Message Bridge
/// Throws if gauge is not killed.
/// @param _gauge .
function reviveGauge(address _gauge) external;
/// @notice Claim emissions from gauges.
/// @param _gauges Array of gauges to collect emissions from.
function claimRewards(address[] memory _gauges) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.19 <0.9.0;
import {Reward} from "./Reward.sol";
import {ILeafMessageBridge} from "../interfaces/bridge/ILeafMessageBridge.sol";
/// @title Base voting reward contract for distribution of rewards by token id
/// on a weekly basis
abstract contract VotingReward is Reward {
constructor(address _voter, address _authorized, address[] memory _rewards) {
uint256 _length = _rewards.length;
for (uint256 i; i < _length; i++) {
if (_rewards[i] != address(0)) {
isReward[_rewards[i]] = true;
rewards.push(_rewards[i]);
}
}
voter = _voter;
authorized = _authorized;
}
/// @inheritdoc Reward
function getReward(address _recipient, uint256 _tokenId, address[] memory _tokens) external override nonReentrant {
if (msg.sender != ILeafMessageBridge(authorized).module()) revert NotAuthorized();
_getReward({_recipient: _recipient, _tokenId: _tokenId, _tokens: _tokens});
}
/// @inheritdoc Reward
function notifyRewardAmount(address token, uint256 amount) external virtual override {}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.19 <0.9.0;
import {Math} from "@openzeppelin5/contracts/utils/math/Math.sol";
import {SafeERC20} from "@openzeppelin5/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin5/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin5/contracts/utils/ReentrancyGuard.sol";
import {IReward} from "../interfaces/rewards/IReward.sol";
import {ILeafMessageBridge} from "../interfaces/bridge/ILeafMessageBridge.sol";
import {VelodromeTimeLibrary} from "../libraries/VelodromeTimeLibrary.sol";
/// @title Base Superchain Rewards Contract
/// @notice Base reward contract for distribution of rewards
abstract contract Reward is IReward, ReentrancyGuard {
using SafeERC20 for IERC20;
/// @inheritdoc IReward
uint256 public constant DURATION = 7 days;
/// @inheritdoc IReward
address public immutable voter;
/// @inheritdoc IReward
address public immutable authorized;
/// @inheritdoc IReward
uint256 public totalSupply;
/// @inheritdoc IReward
mapping(uint256 => uint256) public balanceOf;
/// @inheritdoc IReward
mapping(address => mapping(uint256 => uint256)) public tokenRewardsPerEpoch;
/// @inheritdoc IReward
mapping(address => mapping(uint256 => uint256)) public lastEarn;
/// @inheritdoc IReward
address[] public rewards;
/// @inheritdoc IReward
mapping(address => bool) public isReward;
/// @notice A record of balance checkpoints for each account, by index
mapping(uint256 => mapping(uint256 => Checkpoint)) public checkpoints;
/// @inheritdoc IReward
mapping(uint256 => uint256) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping(uint256 => SupplyCheckpoint) public supplyCheckpoints;
/// @inheritdoc IReward
uint256 public supplyNumCheckpoints;
/// @inheritdoc IReward
function getPriorBalanceIndex(uint256 tokenId, uint256 timestamp) public view returns (uint256) {
uint256 nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint256 lower = 0;
uint256 upper = nCheckpoints - 1;
while (upper > lower) {
uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
/// @inheritdoc IReward
function getPriorSupplyIndex(uint256 timestamp) public view returns (uint256) {
uint256 nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint256 lower = 0;
uint256 upper = nCheckpoints - 1;
while (upper > lower) {
uint256 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function _writeCheckpoint(uint256 tokenId, uint256 balance, uint256 timestamp) internal {
uint256 _nCheckPoints = numCheckpoints[tokenId];
if (
_nCheckPoints > 0
&& VelodromeTimeLibrary.epochStart(checkpoints[tokenId][_nCheckPoints - 1].timestamp)
== VelodromeTimeLibrary.epochStart(timestamp)
) {
checkpoints[tokenId][_nCheckPoints - 1] = Checkpoint(timestamp, balance);
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint(uint256 timestamp) internal {
uint256 _nCheckPoints = supplyNumCheckpoints;
if (
_nCheckPoints > 0
&& VelodromeTimeLibrary.epochStart(supplyCheckpoints[_nCheckPoints - 1].timestamp)
== VelodromeTimeLibrary.epochStart(timestamp)
) {
supplyCheckpoints[_nCheckPoints - 1] = SupplyCheckpoint(timestamp, totalSupply);
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
/// @inheritdoc IReward
function rewardsListLength() external view returns (uint256) {
return rewards.length;
}
/// @inheritdoc IReward
function earned(address token, uint256 tokenId) public view returns (uint256) {
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint256 reward = 0;
uint256 _supply = 1;
uint256 _currTs = VelodromeTimeLibrary.epochStart(lastEarn[token][tokenId]); // take epoch last claimed in as starting point
uint256 _index = getPriorBalanceIndex(tokenId, _currTs);
Checkpoint memory cp0 = checkpoints[tokenId][_index];
// accounts for case where lastEarn is before first checkpoint
_currTs = Math.max(_currTs, VelodromeTimeLibrary.epochStart(cp0.timestamp));
// get epochs between current epoch and first checkpoint in same epoch as last claim
uint256 numEpochs = (VelodromeTimeLibrary.epochStart(block.timestamp) - _currTs) / DURATION;
if (numEpochs > 0) {
for (uint256 i = 0; i < numEpochs; i++) {
// get index of last checkpoint in this epoch
_index = getPriorBalanceIndex(tokenId, _currTs + DURATION - 1);
// get checkpoint in this epoch
cp0 = checkpoints[tokenId][_index];
// get supply of last checkpoint in this epoch
_supply = Math.max(supplyCheckpoints[getPriorSupplyIndex(_currTs + DURATION - 1)].supply, 1);
reward += (cp0.balanceOf * tokenRewardsPerEpoch[token][_currTs]) / _supply;
_currTs += DURATION;
}
}
return reward;
}
/// @inheritdoc IReward
function _deposit(uint256 amount, uint256 tokenId, uint256 timestamp) external nonReentrant {
if (msg.sender != ILeafMessageBridge(authorized).module()) revert NotAuthorized();
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId], timestamp);
_writeSupplyCheckpoint(timestamp);
emit Deposit(tokenId, amount);
}
/// @inheritdoc IReward
function _withdraw(uint256 amount, uint256 tokenId, uint256 timestamp) external nonReentrant {
if (msg.sender != ILeafMessageBridge(authorized).module()) revert NotAuthorized();
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId], timestamp);
_writeSupplyCheckpoint(timestamp);
emit Withdraw(tokenId, amount);
}
/// @inheritdoc IReward
function getReward(address _recipient, uint256 _tokenId, address[] memory _tokens) external virtual nonReentrant {}
/// @dev used with all getReward implementations
function _getReward(address _recipient, uint256 _tokenId, address[] memory _tokens) internal {
uint256 _length = _tokens.length;
for (uint256 i = 0; i < _length; i++) {
uint256 _reward = earned(_tokens[i], _tokenId);
lastEarn[_tokens[i]][_tokenId] = block.timestamp;
if (_reward > 0) IERC20(_tokens[i]).safeTransfer(_recipient, _reward);
emit ClaimRewards(_recipient, _tokens[i], _reward);
}
}
/// @inheritdoc IReward
function notifyRewardAmount(address token, uint256 amount) external virtual nonReentrant {}
/// @dev used within all notifyRewardAmount implementations
function _notifyRewardAmount(address sender, address token, uint256 amount) internal {
if (amount == 0) revert ZeroAmount();
IERC20(token).safeTransferFrom(sender, address(this), amount);
uint256 epochStart = VelodromeTimeLibrary.epochStart(block.timestamp);
tokenRewardsPerEpoch[token][epochStart] += amount;
emit NotifyReward(sender, token, epochStart, amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ILeafMessageBridge {
error ZeroAddress();
event ModuleSet(address indexed _sender, address indexed _module);
/// @notice Returns the address of the xERC20 token that is bridged by this contract
function xerc20() external view returns (address);
/// @notice Returns the address of the module contract that is allowed to send messages x-chain
function module() external view returns (address);
/// @notice Returns the address of the voter contract
/// @dev Used to verify the sender of a message
function voter() external view returns (address);
/// @notice Sets the address of the module contract that is allowed to send messages x-chain
/// @dev Module handles x-chain messages
/// @param _module The address of the new module contract
function setModule(address _module) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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 towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (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 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 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.
uint256 twos = denominator & (0 - denominator);
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 (unsignedRoundsUp(rounding) && 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
* towards zero.
*
* 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: MIT
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(uint256 indexed _tokenId, uint256 _amount);
event Withdraw(uint256 indexed _tokenId, uint256 _amount);
event NotifyReward(address indexed _sender, address indexed _reward, uint256 indexed _epoch, uint256 _amount);
event ClaimRewards(address indexed _sender, address indexed _reward, uint256 _amount);
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint256 timestamp;
uint256 balanceOf;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint256 timestamp;
uint256 supply;
}
/// @notice Epoch duration constant (7 days)
function DURATION() external view returns (uint256);
/// @notice Address of LeafVoter.sol
function voter() external view returns (address);
/// @dev Address which has permission to externally call _deposit() & _withdraw()
function authorized() external view returns (address);
/// @notice Total amount currently deposited via _deposit()
function totalSupply() external view returns (uint256);
/// @notice Current amount deposited by tokenId
function balanceOf(uint256 tokenId) external view returns (uint256);
/// @notice Amount of tokens to reward depositors for a given epoch
/// @param token Address of token to reward
/// @param epochStart Startime of rewards epoch
/// @return Amount of token
function tokenRewardsPerEpoch(address token, uint256 epochStart) external view returns (uint256);
/// @notice Most recent timestamp a veNFT has claimed their rewards
/// @param token Address of token rewarded
/// @param tokenId veNFT unique identifier
/// @return Timestamp
function lastEarn(address token, uint256 tokenId) external view returns (uint256);
/// @notice List of reward tokens
/// @param _index Index of reward token
/// @return Address of reward token
function rewards(uint256 _index) external view returns (address);
/// @notice True if a token is or has been an active reward token, else false
function isReward(address token) external view returns (bool);
/// @notice The number of checkpoints for each tokenId deposited
function numCheckpoints(uint256 tokenId) external view returns (uint256);
/// @notice The total number of checkpoints
function supplyNumCheckpoints() external view returns (uint256);
/// @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.module()`.
/// @param amount Vote weight to deposit
/// @param tokenId Token ID of weight to deposit
/// @param timestamp Timestamp of deposit
function _deposit(uint256 amount, uint256 tokenId, uint256 timestamp) external;
/// @notice Withdraw an amount from the rewards contract associated to a veNFT
/// @dev Internal notation used as only callable internally by `authorized.module()`.
/// @param amount Vote weight to withdraw
/// @param tokenId Token ID of weight to withdraw
/// @param timestamp Timestamp of withdraw
function _withdraw(uint256 amount, uint256 tokenId, uint256 timestamp) external;
/// @notice Claim the rewards earned by a veNFT staker
/// @param _recipient Address of reward recipient
/// @param _tokenId Unique identifier of the veNFT
/// @param _tokens Array of tokens to claim rewards of
function getReward(address _recipient, 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 Get number of rewards tokens
function rewardsListLength() 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);
function checkpoints(uint256 tokenId, uint256 index) external view returns (uint256 timestamp, uint256 balanceOf);
function supplyCheckpoints(uint256 index) external view returns (uint256 timestamp, uint256 supply);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;
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 (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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 v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) 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 FailedInnerCall();
}
}
}{
"remappings": [
"@openzeppelin5/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/src/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"createX/=lib/createX/src/",
"@nomad-xyz/=lib/ExcessivelySafeCall/",
"@hyperlane/=node_modules/@hyperlane-xyz/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
"ExcessivelySafeCall/=lib/ExcessivelySafeCall/src/",
"openzeppelin/=lib/createX/lib/openzeppelin-contracts/contracts/",
"solady/=lib/createX/lib/solady/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_bridge","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotVoter","type":"error"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_rewards","type":"address[]"}],"name":"createRewards","outputs":[{"internalType":"address","name":"feesVotingReward","type":"address"},{"internalType":"address","name":"incentiveVotingReward","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c060405234801561000f575f5ffd5b506040516134b63803806134b683398101604081905261002e91610060565b6001600160a01b039182166080521660a052610091565b80516001600160a01b038116811461005b575f5ffd5b919050565b5f5f60408385031215610071575f5ffd5b61007a83610045565b915061008860208401610045565b90509250929050565b60805160a0516133e46100d25f395f818160bf0152818161014f01526101c601525f818160480152818160ee0152818161012e01526101a501526133e45ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c806346c96aac14610043578063887a425714610087578063e78cea92146100ba575b5f5ffd5b61006a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61009a610095366004610268565b6100e1565b604080516001600160a01b0393841681529290911660208301520161007e565b61006a7f000000000000000000000000000000000000000000000000000000000000000081565b5f80336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461012c5760405163c18384c160e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008460405161017b9061021f565b61018793929190610333565b604051809103905ff0801580156101a0573d5f5f3e3d5ffd5b5091507f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000846040516101f29061022c565b6101fe93929190610333565b604051809103905ff080158015610217573d5f5f3e3d5ffd5b509050915091565b6117e88061039d83390190565b61182a80611b8583390190565b634e487b7160e01b5f52604160045260245ffd5b80356001600160a01b0381168114610263575f5ffd5b919050565b5f60208284031215610278575f5ffd5b813567ffffffffffffffff81111561028e575f5ffd5b8201601f8101841361029e575f5ffd5b803567ffffffffffffffff8111156102b8576102b8610239565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156102e5576102e5610239565b604052918252602081840181019290810187841115610302575f5ffd5b6020850194505b838510156103285761031a8561024d565b815260209485019401610309565b509695505050505050565b6001600160a01b038481168252831660208083019190915260606040830181905283519083018190525f918401906080840190835b8181101561038f5783516001600160a01b0316835260209384019390920191600101610368565b509097965050505050505056fe60c060405234801561000f575f5ffd5b506040516117e83803806117e883398101604081905261002e9161016f565b60015f90815581518491849184915b81811015610122575f6001600160a01b03168382815181106100615761006161025c565b60200260200101516001600160a01b03161461011a57600160065f85848151811061008e5761008e61025c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff02191690831515021790555060058382815181106100df576100df61025c565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60010161003d565b5050506001600160a01b039182166080521660a05250610270915050565b80516001600160a01b0381168114610156575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f60608486031215610181575f5ffd5b61018a84610140565b925061019860208501610140565b60408501519092506001600160401b038111156101b3575f5ffd5b8401601f810186136101c3575f5ffd5b80516001600160401b038111156101dc576101dc61015b565b604051600582901b90603f8201601f191681016001600160401b038111828210171561020a5761020a61015b565b604052918252602081840181019290810189841115610227575f5ffd5b6020850194505b8385101561024d5761023f85610140565b81526020948501940161022e565b50809450505050509250925092565b634e487b7160e01b5f52603260045260245ffd5b60805160a05161153b6102ad5f395f8181610189015281816103a7015281816106d60152610a8101525f81816101c80152610b6b015261153b5ff3fe608060405234801561000f575f5ffd5b5060043610610132575f3560e01c806376f4be36116100b4578063b66503cf11610079578063b66503cf14610316578063e688639614610329578063e8111a1214610331578063f25e55a51461033a578063f301af4214610364578063f7412baf14610377575f5ffd5b806376f4be361461029457806392777b29146102a75780639cc7f708146102d1578063a28d4c9c146102f0578063a44d113f14610303575f5ffd5b806346c96aac116100fa57806346c96aac146101c357806349dcc204146101ea5780634d5ce0381461023057806350589793146102625780637225662014610281575f5ffd5b806318160ddd146101365780631be05289146101525780632a1fc4161461015c5780633e491d4714610171578063456cb7c614610184575b5f5ffd5b61013f60015481565b6040519081526020015b60405180910390f35b61013f62093a8081565b61016f61016a36600461126c565b61039d565b005b61013f61017f3660046112b9565b6104f9565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610149565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b61021b6101f83660046112e3565b600760209081525f92835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610149565b61025261023e366004611303565b60066020525f908152604090205460ff1681565b6040519015158152602001610149565b61013f61027036600461131e565b60086020525f908152604090205481565b61016f61028f36600461126c565b6106cc565b61013f6102a236600461131e565b610812565b61013f6102b53660046112b9565b600360209081525f928352604080842090915290825290205481565b61013f6102df36600461131e565b60026020525f908152604090205481565b61013f6102fe3660046112e3565b61093c565b61016f610311366004611349565b610a77565b61016f6103243660046112b9565b610b44565b60055461013f565b61013f600a5481565b61013f6103483660046112b9565b600460209081525f928352604080842090915290825290205481565b6101ab61037236600461131e565b610c4b565b61021b61038536600461131e565b60096020525f90815260409020805460019091015482565b6103a5610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104259190611431565b6001600160a01b0316336001600160a01b0316146104565760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f8282546104679190611460565b90915550505f8281526002602052604081208054859290610489908490611460565b90915550505f828152600260205260409020546104a890839083610c9b565b6104b181610d9c565b817fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c55846040516104e391815260200190565b60405180910390a26104f460015f55565b505050565b5f81815260086020526040812054810361051457505f6106c6565b6001600160a01b0383165f90815260046020908152604080832085845290915281205460019062093a80810690038261054d868361093c565b5f87815260076020908152604080832084845282529182902082518084019093528054808452600190910154918301919091529192509061059790849062093a8081069003610e52565b92505f62093a806105ad85428381069003611473565b6105b79190611486565b905080156106bd575f5b818110156106bb576105e68960016105dc62093a8089611460565b6102fe9190611473565b5f8a815260076020908152604080832084845282528083208151808301909252805482526001908101549282019290925292965091945061065891600991906106409061063662093a808b611460565b6102a29190611473565b81526020019081526020015f20600101546001610e52565b6001600160a01b038b165f90815260036020908152604080832089845282529091205490850151919750879161068e91906114a5565b6106989190611486565b6106a29088611460565b96506106b162093a8086611460565b94506001016105c1565b505b50939450505050505b92915050565b6106d4610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107549190611431565b6001600160a01b0316336001600160a01b0316146107855760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f8282546107969190611473565b90915550505f82815260026020526040812080548592906107b8908490611473565b90915550505f828152600260205260409020546107d790839083610c9b565b6107e081610d9c565b817f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8846040516104e391815260200190565b600a545f9080820361082657505f92915050565b8260095f610835600185611473565b81526020019081526020015f205f01541161085c57610855600182611473565b9392505050565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5483101561089557505f92915050565b5f806108a2600184611473565b90505b81811115610934575f60026108ba8484611473565b6108c49190611486565b6108ce9083611473565b5f8181526009602090815260409182902082518084019093528054808452600190910154918301919091529192509087900361090e575095945050505050565b805187111561091f5781935061092d565b61092a600183611473565b92505b50506108a5565b509392505050565b5f8281526008602052604081205480820361095a575f9150506106c6565b5f8481526007602052604081208491610974600185611473565b81526020019081526020015f205f01541161099c57610994600182611473565b9150506106c6565b5f8481526007602090815260408083208380529091529020548310156109c5575f9150506106c6565b5f806109d2600184611473565b90505b81811115610a6e575f60026109ea8484611473565b6109f49190611486565b6109fe9083611473565b5f888152600760209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090879003610a48575093506106c692505050565b8051871115610a5957819350610a67565b610a64600183611473565b92505b50506109d5565b50949350505050565b610a7f610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aff9190611431565b6001600160a01b0316336001600160a01b031614610b305760405163ea8e4eb560e01b815260040160405180910390fd5b610b3b838383610e67565b6104f460015f55565b610b4c610c73565b60405163c4f0816560e01b815233600482015230906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c4f0816590602401602060405180830381865afa158015610bb0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bd49190611431565b6001600160a01b031614610bfb576040516304639b6160e11b815260040160405180910390fd5b6001600160a01b0382165f9081526006602052604090205460ff16610c33576040516314414f4160e11b815260040160405180910390fd5b610c3e338383610f92565b610c4760015f55565b5050565b60058181548110610c5a575f80fd5b5f918252602090912001546001600160a01b0316905081565b60025f5403610c9557604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f838152600860205260409020548015801590610cf4575062093a80820682035f858152600760205260408120610cf291610cd7600186611473565b81526020019081526020015f205f015462093a808106900390565b145b15610d485760408051808201825283815260208082018690525f87815260079091529182209091610d26600185611473565b81526020808201929092526040015f2082518155910151600190910155610d96565b60408051808201825283815260208082018681525f88815260078352848120868252909252929020905181559051600191820155610d87908290611460565b5f858152600860205260409020555b50505050565b600a548015801590610dc4575062093a8082068203610dc260095f610cd7600186611473565b145b15610e1157604051806040016040528083815260200160015481525060095f600184610df09190611473565b81526020808201929092526040015f20825181559101516001909101555050565b6040805180820182528381526001805460208084019182525f86815260099091529390932091518255915190820155610e4b908290611460565b600a555050565b5f818311610e605781610855565b5090919050565b80515f5b81811015610f8b575f610e97848381518110610e8957610e896114bc565b6020026020010151866104f9565b90504260045f868581518110610eaf57610eaf6114bc565b6020908102919091018101516001600160a01b031682528181019290925260409081015f9081208982529092529020558015610f1c57610f1c8682868581518110610efc57610efc6114bc565b60200260200101516001600160a01b03166110699092919063ffffffff16565b838281518110610f2e57610f2e6114bc565b60200260200101516001600160a01b0316866001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f7a91815260200190565b60405180910390a350600101610e6b565b5050505050565b805f03610fb257604051631f2a200560e01b815260040160405180910390fd5b610fc76001600160a01b0383168430846110c8565b5f610fd74262093a808106900390565b6001600160a01b0384165f90815260036020908152604080832084845290915281208054929350849290919061100e908490611460565b9250508190555080836001600160a01b0316856001600160a01b03167f52977ea98a2220a03ee9ba5cb003ada08d394ea10155483c95dc2dc77a7eb24b8560405161105b91815260200190565b60405180910390a450505050565b6040516001600160a01b038381166024830152604482018390526104f491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611101565b6040516001600160a01b038481166024830152838116604483015260648201839052610d969186918216906323b872dd90608401611096565b5f6111156001600160a01b03841683611167565b905080515f1415801561113957508080602001905181019061113791906114d0565b155b156104f457604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061085583835f845f5f856001600160a01b0316848660405161118b91906114ef565b5f6040518083038185875af1925050503d805f81146111c5576040519150601f19603f3d011682016040523d82523d5f602084013e6111ca565b606091505b50915091506111da8683836111e4565b9695505050505050565b6060826111f9576111f482611240565b610855565b815115801561121057506001600160a01b0384163b155b1561123957604051639996b31560e01b81526001600160a01b038516600482015260240161115e565b5080610855565b8051156112505780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b5f5f5f6060848603121561127e575f5ffd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114611269575f5ffd5b80356112b481611295565b919050565b5f5f604083850312156112ca575f5ffd5b82356112d581611295565b946020939093013593505050565b5f5f604083850312156112f4575f5ffd5b50508035926020909101359150565b5f60208284031215611313575f5ffd5b813561085581611295565b5f6020828403121561132e575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f6060848603121561135b575f5ffd5b833561136681611295565b925060208401359150604084013567ffffffffffffffff811115611388575f5ffd5b8401601f81018613611398575f5ffd5b803567ffffffffffffffff8111156113b2576113b2611335565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156113df576113df611335565b6040529182526020818401810192908101898411156113fc575f5ffd5b6020850194505b8385101561142257611414856112a9565b815260209485019401611403565b50809450505050509250925092565b5f60208284031215611441575f5ffd5b815161085581611295565b634e487b7160e01b5f52601160045260245ffd5b808201808211156106c6576106c661144c565b818103818111156106c6576106c661144c565b5f826114a057634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176106c6576106c661144c565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156114e0575f5ffd5b81518015158114610855575f5ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220c91aa046d79be9afffc614fcbeff7d608594018c64154014d523b600644e213164736f6c634300081b003360c060405234801561000f575f5ffd5b5060405161182a38038061182a83398101604081905261002e9161016f565b60015f90815581518491849184915b81811015610122575f6001600160a01b03168382815181106100615761006161025c565b60200260200101516001600160a01b03161461011a57600160065f85848151811061008e5761008e61025c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff02191690831515021790555060058382815181106100df576100df61025c565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60010161003d565b5050506001600160a01b039182166080521660a05250610270915050565b80516001600160a01b0381168114610156575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f60608486031215610181575f5ffd5b61018a84610140565b925061019860208501610140565b60408501519092506001600160401b038111156101b3575f5ffd5b8401601f810186136101c3575f5ffd5b80516001600160401b038111156101dc576101dc61015b565b604051600582901b90603f8201601f191681016001600160401b038111828210171561020a5761020a61015b565b604052918252602081840181019290810189841115610227575f5ffd5b6020850194505b8385101561024d5761023f85610140565b81526020948501940161022e565b50809450505050509250925092565b634e487b7160e01b5f52603260045260245ffd5b60805160a05161157d6102ad5f395f8181610189015281816103a7015281816106d60152610a8101525f81816101c80152610b8a015261157d5ff3fe608060405234801561000f575f5ffd5b5060043610610132575f3560e01c806376f4be36116100b4578063b66503cf11610079578063b66503cf14610316578063e688639614610329578063e8111a1214610331578063f25e55a51461033a578063f301af4214610364578063f7412baf14610377575f5ffd5b806376f4be361461029457806392777b29146102a75780639cc7f708146102d1578063a28d4c9c146102f0578063a44d113f14610303575f5ffd5b806346c96aac116100fa57806346c96aac146101c357806349dcc204146101ea5780634d5ce0381461023057806350589793146102625780637225662014610281575f5ffd5b806318160ddd146101365780631be05289146101525780632a1fc4161461015c5780633e491d4714610171578063456cb7c614610184575b5f5ffd5b61013f60015481565b6040519081526020015b60405180910390f35b61013f62093a8081565b61016f61016a3660046112ae565b61039d565b005b61013f61017f3660046112fb565b6104f9565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610149565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b61021b6101f8366004611325565b600760209081525f92835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610149565b61025261023e366004611345565b60066020525f908152604090205460ff1681565b6040519015158152602001610149565b61013f610270366004611360565b60086020525f908152604090205481565b61016f61028f3660046112ae565b6106cc565b61013f6102a2366004611360565b610812565b61013f6102b53660046112fb565b600360209081525f928352604080842090915290825290205481565b61013f6102df366004611360565b60026020525f908152604090205481565b61013f6102fe366004611325565b61093c565b61016f61031136600461138b565b610a77565b61016f6103243660046112fb565b610b44565b60055461013f565b61013f600a5481565b61013f6103483660046112fb565b600460209081525f928352604080842090915290825290205481565b6101ab610372366004611360565b610c8d565b61021b610385366004611360565b60096020525f90815260409020805460019091015482565b6103a5610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104259190611473565b6001600160a01b0316336001600160a01b0316146104565760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f82825461046791906114a2565b90915550505f82815260026020526040812080548592906104899084906114a2565b90915550505f828152600260205260409020546104a890839083610cdd565b6104b181610dde565b817fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c55846040516104e391815260200190565b60405180910390a26104f460015f55565b505050565b5f81815260086020526040812054810361051457505f6106c6565b6001600160a01b0383165f90815260046020908152604080832085845290915281205460019062093a80810690038261054d868361093c565b5f87815260076020908152604080832084845282529182902082518084019093528054808452600190910154918301919091529192509061059790849062093a8081069003610e94565b92505f62093a806105ad854283810690036114b5565b6105b791906114c8565b905080156106bd575f5b818110156106bb576105e68960016105dc62093a80896114a2565b6102fe91906114b5565b5f8a815260076020908152604080832084845282528083208151808301909252805482526001908101549282019290925292965091945061065891600991906106409061063662093a808b6114a2565b6102a291906114b5565b81526020019081526020015f20600101546001610e94565b6001600160a01b038b165f90815260036020908152604080832089845282529091205490850151919750879161068e91906114e7565b61069891906114c8565b6106a290886114a2565b96506106b162093a80866114a2565b94506001016105c1565b505b50939450505050505b92915050565b6106d4610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107549190611473565b6001600160a01b0316336001600160a01b0316146107855760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f82825461079691906114b5565b90915550505f82815260026020526040812080548592906107b89084906114b5565b90915550505f828152600260205260409020546107d790839083610cdd565b6107e081610dde565b817f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8846040516104e391815260200190565b600a545f9080820361082657505f92915050565b8260095f6108356001856114b5565b81526020019081526020015f205f01541161085c576108556001826114b5565b9392505050565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5483101561089557505f92915050565b5f806108a26001846114b5565b90505b81811115610934575f60026108ba84846114b5565b6108c491906114c8565b6108ce90836114b5565b5f8181526009602090815260409182902082518084019093528054808452600190910154918301919091529192509087900361090e575095945050505050565b805187111561091f5781935061092d565b61092a6001836114b5565b92505b50506108a5565b509392505050565b5f8281526008602052604081205480820361095a575f9150506106c6565b5f84815260076020526040812084916109746001856114b5565b81526020019081526020015f205f01541161099c576109946001826114b5565b9150506106c6565b5f8481526007602090815260408083208380529091529020548310156109c5575f9150506106c6565b5f806109d26001846114b5565b90505b81811115610a6e575f60026109ea84846114b5565b6109f491906114c8565b6109fe90836114b5565b5f888152600760209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090879003610a48575093506106c692505050565b8051871115610a5957819350610a67565b610a646001836114b5565b92505b50506109d5565b50949350505050565b610a7f610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aff9190611473565b6001600160a01b0316336001600160a01b031614610b305760405163ea8e4eb560e01b815260040160405180910390fd5b610b3b838383610ea9565b6104f460015f55565b610b4c610cb5565b6001600160a01b0382165f9081526006602052604090205460ff16610c755760405163559bfa4360e11b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ab37f48690602401602060405180830381865afa158015610bcf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bf391906114fe565b610c1057604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b0382165f818152600660205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b03191690911790555b610c80338383610fd4565b610c8960015f55565b5050565b60058181548110610c9c575f80fd5b5f918252602090912001546001600160a01b0316905081565b60025f5403610cd757604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f838152600860205260409020548015801590610d36575062093a80820682035f858152600760205260408120610d3491610d196001866114b5565b81526020019081526020015f205f015462093a808106900390565b145b15610d8a5760408051808201825283815260208082018690525f87815260079091529182209091610d686001856114b5565b81526020808201929092526040015f2082518155910151600190910155610dd8565b60408051808201825283815260208082018681525f88815260078352848120868252909252929020905181559051600191820155610dc99082906114a2565b5f858152600860205260409020555b50505050565b600a548015801590610e06575062093a8082068203610e0460095f610d196001866114b5565b145b15610e5357604051806040016040528083815260200160015481525060095f600184610e3291906114b5565b81526020808201929092526040015f20825181559101516001909101555050565b6040805180820182528381526001805460208084019182525f86815260099091529390932091518255915190820155610e8d9082906114a2565b600a555050565b5f818311610ea25781610855565b5090919050565b80515f5b81811015610fcd575f610ed9848381518110610ecb57610ecb61151d565b6020026020010151866104f9565b90504260045f868581518110610ef157610ef161151d565b6020908102919091018101516001600160a01b031682528181019290925260409081015f9081208982529092529020558015610f5e57610f5e8682868581518110610f3e57610f3e61151d565b60200260200101516001600160a01b03166110ab9092919063ffffffff16565b838281518110610f7057610f7061151d565b60200260200101516001600160a01b0316866001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610fbc91815260200190565b60405180910390a350600101610ead565b5050505050565b805f03610ff457604051631f2a200560e01b815260040160405180910390fd5b6110096001600160a01b03831684308461110a565b5f6110194262093a808106900390565b6001600160a01b0384165f9081526003602090815260408083208484529091528120805492935084929091906110509084906114a2565b9250508190555080836001600160a01b0316856001600160a01b03167f52977ea98a2220a03ee9ba5cb003ada08d394ea10155483c95dc2dc77a7eb24b8560405161109d91815260200190565b60405180910390a450505050565b6040516001600160a01b038381166024830152604482018390526104f491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611143565b6040516001600160a01b038481166024830152838116604483015260648201839052610dd89186918216906323b872dd906084016110d8565b5f6111576001600160a01b038416836111a9565b905080515f1415801561117b57508080602001905181019061117991906114fe565b155b156104f457604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061085583835f845f5f856001600160a01b031684866040516111cd9190611531565b5f6040518083038185875af1925050503d805f8114611207576040519150601f19603f3d011682016040523d82523d5f602084013e61120c565b606091505b509150915061121c868383611226565b9695505050505050565b60608261123b5761123682611282565b610855565b815115801561125257506001600160a01b0384163b155b1561127b57604051639996b31560e01b81526001600160a01b03851660048201526024016111a0565b5080610855565b8051156112925780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b5f5f5f606084860312156112c0575f5ffd5b505081359360208301359350604090920135919050565b6001600160a01b03811681146112ab575f5ffd5b80356112f6816112d7565b919050565b5f5f6040838503121561130c575f5ffd5b8235611317816112d7565b946020939093013593505050565b5f5f60408385031215611336575f5ffd5b50508035926020909101359150565b5f60208284031215611355575f5ffd5b8135610855816112d7565b5f60208284031215611370575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f6060848603121561139d575f5ffd5b83356113a8816112d7565b925060208401359150604084013567ffffffffffffffff8111156113ca575f5ffd5b8401601f810186136113da575f5ffd5b803567ffffffffffffffff8111156113f4576113f4611377565b8060051b604051601f19603f830116810181811067ffffffffffffffff8211171561142157611421611377565b60405291825260208184018101929081018984111561143e575f5ffd5b6020850194505b8385101561146457611456856112eb565b815260209485019401611445565b50809450505050509250925092565b5f60208284031215611483575f5ffd5b8151610855816112d7565b634e487b7160e01b5f52601160045260245ffd5b808201808211156106c6576106c661148e565b818103818111156106c6576106c661148e565b5f826114e257634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176106c6576106c661148e565b5f6020828403121561150e575f5ffd5b81518015158114610855575f5ffd5b634e487b7160e01b5f52603260045260245ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220234a48ef2e87d9f06049ab04e20cdb688bd7b4adf798a19596105bd0a98e56d364736f6c634300081b0033a2646970667358221220e0e3c3d5d741d191c9671bd26d13b1b76dd9b55e37cf6a2ff44b5504bca0ade064736f6c634300081b003300000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123000000000000000000000000f278761576f45472bdd721eaca19317ce159c011
Deployed Bytecode
0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c806346c96aac14610043578063887a425714610087578063e78cea92146100ba575b5f5ffd5b61006a7f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a112381565b6040516001600160a01b0390911681526020015b60405180910390f35b61009a610095366004610268565b6100e1565b604080516001600160a01b0393841681529290911660208301520161007e565b61006a7f000000000000000000000000f278761576f45472bdd721eaca19317ce159c01181565b5f80336001600160a01b037f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123161461012c5760405163c18384c160e01b815260040160405180910390fd5b7f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a11237f000000000000000000000000f278761576f45472bdd721eaca19317ce159c0118460405161017b9061021f565b61018793929190610333565b604051809103905ff0801580156101a0573d5f5f3e3d5ffd5b5091507f00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a11237f000000000000000000000000f278761576f45472bdd721eaca19317ce159c011846040516101f29061022c565b6101fe93929190610333565b604051809103905ff080158015610217573d5f5f3e3d5ffd5b509050915091565b6117e88061039d83390190565b61182a80611b8583390190565b634e487b7160e01b5f52604160045260245ffd5b80356001600160a01b0381168114610263575f5ffd5b919050565b5f60208284031215610278575f5ffd5b813567ffffffffffffffff81111561028e575f5ffd5b8201601f8101841361029e575f5ffd5b803567ffffffffffffffff8111156102b8576102b8610239565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156102e5576102e5610239565b604052918252602081840181019290810187841115610302575f5ffd5b6020850194505b838510156103285761031a8561024d565b815260209485019401610309565b509695505050505050565b6001600160a01b038481168252831660208083019190915260606040830181905283519083018190525f918401906080840190835b8181101561038f5783516001600160a01b0316835260209384019390920191600101610368565b509097965050505050505056fe60c060405234801561000f575f5ffd5b506040516117e83803806117e883398101604081905261002e9161016f565b60015f90815581518491849184915b81811015610122575f6001600160a01b03168382815181106100615761006161025c565b60200260200101516001600160a01b03161461011a57600160065f85848151811061008e5761008e61025c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff02191690831515021790555060058382815181106100df576100df61025c565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60010161003d565b5050506001600160a01b039182166080521660a05250610270915050565b80516001600160a01b0381168114610156575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f60608486031215610181575f5ffd5b61018a84610140565b925061019860208501610140565b60408501519092506001600160401b038111156101b3575f5ffd5b8401601f810186136101c3575f5ffd5b80516001600160401b038111156101dc576101dc61015b565b604051600582901b90603f8201601f191681016001600160401b038111828210171561020a5761020a61015b565b604052918252602081840181019290810189841115610227575f5ffd5b6020850194505b8385101561024d5761023f85610140565b81526020948501940161022e565b50809450505050509250925092565b634e487b7160e01b5f52603260045260245ffd5b60805160a05161153b6102ad5f395f8181610189015281816103a7015281816106d60152610a8101525f81816101c80152610b6b015261153b5ff3fe608060405234801561000f575f5ffd5b5060043610610132575f3560e01c806376f4be36116100b4578063b66503cf11610079578063b66503cf14610316578063e688639614610329578063e8111a1214610331578063f25e55a51461033a578063f301af4214610364578063f7412baf14610377575f5ffd5b806376f4be361461029457806392777b29146102a75780639cc7f708146102d1578063a28d4c9c146102f0578063a44d113f14610303575f5ffd5b806346c96aac116100fa57806346c96aac146101c357806349dcc204146101ea5780634d5ce0381461023057806350589793146102625780637225662014610281575f5ffd5b806318160ddd146101365780631be05289146101525780632a1fc4161461015c5780633e491d4714610171578063456cb7c614610184575b5f5ffd5b61013f60015481565b6040519081526020015b60405180910390f35b61013f62093a8081565b61016f61016a36600461126c565b61039d565b005b61013f61017f3660046112b9565b6104f9565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610149565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b61021b6101f83660046112e3565b600760209081525f92835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610149565b61025261023e366004611303565b60066020525f908152604090205460ff1681565b6040519015158152602001610149565b61013f61027036600461131e565b60086020525f908152604090205481565b61016f61028f36600461126c565b6106cc565b61013f6102a236600461131e565b610812565b61013f6102b53660046112b9565b600360209081525f928352604080842090915290825290205481565b61013f6102df36600461131e565b60026020525f908152604090205481565b61013f6102fe3660046112e3565b61093c565b61016f610311366004611349565b610a77565b61016f6103243660046112b9565b610b44565b60055461013f565b61013f600a5481565b61013f6103483660046112b9565b600460209081525f928352604080842090915290825290205481565b6101ab61037236600461131e565b610c4b565b61021b61038536600461131e565b60096020525f90815260409020805460019091015482565b6103a5610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104259190611431565b6001600160a01b0316336001600160a01b0316146104565760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f8282546104679190611460565b90915550505f8281526002602052604081208054859290610489908490611460565b90915550505f828152600260205260409020546104a890839083610c9b565b6104b181610d9c565b817fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c55846040516104e391815260200190565b60405180910390a26104f460015f55565b505050565b5f81815260086020526040812054810361051457505f6106c6565b6001600160a01b0383165f90815260046020908152604080832085845290915281205460019062093a80810690038261054d868361093c565b5f87815260076020908152604080832084845282529182902082518084019093528054808452600190910154918301919091529192509061059790849062093a8081069003610e52565b92505f62093a806105ad85428381069003611473565b6105b79190611486565b905080156106bd575f5b818110156106bb576105e68960016105dc62093a8089611460565b6102fe9190611473565b5f8a815260076020908152604080832084845282528083208151808301909252805482526001908101549282019290925292965091945061065891600991906106409061063662093a808b611460565b6102a29190611473565b81526020019081526020015f20600101546001610e52565b6001600160a01b038b165f90815260036020908152604080832089845282529091205490850151919750879161068e91906114a5565b6106989190611486565b6106a29088611460565b96506106b162093a8086611460565b94506001016105c1565b505b50939450505050505b92915050565b6106d4610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107549190611431565b6001600160a01b0316336001600160a01b0316146107855760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f8282546107969190611473565b90915550505f82815260026020526040812080548592906107b8908490611473565b90915550505f828152600260205260409020546107d790839083610c9b565b6107e081610d9c565b817f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8846040516104e391815260200190565b600a545f9080820361082657505f92915050565b8260095f610835600185611473565b81526020019081526020015f205f01541161085c57610855600182611473565b9392505050565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5483101561089557505f92915050565b5f806108a2600184611473565b90505b81811115610934575f60026108ba8484611473565b6108c49190611486565b6108ce9083611473565b5f8181526009602090815260409182902082518084019093528054808452600190910154918301919091529192509087900361090e575095945050505050565b805187111561091f5781935061092d565b61092a600183611473565b92505b50506108a5565b509392505050565b5f8281526008602052604081205480820361095a575f9150506106c6565b5f8481526007602052604081208491610974600185611473565b81526020019081526020015f205f01541161099c57610994600182611473565b9150506106c6565b5f8481526007602090815260408083208380529091529020548310156109c5575f9150506106c6565b5f806109d2600184611473565b90505b81811115610a6e575f60026109ea8484611473565b6109f49190611486565b6109fe9083611473565b5f888152600760209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090879003610a48575093506106c692505050565b8051871115610a5957819350610a67565b610a64600183611473565b92505b50506109d5565b50949350505050565b610a7f610c73565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aff9190611431565b6001600160a01b0316336001600160a01b031614610b305760405163ea8e4eb560e01b815260040160405180910390fd5b610b3b838383610e67565b6104f460015f55565b610b4c610c73565b60405163c4f0816560e01b815233600482015230906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c4f0816590602401602060405180830381865afa158015610bb0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bd49190611431565b6001600160a01b031614610bfb576040516304639b6160e11b815260040160405180910390fd5b6001600160a01b0382165f9081526006602052604090205460ff16610c33576040516314414f4160e11b815260040160405180910390fd5b610c3e338383610f92565b610c4760015f55565b5050565b60058181548110610c5a575f80fd5b5f918252602090912001546001600160a01b0316905081565b60025f5403610c9557604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f838152600860205260409020548015801590610cf4575062093a80820682035f858152600760205260408120610cf291610cd7600186611473565b81526020019081526020015f205f015462093a808106900390565b145b15610d485760408051808201825283815260208082018690525f87815260079091529182209091610d26600185611473565b81526020808201929092526040015f2082518155910151600190910155610d96565b60408051808201825283815260208082018681525f88815260078352848120868252909252929020905181559051600191820155610d87908290611460565b5f858152600860205260409020555b50505050565b600a548015801590610dc4575062093a8082068203610dc260095f610cd7600186611473565b145b15610e1157604051806040016040528083815260200160015481525060095f600184610df09190611473565b81526020808201929092526040015f20825181559101516001909101555050565b6040805180820182528381526001805460208084019182525f86815260099091529390932091518255915190820155610e4b908290611460565b600a555050565b5f818311610e605781610855565b5090919050565b80515f5b81811015610f8b575f610e97848381518110610e8957610e896114bc565b6020026020010151866104f9565b90504260045f868581518110610eaf57610eaf6114bc565b6020908102919091018101516001600160a01b031682528181019290925260409081015f9081208982529092529020558015610f1c57610f1c8682868581518110610efc57610efc6114bc565b60200260200101516001600160a01b03166110699092919063ffffffff16565b838281518110610f2e57610f2e6114bc565b60200260200101516001600160a01b0316866001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f7a91815260200190565b60405180910390a350600101610e6b565b5050505050565b805f03610fb257604051631f2a200560e01b815260040160405180910390fd5b610fc76001600160a01b0383168430846110c8565b5f610fd74262093a808106900390565b6001600160a01b0384165f90815260036020908152604080832084845290915281208054929350849290919061100e908490611460565b9250508190555080836001600160a01b0316856001600160a01b03167f52977ea98a2220a03ee9ba5cb003ada08d394ea10155483c95dc2dc77a7eb24b8560405161105b91815260200190565b60405180910390a450505050565b6040516001600160a01b038381166024830152604482018390526104f491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611101565b6040516001600160a01b038481166024830152838116604483015260648201839052610d969186918216906323b872dd90608401611096565b5f6111156001600160a01b03841683611167565b905080515f1415801561113957508080602001905181019061113791906114d0565b155b156104f457604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061085583835f845f5f856001600160a01b0316848660405161118b91906114ef565b5f6040518083038185875af1925050503d805f81146111c5576040519150601f19603f3d011682016040523d82523d5f602084013e6111ca565b606091505b50915091506111da8683836111e4565b9695505050505050565b6060826111f9576111f482611240565b610855565b815115801561121057506001600160a01b0384163b155b1561123957604051639996b31560e01b81526001600160a01b038516600482015260240161115e565b5080610855565b8051156112505780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b5f5f5f6060848603121561127e575f5ffd5b505081359360208301359350604090920135919050565b6001600160a01b0381168114611269575f5ffd5b80356112b481611295565b919050565b5f5f604083850312156112ca575f5ffd5b82356112d581611295565b946020939093013593505050565b5f5f604083850312156112f4575f5ffd5b50508035926020909101359150565b5f60208284031215611313575f5ffd5b813561085581611295565b5f6020828403121561132e575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f6060848603121561135b575f5ffd5b833561136681611295565b925060208401359150604084013567ffffffffffffffff811115611388575f5ffd5b8401601f81018613611398575f5ffd5b803567ffffffffffffffff8111156113b2576113b2611335565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156113df576113df611335565b6040529182526020818401810192908101898411156113fc575f5ffd5b6020850194505b8385101561142257611414856112a9565b815260209485019401611403565b50809450505050509250925092565b5f60208284031215611441575f5ffd5b815161085581611295565b634e487b7160e01b5f52601160045260245ffd5b808201808211156106c6576106c661144c565b818103818111156106c6576106c661144c565b5f826114a057634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176106c6576106c661144c565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156114e0575f5ffd5b81518015158114610855575f5ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220c91aa046d79be9afffc614fcbeff7d608594018c64154014d523b600644e213164736f6c634300081b003360c060405234801561000f575f5ffd5b5060405161182a38038061182a83398101604081905261002e9161016f565b60015f90815581518491849184915b81811015610122575f6001600160a01b03168382815181106100615761006161025c565b60200260200101516001600160a01b03161461011a57600160065f85848151811061008e5761008e61025c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff02191690831515021790555060058382815181106100df576100df61025c565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b039092169190911790555b60010161003d565b5050506001600160a01b039182166080521660a05250610270915050565b80516001600160a01b0381168114610156575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f60608486031215610181575f5ffd5b61018a84610140565b925061019860208501610140565b60408501519092506001600160401b038111156101b3575f5ffd5b8401601f810186136101c3575f5ffd5b80516001600160401b038111156101dc576101dc61015b565b604051600582901b90603f8201601f191681016001600160401b038111828210171561020a5761020a61015b565b604052918252602081840181019290810189841115610227575f5ffd5b6020850194505b8385101561024d5761023f85610140565b81526020948501940161022e565b50809450505050509250925092565b634e487b7160e01b5f52603260045260245ffd5b60805160a05161157d6102ad5f395f8181610189015281816103a7015281816106d60152610a8101525f81816101c80152610b8a015261157d5ff3fe608060405234801561000f575f5ffd5b5060043610610132575f3560e01c806376f4be36116100b4578063b66503cf11610079578063b66503cf14610316578063e688639614610329578063e8111a1214610331578063f25e55a51461033a578063f301af4214610364578063f7412baf14610377575f5ffd5b806376f4be361461029457806392777b29146102a75780639cc7f708146102d1578063a28d4c9c146102f0578063a44d113f14610303575f5ffd5b806346c96aac116100fa57806346c96aac146101c357806349dcc204146101ea5780634d5ce0381461023057806350589793146102625780637225662014610281575f5ffd5b806318160ddd146101365780631be05289146101525780632a1fc4161461015c5780633e491d4714610171578063456cb7c614610184575b5f5ffd5b61013f60015481565b6040519081526020015b60405180910390f35b61013f62093a8081565b61016f61016a3660046112ae565b61039d565b005b61013f61017f3660046112fb565b6104f9565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610149565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b61021b6101f8366004611325565b600760209081525f92835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610149565b61025261023e366004611345565b60066020525f908152604090205460ff1681565b6040519015158152602001610149565b61013f610270366004611360565b60086020525f908152604090205481565b61016f61028f3660046112ae565b6106cc565b61013f6102a2366004611360565b610812565b61013f6102b53660046112fb565b600360209081525f928352604080842090915290825290205481565b61013f6102df366004611360565b60026020525f908152604090205481565b61013f6102fe366004611325565b61093c565b61016f61031136600461138b565b610a77565b61016f6103243660046112fb565b610b44565b60055461013f565b61013f600a5481565b61013f6103483660046112fb565b600460209081525f928352604080842090915290825290205481565b6101ab610372366004611360565b610c8d565b61021b610385366004611360565b60096020525f90815260409020805460019091015482565b6103a5610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610401573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104259190611473565b6001600160a01b0316336001600160a01b0316146104565760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f82825461046791906114a2565b90915550505f82815260026020526040812080548592906104899084906114a2565b90915550505f828152600260205260409020546104a890839083610cdd565b6104b181610dde565b817fa3af609bf46297028ce551832669030f9effef2b02606d02cbbcc40fe6b47c55846040516104e391815260200190565b60405180910390a26104f460015f55565b505050565b5f81815260086020526040812054810361051457505f6106c6565b6001600160a01b0383165f90815260046020908152604080832085845290915281205460019062093a80810690038261054d868361093c565b5f87815260076020908152604080832084845282529182902082518084019093528054808452600190910154918301919091529192509061059790849062093a8081069003610e94565b92505f62093a806105ad854283810690036114b5565b6105b791906114c8565b905080156106bd575f5b818110156106bb576105e68960016105dc62093a80896114a2565b6102fe91906114b5565b5f8a815260076020908152604080832084845282528083208151808301909252805482526001908101549282019290925292965091945061065891600991906106409061063662093a808b6114a2565b6102a291906114b5565b81526020019081526020015f20600101546001610e94565b6001600160a01b038b165f90815260036020908152604080832089845282529091205490850151919750879161068e91906114e7565b61069891906114c8565b6106a290886114a2565b96506106b162093a80866114a2565b94506001016105c1565b505b50939450505050505b92915050565b6106d4610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610730573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107549190611473565b6001600160a01b0316336001600160a01b0316146107855760405163ea8e4eb560e01b815260040160405180910390fd5b8260015f82825461079691906114b5565b90915550505f82815260026020526040812080548592906107b89084906114b5565b90915550505f828152600260205260409020546107d790839083610cdd565b6107e081610dde565b817f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8846040516104e391815260200190565b600a545f9080820361082657505f92915050565b8260095f6108356001856114b5565b81526020019081526020015f205f01541161085c576108556001826114b5565b9392505050565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5483101561089557505f92915050565b5f806108a26001846114b5565b90505b81811115610934575f60026108ba84846114b5565b6108c491906114c8565b6108ce90836114b5565b5f8181526009602090815260409182902082518084019093528054808452600190910154918301919091529192509087900361090e575095945050505050565b805187111561091f5781935061092d565b61092a6001836114b5565b92505b50506108a5565b509392505050565b5f8281526008602052604081205480820361095a575f9150506106c6565b5f84815260076020526040812084916109746001856114b5565b81526020019081526020015f205f01541161099c576109946001826114b5565b9150506106c6565b5f8481526007602090815260408083208380529091529020548310156109c5575f9150506106c6565b5f806109d26001846114b5565b90505b81811115610a6e575f60026109ea84846114b5565b6109f491906114c8565b6109fe90836114b5565b5f888152600760209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090879003610a48575093506106c692505050565b8051871115610a5957819350610a67565b610a646001836114b5565b92505b50506109d5565b50949350505050565b610a7f610cb5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b86d52986040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aff9190611473565b6001600160a01b0316336001600160a01b031614610b305760405163ea8e4eb560e01b815260040160405180910390fd5b610b3b838383610ea9565b6104f460015f55565b610b4c610cb5565b6001600160a01b0382165f9081526006602052604090205460ff16610c755760405163559bfa4360e11b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ab37f48690602401602060405180830381865afa158015610bcf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bf391906114fe565b610c1057604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b0382165f818152600660205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b03191690911790555b610c80338383610fd4565b610c8960015f55565b5050565b60058181548110610c9c575f80fd5b5f918252602090912001546001600160a01b0316905081565b60025f5403610cd757604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f838152600860205260409020548015801590610d36575062093a80820682035f858152600760205260408120610d3491610d196001866114b5565b81526020019081526020015f205f015462093a808106900390565b145b15610d8a5760408051808201825283815260208082018690525f87815260079091529182209091610d686001856114b5565b81526020808201929092526040015f2082518155910151600190910155610dd8565b60408051808201825283815260208082018681525f88815260078352848120868252909252929020905181559051600191820155610dc99082906114a2565b5f858152600860205260409020555b50505050565b600a548015801590610e06575062093a8082068203610e0460095f610d196001866114b5565b145b15610e5357604051806040016040528083815260200160015481525060095f600184610e3291906114b5565b81526020808201929092526040015f20825181559101516001909101555050565b6040805180820182528381526001805460208084019182525f86815260099091529390932091518255915190820155610e8d9082906114a2565b600a555050565b5f818311610ea25781610855565b5090919050565b80515f5b81811015610fcd575f610ed9848381518110610ecb57610ecb61151d565b6020026020010151866104f9565b90504260045f868581518110610ef157610ef161151d565b6020908102919091018101516001600160a01b031682528181019290925260409081015f9081208982529092529020558015610f5e57610f5e8682868581518110610f3e57610f3e61151d565b60200260200101516001600160a01b03166110ab9092919063ffffffff16565b838281518110610f7057610f7061151d565b60200260200101516001600160a01b0316866001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610fbc91815260200190565b60405180910390a350600101610ead565b5050505050565b805f03610ff457604051631f2a200560e01b815260040160405180910390fd5b6110096001600160a01b03831684308461110a565b5f6110194262093a808106900390565b6001600160a01b0384165f9081526003602090815260408083208484529091528120805492935084929091906110509084906114a2565b9250508190555080836001600160a01b0316856001600160a01b03167f52977ea98a2220a03ee9ba5cb003ada08d394ea10155483c95dc2dc77a7eb24b8560405161109d91815260200190565b60405180910390a450505050565b6040516001600160a01b038381166024830152604482018390526104f491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611143565b6040516001600160a01b038481166024830152838116604483015260648201839052610dd89186918216906323b872dd906084016110d8565b5f6111576001600160a01b038416836111a9565b905080515f1415801561117b57508080602001905181019061117991906114fe565b155b156104f457604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b606061085583835f845f5f856001600160a01b031684866040516111cd9190611531565b5f6040518083038185875af1925050503d805f8114611207576040519150601f19603f3d011682016040523d82523d5f602084013e61120c565b606091505b509150915061121c868383611226565b9695505050505050565b60608261123b5761123682611282565b610855565b815115801561125257506001600160a01b0384163b155b1561127b57604051639996b31560e01b81526001600160a01b03851660048201526024016111a0565b5080610855565b8051156112925780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b5f5f5f606084860312156112c0575f5ffd5b505081359360208301359350604090920135919050565b6001600160a01b03811681146112ab575f5ffd5b80356112f6816112d7565b919050565b5f5f6040838503121561130c575f5ffd5b8235611317816112d7565b946020939093013593505050565b5f5f60408385031215611336575f5ffd5b50508035926020909101359150565b5f60208284031215611355575f5ffd5b8135610855816112d7565b5f60208284031215611370575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f6060848603121561139d575f5ffd5b83356113a8816112d7565b925060208401359150604084013567ffffffffffffffff8111156113ca575f5ffd5b8401601f810186136113da575f5ffd5b803567ffffffffffffffff8111156113f4576113f4611377565b8060051b604051601f19603f830116810181811067ffffffffffffffff8211171561142157611421611377565b60405291825260208184018101929081018984111561143e575f5ffd5b6020850194505b8385101561146457611456856112eb565b815260209485019401611445565b50809450505050509250925092565b5f60208284031215611483575f5ffd5b8151610855816112d7565b634e487b7160e01b5f52601160045260245ffd5b808201808211156106c6576106c661148e565b818103818111156106c6576106c661148e565b5f826114e257634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176106c6576106c661148e565b5f6020828403121561150e575f5ffd5b81518015158114610855575f5ffd5b634e487b7160e01b5f52603260045260245ffd5b5f82518060208501845e5f92019182525091905056fea2646970667358221220234a48ef2e87d9f06049ab04e20cdb688bd7b4adf798a19596105bd0a98e56d364736f6c634300081b0033a2646970667358221220e0e3c3d5d741d191c9671bd26d13b1b76dd9b55e37cf6a2ff44b5504bca0ade064736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123000000000000000000000000f278761576f45472bdd721eaca19317ce159c011
-----Decoded View---------------
Arg [0] : _voter (address): 0x97cDBCe21B6fd0585d29E539B1B99dAd328a1123
Arg [1] : _bridge (address): 0xF278761576f45472bdD721EACA19317cE159c011
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000097cdbce21b6fd0585d29e539b1b99dad328a1123
Arg [1] : 000000000000000000000000f278761576f45472bdd721eaca19317ce159c011
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.