Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xE5742f83b515849fF2B7fc486E247D5c74824243
Balance 0 ETH
Nonce 1
Code Size 6112 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

6112 bytes
0x608060405234801561000f575f80fd5b50600436106100fe575f3560e01c80635a84941911610095578063e680be4d11610064578063e680be4d146102d4578063ed10e33c14610304578063f3c0f4d71461030e578063fccc28131461032c576100fe565b80635a8494191461024c578063900e2b261461027c578063d8d818eb1461029a578063dd467064146102b8576100fe565b80633fbb2c01116100d15780633fbb2c011461019e57806344227d35146101ce5780634a4643f7146101fe578063596b2b841461022e576100fe565b806309afda18146101025780630bdf53001461013257806310b20139146101505780632293f97314610180575b5f80fd5b61011c600480360381019061011791906111ea565b61034a565b604051610129919061122d565b60405180910390f35b61013a610537565b6040516101479190611255565b60405180910390f35b61016a600480360381019061016591906111ea565b61055b565b604051610177919061122d565b60405180910390f35b610188610570565b604051610195919061122d565b60405180910390f35b6101b860048036038101906101b391906111ea565b610577565b6040516101c59190611290565b60405180910390f35b6101e860048036038101906101e391906111ea565b61059b565b6040516101f591906112c3565b60405180910390f35b610218600480360381019061021391906111ea565b61065c565b604051610225919061122d565b60405180910390f35b610236610671565b604051610243919061122d565b60405180910390f35b610266600480360381019061026191906111ea565b610678565b604051610273919061122d565b60405180910390f35b61028461068d565b604051610291919061122d565b60405180910390f35b6102a2610692565b6040516102af9190611255565b60405180910390f35b6102d260048036038101906102cd9190611306565b6106b6565b005b6102ee60048036038101906102e991906111ea565b6109ed565b6040516102fb919061122d565b60405180910390f35b61030c610c41565b005b610316610da3565b604051610323919061122d565b60405180910390f35b610334610da8565b6040516103419190611255565b60405180910390f35b5f805f90505f60035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205414806103a157505f61039f846109ed565b115b61052e5762ed4e0060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff164261040f919061135e565b1015610490574262ed4e0060015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1661047f9190611391565b610489919061135e565b905061052d565b5f61049a84610dae565b90504262278d00826104ac91906113c4565b62ed4e0060015f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff166105159190611391565b61051f9190611391565b610529919061135e565b9150505b5b80915050919050565b7f00000000000000000000000013d074303c95a34d304f29928dc8a16dec797e9e81565b6004602052805f5260405f205f915090505481565b62278d0081565b6001602052805f5260405f205f915054906101000a900467ffffffffffffffff1681565b5f8060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054036105e8575f9050610657565b62ed4e0060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1642610652919061135e565b101590505b919050565b6002602052805f5260405f205f915090505481565b62ed4e0081565b6003602052805f5260405f205f915090505481565b600c81565b7f000000000000000000000000f35593120a5c19d3ae3d551b5806163b367c096d81565b5f60015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1614610752576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107499061145f565b60405180910390fd5b5f8111610794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078b906114c7565b60405180910390fd5b5f54816107a19190611391565b7f00000000000000000000000013d074303c95a34d304f29928dc8a16dec797e9e73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016107fa9190611255565b602060405180830381865afa158015610815573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061083991906114f9565b101561087a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087190611594565b60405180910390fd5b8060025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508060035f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055504260015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550805f808282546109719190611391565b925050819055506109a67f000000000000000000000000f35593120a5c19d3ae3d551b5806163b367c096d3361dead84610e47565b803373ffffffffffffffffffffffffffffffffffffffff167f9f1ec8c880f76798e7b793325d625e9b60e4082a553c98f42b6cda368dd6000860405160405180910390a350565b5f8060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205403610a3a575f9050610c3c565b62ed4e0060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1642610aa4919061135e565b1015610ab2575f9050610c3c565b5f610abc83610dae565b90505f60045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054600c60025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205484610b4891906113c4565b610b5291906115df565b610b5c919061135e565b905060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054811180610bf05750818160035f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054610bee919061135e565b105b15610c365760035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205490505b80925050505b919050565b5f610c4b336109ed565b90505f8111610c8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8690611659565b60405180910390fd5b8060035f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825403925050819055508060045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282540192505081905550805f808282540392505081905550610d5c7f00000000000000000000000013d074303c95a34d304f29928dc8a16dec797e9e3383610ec9565b803373ffffffffffffffffffffffffffffffffffffffff167f0f0bc5b519ddefdd8e5f9e6423433aa2b869738de2ae34d58ebc796fc749fa0d60405160405180910390a350565b5f5481565b61dead81565b5f600160ff1662278d0062ed4e0060015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1642610e22919061135e565b610e2c919061135e565b610e3691906115df565b610e409190611391565b9050919050565b610ec3848573ffffffffffffffffffffffffffffffffffffffff166323b872dd868686604051602401610e7c93929190611677565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610f48565b50505050565b610f43838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401610efc9291906116ac565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610f48565b505050565b5f610f72828473ffffffffffffffffffffffffffffffffffffffff16610fdd90919063ffffffff16565b90505f815114158015610f96575080806020019051810190610f9491906116fd565b155b15610fd857826040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401610fcf9190611255565b60405180910390fd5b505050565b6060610fea83835f610ff2565b905092915050565b60608147101561103957306040517fcd7860590000000000000000000000000000000000000000000000000000000081526004016110309190611255565b60405180910390fd5b5f808573ffffffffffffffffffffffffffffffffffffffff1684866040516110619190611794565b5f6040518083038185875af1925050503d805f811461109b576040519150601f19603f3d011682016040523d82523d5f602084013e6110a0565b606091505b50915091506110b08683836110bb565b925050509392505050565b6060826110d0576110cb82611148565b611140565b5f82511480156110f657505f8473ffffffffffffffffffffffffffffffffffffffff163b145b1561113857836040517f9996b31500000000000000000000000000000000000000000000000000000000815260040161112f9190611255565b60405180910390fd5b819050611141565b5b9392505050565b5f8151111561115a5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6111b982611190565b9050919050565b6111c9816111af565b81146111d3575f80fd5b50565b5f813590506111e4816111c0565b92915050565b5f602082840312156111ff576111fe61118c565b5b5f61120c848285016111d6565b91505092915050565b5f819050919050565b61122781611215565b82525050565b5f6020820190506112405f83018461121e565b92915050565b61124f816111af565b82525050565b5f6020820190506112685f830184611246565b92915050565b5f67ffffffffffffffff82169050919050565b61128a8161126e565b82525050565b5f6020820190506112a35f830184611281565b92915050565b5f8115159050919050565b6112bd816112a9565b82525050565b5f6020820190506112d65f8301846112b4565b92915050565b6112e581611215565b81146112ef575f80fd5b50565b5f81359050611300816112dc565b92915050565b5f6020828403121561131b5761131a61118c565b5b5f611328848285016112f2565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61136882611215565b915061137383611215565b925082820390508181111561138b5761138a611331565b5b92915050565b5f61139b82611215565b91506113a683611215565b92508282019050808211156113be576113bd611331565b5b92915050565b5f6113ce82611215565b91506113d983611215565b92508282026113e781611215565b915082820484148315176113fe576113fd611331565b5b5092915050565b5f82825260208201905092915050565b7f416c7265616479206c6f636b656420746f6b656e7300000000000000000000005f82015250565b5f611449601583611405565b915061145482611415565b602082019050919050565b5f6020820190508181035f8301526114768161143d565b9050919050565b7f43616e6e6f74206465706f736974203020746f6b656e730000000000000000005f82015250565b5f6114b1601783611405565b91506114bc8261147d565b602082019050919050565b5f6020820190508181035f8301526114de816114a5565b9050919050565b5f815190506114f3816112dc565b92915050565b5f6020828403121561150e5761150d61118c565b5b5f61151b848285016114e5565b91505092915050565b7f436f6e747261637420646f6573206e6f7420686f6c6420656e6f75676820746f5f8201527f6b656e7300000000000000000000000000000000000000000000000000000000602082015250565b5f61157e602483611405565b915061158982611524565b604082019050919050565b5f6020820190508181035f8301526115ab81611572565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6115e982611215565b91506115f483611215565b925082611604576116036115b2565b5b828204905092915050565b7f4e6f7468696e6720746f20756e6c6f636b0000000000000000000000000000005f82015250565b5f611643601183611405565b915061164e8261160f565b602082019050919050565b5f6020820190508181035f83015261167081611637565b9050919050565b5f60608201905061168a5f830186611246565b6116976020830185611246565b6116a4604083018461121e565b949350505050565b5f6040820190506116bf5f830185611246565b6116cc602083018461121e565b9392505050565b6116dc816112a9565b81146116e6575f80fd5b50565b5f815190506116f7816116d3565b92915050565b5f602082840312156117125761171161118c565b5b5f61171f848285016116e9565b91505092915050565b5f81519050919050565b5f81905092915050565b5f5b8381101561175957808201518184015260208101905061173e565b5f8484015250505050565b5f61176e82611728565b6117788185611732565b935061178881856020860161173c565b80840191505092915050565b5f61179f8284611764565b91508190509291505056fea264697066735822122040a4423f9166458e2c7977fc4224a822a031ecb1a83b3c1b625fb610b19fec6f64736f6c63430008140033

