ETH Price: $3,309.42 (-2.98%)
Gas: 12 Gwei

Contract

0xcb7A9a86fcd4CaCeFE998781B426A849b809Df2A
 
Transaction Hash
Method
Block
From
To
Value
Claim Gift187350092023-12-07 14:28:47209 days ago1701959327IN
0xcb7A9a86...9b809Df2A
0 ETH0.0015974569.45452496
Add Gift Tokens ...180348332023-08-31 13:23:59307 days ago1693488239IN
0xcb7A9a86...9b809Df2A
0 ETH0.041645324.13407617
Add Gift Tokens ...180348202023-08-31 13:21:11307 days ago1693488071IN
0xcb7A9a86...9b809Df2A
0 ETH0.0010455419.42745969
Add Gift Tokens ...180348122023-08-31 13:19:35307 days ago1693487975IN
0xcb7A9a86...9b809Df2A
0 ETH0.0010448119.41390042
Set Maximum Gift...180347712023-08-31 13:11:23307 days ago1693487483IN
0xcb7A9a86...9b809Df2A
0 ETH0.0005110117.66131649
Add Gift Tokens ...180347592023-08-31 13:08:59307 days ago1693487339IN
0xcb7A9a86...9b809Df2A
0 ETH0.0007506518.22235468
Set White Listed...180347442023-08-31 13:05:59307 days ago1693487159IN
0xcb7A9a86...9b809Df2A
0 ETH0.0008540318.23374439
Set White Listed...180347382023-08-31 13:04:47307 days ago1693487087IN
0xcb7A9a86...9b809Df2A
0 ETH0.0004729818.97571635
Set Gift Transfe...180258272023-08-30 7:07:35308 days ago1693379255IN
0xcb7A9a86...9b809Df2A
0 ETH0.0005414418.46044359
Transfer Ownersh...170733382023-04-18 11:41:59442 days ago1681818119IN
0xcb7A9a86...9b809Df2A
0 ETH0.0012668343.62061866
Send Gift170621572023-04-16 21:41:47443 days ago1681681307IN
0xcb7A9a86...9b809Df2A
0 ETH0.005974332.80440687
Claim Gift170621562023-04-16 21:41:35443 days ago1681681295IN
0xcb7A9a86...9b809Df2A
0 ETH0.0034251932.22774239
Set Gift Claimin...170240562023-04-11 9:46:23449 days ago1681206383IN
0xcb7A9a86...9b809Df2A
0 ETH0.0007498823.70725347
Set Gift Claimin...169243372023-03-28 7:24:47463 days ago1679988287IN
0xcb7A9a86...9b809Df2A
0 ETH0.0007466623.60547851
Send Gift168931192023-03-23 22:10:47467 days ago1679609447IN
0xcb7A9a86...9b809Df2A
0 ETH0.0047819726.25741622
Claim Gift168931182023-03-23 22:10:35467 days ago1679609435IN
0xcb7A9a86...9b809Df2A
0 ETH0.0027831126.18634216
Send Gift167963232023-03-10 7:40:47481 days ago1678434047IN
0xcb7A9a86...9b809Df2A
0 ETH0.0050911727.95520716
Claim Gift167963222023-03-10 7:40:35481 days ago1678434035IN
0xcb7A9a86...9b809Df2A
0 ETH0.0025109823.62588127
Set Gift Claimin...166474742023-02-17 9:13:11502 days ago1676625191IN
0xcb7A9a86...9b809Df2A
0 ETH0.000815625.78485952
Send Gift165447732023-02-03 0:45:23516 days ago1675385123IN
0xcb7A9a86...9b809Df2A
0 ETH0.0053982629.64143405
Claim Gift165447722023-02-03 0:45:11516 days ago1675385111IN
0xcb7A9a86...9b809Df2A
0 ETH0.0031037629.20338772
Send Gift165028572023-01-28 4:14:59522 days ago1674879299IN
0xcb7A9a86...9b809Df2A
0 ETH0.0030301915.21039162
Claim Gift165028562023-01-28 4:14:47522 days ago1674879287IN
0xcb7A9a86...9b809Df2A
0 ETH0.0015987415.04261425
Send Gift164965382023-01-27 7:02:59523 days ago1674802979IN
0xcb7A9a86...9b809Df2A
0 ETH0.0034174617.15433171
Claim Gift164965372023-01-27 7:02:47523 days ago1674802967IN
0xcb7A9a86...9b809Df2A
0 ETH0.0015856914.91986657
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:
ClaimGift

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : ClaimGift.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.16;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/interfaces/IERC1155Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IAnimeMetaverseReward.sol";
import "./GiftIndexListManager.sol";

error InsufficientGiftBoxTokenAmount();
error InvalidDataLength();
error InvalidGiftContractType();
error InsufficientGiftTokenAmount();
error NotApprovedForAll();
error NotOwnerOfToken(uint256 _tokenId, address _collectionAddress);
error GiftNotAvailable();
error NotAbleToRescue();
error GiftClaimNotActive();
error NotWhiteListed();
error GiftSupplyExceedsMaxSupply();
error ClaimingNotAllowedOutsideValidTimeWindow();
error InvalidTimeStamp();
error NotGiftTransferCaller();
error GiftAlreadyClaimedForThisRequest();
error InvalidRequestId();
error InvalidGiftListManagerIndex();

