ETH Price: $3,302.21 (-4.69%)

Contract

0x9a98E6B60784634AE273F2FB84519C7F1885AeD2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Stake214892442024-12-26 21:12:115 mins ago1735247531IN
Moca: Staking v1
0 ETH0.000747289.97015636
Unstake214892342024-12-26 21:10:117 mins ago1735247411IN
Moca: Staking v1
0 ETH0.000634017.13128507
Unstake214892132024-12-26 21:05:5911 mins ago1735247159IN
Moca: Staking v1
0 ETH0.000920137.77787849
Stake214891462024-12-26 20:52:2325 mins ago1735246343IN
Moca: Staking v1
0 ETH0.000658397.41089448
Stake214891092024-12-26 20:44:4732 mins ago1735245887IN
Moca: Staking v1
0 ETH0.000668086.30545786
Unstake214890792024-12-26 20:38:4738 mins ago1735245527IN
Moca: Staking v1
0 ETH0.000571686.43111815
Unstake214888062024-12-26 19:43:591 hr ago1735242239IN
Moca: Staking v1
0 ETH0.000566666.37199609
Stake214887942024-12-26 19:41:351 hr ago1735242095IN
Moca: Staking v1
0 ETH0.000553156.22630257
Stake214886872024-12-26 19:20:111 hr ago1735240811IN
Moca: Staking v1
0 ETH0.000578417.28933251
Stake214886832024-12-26 19:19:231 hr ago1735240763IN
Moca: Staking v1
0 ETH0.000454856.06767114
Stake214885522024-12-26 18:52:472 hrs ago1735239167IN
Moca: Staking v1
0 ETH0.000945168.65856551
Stake214883952024-12-26 18:21:112 hrs ago1735237271IN
Moca: Staking v1
0 ETH0.0008138610.85504393
Unstake214882992024-12-26 18:01:473 hrs ago1735236107IN
Moca: Staking v1
0 ETH0.001181439.98663649
Stake214881282024-12-26 17:27:233 hrs ago1735234043IN
Moca: Staking v1
0 ETH0.000868969.78114628
Unstake214879732024-12-26 16:56:234 hrs ago1735232183IN
Moca: Staking v1
0 ETH0.0008772810.43215822
Unstake214879722024-12-26 16:56:114 hrs ago1735232171IN
Moca: Staking v1
0 ETH0.0008973410.09323674
Stake214878972024-12-26 16:40:594 hrs ago1735231259IN
Moca: Staking v1
0 ETH0.000716869.5627658
Stake214878422024-12-26 16:29:594 hrs ago1735230599IN
Moca: Staking v1
0 ETH0.0009657612.88104084
Unstake214877522024-12-26 16:11:595 hrs ago1735229519IN
Moca: Staking v1
0 ETH0.00074328.36057095
Stake214875902024-12-26 15:39:235 hrs ago1735227563IN
Moca: Staking v1
0 ETH0.000674568.99851619
Unstake214871792024-12-26 14:17:117 hrs ago1735222631IN
Moca: Staking v1
0 ETH0.000472736.58347945
Unstake214871242024-12-26 14:06:117 hrs ago1735221971IN
Moca: Staking v1
0 ETH0.000476636.6389342
Stake214870742024-12-26 13:55:477 hrs ago1735221347IN
Moca: Staking v1
0 ETH0.000495966.61598028
Stake214869992024-12-26 13:40:477 hrs ago1735220447IN
Moca: Staking v1
0 ETH0.000681176.43124972
Stake214869962024-12-26 13:40:117 hrs ago1735220411IN
Moca: Staking v1
0 ETH0.000532157.1
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SimpleStaking

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 9 : SimpleStaking.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

import {SafeERC20, IERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable2Step, Ownable} from "./../lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {Pausable} from "./../lib/openzeppelin-contracts/contracts/utils/Pausable.sol";

