Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
- | 12430748 | 1409 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xeB1C3B2C...61A96Ddcf The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
TreasuryVester
Compiler Version
v0.7.4+commit.3f05b770
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-05-10 */ /** *Submitted for verification at Etherscan.io on 2021-04-22 */ // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ 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) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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) { // 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) { 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) { 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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @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. 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) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); 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) { require(b > 0, "SafeMath: modulo by zero"); 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) { 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. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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) { 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) { require(b > 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); } // File: contracts/TreasuryVester.sol pragma solidity >=0.6.0 <0.8.0; contract TreasuryVester { using SafeMath for uint; address public yfx; address public recipient; uint256 public vestingAmount; uint256 public vestingBegin; uint256 public vestingCliff; uint256 public vestingEnd; uint256 public lastUpdate; constructor( address _yfx, address _recipient, uint256 _vestingAmount, uint256 _vestingBegin, uint256 _vestingCliff, uint256 _vestingEnd ) { require(_vestingAmount > 0, "vesting amount is zero"); require(_vestingBegin >= block.timestamp, "vesting begin too early"); require(_vestingCliff >= _vestingBegin, "cliff is too early"); require(_vestingEnd > _vestingCliff, "end is too early"); yfx = _yfx; recipient = _recipient; vestingAmount = _vestingAmount; vestingBegin = _vestingBegin; vestingCliff = _vestingCliff; vestingEnd = _vestingEnd; lastUpdate = vestingBegin; } function setRecipient(address _recipient) external { require(msg.sender == recipient, "unauthorized"); recipient = _recipient; } function vested() public view returns(uint256) { if( block.timestamp < vestingCliff) { return 0; } if (block.timestamp >= vestingEnd) { return IERC20(yfx).balanceOf(address(this)); } else { return vestingAmount.mul(block.timestamp - lastUpdate).div(vestingEnd.sub(vestingBegin)); } } function claim() external { require(block.timestamp >= vestingCliff, "not time yet"); uint256 amount = vested(); if (amount > 0) { lastUpdate = block.timestamp; IERC20(yfx).transfer(recipient, amount); } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_yfx","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":"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":"vested","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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"},{"inputs":[],"name":"yfx","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061009d5760003560e01c806384a1931f1161006657806384a1931f14610176578063c046371114610194578063e29bc68b146101b2578063f3640e74146101d0578063fea5657c146101ee5761009d565b8062728f76146100a25780633bbed4a0146100c05780634e71d92d14610104578063642daec01461010e57806366d003ac14610142575b600080fd5b6100aa61020c565b6040518082815260200191505060405180910390f35b610102600480360360208110156100d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610212565b005b61010c610319565b005b6101166104a0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61014a6104c4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61017e6104ea565b6040518082815260200191505060405180910390f35b61019c6104f0565b6040518082815260200191505060405180910390f35b6101ba6104f6565b6040518082815260200191505060405180910390f35b6101d86104fc565b6040518082815260200191505060405180910390f35b6101f6610502565b6040518082815260200191505060405180910390f35b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f756e617574686f72697a6564000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600454421015610391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f6e6f742074696d6520796574000000000000000000000000000000000000000081525060200191505060405180910390fd5b600061039b610502565b9050600081111561049d574260068190555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561046057600080fd5b505af1158015610474573d6000803e3d6000fd5b505050506040513d602081101561048a57600080fd5b8101908080519060200190929190505050505b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60065481565b60035481565b60045481565b6000600454421015610517576000905061062d565b60055442106105e95760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156105a757600080fd5b505afa1580156105bb573d6000803e3d6000fd5b505050506040513d60208110156105d157600080fd5b8101908080519060200190929190505050905061062d565b61062a61060360035460055461063090919063ffffffff16565b61061c60065442036002546106b390919063ffffffff16565b61073990919063ffffffff16565b90505b90565b6000828211156106a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b6000808314156106c65760009050610733565b60008284029050828482816106d757fe5b041461072e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806107c36021913960400191505060405180910390fd5b809150505b92915050565b60008082116107b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b8183816107b957fe5b0490509291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212205eb1d3c0204a1a772525f650f3465a43c162f2a7a064ca7565246af6469cfafa64736f6c63430007040033
Deployed Bytecode Sourcemap
10453:1864:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10574:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;11491:151;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;12040:274;;;:::i;:::-;;10516:18;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;10541:24;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;10677:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;10711;;;:::i;:::-;;;;;;;;;;;;;;;;;;;10609:27;;;:::i;:::-;;;;;;;;;;;;;;;;;;;10643;;;:::i;:::-;;;;;;;;;;;;;;;;;;;11650:382;;;:::i;:::-;;;;;;;;;;;;;;;;;;;10574:28;;;;:::o;11491:151::-;11575:9;;;;;;;;;;;11561:23;;:10;:23;;;11553:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11624:10;11612:9;;:22;;;;;;;;;;;;;;;;;;11491:151;:::o;12040:274::-;12104:12;;12085:15;:31;;12077:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12144:14;12161:8;:6;:8::i;:::-;12144:25;;12195:1;12186:6;:10;12182:125;;;12226:15;12213:10;:28;;;;12263:3;;;;;;;;;;12256:20;;;12277:9;;;;;;;;;;;12288:6;12256:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12182:125;12040:274;:::o;10516:18::-;;;;;;;;;;;;:::o;10541:24::-;;;;;;;;;;;;;:::o;10677:25::-;;;;:::o;10711:::-;;;;:::o;10609:27::-;;;;:::o;10643:::-;;;;:::o;11650:382::-;11688:7;11730:12;;11712:15;:30;11708:71;;;11766:1;11759:8;;;;11708:71;11822:10;;11803:15;:29;11799:226;;11863:3;;;;;;;;;;11856:21;;;11886:4;11856:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11849:43;;;;11799:226;11932:81;11984:28;11999:12;;11984:10;;:14;;:28;;;;:::i;:::-;11932:47;11968:10;;11950:15;:28;11932:13;;:17;;:47;;;;:::i;:::-;:51;;:81;;;;:::i;:::-;11925:88;;11650:382;;:::o;3361:158::-;3419:7;3452:1;3447;:6;;3439:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3510:1;3506;:5;3499:12;;3361:158;;;;:::o;3778:220::-;3836:7;3865:1;3860;:6;3856:20;;;3875:1;3868:8;;;;3856:20;3887:9;3903:1;3899;:5;3887:17;;3932:1;3927;3923;:5;;;;;;:10;3915:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3989:1;3982:8;;;3778:220;;;;;:::o;4476:153::-;4534:7;4566:1;4562;:5;4554:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4620:1;4616;:5;;;;;;4609:12;;4476:153;;;;:::o
Swarm Source
ipfs://5eb1d3c0204a1a772525f650f3465a43c162f2a7a064ca7565246af6469cfafa
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.