contract ClaimGift is Ownable, IERC1155Receiver, ReentrancyGuard, IERC721Receiver, GiftIndexListManager {
    using SafeMath for uint256;

    ///@dev Event for transfering a gift to the calimer wallet address
    event GiftTokenTransferred(
        uint256 requestId,
        address userWallet,
        address collectionAddress,
        uint256 tokenId,
        uint256 tokenType,
        uint256 randomNumber
    );

    ///@dev Event after completing gift claim request
    event ClaimGiftRequestComplete(uint256 requestId, uint256 requestAmount, address userWallet);

    ///@dev Modifier that blocks to call the method from any different smart contract
    modifier noContracts() {
        uint256 size;
        address acc = msg.sender;
        assembly {
            size := extcodesize(acc)
        }
        require(msg.sender == tx.origin, "tx.origin != msg.sender");
        require(size == 0, "Contract calls are not allowed");
        _;
    }

    ///@dev AnimeMetaverseGachaReward contract address
    address public rewardContractAddress;
    ///@dev Gift transfer caller wallet address
    address public giftTransferCallerWallet;
    ///@dev TokenId of GiftOfSoul from AnimeMetaverseReward contract
    uint256 public giftBoxTokenId = 1;
    ///@dev Maximum amount of gift for user
    uint256 public maximumGiftSupply = 170;
    ///@dev Amount of total user claimed gift
    uint256 public totalClaimedGift;
    ///@dev Total amount of gift added by the whitelisted user
    uint256 public totalGiftAmount;
    ///@dev Available gift amount that user can claim
    uint256 public availableGiftAmount;
    ///@dev Starting timestamp for claiming gift
    uint256 public claimingStartsAtTimeStamp;
    ///@dev Ending timestamp for claiming gift
    uint256 public claimingEndsAtTimeStamp;
    ///@dev Ending timestamp for claiming gift
    uint256 public totalClaimRequest;
    ///@dev Flag for pausing gift claim
    bool public giftClaimActive = true;

    ///@dev Wallet mapping for the eligibility to add gift
    mapping(address => bool) public whiteListedWallets;

    ///@dev Claimer user wallet mapping with claim requestId
    mapping(uint256 => address) public giftClaimer;

    ///@dev Claimed gift amount mapping with claim requestId
    mapping(uint256 => uint256) public claimedAmount;

    ///@dev Claimed gift request status maping with claim requestId
    mapping(uint256 => bool) public claimCompleted;

    ///@dev Gift Contract Type enum
    ///@dev for ERC_1155 it is 0
    ///@dev for ERC_721 is is 1
    enum GiftContractType {
        ERC_1155,
        ERC_721
    }

    ///@dev Modifier for adding gift
    ///@notice Only whitelisted wallet will be able to add gift token
    modifier onlyWhiteListed(address _walletAddress) {
        if (!whiteListedWallets[_walletAddress]) {
            revert NotWhiteListed();
        }
        _;
    }

    ///@dev Gift token structure for input parameters
    struct GiftTokenInput {
        address collectionAddress;
        uint256 giftTokenId;
        uint256 giftCollectionContractType;
        uint256 amount;
    }

    ///@dev Gift token structure for storing gift token information
    struct GiftToken {
        address collectionAddress;
        address receiverWallet;
        uint256 giftTokenId;
        uint256 claimIndex;
        uint256 giftCollectionContractType;
        bool isGivenAway;
        bool isRescued;
    }

    ///@dev Gift token map as storage of gift information
    mapping(uint256 => GiftToken) public giftTokens;

    ///@dev ClaimGift contract constractor
    ///@param _rewardContractAddress Gacha reword contract address
    ///@param _giftTransferCallerWallet Wallet address for calling gift transfer call
    ///@param _claimingStartsAtTimeStamp Gift claiming start timestamp
    ///@param _claimingEndsAtTimeStamp Gift claiming end timestamp
    constructor(
        address _rewardContractAddress,
        address _giftTransferCallerWallet,
        uint256 _claimingStartsAtTimeStamp,
        uint256 _claimingEndsAtTimeStamp
    ) {
        giftTransferCallerWallet = _giftTransferCallerWallet;
        rewardContractAddress = _rewardContractAddress;
        claimingStartsAtTimeStamp = _claimingStartsAtTimeStamp;
        claimingEndsAtTimeStamp = _claimingEndsAtTimeStamp;
    }

    ///@dev Adds ERC1155 gift token to smart contract
    ///@notice Only the whitelisted wallet address can add gift token
    ///@notice Gift collection address should be setApprovedForAll for the ClaimGift contract
    ///@param _tokenId Gift tokenId
    ///@param _collectionAddress Gift collection contract address
    ///@param _amount amount of gift token for adding as gift
    function addERC1155GiftTokensToSmartContract(
        uint256 _tokenId,
        address _collectionAddress,
        uint256 _amount
    ) public onlyWhiteListed(msg.sender) {
        if (totalGiftAmount + _amount > maximumGiftSupply) {
            revert GiftSupplyExceedsMaxSupply();
        }

        ERC1155 GiftTokenContract = ERC1155(_collectionAddress);
        if (GiftTokenContract.balanceOf(msg.sender, _tokenId) < _amount) {
            revert InsufficientGiftTokenAmount();
        }

        if (!GiftTokenContract.isApprovedForAll(msg.sender, address(this))) {
            revert NotApprovedForAll();
        }

        for (uint256 index = 0; index < _amount; index = _uncheckedInc(index)) {
            unchecked {
                totalGiftAmount++;
                availableGiftAmount++;
            }

            giftTokens[totalGiftAmount] = GiftToken({
                collectionAddress: _collectionAddress,
                giftTokenId: _tokenId,
                receiverWallet: address(0),
                claimIndex: 0,
                giftCollectionContractType: uint256(GiftContractType.ERC_1155),
                isGivenAway: false,
                isRescued: false
            });
            addGiftIndex(totalGiftAmount);
        }

        GiftTokenContract.safeTransferFrom(msg.sender, address(this), _tokenId, _amount, "");
    }

    ///@dev Adds ERC721 gift token to the smart contract
    ///@notice Only the whitelisted wallet address can add gift token
    ///@notice Gift collection address should be setApprovedForAll for the ClaimGift contract
    ///@param _tokenId Gift tokenId
    ///@param _collectionAddress Gift collection contract address
    function addERC712GiftTokensToSmartContract(uint256 _tokenId, address _collectionAddress) public onlyWhiteListed(msg.sender) {
        if (totalGiftAmount + 1 > maximumGiftSupply) {
            revert GiftSupplyExceedsMaxSupply();
        }

        ERC721 GiftTokenContract = ERC721(_collectionAddress);
        if (GiftTokenContract.ownerOf(_tokenId) != msg.sender) {
            revert NotOwnerOfToken(_tokenId, _collectionAddress);
        }

        if (!GiftTokenContract.isApprovedForAll(msg.sender, address(this))) {
            revert NotApprovedForAll();
        }

        unchecked {
            totalGiftAmount++;
            availableGiftAmount++;
        }

        giftTokens[totalGiftAmount] = GiftToken({
            collectionAddress: _collectionAddress,
            giftTokenId: _tokenId,
            receiverWallet: address(0),
            claimIndex: 0,
            giftCollectionContractType: uint256(GiftContractType.ERC_721),
            isGivenAway: false,
            isRescued: false
        });

        addGiftIndex(totalGiftAmount);

        GiftTokenContract.safeTransferFrom(msg.sender, address(this), _tokenId);
    }

    ///@dev Adds gift tokens in batch
    ///@notice Only the whitelisted wallet address can add gift token
    ///@notice Gift collection address should be setApprovedForAll for the ClaimGift contract
    ///@param _giftTokens Gift token list
    function addGiftTokensToSmartContract(GiftTokenInput[] calldata _giftTokens) external onlyWhiteListed(msg.sender) {
        if (_giftTokens.length < 1) {
            revert InvalidDataLength();
        }

        for (uint256 index = 0; index < _giftTokens.length; index = _uncheckedInc(index)) {
            if (_giftTokens[index].giftCollectionContractType == uint256(GiftContractType.ERC_1155)) {
                addERC1155GiftTokensToSmartContract(_giftTokens[index].giftTokenId, _giftTokens[index].collectionAddress, _giftTokens[index].amount);
            } else if (_giftTokens[index].giftCollectionContractType == uint256(GiftContractType.ERC_721)) {
                addERC712GiftTokensToSmartContract(_giftTokens[index].giftTokenId, _giftTokens[index].collectionAddress);
            } else {
                revert InvalidGiftContractType();
            }
        }
    }

    ///@dev Sets whitelisted wallet for adding gift
    ///@notice Only contract can update whitelisted wallet address list
    ///@param _walletAddress Wallet address for adding gift token
    ///@param _flag Whitelisting wallet address flag
    function setWhiteListedWallet(address _walletAddress, bool _flag) external onlyOwner {
        whiteListedWallets[_walletAddress] = _flag;
    }

    ///@dev Rescue gift token for emergency case. The contract owner can
    ///@dev remove gift from the contract if it is not already given away or
    ///@dev rescued before.
    ///@notice Only contract can rescue gift token
    ///@param _giftIndex TokenId to rescue
    ///@param _transferTo Wallet address of receiver
    function rescueGiftToken(
        uint256 _giftIndex,
        address _transferTo,
        uint256 _giftListManagerIndex
    ) external nonReentrant onlyOwner {
        if (giftTokens[_giftIndex].giftCollectionContractType == uint256(GiftContractType.ERC_1155)) {
            ERC1155 giftContract = ERC1155(giftTokens[_giftIndex].collectionAddress);

            if (!giftTokens[_giftIndex].isGivenAway && !giftTokens[_giftIndex].isRescued) {
                giftTokens[_giftIndex].isRescued = true;
                unchecked {
                    availableGiftAmount--;
                }

                if (giftIndexs[_giftListManagerIndex] == _giftIndex) {
                    removeGiftIndex(_giftListManagerIndex);
                } else {
                    revert InvalidGiftListManagerIndex();
                }
                giftContract.safeTransferFrom(address(this), _transferTo, giftTokens[_giftIndex].giftTokenId, 1, "");
            } else {
                revert NotAbleToRescue();
            }
        } else {
            ERC721 giftContract = ERC721(giftTokens[_giftIndex].collectionAddress);

            if (giftContract.ownerOf(giftTokens[_giftIndex].giftTokenId) == address(this)) {
                giftTokens[_giftIndex].isRescued = true;
                unchecked {
                    availableGiftAmount--;
                }

                if (giftIndexs[_giftListManagerIndex] == _giftIndex) {
                    removeGiftIndex(_giftListManagerIndex);
                } else {
                    revert InvalidGiftListManagerIndex();
                }

                giftContract.safeTransferFrom(address(this), _transferTo, giftTokens[_giftIndex].giftTokenId);
            } else {
                revert NotAbleToRescue();
            }
        }
    }

    ///@dev External method for claiming gift
    ///@param _claimGiftAmount Gift of soul token amount for burning and claiming gif token
    function claimGift(uint256 _claimGiftAmount) external nonReentrant noContracts {
        ERC1155 RewardContract = ERC1155(rewardContractAddress);
        if (RewardContract.balanceOf(msg.sender, giftBoxTokenId) < _claimGiftAmount) {
            revert InsufficientGiftBoxTokenAmount();
        }

        if (!giftClaimActive) {
            revert GiftClaimNotActive();
        }

        if (block.timestamp < claimingStartsAtTimeStamp || block.timestamp > claimingEndsAtTimeStamp) {
            revert ClaimingNotAllowedOutsideValidTimeWindow();
        }

        if (_claimGiftAmount < 1) {
            revert InsufficientGiftBoxTokenAmount();
        }

        if (availableGiftAmount < _claimGiftAmount) {
            revert GiftNotAvailable();
        }

        unchecked {
            totalClaimRequest++;
        }

        giftClaimer[totalClaimRequest] = msg.sender;
        claimedAmount[totalClaimRequest] = _claimGiftAmount;

        IAnimeMetaverseReward AnimeMetaverseReward = IAnimeMetaverseReward(rewardContractAddress);
        AnimeMetaverseReward.forceBurn(msg.sender, giftBoxTokenId, _claimGiftAmount);
        emit ClaimGiftRequestComplete(totalClaimRequest, _claimGiftAmount, msg.sender);
    }

    ///@dev Generate a random number with a seed value
    ///@param _seed created by backend to generate random number
    function getRandomNumber(uint256 _seed) internal view returns (uint256) {
        uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp + _seed + block.difficulty + availableGiftAmount)));

        return randomNumber;
    }

    ///@dev Sends gift to the user. Only one giftTransferCallerWallet can call this method
    ///@param _claimRequestId requestId created by user during claiming
    ///@param _randomSeed created by beckend code so that smart contract can generate a random number
    function sendGift(uint256 _claimRequestId, uint256 _randomSeed) public {
        if (msg.sender != giftTransferCallerWallet) {
            revert NotGiftTransferCaller();
        }

        if (_claimRequestId < 1 || _claimRequestId > totalClaimRequest) {
            revert InvalidRequestId();
        }

        if (claimCompleted[_claimRequestId]) {
            revert GiftAlreadyClaimedForThisRequest();
        }

        claimCompleted[_claimRequestId] = true;

        for (uint256 index = 0; index < claimedAmount[_claimRequestId]; index = _uncheckedInc(index)) {
            uint256 randomNumber = getRandomNumber(_randomSeed);
            uint256 selectedIndex = randomNumber.mod(giftIndexCount) + 1;
            uint256 giftTokenIndex = giftIndexs[selectedIndex];
            removeGiftIndex(selectedIndex);

            unchecked {
                totalClaimedGift++;
                availableGiftAmount--;
            }

            giftTokens[giftTokenIndex].isGivenAway = true;
            giftTokens[giftTokenIndex].receiverWallet = giftClaimer[_claimRequestId];
            giftTokens[giftTokenIndex].claimIndex = totalClaimedGift;

            if (giftTokens[giftTokenIndex].giftCollectionContractType == uint256(GiftContractType.ERC_1155)) {
                ERC1155 GiftTokenContract = ERC1155(giftTokens[giftTokenIndex].collectionAddress);

                GiftTokenContract.safeTransferFrom(
                    address(this),
                    giftTokens[giftTokenIndex].receiverWallet,
                    giftTokens[giftTokenIndex].giftTokenId,
                    1,
                    ""
                );
            } else {
                ERC721 GiftTokenContract = ERC721(giftTokens[giftTokenIndex].collectionAddress);
                GiftTokenContract.transferFrom(address(this), giftTokens[giftTokenIndex].receiverWallet, giftTokens[giftTokenIndex].giftTokenId);
            }

            emit GiftTokenTransferred(
                _claimRequestId,
                giftTokens[giftTokenIndex].receiverWallet,
                giftTokens[giftTokenIndex].collectionAddress,
                giftTokens[giftTokenIndex].giftTokenId,
                giftTokens[giftTokenIndex].giftCollectionContractType,
                randomNumber
            );
        }
    }

    ///@dev Sets gift claiming status
    ///@notice Only contract can active gift claim status and pause it
    ///@param _giftClaimStatus Gift claim status
    function setGiftClaimStatus(bool _giftClaimStatus) external onlyOwner {
        giftClaimActive = _giftClaimStatus;
    }

    ///@dev Sets reword smart contract address
    ///@notice Only contract can update reward contract address
    ///@param _giftTransferCallerWallet Gacha reword contract address
    function setGiftTransferCallerWallet(address _giftTransferCallerWallet) external onlyOwner {
        giftTransferCallerWallet = _giftTransferCallerWallet;
    }

    ///@dev Sets reword smart contract address
    ///@notice Only contract can update reward contract address
    ///@param _rewardContractAddress Gacha reword contract address
    function setRewardContract(address _rewardContractAddress) external onlyOwner {
        rewardContractAddress = _rewardContractAddress;
    }

    ///@dev Sets gift of soul token Id
    ///@notice Only contract can update reward token Id to burn
    ///@param _giftBoxTokenId Gift of soul tokenId
    function setGiftBoxTokenId(uint256 _giftBoxTokenId) external onlyOwner {
        giftBoxTokenId = _giftBoxTokenId;
    }

    ///@dev Sets gift of soul token Id
    ///@notice Only contract can update reward token Id to burn
    ///@param _claimingStartsAtTimeStamp Gift claiming start timestamp
    ///@param _claimingEndsAtTimeStamp Gift claiming end timestamp
    function setGiftClaimingTimeStamp(uint256 _claimingStartsAtTimeStamp, uint256 _claimingEndsAtTimeStamp) external onlyOwner {
        if (_claimingEndsAtTimeStamp <= _claimingStartsAtTimeStamp) {
            revert InvalidTimeStamp();
        }

        claimingStartsAtTimeStamp = _claimingStartsAtTimeStamp;
        claimingEndsAtTimeStamp = _claimingEndsAtTimeStamp;
    }

    ///@dev Sets maximum gift token amount
    ///@notice Only contract can update maximum gift token amount
    ///@param _maximumGiftSupply amount of maximum gift token for claiming
    function setMaximumGiftSupply(uint256 _maximumGiftSupply) external onlyOwner {
        maximumGiftSupply = _maximumGiftSupply;
    }

    ///@dev onERC1155Received needs to implement for getting the accepting ERC-1155
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes calldata
    ) external pure returns (bytes4) {
        return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"));
    }

    ///@dev onERC1155BatchReceived needs to implement for getting the accepting ERC-1155
    function onERC1155BatchReceived(
        address,
        address,
        uint256[] calldata,
        uint256[] calldata,
        bytes calldata
    ) external pure returns (bytes4) {
        return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"));
    }

    ///@dev onERC721Received needs to implement for getting the accepting ERC-721
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) external pure returns (bytes4) {
        return IERC721Receiver.onERC721Received.selector;
    }

    ///@dev supportsInterface needs to implement for getting the accepting ERC-1155
    function supportsInterface(bytes4 interfaceID) external pure returns (bool) {
        return interfaceID == type(IERC1155Receiver).interfaceId || interfaceID == type(IERC721Receiver).interfaceId;
    }

    /// @dev Unchecked increment function, just to reduce gas usage
    /// @notice This value can not be greater than 170
    /// @param value value to be incremented, should not overflow 2**256 - 1
    /// @return incremented value
    function _uncheckedInc(uint256 value) private pure returns (uint256) {
        unchecked {
            return value + 1;
        }
    }
}

