Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x11beA26ffAb87CEdAc70CD0E26094235733F1262
Balance 0 ETH
Nonce 1
Code Size 5065 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

5065 bytes
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638a5bdf5c116100ad578063bdcab79511610071578063bdcab795146102bb578063cdce101b146102ce578063dd0b281e146102ee578063f2fde38b1461030e578063fa01dc061461032157600080fd5b80638a5bdf5c1461023b5780638da5cb5b146102435780639bd2a16e14610268578063a153e7081461027b578063b36760a31461029b57600080fd5b806351a80c0a116100f457806351a80c0a146101e5578063715018a61461020557806374a8f1031461020d57806386d1a69f146102205780638980f11f1461022857600080fd5b806301567739146101315780631726cbc814610169578063196d71d41461018a5780632489050c1461019f5780632b34af70146101c2575b600080fd5b61015461013f36600461114f565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61017c61017736600461114f565b610344565b604051908152602001610160565b61019d61019836600461114f565b610355565b005b6101546101ad36600461114f565b60076020526000908152604090205460ff1681565b6101546101d036600461114f565b60066020526000908152604090205460ff1681565b61017c6101f336600461114f565b600a6020526000908152604090205481565b61019d61047a565b61019d61021b36600461114f565b6104b0565b61019d61068a565b61019d610236366004611169565b610823565b61019d6108e8565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610160565b600154610250906001600160a01b031681565b61017c61028936600461114f565b60096020526000908152604090205481565b61017c6102a936600461114f565b60056020526000908152604090205481565b61019d6102c9366004611192565b61095b565b61017c6102dc36600461114f565b60046020526000908152604090205481565b61017c6102fc36600461114f565b60036020526000908152604090205481565b61019d61031c36600461114f565b610c46565b61015461032f36600461114f565b60086020526000908152604090205460ff1681565b600061034f82610ce1565b92915050565b6000546001600160a01b031633146103885760405162461bcd60e51b815260040161037f90611258565b60405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff16156104075760405162461bcd60e51b815260206004820152602d60248201527f546f6b656e56657374696e673a2043616e6e6f742063616e63656c206163636560448201526c1c1d19590818dbdb9d1c9858dd609a1b606482015260840161037f565b61044361041c6000546001600160a01b031690565b6001600160a01b038084166000908152600960205260409020546001549091169190610d0d565b6040516001600160a01b038216907f7a974b69d04cb3f897a4fa7777c1bc75f5d3efb18027ed1503042608d4e703f590600090a250565b6000546001600160a01b031633146104a45760405162461bcd60e51b815260040161037f90611258565b6104ae6000610d64565b565b6000546001600160a01b031633146104da5760405162461bcd60e51b815260040161037f90611258565b6001600160a01b03811660009081526007602052604090205460ff166105425760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e56657374696e673a204e6f74207265766f6361626c650000000000604482015260640161037f565b6001600160a01b03811660009081526008602052604090205460ff16156105ab5760405162461bcd60e51b815260206004820152601d60248201527f546f6b656e56657374696e673a20416c7265616479207265766f6b6564000000604482015260640161037f565b6001600160a01b0381166000908152600a602090815260408083205460099092528220546105d99190611328565b905060006105e683610ce1565b905060006105f48284611328565b6001600160a01b0385166000908152600860205260409020805460ff19166001179055905061064161062e6000546001600160a01b031690565b6001546001600160a01b03169083610d0d565b836001600160a01b03167f8c82cd5dc1ce07aad22dcf75d3642f20cad51b7d13b907e638e5444bdad41d9d8260405161067c91815260200190565b60405180910390a250505050565b3360009081526002602052604090205460ff166106b95760405162461bcd60e51b815260040161037f9061128d565b3360009081526006602052604090205460ff166107235760405162461bcd60e51b815260206004820152602260248201527f546f6b656e56657374696e673a2056657374696e67206e6f7420616363657074604482015261195960f21b606482015260840161037f565b33600061072f82610ce1565b90506000811161078c5760405162461bcd60e51b815260206004820152602260248201527f546f6b656e56657374696e673a204e6f20746f6b656e7320746f2072656c6561604482015261736560f01b606482015260840161037f565b6001600160a01b0382166000908152600a60205260409020546107b09082906112d1565b6001600160a01b038084166000908152600a60205260409020919091556001546107dc91168383610d0d565b816001600160a01b03167fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931798260405161081791815260200190565b60405180910390a25050565b6000546001600160a01b0316331461084d5760405162461bcd60e51b815260040161037f90611258565b6001546001600160a01b03838116911614156108be5760405162461bcd60e51b815260206004820152602a60248201527f546f6b656e56657374696e673a2043616e6e6f74207265636f766572206c6f636044820152696b656420746f6b656e7360b01b606482015260840161037f565b6108e46108d36000546001600160a01b031690565b6001600160a01b0384169083610d0d565b5050565b3360009081526002602052604090205460ff166109175760405162461bcd60e51b815260040161037f9061128d565b33600081815260066020526040808220805460ff191660011790555182917fc30c364b0ad1ce173c12ad302fa271c1e271baab3f116e7abda0e058f42d804591a250565b6000546001600160a01b031633146109855760405162461bcd60e51b815260040161037f90611258565b6001600160a01b03861660009081526002602052604090205460ff16156109fe5760405162461bcd60e51b815260206004820152602760248201527f546f6b656e56657374696e673a2042656e656669636961727920616c726561646044820152661e48185919195960ca1b606482015260840161037f565b6001600160a01b038616610a665760405162461bcd60e51b815260206004820152602960248201527f546f6b656e56657374696e673a2062656e65666963696172792069732061646460448201526872657373207a65726f60b81b606482015260840161037f565b60008511610ac25760405162461bcd60e51b815260206004820152602360248201527f546f6b656e56657374696e673a206c6f636b656420616d6f756e74206973206e6044820152621d5b1b60ea1b606482015260840161037f565b60008211610b125760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e56657374696e673a206475726174696f6e206973206e756c6c0000604482015260640161037f565b81831115610b735760405162461bcd60e51b815260206004820152602860248201527f546f6b656e56657374696e673a20636c696666206c6f6e676572207468616e20604482015267323ab930ba34b7b760c11b606482015260840161037f565b42610b7e83866112d1565b11610bd95760405162461bcd60e51b815260206004820152602560248201527f546f6b656e56657374696e673a20696e636f72726563742076657374696e6720604482015264646174657360d81b606482015260840161037f565b6001600160a01b039095166000908152600260209081526040808320805460ff199081166001179091556009835281842097909755600382528083209590955560048152848220939093556005835283812091909155600790915220805492151592909116919091179055565b6000546001600160a01b03163314610c705760405162461bcd60e51b815260040161037f90611258565b6001600160a01b038116610cd55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161037f565b610cde81610d64565b50565b6001600160a01b0381166000908152600a6020526040812054610d0383610db4565b61034f9190611328565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d5f908490610eec565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600460209081526040808320546003909252822054610de291906112d1565b421080610e0857506001600160a01b03821660009081526006602052604090205460ff16155b15610e1557506000919050565b6001600160a01b038216600090815260056020908152604080832054600390925290912054610e4491906112d1565b42101580610e6a57506001600160a01b03821660009081526008602052604090205460ff165b15610e8b57506001600160a01b031660009081526009602052604090205490565b6001600160a01b038216600090815260056020908152604080832054600390925290912054610eba9042611328565b6001600160a01b038416600090815260096020526040902054610edd9190611309565b61034f91906112e9565b919050565b6000610f41826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610fbe9092919063ffffffff16565b805190915015610d5f5780806020019051810190610f5f91906111ed565b610d5f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161037f565b6060610fcd8484600085610fd7565b90505b9392505050565b6060824710156110385760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161037f565b843b6110865760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161037f565b600080866001600160a01b031685876040516110a29190611209565b60006040518083038185875af1925050503d80600081146110df576040519150601f19603f3d011682016040523d82523d6000602084013e6110e4565b606091505b50915091506110f48282866110ff565b979650505050505050565b6060831561110e575081610fd0565b82511561111e5782518084602001fd5b8160405162461bcd60e51b815260040161037f9190611225565b80356001600160a01b0381168114610ee757600080fd5b600060208284031215611160578081fd5b610fd082611138565b6000806040838503121561117b578081fd5b61118483611138565b946020939093013593505050565b60008060008060008060c087890312156111aa578182fd5b6111b387611138565b95506020870135945060408701359350606087013592506080870135915060a08701356111df81611385565b809150509295509295509295565b6000602082840312156111fe578081fd5b8151610fd081611385565b6000825161121b81846020870161133f565b9190910192915050565b602081526000825180602084015261124481604085016020870161133f565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526024908201527f546f6b656e56657374696e673a2043616c6c6572206e6f742062656e656669636040820152636961727960e01b606082015260800190565b600082198211156112e4576112e461136f565b500190565b60008261130457634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156113235761132361136f565b500290565b60008282101561133a5761133a61136f565b500390565b60005b8381101561135a578181015183820152602001611342565b83811115611369576000848401525b50505050565b634e487b7160e01b600052601160045260246000fd5b8015158114610cde57600080fdfea26469706673582212209e0895537252b48884cb9b98191e38e554f78be67773579fe776d9c45f40215d64736f6c63430008040033

