ETH Price: $3,758.62 (-2.09%)
Gas: 14 Gwei

Token

 

Overview

Max Total Supply

0

Holders

0

Total Transfers

-

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
TreasuryVester

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at Etherscan.io on 2021-08-03
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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;
    }
}


contract TreasuryVester {
    using SafeMath for uint;

    address public dvf;
    address public recipient;

    uint public vestingAmount;
    uint public vestingBegin;
    uint public vestingCliff;
    uint public vestingEnd;

    uint public lastUpdate;

    constructor(
        address dvf_,
        address recipient_,
        uint vestingAmount_,
        uint vestingBegin_,
        uint vestingCliff_,
        uint vestingEnd_
    ) public {
        require(vestingBegin_ >= block.timestamp, 'TreasuryVester::constructor: vesting begin too early');
        require(vestingCliff_ >= vestingBegin_, 'TreasuryVester::constructor: cliff is too early');
        require(vestingEnd_ > vestingCliff_, 'TreasuryVester::constructor: end is too early');

        dvf = dvf_;
        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');
        uint amount;
        if (block.timestamp >= vestingEnd) {
            amount = IDvf(dvf).balanceOf(address(this));
        } else {
            amount = vestingAmount.mul(block.timestamp - lastUpdate).div(vestingEnd - vestingBegin);
            lastUpdate = block.timestamp;
        }
        IDvf(dvf).transfer(recipient, amount);
    }
}