contract SimpleStaking is Ownable2Step, Pausable {
    using SafeERC20 for IERC20;

    // interfaces 
    IERC20 internal immutable MOCA_TOKEN;
    // startTime
    uint256 internal immutable _startTime;

    // pool data 
    uint256 internal _totalStaked;
    uint256 internal _totalCumulativeWeight;
    uint256 internal _poolLastUpdateTimestamp; 

    struct Data {
        uint256 amount;
        uint256 cumulativeWeight;
        uint256 lastUpdateTimestamp;
    }

    mapping(address user => Data userData) internal _users;

    address internal _updater;

    // events 
    event Staked(address indexed user, uint256 amount);
    event Unstaked(address indexed user, uint256 amount);
    event StakedBehalf(address[] indexed users, uint256[] indexed amounts);


    constructor(address mocaToken, uint256 startTime_, address owner, address updater) Ownable(owner){
        // ensure startTime is not far-dated
        require(startTime_ <= block.timestamp + 30 days, "Far-dated start"); 
        require(startTime_ >= block.timestamp, "StartTime in past");

        MOCA_TOKEN = IERC20(mocaToken);
        
        _startTime = startTime_;

        _updater = updater;
    }


    /*//////////////////////////////////////////////////////////////
                                EXTERNAL
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice User to stake MocaTokens
     * @dev User can stake for another address of choice
     * @param amount Tokens to stake, 1e8 precision
     */
    function stake(uint256 amount) external whenNotPaused {
        require(amount > 0, "Zero amount");

        // cache
        Data memory userData_ = _users[msg.sender];
   
        // book pool's previous
        _updatePool();

        // book user's previous
        Data memory userData = _updateUserCumulativeWeight(userData_);
    
        // book inflow
        userData.amount += amount;
        _totalStaked += amount;

        // user: update storage
        _users[msg.sender] = userData;

        emit Staked(msg.sender, amount);
 
        // grab MOCA
        MOCA_TOKEN.safeTransferFrom(msg.sender, address(this), amount);
    }

    /**
     * @notice User to unstake MocaTokens
     * @param amount Tokens to unstake, 1e8 precision
     */
    function unstake(uint256 amount) external {
        require(block.timestamp >= _startTime, "Not started");
        require(amount > 0, "Zero amount");

        // cache
        Data memory userData_ = _users[msg.sender];

        // sanity checks
        require(userData_.amount >= amount, "Insufficient balance");

        // book pool's previous
        _updatePool();

        // book user's previous
        Data memory userData = _updateUserCumulativeWeight(userData_);

        // book outflow
        userData.amount -= amount;
        _totalStaked -= amount;      // sstore 

        // user: update state 
        _users[msg.sender] = userData;

        emit Unstaked(msg.sender, amount);

        // transfer moca
        MOCA_TOKEN.safeTransfer(msg.sender, amount);
    }

    /**
     * @notice Owner to stake on behalf of users for distribution
     * @dev Gas used: 84,805 for length =1, incrementing by 2600 for every additional loop
     * @param users Array of address 
     * @param amounts Array of stake amounts, 1e18 precision
     */
    function stakeBehalf(address[] calldata users, uint256[] calldata amounts) external whenNotPaused {
        require(msg.sender == _updater, "Incorrect caller");

        uint256 usersLength = users.length;
        uint256 amountLength = amounts.length;
        require(usersLength == amountLength, "Incorrect lengths");

        require(usersLength > 0, "Empty array");

        // book pool's previous
        _updatePool();

        uint256 totalAmount;
        for (uint256 i; i < usersLength; ++i){
            address onBehalfOf = users[i];
            uint256 amount = amounts[i];

            // cache
            Data memory userData_ = _users[onBehalfOf];
        
            // book user's previous
            Data memory userData = _updateUserCumulativeWeight(userData_);

            // book inflow
            userData.amount += amount;

            // user: update storage
            _users[onBehalfOf] = userData;

            // increment totalAmount
            totalAmount += amount;
        }
        
        emit StakedBehalf(users, amounts);

        _totalStaked += totalAmount;         //sstore

        // grab MOCA
        MOCA_TOKEN.safeTransferFrom(msg.sender, address(this), totalAmount);
    }

    /**
     * @notice Owner to pause contract
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @notice Owner to unpause contract
     */
    function unpause() external onlyOwner {
        _unpause();
    }
    
    /**
     * @notice Owner to change updater address
     * @param newUpdater new updater address
     */
    function changeUpdater(address newUpdater) external onlyOwner {
        _updater = newUpdater;
    }

    /*//////////////////////////////////////////////////////////////
                                INTERNAL
    //////////////////////////////////////////////////////////////*/

    function _updatePool() internal {
        
        // no update of the _poolLastUpdateTimestamp otherwise it can be set to before
        // _poolLastUpdateTimestamp =0, when t = startTime
        if (block.timestamp <= _startTime) {
            return; 
        }

        if(_totalStaked > 0){
            if(block.timestamp > _poolLastUpdateTimestamp){

                uint256 timeDelta = _getTimeDelta(block.timestamp, _poolLastUpdateTimestamp);
                uint256 unbookedWeight = timeDelta * _totalStaked;
                
                // sstore
                _totalCumulativeWeight += unbookedWeight;
            }
        }
        
        // sstore
        _poolLastUpdateTimestamp = block.timestamp;
    }

    function _updateUserCumulativeWeight(Data memory userData) internal returns(Data memory) {
        
        // staking not started: return early
        uint256 startTime = _startTime;
        if (block.timestamp <= startTime) {
            return userData;
        }

        // staking has begun
        if(userData.amount > 0){
            if(block.timestamp > userData.lastUpdateTimestamp){
                
                // timeDelta: 0 if staking has not begun 
                uint256 timeDelta = _getTimeDelta(block.timestamp, userData.lastUpdateTimestamp);
                uint256 unbookedWeight = timeDelta * userData.amount;

                // update user
                userData.cumulativeWeight += unbookedWeight;
            }
        }
        
        userData.lastUpdateTimestamp = block.timestamp;
        return userData;
    }

    function _getTimeDelta(uint256 to, uint256 from) internal view returns (uint256) {
        // cache
        uint256 startTime = _startTime;
        
        if(from < startTime){
            from = startTime;
        }

        return (to - from);
    }

    /*//////////////////////////////////////////////////////////////
                                GETTERS
    //////////////////////////////////////////////////////////////*/

    ///@notice returns moca token address    
    function getMocaToken() external view returns(address) {
        return address(MOCA_TOKEN);
    }

    ///@notice returns _startTime
    function getStartTime() external view returns(uint256) {
        return _startTime;
    }

    ///@notice returns _totalStaked
    function getTotalStaked() external view returns(uint256) {
        return _totalStaked;
    }

    ///@notice returns _totalCumulativeWeight
    function getTotalCumulativeWeight() external view returns(uint256) {
        return _totalCumulativeWeight;
    }

    ///@notice returns _poolLastUpdateTimestamp
    function getPoolLastUpdateTimestamp() external view returns(uint256) {
        return _poolLastUpdateTimestamp;
    }

    ///@notice returns user data struct
    function getUser(address user) external view returns(Data memory) {
        return _users[user];
    } 

    ///@notice returns user's cumulative weight
    ///@dev returns 0 if staking has not begun
    function getUserCumulativeWeight(address user) external view returns(uint256) {
        // cache
        Data memory userData = _users[user];

        // staking not started: return early
        if (block.timestamp <= _startTime) {
            return 0;
        }

        // calc. unbooked
        if(userData.amount > 0) {
            if(block.timestamp > userData.lastUpdateTimestamp){

                uint256 timeDelta = _getTimeDelta(block.timestamp, userData.lastUpdateTimestamp);

                uint256 unbookedWeight = userData.amount * timeDelta;
                return (userData.cumulativeWeight + unbookedWeight);
            }
        }

        // updated to latest, nothing unbooked 
        return userData.cumulativeWeight;
    }

    ///@notice returns pool's total cumulative weight (incl. pending)
    ///@dev returns 0 if staking has not begun
    function getPoolCumulativeWeight() external view returns(uint256) {

        // staking not started
        if (block.timestamp <= _startTime) {
            return 0; 
        }

        // calc. unbooked
        if(block.timestamp > _poolLastUpdateTimestamp){

            uint256 timeDelta = _getTimeDelta(block.timestamp, _poolLastUpdateTimestamp);

            uint256 unbookedWeight = _totalStaked * timeDelta;
            return (_totalCumulativeWeight + unbookedWeight);
        }

        // updated to latest, nothing unbooked 
        return _totalCumulativeWeight;
    }

    ///@notice returns _updater
    function getUpdater() external view returns(address){
        return _updater;
    }
}