Verified Source Code Full Match

Compiler: v0.8.4+commit.c7e474f2 EVM: istanbul Optimization: Yes (200 runs)
MultiVesting.sol 207 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../open-zeppelin/interfaces/IERC20.sol";
import "../open-zeppelin/libraries/SafeERC20.sol";
import "../open-zeppelin/utils/Ownable.sol";

/** @title MultiVesting contract  */
/// @author Paladin
/*
    Contract that manages locked tokens for multiple users.
    Tokens can be released according to a vesting schedule, with a cliff and a vesting period
    If set at creation, vesting can be revoked by the owner
*/
contract MultiVesting is Ownable {
    using SafeERC20 for IERC20;


    // Storage : 

    // ERC20 token locked in the contract
    IERC20 public pal;

    // address to receive the tokens
    mapping(address => bool) public beneficiaries;

    // dates are in seconds
    mapping(address => uint256) public start;
    // durations are in seconds
    mapping(address => uint256) public cliff;
    mapping(address => uint256) public duration;

    // beneficiary accepted the vesting terms
    mapping(address => bool) public accepted;

    // vesting can be set as revocable when created, and allow owner to revoke unvested tokens
    mapping(address => bool) public revocable;
    mapping(address => bool) public revoked;

    // amount of tokens locked when starting the Vesting
    mapping(address => uint256) public lockedAmount;
    // amount of tokens released to the beneficiary
    mapping(address => uint256) public totalReleasedAmount;


    // Events : 

    event TokensReleased(address indexed beneficiary, uint256 releasedAmount);
    event TokenVestingRevoked(address indexed beneficiary, uint256 revokedAmount);
    event LockAccepted(address indexed beneficiary);
    event LockCanceled(address indexed beneficiary);


    //Modifiers : 

    modifier isBeneficiary() {
        require(beneficiaries[msg.sender], "TokenVesting: Caller not beneficiary");
        _;
    }

    modifier onlyIfAccepted() {
        require(beneficiaries[msg.sender], "TokenVesting: Caller not beneficiary");
        require(accepted[msg.sender], "TokenVesting: Vesting not accepted");
        _;
    }


    // Constructor : 
    /**
     * @dev Creates the vesting contract
     * @param _palAddress address of the locked token (PAL token)
     */
    constructor(
        address _admin,
        address _palAddress
    ){
        require(_admin != address(0), "TokenVesting: admin is address zero");
        require(_palAddress != address(0), "TokenVesting: incorrect PAL address");

        pal = IERC20(_palAddress);

        transferOwnership(_admin);
    }


    // Functions : 

    /**
     * @dev Adds beneficiary to the vesting contract with a cliff. Cliff can be 0
     * @param _beneficiary address receiving the vested tokens
     * @param _lockedAmount amount of tokens locked in the contract
     * @param _startTimestamp timestamp when the vesting starts (Unix Timestamp)
     * @param _cliffDuration duration of the cliff period (in seconds)
     * @param _duration duration of the vesting period (in seconds)
     * @param _revocable is vesting revocable
     */
    function addBeneficiary(
        address _beneficiary,
        uint256 _lockedAmount,
        uint256 _startTimestamp, //Unix Timestamp
        uint256 _cliffDuration, //in seconds
        uint256 _duration, //in seconds
        bool _revocable
    ) external onlyOwner {
        require(beneficiaries[_beneficiary] == false, "TokenVesting: Beneficiary already added");


        require(_beneficiary != address(0), "TokenVesting: beneficiary is address zero");
        require(_lockedAmount > 0, "TokenVesting: locked amount is null");
        require(_duration > 0, "TokenVesting: duration is null");
        require(_cliffDuration <= _duration, "TokenVesting: cliff longer than duration");
        require(_startTimestamp + _duration > block.timestamp, "TokenVesting: incorrect vesting dates");


        beneficiaries[_beneficiary] = true;

        lockedAmount[_beneficiary] = _lockedAmount;

        start[_beneficiary] = _startTimestamp;
        cliff[_beneficiary] = _cliffDuration;
        duration[_beneficiary] = _duration;

        revocable[_beneficiary] = _revocable;
        
    }

    function acceptLock() external isBeneficiary {
        address beneficiary = msg.sender;

        accepted[beneficiary] = true;

        emit LockAccepted(beneficiary);
    }


    function cancelLock(address beneficiary) external onlyOwner {
        require(accepted[beneficiary] == false, "TokenVesting: Cannot cancel accepted contract");

        pal.safeTransfer(owner(), lockedAmount[beneficiary]);

        emit LockCanceled(beneficiary);
    }


    function release() external onlyIfAccepted {
        address beneficiary = msg.sender;

        uint256 unreleasedAmount = _releasableAmount(beneficiary);

        require(unreleasedAmount > 0, "TokenVesting: No tokens to release");

        totalReleasedAmount[beneficiary] = totalReleasedAmount[beneficiary] + unreleasedAmount;

        pal.safeTransfer(beneficiary, unreleasedAmount);

        emit TokensReleased(beneficiary, unreleasedAmount);
    }


    function releasableAmount(address beneficiary) external view returns (uint256){
        return _releasableAmount(beneficiary);
    }


    function _vestedAmount(address beneficiary) private view returns (uint256) {
        if (block.timestamp < start[beneficiary] + cliff[beneficiary] || !accepted[beneficiary]) {
            return 0;
        } else if (block.timestamp >= start[beneficiary] + duration[beneficiary] || revoked[beneficiary]) {
            return lockedAmount[beneficiary];
        } else {
            return (lockedAmount[beneficiary] * (block.timestamp - start[beneficiary])) / duration[beneficiary];
        }
    }


    function _releasableAmount(address beneficiary) private view returns (uint256) {
        return _vestedAmount(beneficiary) - totalReleasedAmount[beneficiary];
    }


    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
        // Cannot recover the locked token
        require(tokenAddress != address(pal), "TokenVesting: Cannot recover locked tokens");

        IERC20(tokenAddress).safeTransfer(owner(), tokenAmount);
    }


    // Admin Functions : 

    function revoke(address beneficiary) external onlyOwner {
        require(revocable[beneficiary], "TokenVesting: Not revocable");
        require(!revoked[beneficiary], "TokenVesting: Already revoked");

        uint256 remaingingAmount = lockedAmount[beneficiary] - totalReleasedAmount[beneficiary];

        uint256 unreleasedAmount = _releasableAmount(beneficiary);
        uint256 revokedAmount = remaingingAmount - unreleasedAmount;

        revoked[beneficiary] = true;

        pal.safeTransfer(owner(), revokedAmount);

        emit TokenVestingRevoked(beneficiary, revokedAmount);
    }

}
Address.sol 216 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT

pragma solidity ^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);
}
SafeERC20.sol 98 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../interfaces/IERC20.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));
        }
    }

    /**
     * @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");
        }
    }
}

Read Contract

accepted 0x2b34af70 → bool
beneficiaries 0x01567739 → bool
cliff 0xcdce101b → uint256
duration 0xb36760a3 → uint256
lockedAmount 0xa153e708 → uint256
owner 0x8da5cb5b → address
pal 0x9bd2a16e → address
releasableAmount 0x1726cbc8 → uint256
revocable 0x2489050c → bool
revoked 0xfa01dc06 → bool
start 0xdd0b281e → uint256
totalReleasedAmount 0x51a80c0a → uint256

Write Contract 8 functions

These functions modify contract state and require a wallet transaction to execute.

acceptLock 0x8a5bdf5c
No parameters
addBeneficiary 0xbdcab795
address _beneficiary
uint256 _lockedAmount
uint256 _startTimestamp
uint256 _cliffDuration
uint256 _duration
bool _revocable
cancelLock 0x196d71d4
address beneficiary
recoverERC20 0x8980f11f
address tokenAddress
uint256 tokenAmount
release 0x86d1a69f
No parameters
renounceOwnership 0x715018a6
No parameters
revoke 0x74a8f103
address beneficiary
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address