interface IDvf {
    function balanceOf(address account) external view returns (uint);
    function transfer(address dst, uint rawAmount) external returns (bool);
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"dvf_","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":"dvf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"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"}]

608060405234801561001057600080fd5b506040516107ea3803806107ea833981810160405260c081101561003357600080fd5b508051602082015160408301516060840151608085015160a0909501519394929391929091428310156100975760405162461bcd60e51b815260040180806020018281038252603481526020018061075a6034913960400191505060405180910390fd5b828210156100d65760405162461bcd60e51b815260040180806020018281038252602f81526020018061078e602f913960400191505060405180910390fd5b8181116101145760405162461bcd60e51b815260040180806020018281038252602d8152602001806107bd602d913960400191505060405180910390fd5b600080546001600160a01b039788166001600160a01b031991821617909155600180549690971695169490941790945560029190915560038190556004929092556005556006556105f08061016a6000396000f3fe608060405234801561001057600080fd5b50600436106100a25760003560e01c806366d003ac11610076578063c04637111161005b578063c04637111461013f578063e29bc68b14610147578063f3640e741461014f576100a2565b806366d003ac1461012f57806384a1931f14610137576100a2565b8062728f76146100a7578063356f56d4146100c15780633bbed4a0146100f25780634e71d92d14610127575b600080fd5b6100af610157565b60408051918252519081900360200190f35b6100c961015d565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101256004803603602081101561010857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610179565b005b610125610230565b6100c961041b565b6100af610437565b6100af61043d565b6100af610443565b6100af610449565b60025481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1633146101e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061054d602a913960400191505060405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60045442101561028b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806105986023913960400191505060405180910390fd5b6000600554421061033a57600054604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d602081101561033157600080fd5b5051905061036a565b6103636003546005540361035d600654420360025461044f90919063ffffffff16565b906104cb565b4260065590505b60008054600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b1580156103ec57600080fd5b505af1158015610400573d6000803e3d6000fd5b505050506040513d602081101561041657600080fd5b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60065481565b60035481565b60045481565b60008261045e575060006104c5565b8282028284828161046b57fe5b04146104c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806105776021913960400191505060405180910390fd5b90505b92915050565b600080821161053b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161054457fe5b04939250505056fe54726561737572795665737465723a3a736574526563697069656e743a20756e617574686f72697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754726561737572795665737465723a3a636c61696d3a206e6f742074696d6520796574a26469706673582212200130c44821e6623ae4a3a85e5b7cf18c3af66110298494a6d6da7c2dcabf55c264736f6c634300060c003354726561737572795665737465723a3a636f6e7374727563746f723a2076657374696e6720626567696e20746f6f206561726c7954726561737572795665737465723a3a636f6e7374727563746f723a20636c69666620697320746f6f206561726c7954726561737572795665737465723a3a636f6e7374727563746f723a20656e6420697320746f6f206561726c79000000000000000000000000dddddd4301a082e62e84e43f474f0444239219180000000000000000000000004788aa3becbf5f7c9fd058372b4a3fc7c75df20100000000000000000000000000000000000000000022e1239930535fe74c000000000000000000000000000000000000000000000000000000000000612ec28000000000000000000000000000000000000000000000000000000000612ec28000000000000000000000000000000000000000000000000000000000665a647f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a25760003560e01c806366d003ac11610076578063c04637111161005b578063c04637111461013f578063e29bc68b14610147578063f3640e741461014f576100a2565b806366d003ac1461012f57806384a1931f14610137576100a2565b8062728f76146100a7578063356f56d4146100c15780633bbed4a0146100f25780634e71d92d14610127575b600080fd5b6100af610157565b60408051918252519081900360200190f35b6100c961015d565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101256004803603602081101561010857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610179565b005b610125610230565b6100c961041b565b6100af610437565b6100af61043d565b6100af610443565b6100af610449565b60025481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1633146101e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061054d602a913960400191505060405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60045442101561028b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806105986023913960400191505060405180910390fd5b6000600554421061033a57600054604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d602081101561033157600080fd5b5051905061036a565b6103636003546005540361035d600654420360025461044f90919063ffffffff16565b906104cb565b4260065590505b60008054600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b1580156103ec57600080fd5b505af1158015610400573d6000803e3d6000fd5b505050506040513d602081101561041657600080fd5b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60065481565b60035481565b60045481565b60008261045e575060006104c5565b8282028284828161046b57fe5b04146104c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806105776021913960400191505060405180910390fd5b90505b92915050565b600080821161053b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161054457fe5b04939250505056fe54726561737572795665737465723a3a736574526563697069656e743a20756e617574686f72697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754726561737572795665737465723a3a636c61696d3a206e6f742074696d6520796574a26469706673582212200130c44821e6623ae4a3a85e5b7cf18c3af66110298494a6d6da7c2dcabf55c264736f6c634300060c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000dddddd4301a082e62e84e43f474f0444239219180000000000000000000000004788aa3becbf5f7c9fd058372b4a3fc7c75df20100000000000000000000000000000000000000000022e1239930535fe74c000000000000000000000000000000000000000000000000000000000000612ec28000000000000000000000000000000000000000000000000000000000612ec28000000000000000000000000000000000000000000000000000000000665a647f

-----Decoded View---------------
Arg [0] : dvf_ (address): 0xDDdddd4301A082e62E84e43F474f044423921918
Arg [1] : recipient_ (address): 0x4788Aa3bECBf5f7c9Fd058372b4a3FC7C75DF201
Arg [2] : vestingAmount_ (uint256): 42166667000000000000000000
Arg [3] : vestingBegin_ (uint256): 1630454400
Arg [4] : vestingCliff_ (uint256): 1630454400
Arg [5] : vestingEnd_ (uint256): 1717199999

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000dddddd4301a082e62e84e43f474f044423921918
Arg [1] : 0000000000000000000000004788aa3becbf5f7c9fd058372b4a3fc7c75df201
Arg [2] : 00000000000000000000000000000000000000000022e1239930535fe74c0000
Arg [3] : 00000000000000000000000000000000000000000000000000000000612ec280
Arg [4] : 00000000000000000000000000000000000000000000000000000000612ec280
Arg [5] : 00000000000000000000000000000000000000000000000000000000665a647f


Deployed Bytecode Sourcemap

7435:1701:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7556:25;;;:::i;:::-;;;;;;;;;;;;;;;;7498:18;;;:::i;:::-;;;;;;;;;;;;;;;;;;;8476:179;;;;;;;;;;;;;;;;-1:-1:-1;8476:179:0;;;;:::i;:::-;;8663:470;;;:::i;7523:24::-;;;:::i;7650:22::-;;;:::i;7681:::-;;;:::i;7588:24::-;;;:::i;7619:::-;;;:::i;7556:25::-;;;;:::o;7498:18::-;;;;;;:::o;8476:179::-;8558:9;;;;8544:10;:23;8536:78;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8625:9;:22;;;;;;;;;;;;;;;8476:179::o;8663:470::-;8725:12;;8706:15;:31;;8698:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8788:11;8833:10;;8814:15;:29;8810:268;;8874:3;;8869:34;;;;;;8897:4;8869:34;;;;;;8874:3;;;;;8869:19;;:34;;;;;;;;;;;;;;;8874:3;8869:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8869:34:0;;-1:-1:-1;8810:268:0;;;8945:78;9010:12;;8997:10;;:25;8945:47;8981:10;;8963:15;:28;8945:13;;:17;;:47;;;;:::i;:::-;:51;;:78::i;:::-;9051:15;9038:10;:28;8936:87;-1:-1:-1;8810:268:0;9093:3;;;;9107:9;9088:37;;;;;;9093:3;9107:9;;;9088:37;;;;;;;;;;;;9093:3;;;;;9088:18;;:37;;;;;;;;;;;;;;;;;;9093:3;9088:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;8663:470:0:o;7523:24::-;;;;;;:::o;7650:22::-;;;;:::o;7681:::-;;;;:::o;7588:24::-;;;;:::o;7619:::-;;;;:::o;3645:220::-;3703:7;3727:6;3723:20;;-1:-1:-1;3742:1:0;3735:8;;3723:20;3766:5;;;3770:1;3766;:5;:1;3790:5;;;;;:10;3782:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3856:1;-1:-1:-1;3645:220:0;;;;;:::o;4343:153::-;4401:7;4433:1;4429;:5;4421:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4487:1;4483;:5;;;;;;;4343:153;-1:-1:-1;;;4343:153:0:o

Swarm Source

ipfs://0130c44821e6623ae4a3a85e5b7cf18c3af66110298494a6d6da7c2dcabf55c2
Loading...
Loading
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.