ETH Price: $3,451.90 (+0.07%)
Gas: 6 Gwei

Contract

0x17237Be9Cd126e58d3A0F798d3D55651c0E57Aaa
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Purchase Shard157489992022-10-14 21:20:59647 days ago1665782459IN
0x17237Be9...1c0E57Aaa
0 ETH0.0005806717.29998742
Purchase Shard152096992022-07-25 5:08:10729 days ago1658725690IN
0x17237Be9...1c0E57Aaa
0 ETH0.00129765.94657909
Purchase Shard151977292022-07-23 7:59:45731 days ago1658563185IN
0x17237Be9...1c0E57Aaa
0 ETH0.001740168.41295385
Purchase Shard151443262022-07-15 1:25:45739 days ago1657848345IN
0x17237Be9...1c0E57Aaa
0 ETH0.0082770740.00983544
Purchase Shard151405622022-07-14 11:44:13740 days ago1657799053IN
0x17237Be9...1c0E57Aaa
0 ETH0.0035157916.2733734
Purchase Shard151388672022-07-14 5:38:13740 days ago1657777093IN
0x17237Be9...1c0E57Aaa
0 ETH0.004394221.24403268
Purchase Shard151362782022-07-13 19:57:47740 days ago1657742267IN
0x17237Be9...1c0E57Aaa
0 ETH0.0055907423.97960039
Purchase Shard151248562022-07-12 1:23:23742 days ago1657589003IN
0x17237Be9...1c0E57Aaa
0 ETH0.0034341617.70863975
Purchase Shard151139912022-07-10 9:01:12744 days ago1657443672IN
0x17237Be9...1c0E57Aaa
0 ETH0.000348310.38083527
Purchase Shard151139912022-07-10 9:01:12744 days ago1657443672IN
0x17237Be9...1c0E57Aaa
0 ETH0.0019811710.38083527
Purchase Shard151052492022-07-09 0:36:57745 days ago1657327017IN
0x17237Be9...1c0E57Aaa
0 ETH0.001973498.46347244
Purchase Shard151027922022-07-08 15:43:03745 days ago1657294983IN
0x17237Be9...1c0E57Aaa
0 ETH0.0050245524.29059734
Purchase Shard150910072022-07-06 20:03:30747 days ago1657137810IN
0x17237Be9...1c0E57Aaa
0 ETH0.0039678917.01659477
Purchase Shard150909972022-07-06 20:02:43747 days ago1657137763IN
0x17237Be9...1c0E57Aaa
0 ETH0.0042279120.43890504
Purchase Shard150875902022-07-06 7:22:10748 days ago1657092130IN
0x17237Be9...1c0E57Aaa
0 ETH0.0025631312.3909249
Purchase Shard150875042022-07-06 7:03:24748 days ago1657091004IN
0x17237Be9...1c0E57Aaa
0 ETH0.0027950613.5108028
Purchase Shard150850692022-07-05 21:55:08748 days ago1657058108IN
0x17237Be9...1c0E57Aaa
0 ETH0.0123447452.94129863
Purchase Shard150786752022-07-04 22:11:49749 days ago1656972709IN
0x17237Be9...1c0E57Aaa
0 ETH0.0007966223.73391287
Purchase Shard150786752022-07-04 22:11:49749 days ago1656972709IN
0x17237Be9...1c0E57Aaa
0 ETH0.0055337523.73391287
Purchase Shard150784752022-07-04 21:25:51749 days ago1656969951IN
0x17237Be9...1c0E57Aaa
0 ETH0.0042935722.62443533
Purchase Shard150622762022-07-02 9:21:08752 days ago1656753668IN
0x17237Be9...1c0E57Aaa
0 ETH0.001923649.29906128
Purchase Shard150611622022-07-02 5:24:46752 days ago1656739486IN
0x17237Be9...1c0E57Aaa
0 ETH0.0036870715.81362481
Purchase Shard150611282022-07-02 5:14:33752 days ago1656738873IN
0x17237Be9...1c0E57Aaa
0 ETH0.0021962910.61646789
Purchase Shard150591922022-07-01 22:17:40752 days ago1656713860IN
0x17237Be9...1c0E57Aaa
0 ETH0.0048855523.6158579
Purchase Shard150583632022-07-01 19:03:00752 days ago1656702180IN
0x17237Be9...1c0E57Aaa
0 ETH0.0088241442.66086594
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:
ShardStore

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 8 : ShardStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

