ETH Price: $3,476.24 (+2.22%)

Contract

0x4Fb2f2F75E5Ad14f1Bd936D4c4565599Bc3320AE
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Mint152481512022-07-31 4:38:14878 days ago1659242294IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.000141114.39569855
Mint152481512022-07-31 4:38:14878 days ago1659242294IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.000141114.39569855
Mint152481512022-07-31 4:38:14878 days ago1659242294IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.000141114.39569855
Mint150045622022-06-21 22:31:32917 days ago1655850692IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.000563217.46039964
Mint149628872022-06-14 17:22:04924 days ago1655227324IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.00121237.75252707
Mint149626782022-06-14 16:31:02924 days ago1655224262IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0013290741.398998
Mint149626712022-06-14 16:30:07924 days ago1655224207IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0015342547.79010762
Mint149626712022-06-14 16:30:07924 days ago1655224207IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0015342547.79010762
Mint149626712022-06-14 16:30:07924 days ago1655224207IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0015342547.79010762
Mint149626712022-06-14 16:30:07924 days ago1655224207IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0015342547.79010762
Mint149468422022-06-11 22:47:17927 days ago1654987637IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0007875324.53082294
Set Status149438242022-06-11 10:40:26928 days ago1654944026IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.000504817.45176681
Mint149437542022-06-11 10:25:11928 days ago1654943111IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0101872120.56295179
Mint149435802022-06-11 9:43:19928 days ago1654940599IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0038391724.58532421
Mint149435512022-06-11 9:37:17928 days ago1654940237IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0185315433.98924201
Mint149435492022-06-11 9:36:32928 days ago1654940192IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0276161332.7559
Mint149434142022-06-11 8:59:12928 days ago1654937952IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0036134826.33617266
Mint149433912022-06-11 8:52:24928 days ago1654937544IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0244237127.98699444
Mint149433742022-06-11 8:50:04928 days ago1654937404IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0222677340.01604811
Mint149433482022-06-11 8:43:17928 days ago1654936997IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0257789935.52563164
Mint149431252022-06-11 7:51:23928 days ago1654933883IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0132197942.62209834
Mint149429852022-06-11 7:16:22928 days ago1654931782IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0135288631.7347263
Mint149425902022-06-11 5:34:32928 days ago1654925672IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0199454827.58097938
Mint149425342022-06-11 5:16:04928 days ago1654924564IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0157259218.1509297
Mint149424172022-06-11 4:49:31928 days ago1654922971IN
0x4Fb2f2F7...9Bc3320AE
0 ETH0.0041189830.06187487
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:
TheFallenMinter

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion
File 1 of 26 : TheFallenMinter.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./libraries/OperatorAccess.sol";
import "./TheFallen.sol";
import "./interfaces/IStaking.sol";

/**
 * @title TheFallen Minter
 * @notice TheFallen Minting Station
 */
