Sonic Blaze Testnet

Contract

0x28a41140A741835E3c3446a9c69AA14dD79FEe40

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Add151215812025-01-24 9:01:316 days ago1737709291IN
0x28a41140...dD79FEe40
0 S0.000110091.1
Add151215732025-01-24 9:01:286 days ago1737709288IN
0x28a41140...dD79FEe40
0 S0.000128881.1

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingContract

Compiler Version
v0.8.22+commit.4fc1097e

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : StakingContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/**
 * @title StakingContract
 * @dev Contract for staking ERC20 tokens and earning points redeemable for TestToken
 */
contract StakingContract is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    // Info of each user's stake for a token
    struct UserInfo {
        uint256 amount;         // How many tokens the user has staked
        uint256 points;         // Points accumulated
        uint256 lastUpdateTime; // Last time points were calculated
    }

    // Info of each stakeable token
    struct PoolInfo {
        IERC20 token;          // Address of staked token
        uint256 pointsPerShare; // Points earned per share (multiplied by 1e12)
        uint256 totalShares;    // Total amount of tokens staked
        bool isActive;          // Whether this pool is active
    }

    // Constants
    uint256 private constant POINTS_MULTIPLIER = 1e12;

    // State variables
    IERC20 public immutable testToken;        // TestToken for rewards
    uint256 public immutable endTimestamp;    // End time for points accumulation
    bool public claimingAllowed;              // Whether claiming is allowed
    PoolInfo[] public poolInfo;               // Info of each pool
    mapping(uint256 => mapping(address => UserInfo)) public userInfo; // pid => user address => info

    // Events
    event PoolAdded(uint256 indexed pid, address indexed token, uint256 pointsPerShare);
    event PoolUpdated(uint256 indexed pid, uint256 pointsPerShare);
    event Staked(address indexed user, uint256 indexed pid, uint256 amount);
    event Unstaked(address indexed user, uint256 indexed pid, uint256 amount);
    event PointsUpdated(address indexed user, uint256 indexed pid, uint256 points);
    event Claimed(address indexed user, uint256 amount);

    /**
     * @dev Constructor
     * @param _testToken TestToken address
     * @param _endTimestamp Timestamp when points accumulation ends
     */
    constructor(address _testToken, uint256 _endTimestamp) Ownable(msg.sender) {
        require(_endTimestamp > block.timestamp, "End timestamp must be in future");
        testToken = IERC20(_testToken);
        endTimestamp = _endTimestamp;
    }

    /**
     * @dev Add a new token pool
     * @param _token Token to stake
     * @param _pointsPerShare Points earned per share
     */
    function add(address _token, uint256 _pointsPerShare) external onlyOwner {
        require(_token != address(0), "Invalid token address");
        require(_pointsPerShare > 0, "Points per share must be > 0");

        poolInfo.push(PoolInfo({
            token: IERC20(_token),
            pointsPerShare: _pointsPerShare,
            totalShares: 0,
            isActive: true
        }));

        emit PoolAdded(poolInfo.length - 1, _token, _pointsPerShare);
    }

    /**
     * @dev Update points per share for a pool
     * @param _pid Pool ID
     * @param _pointsPerShare New points per share
     */
    function set(uint256 _pid, uint256 _pointsPerShare) external onlyOwner {
        require(_pid < poolInfo.length, "Pool does not exist");
        require(_pointsPerShare > 0, "Points per share must be > 0");

        poolInfo[_pid].pointsPerShare = _pointsPerShare;
        emit PoolUpdated(_pid, _pointsPerShare);
    }

    /**
     * @dev Enable/disable claiming of rewards
     */
    function setClaimingAllowed(bool _allowed) external onlyOwner {
        claimingAllowed = _allowed;
    }

    /**
     * @dev Stake tokens
     * @param _pid Pool ID
     * @param _amount Amount to stake
     */
    function stake(uint256 _pid, uint256 _amount) external nonReentrant {
        require(_pid < poolInfo.length, "Pool does not exist");
        require(block.timestamp < endTimestamp, "Staking period ended");
        
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(pool.isActive, "Pool is not active");
        require(_amount > 0, "Cannot stake 0");

        // Update user's points before modifying stake
        _updatePoints(_pid, msg.sender);

        // Transfer tokens
        pool.token.safeTransferFrom(msg.sender, address(this), _amount);
        
        user.amount += _amount;
        pool.totalShares += _amount;

        emit Staked(msg.sender, _pid, _amount);
    }

    /**
     * @dev Unstake tokens
     * @param _pid Pool ID
     * @param _amount Amount to unstake
     */
    function unstake(uint256 _pid, uint256 _amount) external nonReentrant {
        require(_pid < poolInfo.length, "Pool does not exist");
        
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(_amount > 0, "Cannot unstake 0");
        require(user.amount >= _amount, "Insufficient balance");

        // Update user's points before modifying stake
        _updatePoints(_pid, msg.sender);

        user.amount -= _amount;
        pool.totalShares -= _amount;

        // Transfer tokens back to user
        pool.token.safeTransfer(msg.sender, _amount);

        emit Unstaked(msg.sender, _pid, _amount);
    }

    /**
     * @dev Claim TestToken rewards based on points
     */
    function claim() external nonReentrant {
        require(block.timestamp >= endTimestamp, "Staking period not ended");
        require(claimingAllowed, "Claiming not allowed yet");

        uint256 totalPoints = 0;
        // Calculate total points across all pools
        for (uint256 pid = 0; pid < poolInfo.length; pid++) {
            _updatePoints(pid, msg.sender);
            UserInfo storage user = userInfo[pid][msg.sender];
            totalPoints += user.points;
            user.points = 0; // Reset points after claiming
        }

        require(totalPoints > 0, "No points to claim");

        // Calculate reward amount (1 point = 1 TestToken)
        uint256 rewardAmount = totalPoints;
        require(testToken.balanceOf(address(this)) >= rewardAmount, "Insufficient reward balance");

        // Transfer rewards
        testToken.safeTransfer(msg.sender, rewardAmount);

        emit Claimed(msg.sender, rewardAmount);
    }

    /**
     * @dev Update user's points
     * @param _pid Pool ID
     * @param _user User address
     */
    function _updatePoints(uint256 _pid, address _user) internal {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];

        if (user.amount == 0 || user.lastUpdateTime == 0) {
            user.lastUpdateTime = block.timestamp;
            return;
        }

        uint256 endTime = block.timestamp < endTimestamp ? block.timestamp : endTimestamp;
        if (endTime <= user.lastUpdateTime) return;

        uint256 timeElapsed = endTime - user.lastUpdateTime;
        uint256 points = 0;

        if (pool.totalShares > 0) {
            // Points are reduced as total shares increase
            points = (user.amount * pool.pointsPerShare * timeElapsed) / (pool.totalShares * POINTS_MULTIPLIER);
        }

        user.points += points;
        user.lastUpdateTime = block.timestamp;

        emit PointsUpdated(_user, _pid, points);
    }

    /**
     * @dev Get user's current points for a pool
     * @param _pid Pool ID
     * @param _user User address
     */
    function getUserPoints(uint256 _pid, address _user) external view returns (uint256) {
        UserInfo storage user = userInfo[_pid][_user];
        return user.points;
    }

    /**
     * @dev Get total points for a user across all pools
     * @param _user User address
     */
    function getTotalPoints(address _user) external view returns (uint256) {
        uint256 totalPoints = 0;
        for (uint256 pid = 0; pid < poolInfo.length; pid++) {
            UserInfo storage user = userInfo[pid][_user];
            totalPoints += user.points;
        }
        return totalPoints;
    }

    /**
     * @dev Get number of pools
     */
    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }
}