File 2 of 22 : Ownable.sol
// 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);
    }
}

File 3 of 22 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 4 of 22 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../token/ERC1155/IERC1155Receiver.sol";

File 5 of 22 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Receiver.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721Receiver.sol";

File 6 of 22 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC1155).interfaceId ||
            interfaceId == type(IERC1155MetadataURI).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 7 of 22 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}
}

File 8 of 22 : ReentrancyGuard.sol
// 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;
    }
}

File 9 of 22 : IAnimeMetaverseReward.sol
// SPDX-License-Identifier: Unlicense

pragma solidity ^0.8.15;

interface IAnimeMetaverseReward {
    function mintBatch(
        uint256 ticket,
        uint256 _drawIndex,
        uint256 _activityId,
        address _to,
        uint256[] memory _ids,
        uint256[] memory _amounts,
        bytes memory _data
    ) external;

    function mint(
        uint256 ticket,
        uint256 _drawIndex,
        uint256 _activityId,
        address _to,
        uint256 _id,
        uint256 _amount,
        bytes memory _data
    ) external;

    function forceBurn(
        address _account,
        uint256 _id,
        uint256 _amount
    ) external;
}

File 10 of 22 : GiftIndexListManager.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.16;

error InvalidIndex();

/// @title GiftIndexListManager: Utility function for developing claim gift smart contract
/// @author LiquidX
/// @notice This smart contract contains helping functionalities for claim gift smart contract
contract GiftIndexListManager {
    uint256 public giftIndexCount = 0;

    uint256[300] public giftIndexs;

    ///@dev remove a gfit index from giftIndex list
    function removeGiftIndex(uint256 _index) internal {
        giftIndexs[_index] = giftIndexs[giftIndexCount];
        giftIndexCount--;
    }

    ///@dev add a gift index in giftIndex list
    function addGiftIndex(uint256 _index) internal {
        giftIndexCount++;
        giftIndexs[giftIndexCount] = _index;
    }

    ///@dev returns a gift index from giftIndex list at a specific point
    function getGiftListManagerIndexOf(uint256 _valueOfIndex) public view returns (uint256) {
        uint256 selectedIndex = 0;
        for (uint256 index = 1; index <= giftIndexCount; index++) {
            if (giftIndexs[index] == _valueOfIndex) {
                selectedIndex = index;
                break;
            }
        }
        return selectedIndex;
    }
}

File 11 of 22 : 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 12 of 22 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 13 of 22 : 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 14 of 22 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 15 of 22 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 16 of 22 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 17 of 22 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 18 of 22 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 19 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

File 20 of 22 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 21 of 22 : Strings.sol
// 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);
    }
}

