APE Price: $0.54 (+1.25%)

Contract

0xb4061E9f8C21b874F0886A01ccE41199Dce8e83d

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo1 APE

APE Value

$0.54 (@ $0.54/APE)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit96330502025-02-10 23:55:3440 days ago1739231734IN
0xb4061E9f...9Dce8e83d
1 APE0.0011539425.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Game

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 5 : Game.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
 * @title Game
 * @dev Contract that manages player deposits and withdrawals with signature verification.
 */
contract Game is Initializable, OwnableUpgradeable {
    using ECDSA for bytes32;

    address public contractSigner;
    uint256 public initialBlock;

    mapping(address => uint256) private totalDeposits;
    mapping(address => uint256) private totalWithdrawals;

    event Deposit(address indexed player, uint256 amount, uint256 totalDeposit);
    event Withdrawal(
        address indexed player,
        uint256 amount,
        uint256 totalWithdrawal
    );

    /**
     * @dev Initializes the contract with the contract signer's address.
     * @param _owner Address of the contract owner.
     * @param _contractSigner Address of the contract signer.
     */
    function initialize(
        address _owner,
        address _contractSigner
    ) public initializer {
        __Ownable_init(_owner);
        contractSigner = _contractSigner;
        initialBlock = block.number;
    }

    /**
     * @dev Allows a player to make a deposit.
     */
    function deposit() external payable {
        require(msg.value > 0, "Amount should be greater than 0");
        totalDeposits[msg.sender] += msg.value;
        emit Deposit(msg.sender, msg.value, totalDeposits[msg.sender]);
    }

    /**
     * @dev Allows a player to make a withdrawal with a valid signature.
     * @param _signature Contract signature.
     * @param _amount Amount to be withdrawn.
     */
    function withdrawal(bytes memory _signature, uint256 _amount) external {
        require(_amount > 0, "Amount should be greater than 0");
        require(
            recoverAddress(
                _signature,
                msg.sender,
                _amount,
                totalWithdrawals[msg.sender]
            ) == contractSigner,
            "Invalid signature"
        );

        totalWithdrawals[msg.sender] += _amount;
        payable(msg.sender).transfer(_amount);
        emit Withdrawal(msg.sender, _amount, totalWithdrawals[msg.sender]);
    }

    /**
     * @dev Returns the total deposited by a player.
     * @param _player Player's address.
     * @return Total deposited by the player.
     */
    function getTotalDeposit(address _player) external view returns (uint256) {
        return totalDeposits[_player];
    }

    /**
     * @dev Returns the total withdrawn by a player.
     * @param _player Player's address.
     * @return Total withdrawn by the player.
     */
    function getTotalWithdrawal(
        address _player
    ) external view returns (uint256) {
        return totalWithdrawals[_player];
    }

    /**
     * @dev Sets the contract signer's address.
     * @param _contractSigner New contract signer address.
     */
    function setContractSigner(address _contractSigner) external onlyOwner {
        contractSigner = _contractSigner;
    }

    /**
     * @dev Function to receive ETH. Reverts all direct transfers.
     */
    receive() external payable {
        revert("Direct transfers not allowed");
    }

    /**
     * @dev Recovers the signer's address from the signature.
     * @param _signature Contract signature.
     * @param _player Player's address.
     * @param _amount Amount to be withdrawn.
     * @param _nonce Nonce to prevent transaction replay.
     * @return Signer's address.
     */
    function recoverAddress(
        bytes memory _signature,
        address _player,
        uint256 _amount,
        uint256 _nonce
    ) internal view returns (address) {
        bytes32 messageHash = keccak256(
            abi.encodePacked(address(this), _player, _amount, _nonce)
        );
        bytes32 ethSignedMessageHash = _getEthSignedMessageHash(messageHash);

        return ECDSA.recover(ethSignedMessageHash, _signature);
    }

    function _getEthSignedMessageHash(
        bytes32 messageHash
    ) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(
                    "\x19Ethereum Signed Message:\n32",
                    messageHash
                )
            );
    }

    function emergencyWithdraw() external onlyOwner {
        payable(owner()).transfer(address(this).balance);
    }
}

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

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @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.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        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) {
        OwnableStorage storage $ = _getOwnableStorage();
        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 {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 5 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

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

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    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 5 of 5 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(
        bytes32 hash,
        bytes memory signature
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly ("memory-safe") {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalDeposit","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWithdrawal","type":"uint256"}],"name":"Withdrawal","type":"event"},{"inputs":[],"name":"contractSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"getTotalDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"getTotalWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_contractSigner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contractSigner","type":"address"}],"name":"setContractSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_signature","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052348015600f57600080fd5b50610c5b8061001f6000396000f3fe6080604052600436106100ab5760003560e01c8063c7eaea8a11610064578063c7eaea8a146101fb578063d0e30db01461021b578063d7b159ed14610223578063db2e21bc14610243578063dff431b914610258578063f2fde38b1461027857600080fd5b80632cb1586414610102578063485cc9551461012b5780634c14470d1461014d578063715018a614610183578063857184d1146101985780638da5cb5b146101ce57600080fd5b366100fd5760405162461bcd60e51b815260206004820152601c60248201527f446972656374207472616e7366657273206e6f7420616c6c6f7765640000000060448201526064015b60405180910390fd5b600080fd5b34801561010e57600080fd5b5061011860015481565b6040519081526020015b60405180910390f35b34801561013757600080fd5b5061014b610146366004610ac8565b610298565b005b34801561015957600080fd5b50610118610168366004610afb565b6001600160a01b031660009081526003602052604090205490565b34801561018f57600080fd5b5061014b6103c8565b3480156101a457600080fd5b506101186101b3366004610afb565b6001600160a01b031660009081526002602052604090205490565b3480156101da57600080fd5b506101e36103dc565b6040516001600160a01b039091168152602001610122565b34801561020757600080fd5b5061014b610216366004610b33565b61040a565b61014b61056f565b34801561022f57600080fd5b5061014b61023e366004610afb565b61062d565b34801561024f57600080fd5b5061014b610657565b34801561026457600080fd5b506000546101e3906001600160a01b031681565b34801561028457600080fd5b5061014b610293366004610afb565b6106a2565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156102de5750825b905060008267ffffffffffffffff1660011480156102fb5750303b155b905081158015610309575080155b156103275760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561035157845460ff60401b1916600160401b1785555b61035a876106dd565b600080546001600160a01b0319166001600160a01b0388161790554360015583156103bf57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b6103d06106ee565b6103da6000610720565b565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6000811161045a5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746572207468616e20300060448201526064016100f4565b600080543380835260036020526040909220546001600160a01b0390911691610487918591908590610791565b6001600160a01b0316146104d15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016100f4565b33600090815260036020526040812080548392906104f0908490610bee565b9091555050604051339082156108fc029083906000818181858888f19350505050158015610522573d6000803e3d6000fd5b5033600081815260036020908152604091829020548251858152918201527fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb910160405180910390a25050565b600034116105bf5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746572207468616e20300060448201526064016100f4565b33600090815260026020526040812080543492906105de908490610bee565b909155505033600081815260026020908152604091829020548251348152918201527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2565b6106356106ee565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b61065f6106ee565b6106676103dc565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561069f573d6000803e3d6000fd5b50565b6106aa6106ee565b6001600160a01b0381166106d457604051631e4fbdf760e01b8152600060048201526024016100f4565b61069f81610720565b6106e5610856565b61069f8161089f565b336106f76103dc565b6001600160a01b0316146103da5760405163118cdaa760e01b81523360048201526024016100f4565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6040516bffffffffffffffffffffffff1930606090811b8216602084015285901b16603482015260488101839052606881018290526000908190608801604051602081830303815290604052805190602001209050600061083f826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b905061084b81886108a7565b979650505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166103da57604051631afcd79f60e31b815260040160405180910390fd5b6106aa610856565b6000806000806108b786866108d3565b9250925092506108c78282610920565b50909150505b92915050565b6000806000835160410361090d5760208401516040850151606086015160001a6108ff888285856109dd565b955095509550505050610919565b50508151600091506002905b9250925092565b600082600381111561093457610934610c0f565b0361093d575050565b600182600381111561095157610951610c0f565b0361096f5760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561098357610983610c0f565b036109a45760405163fce698f760e01b8152600481018290526024016100f4565b60038260038111156109b8576109b8610c0f565b036109d9576040516335e2f38360e21b8152600481018290526024016100f4565b5050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610a185750600091506003905082610aa2565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610a6c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a9857506000925060019150829050610aa2565b9250600091508190505b9450945094915050565b80356001600160a01b0381168114610ac357600080fd5b919050565b60008060408385031215610adb57600080fd5b610ae483610aac565b9150610af260208401610aac565b90509250929050565b600060208284031215610b0d57600080fd5b610b1682610aac565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610b4657600080fd5b823567ffffffffffffffff811115610b5d57600080fd5b8301601f81018513610b6e57600080fd5b803567ffffffffffffffff811115610b8857610b88610b1d565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610bb757610bb7610b1d565b604052818152828201602001871015610bcf57600080fd5b8160208401602083013760006020928201830152969401359450505050565b808201808211156108cd57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220cc63dbf66109c2e9868248abe59cb56e8d3175463887d5dfae562b9944c365e064736f6c634300081c0033

Deployed Bytecode

0x6080604052600436106100ab5760003560e01c8063c7eaea8a11610064578063c7eaea8a146101fb578063d0e30db01461021b578063d7b159ed14610223578063db2e21bc14610243578063dff431b914610258578063f2fde38b1461027857600080fd5b80632cb1586414610102578063485cc9551461012b5780634c14470d1461014d578063715018a614610183578063857184d1146101985780638da5cb5b146101ce57600080fd5b366100fd5760405162461bcd60e51b815260206004820152601c60248201527f446972656374207472616e7366657273206e6f7420616c6c6f7765640000000060448201526064015b60405180910390fd5b600080fd5b34801561010e57600080fd5b5061011860015481565b6040519081526020015b60405180910390f35b34801561013757600080fd5b5061014b610146366004610ac8565b610298565b005b34801561015957600080fd5b50610118610168366004610afb565b6001600160a01b031660009081526003602052604090205490565b34801561018f57600080fd5b5061014b6103c8565b3480156101a457600080fd5b506101186101b3366004610afb565b6001600160a01b031660009081526002602052604090205490565b3480156101da57600080fd5b506101e36103dc565b6040516001600160a01b039091168152602001610122565b34801561020757600080fd5b5061014b610216366004610b33565b61040a565b61014b61056f565b34801561022f57600080fd5b5061014b61023e366004610afb565b61062d565b34801561024f57600080fd5b5061014b610657565b34801561026457600080fd5b506000546101e3906001600160a01b031681565b34801561028457600080fd5b5061014b610293366004610afb565b6106a2565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156102de5750825b905060008267ffffffffffffffff1660011480156102fb5750303b155b905081158015610309575080155b156103275760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561035157845460ff60401b1916600160401b1785555b61035a876106dd565b600080546001600160a01b0319166001600160a01b0388161790554360015583156103bf57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b6103d06106ee565b6103da6000610720565b565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6000811161045a5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746572207468616e20300060448201526064016100f4565b600080543380835260036020526040909220546001600160a01b0390911691610487918591908590610791565b6001600160a01b0316146104d15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b60448201526064016100f4565b33600090815260036020526040812080548392906104f0908490610bee565b9091555050604051339082156108fc029083906000818181858888f19350505050158015610522573d6000803e3d6000fd5b5033600081815260036020908152604091829020548251858152918201527fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb910160405180910390a25050565b600034116105bf5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e742073686f756c642062652067726561746572207468616e20300060448201526064016100f4565b33600090815260026020526040812080543492906105de908490610bee565b909155505033600081815260026020908152604091829020548251348152918201527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2565b6106356106ee565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b61065f6106ee565b6106676103dc565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561069f573d6000803e3d6000fd5b50565b6106aa6106ee565b6001600160a01b0381166106d457604051631e4fbdf760e01b8152600060048201526024016100f4565b61069f81610720565b6106e5610856565b61069f8161089f565b336106f76103dc565b6001600160a01b0316146103da5760405163118cdaa760e01b81523360048201526024016100f4565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6040516bffffffffffffffffffffffff1930606090811b8216602084015285901b16603482015260488101839052606881018290526000908190608801604051602081830303815290604052805190602001209050600061083f826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b905061084b81886108a7565b979650505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166103da57604051631afcd79f60e31b815260040160405180910390fd5b6106aa610856565b6000806000806108b786866108d3565b9250925092506108c78282610920565b50909150505b92915050565b6000806000835160410361090d5760208401516040850151606086015160001a6108ff888285856109dd565b955095509550505050610919565b50508151600091506002905b9250925092565b600082600381111561093457610934610c0f565b0361093d575050565b600182600381111561095157610951610c0f565b0361096f5760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561098357610983610c0f565b036109a45760405163fce698f760e01b8152600481018290526024016100f4565b60038260038111156109b8576109b8610c0f565b036109d9576040516335e2f38360e21b8152600481018290526024016100f4565b5050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610a185750600091506003905082610aa2565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610a6c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a9857506000925060019150829050610aa2565b9250600091508190505b9450945094915050565b80356001600160a01b0381168114610ac357600080fd5b919050565b60008060408385031215610adb57600080fd5b610ae483610aac565b9150610af260208401610aac565b90509250929050565b600060208284031215610b0d57600080fd5b610b1682610aac565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610b4657600080fd5b823567ffffffffffffffff811115610b5d57600080fd5b8301601f81018513610b6e57600080fd5b803567ffffffffffffffff811115610b8857610b88610b1d565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610bb757610bb7610b1d565b604052818152828201602001871015610bcf57600080fd5b8160208401602083013760006020928201830152969401359450505050565b808201808211156108cd57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220cc63dbf66109c2e9868248abe59cb56e8d3175463887d5dfae562b9944c365e064736f6c634300081c0033

Block Transaction Difficulty 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.