ETH Price: $2,046.38 (-0.56%)

Contract

0x722aC7D2Be2a86C7D4e69C213d868BCA583334F5
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...241689282026-01-05 14:01:5984 days ago1767621719IN
Swap Shop Chops
0 ETH0.000006680.23389148
Chop Swap Sheep186982562023-12-02 10:55:11849 days ago1701514511IN
Swap Shop Chops
0 ETH0.0029648326.61261566
Chop Swap Sheep186914602023-12-01 12:07:35850 days ago1701432455IN
Swap Shop Chops
0 ETH0.0053949333.1186642
Chop Swap Sheep186911432023-12-01 11:03:35850 days ago1701428615IN
Swap Shop Chops
0 ETH0.0035792532.1277833
Chop Swap Sheep186844992023-11-30 12:44:11851 days ago1701348251IN
Swap Shop Chops
0 ETH0.0044894432.73357472
Chop Swap Sheep182773832023-10-04 13:14:11908 days ago1696425251IN
Swap Shop Chops
0 ETH0.0012165611.41169112
Chop Swap Sheep182739602023-10-04 1:45:11909 days ago1696383911IN
Swap Shop Chops
0 ETH0.000810727.2771431
Chop Swap Sheep182120302023-09-25 9:53:11917 days ago1695635591IN
Swap Shop Chops
0 ETH0.000852667.65363451
Set Prices181541242023-09-17 6:54:47926 days ago1694933687IN
Swap Shop Chops
0 ETH0.000352668.61842987
Chop Swap Sheep179749002023-08-23 4:03:47951 days ago1692763427IN
Swap Shop Chops
0 ETH0.0024121217.58736507
Chop Swap Sheep179288872023-08-16 17:30:11957 days ago1692207011IN
Swap Shop Chops
0 ETH0.0052656938.39342651
Chop Swap Sheep178936892023-08-11 19:19:23962 days ago1691781563IN
Swap Shop Chops
0 ETH0.0023918221.46921492
Chop Swap Sheep178814152023-08-10 2:09:11964 days ago1691633351IN
Swap Shop Chops
0 ETH0.002067918.56171493
Chop Swap Sheep178808642023-08-10 0:17:35964 days ago1691626655IN
Swap Shop Chops
0 ETH0.0023950621.49829585
Chop Swap Sheep178791522023-08-09 18:32:47964 days ago1691605967IN
Swap Shop Chops
0 ETH0.0031029527.8524674
Chop Swap Sheep177843482023-07-27 12:17:59977 days ago1690460279IN
Swap Shop Chops
0 ETH0.0024644922.12156489
Chop Swap Sheep176853162023-07-13 14:58:23991 days ago1689260303IN
Swap Shop Chops
0 ETH0.0022022419.76753038
Chop Swap Sheep176824232023-07-13 5:09:59992 days ago1689224999IN
Swap Shop Chops
0 ETH0.0014879913.95772312
Chop Swap Sheep176803042023-07-12 21:59:47992 days ago1689199187IN
Swap Shop Chops
0 ETH0.0021355819.1691943
Chop Swap Sheep176783642023-07-12 15:27:11992 days ago1689175631IN
Swap Shop Chops
0 ETH0.0048805643.80844725
Chop Swap Sheep176778732023-07-12 13:47:11992 days ago1689169631IN
Swap Shop Chops
0 ETH0.0033000239.02262227
Chop Swap Sheep176778712023-07-12 13:46:47992 days ago1689169607IN
Swap Shop Chops
0 ETH0.0046971642.16222385
Chop Swap Sheep176778452023-07-12 13:41:35992 days ago1689169295IN
Swap Shop Chops
0 ETH0.003471431.15968049
Chop Swap Sheep176436092023-07-07 18:09:23997 days ago1688753363IN
Swap Shop Chops
0 ETH0.0048687343.70220939
Chop Swap Sheep176276352023-07-05 12:19:11999 days ago1688559551IN
Swap Shop Chops
0 ETH0.0061425155.13577333
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwapShopChops

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