File 2 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @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 3 of 9 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 4 of 9 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 5 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// 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 6 of 9 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// 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 7 of 9 : Address.sol
// SPDX-License-Identifier: MIT
// 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 8 of 9 : 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 9 of 9 : 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;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"mocaToken","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"updater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address[]","name":"users","type":"address[]"},{"indexed":true,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"StakedBehalf","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newUpdater","type":"address"}],"name":"changeUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMocaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolCumulativeWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolLastUpdateTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalCumulativeWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUser","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"cumulativeWeight","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"}],"internalType":"struct SimpleStaking.Data","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserCumulativeWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"stakeBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620015ad380380620015ad8339810160408190526200003491620001d1565b816001600160a01b0381166200006557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000708162000146565b506001805460ff60a01b191690556200008d4262278d0062000225565b831115620000d05760405162461bcd60e51b815260206004820152600f60248201526e11985c8b59185d1959081cdd185c9d608a1b60448201526064016200005c565b42831015620001165760405162461bcd60e51b815260206004820152601160248201527014dd185c9d151a5b59481a5b881c185cdd607a1b60448201526064016200005c565b6001600160a01b0393841660805260a09290925250600680546001600160a01b031916919092161790556200024d565b600180546001600160a01b0319169055620001618162000164565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001cc57600080fd5b919050565b60008060008060808587031215620001e857600080fd5b620001f385620001b4565b9350602085015192506200020a60408601620001b4565b91506200021a60608601620001b4565b905092959194509250565b808201808211156200024757634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a0516112fb620002b260003960008181610263015281816102e6015281816107ac01528181610a7701528181610b7401528181610c150152610deb0152600081816102c0015281816104af015281816107770152610a1201526112fb6000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806379ba5097116100b8578063aa0b39c71161007c578063aa0b39c714610259578063c828371e14610261578063e30c397814610287578063e786977114610298578063f2fde38b146102ab578063f6962a20146102be57600080fd5b806379ba5097146102005780638456cb59146102085780638da5cb5b1461021057806399d54d3914610235578063a694fc3a1461024657600080fd5b8063469ae374116100ff578063469ae3741461018b578063541251bd1461019e5780635c975abb146101a65780636f77926b146101c3578063715018a6146101f857600080fd5b80630917e7761461013c578063293c5e63146101535780632e17de781461015b578063326220bf146101705780633f4ba83a14610183575b600080fd5b6002545b6040519081526020015b60405180910390f35b600454610140565b61016e61016936600461109a565b6102e4565b005b61016e61017e3660046110cf565b6104db565b61016e610505565b61016e610199366004611136565b610517565b6101406107a8565b600154600160a01b900460ff16604051901515815260200161014a565b6101d66101d13660046110cf565b61081f565b604080518251815260208084015190820152918101519082015260600161014a565b61016e610885565b61016e610897565b61016e6108db565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161014a565b6006546001600160a01b031661021d565b61016e61025436600461109a565b6108eb565b600354610140565b7f0000000000000000000000000000000000000000000000000000000000000000610140565b6001546001600160a01b031661021d565b6101406102a63660046110cf565b610a3a565b61016e6102b93660046110cf565b610b01565b7f000000000000000000000000000000000000000000000000000000000000000061021d565b7f00000000000000000000000000000000000000000000000000000000000000004210156103475760405162461bcd60e51b815260206004820152600b60248201526a139bdd081cdd185c9d195960aa1b60448201526064015b60405180910390fd5b600081116103855760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015260640161033e565b3360009081526005602090815260409182902082516060810184528154808252600183015493820193909352600290910154928101929092528211156104045760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015260640161033e565b61040c610b72565b600061041782610bef565b9050828160000181815161042b91906111b8565b905250600280548491906000906104439084906111b8565b909155505033600081815260056020908152604091829020845181558482015160018201558483015160029091015590518581527f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75910160405180910390a26104d66001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385610c9c565b505050565b6104e3610cfb565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b61050d610cfb565b610515610d28565b565b61051f610d7d565b6006546001600160a01b0316331461056c5760405162461bcd60e51b815260206004820152601060248201526f24b731b7b93932b1ba1031b0b63632b960811b604482015260640161033e565b82818082146105b15760405162461bcd60e51b8152602060048201526011602482015270496e636f7272656374206c656e6774687360781b604482015260640161033e565b600082116105ef5760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b604482015260640161033e565b6105f7610b72565b6000805b838110156106f9576000888883818110610617576106176111cb565b905060200201602081019061062c91906110cf565b90506000878784818110610642576106426111cb565b6001600160a01b03851660009081526005602090815260408083208151606081018352815481526001820154818501526002909101549181019190915292029390930135935091905061069482610bef565b905082816000018181516106a891906111e1565b9052506001600160a01b03841660009081526005602090815260409182902083518155908301516001820155908201516002909101556106e883876111e1565b9550505050508060010190506105fb565b50848460405161070a9291906111f4565b6040518091039020878760405161072292919061121d565b604051908190038120907ff8a1448a8741accb69ef058349d251e0830b63a2fabfbada1059c05a286f619590600090a3806002600082825461076491906111e1565b9091555061079f90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333084610da8565b50505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000042116107d75750600090565b6004544211156108185760006107ef42600454610de7565b9050600081600254610801919061125d565b90508060035461081191906111e1565b9250505090565b5060035490565b61084360405180606001604052806000815260200160008152602001600081525090565b506001600160a01b0316600090815260056020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b61088d610cfb565b6105156000610e2a565b60015433906001600160a01b031681146108cf5760405163118cdaa760e01b81526001600160a01b038216600482015260240161033e565b6108d881610e2a565b50565b6108e3610cfb565b610515610e43565b6108f3610d7d565b600081116109315760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015260640161033e565b33600090815260056020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915261096f610b72565b600061097a82610bef565b9050828160000181815161098e91906111e1565b905250600280548491906000906109a69084906111e1565b909155505033600081815260056020908152604091829020845181558482015160018201558483015160029091015590518581527f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d910160405180910390a26104d66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086610da8565b6001600160a01b038116600090815260056020908152604080832081516060810183528154815260018201549381019390935260020154908201527f00000000000000000000000000000000000000000000000000000000000000004211610aa55750600092915050565b805115610af7578060400151421115610af7576000610ac8428360400151610de7565b90506000818360000151610adc919061125d565b9050808360200151610aee91906111e1565b95945050505050565b6020015192915050565b610b09610cfb565b600180546001600160a01b0383166001600160a01b03199091168117909155610b3a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b7f00000000000000000000000000000000000000000000000000000000000000004211610b9b57565b60025415610be957600454421115610be9576000610bbb42600454610de7565b9050600060025482610bcd919061125d565b90508060036000828254610be191906111e1565b909155505050505b42600455565b610c1360405180606001604052806000815260200160008152602001600081525090565b7f0000000000000000000000000000000000000000000000000000000000000000428110610c42575090919050565b825115610c91578260400151421115610c91576000610c65428560400151610de7565b8451909150600090610c77908361125d565b90508085602001818151610c8b91906111e1565b90525050505b505042604082015290565b6040516001600160a01b038381166024830152604482018390526104d691859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610e86565b6000546001600160a01b031633146105155760405163118cdaa760e01b815233600482015260240161033e565b610d30610ee9565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600154600160a01b900460ff16156105155760405163d93c066560e01b815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610de19186918216906323b872dd90608401610cc9565b50505050565b60007f000000000000000000000000000000000000000000000000000000000000000080831015610e16578092505b610e2083856111b8565b9150505b92915050565b600180546001600160a01b03191690556108d881610f13565b610e4b610d7d565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d603390565b6000610e9b6001600160a01b03841683610f63565b90508051600014158015610ec0575080806020019051810190610ebe9190611274565b155b156104d657604051635274afe760e01b81526001600160a01b038416600482015260240161033e565b600154600160a01b900460ff1661051557604051638dfc202b60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610f7183836000610f78565b9392505050565b606081471015610f9d5760405163cd78605960e01b815230600482015260240161033e565b600080856001600160a01b03168486604051610fb99190611296565b60006040518083038185875af1925050503d8060008114610ff6576040519150601f19603f3d011682016040523d82523d6000602084013e610ffb565b606091505b509150915061100b868383611015565b9695505050505050565b60608261102a5761102582611071565b610f71565b815115801561104157506001600160a01b0384163b155b1561106a57604051639996b31560e01b81526001600160a01b038516600482015260240161033e565b5080610f71565b8051156110815780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6000602082840312156110ac57600080fd5b5035919050565b80356001600160a01b03811681146110ca57600080fd5b919050565b6000602082840312156110e157600080fd5b610f71826110b3565b60008083601f8401126110fc57600080fd5b50813567ffffffffffffffff81111561111457600080fd5b6020830191508360208260051b850101111561112f57600080fd5b9250929050565b6000806000806040858703121561114c57600080fd5b843567ffffffffffffffff8082111561116457600080fd5b611170888389016110ea565b9096509450602087013591508082111561118957600080fd5b50611196878288016110ea565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610e2457610e246111a2565b634e487b7160e01b600052603260045260246000fd5b80820180821115610e2457610e246111a2565b60006001600160fb1b0383111561120a57600080fd5b8260051b80858437919091019392505050565b60008184825b85811015611252576001600160a01b0361123c836110b3565b1683526020928301929190910190600101611223565b509095945050505050565b8082028115828204841417610e2457610e246111a2565b60006020828403121561128657600080fd5b81518015158114610f7157600080fd5b6000825160005b818110156112b7576020818601810151858301520161129d565b50600092019182525091905056fea2646970667358221220525555baa637a967157864bd675429e183ac25b391b7ceb7b88fe8a1d673035464736f6c63430008180033000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c500000000000000000000000000000000000000000000000000000000668f9f1000000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d00000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101375760003560e01c806379ba5097116100b8578063aa0b39c71161007c578063aa0b39c714610259578063c828371e14610261578063e30c397814610287578063e786977114610298578063f2fde38b146102ab578063f6962a20146102be57600080fd5b806379ba5097146102005780638456cb59146102085780638da5cb5b1461021057806399d54d3914610235578063a694fc3a1461024657600080fd5b8063469ae374116100ff578063469ae3741461018b578063541251bd1461019e5780635c975abb146101a65780636f77926b146101c3578063715018a6146101f857600080fd5b80630917e7761461013c578063293c5e63146101535780632e17de781461015b578063326220bf146101705780633f4ba83a14610183575b600080fd5b6002545b6040519081526020015b60405180910390f35b600454610140565b61016e61016936600461109a565b6102e4565b005b61016e61017e3660046110cf565b6104db565b61016e610505565b61016e610199366004611136565b610517565b6101406107a8565b600154600160a01b900460ff16604051901515815260200161014a565b6101d66101d13660046110cf565b61081f565b604080518251815260208084015190820152918101519082015260600161014a565b61016e610885565b61016e610897565b61016e6108db565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161014a565b6006546001600160a01b031661021d565b61016e61025436600461109a565b6108eb565b600354610140565b7f00000000000000000000000000000000000000000000000000000000668f9f10610140565b6001546001600160a01b031661021d565b6101406102a63660046110cf565b610a3a565b61016e6102b93660046110cf565b610b01565b7f000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c561021d565b7f00000000000000000000000000000000000000000000000000000000668f9f104210156103475760405162461bcd60e51b815260206004820152600b60248201526a139bdd081cdd185c9d195960aa1b60448201526064015b60405180910390fd5b600081116103855760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015260640161033e565b3360009081526005602090815260409182902082516060810184528154808252600183015493820193909352600290910154928101929092528211156104045760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015260640161033e565b61040c610b72565b600061041782610bef565b9050828160000181815161042b91906111b8565b905250600280548491906000906104439084906111b8565b909155505033600081815260056020908152604091829020845181558482015160018201558483015160029091015590518581527f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75910160405180910390a26104d66001600160a01b037f000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c5163385610c9c565b505050565b6104e3610cfb565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b61050d610cfb565b610515610d28565b565b61051f610d7d565b6006546001600160a01b0316331461056c5760405162461bcd60e51b815260206004820152601060248201526f24b731b7b93932b1ba1031b0b63632b960811b604482015260640161033e565b82818082146105b15760405162461bcd60e51b8152602060048201526011602482015270496e636f7272656374206c656e6774687360781b604482015260640161033e565b600082116105ef5760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b604482015260640161033e565b6105f7610b72565b6000805b838110156106f9576000888883818110610617576106176111cb565b905060200201602081019061062c91906110cf565b90506000878784818110610642576106426111cb565b6001600160a01b03851660009081526005602090815260408083208151606081018352815481526001820154818501526002909101549181019190915292029390930135935091905061069482610bef565b905082816000018181516106a891906111e1565b9052506001600160a01b03841660009081526005602090815260409182902083518155908301516001820155908201516002909101556106e883876111e1565b9550505050508060010190506105fb565b50848460405161070a9291906111f4565b6040518091039020878760405161072292919061121d565b604051908190038120907ff8a1448a8741accb69ef058349d251e0830b63a2fabfbada1059c05a286f619590600090a3806002600082825461076491906111e1565b9091555061079f90506001600160a01b037f000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c516333084610da8565b50505050505050565b60007f00000000000000000000000000000000000000000000000000000000668f9f1042116107d75750600090565b6004544211156108185760006107ef42600454610de7565b9050600081600254610801919061125d565b90508060035461081191906111e1565b9250505090565b5060035490565b61084360405180606001604052806000815260200160008152602001600081525090565b506001600160a01b0316600090815260056020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b61088d610cfb565b6105156000610e2a565b60015433906001600160a01b031681146108cf5760405163118cdaa760e01b81526001600160a01b038216600482015260240161033e565b6108d881610e2a565b50565b6108e3610cfb565b610515610e43565b6108f3610d7d565b600081116109315760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015260640161033e565b33600090815260056020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915261096f610b72565b600061097a82610bef565b9050828160000181815161098e91906111e1565b905250600280548491906000906109a69084906111e1565b909155505033600081815260056020908152604091829020845181558482015160018201558483015160029091015590518581527f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d910160405180910390a26104d66001600160a01b037f000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c516333086610da8565b6001600160a01b038116600090815260056020908152604080832081516060810183528154815260018201549381019390935260020154908201527f00000000000000000000000000000000000000000000000000000000668f9f104211610aa55750600092915050565b805115610af7578060400151421115610af7576000610ac8428360400151610de7565b90506000818360000151610adc919061125d565b9050808360200151610aee91906111e1565b95945050505050565b6020015192915050565b610b09610cfb565b600180546001600160a01b0383166001600160a01b03199091168117909155610b3a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b7f00000000000000000000000000000000000000000000000000000000668f9f104211610b9b57565b60025415610be957600454421115610be9576000610bbb42600454610de7565b9050600060025482610bcd919061125d565b90508060036000828254610be191906111e1565b909155505050505b42600455565b610c1360405180606001604052806000815260200160008152602001600081525090565b7f00000000000000000000000000000000000000000000000000000000668f9f10428110610c42575090919050565b825115610c91578260400151421115610c91576000610c65428560400151610de7565b8451909150600090610c77908361125d565b90508085602001818151610c8b91906111e1565b90525050505b505042604082015290565b6040516001600160a01b038381166024830152604482018390526104d691859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610e86565b6000546001600160a01b031633146105155760405163118cdaa760e01b815233600482015260240161033e565b610d30610ee9565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600154600160a01b900460ff16156105155760405163d93c066560e01b815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610de19186918216906323b872dd90608401610cc9565b50505050565b60007f00000000000000000000000000000000000000000000000000000000668f9f1080831015610e16578092505b610e2083856111b8565b9150505b92915050565b600180546001600160a01b03191690556108d881610f13565b610e4b610d7d565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d603390565b6000610e9b6001600160a01b03841683610f63565b90508051600014158015610ec0575080806020019051810190610ebe9190611274565b155b156104d657604051635274afe760e01b81526001600160a01b038416600482015260240161033e565b600154600160a01b900460ff1661051557604051638dfc202b60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610f7183836000610f78565b9392505050565b606081471015610f9d5760405163cd78605960e01b815230600482015260240161033e565b600080856001600160a01b03168486604051610fb99190611296565b60006040518083038185875af1925050503d8060008114610ff6576040519150601f19603f3d011682016040523d82523d6000602084013e610ffb565b606091505b509150915061100b868383611015565b9695505050505050565b60608261102a5761102582611071565b610f71565b815115801561104157506001600160a01b0384163b155b1561106a57604051639996b31560e01b81526001600160a01b038516600482015260240161033e565b5080610f71565b8051156110815780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6000602082840312156110ac57600080fd5b5035919050565b80356001600160a01b03811681146110ca57600080fd5b919050565b6000602082840312156110e157600080fd5b610f71826110b3565b60008083601f8401126110fc57600080fd5b50813567ffffffffffffffff81111561111457600080fd5b6020830191508360208260051b850101111561112f57600080fd5b9250929050565b6000806000806040858703121561114c57600080fd5b843567ffffffffffffffff8082111561116457600080fd5b611170888389016110ea565b9096509450602087013591508082111561118957600080fd5b50611196878288016110ea565b95989497509550505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610e2457610e246111a2565b634e487b7160e01b600052603260045260246000fd5b80820180821115610e2457610e246111a2565b60006001600160fb1b0383111561120a57600080fd5b8260051b80858437919091019392505050565b60008184825b85811015611252576001600160a01b0361123c836110b3565b1683526020928301929190910190600101611223565b509095945050505050565b8082028115828204841417610e2457610e246111a2565b60006020828403121561128657600080fd5b81518015158114610f7157600080fd5b6000825160005b818110156112b7576020818601810151858301520161129d565b50600092019182525091905056fea2646970667358221220525555baa637a967157864bd675429e183ac25b391b7ceb7b88fe8a1d673035464736f6c63430008180033

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

000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c500000000000000000000000000000000000000000000000000000000668f9f1000000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d00000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d

-----Decoded View---------------
Arg [0] : mocaToken (address): 0xF944e35f95E819E752f3cCB5Faf40957d311e8c5
Arg [1] : startTime_ (uint256): 1720688400
Arg [2] : owner (address): 0x84Db3d1de9a43Aa144C21b248AD31a1c83d8334D
Arg [3] : updater (address): 0x84Db3d1de9a43Aa144C21b248AD31a1c83d8334D

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f944e35f95e819e752f3ccb5faf40957d311e8c5
Arg [1] : 00000000000000000000000000000000000000000000000000000000668f9f10
Arg [2] : 00000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d
Arg [3] : 00000000000000000000000084db3d1de9a43aa144c21b248ad31a1c83d8334d


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

$MOCA is the underlying resource that powers the Moca Network. Stake $MOCA to earn Staking Power

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.