contract TheFallenMinter is OperatorAccess, ReentrancyGuard {
    using SafeMath for uint256;

    uint8 public constant STATUS_NOT_INITIALIZED = 0;
    uint8 public constant STATUS_PREPARING = 1;
    uint8 public constant STATUS_CLAIM = 2;
    uint8 public constant STATUS_CLOSED = 3;

    uint8 public currentStatus = STATUS_NOT_INITIALIZED;

    uint256 public maxSupply;
    uint256 public availableSupply;

    uint256 public startTimestamp;
    uint256 public endTimestamp;

    TheFallen public immutable nftCollection;

    address public immutable samuraiCollection;
    address public immutable samuraiStakingV1;
    address public immutable samuraiStakingV2;
    address public immutable onnaCollection;
    address public immutable onnaStaking;

    mapping(uint256 => uint256) private _tokenIdsCache;

    modifier whenClaimable() {
        require(currentStatus == STATUS_CLAIM, "Status not claim");
        _;
    }

    modifier whenMintOpened() {
        require(startTimestamp > 0, "Mint not configured");
        require(startTimestamp <= block.timestamp, "Mint not opened");
        require(endTimestamp == 0 || endTimestamp >= block.timestamp, "Mint closed");
        _;
    }

    modifier whenValidQuantity(uint256 _quantity) {
        require(availableSupply > 0, "No more supply");
        require(availableSupply >= _quantity, "Not enough supply");
        require(_quantity > 0, "Qty <= 0");
        _;
    }

    // modifier to allow execution by owner or operator
    modifier onlyOwnerOrOperator() {
        require(
            hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || hasRole(OPERATOR_ROLE, _msgSender()),
            "Not an owner or operator"
        );
        _;
    }

    constructor(
        TheFallen _collection,
        address _samuraiCollection,
        address _samuraiStakingV1,
        address _samuraiStakingV2,
        address _onnaCollection,
        address _onnaStaking
    ) {
        nftCollection = _collection;
        samuraiCollection = _samuraiCollection;
        samuraiStakingV1 = _samuraiStakingV1;
        samuraiStakingV2 = _samuraiStakingV2;
        onnaCollection = _onnaCollection;
        onnaStaking = _onnaStaking;

        currentStatus = STATUS_PREPARING;

        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _syncSupply();
    }

    function _mint(
        address _to,
        uint256[] memory _linkedSamuraiIds,
        uint256[] memory _linkedOnnaIds
    ) internal returns (uint256[] memory) {
        uint256 quantity = _linkedSamuraiIds.length + _linkedOnnaIds.length;
        require(availableSupply >= quantity, "Not enough supply");

        uint256[] memory tokenIds = new uint256[](quantity);

        for (uint256 i = 0; i < quantity; i++) {
            uint256 tokenId = getNextTokenId();
            availableSupply = availableSupply - 1;
            tokenIds[i] = tokenId;
        }

        if (quantity == 1) {
            if (_linkedSamuraiIds.length > 0) nftCollection.mint(_to, tokenIds[0], 0, _linkedSamuraiIds[0]);
            else nftCollection.mint(_to, tokenIds[0], 1, _linkedOnnaIds[0]);
        } else {
            nftCollection.mintBatch(_to, tokenIds, _linkedSamuraiIds, _linkedOnnaIds);
        }

        return tokenIds;
    }

    function _verifyOwner(
        address expected,
        address collection,
        uint256 tokenId
    ) internal view returns (bool) {
        address currentOwner = IERC721(collection).ownerOf(tokenId);

        if (currentOwner == samuraiStakingV2) {
            (currentOwner, , , ) = ISamuraiStaking(samuraiStakingV2).getStakeInfo(tokenId);
        } else if (currentOwner == samuraiStakingV1) {
            (currentOwner, , , ) = ISamuraiStaking(samuraiStakingV1).getStakeInfo(tokenId);
        } else if (currentOwner == onnaStaking) {
            (currentOwner, , , , ) = IOnnaStaking(onnaStaking).getStakeInfo(tokenId);
        }

        return currentOwner == expected;
    }

    /**
     * @dev mint NFTs and link them to original collections
     */
    function mint(uint256[] calldata _linkedSamuraiIds, uint256[] calldata _linkedOnnaIds)
        external
        nonReentrant
        whenValidQuantity(_linkedSamuraiIds.length + _linkedOnnaIds.length)
        whenClaimable
        whenMintOpened
    {
        address to = _msgSender();

        uint256 i;
        for (i = 0; i < _linkedSamuraiIds.length; i++) {
            require(_verifyOwner(to, samuraiCollection, _linkedSamuraiIds[i]), "Must be owner of linked samurai");
        }

        for (i = 0; i < _linkedOnnaIds.length; i++) {
            require(_verifyOwner(to, onnaCollection, _linkedOnnaIds[i]), "Must be owner of linked onna");
        }

        _mint(to, _linkedSamuraiIds, _linkedOnnaIds);
    }

    function setStatus(uint8 _status) external onlyOwnerOrOperator {
        currentStatus = _status;
    }

    function _syncSupply() internal {
        uint256 totalSupply = nftCollection.totalSupply();
        maxSupply = nftCollection.maxSupply();
        availableSupply = maxSupply - totalSupply;
    }

    function syncSupply() external onlyOwnerOrOperator {
        _syncSupply();
    }

    /**
     * @dev configure the round
     */
    function configure(uint256 _startTimestamp, uint256 _endTimestamp) external onlyOwnerOrOperator {
        require(_endTimestamp == 0 || _startTimestamp < _endTimestamp, "Invalid timestamps");
        startTimestamp = _startTimestamp;
        endTimestamp = _endTimestamp;
    }

    function _getNextRandomNumber() private returns (uint256 index) {
        require(availableSupply > 0, "Invalid _remaining");

        uint256 i = maxSupply.add(uint256(keccak256(abi.encode(block.difficulty, blockhash(block.number))))).mod(
            availableSupply
        );

        // if there's a cache at _tokenIdsCache[i] then use it
        // otherwise use i itself
        index = _tokenIdsCache[i] == 0 ? i : _tokenIdsCache[i];

        // grab a number from the tail
        _tokenIdsCache[i] = _tokenIdsCache[availableSupply - 1] == 0
            ? availableSupply - 1
            : _tokenIdsCache[availableSupply - 1];
    }

    function getNextTokenId() internal returns (uint256 index) {
        return _getNextRandomNumber() + 1;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 26 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 substraction 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 26 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 5 of 26 : OperatorAccess.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/AccessControl.sol";

abstract contract OperatorAccess is AccessControl {
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");

    // Modifier for operator roles
    modifier onlyOperator() {
        require(hasRole(OPERATOR_ROLE, _msgSender()), "Not an operator");
        _;
    }
}

File 6 of 26 : TheFallen.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./libraries/ContractUri.sol";
import "./libraries/MinterAccess.sol";
import "./libraries/Recoverable.sol";

/**
 * @title TheFallen
 * @notice TheFallen ERC721 NFT collection
 * https://www.samuraisaga.com
 */
contract TheFallen is Ownable, ERC721, MinterAccess, ContractUri, Recoverable {
    using Strings for uint256;
    using Counters for Counters.Counter;

    bool public isMetadataLocked;

    uint256 public immutable maxSupply;
    Counters.Counter private _totalSupply;

    string public baseURI;

    mapping(uint256 => bool) public linkedSamurais;
    mapping(uint256 => bool) public linkedOnnas;

    event LockMetadata();

    /**
     * @notice Constructor
     * @param _maxSupply: NFT max totalSupply
     */
    constructor(uint256 _maxSupply) ERC721("TheFallen", "FALLEN") {
        maxSupply = _maxSupply;
    }

    /**
     * @dev Returns the current supply
     */
    function totalSupply() public view returns (uint256) {
        return _totalSupply.current();
    }

    /**
     * @notice Allows the owner to lock the contract
     * @dev Callable by owner
     */
    function lockMetadata() external onlyOwner {
        require(!isMetadataLocked, "Operations: Contract is locked");
        require(bytes(baseURI).length > 0, "Operations: BaseUri not set");
        isMetadataLocked = true;
        emit LockMetadata();
    }

    /**
     * @notice Allows a member of the minters group to mint a token to a specific address
     * @param _to: address to receive the token
     * @param _tokenId: tokenId
     * @dev Callable by minters
     */
    function mint(
        address _to,
        uint256 _tokenId,
        uint8 linkedCollection,
        uint256 linkedId
    ) external onlyMinters {
        require(_totalSupply.current() < maxSupply, "NFT: Total supply reached");

        if (linkedCollection == 0) {
            require(!linkedSamurais[linkedId], "NFT: Samurai already linked");
            linkedSamurais[linkedId] = true;
        } else {
            require(!linkedOnnas[linkedId], "NFT: Onna already linked");
            linkedOnnas[linkedId] = true;
        }

        _totalSupply.increment();
        _mint(_to, _tokenId);
    }

    /**
     * @notice Allows a member of the minters group to mint a batch of tokens to a specific address
     * @param _to: address to receive the token
     * @param _tokenIds: the list of tokenId to mint
     * @param _linkedSamuraiIds: the linked samurais
     * @param _linkedOnnaIds: the linked onna bugeishas
     * @dev Callable by minters
     */
    function mintBatch(
        address _to,
        uint256[] calldata _tokenIds,
        uint256[] calldata _linkedSamuraiIds,
        uint256[] calldata _linkedOnnaIds
    ) external onlyMinters {
        require(_totalSupply.current() < maxSupply, "NFT: Total supply reached");
        require(_totalSupply.current() + _tokenIds.length <= maxSupply, "NFT: Not enough supply");
        require(_tokenIds.length == _linkedSamuraiIds.length + _linkedOnnaIds.length, "NFT: Invalid linked tokens");

        uint256 i;
        for (i = 0; i < _linkedSamuraiIds.length; i++) {
            require(!linkedSamurais[_linkedSamuraiIds[i]], "NFT: Samurai already linked");
            linkedSamurais[_linkedSamuraiIds[i]] = true;
        }

        for (i = 0; i < _linkedOnnaIds.length; i++) {
            require(!linkedOnnas[_linkedOnnaIds[i]], "NFT: Onna already linked");
            linkedOnnas[_linkedOnnaIds[i]] = true;
        }

        for (i = 0; i < _tokenIds.length; i++) {
            _totalSupply.increment();
            _mint(_to, _tokenIds[i]);
        }
    }

    /**
     * @notice Allows the owner to set the base URI to be used for all token IDs
     * @param _uri: base URI
     * @dev Callable by owner
     */
    function setBaseURI(string memory _uri) external onlyOwner {
        require(!isMetadataLocked, "Operations: Contract is locked");
        baseURI = _uri;
    }

    /**
     * @notice Returns the Uniform Resource Identifier (URI) for a token ID
     * @param tokenId: token ID
     */
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "Invalid tokenId");
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json")) : "";
    }

    function isTokenLinked(uint8 linkedCollection, uint256 tokenId) public view returns (bool) {
        if (linkedCollection == 0) return linkedSamurais[tokenId];
        return linkedOnnas[tokenId];
    }
}

