Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
15941246 | 703 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
Vesting
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract Vesting { using SafeMath for uint256; address public magic; address public recipient; uint256 public vestingAmount; uint256 public vestingBegin; uint256 public vestingCliff; uint256 public vestingEnd; uint256 public lastUpdate; constructor( address magic_, address recipient_, uint256 vestingAmount_, uint256 vestingBegin_, uint256 vestingCliff_, uint256 vestingEnd_ ) public { require( vestingCliff_ >= vestingBegin_, 'TreasuryVester.constructor: cliff is too early' ); require( vestingEnd_ > vestingCliff_, 'TreasuryVester.constructor: end is too early' ); magic = magic_; recipient = recipient_; vestingAmount = vestingAmount_; vestingBegin = vestingBegin_; vestingCliff = vestingCliff_; vestingEnd = vestingEnd_; lastUpdate = vestingBegin; } function setRecipient(address recipient_) public { require( msg.sender == recipient, 'TreasuryVester.setRecipient: unauthorized' ); recipient = recipient_; } function claim() public { require( block.timestamp >= vestingCliff, 'TreasuryVester.claim: not time yet' ); uint256 amount; if (block.timestamp >= vestingEnd) { amount = IERC20(magic).balanceOf(address(this)); } else { amount = vestingAmount.mul(block.timestamp.sub(lastUpdate)).div( vestingEnd.sub(vestingBegin) ); lastUpdate = block.timestamp; } IERC20(magic).transfer(recipient, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// 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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"magic_","type":"address"},{"internalType":"address","name":"recipient_","type":"address"},{"internalType":"uint256","name":"vestingAmount_","type":"uint256"},{"internalType":"uint256","name":"vestingBegin_","type":"uint256"},{"internalType":"uint256","name":"vestingCliff_","type":"uint256"},{"internalType":"uint256","name":"vestingEnd_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"magic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient_","type":"address"}],"name":"setRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingBegin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingCliff","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161068438038061068483398101604081905261002f91610167565b8282101561009b5760405162461bcd60e51b815260206004820152602e60248201527f54726561737572795665737465722e636f6e7374727563746f723a20636c696660448201526d6620697320746f6f206561726c7960901b60648201526084015b60405180910390fd5b8181116100ff5760405162461bcd60e51b815260206004820152602c60248201527f54726561737572795665737465722e636f6e7374727563746f723a20656e642060448201526b697320746f6f206561726c7960a01b6064820152608401610092565b600080546001600160a01b039788166001600160a01b031991821617909155600180549690971695169490941790945560029190915560038190556004929092556005556006556101bf565b80516001600160a01b038116811461016257600080fd5b919050565b60008060008060008060c0878903121561018057600080fd5b6101898761014b565b95506101976020880161014b565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b6104b6806101ce6000396000f3fe608060405234801561001057600080fd5b50600436106100925760003560e01c806366d003ac1161006657806366d003ac146100fb57806384a1931f1461010e578063c046371114610117578063e29bc68b14610120578063f3640e741461012957600080fd5b8062728f76146100975780630d854646146100b35780633bbed4a0146100de5780634e71d92d146100f3575b600080fd5b6100a060025481565b6040519081526020015b60405180910390f35b6000546100c6906001600160a01b031681565b6040516001600160a01b0390911681526020016100aa565b6100f16100ec3660046103ae565b610132565b005b6100f16101c5565b6001546100c6906001600160a01b031681565b6100a060055481565b6100a060065481565b6100a060035481565b6100a060045481565b6001546001600160a01b031633146101a35760405162461bcd60e51b815260206004820152602960248201527f54726561737572795665737465722e736574526563697069656e743a20756e616044820152681d5d1a1bdc9a5e995960ba1b60648201526084015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6004544210156102225760405162461bcd60e51b815260206004820152602260248201527f54726561737572795665737465722e636c61696d3a206e6f742074696d652079604482015261195d60f21b606482015260840161019a565b600060055442106102af576000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561027057600080fd5b505afa158015610284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a891906103d7565b90506102f7565b6102f06102c960035460055461038390919063ffffffff16565b6102ea6102e16006544261038390919063ffffffff16565b60025490610396565b906103a2565b4260065590505b60005460015460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b15801561034757600080fd5b505af115801561035b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037f91906103f0565b5050565b600061038f8284610428565b9392505050565b600061038f828461043f565b600061038f828461045e565b6000602082840312156103c057600080fd5b81356001600160a01b038116811461038f57600080fd5b6000602082840312156103e957600080fd5b5051919050565b60006020828403121561040257600080fd5b8151801515811461038f57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561043a5761043a610412565b500390565b600081600019048311821515161561045957610459610412565b500290565b60008261047b57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220c84c29c8401b19232a87de2bbfbb628e8aa938194d8cb8e03b2bf6d8cf4723e264736f6c63430008090033000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a00000000000000000000000070044278d556b0c962224e095397a52287c99cb5000000000000000000000000000000000000000000014ff21d5e27fa5b8c0000000000000000000000000000000000000000000000000000000000006519978000000000000000000000000000000000000000000000000000000000651997800000000000000000000000000000000000000000000000000000000068dd5000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100925760003560e01c806366d003ac1161006657806366d003ac146100fb57806384a1931f1461010e578063c046371114610117578063e29bc68b14610120578063f3640e741461012957600080fd5b8062728f76146100975780630d854646146100b35780633bbed4a0146100de5780634e71d92d146100f3575b600080fd5b6100a060025481565b6040519081526020015b60405180910390f35b6000546100c6906001600160a01b031681565b6040516001600160a01b0390911681526020016100aa565b6100f16100ec3660046103ae565b610132565b005b6100f16101c5565b6001546100c6906001600160a01b031681565b6100a060055481565b6100a060065481565b6100a060035481565b6100a060045481565b6001546001600160a01b031633146101a35760405162461bcd60e51b815260206004820152602960248201527f54726561737572795665737465722e736574526563697069656e743a20756e616044820152681d5d1a1bdc9a5e995960ba1b60648201526084015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6004544210156102225760405162461bcd60e51b815260206004820152602260248201527f54726561737572795665737465722e636c61696d3a206e6f742074696d652079604482015261195d60f21b606482015260840161019a565b600060055442106102af576000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561027057600080fd5b505afa158015610284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a891906103d7565b90506102f7565b6102f06102c960035460055461038390919063ffffffff16565b6102ea6102e16006544261038390919063ffffffff16565b60025490610396565b906103a2565b4260065590505b60005460015460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b15801561034757600080fd5b505af115801561035b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037f91906103f0565b5050565b600061038f8284610428565b9392505050565b600061038f828461043f565b600061038f828461045e565b6000602082840312156103c057600080fd5b81356001600160a01b038116811461038f57600080fd5b6000602082840312156103e957600080fd5b5051919050565b60006020828403121561040257600080fd5b8151801515811461038f57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561043a5761043a610412565b500390565b600081600019048311821515161561045957610459610412565b500290565b60008261047b57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220c84c29c8401b19232a87de2bbfbb628e8aa938194d8cb8e03b2bf6d8cf4723e264736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a00000000000000000000000070044278d556b0c962224e095397a52287c99cb5000000000000000000000000000000000000000000014ff21d5e27fa5b8c0000000000000000000000000000000000000000000000000000000000006519978000000000000000000000000000000000000000000000000000000000651997800000000000000000000000000000000000000000000000000000000068dd5000
-----Decoded View---------------
Arg [0] : magic_ (address): 0xB0c7a3Ba49C7a6EaBa6cD4a96C55a1391070Ac9A
Arg [1] : recipient_ (address): 0x70044278D556B0C962224e095397A52287C99cB5
Arg [2] : vestingAmount_ (uint256): 1586459000000000000000000
Arg [3] : vestingBegin_ (uint256): 1696176000
Arg [4] : vestingCliff_ (uint256): 1696176000
Arg [5] : vestingEnd_ (uint256): 1759334400
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a
Arg [1] : 00000000000000000000000070044278d556b0c962224e095397a52287c99cb5
Arg [2] : 000000000000000000000000000000000000000000014ff21d5e27fa5b8c0000
Arg [3] : 0000000000000000000000000000000000000000000000000000000065199780
Arg [4] : 0000000000000000000000000000000000000000000000000000000065199780
Arg [5] : 0000000000000000000000000000000000000000000000000000000068dd5000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.360366 | 794,235.3797 | $286,215.63 |
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.