File 22 of 22 : Math.sol
// 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);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardContractAddress","type":"address"},{"internalType":"address","name":"_giftTransferCallerWallet","type":"address"},{"internalType":"uint256","name":"_claimingStartsAtTimeStamp","type":"uint256"},{"internalType":"uint256","name":"_claimingEndsAtTimeStamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ClaimingNotAllowedOutsideValidTimeWindow","type":"error"},{"inputs":[],"name":"GiftAlreadyClaimedForThisRequest","type":"error"},{"inputs":[],"name":"GiftClaimNotActive","type":"error"},{"inputs":[],"name":"GiftNotAvailable","type":"error"},{"inputs":[],"name":"GiftSupplyExceedsMaxSupply","type":"error"},{"inputs":[],"name":"InsufficientGiftBoxTokenAmount","type":"error"},{"inputs":[],"name":"InsufficientGiftTokenAmount","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidGiftContractType","type":"error"},{"inputs":[],"name":"InvalidGiftListManagerIndex","type":"error"},{"inputs":[],"name":"InvalidRequestId","type":"error"},{"inputs":[],"name":"InvalidTimeStamp","type":"error"},{"inputs":[],"name":"NotAbleToRescue","type":"error"},{"inputs":[],"name":"NotApprovedForAll","type":"error"},{"inputs":[],"name":"NotGiftTransferCaller","type":"error"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"NotOwnerOfToken","type":"error"},{"inputs":[],"name":"NotWhiteListed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"userWallet","type":"address"}],"name":"ClaimGiftRequestComplete","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"address","name":"userWallet","type":"address"},{"indexed":false,"internalType":"address","name":"collectionAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"GiftTokenTransferred","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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addERC1155GiftTokensToSmartContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"addERC712GiftTokensToSmartContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionAddress","type":"address"},{"internalType":"uint256","name":"giftTokenId","type":"uint256"},{"internalType":"uint256","name":"giftCollectionContractType","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ClaimGift.GiftTokenInput[]","name":"_giftTokens","type":"tuple[]"}],"name":"addGiftTokensToSmartContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableGiftAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimGiftAmount","type":"uint256"}],"name":"claimGift","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimingEndsAtTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimingStartsAtTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_valueOfIndex","type":"uint256"}],"name":"getGiftListManagerIndexOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"giftBoxTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"giftClaimActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"giftClaimer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"giftIndexCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"giftIndexs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"giftTokens","outputs":[{"internalType":"address","name":"collectionAddress","type":"address"},{"internalType":"address","name":"receiverWallet","type":"address"},{"internalType":"uint256","name":"giftTokenId","type":"uint256"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint256","name":"giftCollectionContractType","type":"uint256"},{"internalType":"bool","name":"isGivenAway","type":"bool"},{"internalType":"bool","name":"isRescued","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"giftTransferCallerWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximumGiftSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_giftIndex","type":"uint256"},{"internalType":"address","name":"_transferTo","type":"address"},{"internalType":"uint256","name":"_giftListManagerIndex","type":"uint256"}],"name":"rescueGiftToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimRequestId","type":"uint256"},{"internalType":"uint256","name":"_randomSeed","type":"uint256"}],"name":"sendGift","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_giftBoxTokenId","type":"uint256"}],"name":"setGiftBoxTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_giftClaimStatus","type":"bool"}],"name":"setGiftClaimStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimingStartsAtTimeStamp","type":"uint256"},{"internalType":"uint256","name":"_claimingEndsAtTimeStamp","type":"uint256"}],"name":"setGiftClaimingTimeStamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_giftTransferCallerWallet","type":"address"}],"name":"setGiftTransferCallerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maximumGiftSupply","type":"uint256"}],"name":"setMaximumGiftSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardContractAddress","type":"address"}],"name":"setRewardContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_walletAddress","type":"address"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setWhiteListedWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalClaimRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimedGift","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGiftAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteListedWallets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

