Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x45DbFa00955178a886bD1289835152456a2BC86c
Balance 0 ETH
Nonce 1
Code Size 3955 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3955 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063adeae8c9116100b8578063e7fa9f7d1161007c578063e7fa9f7d14610285578063eded3fda1461028e578063f2f3d09214610296578063f2fde38b146102a1578063f6153ccd146102b4578063fc6d2cf7146102bd57600080fd5b8063adeae8c914610251578063bcee77e814610259578063d66d9e1914610261578063dd429cb114610269578063e47ea99b1461027a57600080fd5b8063715018a61161010a578063715018a6146101e757806383625f9a146101ef5780638da5cb5b146101f757806394d7a821146102085780639c8957b114610236578063a59f3e0c1461023e57600080fd5b806323e3fbd514610147578063469a694714610183578063597fb91514610196578063688c3e401461019e5780636baa9575146101dd575b600080fd5b610170610155366004610dfe565b6001600160a01b031660009081526004602052604090205490565b6040519081526020015b60405180910390f35b610170610191366004610dfe565b6102e6565b610170605081565b6101c57f000000000000000000000000df09a216fac5adc3e640db418c0b95607650950381565b6040516001600160a01b03909116815260200161017a565b6101e561036f565b005b6101e5610518565b610170605a81565b6000546001600160a01b03166101c5565b61021b610216366004610e50565b61054e565b6040805193845260208401929092529082015260600161017a565b6101706105f5565b6101e561024c366004610e50565b61060d565b610170604181565b6101706108e6565b6101e56108fb565b6101706914c0973485bf3940000081565b6101706363a2f54081565b61017060015481565b610170610a68565b6101706303c2670081565b6101e56102af366004610dfe565b610b25565b61017060025481565b6101706102cb366004610dfe565b6001600160a01b031660009081526003602052604090205490565b6001600160a01b0381166000908152600560205260408120546103415760405162461bcd60e51b815260206004820152600e60248201526d139bc819195c1bdcda5d081e595d60921b60448201526064015b60405180910390fd5b6001600160a01b038216600090815260056020526040902054610369906303c2670090610eb7565b92915050565b6000546001600160a01b031633146103995760405162461bcd60e51b815260040161033890610e82565b6103a86303c267006002610ef1565b6103b6906363a2f540610eb7565b4210156103f65760405162461bcd60e51b815260206004820152600e60248201526d139bdd081b9959591959081e595d60921b6044820152606401610338565b6040516370a0823160e01b81523060048201527f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095036001600160a01b03169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561045f57600080fd5b505afa158015610473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190610e69565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156104dd57600080fd5b505af11580156104f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105159190610e2e565b50565b6000546001600160a01b031633146105425760405162461bcd60e51b815260040161033890610e82565b61054c6000610bb9565b565b600080806105676914c0973485bf394000006064610ef1565b841115610590576105836914c0973485bf394000006064610ef1565b61058d9085610f10565b90505b6105a56914c0973485bf39400000600a610ef1565b8411156105d8576105c16914c0973485bf39400000600a610ef1565b6105cb8286610f10565b6105d59190610f10565b91505b816105e38286610f10565b6105ed9190610f10565b949193509150565b61060a6914c0973485bf39400000600a610ef1565b81565b6363a2f54042106106575760405162461bcd60e51b8152602060048201526014602482015273131bd8dada5b99c81c195c9a5bd908195b99195960621b6044820152606401610338565b60006106633383610c09565b336000908152600460205260408120549192506106808383610eb7565b90506914c0973485bf394000008110156106dc5760405162461bcd60e51b815260206004820181905260248201527f416d6f756e74206c657373207468616e206d696e696d756d206465706f7369746044820152606401610338565b60008060006106ea8561054e565b92509250925060008060006106fe8761054e565b9194509250905060006107118785610f10565b9050600061071f8785610f10565b9050600061072d8785610f10565b90508a610747573360009081526005602052604090204290555b600042610753336102e6565b61075d9190610f10565b9050600084156107ad576107766303c267006064610ef1565b82610782604188610ef1565b61078c9190610ef1565b6107969190610ecf565b6107a09086610eb7565b6107aa9082610eb7565b90505b83156107f9576107c26303c267006064610ef1565b826107ce605087610ef1565b6107d89190610ef1565b6107e29190610ecf565b6107ec9085610eb7565b6107f69082610eb7565b90505b82156108455761080e6303c267006064610ef1565b8261081a605a86610ef1565b6108249190610ef1565b61082e9190610ecf565b6108389084610eb7565b6108429082610eb7565b90505b8d60046000336001600160a01b03166001600160a01b03168152602001908152602001600020600082825461087a9190610eb7565b925050819055508d600260008282546108939190610eb7565b909155505033600090815260036020526040812080548392906108b7908490610eb7565b9250508190555080600160008282546108d09190610eb7565b9091555050505050505050505050505050505050565b61060a6914c0973485bf394000006064610ef1565b610904336102e6565b4210156109465760405162461bcd60e51b815260206004820152601060248201526f139bdd081d5b9b1bd8dad959081e595d60821b6044820152606401610338565b336000908152600360205260409020548061099b5760405162461bcd60e51b8152602060048201526015602482015274139bc81c195b991a5b99c81dda5d1a191c985dd85b605a1b6044820152606401610338565b336000908152600360205260408120819055600180548392906109bf908490610f10565b909155505060405163a9059cbb60e01b8152336004820152602481018290527f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095036001600160a01b03169063a9059cbb90604401602060405180830381600087803b158015610a2c57600080fd5b505af1158015610a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a649190610e2e565b5050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000df09a216fac5adc3e640db418c0b95607650950316906370a082319060240160206040518083038186803b158015610acc57600080fd5b505afa158015610ae0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b049190610e69565b9050806001541115610b215780600154610b1e9190610f10565b91505b5090565b6000546001600160a01b03163314610b4f5760405162461bcd60e51b815260040161033890610e82565b6001600160a01b038116610bb45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610338565b610515815b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000df09a216fac5adc3e640db418c0b95607650950316906370a082319060240160206040518083038186803b158015610c6d57600080fd5b505afa158015610c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca59190610e69565b6040516323b872dd60e01b81526001600160a01b038681166004830152306024830152604482018690529192507f000000000000000000000000df09a216fac5adc3e640db418c0b956076509503909116906323b872dd90606401602060405180830381600087803b158015610d1a57600080fd5b505af1158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d529190610e2e565b506040516370a0823160e01b815230600482015281907f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095036001600160a01b0316906370a082319060240160206040518083038186803b158015610db457600080fd5b505afa158015610dc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dec9190610e69565b610df69190610f10565b949350505050565b600060208284031215610e1057600080fd5b81356001600160a01b0381168114610e2757600080fd5b9392505050565b600060208284031215610e4057600080fd5b81518015158114610e2757600080fd5b600060208284031215610e6257600080fd5b5035919050565b600060208284031215610e7b57600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610eca57610eca610f27565b500190565b600082610eec57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610f0b57610f0b610f27565b500290565b600082821015610f2257610f22610f27565b500390565b634e487b7160e01b600052601160045260246000fdfea26469706673582212201e2378fb326595bfb9cd6e4f64531f3c87be3068d35d44f135ffb970a3ccd3d064736f6c63430008070033