File 2 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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 3 of 10 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 4 of 10 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 5 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 6 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 7 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 8 of 10 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 10 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 10 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_testToken","type":"address"},{"internalType":"uint256","name":"_endTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"points","type":"uint256"}],"name":"PointsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"pointsPerShare","type":"uint256"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pointsPerShare","type":"uint256"}],"name":"PoolUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_pointsPerShare","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimingAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getTotalPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"getUserPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"pointsPerShare","type":"uint256"},{"internalType":"uint256","name":"totalShares","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_pointsPerShare","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_allowed","type":"bool"}],"name":"setClaimingAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"testToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"}],"stateMutability":"view","type":"function"}]

60c060405234801561001057600080fd5b506040516113fd3803806113fd83398101604081905261002f91610119565b338061005657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61005f816100c9565b50600180554281116100b35760405162461bcd60e51b815260206004820152601f60248201527f456e642074696d657374616d70206d75737420626520696e2066757475726500604482015260640161004d565b6001600160a01b0390911660805260a052610153565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806040838503121561012c57600080fd5b82516001600160a01b038116811461014357600080fd5b6020939093015192949293505050565b60805160a05161125b6101a2600039600081816102b1015281816104850152818161078301528181610dd60152610dfd0152600081816101cb015281816105f401526106c2015261125b6000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a257806393faf4fb1161007157806393faf4fb146102865780639e2c8a5b14610299578063a85adeab146102ac578063f2fde38b146102d3578063f5d82b6b146102e657600080fd5b8063715018a6146102055780637b0472f01461020d5780638da5cb5b1461022057806393f1a40b1461023157600080fd5b80634e71d92d116100de5780634e71d92d1461018e5780635d73311e14610196578063673f200a146101a95780636895179d146101c657600080fd5b8063081e3eda146101105780631088ce90146101275780631526fe271461013a5780631ab06ee514610179575b600080fd5b6003545b6040519081526020015b60405180910390f35b61011461013536600461107f565b6102f9565b61014d6101483660046110a1565b61034b565b604080516001600160a01b0390951685526020850193909352918301521515606082015260800161011e565b61018c6101873660046110ba565b610392565b005b61018c61047b565b61018c6101a43660046110dc565b61072b565b6002546101b69060ff1681565b604051901515815260200161011e565b6101ed7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161011e565b61018c610746565b61018c61021b3660046110ba565b610758565b6000546001600160a01b03166101ed565b61026b61023f3660046110fe565b600460209081526000928352604080842090915290825290208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161011e565b6101146102943660046110fe565b61094b565b61018c6102a73660046110ba565b610978565b6101147f000000000000000000000000000000000000000000000000000000000000000081565b61018c6102e136600461107f565b610aee565b61018c6102f436600461112a565b610b2c565b600080805b6003548110156103445760008181526004602090815260408083206001600160a01b038816845290915290206001810154610339908461116a565b9250506001016102fe565b5092915050565b6003818154811061035b57600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919060ff1684565b61039a610d12565b60035482106103c45760405162461bcd60e51b81526004016103bb9061117d565b60405180910390fd5b600081116104145760405162461bcd60e51b815260206004820152601c60248201527f506f696e747320706572207368617265206d757374206265203e20300000000060448201526064016103bb565b8060038381548110610428576104286111aa565b906000526020600020906004020160010181905550817f7fa9647ec1cc14e3822b46d05a2b9d4e019bde8875c0088c46b6503d71bf17228260405161046f91815260200190565b60405180910390a25050565b610483610d3f565b7f00000000000000000000000000000000000000000000000000000000000000004210156104f35760405162461bcd60e51b815260206004820152601860248201527f5374616b696e6720706572696f64206e6f7420656e646564000000000000000060448201526064016103bb565b60025460ff166105455760405162461bcd60e51b815260206004820152601860248201527f436c61696d696e67206e6f7420616c6c6f77656420796574000000000000000060448201526064016103bb565b6000805b6003548110156105955761055d8133610d69565b600081815260046020908152604080832033845290915290206001810154610585908461116a565b6000600192830155925001610549565b50600081116105db5760405162461bcd60e51b81526020600482015260126024820152714e6f20706f696e747320746f20636c61696d60701b60448201526064016103bb565b6040516370a0823160e01b8152306004820152819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610643573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066791906111c0565b10156106b55760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e74207265776172642062616c616e6365000000000060448201526064016103bb565b6106e96001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610eff565b60405181815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9060200160405180910390a2505061072960018055565b565b610733610d12565b6002805460ff1916911515919091179055565b61074e610d12565b6107296000610f63565b610760610d3f565b60035482106107815760405162461bcd60e51b81526004016103bb9061117d565b7f000000000000000000000000000000000000000000000000000000000000000042106107e75760405162461bcd60e51b815260206004820152601460248201527314dd185ada5b99c81c195c9a5bd908195b99195960621b60448201526064016103bb565b6000600383815481106107fc576107fc6111aa565b6000918252602080832086845260048083526040808620338752909352919093209102909101600381015490925060ff1661086e5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c206973206e6f742061637469766560701b60448201526064016103bb565b600083116108af5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016103bb565b6108b98433610d69565b81546108d0906001600160a01b0316333086610fb3565b828160000160008282546108e4919061116a565b92505081905550828260020160008282546108ff919061116a565b9091555050604051838152849033907f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90906020015b60405180910390a3505061094760018055565b5050565b60008281526004602090815260408083206001600160a01b03851684529091529020600101545b92915050565b610980610d3f565b60035482106109a15760405162461bcd60e51b81526004016103bb9061117d565b6000600383815481106109b6576109b66111aa565b6000918252602080832086845260048083526040808620338752909352919093209102909101915082610a1e5760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f7420756e7374616b6520360841b60448201526064016103bb565b8054831115610a665760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016103bb565b610a708433610d69565b82816000016000828254610a8491906111d9565b9250508190555082826002016000828254610a9f91906111d9565b90915550508154610aba906001600160a01b03163385610eff565b604051838152849033907f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e90602001610934565b610af6610d12565b6001600160a01b038116610b2057604051631e4fbdf760e01b8152600060048201526024016103bb565b610b2981610f63565b50565b610b34610d12565b6001600160a01b038216610b825760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420746f6b656e206164647265737360581b60448201526064016103bb565b60008111610bd25760405162461bcd60e51b815260206004820152601c60248201527f506f696e747320706572207368617265206d757374206265203e20300000000060448201526064016103bb565b604080516080810182526001600160a01b038481168083526020830185815260009484018581526001606086018181526003805480840182559881905296517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b600490990298890180546001600160a01b031916919097161790955591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c870155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d86015591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e909401805460ff1916941515949094179093559054610cdb91906111d9565b6040518381527f6c5d0ef1d0199b6de41ecbce95f59643be4d723ca363faf92d756e61e82fb13e9060200160405180910390a35050565b6000546001600160a01b031633146107295760405163118cdaa760e01b81523360048201526024016103bb565b600260015403610d6257604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b600060038381548110610d7e57610d7e6111aa565b60009182526020808320868452600480835260408086206001600160a01b03891687529093529190932080549290910290920192501580610dc157506002810154155b15610dd25742600290910155505050565b60007f00000000000000000000000000000000000000000000000000000000000000004210610e21577f0000000000000000000000000000000000000000000000000000000000000000610e23565b425b905081600201548111610e37575050505050565b6000826002015482610e4991906111d9565b905060008085600201541115610e975764e8d4a510008560020154610e6e91906111ec565b600186015485548491610e80916111ec565b610e8a91906111ec565b610e949190611203565b90505b80846001016000828254610eab919061116a565b909155505042600285015560405181815287906001600160a01b038816907feceb10b266995afd3009502df537b0421b7f635dd268f4b0a74b99a87be652139060200160405180910390a350505050505050565b6040516001600160a01b03838116602483015260448201839052610f5e91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610ff2565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052610fec9186918216906323b872dd90608401610f2c565b50505050565b600080602060008451602086016000885af180611015576040513d6000823e3d81fd5b50506000513d9150811561102d57806001141561103a565b6001600160a01b0384163b155b15610fec57604051635274afe760e01b81526001600160a01b03851660048201526024016103bb565b80356001600160a01b038116811461107a57600080fd5b919050565b60006020828403121561109157600080fd5b61109a82611063565b9392505050565b6000602082840312156110b357600080fd5b5035919050565b600080604083850312156110cd57600080fd5b50508035926020909101359150565b6000602082840312156110ee57600080fd5b8135801515811461109a57600080fd5b6000806040838503121561111157600080fd5b8235915061112160208401611063565b90509250929050565b6000806040838503121561113d57600080fd5b61114683611063565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561097257610972611154565b602080825260139082015272141bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156111d257600080fd5b5051919050565b8181038181111561097257610972611154565b808202811582820484141761097257610972611154565b60008261122057634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220afbb9e740c2714580cf99a49fbd597b7c58d35112d2162f056b6ba2f559ee66e64736f6c63430008160033000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a2117300000000000000000000000000000000000000000000000000000000069748a62

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a257806393faf4fb1161007157806393faf4fb146102865780639e2c8a5b14610299578063a85adeab146102ac578063f2fde38b146102d3578063f5d82b6b146102e657600080fd5b8063715018a6146102055780637b0472f01461020d5780638da5cb5b1461022057806393f1a40b1461023157600080fd5b80634e71d92d116100de5780634e71d92d1461018e5780635d73311e14610196578063673f200a146101a95780636895179d146101c657600080fd5b8063081e3eda146101105780631088ce90146101275780631526fe271461013a5780631ab06ee514610179575b600080fd5b6003545b6040519081526020015b60405180910390f35b61011461013536600461107f565b6102f9565b61014d6101483660046110a1565b61034b565b604080516001600160a01b0390951685526020850193909352918301521515606082015260800161011e565b61018c6101873660046110ba565b610392565b005b61018c61047b565b61018c6101a43660046110dc565b61072b565b6002546101b69060ff1681565b604051901515815260200161011e565b6101ed7f000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a21173081565b6040516001600160a01b03909116815260200161011e565b61018c610746565b61018c61021b3660046110ba565b610758565b6000546001600160a01b03166101ed565b61026b61023f3660046110fe565b600460209081526000928352604080842090915290825290208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161011e565b6101146102943660046110fe565b61094b565b61018c6102a73660046110ba565b610978565b6101147f0000000000000000000000000000000000000000000000000000000069748a6281565b61018c6102e136600461107f565b610aee565b61018c6102f436600461112a565b610b2c565b600080805b6003548110156103445760008181526004602090815260408083206001600160a01b038816845290915290206001810154610339908461116a565b9250506001016102fe565b5092915050565b6003818154811061035b57600080fd5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919060ff1684565b61039a610d12565b60035482106103c45760405162461bcd60e51b81526004016103bb9061117d565b60405180910390fd5b600081116104145760405162461bcd60e51b815260206004820152601c60248201527f506f696e747320706572207368617265206d757374206265203e20300000000060448201526064016103bb565b8060038381548110610428576104286111aa565b906000526020600020906004020160010181905550817f7fa9647ec1cc14e3822b46d05a2b9d4e019bde8875c0088c46b6503d71bf17228260405161046f91815260200190565b60405180910390a25050565b610483610d3f565b7f0000000000000000000000000000000000000000000000000000000069748a624210156104f35760405162461bcd60e51b815260206004820152601860248201527f5374616b696e6720706572696f64206e6f7420656e646564000000000000000060448201526064016103bb565b60025460ff166105455760405162461bcd60e51b815260206004820152601860248201527f436c61696d696e67206e6f7420616c6c6f77656420796574000000000000000060448201526064016103bb565b6000805b6003548110156105955761055d8133610d69565b600081815260046020908152604080832033845290915290206001810154610585908461116a565b6000600192830155925001610549565b50600081116105db5760405162461bcd60e51b81526020600482015260126024820152714e6f20706f696e747320746f20636c61696d60701b60448201526064016103bb565b6040516370a0823160e01b8152306004820152819081907f000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a2117306001600160a01b0316906370a0823190602401602060405180830381865afa158015610643573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066791906111c0565b10156106b55760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e74207265776172642062616c616e6365000000000060448201526064016103bb565b6106e96001600160a01b037f000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a211730163383610eff565b60405181815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9060200160405180910390a2505061072960018055565b565b610733610d12565b6002805460ff1916911515919091179055565b61074e610d12565b6107296000610f63565b610760610d3f565b60035482106107815760405162461bcd60e51b81526004016103bb9061117d565b7f0000000000000000000000000000000000000000000000000000000069748a6242106107e75760405162461bcd60e51b815260206004820152601460248201527314dd185ada5b99c81c195c9a5bd908195b99195960621b60448201526064016103bb565b6000600383815481106107fc576107fc6111aa565b6000918252602080832086845260048083526040808620338752909352919093209102909101600381015490925060ff1661086e5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c206973206e6f742061637469766560701b60448201526064016103bb565b600083116108af5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016103bb565b6108b98433610d69565b81546108d0906001600160a01b0316333086610fb3565b828160000160008282546108e4919061116a565b92505081905550828260020160008282546108ff919061116a565b9091555050604051838152849033907f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90906020015b60405180910390a3505061094760018055565b5050565b60008281526004602090815260408083206001600160a01b03851684529091529020600101545b92915050565b610980610d3f565b60035482106109a15760405162461bcd60e51b81526004016103bb9061117d565b6000600383815481106109b6576109b66111aa565b6000918252602080832086845260048083526040808620338752909352919093209102909101915082610a1e5760405162461bcd60e51b815260206004820152601060248201526f043616e6e6f7420756e7374616b6520360841b60448201526064016103bb565b8054831115610a665760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016103bb565b610a708433610d69565b82816000016000828254610a8491906111d9565b9250508190555082826002016000828254610a9f91906111d9565b90915550508154610aba906001600160a01b03163385610eff565b604051838152849033907f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e90602001610934565b610af6610d12565b6001600160a01b038116610b2057604051631e4fbdf760e01b8152600060048201526024016103bb565b610b2981610f63565b50565b610b34610d12565b6001600160a01b038216610b825760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420746f6b656e206164647265737360581b60448201526064016103bb565b60008111610bd25760405162461bcd60e51b815260206004820152601c60248201527f506f696e747320706572207368617265206d757374206265203e20300000000060448201526064016103bb565b604080516080810182526001600160a01b038481168083526020830185815260009484018581526001606086018181526003805480840182559881905296517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b600490990298890180546001600160a01b031916919097161790955591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c870155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d86015591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e909401805460ff1916941515949094179093559054610cdb91906111d9565b6040518381527f6c5d0ef1d0199b6de41ecbce95f59643be4d723ca363faf92d756e61e82fb13e9060200160405180910390a35050565b6000546001600160a01b031633146107295760405163118cdaa760e01b81523360048201526024016103bb565b600260015403610d6257604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b600060038381548110610d7e57610d7e6111aa565b60009182526020808320868452600480835260408086206001600160a01b03891687529093529190932080549290910290920192501580610dc157506002810154155b15610dd25742600290910155505050565b60007f0000000000000000000000000000000000000000000000000000000069748a624210610e21577f0000000000000000000000000000000000000000000000000000000069748a62610e23565b425b905081600201548111610e37575050505050565b6000826002015482610e4991906111d9565b905060008085600201541115610e975764e8d4a510008560020154610e6e91906111ec565b600186015485548491610e80916111ec565b610e8a91906111ec565b610e949190611203565b90505b80846001016000828254610eab919061116a565b909155505042600285015560405181815287906001600160a01b038816907feceb10b266995afd3009502df537b0421b7f635dd268f4b0a74b99a87be652139060200160405180910390a350505050505050565b6040516001600160a01b03838116602483015260448201839052610f5e91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610ff2565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052610fec9186918216906323b872dd90608401610f2c565b50505050565b600080602060008451602086016000885af180611015576040513d6000823e3d81fd5b50506000513d9150811561102d57806001141561103a565b6001600160a01b0384163b155b15610fec57604051635274afe760e01b81526001600160a01b03851660048201526024016103bb565b80356001600160a01b038116811461107a57600080fd5b919050565b60006020828403121561109157600080fd5b61109a82611063565b9392505050565b6000602082840312156110b357600080fd5b5035919050565b600080604083850312156110cd57600080fd5b50508035926020909101359150565b6000602082840312156110ee57600080fd5b8135801515811461109a57600080fd5b6000806040838503121561111157600080fd5b8235915061112160208401611063565b90509250929050565b6000806040838503121561113d57600080fd5b61114683611063565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561097257610972611154565b602080825260139082015272141bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156111d257600080fd5b5051919050565b8181038181111561097257610972611154565b808202811582820484141761097257610972611154565b60008261122057634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220afbb9e740c2714580cf99a49fbd597b7c58d35112d2162f056b6ba2f559ee66e64736f6c63430008160033

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

000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a2117300000000000000000000000000000000000000000000000000000000069748a62

-----Decoded View---------------
Arg [0] : _testToken (address): 0xE54F7a1521a15c1Ad95F60E54F6fFc6D6A211730
Arg [1] : _endTimestamp (uint256): 1769245282

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000e54f7a1521a15c1ad95f60e54f6ffc6d6a211730
Arg [1] : 0000000000000000000000000000000000000000000000000000000069748a62


Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.