6080604052600060025560016101315560aa61013255600161013960006101000a81548160ff0219169083151502179055503480156200003e57600080fd5b5060405162003c5f38038062003c5f83398181016040528101906200006491906200029a565b62000084620000786200012960201b60201c565b6200013160201b60201c565b600180819055508261013060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508361012f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081610136819055508061013781905550505050506200030c565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200022782620001fa565b9050919050565b62000239816200021a565b81146200024557600080fd5b50565b60008151905062000259816200022e565b92915050565b6000819050919050565b62000274816200025f565b81146200028057600080fd5b50565b600081519050620002948162000269565b92915050565b60008060008060808587031215620002b757620002b6620001f5565b5b6000620002c78782880162000248565b9450506020620002da8782880162000248565b9350506040620002ed8782880162000283565b9250506060620003008782880162000283565b91505092959194509250565b613943806200031c6000396000f3fe608060405234801561001057600080fd5b506004361061023c5760003560e01c80637e91bdca1161013b578063bc197c81116100b8578063f23a6e611161007c578063f23a6e61146106b9578063f2fde38b146106e9578063f5eb656414610705578063fcda136b14610723578063fe85f9d81461073f5761023c565b8063bc197c8114610615578063c2a08df514610645578063c8a2582f14610663578063dbed8a6a1461067f578063eb215d241461069d5761023c565b80639052d06f116100ff5780639052d06f1461058757806391406c7d146105a357806399b7fa4c146105bf578063ac92e9ad146105dd578063acb52286146105f95761023c565b80637e91bdca146104d9578063804a4ac9146104f75780638ac4d8c6146105155780638da5cb5b1461054b5780638f88fa5e146105695761023c565b806351508f0a116101c95780635c6242201161018d5780635c62422014610447578063605d6c03146104775780636bd1263014610495578063715018a6146104b357806378cbf86c146104bd5761023c565b806351508f0a146103b9578063544b2514146103d557806354d2df4a146103f157806355b2cf571461040f57806358f489851461042b5761023c565b8063060c5fe811610210578063060c5fe8146102dd578063150b7a02146102f9578063190cbd5d1461032957806347f92935146103595780634f9b741d146103895761023c565b80626cb8831461024157806301ffc9a71461027157806303225dd8146102a157806303945358146102bf575b600080fd5b61025b60048036038101906102569190612a51565b61076f565b6040516102689190612a8d565b60405180910390f35b61028b60048036038101906102869190612b00565b610788565b6040516102989190612b48565b60405180910390f35b6102a961085a565b6040516102b69190612a8d565b60405180910390f35b6102c7610861565b6040516102d49190612a8d565b60405180910390f35b6102f760048036038101906102f29190612a51565b610868565b005b610313600480360381019061030e9190612c26565b61087b565b6040516103209190612cbd565b60405180910390f35b610343600480360381019061033e9190612a51565b610890565b6040516103509190612a8d565b60405180910390f35b610373600480360381019061036e9190612a51565b6108ac565b6040516103809190612b48565b60405180910390f35b6103a3600480360381019061039e9190612a51565b6108cd565b6040516103b09190612ce7565b60405180910390f35b6103d360048036038101906103ce9190612d02565b610901565b005b6103ef60048036038101906103ea9190612d5b565b61094e565b005b6103f9610974565b6040516104069190612a8d565b60405180910390f35b61042960048036038101906104249190612d02565b61097a565b005b61044560048036038101906104409190612d88565b6109c7565b005b610461600480360381019061045c9190612d02565b610fb5565b60405161046e9190612b48565b60405180910390f35b61047f610fd6565b60405161048c9190612a8d565b60405180910390f35b61049d610fdd565b6040516104aa9190612b48565b60405180910390f35b6104bb610ff1565b005b6104d760048036038101906104d29190612a51565b611005565b005b6104e161141c565b6040516104ee9190612a8d565b60405180910390f35b6104ff611423565b60405161050c9190612a8d565b60405180910390f35b61052f600480360381019061052a9190612a51565b61142a565b6040516105429796959493929190612dc8565b60405180910390f35b6105536114c7565b6040516105609190612ce7565b60405180910390f35b6105716114f0565b60405161057e9190612ce7565b60405180910390f35b6105a1600480360381019061059c9190612e37565b611517565b005b6105bd60048036038101906105b89190612a51565b611998565b005b6105c76119ab565b6040516105d49190612ce7565b60405180910390f35b6105f760048036038101906105f29190612e8a565b6119d2565b005b610613600480360381019061060e9190612d88565b611a36565b005b61062f600480360381019061062a9190612f20565b611a8b565b60405161063c9190612cbd565b60405180910390f35b61064d611abc565b60405161065a9190612a8d565b60405180910390f35b61067d60048036038101906106789190612ffc565b611ac3565b005b610687611f5c565b6040516106949190612a8d565b60405180910390f35b6106b760048036038101906106b29190612e37565b611f63565b005b6106d360048036038101906106ce919061303c565b61240c565b6040516106e09190612cbd565b60405180910390f35b61070360048036038101906106fe9190612d02565b61243b565b005b61070d6124be565b60405161071a9190612a8d565b60405180910390f35b61073d6004803603810190610738919061312c565b6124c5565b005b61075960048036038101906107549190612a51565b612711565b6040516107669190612a8d565b60405180910390f35b61013c6020528060005260406000206000915090505481565b60007f4e2312e0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061085357507f150b7a02000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6101385481565b6101335481565b61087061276a565b806101328190555050565b600063150b7a0260e01b905095945050505050565b60038161012c81106108a157600080fd5b016000915090505481565b61013d6020528060005260406000206000915054906101000a900460ff1681565b61013b6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61090961276a565b8061012f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61095661276a565b8061013960006101000a81548160ff02191690831515021790555050565b60025481565b61098261276a565b8061013060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61013060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517fcea204ee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001821080610a6057506101385482115b15610a97576040517fba0514c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013d600083815260200190815260200160002060009054906101000a900460ff1615610af0576040517f1f4e216500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600161013d600084815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b61013c600084815260200190815260200160002054811015610fb0576000610b47836127e8565b905060006001610b626002548461284490919063ffffffff16565b610b6c91906131a8565b9050600060038261012c8110610b8557610b846131dc565b5b01549050610b928261285a565b610133600081548092919060010191905055506101356000815480929190600190039190505550600161013e600083815260200190815260200160002060050160006101000a81548160ff02191690831515021790555061013b600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e600083815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101335461013e60008381526020019081526020016000206003018190555060006001811115610ca657610ca561320b565b5b61013e60008381526020019081526020016000206004015403610dc557600061013e600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f242432a3061013e600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e60008781526020019081526020016000206002015460016040518563ffffffff1660e01b8152600401610d8d94939291906132b6565b600060405180830381600087803b158015610da757600080fd5b505af1158015610dbb573d6000803e3d6000fd5b5050505050610ec0565b600061013e600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3061013e600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e6000878152602001908152602001600020600201546040518463ffffffff1660e01b8152600401610e8c9392919061330e565b600060405180830381600087803b158015610ea657600080fd5b505af1158015610eba573d6000803e3d6000fd5b50505050505b7f43a492d53892ce5481de19394fb84246a2e228d9b1f38bb2104ca351c96b065c8661013e600084815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e60008681526020019081526020016000206002015461013e60008781526020019081526020016000206004015488604051610f9596959493929190613345565b60405180910390a1505050610fa9816128a8565b9050610b20565b505050565b61013a6020528060005260406000206000915054906101000a900460ff1681565b6101355481565b61013960009054906101000a900460ff1681565b610ff961276a565b61100360006128b5565b565b61100d612979565b600080339050803b91503273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107c90613403565b60405180910390fd5b600082146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf9061346f565b60405180910390fd5b600061012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050838173ffffffffffffffffffffffffffffffffffffffff1662fdd58e33610131546040518363ffffffff1660e01b815260040161112e92919061348f565b602060405180830381865afa15801561114b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116f91906134cd565b10156111a7576040517fdfa5108800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013960009054906101000a900460ff166111ee576040517f1405e33600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101365442108061120157506101375442115b15611238576040517f656a54a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001841015611273576040517fdfa5108800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836101355410156112b0576040517f0bdd326f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610138600081548092919060010191905055503361013b600061013854815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508361013c600061013854815260200190815260200160002081905550600061012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630eb36a883361013154886040518463ffffffff1660e01b815260040161139d939291906134fa565b600060405180830381600087803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b505050507f9043194e392e34ca14f9e2d496a5afef8f0bfe0134b8daca0c6d86176976089461013854863360405161140593929190613531565b60405180910390a1505050506114196129c8565b50565b6101345481565b6101375481565b61013e6020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661159c576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101325482610134546115af91906131a8565b11156115e7576040517ffaaa699c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000839050828173ffffffffffffffffffffffffffffffffffffffff1662fdd58e33886040518363ffffffff1660e01b815260040161162792919061348f565b602060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166891906134cd565b10156116a0576040517ff9c8f85e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663e985e9c533306040518363ffffffff1660e01b81526004016116db929190613568565b602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c91906135a6565b611752576040517fcd7769ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8381101561191f5761013460008154809291906001019190505550610135600081548092919060010191905055506040518060e001604052808673ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200187815260200160008152602001600060018111156117e8576117e761320b565b5b81526020016000151581526020016000151581525061013e600061013454815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff02191690831515021790555090505061190f610134546129d1565b611918816128a8565b9050611755565b508073ffffffffffffffffffffffffffffffffffffffff1663f242432a333088876040518563ffffffff1660e01b815260040161195f94939291906135d3565b600060405180830381600087803b15801561197957600080fd5b505af115801561198d573d6000803e3d6000fd5b505050505050505050565b6119a061276a565b806101318190555050565b61013060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6119da61276a565b8061013a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b611a3e61276a565b818111611a77576040517f4b3d204d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816101368190555080610137819055505050565b60007fbc197c819b3e337a6f9652dd10becd7eef83032af3b9d958d3d42f6694146621905098975050505050505050565b6101365481565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611b48576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013254600161013454611b5c91906131a8565b1115611b94576040517ffaaa699c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008290503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e866040518263ffffffff1660e01b8152600401611be99190612a8d565b602060405180830381865afa158015611c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2a9190613640565b73ffffffffffffffffffffffffffffffffffffffff1614611c845783836040517f3943657b000000000000000000000000000000000000000000000000000000008152600401611c7b92919061366d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663e985e9c533306040518363ffffffff1660e01b8152600401611cbf929190613568565b602060405180830381865afa158015611cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0091906135a6565b611d36576040517fcd7769ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013460008154809291906001019190505550610135600081548092919060010191905055506040518060e001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200185815260200160008152602001600180811115611dc057611dbf61320b565b5b81526020016000151581526020016000151581525061013e600061013454815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff021916908315150217905550905050611ee7610134546129d1565b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e3330876040518463ffffffff1660e01b8152600401611f249392919061330e565b600060405180830381600087803b158015611f3e57600080fd5b505af1158015611f52573d6000803e3d6000fd5b5050505050505050565b6101325481565b611f6b612979565b611f7361276a565b60006001811115611f8757611f8661320b565b5b61013e600085815260200190815260200160002060040154036121a057600061013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061013e600085815260200190815260200160002060050160009054906101000a900460ff16158015612034575061013e600085815260200190815260200160002060050160019054906101000a900460ff16155b1561216857600161013e600086815260200190815260200160002060050160016101000a81548160ff02191690831515021790555061013560008154809291906001900391905055508360038361012c8110612093576120926131dc565b5b0154036120a8576120a38261285a565b6120da565b6040517fb9f13db300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663f242432a308561013e60008981526020019081526020016000206002015460016040518563ffffffff1660e01b815260040161213194939291906132b6565b600060405180830381600087803b15801561214b57600080fd5b505af115801561215f573d6000803e3d6000fd5b5050505061219a565b6040517fa1057bdc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506123ff565b600061013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e61013e6000888152602001908152602001600020600201546040518263ffffffff1660e01b81526004016122439190612a8d565b602060405180830381865afa158015612260573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122849190613640565b73ffffffffffffffffffffffffffffffffffffffff16036123cb57600161013e600086815260200190815260200160002060050160016101000a81548160ff02191690831515021790555061013560008154809291906001900391905055508360038361012c81106122f9576122f86131dc565b5b01540361230e576123098261285a565b612340565b6040517fb9f13db300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e308561013e6000898152602001908152602001600020600201546040518463ffffffff1660e01b81526004016123949392919061330e565b600060405180830381600087803b1580156123ae57600080fd5b505af11580156123c2573d6000803e3d6000fd5b505050506123fd565b6040517fa1057bdc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6124076129c8565b505050565b60007ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf9790509695505050505050565b61244361276a565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036124b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124a990613708565b60405180910390fd5b6124bb816128b5565b50565b6101315481565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661254a576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001838390501015612588576040517fdfe9309000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8383905081101561270b57600060018111156125aa576125a961320b565b5b8484838181106125bd576125bc6131dc565b5b905060800201604001350361263e576126398484838181106125e2576125e16131dc565b5b905060800201602001358585848181106125ff576125fe6131dc565b5b90506080020160000160208101906126179190612d02565b86868581811061262a576126296131dc565b5b90506080020160600135611517565b6126fb565b6001808111156126515761265061320b565b5b848483818110612664576126636131dc565b5b90506080020160400135036126c8576126c3848483818110612689576126886131dc565b5b905060800201602001358585848181106126a6576126a56131dc565b5b90506080020160000160208101906126be9190612d02565b611ac3565b6126fa565b6040517fa7f0c1cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b612704816128a8565b905061258b565b50505050565b600080600090506000600190505b6002548111612760578360038261012c811061273e5761273d6131dc565b5b01540361274d57809150612760565b808061275890613728565b91505061271f565b5080915050919050565b612772612a09565b73ffffffffffffffffffffffffffffffffffffffff166127906114c7565b73ffffffffffffffffffffffffffffffffffffffff16146127e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127dd906137bc565b60405180910390fd5b565b600080610135544484426127fc91906131a8565b61280691906131a8565b61281091906131a8565b60405160200161282091906137fd565b6040516020818303038152906040528051906020012060001c905080915050919050565b600081836128529190613847565b905092915050565b600360025461012c8110612871576128706131dc565b5b015460038261012c8110612888576128876131dc565b5b0181905550600260008154809291906128a090613878565b919050555050565b6000600182019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6002600154036129be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b5906138ed565b60405180910390fd5b6002600181905550565b60018081905550565b600260008154809291906129e490613728565b919050555080600360025461012c8110612a0157612a006131dc565b5b018190555050565b600033905090565b600080fd5b600080fd5b6000819050919050565b612a2e81612a1b565b8114612a3957600080fd5b50565b600081359050612a4b81612a25565b92915050565b600060208284031215612a6757612a66612a11565b5b6000612a7584828501612a3c565b91505092915050565b612a8781612a1b565b82525050565b6000602082019050612aa26000830184612a7e565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612add81612aa8565b8114612ae857600080fd5b50565b600081359050612afa81612ad4565b92915050565b600060208284031215612b1657612b15612a11565b5b6000612b2484828501612aeb565b91505092915050565b60008115159050919050565b612b4281612b2d565b82525050565b6000602082019050612b5d6000830184612b39565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b8e82612b63565b9050919050565b612b9e81612b83565b8114612ba957600080fd5b50565b600081359050612bbb81612b95565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112612be657612be5612bc1565b5b8235905067ffffffffffffffff811115612c0357612c02612bc6565b5b602083019150836001820283011115612c1f57612c1e612bcb565b5b9250929050565b600080600080600060808688031215612c4257612c41612a11565b5b6000612c5088828901612bac565b9550506020612c6188828901612bac565b9450506040612c7288828901612a3c565b935050606086013567ffffffffffffffff811115612c9357612c92612a16565b5b612c9f88828901612bd0565b92509250509295509295909350565b612cb781612aa8565b82525050565b6000602082019050612cd26000830184612cae565b92915050565b612ce181612b83565b82525050565b6000602082019050612cfc6000830184612cd8565b92915050565b600060208284031215612d1857612d17612a11565b5b6000612d2684828501612bac565b91505092915050565b612d3881612b2d565b8114612d4357600080fd5b50565b600081359050612d5581612d2f565b92915050565b600060208284031215612d7157612d70612a11565b5b6000612d7f84828501612d46565b91505092915050565b60008060408385031215612d9f57612d9e612a11565b5b6000612dad85828601612a3c565b9250506020612dbe85828601612a3c565b9150509250929050565b600060e082019050612ddd600083018a612cd8565b612dea6020830189612cd8565b612df76040830188612a7e565b612e046060830187612a7e565b612e116080830186612a7e565b612e1e60a0830185612b39565b612e2b60c0830184612b39565b98975050505050505050565b600080600060608486031215612e5057612e4f612a11565b5b6000612e5e86828701612a3c565b9350506020612e6f86828701612bac565b9250506040612e8086828701612a3c565b9150509250925092565b60008060408385031215612ea157612ea0612a11565b5b6000612eaf85828601612bac565b9250506020612ec085828601612d46565b9150509250929050565b60008083601f840112612ee057612edf612bc1565b5b8235905067ffffffffffffffff811115612efd57612efc612bc6565b5b602083019150836020820283011115612f1957612f18612bcb565b5b9250929050565b60008060008060008060008060a0898b031215612f4057612f3f612a11565b5b6000612f4e8b828c01612bac565b9850506020612f5f8b828c01612bac565b975050604089013567ffffffffffffffff811115612f8057612f7f612a16565b5b612f8c8b828c01612eca565b9650965050606089013567ffffffffffffffff811115612faf57612fae612a16565b5b612fbb8b828c01612eca565b9450945050608089013567ffffffffffffffff811115612fde57612fdd612a16565b5b612fea8b828c01612bd0565b92509250509295985092959890939650565b6000806040838503121561301357613012612a11565b5b600061302185828601612a3c565b925050602061303285828601612bac565b9150509250929050565b60008060008060008060a0878903121561305957613058612a11565b5b600061306789828a01612bac565b965050602061307889828a01612bac565b955050604061308989828a01612a3c565b945050606061309a89828a01612a3c565b935050608087013567ffffffffffffffff8111156130bb576130ba612a16565b5b6130c789828a01612bd0565b92509250509295509295509295565b60008083601f8401126130ec576130eb612bc1565b5b8235905067ffffffffffffffff81111561310957613108612bc6565b5b60208301915083608082028301111561312557613124612bcb565b5b9250929050565b6000806020838503121561314357613142612a11565b5b600083013567ffffffffffffffff81111561316157613160612a16565b5b61316d858286016130d6565b92509250509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006131b382612a1b565b91506131be83612a1b565b92508282019050808211156131d6576131d5613179565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000819050919050565b6000819050919050565b600061326961326461325f8461323a565b613244565b612a1b565b9050919050565b6132798161324e565b82525050565b600082825260208201905092915050565b50565b60006132a060008361327f565b91506132ab82613290565b600082019050919050565b600060a0820190506132cb6000830187612cd8565b6132d86020830186612cd8565b6132e56040830185612a7e565b6132f26060830184613270565b818103608083015261330381613293565b905095945050505050565b60006060820190506133236000830186612cd8565b6133306020830185612cd8565b61333d6040830184612a7e565b949350505050565b600060c08201905061335a6000830189612a7e565b6133676020830188612cd8565b6133746040830187612cd8565b6133816060830186612a7e565b61338e6080830185612a7e565b61339b60a0830184612a7e565b979650505050505050565b600082825260208201905092915050565b7f74782e6f726967696e20213d206d73672e73656e646572000000000000000000600082015250565b60006133ed6017836133a6565b91506133f8826133b7565b602082019050919050565b6000602082019050818103600083015261341c816133e0565b9050919050565b7f436f6e74726163742063616c6c7320617265206e6f7420616c6c6f7765640000600082015250565b6000613459601e836133a6565b915061346482613423565b602082019050919050565b600060208201905081810360008301526134888161344c565b9050919050565b60006040820190506134a46000830185612cd8565b6134b16020830184612a7e565b9392505050565b6000815190506134c781612a25565b92915050565b6000602082840312156134e3576134e2612a11565b5b60006134f1848285016134b8565b91505092915050565b600060608201905061350f6000830186612cd8565b61351c6020830185612a7e565b6135296040830184612a7e565b949350505050565b60006060820190506135466000830186612a7e565b6135536020830185612a7e565b6135606040830184612cd8565b949350505050565b600060408201905061357d6000830185612cd8565b61358a6020830184612cd8565b9392505050565b6000815190506135a081612d2f565b92915050565b6000602082840312156135bc576135bb612a11565b5b60006135ca84828501613591565b91505092915050565b600060a0820190506135e86000830187612cd8565b6135f56020830186612cd8565b6136026040830185612a7e565b61360f6060830184612a7e565b818103608083015261362081613293565b905095945050505050565b60008151905061363a81612b95565b92915050565b60006020828403121561365657613655612a11565b5b60006136648482850161362b565b91505092915050565b60006040820190506136826000830185612a7e565b61368f6020830184612cd8565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006136f26026836133a6565b91506136fd82613696565b604082019050919050565b60006020820190508181036000830152613721816136e5565b9050919050565b600061373382612a1b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361376557613764613179565b5b600182019050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006137a66020836133a6565b91506137b182613770565b602082019050919050565b600060208201905081810360008301526137d581613799565b9050919050565b6000819050919050565b6137f76137f282612a1b565b6137dc565b82525050565b600061380982846137e6565b60208201915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061385282612a1b565b915061385d83612a1b565b92508261386d5761386c613818565b5b828206905092915050565b600061388382612a1b565b91506000820361389657613895613179565b5b600182039050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006138d7601f836133a6565b91506138e2826138a1565b602082019050919050565b60006020820190508181036000830152613906816138ca565b905091905056fea26469706673582212203d051043726e8a1315d0b58f1d474dd5f1d99d61cf47b61aad3ab4643b4ffc8c64736f6c6343000810003300000000000000000000000002b67fd1bc80bda265ba804d98ec0786e5ff321b000000000000000000000000e4e127f0ed50da879524b8d2e315f8caf078b8890000000000000000000000000000000000000000000000000000000063b370000000000000000000000000000000000000000000000000000000000064013880

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023c5760003560e01c80637e91bdca1161013b578063bc197c81116100b8578063f23a6e611161007c578063f23a6e61146106b9578063f2fde38b146106e9578063f5eb656414610705578063fcda136b14610723578063fe85f9d81461073f5761023c565b8063bc197c8114610615578063c2a08df514610645578063c8a2582f14610663578063dbed8a6a1461067f578063eb215d241461069d5761023c565b80639052d06f116100ff5780639052d06f1461058757806391406c7d146105a357806399b7fa4c146105bf578063ac92e9ad146105dd578063acb52286146105f95761023c565b80637e91bdca146104d9578063804a4ac9146104f75780638ac4d8c6146105155780638da5cb5b1461054b5780638f88fa5e146105695761023c565b806351508f0a116101c95780635c6242201161018d5780635c62422014610447578063605d6c03146104775780636bd1263014610495578063715018a6146104b357806378cbf86c146104bd5761023c565b806351508f0a146103b9578063544b2514146103d557806354d2df4a146103f157806355b2cf571461040f57806358f489851461042b5761023c565b8063060c5fe811610210578063060c5fe8146102dd578063150b7a02146102f9578063190cbd5d1461032957806347f92935146103595780634f9b741d146103895761023c565b80626cb8831461024157806301ffc9a71461027157806303225dd8146102a157806303945358146102bf575b600080fd5b61025b60048036038101906102569190612a51565b61076f565b6040516102689190612a8d565b60405180910390f35b61028b60048036038101906102869190612b00565b610788565b6040516102989190612b48565b60405180910390f35b6102a961085a565b6040516102b69190612a8d565b60405180910390f35b6102c7610861565b6040516102d49190612a8d565b60405180910390f35b6102f760048036038101906102f29190612a51565b610868565b005b610313600480360381019061030e9190612c26565b61087b565b6040516103209190612cbd565b60405180910390f35b610343600480360381019061033e9190612a51565b610890565b6040516103509190612a8d565b60405180910390f35b610373600480360381019061036e9190612a51565b6108ac565b6040516103809190612b48565b60405180910390f35b6103a3600480360381019061039e9190612a51565b6108cd565b6040516103b09190612ce7565b60405180910390f35b6103d360048036038101906103ce9190612d02565b610901565b005b6103ef60048036038101906103ea9190612d5b565b61094e565b005b6103f9610974565b6040516104069190612a8d565b60405180910390f35b61042960048036038101906104249190612d02565b61097a565b005b61044560048036038101906104409190612d88565b6109c7565b005b610461600480360381019061045c9190612d02565b610fb5565b60405161046e9190612b48565b60405180910390f35b61047f610fd6565b60405161048c9190612a8d565b60405180910390f35b61049d610fdd565b6040516104aa9190612b48565b60405180910390f35b6104bb610ff1565b005b6104d760048036038101906104d29190612a51565b611005565b005b6104e161141c565b6040516104ee9190612a8d565b60405180910390f35b6104ff611423565b60405161050c9190612a8d565b60405180910390f35b61052f600480360381019061052a9190612a51565b61142a565b6040516105429796959493929190612dc8565b60405180910390f35b6105536114c7565b6040516105609190612ce7565b60405180910390f35b6105716114f0565b60405161057e9190612ce7565b60405180910390f35b6105a1600480360381019061059c9190612e37565b611517565b005b6105bd60048036038101906105b89190612a51565b611998565b005b6105c76119ab565b6040516105d49190612ce7565b60405180910390f35b6105f760048036038101906105f29190612e8a565b6119d2565b005b610613600480360381019061060e9190612d88565b611a36565b005b61062f600480360381019061062a9190612f20565b611a8b565b60405161063c9190612cbd565b60405180910390f35b61064d611abc565b60405161065a9190612a8d565b60405180910390f35b61067d60048036038101906106789190612ffc565b611ac3565b005b610687611f5c565b6040516106949190612a8d565b60405180910390f35b6106b760048036038101906106b29190612e37565b611f63565b005b6106d360048036038101906106ce919061303c565b61240c565b6040516106e09190612cbd565b60405180910390f35b61070360048036038101906106fe9190612d02565b61243b565b005b61070d6124be565b60405161071a9190612a8d565b60405180910390f35b61073d6004803603810190610738919061312c565b6124c5565b005b61075960048036038101906107549190612a51565b612711565b6040516107669190612a8d565b60405180910390f35b61013c6020528060005260406000206000915090505481565b60007f4e2312e0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061085357507f150b7a02000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6101385481565b6101335481565b61087061276a565b806101328190555050565b600063150b7a0260e01b905095945050505050565b60038161012c81106108a157600080fd5b016000915090505481565b61013d6020528060005260406000206000915054906101000a900460ff1681565b61013b6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61090961276a565b8061012f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61095661276a565b8061013960006101000a81548160ff02191690831515021790555050565b60025481565b61098261276a565b8061013060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61013060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517fcea204ee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001821080610a6057506101385482115b15610a97576040517fba0514c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013d600083815260200190815260200160002060009054906101000a900460ff1615610af0576040517f1f4e216500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600161013d600084815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b61013c600084815260200190815260200160002054811015610fb0576000610b47836127e8565b905060006001610b626002548461284490919063ffffffff16565b610b6c91906131a8565b9050600060038261012c8110610b8557610b846131dc565b5b01549050610b928261285a565b610133600081548092919060010191905055506101356000815480929190600190039190505550600161013e600083815260200190815260200160002060050160006101000a81548160ff02191690831515021790555061013b600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e600083815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101335461013e60008381526020019081526020016000206003018190555060006001811115610ca657610ca561320b565b5b61013e60008381526020019081526020016000206004015403610dc557600061013e600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f242432a3061013e600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e60008781526020019081526020016000206002015460016040518563ffffffff1660e01b8152600401610d8d94939291906132b6565b600060405180830381600087803b158015610da757600080fd5b505af1158015610dbb573d6000803e3d6000fd5b5050505050610ec0565b600061013e600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3061013e600086815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e6000878152602001908152602001600020600201546040518463ffffffff1660e01b8152600401610e8c9392919061330e565b600060405180830381600087803b158015610ea657600080fd5b505af1158015610eba573d6000803e3d6000fd5b50505050505b7f43a492d53892ce5481de19394fb84246a2e228d9b1f38bb2104ca351c96b065c8661013e600084815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661013e60008681526020019081526020016000206002015461013e60008781526020019081526020016000206004015488604051610f9596959493929190613345565b60405180910390a1505050610fa9816128a8565b9050610b20565b505050565b61013a6020528060005260406000206000915054906101000a900460ff1681565b6101355481565b61013960009054906101000a900460ff1681565b610ff961276a565b61100360006128b5565b565b61100d612979565b600080339050803b91503273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107c90613403565b60405180910390fd5b600082146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf9061346f565b60405180910390fd5b600061012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050838173ffffffffffffffffffffffffffffffffffffffff1662fdd58e33610131546040518363ffffffff1660e01b815260040161112e92919061348f565b602060405180830381865afa15801561114b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116f91906134cd565b10156111a7576040517fdfa5108800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013960009054906101000a900460ff166111ee576040517f1405e33600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101365442108061120157506101375442115b15611238576040517f656a54a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001841015611273576040517fdfa5108800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836101355410156112b0576040517f0bdd326f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610138600081548092919060010191905055503361013b600061013854815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508361013c600061013854815260200190815260200160002081905550600061012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630eb36a883361013154886040518463ffffffff1660e01b815260040161139d939291906134fa565b600060405180830381600087803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b505050507f9043194e392e34ca14f9e2d496a5afef8f0bfe0134b8daca0c6d86176976089461013854863360405161140593929190613531565b60405180910390a1505050506114196129c8565b50565b6101345481565b6101375481565b61013e6020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61012f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661159c576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101325482610134546115af91906131a8565b11156115e7576040517ffaaa699c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000839050828173ffffffffffffffffffffffffffffffffffffffff1662fdd58e33886040518363ffffffff1660e01b815260040161162792919061348f565b602060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166891906134cd565b10156116a0576040517ff9c8f85e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663e985e9c533306040518363ffffffff1660e01b81526004016116db929190613568565b602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c91906135a6565b611752576040517fcd7769ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8381101561191f5761013460008154809291906001019190505550610135600081548092919060010191905055506040518060e001604052808673ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200187815260200160008152602001600060018111156117e8576117e761320b565b5b81526020016000151581526020016000151581525061013e600061013454815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff02191690831515021790555090505061190f610134546129d1565b611918816128a8565b9050611755565b508073ffffffffffffffffffffffffffffffffffffffff1663f242432a333088876040518563ffffffff1660e01b815260040161195f94939291906135d3565b600060405180830381600087803b15801561197957600080fd5b505af115801561198d573d6000803e3d6000fd5b505050505050505050565b6119a061276a565b806101318190555050565b61013060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6119da61276a565b8061013a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b611a3e61276a565b818111611a77576040517f4b3d204d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816101368190555080610137819055505050565b60007fbc197c819b3e337a6f9652dd10becd7eef83032af3b9d958d3d42f6694146621905098975050505050505050565b6101365481565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611b48576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013254600161013454611b5c91906131a8565b1115611b94576040517ffaaa699c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008290503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e866040518263ffffffff1660e01b8152600401611be99190612a8d565b602060405180830381865afa158015611c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2a9190613640565b73ffffffffffffffffffffffffffffffffffffffff1614611c845783836040517f3943657b000000000000000000000000000000000000000000000000000000008152600401611c7b92919061366d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663e985e9c533306040518363ffffffff1660e01b8152600401611cbf929190613568565b602060405180830381865afa158015611cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0091906135a6565b611d36576040517fcd7769ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61013460008154809291906001019190505550610135600081548092919060010191905055506040518060e001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200185815260200160008152602001600180811115611dc057611dbf61320b565b5b81526020016000151581526020016000151581525061013e600061013454815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff021916908315150217905550905050611ee7610134546129d1565b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e3330876040518463ffffffff1660e01b8152600401611f249392919061330e565b600060405180830381600087803b158015611f3e57600080fd5b505af1158015611f52573d6000803e3d6000fd5b5050505050505050565b6101325481565b611f6b612979565b611f7361276a565b60006001811115611f8757611f8661320b565b5b61013e600085815260200190815260200160002060040154036121a057600061013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061013e600085815260200190815260200160002060050160009054906101000a900460ff16158015612034575061013e600085815260200190815260200160002060050160019054906101000a900460ff16155b1561216857600161013e600086815260200190815260200160002060050160016101000a81548160ff02191690831515021790555061013560008154809291906001900391905055508360038361012c8110612093576120926131dc565b5b0154036120a8576120a38261285a565b6120da565b6040517fb9f13db300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663f242432a308561013e60008981526020019081526020016000206002015460016040518563ffffffff1660e01b815260040161213194939291906132b6565b600060405180830381600087803b15801561214b57600080fd5b505af115801561215f573d6000803e3d6000fd5b5050505061219a565b6040517fa1057bdc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506123ff565b600061013e600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e61013e6000888152602001908152602001600020600201546040518263ffffffff1660e01b81526004016122439190612a8d565b602060405180830381865afa158015612260573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122849190613640565b73ffffffffffffffffffffffffffffffffffffffff16036123cb57600161013e600086815260200190815260200160002060050160016101000a81548160ff02191690831515021790555061013560008154809291906001900391905055508360038361012c81106122f9576122f86131dc565b5b01540361230e576123098261285a565b612340565b6040517fb9f13db300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166342842e0e308561013e6000898152602001908152602001600020600201546040518463ffffffff1660e01b81526004016123949392919061330e565b600060405180830381600087803b1580156123ae57600080fd5b505af11580156123c2573d6000803e3d6000fd5b505050506123fd565b6040517fa1057bdc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6124076129c8565b505050565b60007ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf9790509695505050505050565b61244361276a565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036124b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124a990613708565b60405180910390fd5b6124bb816128b5565b50565b6101315481565b3361013a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661254a576040517f6a9a57a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001838390501015612588576040517fdfe9309000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8383905081101561270b57600060018111156125aa576125a961320b565b5b8484838181106125bd576125bc6131dc565b5b905060800201604001350361263e576126398484838181106125e2576125e16131dc565b5b905060800201602001358585848181106125ff576125fe6131dc565b5b90506080020160000160208101906126179190612d02565b86868581811061262a576126296131dc565b5b90506080020160600135611517565b6126fb565b6001808111156126515761265061320b565b5b848483818110612664576126636131dc565b5b90506080020160400135036126c8576126c3848483818110612689576126886131dc565b5b905060800201602001358585848181106126a6576126a56131dc565b5b90506080020160000160208101906126be9190612d02565b611ac3565b6126fa565b6040517fa7f0c1cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b612704816128a8565b905061258b565b50505050565b600080600090506000600190505b6002548111612760578360038261012c811061273e5761273d6131dc565b5b01540361274d57809150612760565b808061275890613728565b91505061271f565b5080915050919050565b612772612a09565b73ffffffffffffffffffffffffffffffffffffffff166127906114c7565b73ffffffffffffffffffffffffffffffffffffffff16146127e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127dd906137bc565b60405180910390fd5b565b600080610135544484426127fc91906131a8565b61280691906131a8565b61281091906131a8565b60405160200161282091906137fd565b6040516020818303038152906040528051906020012060001c905080915050919050565b600081836128529190613847565b905092915050565b600360025461012c8110612871576128706131dc565b5b015460038261012c8110612888576128876131dc565b5b0181905550600260008154809291906128a090613878565b919050555050565b6000600182019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6002600154036129be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b5906138ed565b60405180910390fd5b6002600181905550565b60018081905550565b600260008154809291906129e490613728565b919050555080600360025461012c8110612a0157612a006131dc565b5b018190555050565b600033905090565b600080fd5b600080fd5b6000819050919050565b612a2e81612a1b565b8114612a3957600080fd5b50565b600081359050612a4b81612a25565b92915050565b600060208284031215612a6757612a66612a11565b5b6000612a7584828501612a3c565b91505092915050565b612a8781612a1b565b82525050565b6000602082019050612aa26000830184612a7e565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612add81612aa8565b8114612ae857600080fd5b50565b600081359050612afa81612ad4565b92915050565b600060208284031215612b1657612b15612a11565b5b6000612b2484828501612aeb565b91505092915050565b60008115159050919050565b612b4281612b2d565b82525050565b6000602082019050612b5d6000830184612b39565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b8e82612b63565b9050919050565b612b9e81612b83565b8114612ba957600080fd5b50565b600081359050612bbb81612b95565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112612be657612be5612bc1565b5b8235905067ffffffffffffffff811115612c0357612c02612bc6565b5b602083019150836001820283011115612c1f57612c1e612bcb565b5b9250929050565b600080600080600060808688031215612c4257612c41612a11565b5b6000612c5088828901612bac565b9550506020612c6188828901612bac565b9450506040612c7288828901612a3c565b935050606086013567ffffffffffffffff811115612c9357612c92612a16565b5b612c9f88828901612bd0565b92509250509295509295909350565b612cb781612aa8565b82525050565b6000602082019050612cd26000830184612cae565b92915050565b612ce181612b83565b82525050565b6000602082019050612cfc6000830184612cd8565b92915050565b600060208284031215612d1857612d17612a11565b5b6000612d2684828501612bac565b91505092915050565b612d3881612b2d565b8114612d4357600080fd5b50565b600081359050612d5581612d2f565b92915050565b600060208284031215612d7157612d70612a11565b5b6000612d7f84828501612d46565b91505092915050565b60008060408385031215612d9f57612d9e612a11565b5b6000612dad85828601612a3c565b9250506020612dbe85828601612a3c565b9150509250929050565b600060e082019050612ddd600083018a612cd8565b612dea6020830189612cd8565b612df76040830188612a7e565b612e046060830187612a7e565b612e116080830186612a7e565b612e1e60a0830185612b39565b612e2b60c0830184612b39565b98975050505050505050565b600080600060608486031215612e5057612e4f612a11565b5b6000612e5e86828701612a3c565b9350506020612e6f86828701612bac565b9250506040612e8086828701612a3c565b9150509250925092565b60008060408385031215612ea157612ea0612a11565b5b6000612eaf85828601612bac565b9250506020612ec085828601612d46565b9150509250929050565b60008083601f840112612ee057612edf612bc1565b5b8235905067ffffffffffffffff811115612efd57612efc612bc6565b5b602083019150836020820283011115612f1957612f18612bcb565b5b9250929050565b60008060008060008060008060a0898b031215612f4057612f3f612a11565b5b6000612f4e8b828c01612bac565b9850506020612f5f8b828c01612bac565b975050604089013567ffffffffffffffff811115612f8057612f7f612a16565b5b612f8c8b828c01612eca565b9650965050606089013567ffffffffffffffff811115612faf57612fae612a16565b5b612fbb8b828c01612eca565b9450945050608089013567ffffffffffffffff811115612fde57612fdd612a16565b5b612fea8b828c01612bd0565b92509250509295985092959890939650565b6000806040838503121561301357613012612a11565b5b600061302185828601612a3c565b925050602061303285828601612bac565b9150509250929050565b60008060008060008060a0878903121561305957613058612a11565b5b600061306789828a01612bac565b965050602061307889828a01612bac565b955050604061308989828a01612a3c565b945050606061309a89828a01612a3c565b935050608087013567ffffffffffffffff8111156130bb576130ba612a16565b5b6130c789828a01612bd0565b92509250509295509295509295565b60008083601f8401126130ec576130eb612bc1565b5b8235905067ffffffffffffffff81111561310957613108612bc6565b5b60208301915083608082028301111561312557613124612bcb565b5b9250929050565b6000806020838503121561314357613142612a11565b5b600083013567ffffffffffffffff81111561316157613160612a16565b5b61316d858286016130d6565b92509250509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006131b382612a1b565b91506131be83612a1b565b92508282019050808211156131d6576131d5613179565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000819050919050565b6000819050919050565b600061326961326461325f8461323a565b613244565b612a1b565b9050919050565b6132798161324e565b82525050565b600082825260208201905092915050565b50565b60006132a060008361327f565b91506132ab82613290565b600082019050919050565b600060a0820190506132cb6000830187612cd8565b6132d86020830186612cd8565b6132e56040830185612a7e565b6132f26060830184613270565b818103608083015261330381613293565b905095945050505050565b60006060820190506133236000830186612cd8565b6133306020830185612cd8565b61333d6040830184612a7e565b949350505050565b600060c08201905061335a6000830189612a7e565b6133676020830188612cd8565b6133746040830187612cd8565b6133816060830186612a7e565b61338e6080830185612a7e565b61339b60a0830184612a7e565b979650505050505050565b600082825260208201905092915050565b7f74782e6f726967696e20213d206d73672e73656e646572000000000000000000600082015250565b60006133ed6017836133a6565b91506133f8826133b7565b602082019050919050565b6000602082019050818103600083015261341c816133e0565b9050919050565b7f436f6e74726163742063616c6c7320617265206e6f7420616c6c6f7765640000600082015250565b6000613459601e836133a6565b915061346482613423565b602082019050919050565b600060208201905081810360008301526134888161344c565b9050919050565b60006040820190506134a46000830185612cd8565b6134b16020830184612a7e565b9392505050565b6000815190506134c781612a25565b92915050565b6000602082840312156134e3576134e2612a11565b5b60006134f1848285016134b8565b91505092915050565b600060608201905061350f6000830186612cd8565b61351c6020830185612a7e565b6135296040830184612a7e565b949350505050565b60006060820190506135466000830186612a7e565b6135536020830185612a7e565b6135606040830184612cd8565b949350505050565b600060408201905061357d6000830185612cd8565b61358a6020830184612cd8565b9392505050565b6000815190506135a081612d2f565b92915050565b6000602082840312156135bc576135bb612a11565b5b60006135ca84828501613591565b91505092915050565b600060a0820190506135e86000830187612cd8565b6135f56020830186612cd8565b6136026040830185612a7e565b61360f6060830184612a7e565b818103608083015261362081613293565b905095945050505050565b60008151905061363a81612b95565b92915050565b60006020828403121561365657613655612a11565b5b60006136648482850161362b565b91505092915050565b60006040820190506136826000830185612a7e565b61368f6020830184612cd8565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006136f26026836133a6565b91506136fd82613696565b604082019050919050565b60006020820190508181036000830152613721816136e5565b9050919050565b600061373382612a1b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361376557613764613179565b5b600182019050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006137a66020836133a6565b91506137b182613770565b602082019050919050565b600060208201905081810360008301526137d581613799565b9050919050565b6000819050919050565b6137f76137f282612a1b565b6137dc565b82525050565b600061380982846137e6565b60208201915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061385282612a1b565b915061385d83612a1b565b92508261386d5761386c613818565b5b828206905092915050565b600061388382612a1b565b91506000820361389657613895613179565b5b600182039050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006138d7601f836133a6565b91506138e2826138a1565b602082019050919050565b60006020820190508181036000830152613906816138ca565b905091905056fea26469706673582212203d051043726e8a1315d0b58f1d474dd5f1d99d61cf47b61aad3ab4643b4ffc8c64736f6c63430008100033

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

00000000000000000000000002b67fd1bc80bda265ba804d98ec0786e5ff321b000000000000000000000000e4e127f0ed50da879524b8d2e315f8caf078b8890000000000000000000000000000000000000000000000000000000063b370000000000000000000000000000000000000000000000000000000000064013880

-----Decoded View---------------
Arg [0] : _rewardContractAddress (address): 0x02b67fD1bc80BDa265Ba804D98EC0786e5FF321b
Arg [1] : _giftTransferCallerWallet (address): 0xE4E127F0eD50Da879524B8D2E315F8caf078b889
Arg [2] : _claimingStartsAtTimeStamp (uint256): 1672704000
Arg [3] : _claimingEndsAtTimeStamp (uint256): 1677801600

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000002b67fd1bc80bda265ba804d98ec0786e5ff321b
Arg [1] : 000000000000000000000000e4e127f0ed50da879524b8d2e315f8caf078b889
Arg [2] : 0000000000000000000000000000000000000000000000000000000063b37000
Arg [3] : 0000000000000000000000000000000000000000000000000000000064013880


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.