/**
 * @dev Interface for checking active staked balance of a user.
 */
interface ILoomi {
  function spendLoomi(address user, uint256 amount) external;
}

interface IMysteryBox {
  function addShards(uint256 shardId, uint256 shardsNumber, address user) external;
}

contract ShardStore is ReentrancyGuard, Ownable {
    ILoomi public loomi;
    IMysteryBox public MysteryBox;

    uint256 public shardPrice;

    bool public isPaused;

    address public signer;

    mapping(address => uint256) private _nonces;
    
    event ClaimShards(address indexed userAddress, uint256[] shards);

    constructor(address _loomi, address _mb, address _signer) {
      loomi = ILoomi(_loomi);
      MysteryBox = IMysteryBox(_mb);
      signer = _signer;

      isPaused = true;
    }

    modifier whenNotPaused {
      require(!isPaused, "Contract paused!");
      _;
    }

    /**
    * @dev Function to purchase missing shards for user.
    */
    function purchaseShard(
      uint256[] calldata shards,
      uint256 nonce,
      bytes calldata signature
    ) public nonReentrant whenNotPaused {
      require(shards.length == 3, "Invalid shards array provided");
      require(_nonces[_msgSender()] < nonce, "Invalid nonce provided");
      require(_validateData(shards, nonce, signature), "Invalid Data Provided");

      _nonces[_msgSender()] = nonce;
      
      uint256 finalPrice;

      for (uint256 i; i < shards.length; i++) {
        if (shards[i] > 0) {
          MysteryBox.addShards(i, 1, _msgSender());
          finalPrice += shardPrice;
        }
      }

      loomi.spendLoomi(_msgSender(), finalPrice);

      emit ClaimShards(_msgSender(), shards);
    }

    /**
    * @dev Function incoming name validation
    */
    function _validateData(
      uint256[] memory _shards,
      uint256 _nonce,
      bytes calldata signature
      ) internal view returns (bool) {
      bytes32 dataHash = keccak256(abi.encodePacked(_shards, _nonce, _msgSender()));
      bytes32 message = ECDSA.toEthSignedMessageHash(dataHash);

      address receivedAddress = ECDSA.recover(message, signature);
      return (receivedAddress != address(0) && receivedAddress == signer);
    }

    /**
    * @dev Function allows admin to update shard Price.
    */
    function updateShardPrice(uint256 _price) public onlyOwner {
      shardPrice = _price;
    }

    /**
    * @dev Function allows admin to pause contract.
    */
    function pause(bool _pause) public onlyOwner {
      isPaused = _pause;
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 8 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 4 of 8 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 5 of 8 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode 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 {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]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        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 {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode 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 {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        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[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

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

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // 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);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

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

        return (signer, RecoverError.NoError);
    }

    /**
     * @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) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 6 of 8 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

File 7 of 8 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 8 of 8 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_loomi","type":"address"},{"internalType":"address","name":"_mb","type":"address"},{"internalType":"address","name":"_signer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"shards","type":"uint256[]"}],"name":"ClaimShards","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"},{"inputs":[],"name":"MysteryBox","outputs":[{"internalType":"contract IMysteryBox","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loomi","outputs":[{"internalType":"contract ILoomi","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_pause","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"shards","type":"uint256[]"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchaseShard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shardPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"updateShardPrice","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051610f3a380380610f3a83398101604081905261002f91610106565b600160005561003d33610098565b600280546001600160a01b03199081166001600160a01b03958616179091556003805490911692841692909217909155600580546001600160a81b031916610100929093169190910260ff1916919091176001179055610149565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b038116811461010157600080fd5b919050565b60008060006060848603121561011b57600080fd5b610124846100ea565b9250610132602085016100ea565b9150610140604085016100ea565b90509250925092565b610de2806101586000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610126578063b187bd2614610137578063c59d264614610154578063dfe72b6814610167578063f2fde38b1461017a578063ff7c9ac51461018d57600080fd5b806302329a29146100ae578063238ac933146100c3578063464bc214146100f8578063503fec231461010b578063715018a61461011e575b600080fd5b6100c16100bc366004610c35565b6101a4565b005b6005546100db9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6002546100db906001600160a01b031681565b6100c1610119366004610c57565b6101ea565b6100c1610219565b6001546001600160a01b03166100db565b6005546101449060ff1681565b60405190151581526020016100ef565b6003546100db906001600160a01b031681565b6100c1610175366004610b8d565b61024f565b6100c1610188366004610b5d565b6105be565b61019660045481565b6040519081526020016100ef565b6001546001600160a01b031633146101d75760405162461bcd60e51b81526004016101ce90610d02565b60405180910390fd5b6005805460ff1916911515919091179055565b6001546001600160a01b031633146102145760405162461bcd60e51b81526004016101ce90610d02565b600455565b6001546001600160a01b031633146102435760405162461bcd60e51b81526004016101ce90610d02565b61024d6000610659565b565b600260005414156102a25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ce565b600260005560055460ff16156102ed5760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374207061757365642160801b60448201526064016101ce565b6003841461033d5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207368617264732061727261792070726f766964656400000060448201526064016101ce565b3360009081526006602052604090205483116103945760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081b9bdb98d9481c1c9bdd9a59195960521b60448201526064016101ce565b6103d58585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506106ab565b6104195760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a590811185d1848141c9bdd9a591959605a1b60448201526064016101ce565b336000908152600660205260408120849055805b858110156104f557600087878381811061044957610449610d96565b9050602002013511156104e3576003546001600160a01b031663957e819a826001336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b03166044820152606401600060405180830381600087803b1580156104ba57600080fd5b505af11580156104ce573d6000803e3d6000fd5b50505050600454826104e09190610d37565b91505b806104ed81610d4f565b91505061042d565b506002546001600160a01b031663bfd77e2b336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561055057600080fd5b505af1158015610564573d6000803e3d6000fd5b5050505061056f3390565b6001600160a01b03167f5c5baa3cd1dcb79570ec838015afff8735583089d4cbb34a0b7bb07d68148d6787876040516105a9929190610cc6565b60405180910390a25050600160005550505050565b6001546001600160a01b031633146105e85760405162461bcd60e51b81526004016101ce90610d02565b6001600160a01b03811661064d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101ce565b61065681610659565b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000808585336040516020016106c393929190610c70565b6040516020818303038152906040528051906020012090506000610734826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b905060006107788287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506107b092505050565b90506001600160a01b038116158015906107a457506005546001600160a01b0382811661010090920416145b98975050505050505050565b60008060006107bf85856107d4565b915091506107cc81610844565b509392505050565b60008082516041141561080b5760208301516040840151606085015160001a6107ff878285856109ff565b9450945050505061083d565b825160401415610835576020830151604084015161082a868383610aec565b93509350505061083d565b506000905060025b9250929050565b600081600481111561085857610858610d80565b14156108615750565b600181600481111561087557610875610d80565b14156108c35760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016101ce565b60028160048111156108d7576108d7610d80565b14156109255760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016101ce565b600381600481111561093957610939610d80565b14156109925760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016101ce565b60048160048111156109a6576109a6610d80565b14156106565760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016101ce565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610a365750600090506003610ae3565b8460ff16601b14158015610a4e57508460ff16601c14155b15610a5f5750600090506004610ae3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610ab3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610adc57600060019250925050610ae3565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01610b0d878288856109ff565b935093505050935093915050565b60008083601f840112610b2d57600080fd5b50813567ffffffffffffffff811115610b4557600080fd5b60208301915083602082850101111561083d57600080fd5b600060208284031215610b6f57600080fd5b81356001600160a01b0381168114610b8657600080fd5b9392505050565b600080600080600060608688031215610ba557600080fd5b853567ffffffffffffffff80821115610bbd57600080fd5b818801915088601f830112610bd157600080fd5b813581811115610be057600080fd5b8960208260051b8501011115610bf557600080fd5b60209283019750955090870135935060408701359080821115610c1757600080fd5b50610c2488828901610b1b565b969995985093965092949392505050565b600060208284031215610c4757600080fd5b81358015158114610b8657600080fd5b600060208284031215610c6957600080fd5b5035919050565b835160009082906020808801845b83811015610c9a57815185529382019390820190600101610c7e565b50509582525060609390931b6bffffffffffffffffffffffff1916938301939093525060340192915050565b6020808252810182905260006001600160fb1b03831115610ce657600080fd5b8260051b80856040850137600092016040019182525092915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d4a57610d4a610d6a565b500190565b6000600019821415610d6357610d63610d6a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220126c10f8d4f2e8f1c58371c17015409b1ea27c3a12b244f339416b817b89de4764736f6c63430008070033000000000000000000000000eb57bf569ad976974c1f861a5923a59f4022245100000000000000000000000005c1fda8ccd7f392c0fe6555a9ee1214bf9bfb4a0000000000000000000000003f2c152b91d1ca6ab86a94f113e778aa2ee8dffc

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610126578063b187bd2614610137578063c59d264614610154578063dfe72b6814610167578063f2fde38b1461017a578063ff7c9ac51461018d57600080fd5b806302329a29146100ae578063238ac933146100c3578063464bc214146100f8578063503fec231461010b578063715018a61461011e575b600080fd5b6100c16100bc366004610c35565b6101a4565b005b6005546100db9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6002546100db906001600160a01b031681565b6100c1610119366004610c57565b6101ea565b6100c1610219565b6001546001600160a01b03166100db565b6005546101449060ff1681565b60405190151581526020016100ef565b6003546100db906001600160a01b031681565b6100c1610175366004610b8d565b61024f565b6100c1610188366004610b5d565b6105be565b61019660045481565b6040519081526020016100ef565b6001546001600160a01b031633146101d75760405162461bcd60e51b81526004016101ce90610d02565b60405180910390fd5b6005805460ff1916911515919091179055565b6001546001600160a01b031633146102145760405162461bcd60e51b81526004016101ce90610d02565b600455565b6001546001600160a01b031633146102435760405162461bcd60e51b81526004016101ce90610d02565b61024d6000610659565b565b600260005414156102a25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ce565b600260005560055460ff16156102ed5760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374207061757365642160801b60448201526064016101ce565b6003841461033d5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207368617264732061727261792070726f766964656400000060448201526064016101ce565b3360009081526006602052604090205483116103945760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081b9bdb98d9481c1c9bdd9a59195960521b60448201526064016101ce565b6103d58585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506106ab565b6104195760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a590811185d1848141c9bdd9a591959605a1b60448201526064016101ce565b336000908152600660205260408120849055805b858110156104f557600087878381811061044957610449610d96565b9050602002013511156104e3576003546001600160a01b031663957e819a826001336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b03166044820152606401600060405180830381600087803b1580156104ba57600080fd5b505af11580156104ce573d6000803e3d6000fd5b50505050600454826104e09190610d37565b91505b806104ed81610d4f565b91505061042d565b506002546001600160a01b031663bfd77e2b336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561055057600080fd5b505af1158015610564573d6000803e3d6000fd5b5050505061056f3390565b6001600160a01b03167f5c5baa3cd1dcb79570ec838015afff8735583089d4cbb34a0b7bb07d68148d6787876040516105a9929190610cc6565b60405180910390a25050600160005550505050565b6001546001600160a01b031633146105e85760405162461bcd60e51b81526004016101ce90610d02565b6001600160a01b03811661064d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101ce565b61065681610659565b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000808585336040516020016106c393929190610c70565b6040516020818303038152906040528051906020012090506000610734826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b905060006107788287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506107b092505050565b90506001600160a01b038116158015906107a457506005546001600160a01b0382811661010090920416145b98975050505050505050565b60008060006107bf85856107d4565b915091506107cc81610844565b509392505050565b60008082516041141561080b5760208301516040840151606085015160001a6107ff878285856109ff565b9450945050505061083d565b825160401415610835576020830151604084015161082a868383610aec565b93509350505061083d565b506000905060025b9250929050565b600081600481111561085857610858610d80565b14156108615750565b600181600481111561087557610875610d80565b14156108c35760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016101ce565b60028160048111156108d7576108d7610d80565b14156109255760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016101ce565b600381600481111561093957610939610d80565b14156109925760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016101ce565b60048160048111156109a6576109a6610d80565b14156106565760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016101ce565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610a365750600090506003610ae3565b8460ff16601b14158015610a4e57508460ff16601c14155b15610a5f5750600090506004610ae3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610ab3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610adc57600060019250925050610ae3565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01610b0d878288856109ff565b935093505050935093915050565b60008083601f840112610b2d57600080fd5b50813567ffffffffffffffff811115610b4557600080fd5b60208301915083602082850101111561083d57600080fd5b600060208284031215610b6f57600080fd5b81356001600160a01b0381168114610b8657600080fd5b9392505050565b600080600080600060608688031215610ba557600080fd5b853567ffffffffffffffff80821115610bbd57600080fd5b818801915088601f830112610bd157600080fd5b813581811115610be057600080fd5b8960208260051b8501011115610bf557600080fd5b60209283019750955090870135935060408701359080821115610c1757600080fd5b50610c2488828901610b1b565b969995985093965092949392505050565b600060208284031215610c4757600080fd5b81358015158114610b8657600080fd5b600060208284031215610c6957600080fd5b5035919050565b835160009082906020808801845b83811015610c9a57815185529382019390820190600101610c7e565b50509582525060609390931b6bffffffffffffffffffffffff1916938301939093525060340192915050565b6020808252810182905260006001600160fb1b03831115610ce657600080fd5b8260051b80856040850137600092016040019182525092915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d4a57610d4a610d6a565b500190565b6000600019821415610d6357610d63610d6a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220126c10f8d4f2e8f1c58371c17015409b1ea27c3a12b244f339416b817b89de4764736f6c63430008070033

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

000000000000000000000000eb57bf569ad976974c1f861a5923a59f4022245100000000000000000000000005c1fda8ccd7f392c0fe6555a9ee1214bf9bfb4a0000000000000000000000003f2c152b91d1ca6ab86a94f113e778aa2ee8dffc

-----Decoded View---------------
Arg [0] : _loomi (address): 0xEb57Bf569Ad976974C1F861a5923A59F40222451
Arg [1] : _mb (address): 0x05C1FDA8ccD7f392c0fe6555a9eE1214bf9BFb4a
Arg [2] : _signer (address): 0x3F2C152B91D1CA6Ab86a94f113e778Aa2eE8DFFc

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000eb57bf569ad976974c1f861a5923a59f40222451
Arg [1] : 00000000000000000000000005c1fda8ccd7f392c0fe6555a9ee1214bf9bfb4a
Arg [2] : 0000000000000000000000003f2c152b91d1ca6ab86a94f113e778aa2ee8dffc


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
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.