Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x86CFD45F68910E373e60560938A16AF673d22aBD
Balance 0 ETH
Nonce 1
Code Size 8759 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

8759 bytes
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638947606911610097578063b300696611610066578063b300696614610266578063b849352b14610298578063e4cdcbee146102b4578063f2fde38b146102ef57610100565b806389476069146101f05780638a19c8bc1461020c5780638da5cb5b1461022a57806391f3839a1461024857610100565b80635fbe4d1d116100d35780635fbe4d1d1461017a57806361ab4dad14610198578063715018a6146101ca57806377329f35146101d457610100565b8063135338231461010557806327a6520d146101215780633ccfd60b1461013d5780635cf3b15f14610147575b600080fd5b61011f600480360381019061011a91906112ec565b61030b565b005b61013b60048036038101906101369190611364565b610473565b005b6101456106b6565b005b610161600480360381019061015c91906113a5565b61070d565b60405161017194939291906113eb565b60405180910390f35b610182610836565b60405161018f919061143f565b60405180910390f35b6101b260048036038101906101ad919061145a565b61085c565b6040516101c19392919061149a565b60405180910390f35b6101d2610893565b005b6101ee60048036038101906101e991906113a5565b6108a7565b005b61020a600480360381019061020591906113a5565b610939565b005b610214610a86565b60405161022191906114e0565b60405180910390f35b610232610b13565b60405161023f919061143f565b60405180910390f35b610250610b3c565b60405161025d91906114e0565b60405180910390f35b610280600480360381019061027b91906114fb565b610b4f565b60405161028f9392919061149a565b60405180910390f35b6102b260048036038101906102ad919061158d565b610b79565b005b6102ce60048036038101906102c991906114fb565b610c3f565b6040516102e69c9b9a999897969594939291906115ed565b60405180910390f35b610309600480360381019061030491906113a5565b610cbf565b005b610313610d42565b6000600660008560000b60000b815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820154815260200160018201548152602001600282015481525050905080600660008660000b60000b815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201559050506000600660008660000b60000b815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555050505050565b61047b610d42565b60008260000b121580156104b057506001600360149054906101000a900460000b6104a691906116d6565b60000b8260000b13155b6104ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e69061178c565b60405180910390fd5b6000816000013511801561050a575080600001358160200135115b610549576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105409061181e565b60405180910390fd5b60008160a0013511610590576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105879061188a565b60405180910390fd5b60008160600135101580156105a9575060008160400135115b6105e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105df9061191c565b60405180910390fd5b60008160600135118015610600575060008160400135115b1561064d57600081608001351161064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064390611988565b60405180910390fd5b5b600360149054906101000a900460000b60000b8260000b13156106895781600360146101000a81548160ff021916908360000b60ff1602179055505b80600460008460000b60000b815260200190815260200160002081816106af9190611cd0565b9050505050565b6106be610d42565b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610709573d6000803e3d6000fd5b5050565b600080600080600061071d610a86565b905060005b8160000b8160000b1361082d576000600460008360000b60000b815260200190815260200160002090506000600560008460000b60000b815260200190815260200160002090506000600660008560000b60000b815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506107ce818484610dc0565b886107d99190611cde565b97506107e6818484610e1b565b876107f19190611cde565b96508060020154866108039190611cde565b95508060000154896108159190611cde565b9850505050808061082590611d12565b915050610722565b50509193509193565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6006602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154905083565b61089b610d42565b6108a56000610ede565b565b6002600154036108ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e390611d87565b60405180910390fd5b600260018190555060006108fe610a86565b905060005b8160000b8160000b1361092d5761091a8382610fa2565b808061092590611d12565b915050610903565b50506001808190555050565b610941610d42565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161099e919061143f565b602060405180830381865afa1580156109bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109df9190611dbc565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610a3e929190611de9565b6020604051808303816000875af1158015610a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a819190611e4a565b505050565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060005b600360149054906101000a900460000b60000b8160000b13610b0b576000600460008360000b60000b8152602001908152602001600020905042816000015411610af7578192505b508080610b0390611d12565b915050610aaf565b508091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600360149054906101000a900460000b81565b60056020528060005260406000206000915090508060000154908060010154908060020154905083565b610b81610d42565b60005b82829050811015610c395736838383818110610ba357610ba2611e77565b5b90506040020190506000600660008760000b60000b81526020019081526020016000206000836020016020810190610bdb91906113a5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508160000135816001018190555050508080610c3190611ea6565b915050610b84565b50505050565b60046020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060154908060070160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600801549080600901549080600a01549080600b015490508c565b610cc7610d42565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d90611f60565b60405180910390fd5b610d3f81610ede565b50565b610d4a61117d565b73ffffffffffffffffffffffffffffffffffffffff16610d68610b13565b73ffffffffffffffffffffffffffffffffffffffff1614610dbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db590611fcc565b60405180910390fd5b565b600080836004015403610e0c574283600101541115610de25760009050610e14565b836000015482600001548460020154610dfb919061201b565b610e05919061204c565b9050610e14565b836001015490505b9392505050565b600080610e29858585610dc0565b90506000610e378286611185565b905081811115610e7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7390612100565b60405180910390fd5b8560020154811015610ec3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eba90612192565b60405180910390fd5b856002015481610ed391906121b2565b925050509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600560008360000b60000b815260200190815260200160002090506000600660008460000b60000b815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600061103e82600460008760000b60000b815260200190815260200160002085610e1b565b90506000810361105057505050611179565b808260020160008282546110649190611cde565b925050819055508083600201600082825461107f9190611cde565b92505081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86836040518363ffffffff1660e01b81526004016110e3929190611de9565b6020604051808303816000875af1158015611102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111269190611e4a565b508473ffffffffffffffffffffffffffffffffffffffff167f69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de28260405161116d91906121e6565b60405180910390a25050505b5050565b600033905090565b60004282600a0154111561119c5760009050611245565b600082600b01546064856111b0919061201b565b6111ba919061204c565b905082600801544210156111d15780915050611245565b600081856111df91906121b2565b9050600042856009015410156111f757819050611233565b84600801544261120791906121b2565b8560080154866009015461121b91906121b2565b83611226919061201b565b611230919061204c565b90505b828161123f9190611cde565b93505050505b92915050565b600080fd5b600080fd5b60008160000b9050919050565b61126b81611255565b811461127657600080fd5b50565b60008135905061128881611262565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006112b98261128e565b9050919050565b6112c9816112ae565b81146112d457600080fd5b50565b6000813590506112e6816112c0565b92915050565b6000806000606084860312156113055761130461124b565b5b600061131386828701611279565b9350506020611324868287016112d7565b9250506040611335868287016112d7565b9150509250925092565b600080fd5b6000610180828403121561135b5761135a61133f565b5b81905092915050565b6000806101a0838503121561137c5761137b61124b565b5b600061138a85828601611279565b925050602061139b85828601611344565b9150509250929050565b6000602082840312156113bb576113ba61124b565b5b60006113c9848285016112d7565b91505092915050565b6000819050919050565b6113e5816113d2565b82525050565b600060808201905061140060008301876113dc565b61140d60208301866113dc565b61141a60408301856113dc565b61142760608301846113dc565b95945050505050565b611439816112ae565b82525050565b60006020820190506114546000830184611430565b92915050565b600080604083850312156114715761147061124b565b5b600061147f85828601611279565b9250506020611490858286016112d7565b9150509250929050565b60006060820190506114af60008301866113dc565b6114bc60208301856113dc565b6114c960408301846113dc565b949350505050565b6114da81611255565b82525050565b60006020820190506114f560008301846114d1565b92915050565b6000602082840312156115115761151061124b565b5b600061151f84828501611279565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261154d5761154c611528565b5b8235905067ffffffffffffffff81111561156a5761156961152d565b5b60208301915083604082028301111561158657611585611532565b5b9250929050565b6000806000604084860312156115a6576115a561124b565b5b60006115b486828701611279565b935050602084013567ffffffffffffffff8111156115d5576115d4611250565b5b6115e186828701611537565b92509250509250925092565b600061018082019050611603600083018f6113dc565b611610602083018e6113dc565b61161d604083018d6113dc565b61162a606083018c6113dc565b611637608083018b6113dc565b61164460a083018a6113dc565b61165160c08301896113dc565b61165e60e0830188611430565b61166c6101008301876113dc565b61167a6101208301866113dc565b6116886101408301856113dc565b6116966101608301846113dc565b9d9c50505050505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116e182611255565b91506116ec83611255565b925082820190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808112607f82131715611729576117286116a7565b5b92915050565b600082825260208201905092915050565b7f50726573616c653a20696e76616c696420726f756e644e756d00000000000000600082015250565b600061177660198361172f565b915061178182611740565b602082019050919050565b600060208201905081810360008301526117a581611769565b9050919050565b7f50726573616c653a20696e76616c696420737461727454696d65206f7220656e60008201527f6454696d65000000000000000000000000000000000000000000000000000000602082015250565b600061180860258361172f565b9150611813826117ac565b604082019050919050565b60006020820190508181036000830152611837816117fb565b9050919050565b7f50726573616c653a20696e76616c6964206d696e427579000000000000000000600082015250565b600061187460178361172f565b915061187f8261183e565b602082019050919050565b600060208201905081810360008301526118a381611867565b9050919050565b7f50726573616c653a20696e76616c6964207261697365436170206f7220746f7460008201527f616c537570706c79000000000000000000000000000000000000000000000000602082015250565b600061190660288361172f565b9150611911826118aa565b604082019050919050565b60006020820190508181036000830152611935816118f9565b9050919050565b7f50726573616c653a20696e76616c696420706572556e69740000000000000000600082015250565b600061197260188361172f565b915061197d8261193c565b602082019050919050565b600060208201905081810360008301526119a181611965565b9050919050565b6119b1816113d2565b81146119bc57600080fd5b50565b600081356119cc816119a8565b80915050919050565b60008160001b9050919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611a0e846119d5565b9350801983169250808416831791505092915050565b6000819050919050565b6000611a49611a44611a3f846113d2565b611a24565b6113d2565b9050919050565b6000819050919050565b611a6382611a2e565b611a76611a6f82611a50565b83546119e2565b8255505050565b60008135611a8a816112c0565b80915050919050565b600073ffffffffffffffffffffffffffffffffffffffff611ab3846119d5565b9350801983169250808416831791505092915050565b6000611ae4611adf611ada8461128e565b611a24565b61128e565b9050919050565b6000611af682611ac9565b9050919050565b6000611b0882611aeb565b9050919050565b6000819050919050565b611b2282611afd565b611b35611b2e82611b0f565b8354611a93565b8255505050565b600081016000830180611b4e816119bf565b9050611b5a8184611a5a565b505050600181016020830180611b6f816119bf565b9050611b7b8184611a5a565b505050600281016040830180611b90816119bf565b9050611b9c8184611a5a565b505050600381016060830180611bb1816119bf565b9050611bbd8184611a5a565b505050600481016080830180611bd2816119bf565b9050611bde8184611a5a565b5050506005810160a0830180611bf3816119bf565b9050611bff8184611a5a565b5050506006810160c0830180611c14816119bf565b9050611c208184611a5a565b5050506007810160e0830180611c3581611a7d565b9050611c418184611b19565b50505060088101610100830180611c57816119bf565b9050611c638184611a5a565b50505060098101610120830180611c79816119bf565b9050611c858184611a5a565b505050600a8101610140830180611c9b816119bf565b9050611ca78184611a5a565b505050600b8101610160830180611cbd816119bf565b9050611cc98184611a5a565b5050505050565b611cda8282611b3c565b5050565b6000611ce9826113d2565b9150611cf4836113d2565b9250828201905080821115611d0c57611d0b6116a7565b5b92915050565b6000611d1d82611255565b9150607f8203611d3057611d2f6116a7565b5b600182019050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d71601f8361172f565b9150611d7c82611d3b565b602082019050919050565b60006020820190508181036000830152611da081611d64565b9050919050565b600081519050611db6816119a8565b92915050565b600060208284031215611dd257611dd161124b565b5b6000611de084828501611da7565b91505092915050565b6000604082019050611dfe6000830185611430565b611e0b60208301846113dc565b9392505050565b60008115159050919050565b611e2781611e12565b8114611e3257600080fd5b50565b600081519050611e4481611e1e565b92915050565b600060208284031215611e6057611e5f61124b565b5b6000611e6e84828501611e35565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611eb1826113d2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ee357611ee26116a7565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611f4a60268361172f565b9150611f5582611eee565b604082019050919050565b60006020820190508181036000830152611f7981611f3d565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611fb660208361172f565b9150611fc182611f80565b602082019050919050565b60006020820190508181036000830152611fe581611fa9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612026826113d2565b9150612031836113d2565b92508261204157612040611fec565b5b828204905092915050565b6000612057826113d2565b9150612062836113d2565b9250828202612070816113d2565b91508282048414831517612087576120866116a7565b5b5092915050565b7f417373657274696f6e4661696c65643a20766573746564203c3d205f746f746160008201527f6c546f6b656e0000000000000000000000000000000000000000000000000000602082015250565b60006120ea60268361172f565b91506120f58261208e565b604082019050919050565b60006020820190508181036000830152612119816120dd565b9050919050565b7f417373657274696f6e4661696c65643a20766573746564203e3d2077616c6c6560008201527f742e746f74616c436c61696d0000000000000000000000000000000000000000602082015250565b600061217c602c8361172f565b915061218782612120565b604082019050919050565b600060208201905081810360008301526121ab8161216f565b9050919050565b60006121bd826113d2565b91506121c8836113d2565b92508282039050818111156121e0576121df6116a7565b5b92915050565b60006020820190506121fb60008301846113dc565b9291505056fea2646970667358221220221af4ee6213f51555a99933d16be0ace74d6cda1af03650eda6f11b2d4ccebf64736f6c63430008130033