Verified Source Code Partial Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (200 runs)
LockedPool24.sol 287 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

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

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

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

// This contract handles locking PKN to get rewards
contract LockedPool24 is Ownable {

    uint256 public constant TIER_MIN = 98000 * 10**18;
    uint256 public constant TIER_MID = TIER_MIN * 10;
    uint256 public constant TIER_MAX = TIER_MIN * 100;
    
    uint256 public constant REWARD_MIN = 65;
    uint256 public constant REWARD_MID = 80;
    uint256 public constant REWARD_MAX = 90;

    uint256 public constant TOTAL_DURATION = 730 days;
    uint256 public constant ENTRY_LIMIT = 1671624000; // Wednesday, December 21, 2022 12:00:00 PM GMT

    uint256 public totalOwed;
    uint256 public totalDeposit;

    mapping(address => uint256) private userOwed;
    mapping(address => uint256) private userDeposit;
    mapping(address => uint256) private userFirstTS;

    IERC20 public immutable PKN;

    constructor(IERC20 _PKN) {
        PKN = _PKN;
    }

    function splitTiers(uint256 amount) public pure returns(uint256 tA, uint256 tB, uint256 tC) {
        if(amount > TIER_MAX) {
            tC = amount - TIER_MAX;
        }
        if(amount > TIER_MID) {
            tB = amount - tC - TIER_MID;
        }
        tA = amount - tC - tB;
    }

    function depositOf(address account) public view returns (uint256) {
        return userDeposit[account];
    }

    function totalRewardOf(address account) public view returns (uint256) {
        return userOwed[account];
    }

    function unlockTimeOf(address account) public view returns (uint256) {
        require(userFirstTS[account] != 0, "No deposit yet");
        return userFirstTS[account] + TOTAL_DURATION;
    }

    function pendingRewards() external view returns(uint256 pending) {
        uint256 currentBalance = PKN.balanceOf(address(this));
        if(totalOwed > currentBalance) {
            pending = totalOwed - currentBalance;
        }
    }

    function enter(uint256 _amount) external {
        require(block.timestamp < ENTRY_LIMIT, "Locking period ended");

        uint256 amount = _receivePKN(msg.sender, _amount);
        uint256 uDeposit = userDeposit[msg.sender];
        uint256 uTotal = uDeposit + amount;

        require(uTotal >= TIER_MIN, "Amount less than minimum deposit");

        (uint256 depA, uint256 depB, uint256 depC) = splitTiers(uDeposit);
        (uint256 totA, uint256 totB, uint256 totC) = splitTiers(uTotal);

        uint256 amtA = totA - depA;
        uint256 amtB = totB - depB;
        uint256 amtC = totC - depC;

        if(uDeposit == 0) {
            // first deposit for this user
            userFirstTS[msg.sender] = block.timestamp;
        }

        uint256 remainingTime = unlockTimeOf(msg.sender) - block.timestamp;
        uint256 owed;
        if(amtA > 0) {
            owed += amtA + amtA * REWARD_MIN * remainingTime / (100 * TOTAL_DURATION);
        }

        if(amtB > 0) {
            owed += amtB + amtB * REWARD_MID * remainingTime / (100 * TOTAL_DURATION);
        }

        if(amtC > 0) {
            owed += amtC + amtC * REWARD_MAX * remainingTime / (100 * TOTAL_DURATION);
        }

        userDeposit[msg.sender] += amount;
        totalDeposit += amount;
        userOwed[msg.sender] += owed;
        totalOwed += owed;
    }

    function leave() external {
        require(block.timestamp >= unlockTimeOf(msg.sender), "Not unlocked yet");

        uint256 amount = userOwed[msg.sender];
        require(amount > 0, "No pending withdrawal");
        userOwed[msg.sender] = 0;
        totalOwed -= amount;
        PKN.transfer(msg.sender, amount);
    }

    // only to be called in an emergency after a wait period of 2 * TOTAL_DURATION
    function emergencyRescue() external onlyOwner() {
        require(block.timestamp >= ENTRY_LIMIT + 2 * TOTAL_DURATION, "Not needed yet");
        PKN.transfer(msg.sender, PKN.balanceOf(address(this)));
    }

    function _receivePKN(address from, uint256 amount) internal returns (uint256) {
        uint256 balanceBefore = PKN.balanceOf(address(this));
        PKN.transferFrom(from, address(this), amount);
        return PKN.balanceOf(address(this)) - balanceBefore;
    }
}

Read Contract

ENTRY_LIMIT 0xe47ea99b → uint256
PKN 0x688c3e40 → address
REWARD_MAX 0x83625f9a → uint256
REWARD_MID 0x597fb915 → uint256
REWARD_MIN 0xadeae8c9 → uint256
TIER_MAX 0xbcee77e8 → uint256
TIER_MID 0x9c8957b1 → uint256
TIER_MIN 0xdd429cb1 → uint256
TOTAL_DURATION 0xf2f3d092 → uint256
depositOf 0x23e3fbd5 → uint256
owner 0x8da5cb5b → address
pendingRewards 0xeded3fda → uint256
splitTiers 0x94d7a821 → uint256, uint256, uint256
totalDeposit 0xf6153ccd → uint256
totalOwed 0xe7fa9f7d → uint256
totalRewardOf 0xfc6d2cf7 → uint256
unlockTimeOf 0x469a6947 → uint256

Write Contract 5 functions

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

emergencyRescue 0x6baa9575
No parameters
enter 0xa59f3e0c
uint256 _amount
leave 0xd66d9e19
No parameters
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address