More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
RewardsDistributor
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.13; import './libraries/Math.sol'; import {Constants} from "./libraries/Constants.sol"; import './interfaces/IRewardsDistributor.sol'; import './interfaces/IVotingEscrow.sol'; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /* @title Curve Fee Distribution modified for ve(3,3) emissions @author Curve Finance, andrecronje @license MIT */ contract RewardsDistributor is IRewardsDistributor { using SafeERC20 for IERC20; event CheckpointToken( uint time, uint tokens ); event Claimed( uint tokenId, uint amount, uint claim_epoch, uint max_epoch ); uint public start_time; uint public time_cursor; mapping(uint => uint) public time_cursor_of; mapping(uint => uint) public user_epoch_of; uint public last_token_time; uint[1000000000000000] public tokens_per_week; uint public token_last_balance; uint[1000000000000000] public ve_supply; address public owner; address public voting_escrow; address public token; address public depositor; constructor(address _voting_escrow) { uint _t = block.timestamp / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; start_time = _t; last_token_time = _t; time_cursor = _t; address _token = IVotingEscrow(_voting_escrow).token(); token = _token; voting_escrow = _voting_escrow; depositor = msg.sender; //MinterUpgradeable owner = msg.sender; require(IERC20(_token).approve(_voting_escrow, type(uint).max)); } function timestamp() external view returns (uint) { return block.timestamp / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; } function _checkpoint_token() internal { uint token_balance = IERC20(token).balanceOf(address(this)); uint to_distribute = token_balance - token_last_balance; token_last_balance = token_balance; uint t = last_token_time; uint since_last = block.timestamp - t; last_token_time = block.timestamp; uint this_week = t / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; uint next_week = 0; for (uint i = 0; i < 20; i++) { next_week = this_week + Constants.EPOCH_LENGTH; if (block.timestamp < next_week) { if (since_last == 0 && block.timestamp == t) { tokens_per_week[this_week] += to_distribute; } else { tokens_per_week[this_week] += to_distribute * (block.timestamp - t) / since_last; } break; } else { if (since_last == 0 && next_week == t) { tokens_per_week[this_week] += to_distribute; } else { tokens_per_week[this_week] += to_distribute * (next_week - t) / since_last; } } t = next_week; this_week = next_week; } emit CheckpointToken(block.timestamp, to_distribute); } function checkpoint_token() external { assert(msg.sender == depositor); _checkpoint_token(); } function _find_timestamp_epoch(address ve, uint _timestamp) internal view returns (uint) { uint _min = 0; uint _max = IVotingEscrow(ve).epoch(); for (uint i = 0; i < 128; i++) { if (_min >= _max) break; uint _mid = (_min + _max + 2) / 2; IVotingEscrow.Point memory pt = IVotingEscrow(ve).point_history(_mid); if (pt.ts <= _timestamp) { _min = _mid; } else { _max = _mid - 1; } } return _min; } function _find_timestamp_user_epoch(address ve, uint tokenId, uint _timestamp, uint max_user_epoch) internal view returns (uint) { uint _min = 0; uint _max = max_user_epoch; for (uint i = 0; i < 128; i++) { if (_min >= _max) break; uint _mid = (_min + _max + 2) / 2; IVotingEscrow.Point memory pt = IVotingEscrow(ve).user_point_history(tokenId, _mid); if (pt.ts <= _timestamp) { _min = _mid; } else { _max = _mid -1; } } return _min; } function ve_for_at(uint _tokenId, uint _timestamp) external view returns (uint) { address ve = voting_escrow; uint max_user_epoch = IVotingEscrow(ve).user_point_epoch(_tokenId); uint epoch = _find_timestamp_user_epoch(ve, _tokenId, _timestamp, max_user_epoch); IVotingEscrow.Point memory pt = IVotingEscrow(ve).user_point_history(_tokenId, epoch); return Math.max(uint(int256(pt.bias - pt.slope * (int128(int256(_timestamp - pt.ts))))), 0); } function _checkpoint_total_supply() internal { address ve = voting_escrow; uint t = time_cursor; uint rounded_timestamp = block.timestamp / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; IVotingEscrow(ve).checkpoint(); for (uint i = 0; i < 20; i++) { if (t > rounded_timestamp) { break; } else { uint epoch = _find_timestamp_epoch(ve, t); IVotingEscrow.Point memory pt = IVotingEscrow(ve).point_history(epoch); int128 dt = 0; if (t > pt.ts) { dt = int128(int256(t - pt.ts)); } ve_supply[t] = Math.max(uint(int256(pt.bias - pt.slope * dt)), 0); } t += Constants.EPOCH_LENGTH; } time_cursor = t; } function checkpoint_total_supply() external { _checkpoint_total_supply(); } function _claim(uint _tokenId, address ve, uint _last_token_time) internal returns (uint) { uint user_epoch = 0; uint to_distribute = 0; uint max_user_epoch = IVotingEscrow(ve).user_point_epoch(_tokenId); uint _start_time = start_time; if (max_user_epoch == 0) return 0; uint week_cursor = time_cursor_of[_tokenId]; if (week_cursor == 0) { user_epoch = _find_timestamp_user_epoch(ve, _tokenId, _start_time, max_user_epoch); } else { user_epoch = user_epoch_of[_tokenId]; } if (user_epoch == 0) user_epoch = 1; IVotingEscrow.Point memory user_point = IVotingEscrow(ve).user_point_history(_tokenId, user_epoch); if (week_cursor == 0) week_cursor = (user_point.ts + Constants.EPOCH_LENGTH - 1) / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; if (week_cursor >= last_token_time) return 0; if (week_cursor < _start_time) week_cursor = _start_time; IVotingEscrow.Point memory old_user_point; for (uint i = 0; i < 50; i++) { if (week_cursor >= _last_token_time) break; if (week_cursor >= user_point.ts && user_epoch <= max_user_epoch) { user_epoch += 1; old_user_point = user_point; if (user_epoch > max_user_epoch) { user_point = IVotingEscrow.Point(0,0,0,0); } else { user_point = IVotingEscrow(ve).user_point_history(_tokenId, user_epoch); } } else { int128 dt = int128(int256(week_cursor - old_user_point.ts)); uint balance_of = (old_user_point.bias - dt * old_user_point.slope) < 0 ? 0 : uint(int256(old_user_point.bias - dt * old_user_point.slope)); if (balance_of == 0 && user_epoch > max_user_epoch) break; if (balance_of != 0) { to_distribute += balance_of * tokens_per_week[week_cursor] / ve_supply[week_cursor]; } week_cursor += Constants.EPOCH_LENGTH; } } user_epoch = Math.min(max_user_epoch, user_epoch - 1); user_epoch_of[_tokenId] = user_epoch; time_cursor_of[_tokenId] = week_cursor; emit Claimed(_tokenId, to_distribute, user_epoch, max_user_epoch); return to_distribute; } function _claimable(uint _tokenId, address ve, uint _last_token_time) internal view returns (uint) { uint user_epoch = 0; uint to_distribute = 0; uint max_user_epoch = IVotingEscrow(ve).user_point_epoch(_tokenId); uint _start_time = start_time; if (max_user_epoch == 0) return 0; uint week_cursor = time_cursor_of[_tokenId]; if (week_cursor == 0) { user_epoch = _find_timestamp_user_epoch(ve, _tokenId, _start_time, max_user_epoch); } else { user_epoch = user_epoch_of[_tokenId]; } if (user_epoch == 0) user_epoch = 1; IVotingEscrow.Point memory user_point = IVotingEscrow(ve).user_point_history(_tokenId, user_epoch); if (week_cursor == 0) week_cursor = (user_point.ts + Constants.EPOCH_LENGTH - 1) / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; if (week_cursor >= last_token_time) return 0; if (week_cursor < _start_time) week_cursor = _start_time; IVotingEscrow.Point memory old_user_point; for (uint i = 0; i < 50; i++) { if (week_cursor >= _last_token_time) break; if (week_cursor >= user_point.ts && user_epoch <= max_user_epoch) { user_epoch += 1; old_user_point = user_point; if (user_epoch > max_user_epoch) { user_point = IVotingEscrow.Point(0,0,0,0); } else { user_point = IVotingEscrow(ve).user_point_history(_tokenId, user_epoch); } } else { int128 dt = int128(int256(week_cursor - old_user_point.ts)); uint balance_of = (old_user_point.bias - dt * old_user_point.slope) < 0 ? 0 : uint(int256(old_user_point.bias - dt * old_user_point.slope)); if (balance_of == 0 && user_epoch > max_user_epoch) break; if (balance_of != 0) { to_distribute += balance_of * tokens_per_week[week_cursor] / ve_supply[week_cursor]; } week_cursor += Constants.EPOCH_LENGTH; } } return to_distribute; } function claimable(uint _tokenId) external view returns (uint) { uint _last_token_time = last_token_time / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; return _claimable(_tokenId, voting_escrow, _last_token_time); } function claim(uint _tokenId) external returns (uint) { if (block.timestamp >= time_cursor) _checkpoint_total_supply(); uint _last_token_time = last_token_time; _last_token_time = _last_token_time / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; uint amount = _claim(_tokenId, voting_escrow, _last_token_time); if (amount != 0) { // if locked.end then send directly IVotingEscrow.LockedBalance memory _locked = IVotingEscrow(voting_escrow).locked(_tokenId); if(_locked.end < block.timestamp){ address _nftOwner = IVotingEscrow(voting_escrow).ownerOf(_tokenId); IERC20(token).safeTransfer(_nftOwner, amount); } else { IVotingEscrow(voting_escrow).deposit_for(_tokenId, amount); } token_last_balance -= amount; } return amount; } function claim_many(uint[] memory _tokenIds) external returns (bool) { if (block.timestamp >= time_cursor) _checkpoint_total_supply(); uint _last_token_time = last_token_time; _last_token_time = _last_token_time / Constants.EPOCH_LENGTH * Constants.EPOCH_LENGTH; address _voting_escrow = voting_escrow; uint total = 0; for (uint i = 0; i < _tokenIds.length; i++) { uint _tokenId = _tokenIds[i]; if (_tokenId == 0) break; uint amount = _claim(_tokenId, _voting_escrow, _last_token_time); if (amount != 0) { // if locked.end then send directly IVotingEscrow.LockedBalance memory _locked = IVotingEscrow(_voting_escrow).locked(_tokenId); if(_locked.end < block.timestamp){ address _nftOwner = IVotingEscrow(_voting_escrow).ownerOf(_tokenId); IERC20(token).safeTransfer(_nftOwner, amount); } else { IVotingEscrow(_voting_escrow).deposit_for(_tokenId, amount); } total += amount; } } if (total != 0) { token_last_balance -= total; } return true; } function setDepositor(address _depositor) external { require(msg.sender == owner); depositor = _depositor; } function setOwner(address _owner) external { require(msg.sender == owner); owner = _owner; } function withdrawERC20(address _token) external { require(msg.sender == owner); require(_token != address(0)); uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, _balance); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IRewardsDistributor { function checkpoint_token() external; function voting_escrow() external view returns(address); function checkpoint_total_supply() external; function claimable(uint _tokenId) external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IVotingEscrow { struct Point { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block } struct LockedBalance { int128 amount; uint start; uint end; } function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint); function locked(uint id) external view returns(LockedBalance memory); function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint); function token() external view returns (address); function team() external returns (address); function epoch() external view returns (uint); function point_history(uint loc) external view returns (Point memory); function user_point_history(uint tokenId, uint loc) external view returns (Point memory); function user_point_epoch(uint tokenId) external view returns (uint); function ownerOf(uint) external view returns (address); function isApprovedOrOwner(address, uint) external view returns (bool); function transferFrom(address, address, uint) external; function voted(uint) external view returns (bool); function attachments(uint) external view returns (uint); function voting(uint tokenId) external; function abstain(uint tokenId) external; function attach(uint tokenId) external; function detach(uint tokenId) external; function checkpoint() external; function deposit_for(uint tokenId, uint value) external; function balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint); function balanceOfNFT(uint _id) external view returns (uint); function balanceOf(address _owner) external view returns (uint); function totalSupply() external view returns (uint); function supply() external view returns (uint); function decimals() external view returns(uint8); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; library Constants { uint256 internal constant EPOCH_LENGTH = 1 hours; // 7 days; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; library Math { function max(uint a, uint b) internal pure returns (uint) { return a >= b ? a : b; } function min(uint a, uint b) internal pure returns (uint) { return a < b ? a : b; } function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } function cbrt(uint256 n) internal pure returns (uint256) { unchecked { uint256 x = 0; for (uint256 y = 1 << 255; y > 0; y >>= 3) { x <<= 1; uint256 z = 3 * x * (x + 1) + 1; if (n / y >= z) { n -= y * z; x += 1; } } return x; }} }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_voting_escrow","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"CheckpointToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claim_epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"max_epoch","type":"uint256"}],"name":"Claimed","type":"event"},{"inputs":[],"name":"checkpoint_token","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpoint_total_supply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"claim_many","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"last_token_time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_depositor","type":"address"}],"name":"setDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"start_time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"time_cursor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"time_cursor_of","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token_last_balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens_per_week","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"user_epoch_of","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"ve_for_at","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ve_supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voting_escrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620022f8380380620022f88339810160408190526200003491620001b0565b6000610e10620000458142620001e2565b62000051919062000205565b90508060008190555080600481905550806001819055506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf9190620001b0565b66071afd498d000880546001600160a01b03199081166001600160a01b0384811691821790935566071afd498d000780548316938816938417905566071afd498d0009805433908416811790915566071afd498d000680549093161790915560405163095ea7b360e01b81526004810192909252600019602483015291925063095ea7b3906044016020604051808303816000875af115801562000177573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200019d919062000233565b620001a757600080fd5b50505062000257565b600060208284031215620001c357600080fd5b81516001600160a01b0381168114620001db57600080fd5b9392505050565b6000826200020057634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156200022e57634e487b7160e01b600052601160045260246000fd5b500290565b6000602082840312156200024657600080fd5b81518015158114620001db57600080fd5b61209180620002676000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80638da5cb5b116100b8578063d4dafba81161007c578063d4dafba814610297578063dfe05031146102aa578063edf59997146102c3578063f2c098b7146102d6578063f4f3b200146102e9578063fc0c546a146102fc57600080fd5b80638da5cb5b1461022a578063b21ed5021461025b578063b80777ea14610263578063c7c4ff461461026b578063d1d58b251461028457600080fd5b8063379607f51161010a578063379607f5146101ca578063486d25fe146101dd57806368809889146101fd5780637f58e8f814610210578063811a40fe14610219578063834ee4171461022157600080fd5b8063127dcbd31461014757806313af40351461016357806316aea5c0146101785780631f1db0431461019857806322b04bfc146101bb575b600080fd5b61015060015481565b6040519081526020015b60405180910390f35b610176610171366004611b9c565b610315565b005b610150610186366004611bb9565b60036020526000908152604090205481565b6101ab6101a6366004611c19565b61035a565b604051901515815260200161015a565b61015066038d7ea4c680055481565b6101506101d8366004611bb9565b6105ab565b6101506101eb366004611bb9565b60026020526000908152604090205481565b61015061020b366004611cbf565b6107b2565b61015060045481565b6101766108f5565b61015060005481565b66071afd498d000654610243906001600160a01b031681565b6040516001600160a01b03909116815260200161015a565b61017661091f565b610150610927565b66071afd498d000954610243906001600160a01b031681565b610150610292366004611bb9565b610945565b6101506102a5366004611bb9565b610984565b66071afd498d000754610243906001600160a01b031681565b6101506102d1366004611bb9565b6109a7565b6101766102e4366004611b9c565b6109bd565b6101766102f7366004611b9c565b610a02565b66071afd498d000854610243906001600160a01b031681565b66071afd498d0006546001600160a01b0316331461033257600080fd5b66071afd498d000680546001600160a01b0319166001600160a01b0392909216919091179055565b6000600154421061036d5761036d610ab7565b600454610e1061037d8183611cf7565b6103879190611d19565b66071afd498d0007549091506001600160a01b03166000805b855181101561057b5760008682815181106103bd576103bd611d38565b60200260200101519050806000036103d5575061057b565b60006103e2828688610c58565b9050801561056657604051635a2d1e0760e11b8152600481018390526000906001600160a01b0387169063b45a3c0e90602401606060405180830381865afa158015610432573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104569190611d65565b905042816040015110156104f6576040516331a9108f60e11b8152600481018490526000906001600160a01b03881690636352211e90602401602060405180830381865afa1580156104ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d09190611dc6565b66071afd498d0008549091506104f0906001600160a01b031682856110a5565b50610558565b604051631dd33fc560e31b815260048101849052602481018390526001600160a01b0387169063ee99fe2890604401600060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b505050505b6105628286611de3565b9450505b5050808061057390611dfb565b9150506103a0565b5080156105a0578066038d7ea4c68005600082825461059a9190611e14565b90915550505b506001949350505050565b600060015442106105be576105be610ab7565b600454610e106105ce8183611cf7565b6105d89190611d19565b66071afd498d0007549091506000906105fc9085906001600160a01b031684610c58565b905080156107ab5766071afd498d000754604051635a2d1e0760e11b8152600481018690526000916001600160a01b03169063b45a3c0e90602401606060405180830381865afa158015610654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106789190611d65565b905042816040015110156107205766071afd498d0007546040516331a9108f60e11b8152600481018790526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190611dc6565b66071afd498d00085490915061071a906001600160a01b031682856110a5565b5061078c565b66071afd498d000754604051631dd33fc560e31b815260048101879052602481018490526001600160a01b039091169063ee99fe2890604401600060405180830381600087803b15801561077357600080fd5b505af1158015610787573d6000803e3d6000fd5b505050505b8166038d7ea4c6800560008282546107a49190611e14565b9091555050505b9392505050565b66071afd498d00075460405163391044d760e21b8152600481018490526000916001600160a01b0316908290829063e441135c90602401602060405180830381865afa158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a9190611e2b565b9050600061083a838787856110fc565b6040516309bb79ed60e11b815260048101889052602481018290529091506000906001600160a01b03851690631376f3da90604401608060405180830381865afa15801561088c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b09190611e44565b90506108ea8160400151876108c59190611e14565b82602001516108d49190611eb6565b82516108e09190611f54565b600f0b60006111f2565b979650505050505050565b66071afd498d0009546001600160a01b0316331461091557610915611fa4565b61091d611209565b565b61091d610ab7565b6000610e106109368142611cf7565b6109409190611d19565b905090565b600080610e10806004546109599190611cf7565b6109639190611d19565b66071afd498d0007549091506107ab9084906001600160a01b031683611464565b66038d7ea4c680068166038d7ea4c6800081106109a057600080fd5b0154905081565b60058166038d7ea4c6800081106109a057600080fd5b66071afd498d0006546001600160a01b031633146109da57600080fd5b66071afd498d000980546001600160a01b0319166001600160a01b0392909216919091179055565b66071afd498d0006546001600160a01b03163314610a1f57600080fd5b6001600160a01b038116610a3257600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d9190611e2b565b9050610ab36001600160a01b03831633836110a5565b5050565b66071afd498d0007546001546001600160a01b03909116906000610e10610ade8142611cf7565b610ae89190611d19565b9050826001600160a01b031663c2c4c5c16040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b5050505060005b6014811015610c5057818311610c50576000610b5c8585611836565b60405163d1febfb960e01b8152600481018290529091506000906001600160a01b0387169063d1febfb990602401608060405180830381865afa158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb9190611e44565b905060008160400151861115610bed576040820151610bea9087611e14565b90505b610c0c818360200151610c009190611eb6565b83516108e09190611f54565b66038d7ea4c680068766038d7ea4c680008110610c2b57610c2b611d38565b0155505050610c3c610e1084611de3565b925080610c4881611dfb565b915050610b40565b505060015550565b60405163391044d760e21b8152600481018490526000908190819081906001600160a01b0387169063e441135c90602401602060405180830381865afa158015610ca6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cca9190611e2b565b60008054919250829003610ce55760009450505050506107ab565b60008881526002602052604081205490819003610d0f57610d08888a84866110fc565b9450610d21565b60008981526003602052604090205494505b84600003610d2e57600194505b6040516309bb79ed60e11b8152600481018a9052602481018690526000906001600160a01b038a1690631376f3da90604401608060405180830381865afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da19190611e44565b905081600003610de457610e10806001610e108460400151610dc39190611de3565b610dcd9190611e14565b610dd79190611cf7565b610de19190611d19565b91505b6004548210610dfc57600096505050505050506107ab565b82821015610e08578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b603281101561101a578984101561101a5782604001518410158015610e525750858811155b15610f1857610e62600189611de3565b975082915085881115610ea15760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611008565b6040516309bb79ed60e11b8152600481018d9052602481018990526001600160a01b038c1690631376f3da90604401608060405180830381865afa158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190611e44565b9250611008565b6000826040015185610f2a9190611e14565b9050600080846020015183610f3f9190611eb6565b8551610f4b9190611f54565b600f0b12610f76576020840151610f629083611eb6565b8451610f6e9190611f54565b600f0b610f79565b60005b905080158015610f885750878a115b15610f9457505061101a565b8015610ff75766038d7ea4c680068666038d7ea4c680008110610fb957610fb9611d38565b015460058766038d7ea4c680008110610fd457610fd4611d38565b0154610fe09083611d19565b610fea9190611cf7565b610ff4908a611de3565b98505b611003610e1087611de3565b955050505b8061101281611dfb565b915050610e2d565b5061102f8561102a60018a611e14565b61198b565b60008c8152600360209081526040808320849055600282529182902086905581518e8152908101899052908101829052606081018790529097507fcae2990aa9af8eb1c64713b7eddb3a80bf18e49a94a13fe0d0002b5d61d58f009060800160405180910390a150939998505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110f790849061199a565b505050565b60008082815b60808110156111e457818310156111e457600060026111218486611de3565b61112c906002611de3565b6111369190611cf7565b6040516309bb79ed60e11b8152600481018a9052602481018290529091506000906001600160a01b038b1690631376f3da90604401608060405180830381865afa158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190611e44565b9050878160400151116111c1578194506111cf565b6111cc600183611e14565b93505b505080806111dc90611dfb565b915050611102565b50909150505b949350505050565b60008183101561120257816107ab565b5090919050565b66071afd498d0008546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611258573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127c9190611e2b565b9050600066038d7ea4c6800554826112949190611e14565b66038d7ea4c6800583905560045490915060006112b18242611e14565b4260045590506000610e106112c68185611cf7565b6112d09190611d19565b90506000805b6014811015611422576112eb610e1084611de3565b915081421015611374578315801561130257508442145b1561133c578560058466038d7ea4c68000811061132157611321611d38565b0160008282546113319190611de3565b909155506114229050565b836113478642611e14565b6113519088611d19565b61135b9190611cf7565b60058466038d7ea4c68000811061132157611321611d38565b8315801561138157508482145b156113bb578560058466038d7ea4c6800081106113a0576113a0611d38565b0160008282546113b09190611de3565b909155506114099050565b836113c68684611e14565b6113d09088611d19565b6113da9190611cf7565b60058466038d7ea4c6800081106113f3576113f3611d38565b0160008282546114039190611de3565b90915550505b819450819250808061141a90611dfb565b9150506112d6565b5060408051428152602081018790527fce749457b74e10f393f2c6b1ce4261b78791376db5a3f501477a809f03f500d6910160405180910390a1505050505050565b60405163391044d760e21b8152600481018490526000908190819081906001600160a01b0387169063e441135c90602401602060405180830381865afa1580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d69190611e2b565b600080549192508290036114f15760009450505050506107ab565b6000888152600260205260408120549081900361151b57611514888a84866110fc565b945061152d565b60008981526003602052604090205494505b8460000361153a57600194505b6040516309bb79ed60e11b8152600481018a9052602481018690526000906001600160a01b038a1690631376f3da90604401608060405180830381865afa158015611589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ad9190611e44565b9050816000036115f057610e10806001610e1084604001516115cf9190611de3565b6115d99190611e14565b6115e39190611cf7565b6115ed9190611d19565b91505b600454821061160857600096505050505050506107ab565b82821015611614578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b60328110156118265789841015611826578260400151841015801561165e5750858811155b156117245761166e600189611de3565b9750829150858811156116ad5760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611814565b6040516309bb79ed60e11b8152600481018d9052602481018990526001600160a01b038c1690631376f3da90604401608060405180830381865afa1580156116f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171d9190611e44565b9250611814565b60008260400151856117369190611e14565b905060008084602001518361174b9190611eb6565b85516117579190611f54565b600f0b1261178257602084015161176e9083611eb6565b845161177a9190611f54565b600f0b611785565b60005b9050801580156117945750878a115b156117a0575050611826565b80156118035766038d7ea4c680068666038d7ea4c6800081106117c5576117c5611d38565b015460058766038d7ea4c6800081106117e0576117e0611d38565b01546117ec9083611d19565b6117f69190611cf7565b611800908a611de3565b98505b61180f610e1087611de3565b955050505b8061181e81611dfb565b915050611639565b50949a9950505050505050505050565b600080600090506000846001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a19190611e2b565b905060005b6080811015611981578183101561198157600060026118c58486611de3565b6118d0906002611de3565b6118da9190611cf7565b60405163d1febfb960e01b8152600481018290529091506000906001600160a01b0389169063d1febfb990602401608060405180830381865afa158015611925573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119499190611e44565b90508681604001511161195e5781945061196c565b611969600183611e14565b93505b5050808061197990611dfb565b9150506118a6565b5090949350505050565b600081831061120257816107ab565b60006119ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a719092919063ffffffff16565b8051909150156110f75780806020019051810190611a0d9190611fba565b6110f75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606111ea848460008585600080866001600160a01b03168587604051611a98919061200c565b60006040518083038185875af1925050503d8060008114611ad5576040519150601f19603f3d011682016040523d82523d6000602084013e611ada565b606091505b50915091506108ea8783838760608315611b55578251600003611b4e576001600160a01b0385163b611b4e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611a68565b50816111ea565b6111ea8383815115611b6a5781518083602001fd5b8060405162461bcd60e51b8152600401611a689190612028565b6001600160a01b0381168114611b9957600080fd5b50565b600060208284031215611bae57600080fd5b81356107ab81611b84565b600060208284031215611bcb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611c1157611c11611bd2565b604052919050565b60006020808385031215611c2c57600080fd5b823567ffffffffffffffff80821115611c4457600080fd5b818501915085601f830112611c5857600080fd5b813581811115611c6a57611c6a611bd2565b8060051b9150611c7b848301611be8565b8181529183018401918481019088841115611c9557600080fd5b938501935b83851015611cb357843582529385019390850190611c9a565b98975050505050505050565b60008060408385031215611cd257600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b600082611d1457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3357611d33611ce1565b500290565b634e487b7160e01b600052603260045260246000fd5b8051600f81900b8114611d6057600080fd5b919050565b600060608284031215611d7757600080fd5b6040516060810181811067ffffffffffffffff82111715611d9a57611d9a611bd2565b604052611da683611d4e565b815260208301516020820152604083015160408201528091505092915050565b600060208284031215611dd857600080fd5b81516107ab81611b84565b60008219821115611df657611df6611ce1565b500190565b600060018201611e0d57611e0d611ce1565b5060010190565b600082821015611e2657611e26611ce1565b500390565b600060208284031215611e3d57600080fd5b5051919050565b600060808284031215611e5657600080fd5b6040516080810181811067ffffffffffffffff82111715611e7957611e79611bd2565b604052611e8583611d4e565b8152611e9360208401611d4e565b602082015260408301516040820152606083015160608201528091505092915050565b600081600f0b83600f0b60016001607f1b03600082136000841383830485118282161615611ee657611ee6611ce1565b6f7fffffffffffffffffffffffffffffff196000851282811687830587121615611f1257611f12611ce1565b60008712925085820587128484161615611f2e57611f2e611ce1565b85850587128184161615611f4457611f44611ce1565b5050509290910295945050505050565b600081600f0b83600f0b600081128160016001607f1b031901831281151615611f7f57611f7f611ce1565b8160016001607f1b03018313811615611f9a57611f9a611ce1565b5090039392505050565b634e487b7160e01b600052600160045260246000fd5b600060208284031215611fcc57600080fd5b815180151581146107ab57600080fd5b60005b83811015611ff7578181015183820152602001611fdf565b83811115612006576000848401525b50505050565b6000825161201e818460208701611fdc565b9190910192915050565b6020815260008251806020840152612047816040850160208701611fdc565b601f01601f1916919091016040019291505056fea264697066735822122080ce930d4539cb0a569301c6e245467af304c563dfd074bf26e5fab3f94e31b664736f6c634300080d0033000000000000000000000000329d9ca4fad82d10f128050535c138d3bd83e397
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80638da5cb5b116100b8578063d4dafba81161007c578063d4dafba814610297578063dfe05031146102aa578063edf59997146102c3578063f2c098b7146102d6578063f4f3b200146102e9578063fc0c546a146102fc57600080fd5b80638da5cb5b1461022a578063b21ed5021461025b578063b80777ea14610263578063c7c4ff461461026b578063d1d58b251461028457600080fd5b8063379607f51161010a578063379607f5146101ca578063486d25fe146101dd57806368809889146101fd5780637f58e8f814610210578063811a40fe14610219578063834ee4171461022157600080fd5b8063127dcbd31461014757806313af40351461016357806316aea5c0146101785780631f1db0431461019857806322b04bfc146101bb575b600080fd5b61015060015481565b6040519081526020015b60405180910390f35b610176610171366004611b9c565b610315565b005b610150610186366004611bb9565b60036020526000908152604090205481565b6101ab6101a6366004611c19565b61035a565b604051901515815260200161015a565b61015066038d7ea4c680055481565b6101506101d8366004611bb9565b6105ab565b6101506101eb366004611bb9565b60026020526000908152604090205481565b61015061020b366004611cbf565b6107b2565b61015060045481565b6101766108f5565b61015060005481565b66071afd498d000654610243906001600160a01b031681565b6040516001600160a01b03909116815260200161015a565b61017661091f565b610150610927565b66071afd498d000954610243906001600160a01b031681565b610150610292366004611bb9565b610945565b6101506102a5366004611bb9565b610984565b66071afd498d000754610243906001600160a01b031681565b6101506102d1366004611bb9565b6109a7565b6101766102e4366004611b9c565b6109bd565b6101766102f7366004611b9c565b610a02565b66071afd498d000854610243906001600160a01b031681565b66071afd498d0006546001600160a01b0316331461033257600080fd5b66071afd498d000680546001600160a01b0319166001600160a01b0392909216919091179055565b6000600154421061036d5761036d610ab7565b600454610e1061037d8183611cf7565b6103879190611d19565b66071afd498d0007549091506001600160a01b03166000805b855181101561057b5760008682815181106103bd576103bd611d38565b60200260200101519050806000036103d5575061057b565b60006103e2828688610c58565b9050801561056657604051635a2d1e0760e11b8152600481018390526000906001600160a01b0387169063b45a3c0e90602401606060405180830381865afa158015610432573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104569190611d65565b905042816040015110156104f6576040516331a9108f60e11b8152600481018490526000906001600160a01b03881690636352211e90602401602060405180830381865afa1580156104ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d09190611dc6565b66071afd498d0008549091506104f0906001600160a01b031682856110a5565b50610558565b604051631dd33fc560e31b815260048101849052602481018390526001600160a01b0387169063ee99fe2890604401600060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b505050505b6105628286611de3565b9450505b5050808061057390611dfb565b9150506103a0565b5080156105a0578066038d7ea4c68005600082825461059a9190611e14565b90915550505b506001949350505050565b600060015442106105be576105be610ab7565b600454610e106105ce8183611cf7565b6105d89190611d19565b66071afd498d0007549091506000906105fc9085906001600160a01b031684610c58565b905080156107ab5766071afd498d000754604051635a2d1e0760e11b8152600481018690526000916001600160a01b03169063b45a3c0e90602401606060405180830381865afa158015610654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106789190611d65565b905042816040015110156107205766071afd498d0007546040516331a9108f60e11b8152600481018790526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190611dc6565b66071afd498d00085490915061071a906001600160a01b031682856110a5565b5061078c565b66071afd498d000754604051631dd33fc560e31b815260048101879052602481018490526001600160a01b039091169063ee99fe2890604401600060405180830381600087803b15801561077357600080fd5b505af1158015610787573d6000803e3d6000fd5b505050505b8166038d7ea4c6800560008282546107a49190611e14565b9091555050505b9392505050565b66071afd498d00075460405163391044d760e21b8152600481018490526000916001600160a01b0316908290829063e441135c90602401602060405180830381865afa158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a9190611e2b565b9050600061083a838787856110fc565b6040516309bb79ed60e11b815260048101889052602481018290529091506000906001600160a01b03851690631376f3da90604401608060405180830381865afa15801561088c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b09190611e44565b90506108ea8160400151876108c59190611e14565b82602001516108d49190611eb6565b82516108e09190611f54565b600f0b60006111f2565b979650505050505050565b66071afd498d0009546001600160a01b0316331461091557610915611fa4565b61091d611209565b565b61091d610ab7565b6000610e106109368142611cf7565b6109409190611d19565b905090565b600080610e10806004546109599190611cf7565b6109639190611d19565b66071afd498d0007549091506107ab9084906001600160a01b031683611464565b66038d7ea4c680068166038d7ea4c6800081106109a057600080fd5b0154905081565b60058166038d7ea4c6800081106109a057600080fd5b66071afd498d0006546001600160a01b031633146109da57600080fd5b66071afd498d000980546001600160a01b0319166001600160a01b0392909216919091179055565b66071afd498d0006546001600160a01b03163314610a1f57600080fd5b6001600160a01b038116610a3257600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d9190611e2b565b9050610ab36001600160a01b03831633836110a5565b5050565b66071afd498d0007546001546001600160a01b03909116906000610e10610ade8142611cf7565b610ae89190611d19565b9050826001600160a01b031663c2c4c5c16040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b5050505060005b6014811015610c5057818311610c50576000610b5c8585611836565b60405163d1febfb960e01b8152600481018290529091506000906001600160a01b0387169063d1febfb990602401608060405180830381865afa158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb9190611e44565b905060008160400151861115610bed576040820151610bea9087611e14565b90505b610c0c818360200151610c009190611eb6565b83516108e09190611f54565b66038d7ea4c680068766038d7ea4c680008110610c2b57610c2b611d38565b0155505050610c3c610e1084611de3565b925080610c4881611dfb565b915050610b40565b505060015550565b60405163391044d760e21b8152600481018490526000908190819081906001600160a01b0387169063e441135c90602401602060405180830381865afa158015610ca6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cca9190611e2b565b60008054919250829003610ce55760009450505050506107ab565b60008881526002602052604081205490819003610d0f57610d08888a84866110fc565b9450610d21565b60008981526003602052604090205494505b84600003610d2e57600194505b6040516309bb79ed60e11b8152600481018a9052602481018690526000906001600160a01b038a1690631376f3da90604401608060405180830381865afa158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da19190611e44565b905081600003610de457610e10806001610e108460400151610dc39190611de3565b610dcd9190611e14565b610dd79190611cf7565b610de19190611d19565b91505b6004548210610dfc57600096505050505050506107ab565b82821015610e08578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b603281101561101a578984101561101a5782604001518410158015610e525750858811155b15610f1857610e62600189611de3565b975082915085881115610ea15760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611008565b6040516309bb79ed60e11b8152600481018d9052602481018990526001600160a01b038c1690631376f3da90604401608060405180830381865afa158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190611e44565b9250611008565b6000826040015185610f2a9190611e14565b9050600080846020015183610f3f9190611eb6565b8551610f4b9190611f54565b600f0b12610f76576020840151610f629083611eb6565b8451610f6e9190611f54565b600f0b610f79565b60005b905080158015610f885750878a115b15610f9457505061101a565b8015610ff75766038d7ea4c680068666038d7ea4c680008110610fb957610fb9611d38565b015460058766038d7ea4c680008110610fd457610fd4611d38565b0154610fe09083611d19565b610fea9190611cf7565b610ff4908a611de3565b98505b611003610e1087611de3565b955050505b8061101281611dfb565b915050610e2d565b5061102f8561102a60018a611e14565b61198b565b60008c8152600360209081526040808320849055600282529182902086905581518e8152908101899052908101829052606081018790529097507fcae2990aa9af8eb1c64713b7eddb3a80bf18e49a94a13fe0d0002b5d61d58f009060800160405180910390a150939998505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110f790849061199a565b505050565b60008082815b60808110156111e457818310156111e457600060026111218486611de3565b61112c906002611de3565b6111369190611cf7565b6040516309bb79ed60e11b8152600481018a9052602481018290529091506000906001600160a01b038b1690631376f3da90604401608060405180830381865afa158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190611e44565b9050878160400151116111c1578194506111cf565b6111cc600183611e14565b93505b505080806111dc90611dfb565b915050611102565b50909150505b949350505050565b60008183101561120257816107ab565b5090919050565b66071afd498d0008546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611258573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127c9190611e2b565b9050600066038d7ea4c6800554826112949190611e14565b66038d7ea4c6800583905560045490915060006112b18242611e14565b4260045590506000610e106112c68185611cf7565b6112d09190611d19565b90506000805b6014811015611422576112eb610e1084611de3565b915081421015611374578315801561130257508442145b1561133c578560058466038d7ea4c68000811061132157611321611d38565b0160008282546113319190611de3565b909155506114229050565b836113478642611e14565b6113519088611d19565b61135b9190611cf7565b60058466038d7ea4c68000811061132157611321611d38565b8315801561138157508482145b156113bb578560058466038d7ea4c6800081106113a0576113a0611d38565b0160008282546113b09190611de3565b909155506114099050565b836113c68684611e14565b6113d09088611d19565b6113da9190611cf7565b60058466038d7ea4c6800081106113f3576113f3611d38565b0160008282546114039190611de3565b90915550505b819450819250808061141a90611dfb565b9150506112d6565b5060408051428152602081018790527fce749457b74e10f393f2c6b1ce4261b78791376db5a3f501477a809f03f500d6910160405180910390a1505050505050565b60405163391044d760e21b8152600481018490526000908190819081906001600160a01b0387169063e441135c90602401602060405180830381865afa1580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d69190611e2b565b600080549192508290036114f15760009450505050506107ab565b6000888152600260205260408120549081900361151b57611514888a84866110fc565b945061152d565b60008981526003602052604090205494505b8460000361153a57600194505b6040516309bb79ed60e11b8152600481018a9052602481018690526000906001600160a01b038a1690631376f3da90604401608060405180830381865afa158015611589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ad9190611e44565b9050816000036115f057610e10806001610e1084604001516115cf9190611de3565b6115d99190611e14565b6115e39190611cf7565b6115ed9190611d19565b91505b600454821061160857600096505050505050506107ab565b82821015611614578291505b6040805160808101825260008082526020820181905291810182905260608101829052905b60328110156118265789841015611826578260400151841015801561165e5750858811155b156117245761166e600189611de3565b9750829150858811156116ad5760405180608001604052806000600f0b81526020016000600f0b81526020016000815260200160008152509250611814565b6040516309bb79ed60e11b8152600481018d9052602481018990526001600160a01b038c1690631376f3da90604401608060405180830381865afa1580156116f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171d9190611e44565b9250611814565b60008260400151856117369190611e14565b905060008084602001518361174b9190611eb6565b85516117579190611f54565b600f0b1261178257602084015161176e9083611eb6565b845161177a9190611f54565b600f0b611785565b60005b9050801580156117945750878a115b156117a0575050611826565b80156118035766038d7ea4c680068666038d7ea4c6800081106117c5576117c5611d38565b015460058766038d7ea4c6800081106117e0576117e0611d38565b01546117ec9083611d19565b6117f69190611cf7565b611800908a611de3565b98505b61180f610e1087611de3565b955050505b8061181e81611dfb565b915050611639565b50949a9950505050505050505050565b600080600090506000846001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a19190611e2b565b905060005b6080811015611981578183101561198157600060026118c58486611de3565b6118d0906002611de3565b6118da9190611cf7565b60405163d1febfb960e01b8152600481018290529091506000906001600160a01b0389169063d1febfb990602401608060405180830381865afa158015611925573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119499190611e44565b90508681604001511161195e5781945061196c565b611969600183611e14565b93505b5050808061197990611dfb565b9150506118a6565b5090949350505050565b600081831061120257816107ab565b60006119ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a719092919063ffffffff16565b8051909150156110f75780806020019051810190611a0d9190611fba565b6110f75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606111ea848460008585600080866001600160a01b03168587604051611a98919061200c565b60006040518083038185875af1925050503d8060008114611ad5576040519150601f19603f3d011682016040523d82523d6000602084013e611ada565b606091505b50915091506108ea8783838760608315611b55578251600003611b4e576001600160a01b0385163b611b4e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611a68565b50816111ea565b6111ea8383815115611b6a5781518083602001fd5b8060405162461bcd60e51b8152600401611a689190612028565b6001600160a01b0381168114611b9957600080fd5b50565b600060208284031215611bae57600080fd5b81356107ab81611b84565b600060208284031215611bcb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611c1157611c11611bd2565b604052919050565b60006020808385031215611c2c57600080fd5b823567ffffffffffffffff80821115611c4457600080fd5b818501915085601f830112611c5857600080fd5b813581811115611c6a57611c6a611bd2565b8060051b9150611c7b848301611be8565b8181529183018401918481019088841115611c9557600080fd5b938501935b83851015611cb357843582529385019390850190611c9a565b98975050505050505050565b60008060408385031215611cd257600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b600082611d1457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3357611d33611ce1565b500290565b634e487b7160e01b600052603260045260246000fd5b8051600f81900b8114611d6057600080fd5b919050565b600060608284031215611d7757600080fd5b6040516060810181811067ffffffffffffffff82111715611d9a57611d9a611bd2565b604052611da683611d4e565b815260208301516020820152604083015160408201528091505092915050565b600060208284031215611dd857600080fd5b81516107ab81611b84565b60008219821115611df657611df6611ce1565b500190565b600060018201611e0d57611e0d611ce1565b5060010190565b600082821015611e2657611e26611ce1565b500390565b600060208284031215611e3d57600080fd5b5051919050565b600060808284031215611e5657600080fd5b6040516080810181811067ffffffffffffffff82111715611e7957611e79611bd2565b604052611e8583611d4e565b8152611e9360208401611d4e565b602082015260408301516040820152606083015160608201528091505092915050565b600081600f0b83600f0b60016001607f1b03600082136000841383830485118282161615611ee657611ee6611ce1565b6f7fffffffffffffffffffffffffffffff196000851282811687830587121615611f1257611f12611ce1565b60008712925085820587128484161615611f2e57611f2e611ce1565b85850587128184161615611f4457611f44611ce1565b5050509290910295945050505050565b600081600f0b83600f0b600081128160016001607f1b031901831281151615611f7f57611f7f611ce1565b8160016001607f1b03018313811615611f9a57611f9a611ce1565b5090039392505050565b634e487b7160e01b600052600160045260246000fd5b600060208284031215611fcc57600080fd5b815180151581146107ab57600080fd5b60005b83811015611ff7578181015183820152602001611fdf565b83811115612006576000848401525b50505050565b6000825161201e818460208701611fdc565b9190910192915050565b6020815260008251806020840152612047816040850160208701611fdc565b601f01601f1916919091016040019291505056fea264697066735822122080ce930d4539cb0a569301c6e245467af304c563dfd074bf26e5fab3f94e31b664736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000329d9ca4fad82d10f128050535c138d3bd83e397
-----Decoded View---------------
Arg [0] : _voting_escrow (address): 0x329D9cA4FAd82D10f128050535c138D3bd83E397
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000329d9ca4fad82d10f128050535c138d3bd83e397
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.