File 7 of 26 : IStaking.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ISamuraiStaking {
    function getStakeInfo(uint256 tokenId)
        external
        view
        returns (
            address, // owner
            uint256, // poolId
            uint256, // unlock date
            uint256 // reward date
        );
}

interface IOnnaStaking {
    function getStakeInfo(uint256 tokenId)
        external
        view
        returns (
            address, // owner
            uint256, // poolId
            uint256, // deposit date
            uint256, // unlock date
            uint256 // reward date
        );
}

File 8 of 26 : 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 9 of 26 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 10 of 26 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 11 of 26 : 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 26 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 13 of 26 : 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 14 of 26 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 15 of 26 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 overriden 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 owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        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: transfer caller is not owner nor 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: transfer caller is not owner nor 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 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 _owners[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) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, 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);

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

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

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

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {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 a {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 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 {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 16 of 26 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 17 of 26 : ContractUri.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IContractUri.sol";

/**
 * @title ContractUri
 * @notice NFT Collection with ContractUri
 */
abstract contract ContractUri is Ownable, IContractUri {
    string public contractURI;

    function setContractURI(string memory _uri) external onlyOwner {
        contractURI = _uri;
    }
}

File 18 of 26 : MinterAccess.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IContractUri.sol";

/**
 * @title MinterAccess
 */
abstract contract MinterAccess is Ownable {
    mapping(address => bool) private _minters;

    event MinterAdded(address indexed minter);
    event MinterRemoved(address indexed minter);

    modifier onlyMinters() {
        require(_minters[_msgSender()], "Mintable: Caller is not minter");
        _;
    }

    function isMinter(address account) public view returns (bool) {
        return _minters[account];
    }

    function addMinter(address minter) external onlyOwner {
        require(!_minters[minter], "Mintable: Already minter");
        _minters[minter] = true;
        emit MinterAdded(minter);
    }

    function removeMinter(address minter) external onlyOwner {
        require(_minters[minter], "Mintable: Not minter");
        _minters[minter] = false;
        emit MinterRemoved(minter);
    }
}

File 19 of 26 : Recoverable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IRecoverable.sol";

abstract contract Recoverable is Ownable, IRecoverable {
    using SafeERC20 for IERC20;

    event NonFungibleTokenRecovery(address indexed token, uint256 tokenId);
    event TokenRecovery(address indexed token, uint256 amount);
    event EthRecovery(uint256 amount);

    /**
     * @notice Allows the owner to recover non-fungible tokens sent to the contract by mistake
     * @param _token: NFT token address
     * @param _tokenId: tokenId
     * @dev Callable by owner
     */
    function recoverNonFungibleToken(address _token, uint256 _tokenId) external virtual onlyOwner {
        IERC721(_token).transferFrom(address(this), address(msg.sender), _tokenId);
        emit NonFungibleTokenRecovery(_token, _tokenId);
    }

    /**
     * @notice Allows the owner to recover tokens sent to the contract by mistake
     * @param _token: token address
     * @dev Callable by owner
     */
    function recoverToken(address _token) external virtual onlyOwner {
        uint256 balance = IERC20(_token).balanceOf(address(this));
        require(balance != 0, "Operations: Cannot recover zero balance");

        IERC20(_token).safeTransfer(address(msg.sender), balance);
        emit TokenRecovery(_token, balance);
    }

    function recoverEth(address payable _to) external virtual onlyOwner {
        uint256 balance = address(this).balance;
        _to.transfer(balance);
        emit EthRecovery(balance);
    }
}

File 20 of 26 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 21 of 26 : 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 22 of 26 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 23 of 26 : IContractUri.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IContractUri {
    function contractURI() external view returns (string memory);

    /**
     * @notice Allows the owner to set the contracy URI to be used
     * @param _uri: contract URI
     * @dev Callable by owner
     */
    function setContractURI(string memory _uri) external;
}

File 24 of 26 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 25 of 26 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 26 of 26 : IRecoverable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IRecoverable {
    /**
     * @notice Allows the owner to recover non-fungible tokens sent to the NFT contract by mistake and this contract
     * @param _token: NFT token address
     * @param _tokenId: tokenId
     * @dev Callable by owner
     */
    function recoverNonFungibleToken(address _token, uint256 _tokenId) external;

    /**
     * @notice Allows the owner to recover tokens sent to the NFT contract and this contract by mistake
     * @param _token: token address
     * @dev Callable by owner
     */
    function recoverToken(address _token) external;

    /**
     * @notice Allows the owner to recover ETH sent to the NFT contract ans and contract by mistake
     * @param _to: target address
     * @dev Callable by owner
     */
    function recoverEth(address payable _to) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TheFallen","name":"_collection","type":"address"},{"internalType":"address","name":"_samuraiCollection","type":"address"},{"internalType":"address","name":"_samuraiStakingV1","type":"address"},{"internalType":"address","name":"_samuraiStakingV2","type":"address"},{"internalType":"address","name":"_onnaCollection","type":"address"},{"internalType":"address","name":"_onnaStaking","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CLAIM","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CLOSED","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_NOT_INITIALIZED","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_PREPARING","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTimestamp","type":"uint256"},{"internalType":"uint256","name":"_endTimestamp","type":"uint256"}],"name":"configure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentStatus","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_linkedSamuraiIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_linkedOnnaIds","type":"uint256[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nftCollection","outputs":[{"internalType":"contract TheFallen","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onnaCollection","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onnaStaking","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"samuraiCollection","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"samuraiStakingV1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"samuraiStakingV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_status","type":"uint8"}],"name":"setStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"syncSupply","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101406040526002805460ff191690553480156200001c57600080fd5b5060405162001fd938038062001fd98339810160408190526200003f9162000254565b60018080556001600160a01b0387811660805286811660a05285811660c05284811660e052838116610100528216610120526002805460ff191690911790556200008b600033620000a1565b62000095620000b1565b50505050505062000328565b620000ad82826200019b565b5050565b60006080516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200011a9190620002e8565b90506080516001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200015d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001839190620002e8565b60038190556200019590829062000302565b60045550565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000ad576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001f73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b03811681146200025157600080fd5b50565b60008060008060008060c087890312156200026e57600080fd5b86516200027b816200023b565b60208801519096506200028e816200023b565b6040880151909550620002a1816200023b565b6060880151909450620002b4816200023b565b6080880151909350620002c7816200023b565b60a0880151909250620002da816200023b565b809150509295509295509295565b600060208284031215620002fb57600080fd5b5051919050565b6000828210156200032357634e487b7160e01b600052601160045260246000fd5b500390565b60805160a05160c05160e0516101005161012051611c06620003d3600039600081816102eb01528181610f320152610f7f015260008181610244015261092401526000818161038d01528181610ddd0152610e2a0152600081816103f701528181610eac0152610ef90152600081816103b401526108770152600081816102c401528181611129015281816112070152818161127c015281816112f7015261137b0152611c066000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c806391d14854116100f9578063d547741f11610097578063e6fd48bc11610071578063e6fd48bc14610419578063ef8a923514610422578063f5b541a61461042f578063feae79071461045657600080fd5b8063d547741f146103d6578063d5abeb01146103e9578063e181da05146103f257600080fd5b8063acc28f91116100d3578063acc28f9114610378578063ad33821d14610380578063bd39046914610388578063d027e698146103af57600080fd5b806391d1485414610330578063a217fddf14610367578063a85adeab1461036f57600080fd5b80633d5d190c116101665780636588103b116101405780636588103b146102bf5780636822ef7b146102e6578063715468791461030d5780637ecc2b561461032757600080fd5b80633d5d190c146102915780633e32747a146102a45780635df5729b146102b757600080fd5b80632f2ff15d116101975780632f2ff15d1461022c578063359cd1c81461023f57806336568abe1461027e57600080fd5b806301ffc9a7146101be578063248a9ca3146101e65780632e49d78b14610217575b600080fd5b6101d16101cc366004611736565b61045e565b60405190151581526020015b60405180910390f35b6102096101f4366004611760565b60009081526020819052604090206001015490565b6040519081526020016101dd565b61022a610225366004611779565b610495565b005b61022a61023a3660046117b4565b610537565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101dd565b61022a61028c3660046117b4565b610562565b61022a61029f366004611830565b6105ee565b61022a6102b236600461189c565b610a2f565b61022a610b19565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b610315600381565b60405160ff90911681526020016101dd565b61020960045481565b6101d161033e3660046117b4565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610209600081565b61020960065481565b610315600081565b610315600181565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b61022a6103e43660046117b4565b610baa565b61020960035481565b6102667f000000000000000000000000000000000000000000000000000000000000000081565b61020960055481565b6002546103159060ff1681565b6102097f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b610315600281565b60006001600160e01b03198216637965db0b60e01b148061048f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6104a060003361033e565b806104d057506104d07f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b6105215760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f72000000000000000060448201526064015b60405180910390fd5b6002805460ff191660ff92909216919091179055565b6000828152602081905260409020600101546105538133610bd0565b61055d8383610c4e565b505050565b6001600160a01b03811633146105e05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610518565b6105ea8282610cec565b5050565b6002600154036106405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610518565b600260015561064f81846118d4565b6000600454116106a15760405162461bcd60e51b815260206004820152600e60248201527f4e6f206d6f726520737570706c790000000000000000000000000000000000006044820152606401610518565b8060045410156106e75760405162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f75676820737570706c7960781b6044820152606401610518565b600081116107225760405162461bcd60e51b81526020600482015260086024820152670517479203c3d20360c41b6044820152606401610518565b6002805460ff16146107765760405162461bcd60e51b815260206004820152601060248201527f537461747573206e6f7420636c61696d000000000000000000000000000000006044820152606401610518565b6000600554116107c85760405162461bcd60e51b815260206004820152601360248201527f4d696e74206e6f7420636f6e66696775726564000000000000000000000000006044820152606401610518565b42600554111561081a5760405162461bcd60e51b815260206004820152600f60248201527f4d696e74206e6f74206f70656e656400000000000000000000000000000000006044820152606401610518565b600654158061082b57504260065410155b6108655760405162461bcd60e51b815260206004820152600b60248201526a135a5b9d0818db1bdcd95960aa1b6044820152606401610518565b3360005b85811015610912576108b4827f00000000000000000000000000000000000000000000000000000000000000008989858181106108a8576108a86118ec565b90506020020135610d6b565b6109005760405162461bcd60e51b815260206004820152601f60248201527f4d757374206265206f776e6572206f66206c696e6b65642073616d75726169006044820152606401610518565b8061090a81611902565b915050610869565b5060005b838110156109b357610955827f00000000000000000000000000000000000000000000000000000000000000008787858181106108a8576108a86118ec565b6109a15760405162461bcd60e51b815260206004820152601c60248201527f4d757374206265206f776e6572206f66206c696e6b6564206f6e6e61000000006044820152606401610518565b806109ab81611902565b915050610916565b610a218288888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a91829185019084908082843760009201919091525061101992505050565b505060018055505050505050565b610a3a60003361033e565b80610a6a5750610a6a7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b610ab65760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f7200000000000000006044820152606401610518565b801580610ac257508082105b610b0e5760405162461bcd60e51b815260206004820152601260248201527f496e76616c69642074696d657374616d707300000000000000000000000000006044820152606401610518565b600591909155600655565b610b2460003361033e565b80610b545750610b547f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b610ba05760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f7200000000000000006044820152606401610518565b610ba86112f3565b565b600082815260208190526040902060010154610bc68133610bd0565b61055d8383610cec565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166105ea57610c0c816001600160a01b03166014611411565b610c17836020611411565b604051602001610c2892919061194b565b60408051601f198184030181529082905262461bcd60e51b8252610518916004016119cc565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166105ea576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610ca83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156105ea576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516331a9108f60e11b81526004810182905260009081906001600160a01b03851690636352211e90602401602060405180830381865afa158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd991906119ff565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610eaa576040516304c09a4160e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906309813482906024015b608060405180830381865afa158015610e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9e9190611a1c565b50919250610ffa915050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f30576040516304c09a4160e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630981348290602401610e5d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610ffa576040516304c09a4160e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063098134829060240160a060405180830381865afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff29190611a5b565b509293505050505b846001600160a01b0316816001600160a01b0316149150509392505050565b606060008251845161102b91906118d4565b90508060045410156110735760405162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f75676820737570706c7960781b6044820152606401610518565b60008167ffffffffffffffff81111561108e5761108e611aa4565b6040519080825280602002602001820160405280156110b7578160200160208202803683370190505b50905060005b828110156111175760006110cf6115c1565b905060016004546110e09190611aba565b600481905550808383815181106110f9576110f96118ec565b6020908102919091010152508061110f81611902565b9150506110bd565b508160010361126557845115611205577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a7a6be96878360008151811061116a5761116a6118ec565b6020026020010151600089600081518110611187576111876118ec565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925260ff1660448301526064820152608401600060405180830381600087803b1580156111e857600080fd5b505af11580156111fc573d6000803e3d6000fd5b505050506112ea565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a7a6be968783600081518110611248576112486118ec565b6020026020010151600188600081518110611187576111876118ec565b60405163305751c360e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c15d470c906112b790899085908a908a90600401611b0c565b600060405180830381600087803b1580156112d157600080fd5b505af11580156112e5573d6000803e3d6000fd5b505050505b95945050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113779190611b5f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190611b5f565b600381905561140b908290611aba565b60045550565b60606000611420836002611b78565b61142b9060026118d4565b67ffffffffffffffff81111561144357611443611aa4565b6040519080825280601f01601f19166020018201604052801561146d576020820181803683370190505b509050600360fc1b81600081518110611488576114886118ec565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106114b7576114b76118ec565b60200101906001600160f81b031916908160001a90535060006114db846002611b78565b6114e69060016118d4565b90505b600181111561156b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611527576115276118ec565b1a60f81b82828151811061153d5761153d6118ec565b60200101906001600160f81b031916908160001a90535060049490941c9361156481611b97565b90506114e9565b5083156115ba5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610518565b9392505050565b60006115cb6115db565b6115d69060016118d4565b905090565b6000806004541161162e5760405162461bcd60e51b815260206004820152601260248201527f496e76616c6964205f72656d61696e696e6700000000000000000000000000006044820152606401610518565b600061167d600454611677444340604051602001611656929190918252602082015260400190565b60408051601f1981840301815291905280516020909101206003549061171e565b9061172a565b600081815260076020526040902054909150156116a8576000818152600760205260409020546116aa565b805b91506007600060016004546116bf9190611aba565b8152602001908152602001600020546000146116fc576007600060016004546116e89190611aba565b81526020019081526020016000205461170b565b600160045461170b9190611aba565b6000918252600760205260409091205590565b60006115ba82846118d4565b60006115ba8284611bae565b60006020828403121561174857600080fd5b81356001600160e01b0319811681146115ba57600080fd5b60006020828403121561177257600080fd5b5035919050565b60006020828403121561178b57600080fd5b813560ff811681146115ba57600080fd5b6001600160a01b03811681146117b157600080fd5b50565b600080604083850312156117c757600080fd5b8235915060208301356117d98161179c565b809150509250929050565b60008083601f8401126117f657600080fd5b50813567ffffffffffffffff81111561180e57600080fd5b6020830191508360208260051b850101111561182957600080fd5b9250929050565b6000806000806040858703121561184657600080fd5b843567ffffffffffffffff8082111561185e57600080fd5b61186a888389016117e4565b9096509450602087013591508082111561188357600080fd5b50611890878288016117e4565b95989497509550505050565b600080604083850312156118af57600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b600082198211156118e7576118e76118be565b500190565b634e487b7160e01b600052603260045260246000fd5b600060018201611914576119146118be565b5060010190565b60005b8381101561193657818101518382015260200161191e565b83811115611945576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161198381601785016020880161191b565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516119c081602884016020880161191b565b01602801949350505050565b60208152600082518060208401526119eb81604085016020870161191b565b601f01601f19169190910160400192915050565b600060208284031215611a1157600080fd5b81516115ba8161179c565b60008060008060808587031215611a3257600080fd5b8451611a3d8161179c565b60208601516040870151606090970151919890975090945092505050565b600080600080600060a08688031215611a7357600080fd5b8551611a7e8161179c565b602087015160408801516060890151608090990151929a91995097965090945092505050565b634e487b7160e01b600052604160045260246000fd5b600082821015611acc57611acc6118be565b500390565b600081518084526020808501945080840160005b83811015611b0157815187529582019590820190600101611ae5565b509495945050505050565b6001600160a01b0385168152608060208201526000611b2e6080830186611ad1565b8281036040840152611b408186611ad1565b90508281036060840152611b548185611ad1565b979650505050505050565b600060208284031215611b7157600080fd5b5051919050565b6000816000190483118215151615611b9257611b926118be565b500290565b600081611ba657611ba66118be565b506000190190565b600082611bcb57634e487b7160e01b600052601260045260246000fd5b50069056fea26469706673582212206d9b7e305a6f0c00d4bfce63038ba8049791c086ff0f21338db0c6bf0ff65e0364736f6c634300080d00330000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c5396000000000000000000000000345c2fa23160c63218dfaa25d37269f26c85ca470000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f95000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd666300000000000000000000000023a5ddd62aac108d1e1a81aa2b83a59055963e9e000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f47

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101b95760003560e01c806391d14854116100f9578063d547741f11610097578063e6fd48bc11610071578063e6fd48bc14610419578063ef8a923514610422578063f5b541a61461042f578063feae79071461045657600080fd5b8063d547741f146103d6578063d5abeb01146103e9578063e181da05146103f257600080fd5b8063acc28f91116100d3578063acc28f9114610378578063ad33821d14610380578063bd39046914610388578063d027e698146103af57600080fd5b806391d1485414610330578063a217fddf14610367578063a85adeab1461036f57600080fd5b80633d5d190c116101665780636588103b116101405780636588103b146102bf5780636822ef7b146102e6578063715468791461030d5780637ecc2b561461032757600080fd5b80633d5d190c146102915780633e32747a146102a45780635df5729b146102b757600080fd5b80632f2ff15d116101975780632f2ff15d1461022c578063359cd1c81461023f57806336568abe1461027e57600080fd5b806301ffc9a7146101be578063248a9ca3146101e65780632e49d78b14610217575b600080fd5b6101d16101cc366004611736565b61045e565b60405190151581526020015b60405180910390f35b6102096101f4366004611760565b60009081526020819052604090206001015490565b6040519081526020016101dd565b61022a610225366004611779565b610495565b005b61022a61023a3660046117b4565b610537565b6102667f00000000000000000000000023a5ddd62aac108d1e1a81aa2b83a59055963e9e81565b6040516001600160a01b0390911681526020016101dd565b61022a61028c3660046117b4565b610562565b61022a61029f366004611830565b6105ee565b61022a6102b236600461189c565b610a2f565b61022a610b19565b6102667f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c539681565b6102667f000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f4781565b610315600381565b60405160ff90911681526020016101dd565b61020960045481565b6101d161033e3660046117b4565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610209600081565b61020960065481565b610315600081565b610315600181565b6102667f000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd666381565b6102667f000000000000000000000000345c2fa23160c63218dfaa25d37269f26c85ca4781565b61022a6103e43660046117b4565b610baa565b61020960035481565b6102667f0000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f9581565b61020960055481565b6002546103159060ff1681565b6102097f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b610315600281565b60006001600160e01b03198216637965db0b60e01b148061048f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6104a060003361033e565b806104d057506104d07f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b6105215760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f72000000000000000060448201526064015b60405180910390fd5b6002805460ff191660ff92909216919091179055565b6000828152602081905260409020600101546105538133610bd0565b61055d8383610c4e565b505050565b6001600160a01b03811633146105e05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610518565b6105ea8282610cec565b5050565b6002600154036106405760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610518565b600260015561064f81846118d4565b6000600454116106a15760405162461bcd60e51b815260206004820152600e60248201527f4e6f206d6f726520737570706c790000000000000000000000000000000000006044820152606401610518565b8060045410156106e75760405162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f75676820737570706c7960781b6044820152606401610518565b600081116107225760405162461bcd60e51b81526020600482015260086024820152670517479203c3d20360c41b6044820152606401610518565b6002805460ff16146107765760405162461bcd60e51b815260206004820152601060248201527f537461747573206e6f7420636c61696d000000000000000000000000000000006044820152606401610518565b6000600554116107c85760405162461bcd60e51b815260206004820152601360248201527f4d696e74206e6f7420636f6e66696775726564000000000000000000000000006044820152606401610518565b42600554111561081a5760405162461bcd60e51b815260206004820152600f60248201527f4d696e74206e6f74206f70656e656400000000000000000000000000000000006044820152606401610518565b600654158061082b57504260065410155b6108655760405162461bcd60e51b815260206004820152600b60248201526a135a5b9d0818db1bdcd95960aa1b6044820152606401610518565b3360005b85811015610912576108b4827f000000000000000000000000345c2fa23160c63218dfaa25d37269f26c85ca478989858181106108a8576108a86118ec565b90506020020135610d6b565b6109005760405162461bcd60e51b815260206004820152601f60248201527f4d757374206265206f776e6572206f66206c696e6b65642073616d75726169006044820152606401610518565b8061090a81611902565b915050610869565b5060005b838110156109b357610955827f00000000000000000000000023a5ddd62aac108d1e1a81aa2b83a59055963e9e8787858181106108a8576108a86118ec565b6109a15760405162461bcd60e51b815260206004820152601c60248201527f4d757374206265206f776e6572206f66206c696e6b6564206f6e6e61000000006044820152606401610518565b806109ab81611902565b915050610916565b610a218288888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a91829185019084908082843760009201919091525061101992505050565b505060018055505050505050565b610a3a60003361033e565b80610a6a5750610a6a7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b610ab65760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f7200000000000000006044820152606401610518565b801580610ac257508082105b610b0e5760405162461bcd60e51b815260206004820152601260248201527f496e76616c69642074696d657374616d707300000000000000000000000000006044820152606401610518565b600591909155600655565b610b2460003361033e565b80610b545750610b547f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9293361033e565b610ba05760405162461bcd60e51b815260206004820152601860248201527f4e6f7420616e206f776e6572206f72206f70657261746f7200000000000000006044820152606401610518565b610ba86112f3565b565b600082815260208190526040902060010154610bc68133610bd0565b61055d8383610cec565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166105ea57610c0c816001600160a01b03166014611411565b610c17836020611411565b604051602001610c2892919061194b565b60408051601f198184030181529082905262461bcd60e51b8252610518916004016119cc565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166105ea576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610ca83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156105ea576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516331a9108f60e11b81526004810182905260009081906001600160a01b03851690636352211e90602401602060405180830381865afa158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd991906119ff565b90507f000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd66636001600160a01b0316816001600160a01b031603610eaa576040516304c09a4160e11b8152600481018490527f000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd66636001600160a01b0316906309813482906024015b608060405180830381865afa158015610e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9e9190611a1c565b50919250610ffa915050565b7f0000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f956001600160a01b0316816001600160a01b031603610f30576040516304c09a4160e11b8152600481018490527f0000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f956001600160a01b031690630981348290602401610e5d565b7f000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f476001600160a01b0316816001600160a01b031603610ffa576040516304c09a4160e11b8152600481018490527f000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f476001600160a01b03169063098134829060240160a060405180830381865afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff29190611a5b565b509293505050505b846001600160a01b0316816001600160a01b0316149150509392505050565b606060008251845161102b91906118d4565b90508060045410156110735760405162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f75676820737570706c7960781b6044820152606401610518565b60008167ffffffffffffffff81111561108e5761108e611aa4565b6040519080825280602002602001820160405280156110b7578160200160208202803683370190505b50905060005b828110156111175760006110cf6115c1565b905060016004546110e09190611aba565b600481905550808383815181106110f9576110f96118ec565b6020908102919091010152508061110f81611902565b9150506110bd565b508160010361126557845115611205577f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c53966001600160a01b031663a7a6be96878360008151811061116a5761116a6118ec565b6020026020010151600089600081518110611187576111876118ec565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925260ff1660448301526064820152608401600060405180830381600087803b1580156111e857600080fd5b505af11580156111fc573d6000803e3d6000fd5b505050506112ea565b7f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c53966001600160a01b031663a7a6be968783600081518110611248576112486118ec565b6020026020010151600188600081518110611187576111876118ec565b60405163305751c360e21b81526001600160a01b037f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c5396169063c15d470c906112b790899085908a908a90600401611b0c565b600060405180830381600087803b1580156112d157600080fd5b505af11580156112e5573d6000803e3d6000fd5b505050505b95945050505050565b60007f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c53966001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113779190611b5f565b90507f0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c53966001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190611b5f565b600381905561140b908290611aba565b60045550565b60606000611420836002611b78565b61142b9060026118d4565b67ffffffffffffffff81111561144357611443611aa4565b6040519080825280601f01601f19166020018201604052801561146d576020820181803683370190505b509050600360fc1b81600081518110611488576114886118ec565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106114b7576114b76118ec565b60200101906001600160f81b031916908160001a90535060006114db846002611b78565b6114e69060016118d4565b90505b600181111561156b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611527576115276118ec565b1a60f81b82828151811061153d5761153d6118ec565b60200101906001600160f81b031916908160001a90535060049490941c9361156481611b97565b90506114e9565b5083156115ba5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610518565b9392505050565b60006115cb6115db565b6115d69060016118d4565b905090565b6000806004541161162e5760405162461bcd60e51b815260206004820152601260248201527f496e76616c6964205f72656d61696e696e6700000000000000000000000000006044820152606401610518565b600061167d600454611677444340604051602001611656929190918252602082015260400190565b60408051601f1981840301815291905280516020909101206003549061171e565b9061172a565b600081815260076020526040902054909150156116a8576000818152600760205260409020546116aa565b805b91506007600060016004546116bf9190611aba565b8152602001908152602001600020546000146116fc576007600060016004546116e89190611aba565b81526020019081526020016000205461170b565b600160045461170b9190611aba565b6000918252600760205260409091205590565b60006115ba82846118d4565b60006115ba8284611bae565b60006020828403121561174857600080fd5b81356001600160e01b0319811681146115ba57600080fd5b60006020828403121561177257600080fd5b5035919050565b60006020828403121561178b57600080fd5b813560ff811681146115ba57600080fd5b6001600160a01b03811681146117b157600080fd5b50565b600080604083850312156117c757600080fd5b8235915060208301356117d98161179c565b809150509250929050565b60008083601f8401126117f657600080fd5b50813567ffffffffffffffff81111561180e57600080fd5b6020830191508360208260051b850101111561182957600080fd5b9250929050565b6000806000806040858703121561184657600080fd5b843567ffffffffffffffff8082111561185e57600080fd5b61186a888389016117e4565b9096509450602087013591508082111561188357600080fd5b50611890878288016117e4565b95989497509550505050565b600080604083850312156118af57600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b600082198211156118e7576118e76118be565b500190565b634e487b7160e01b600052603260045260246000fd5b600060018201611914576119146118be565b5060010190565b60005b8381101561193657818101518382015260200161191e565b83811115611945576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161198381601785016020880161191b565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516119c081602884016020880161191b565b01602801949350505050565b60208152600082518060208401526119eb81604085016020870161191b565b601f01601f19169190910160400192915050565b600060208284031215611a1157600080fd5b81516115ba8161179c565b60008060008060808587031215611a3257600080fd5b8451611a3d8161179c565b60208601516040870151606090970151919890975090945092505050565b600080600080600060a08688031215611a7357600080fd5b8551611a7e8161179c565b602087015160408801516060890151608090990151929a91995097965090945092505050565b634e487b7160e01b600052604160045260246000fd5b600082821015611acc57611acc6118be565b500390565b600081518084526020808501945080840160005b83811015611b0157815187529582019590820190600101611ae5565b509495945050505050565b6001600160a01b0385168152608060208201526000611b2e6080830186611ad1565b8281036040840152611b408186611ad1565b90508281036060840152611b548185611ad1565b979650505050505050565b600060208284031215611b7157600080fd5b5051919050565b6000816000190483118215151615611b9257611b926118be565b500290565b600081611ba657611ba66118be565b506000190190565b600082611bcb57634e487b7160e01b600052601260045260246000fd5b50069056fea26469706673582212206d9b7e305a6f0c00d4bfce63038ba8049791c086ff0f21338db0c6bf0ff65e0364736f6c634300080d0033

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

0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c5396000000000000000000000000345c2fa23160c63218dfaa25d37269f26c85ca470000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f95000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd666300000000000000000000000023a5ddd62aac108d1e1a81aa2b83a59055963e9e000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f47

-----Decoded View---------------
Arg [0] : _collection (address): 0x2A73068880618AcC4dC8B0B9Db29aa33ca5C5396
Arg [1] : _samuraiCollection (address): 0x345C2Fa23160C63218DfAA25D37269F26C85cA47
Arg [2] : _samuraiStakingV1 (address): 0x8Bc1E2e9cf5DAB703f8252473CBBDaEF83843f95
Arg [3] : _samuraiStakingV2 (address): 0xA760212ef90b5D4Be755FF7DAa546420D7fD6663
Arg [4] : _onnaCollection (address): 0x23A5DdD62AAC108D1e1a81aa2b83a59055963e9e
Arg [5] : _onnaStaking (address): 0xf6274573191ff7B92a13cC79908B46C1ef963f47

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000002a73068880618acc4dc8b0b9db29aa33ca5c5396
Arg [1] : 000000000000000000000000345c2fa23160c63218dfaa25d37269f26c85ca47
Arg [2] : 0000000000000000000000008bc1e2e9cf5dab703f8252473cbbdaef83843f95
Arg [3] : 000000000000000000000000a760212ef90b5d4be755ff7daa546420d7fd6663
Arg [4] : 00000000000000000000000023a5ddd62aac108d1e1a81aa2b83a59055963e9e
Arg [5] : 000000000000000000000000f6274573191ff7b92a13cc79908b46c1ef963f47


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.