Verified Source Code Partial Match

Compiler: v0.8.20+commit.a1b79de6 EVM: shanghai Optimization: No
LakeVestingOTC1.sol 619 lines
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// File: @openzeppelin/contracts/utils/Address.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;




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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// File: LAKE_Vesting_OTC1.sol


pragma solidity = 0.8.20;


interface Token {
    function balanceOf(address) external view returns(uint);
}

contract LakeVestingOTC1 {
    address public immutable TOKEN_ADDRESS;  // ERC20 withdraw token contract address
    address public immutable DEPOSIT_TOKEN_ADDRESS;  // ERC-20 deposit token contract address
    address public constant BURN_ADDRESS =
        0x000000000000000000000000000000000000dEaD;  // Burn address

    uint256 public constant FULL_LOCKUP_PERIOD = 180 days;       // Time for each phase = 180 days
    uint256 public constant TIME_1_MONTH_ADJUSTED = 30 days;     // Time for each period = 30 days
    uint256 public constant TOTAL_WITHDRAWS = 12;                // Num periods = Max number of withdraws = 12
    uint256 public totalPendingToGet;                            // Total amount deposited and not withdrawn
    uint8 private constant NUM_EXTRA_PERIODS = 1;                // To be used when calculating the unlockable amount

    mapping(address => uint64) public lockingTime;      // Depositing time by an address
    mapping(address => uint256) public depositedAmount; // Total deposited ERC-20 tokens by an address
    mapping(address => uint256) public remainingAmount; // Remaining locked ERC-20 tokens by an address [deposited - withdrawn]
    mapping(address => uint256) public withdrawnAmount; // Total unlocked ERC-20 tokens by an address

    event Locked(address indexed, uint256 indexed amount);
    event Unlocked(address indexed, uint256 indexed amount);

    constructor(address _lockToken, address _unlockToken) {
        require(_lockToken != address(0) && _unlockToken != address(0), "Null address");
        DEPOSIT_TOKEN_ADDRESS = _lockToken;
        TOKEN_ADDRESS = _unlockToken;
    }

    /*
    Allows to deposit tokens [DEPOSIT_TOKEN_ADDRESS] by sender
    @param _amount: Amount to deposit.
    */
    function lock(uint256 _amount) external {
        require(lockingTime[msg.sender] == 0, "Already locked tokens");
        require(_amount > 0, "Cannot deposit 0 tokens");
        /* Check the contract holds enough tokens to withdraw by doing a externall call "balanceOf()", 
        which is a view function from a trusted contract (LAK3 token contract), avoiding "checks-effects-interactions" pattern violation risks */
        require(Token(TOKEN_ADDRESS).balanceOf(address(this)) >= _amount + totalPendingToGet , "Contract does not hold enough tokens");
        
        depositedAmount[msg.sender] = _amount;
        remainingAmount[msg.sender] = _amount;
        lockingTime[msg.sender] = uint64(block.timestamp);
        totalPendingToGet += _amount;

        SafeERC20.safeTransferFrom(IERC20(DEPOSIT_TOKEN_ADDRESS), msg.sender, BURN_ADDRESS, _amount);

        emit Locked(msg.sender, _amount);
    }

    /*
    Allows to withdraw all unlockable tokens [TOKEN_ADDRESS]
    */
    function unLock() external {
        uint256 _amount = getUnlockableAmount(msg.sender);
        require(_amount > 0, "Nothing to unlock");

        /* underflow/overflow cannot happen:
            - Max of _amount = remainingAmount
            - Max of withdrawnAmount = depositedAmount
            - Max of _amount = totalPendingToGet
        */
        unchecked {
            remainingAmount[msg.sender] -= _amount;
            withdrawnAmount[msg.sender] += _amount;
            totalPendingToGet -= _amount;
        }

        SafeERC20.safeTransfer(IERC20(TOKEN_ADDRESS), msg.sender, _amount);

        emit Unlocked(msg.sender, _amount);
    }

    /*
    Get the amount of unlockable tokens [TOKEN_ADDRESS]
    @param _wallet: Address to check
    */
    function getUnlockableAmount(address _wallet)
        public
        view
        returns (uint256)
    {
        if (remainingAmount[_wallet] == 0) return 0;
        if (block.timestamp - lockingTime[_wallet] < FULL_LOCKUP_PERIOD)
            return 0;

        uint256 numWithdraws = getNumUnlockPeriods(_wallet);
        uint256 _toSend = (numWithdraws * depositedAmount[_wallet]) /
            TOTAL_WITHDRAWS -
            withdrawnAmount[_wallet];

        if (
            _toSend > remainingAmount[_wallet] || 
            remainingAmount[_wallet] - _toSend < numWithdraws // decimals check (for the last withdraw) - 0,000000000000000012
        ) {
            _toSend = remainingAmount[_wallet];
        }
        return _toSend;
    }

    /*
    Get the number of unlockable periods (30 days)
    @param _wallet: Address to check
    */
    function getNumUnlockPeriods(address _wallet)
        internal
        view
        returns (uint256)
    {
        return
            (block.timestamp - lockingTime[_wallet] - FULL_LOCKUP_PERIOD) /
            TIME_1_MONTH_ADJUSTED +
            NUM_EXTRA_PERIODS;
    }

    /*
    Get if is in the unlocking phase or not
    @param _wallet: Address to check
    */
    function isInUnlockingMode(address _wallet) external view returns (bool) {
        if (remainingAmount[_wallet] == 0) return false;
        return (block.timestamp - lockingTime[_wallet] >= FULL_LOCKUP_PERIOD);
    }

    /*
    Get the time (in seconds) till the next unlock
    @param _wallet: Address to check
    returns 0 if remaining tokens is 0
    returns 0 if unlockable amount is greater than 0
    */
    function getTimeUntilNextUnlock(address _wallet)
        external
        view
        returns (uint256)
    {   
        uint _res = 0;
        if (
            remainingAmount[_wallet] == 0 ||
            getUnlockableAmount(_wallet) > 0 
        ){
            // must return 0
        }else if (block.timestamp - lockingTime[_wallet] < FULL_LOCKUP_PERIOD){
            _res = lockingTime[_wallet] + FULL_LOCKUP_PERIOD - block.timestamp;
        }else{
            uint256 numPeriods = getNumUnlockPeriods(_wallet);
            _res = lockingTime[_wallet] +
               FULL_LOCKUP_PERIOD +
               numPeriods *
               TIME_1_MONTH_ADJUSTED -
               block.timestamp;
        }
        return _res;

    }
}

Read Contract

BURN_ADDRESS 0xfccc2813 → address
DEPOSIT_TOKEN_ADDRESS 0xd8d818eb → address
FULL_LOCKUP_PERIOD 0x596b2b84 → uint256
TIME_1_MONTH_ADJUSTED 0x2293f973 → uint256
TOKEN_ADDRESS 0x0bdf5300 → address
TOTAL_WITHDRAWS 0x900e2b26 → uint256
depositedAmount 0x4a4643f7 → uint256
getTimeUntilNextUnlock 0x09afda18 → uint256
getUnlockableAmount 0xe680be4d → uint256
isInUnlockingMode 0x44227d35 → bool
lockingTime 0x3fbb2c01 → uint64
remainingAmount 0x5a849419 → uint256
totalPendingToGet 0xf3c0f4d7 → uint256
withdrawnAmount 0x10b20139 → uint256

Write Contract 2 functions

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

lock 0xdd467064
uint256 _amount
unLock 0xed10e33c
No parameters

Recent Transactions

No transactions found for this address