Verified Source Code Partial Match

Compiler: v0.8.19+commit.7dd6d404 EVM: paris Optimization: No
VestingControlV2.sol 501 lines
// Sources flattened with hardhat v2.19.3 https://hardhat.org

// SPDX-License-Identifier: MIT AND UNLICENSED

// File @openzeppelin/contracts/utils/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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;
    }
}


// File @openzeppelin/contracts/access/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @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() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File @openzeppelin/contracts/security/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}


// File @openzeppelin/contracts/token/ERC20/[email protected]

// Original license: 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);
}


// File contracts/VestingControlV2.sol

// Original license: SPDX_License_Identifier: UNLICENSED
pragma solidity =0.8.19;



contract VestingControlV2 is Ownable, ReentrancyGuard {
    event Transfer(address indexed to, uint256 token);

    string magic = "HA0UdnhY29wIxKPZ";

    address public tokenAddr; // erc20 token address, decimals 1e18
    int8 public roundLatest = -1; // round is start at 0

    struct RoundOpt {
        uint256 startTime; // round start at
        uint256 endTime; // round end at
        uint256 totalSupply; // total erc20 token supply for this round
        uint256 raiseCap; // total raise cap, 0 means nolimit
        uint256 perUnit; // token amount = perUnit * 1ETH, 0 means we should wait for the round to end
        uint256 minBuy; //  minimun amount per wallet
        uint256 maxBuy; // maximum amount per wallet, 0 means nolimit
        address signerAddress; // signer for whitelist, empty means nolimit

        // vesting period
        uint256 vestingStartTime; // vestingStartTime > tokenReleaseAt
        uint256 vestingEndTime; //
        uint256 tgeStartTime;
        uint256 tgePerc; // 0~100
    }

    struct RoundStat {
        uint256 totalRaised; // eth
        uint256 totalToken; // token
        uint256 totalClaim; // token
    }

    struct Wallet {
        uint256 totalDeposited; // eth
        uint256 totalToken; // token
        uint256 totalClaim; // token
    }

    struct Vesting {
        uint256 amount;
        address beneficary;
    }

    mapping(int8 => RoundOpt) public roundOpts;
    mapping(int8 => RoundStat) public roundStat;
    mapping(int8 => mapping(address => Wallet)) public wallets;

    constructor(address _tokenAddr) {
        tokenAddr = _tokenAddr;
    }

    // ============= State Function  =============
    
    function currentRound() public view returns (int8) {
        int8 _currentRound = -1;
        for (int8 roundNum = 0; roundNum <= roundLatest; roundNum++) {
            RoundOpt storage opt = roundOpts[roundNum];
            if (opt.startTime <= block.timestamp) {
                _currentRound = roundNum;
            }
        } 
        return _currentRound;
    }

    // ============= Exchange Function  =============

    // ============= Claim Fuciton ===============

    // User claim
    function totalToken(address addr) external view returns (uint256 deposited, uint256 amount, uint256 claimable, uint256 claimed) {
        int8 _currentRound = currentRound();

        for (int8 roundNum = 0; roundNum <= _currentRound; roundNum++) {
            RoundOpt storage opt = roundOpts[roundNum];
            RoundStat storage stat = roundStat[roundNum];
            Wallet storage wallet = wallets[roundNum][addr];

            amount += _getBoughtToken(wallet, opt, stat);
            claimable += _claimableToken(wallet, opt, stat);
            claimed += wallet.totalClaim;
            deposited += wallet.totalDeposited;
        }

        return (deposited, amount, claimable, claimed);
    }


    function _getBoughtToken(
        Wallet storage wallet,
        RoundOpt storage opt,
        RoundStat storage stat
    ) private view returns (uint256) {
        if (opt.perUnit == 0) {
            if (opt.endTime > block.timestamp) {
                return 0;
            } else {
                return opt.totalSupply / stat.totalRaised * wallet.totalDeposited;
            }
        } else {
            return wallet.totalToken;
        }
    }

    function _claimableToken(
        Wallet storage wallet,
        RoundOpt storage opt,
        RoundStat storage stat
    ) private view returns (uint256) {
        uint256 _totalToken = _getBoughtToken(wallet, opt, stat);

        uint256 vested = getVestedAmount(_totalToken, opt);

        require(vested <= _totalToken, "AssertionFailed: vested <= _totalToken");
        require(vested >= wallet.totalClaim, "AssertionFailed: vested >= wallet.totalClaim");

        return vested - wallet.totalClaim;
    }

    function getVestedAmount(uint256 boughtAmount, RoundOpt storage opt) private view returns (uint256) {
        if (opt.tgeStartTime > block.timestamp) {
            return 0;
        }

        uint256 initVestedAmount = boughtAmount / 100 * opt.tgePerc;

        if (block.timestamp < opt.vestingStartTime) {
            return initVestedAmount;
        }


        uint256 vestingAmount = boughtAmount - initVestedAmount;

        uint256 vestedAmount = 0;
        if (opt.vestingEndTime < block.timestamp) {
            vestedAmount = vestingAmount;
        } else {
            vestedAmount = vestingAmount / (opt.vestingEndTime - opt.vestingStartTime) * (block.timestamp - opt.vestingStartTime);
        }

        return vestedAmount + initVestedAmount;
    }

    // claimAll claimable token
    function claimAll(address addr) external nonReentrant {
        int8 _currentRound = currentRound();

        for (int8 roundNum = 0; roundNum <= _currentRound; roundNum++) {
            _claim(addr, roundNum);
        }
    }
    
    function _claim(address addr, int8 roundNum) private {
        RoundStat storage stat = roundStat[roundNum];
        Wallet storage wallet = wallets[roundNum][addr];

        uint256 claimable = _claimableToken(wallet, roundOpts[roundNum], stat);
        if (claimable == 0) {
            return;
        }

        wallet.totalClaim += claimable;
        stat.totalClaim += claimable;
    
        IERC20(tokenAddr).transfer(addr, claimable);
        emit Transfer(addr, claimable);
    }

    // =========== Admin Fuction (onlyOwner)============

    // setup round
    function setupRound(
        int8 roundNum,
        RoundOpt calldata opt
    ) external onlyOwner {
        require(roundNum >= 0 && roundNum <= roundLatest + 1, "Presale: invalid roundNum");
        require(
            opt.startTime > 0 && opt.endTime > opt.startTime,
            "Presale: invalid startTime or endTime"
        );
        require(opt.minBuy > 0, "Presale: invalid minBuy");
        require(
            opt.raiseCap >= 0 && opt.totalSupply > 0,
            "Presale: invalid raiseCap or totalSupply"
        );

        if (opt.raiseCap > 0 && opt.totalSupply > 0) {
            require(opt.perUnit > 0, "Presale: invalid perUnit");
        }

        if (roundNum > roundLatest) {
            roundLatest = roundNum;
        }

        roundOpts[roundNum] = opt;
    }

    function upsertVestings(int8 roundNum, Vesting[] calldata beneficaries) external onlyOwner() {
        for (uint256 index = 0; index < beneficaries.length; index++) {
            Vesting calldata beneficary = beneficaries[index];
            Wallet storage wallet = wallets[roundNum][beneficary.beneficary]; 
            wallet.totalToken = beneficary.amount;
        }
    }

    function updateVestingBeneficary(int8 roundNum, address from, address to) external onlyOwner() {
        // copy wallet
        Wallet memory wallet = wallets[roundNum][from]; 
        wallets[roundNum][to] = wallet;
        // remove amount
        wallets[roundNum][from].totalToken = 0;
    }

    // withdraw
    function withdraw() external onlyOwner {
        uint256 count = address(this).balance;
        (payable(msg.sender)).transfer(count);
    }

    function withdrawToken(address addr) external onlyOwner {
        uint256 count = IERC20(tokenAddr).balanceOf(address(this));
        IERC20(tokenAddr).transfer(addr, count);
    }

    // internal helper
}

Read Contract

currentRound 0x8a19c8bc → int8
owner 0x8da5cb5b → address
roundLatest 0x91f3839a → int8
roundOpts 0xe4cdcbee → uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, uint256, uint256, uint256, uint256
roundStat 0xb3006966 → uint256, uint256, uint256
tokenAddr 0x5fbe4d1d → address
totalToken 0x5cf3b15f → uint256, uint256, uint256, uint256
wallets 0x61ab4dad → uint256, uint256, uint256

Write Contract 8 functions

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

claimAll 0x77329f35
address addr
renounceOwnership 0x715018a6
No parameters
setupRound 0xc9c6ce93
int8 roundNum
tuple opt
transferOwnership 0xf2fde38b
address newOwner
updateVestingBeneficary 0x13533823
int8 roundNum
address from
address to
upsertVestings 0x7555bd3a
int8 roundNum
tuple[] beneficaries
withdraw 0x3ccfd60b
No parameters
withdrawToken 0x89476069
address addr

Recent Transactions

No transactions found for this address