// SwapShop Chops by Seedphrase.eth 🎩
// Use at https://chops.swapshop.pro 🥩
// Built by https://www.tokenpage.xyz 🚀

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';

error CannotSwapWolf();
error Gen0SwapsNotEnabled();
error Gen1SwapsNotEnabled();
error Gen2SwapsNotEnabled();
error Gen2MinEnergyMaxNotReached();
error InvalidSignature();
error NotAuthorized();

interface IWoolf {
    struct SheepWolf {
        bool isSheep;
        uint8 fur;
        uint8 head;
        uint8 ears;
        uint8 eyes;
        uint8 nose;
        uint8 mouth;
        uint8 neck;
        uint8 feet;
        uint8 alphaIndex;
    }
    function getTokenTraits(uint256 tokenId) external view returns (SheepWolf memory);
    function getPaidTokens() external view returns (uint256);
}

interface IWolfGameReborn {
    function woolf() external view returns (address);
    function transferFrom(address from, address to, uint256 tokenId) external;
}

interface IWolfGameGen2 {
    function transferFrom(address from, address to, uint256 tokenId) external;
}

interface IWOOL is IERC20 {
}

contract SwapShopChops is Ownable, Pausable, ReentrancyGuard {
    using ECDSA for bytes32;
    using EnumerableSet for EnumerableSet.UintSet;

    event ChopSwap(uint256 swapId, address swapper, uint256 chopsAmount);

    IWoolf public wolfGame;
    IWolfGameReborn public wolfGameReborn;
    IWolfGameGen2 public wolfGameGen2;
    address public controller;
    uint256 public lastSwapId;
    bool public isGen0SwapsEnabled;
    bool public isGen1SwapsEnabled;
    bool public isGen2SwapsEnabled;
    uint256 public gen0ChopsPerEnergyMax;
    uint256 public gen1ChopsPerEnergyMax;
    uint256 public gen2ChopsPerEnergyMax;
    uint256 public gen2MinimumEnergyMax;
    address public serverSigner;

    constructor(address initialWolfGameRebornAddress, address initialWolfGameGen2Address, address initialController)
    Ownable() {
        wolfGameReborn = IWolfGameReborn(initialWolfGameRebornAddress);
        wolfGame = IWoolf(wolfGameReborn.woolf());
        wolfGameGen2 = IWolfGameGen2(initialWolfGameGen2Address);
        controller = initialController;
    }

    // Util

    modifier onlyOwnerOrController() {
        if (owner() != _msgSender() && controller != _msgSender()) {
            revert NotAuthorized();
        }
        _;
    }

    // Admin

    function setController(address newController) external onlyOwner {
        controller = newController;
    }

    function pause() external onlyOwnerOrController {
        _pause();
    }

    function unpause() external onlyOwnerOrController {
        _unpause();
    }

    function setPrices(bool newIsGen0SwapsEnabled, bool newIsGen1SwapsEnabled, bool newIsGen2SwapsEnabled, uint256 newGen0ChopsPerEnergyMax, uint256 newGen1ChopsPerEnergyMax, uint256 newGen2ChopsPerEnergyMax, uint256 newGen2MinimumEnergyMax) external onlyOwnerOrController {
        isGen0SwapsEnabled = newIsGen0SwapsEnabled;
        isGen1SwapsEnabled = newIsGen1SwapsEnabled;
        isGen2SwapsEnabled = newIsGen2SwapsEnabled;
        gen0ChopsPerEnergyMax = newGen0ChopsPerEnergyMax;
        gen1ChopsPerEnergyMax = newGen1ChopsPerEnergyMax;
        gen2ChopsPerEnergyMax = newGen2ChopsPerEnergyMax;
        gen2MinimumEnergyMax = newGen2MinimumEnergyMax;
    }

    function setServerSigner(address newServerSigner) external onlyOwnerOrController {
        serverSigner = newServerSigner;
    }

    // Views

    function getPrices() external view returns (bool, bool, bool, uint256, uint256, uint256, uint256) {
        return (isGen0SwapsEnabled, isGen1SwapsEnabled, isGen2SwapsEnabled, gen0ChopsPerEnergyMax, gen1ChopsPerEnergyMax, gen2ChopsPerEnergyMax, gen2MinimumEnergyMax);
    }

    // Users

    function _checkIsSheep(uint tokenId) internal view {
        IWoolf.SheepWolf memory tokenTraits = wolfGame.getTokenTraits(tokenId);
        if (!tokenTraits.isSheep) {
            revert CannotSwapWolf();
        }
    }

    function _validateGen2Energies(uint256[] calldata gen2TokenIds, uint16[] calldata gen2TokenEnergyMaxs, bytes calldata gen2TokensSignature) internal view {
        bytes32 messageHash = keccak256(abi.encodePacked(gen2TokenIds, gen2TokenEnergyMaxs));
        address signer = messageHash.toEthSignedMessageHash().recover(gen2TokensSignature);
        if (signer != serverSigner) {
            revert InvalidSignature();
        }
    }

    function chopSwapSheep(uint256[] calldata gen0Gen1TokenIds, uint256[] calldata gen2TokenIds, uint16[] calldata gen2TokenEnergyMaxs, bytes calldata gen2TokensSignature) external nonReentrant whenNotPaused {
        if (gen2TokenIds.length > 0) {
            _validateGen2Energies(gen2TokenIds, gen2TokenEnergyMaxs, gen2TokensSignature);
        }
        lastSwapId++;
        uint256 gen0TokenCount;
        uint256 gen1TokenCount;
        uint256 paidTokenCount = wolfGame.getPaidTokens();
        for (uint256 i = 0; i < gen0Gen1TokenIds.length; i++) {
            uint256 gen0Gen1TokenId = gen0Gen1TokenIds[i];
            _checkIsSheep(gen0Gen1TokenId);
            if (gen0Gen1TokenId <= paidTokenCount) {
                gen0TokenCount += 1;
            } else {
                gen1TokenCount += 1;
            }
            wolfGameReborn.transferFrom(_msgSender(), controller, gen0Gen1TokenId);
        }
        uint256 gen2TotalEnergyMax = 0;
        for (uint256 i = 0; i < gen2TokenIds.length; i++) {
            if (gen2TokenEnergyMaxs[i] < gen2MinimumEnergyMax) {
                revert Gen2MinEnergyMaxNotReached();
            }
            gen2TotalEnergyMax += gen2TokenEnergyMaxs[i];
            wolfGameGen2.transferFrom(_msgSender(), controller, gen2TokenIds[i]);
        }
        if (gen0TokenCount > 0 && !isGen0SwapsEnabled) {
            revert Gen0SwapsNotEnabled();
        }
        if (gen1TokenCount > 0 && !isGen1SwapsEnabled) {
            revert Gen1SwapsNotEnabled();
        }
        if (gen2TokenIds.length > 0 && !isGen2SwapsEnabled) {
            revert Gen2SwapsNotEnabled();
        }
        uint256 chopsAmount = (gen0TokenCount * 1000 * gen0ChopsPerEnergyMax) + (gen1TokenCount * 800 * gen1ChopsPerEnergyMax) + (gen2TotalEnergyMax * gen2ChopsPerEnergyMax);
        emit ChopSwap(lastSwapId, _msgSender(), chopsAmount);
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    bool private _paused;

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

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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 // Deprecated in v4.8
    }

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

    /**
     * @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) {
        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.
            /// @solidity memory-safe-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 {
            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 = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        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.
     *
     * _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 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));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"initialWolfGameRebornAddress","type":"address"},{"internalType":"address","name":"initialWolfGameGen2Address","type":"address"},{"internalType":"address","name":"initialController","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotSwapWolf","type":"error"},{"inputs":[],"name":"Gen0SwapsNotEnabled","type":"error"},{"inputs":[],"name":"Gen1SwapsNotEnabled","type":"error"},{"inputs":[],"name":"Gen2MinEnergyMaxNotReached","type":"error"},{"inputs":[],"name":"Gen2SwapsNotEnabled","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"swapId","type":"uint256"},{"indexed":false,"internalType":"address","name":"swapper","type":"address"},{"indexed":false,"internalType":"uint256","name":"chopsAmount","type":"uint256"}],"name":"ChopSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"gen0Gen1TokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"gen2TokenIds","type":"uint256[]"},{"internalType":"uint16[]","name":"gen2TokenEnergyMaxs","type":"uint16[]"},{"internalType":"bytes","name":"gen2TokensSignature","type":"bytes"}],"name":"chopSwapSheep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gen0ChopsPerEnergyMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gen1ChopsPerEnergyMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gen2ChopsPerEnergyMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gen2MinimumEnergyMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrices","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isGen0SwapsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isGen1SwapsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isGen2SwapsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSwapId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"serverSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newController","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newIsGen0SwapsEnabled","type":"bool"},{"internalType":"bool","name":"newIsGen1SwapsEnabled","type":"bool"},{"internalType":"bool","name":"newIsGen2SwapsEnabled","type":"bool"},{"internalType":"uint256","name":"newGen0ChopsPerEnergyMax","type":"uint256"},{"internalType":"uint256","name":"newGen1ChopsPerEnergyMax","type":"uint256"},{"internalType":"uint256","name":"newGen2ChopsPerEnergyMax","type":"uint256"},{"internalType":"uint256","name":"newGen2MinimumEnergyMax","type":"uint256"}],"name":"setPrices","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newServerSigner","type":"address"}],"name":"setServerSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wolfGame","outputs":[{"internalType":"contract IWoolf","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wolfGameGen2","outputs":[{"internalType":"contract IWolfGameGen2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wolfGameReborn","outputs":[{"internalType":"contract IWolfGameReborn","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620018373803806200183783398101604081905262000034916200017f565b6200003f3362000112565b6000805460ff60a01b1916905560018055600380546001600160a01b0319166001600160a01b038516908117909155604080516309970f3760e21b8152905163265c3cdc916004808201926020929091908290030181865afa158015620000aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d09190620001c9565b600280546001600160a01b03199081166001600160a01b03938416179091556004805482169483169490941790935560058054909316911617905550620001ee565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200017a57600080fd5b919050565b6000806000606084860312156200019557600080fd5b620001a08462000162565b9250620001b06020850162000162565b9150620001c06040850162000162565b90509250925092565b600060208284031215620001dc57600080fd5b620001e78262000162565b9392505050565b61163980620001fe6000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c80638da5cb5b116100e3578063baa3d6861161008c578063f021c20b11610066578063f021c20b14610368578063f2fde38b14610375578063f77c47911461038857600080fd5b8063baa3d686146102d5578063bd9a548b146102e8578063eaba792d1461035557600080fd5b80639d6da146116100bd5780639d6da146146102b0578063b25a0aa6146102b9578063b9207156146102c257600080fd5b80638da5cb5b1461027957806392eefe9b1461028a57806398e862811461029d57600080fd5b80635c975abb11610145578063715018a61161011f578063715018a6146102575780638385624b1461025f5780638456cb591461027157600080fd5b80635c975abb1461021d5780635ec3d1581461023b5780636366f90f1461024457600080fd5b806331af19081161017657806331af1908146101f75780633f4ba83a1461020a57806356c4c8351461021457600080fd5b806303984a6d1461019d5780631f4ee314146101b957806326e0ed4a146101e4575b600080fd5b6101a660085481565b6040519081526020015b60405180910390f35b6004546101cc906001600160a01b031681565b6040516001600160a01b0390911681526020016101b0565b6002546101cc906001600160a01b031681565b600c546101cc906001600160a01b031681565b61021261039b565b005b6101a660095481565b600054600160a01b900460ff165b60405190151581526020016101b0565b6101a6600b5481565b610212610252366004611206565b6103e9565b6102126108c0565b60075461022b90610100900460ff1681565b6102126108d2565b6000546001600160a01b03166101cc565b6102126102983660046112f7565b61091e565b6102126102ab3660046112f7565b610955565b6101a660065481565b6101a6600a5481565b6102126102d0366004611335565b6109c8565b60075461022b9062010000900460ff1681565b610318600754600854600954600a54600b5460ff8086169661010087048216966201000090049091169493929190565b6040805197151588529515156020880152931515948601949094526060850191909152608084015260a083019190915260c082015260e0016101b0565b6003546101cc906001600160a01b031681565b60075461022b9060ff1681565b6102126103833660046112f7565b610a5b565b6005546101cc906001600160a01b031681565b6000546001600160a01b031633148015906103c157506005546001600160a01b03163314155b156103df5760405163ea8e4eb560e01b815260040160405180910390fd5b6103e7610af0565b565b6103f1610b45565b6103f9610b9e565b841561040d5761040d868686868686610bf8565b6006805490600061041d836113b9565b91905055506000806000600260009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561047a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049e91906113d2565b905060005b8a8110156105a05760008c8c838181106104bf576104bf6113eb565b9050602002013590506104d181610cc0565b8281116104ea576104e3600186611401565b94506104f8565b6104f5600185611401565b93505b6003546001600160a01b03166323b872dd3360055460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b15801561057457600080fd5b505af1158015610588573d6000803e3d6000fd5b50505050508080610598906113b9565b9150506104a3565b506000805b8981101561071557600b548989838181106105c2576105c26113eb565b90506020020160208101906105d7919061142b565b61ffff161015610613576040517f1559566300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b888882818110610625576106256113eb565b905060200201602081019061063a919061142b565b6106489061ffff1683611401565b6004549092506001600160a01b03166323b872dd336005546001600160a01b03168e8e8681811061067b5761067b6113eb565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156106ea57600080fd5b505af11580156106fe573d6000803e3d6000fd5b50505050808061070d906113b9565b9150506105a5565b50600084118015610729575060075460ff16155b15610760576040517f19f1a52e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000831180156107785750600754610100900460ff16155b156107af576040517f5e2a45d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b88158015906107c7575060075462010000900460ff16155b156107fe576040517f2ddab56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600a548261080e9190611446565b60095461081d86610320611446565b6108279190611446565b600854610836886103e8611446565b6108409190611446565b61084a9190611401565b6108549190611401565b90507f5d8b7bf7fdfbb4e75084e5fc630ed743b62a0443e8be1dea74e7eddc45d780c56006546108813390565b604080519283526001600160a01b039091166020830152810183905260600160405180910390a150505050506108b660018055565b5050505050505050565b6108c8610d87565b6103e76000610de1565b6000546001600160a01b031633148015906108f857506005546001600160a01b03163314155b156109165760405163ea8e4eb560e01b815260040160405180910390fd5b6103e7610e3e565b610926610d87565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480159061097b57506005546001600160a01b03163314155b156109995760405163ea8e4eb560e01b815260040160405180910390fd5b600c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633148015906109ee57506005546001600160a01b03163314155b15610a0c5760405163ea8e4eb560e01b815260040160405180910390fd5b6007805461ffff191697151561ff00191697909717610100961515969096029590951762ff00001916620100009415159490940293909317909455600855600992909255600a91909155600b55565b610a63610d87565b6001600160a01b038116610ae45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610aed81610de1565b50565b610af8610e81565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600260015403610b975760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610adb565b6002600155565b600054600160a01b900460ff16156103e75760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610adb565b600086868686604051602001610c11949392919061145d565b6040516020818303038152906040528051906020012090506000610c7684848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610c709250869150610eda9050565b90610f2d565b600c549091506001600160a01b038083169116146108b6576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002546040517f94e56847000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b0316906394e568479060240161014060405180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d489190611525565b8051909150610d83576040517fdf66def000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b6000546001600160a01b031633146103e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610adb565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e46610b9e565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b283390565b600054600160a01b900460ff166103e75760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610adb565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000610f3c8585610f53565b91509150610f4981610f98565b5090505b92915050565b6000808251604103610f895760208301516040840151606085015160001a610f7d878285856110fd565b94509450505050610f91565b506000905060025b9250929050565b6000816004811115610fac57610fac6115ed565b03610fb45750565b6001816004811115610fc857610fc86115ed565b036110155760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610adb565b6002816004811115611029576110296115ed565b036110765760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610adb565b600381600481111561108a5761108a6115ed565b03610aed5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610adb565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561113457506000905060036111b8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611188573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166111b1576000600192509250506111b8565b9150600090505b94509492505050565b60008083601f8401126111d357600080fd5b50813567ffffffffffffffff8111156111eb57600080fd5b6020830191508360208260051b8501011115610f9157600080fd5b6000806000806000806000806080898b03121561122257600080fd5b883567ffffffffffffffff8082111561123a57600080fd5b6112468c838d016111c1565b909a50985060208b013591508082111561125f57600080fd5b61126b8c838d016111c1565b909850965060408b013591508082111561128457600080fd5b6112908c838d016111c1565b909650945060608b01359150808211156112a957600080fd5b818b0191508b601f8301126112bd57600080fd5b8135818111156112cc57600080fd5b8c60208285010111156112de57600080fd5b6020830194508093505050509295985092959890939650565b60006020828403121561130957600080fd5b81356001600160a01b038116811461132057600080fd5b9392505050565b8015158114610aed57600080fd5b600080600080600080600060e0888a03121561135057600080fd5b873561135b81611327565b9650602088013561136b81611327565b9550604088013561137b81611327565b969995985095966060810135965060808101359560a0820135955060c0909101359350915050565b634e487b7160e01b600052601160045260246000fd5b6000600182016113cb576113cb6113a3565b5060010190565b6000602082840312156113e457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610f4d57610f4d6113a3565b803561ffff8116811461142657600080fd5b919050565b60006020828403121561143d57600080fd5b61132082611414565b8082028115828204841417610f4d57610f4d6113a3565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85111561148c57600080fd5b8460051b8087843782018460005b858110156114c45761ffff6114ae83611414565b168352602092830192919091019060010161149a565b5090979650505050505050565b604051610140810167ffffffffffffffff8111828210171561150357634e487b7160e01b600052604160045260246000fd5b60405290565b805161142681611327565b805160ff8116811461142657600080fd5b6000610140828403121561153857600080fd5b6115406114d1565b61154983611509565b815261155760208401611514565b602082015261156860408401611514565b604082015261157960608401611514565b606082015261158a60808401611514565b608082015261159b60a08401611514565b60a08201526115ac60c08401611514565b60c08201526115bd60e08401611514565b60e08201526101006115d0818501611514565b908201526101206115e2848201611514565b908201529392505050565b634e487b7160e01b600052602160045260246000fdfea26469706673582212205d05cc7b0d35274802d6ddef650b2d78849fb2ed4cf30493e7a7b2cab552672764736f6c634300081100330000000000000000000000007f36182dee28c45de6072a34d29855bae76dbe2f000000000000000000000000fb40afd6b7cb87922e4fd828771c62421447e1d5000000000000000000000000ce11d6fb4f1e006e5a348230449dc387fde850cc

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101985760003560e01c80638da5cb5b116100e3578063baa3d6861161008c578063f021c20b11610066578063f021c20b14610368578063f2fde38b14610375578063f77c47911461038857600080fd5b8063baa3d686146102d5578063bd9a548b146102e8578063eaba792d1461035557600080fd5b80639d6da146116100bd5780639d6da146146102b0578063b25a0aa6146102b9578063b9207156146102c257600080fd5b80638da5cb5b1461027957806392eefe9b1461028a57806398e862811461029d57600080fd5b80635c975abb11610145578063715018a61161011f578063715018a6146102575780638385624b1461025f5780638456cb591461027157600080fd5b80635c975abb1461021d5780635ec3d1581461023b5780636366f90f1461024457600080fd5b806331af19081161017657806331af1908146101f75780633f4ba83a1461020a57806356c4c8351461021457600080fd5b806303984a6d1461019d5780631f4ee314146101b957806326e0ed4a146101e4575b600080fd5b6101a660085481565b6040519081526020015b60405180910390f35b6004546101cc906001600160a01b031681565b6040516001600160a01b0390911681526020016101b0565b6002546101cc906001600160a01b031681565b600c546101cc906001600160a01b031681565b61021261039b565b005b6101a660095481565b600054600160a01b900460ff165b60405190151581526020016101b0565b6101a6600b5481565b610212610252366004611206565b6103e9565b6102126108c0565b60075461022b90610100900460ff1681565b6102126108d2565b6000546001600160a01b03166101cc565b6102126102983660046112f7565b61091e565b6102126102ab3660046112f7565b610955565b6101a660065481565b6101a6600a5481565b6102126102d0366004611335565b6109c8565b60075461022b9062010000900460ff1681565b610318600754600854600954600a54600b5460ff8086169661010087048216966201000090049091169493929190565b6040805197151588529515156020880152931515948601949094526060850191909152608084015260a083019190915260c082015260e0016101b0565b6003546101cc906001600160a01b031681565b60075461022b9060ff1681565b6102126103833660046112f7565b610a5b565b6005546101cc906001600160a01b031681565b6000546001600160a01b031633148015906103c157506005546001600160a01b03163314155b156103df5760405163ea8e4eb560e01b815260040160405180910390fd5b6103e7610af0565b565b6103f1610b45565b6103f9610b9e565b841561040d5761040d868686868686610bf8565b6006805490600061041d836113b9565b91905055506000806000600260009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561047a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049e91906113d2565b905060005b8a8110156105a05760008c8c838181106104bf576104bf6113eb565b9050602002013590506104d181610cc0565b8281116104ea576104e3600186611401565b94506104f8565b6104f5600185611401565b93505b6003546001600160a01b03166323b872dd3360055460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b15801561057457600080fd5b505af1158015610588573d6000803e3d6000fd5b50505050508080610598906113b9565b9150506104a3565b506000805b8981101561071557600b548989838181106105c2576105c26113eb565b90506020020160208101906105d7919061142b565b61ffff161015610613576040517f1559566300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b888882818110610625576106256113eb565b905060200201602081019061063a919061142b565b6106489061ffff1683611401565b6004549092506001600160a01b03166323b872dd336005546001600160a01b03168e8e8681811061067b5761067b6113eb565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156106ea57600080fd5b505af11580156106fe573d6000803e3d6000fd5b50505050808061070d906113b9565b9150506105a5565b50600084118015610729575060075460ff16155b15610760576040517f19f1a52e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000831180156107785750600754610100900460ff16155b156107af576040517f5e2a45d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b88158015906107c7575060075462010000900460ff16155b156107fe576040517f2ddab56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600a548261080e9190611446565b60095461081d86610320611446565b6108279190611446565b600854610836886103e8611446565b6108409190611446565b61084a9190611401565b6108549190611401565b90507f5d8b7bf7fdfbb4e75084e5fc630ed743b62a0443e8be1dea74e7eddc45d780c56006546108813390565b604080519283526001600160a01b039091166020830152810183905260600160405180910390a150505050506108b660018055565b5050505050505050565b6108c8610d87565b6103e76000610de1565b6000546001600160a01b031633148015906108f857506005546001600160a01b03163314155b156109165760405163ea8e4eb560e01b815260040160405180910390fd5b6103e7610e3e565b610926610d87565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480159061097b57506005546001600160a01b03163314155b156109995760405163ea8e4eb560e01b815260040160405180910390fd5b600c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633148015906109ee57506005546001600160a01b03163314155b15610a0c5760405163ea8e4eb560e01b815260040160405180910390fd5b6007805461ffff191697151561ff00191697909717610100961515969096029590951762ff00001916620100009415159490940293909317909455600855600992909255600a91909155600b55565b610a63610d87565b6001600160a01b038116610ae45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610aed81610de1565b50565b610af8610e81565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600260015403610b975760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610adb565b6002600155565b600054600160a01b900460ff16156103e75760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610adb565b600086868686604051602001610c11949392919061145d565b6040516020818303038152906040528051906020012090506000610c7684848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610c709250869150610eda9050565b90610f2d565b600c549091506001600160a01b038083169116146108b6576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002546040517f94e56847000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b0316906394e568479060240161014060405180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d489190611525565b8051909150610d83576040517fdf66def000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b6000546001600160a01b031633146103e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610adb565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e46610b9e565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b283390565b600054600160a01b900460ff166103e75760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610adb565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000610f3c8585610f53565b91509150610f4981610f98565b5090505b92915050565b6000808251604103610f895760208301516040840151606085015160001a610f7d878285856110fd565b94509450505050610f91565b506000905060025b9250929050565b6000816004811115610fac57610fac6115ed565b03610fb45750565b6001816004811115610fc857610fc86115ed565b036110155760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610adb565b6002816004811115611029576110296115ed565b036110765760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610adb565b600381600481111561108a5761108a6115ed565b03610aed5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610adb565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561113457506000905060036111b8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611188573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166111b1576000600192509250506111b8565b9150600090505b94509492505050565b60008083601f8401126111d357600080fd5b50813567ffffffffffffffff8111156111eb57600080fd5b6020830191508360208260051b8501011115610f9157600080fd5b6000806000806000806000806080898b03121561122257600080fd5b883567ffffffffffffffff8082111561123a57600080fd5b6112468c838d016111c1565b909a50985060208b013591508082111561125f57600080fd5b61126b8c838d016111c1565b909850965060408b013591508082111561128457600080fd5b6112908c838d016111c1565b909650945060608b01359150808211156112a957600080fd5b818b0191508b601f8301126112bd57600080fd5b8135818111156112cc57600080fd5b8c60208285010111156112de57600080fd5b6020830194508093505050509295985092959890939650565b60006020828403121561130957600080fd5b81356001600160a01b038116811461132057600080fd5b9392505050565b8015158114610aed57600080fd5b600080600080600080600060e0888a03121561135057600080fd5b873561135b81611327565b9650602088013561136b81611327565b9550604088013561137b81611327565b969995985095966060810135965060808101359560a0820135955060c0909101359350915050565b634e487b7160e01b600052601160045260246000fd5b6000600182016113cb576113cb6113a3565b5060010190565b6000602082840312156113e457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610f4d57610f4d6113a3565b803561ffff8116811461142657600080fd5b919050565b60006020828403121561143d57600080fd5b61132082611414565b8082028115828204841417610f4d57610f4d6113a3565b60007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85111561148c57600080fd5b8460051b8087843782018460005b858110156114c45761ffff6114ae83611414565b168352602092830192919091019060010161149a565b5090979650505050505050565b604051610140810167ffffffffffffffff8111828210171561150357634e487b7160e01b600052604160045260246000fd5b60405290565b805161142681611327565b805160ff8116811461142657600080fd5b6000610140828403121561153857600080fd5b6115406114d1565b61154983611509565b815261155760208401611514565b602082015261156860408401611514565b604082015261157960608401611514565b606082015261158a60808401611514565b608082015261159b60a08401611514565b60a08201526115ac60c08401611514565b60c08201526115bd60e08401611514565b60e08201526101006115d0818501611514565b908201526101206115e2848201611514565b908201529392505050565b634e487b7160e01b600052602160045260246000fdfea26469706673582212205d05cc7b0d35274802d6ddef650b2d78849fb2ed4cf30493e7a7b2cab552672764736f6c63430008110033

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

0000000000000000000000007f36182dee28c45de6072a34d29855bae76dbe2f000000000000000000000000fb40afd6b7cb87922e4fd828771c62421447e1d5000000000000000000000000ce11d6fb4f1e006e5a348230449dc387fde850cc

-----Decoded View---------------
Arg [0] : initialWolfGameRebornAddress (address): 0x7F36182DeE28c45dE6072a34D29855BaE76DBe2f
Arg [1] : initialWolfGameGen2Address (address): 0xfB40Afd6b7CB87922e4fD828771C62421447E1D5
Arg [2] : initialController (address): 0xCE11D6fb4f1e006E5a348230449Dc387fde850CC

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000007f36182dee28c45de6072a34d29855bae76dbe2f
Arg [1] : 000000000000000000000000fb40afd6b7cb87922e4fd828771c62421447e1d5
Arg [2] : 000000000000000000000000ce11d6fb4f1e006e5a348230449dc387fde850cc


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

OVERVIEW

Instantly swap your sheep for chops

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.