ETH Price: $2,987.08 (-2.24%)
Gas: 2 Gwei

Contract

0x3A7ec00153616Af055eedB16A0790310A067F839
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Stake Traits202024232024-06-30 5:30:477 days ago1719725447IN
0x3A7ec001...0A067F839
0 ETH0.000262731.85156736
Unstake Traits202022292024-06-30 4:51:477 days ago1719723107IN
0x3A7ec001...0A067F839
0 ETH0.000121661.54322387
Stake Traits200476792024-06-08 14:22:3529 days ago1717856555IN
0x3A7ec001...0A067F839
0 ETH0.004594018.88832909
Unstake Traits197876432024-05-03 5:57:2365 days ago1714715843IN
0x3A7ec001...0A067F839
0 ETH0.001026895.2974855
Unstake Traits197876382024-05-03 5:56:2365 days ago1714715783IN
0x3A7ec001...0A067F839
0 ETH0.00126924.69197812
Unstake Traits197876032024-05-03 5:48:5965 days ago1714715339IN
0x3A7ec001...0A067F839
0 ETH0.00135155.82032671
Stake Traits197607722024-04-29 11:48:2369 days ago1714391303IN
0x3A7ec001...0A067F839
0 ETH0.001322989.85423717
Stake Traits197607572024-04-29 11:45:2369 days ago1714391123IN
0x3A7ec001...0A067F839
0 ETH0.001148468.55434478
Stake Traits197607362024-04-29 11:40:5969 days ago1714390859IN
0x3A7ec001...0A067F839
0 ETH0.001190238.86544753
Stake Traits197607212024-04-29 11:37:5969 days ago1714390679IN
0x3A7ec001...0A067F839
0 ETH0.001245958.779801
Stake Traits197607062024-04-29 11:34:5969 days ago1714390499IN
0x3A7ec001...0A067F839
0 ETH0.00110588.23657366
Stake Traits197472352024-04-27 14:22:4771 days ago1714227767IN
0x3A7ec001...0A067F839
0 ETH0.001140288.5142652
Stake Traits197471342024-04-27 14:02:3571 days ago1714226555IN
0x3A7ec001...0A067F839
0 ETH0.001064357.94734554
Stake Traits197471222024-04-27 14:00:1171 days ago1714226411IN
0x3A7ec001...0A067F839
0 ETH0.00081976.12055751
Stake Traits197471112024-04-27 13:57:5971 days ago1714226279IN
0x3A7ec001...0A067F839
0 ETH0.000924426.88556742
Stake Traits197471012024-04-27 13:55:5971 days ago1714226159IN
0x3A7ec001...0A067F839
0 ETH0.001544857.07587757
Stake Traits196083752024-04-08 3:48:4790 days ago1712548127IN
0x3A7ec001...0A067F839
0 ETH0.001370999.66178591
Stake Traits194913772024-03-22 16:32:47107 days ago1711125167IN
0x3A7ec001...0A067F839
0 ETH0.0032397923.29865783
Stake Traits194913522024-03-22 16:27:35107 days ago1711124855IN
0x3A7ec001...0A067F839
0 ETH0.0096008924.89349349
Stake Traits192034622024-02-11 7:52:59147 days ago1707637979IN
0x3A7ec001...0A067F839
0 ETH0.0031982423.88068904
Stake Traits191041192024-01-28 9:22:59161 days ago1706433779IN
0x3A7ec001...0A067F839
0 ETH0.0014617712.78656195
Stake Traits190676922024-01-23 6:48:23166 days ago1705992503IN
0x3A7ec001...0A067F839
0 ETH0.001268269.44666876
Stake Traits190478572024-01-20 11:43:59169 days ago1705751039IN
0x3A7ec001...0A067F839
0 ETH0.0056504412.07602283
Stake Traits190342282024-01-18 14:05:23171 days ago1705586723IN
0x3A7ec001...0A067F839
0 ETH0.0166973330.08956837
Stake Traits190341812024-01-18 13:55:47171 days ago1705586147IN
0x3A7ec001...0A067F839
0 ETH0.0121634229.49488358
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:
TraitSwap

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : TraitSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/IFancyTraitsV2.sol";
import "./interfaces/IFancyBearTraits.sol";
import "./interfaces/IFancy721.sol";
import "./interfaces/IFancyTraitCategories.sol";
import "./interfaces/IFancyBearStaking.sol";
import "./Tag.sol";

contract TraitSwap is ERC1155Holder, AccessControlEnumerable {
    
    struct Trait {
        address traitContract;
        uint256 traitId;
    }

    enum State {
        Off,
        On
    }

    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.AddressSet;

    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    EnumerableSet.AddressSet private approvedCollections;
    EnumerableSet.AddressSet private approvedTraitContracts;

    IFancyBearTraits public fancyTraitContract;
    IFancyTraitCategories public fancyTraitCategories;
    IFancyBearStaking public fancyBearStakingContract;
    address fancyBearContract;

    mapping(address => mapping(uint256 => mapping(string => Trait)))
        public traitsByCategoryByTokenByCollection;

    State public state;

    event TraitStaked(
        address indexed _collection,
        uint256 indexed _tokenId,
        address _traitContract,
        uint256 indexed _traitId,
        string _category,
        address _sender
    );
    event TraitUnstaked(
        address indexed _collection,
        uint256 indexed _tokenId,
        uint256 indexed _traitId,
        string _category,
        address _sender
    );
    event TraitSwapped(
        address indexed _collection,
        uint256 indexed _tokenId,
        string _category,
        uint256 _oldTraitId,
        address _oldTraitContract,
        uint256 _newTraitId,
        address _newTraitContract,
        address _sender
    );

    event CollectionAdded(address indexed _collection);
    event TraitContractAdded(address indexed _traitContract);
    event StateChanged(State _state);

    constructor(
        IFancyBearTraits _fancyTraitContract,
        IFancyTraitCategories _fancyTraitCategories,
        IFancyBearStaking _fancyBearStakingContract,
        address _fancyBearContract
    ) {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        fancyTraitContract = _fancyTraitContract;
        fancyTraitCategories = _fancyTraitCategories;
        fancyBearStakingContract = _fancyBearStakingContract;
        fancyBearContract = _fancyBearContract;
        state = State.On;
    }

    function stakeTraits(
        address[] calldata _collections,
        uint256[] calldata _tokenIds,
        address[] calldata _traitContracts,
        uint256[][] calldata _traitIds
    ) public {

        require(state == State.On, "stakeTraits: state must be on in order to stake traits");

        uint256 expectedLength = _collections.length;

        require(
            _tokenIds.length == expectedLength,
            "stakeTraits: tokenIds array size mismatch"
        );

        require(
            _traitContracts.length == expectedLength,
            "stakeTraits: traitCollection array size mismatch"
        );

        require(
            _traitIds.length == expectedLength,
            "stakeTraits: traitIds array size mismatch"
        );

        for (uint256 i = 0; i < expectedLength; i++) {

            require(
                isCollectionApproved(_collections[i]),
                "stakeTraits: collection not approved"
            );

            if(_collections[i] == fancyBearContract){
                require(
                    IERC721Enumerable(_collections[i]).ownerOf(_tokenIds[i]) == msg.sender ||
                    fancyBearStakingContract.getOwnerOf(_tokenIds[i]) == msg.sender,
                    "stakeTraits: caller does not own token on collection"
                );
            } 
            else {
                require(
                    IERC721Enumerable(_collections[i]).ownerOf(_tokenIds[i]) == msg.sender,
                    "stakeTraits: caller does not own token on collection"
                );
            }

            require(
                _traitContracts[i] == address(fancyTraitContract) ||
                isTraitContractApproved(_traitContracts[i]),
                "stakeTraits: trait contract not approved"
            );
            

            string memory category;

            for (uint256 j = 0; j < _traitIds[i].length; j++) {
                require(
                    IERC1155(_traitContracts[i]).balanceOf(msg.sender, _traitIds[i][j]) >
                        0,
                    "stakeTraits: caller does not own trait"
                );

                if (_traitContracts[i] == address(fancyTraitContract)) {
                    (, category, ) = fancyTraitContract.getTrait(
                        _traitIds[i][j]
                    );
                } else {
                    (, category) = IFancyTraitsV2(_traitContracts[i]).getTrait(
                        _traitIds[i][j]
                    );
                }

                require(
                    fancyTraitCategories.categoryApprovedByCollection(_collections[i], category),
                    "stakeTraits: category not approved for collection"
                );

                Trait memory currentTrait = traitsByCategoryByTokenByCollection[
                    _collections[i]
                ][_tokenIds[i]][category];

                if (currentTrait.traitContract != address(0)) {
                    IERC1155(currentTrait.traitContract).safeTransferFrom(
                        address(this),
                        msg.sender,
                        currentTrait.traitId,
                        1,
                        ""
                    );

                    delete (
                        traitsByCategoryByTokenByCollection[_collections[i]][
                            _tokenIds[i]
                        ][category]
                    );
                }

                IERC1155(_traitContracts[i]).safeTransferFrom(
                    msg.sender,
                    address(this),
                    _traitIds[i][j],
                    1,
                    ""
                );

                traitsByCategoryByTokenByCollection[_collections[i]][
                    _tokenIds[i]
                ][category] = Trait({
                    traitContract: _traitContracts[i],
                    traitId: _traitIds[i][j]
                });

                if (currentTrait.traitContract == address(0)) {
                    emit TraitStaked(
                        _collections[i],
                        _tokenIds[i],
                        _traitContracts[i],
                        _traitIds[i][j],
                        category,
                        msg.sender
                    );
                } else {
                    emit TraitSwapped(
                        _collections[i],
                        _tokenIds[i],
                        category,
                        currentTrait.traitId,
                        currentTrait.traitContract,
                        _traitIds[i][j],
                        _traitContracts[i],
                        msg.sender
                    );
                }
            }
        }
    }

    function unstakeTraits(
        address _collection,
        uint256 _tokenId,
        string[] calldata _categoriesToUnstake
    ) public {

        if(_collection == fancyBearContract){
            require(
                IERC721Enumerable(_collection).ownerOf(_tokenId) == msg.sender ||
                fancyBearStakingContract.getOwnerOf(_tokenId) == msg.sender,
                "unstakeTraits: caller does not own token on collection"
            );
        } 
        else {
            require(
            IERC721Enumerable(_collection).ownerOf(_tokenId) == msg.sender,
            "unstakeTraits: caller does not own token on collection"
        );
        }

        Trait memory currentTrait;

        for (uint256 i = 0; i < _categoriesToUnstake.length; i++) {
            currentTrait = traitsByCategoryByTokenByCollection[_collection][
                _tokenId
            ][_categoriesToUnstake[i]];

            require(
                currentTrait.traitContract != address(0),
                "unstakeTraits: no trait staked in category"
            );

            IERC1155(currentTrait.traitContract).safeTransferFrom(
                address(this),
                msg.sender,
                currentTrait.traitId,
                1,
                ""
            );
            delete (
                traitsByCategoryByTokenByCollection[_collection][_tokenId][
                    _categoriesToUnstake[i]
                ]
            );

            emit TraitUnstaked(
                _collection,
                _tokenId,
                currentTrait.traitId,
                _categoriesToUnstake[i],
                msg.sender
            );
        }
    }

    function getStakedTraits(address _collection, uint256 _tokenId)
        public
        view
        returns (string[] memory, Trait[] memory)
    {

        string[] memory categories = fancyTraitCategories.getCategoriesByCollection(_collection);

        Trait[] memory traitArray = new Trait[](categories.length);

        for (uint256 i = 0; i < traitArray.length; i++) {
            traitArray[i] = traitsByCategoryByTokenByCollection[
                    _collection
                ][_tokenId][categories[i]];
        }
        return (categories, traitArray);
    }

    function addCollection(address _collection) public onlyRole(MANAGER_ROLE) {
        approvedCollections.add(_collection);
        emit CollectionAdded(_collection);
    }

    function changeState(State _state) public onlyRole(MANAGER_ROLE) {
        require(state != _state, "changeState: no state change requested");
        state = _state;
        emit StateChanged(_state);
    }

    function getApprovedCollection() public view returns (address[] memory) {
        return approvedCollections.values();
    }

    function isCollectionApproved(address _address) public view returns (bool) {
        return approvedCollections.contains(_address);
    }

    function addTraitContract(address _traitContract)
        public
        onlyRole(MANAGER_ROLE)
    {
        approvedTraitContracts.add(_traitContract);
        emit TraitContractAdded(_traitContract);
    }

    function getApprovedTraitContracts()
        public
        view
        returns (address[] memory)
    {
        return approvedTraitContracts.values();
    }

    function isTraitContractApproved(address _address)
        public
        view
        returns (bool)
    {
        return approvedTraitContracts.contains(_address);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC1155Receiver, AccessControlEnumerable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

File 2 of 24 : IFancyTraitsV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

abstract contract IFancyTraitsV2 is IERC1155 {

    struct Trait {
        string name;
        string category;
        bool set;
    }

    mapping(uint256 => Trait) public traits;

    mapping(string => bool) public categoryValidation;
    uint256 public categoryPointer;
    string[] public categories;
    function getTrait(uint256 _tokenId) public virtual returns (string memory, string memory);
    function getCategories() public virtual returns (string[] memory);
    function mint(address _account, uint256 _id, uint256 _amount, bytes memory _data) public virtual;
    function mintBatch(address _account, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) public virtual;
}

File 3 of 24 : IFancyTraitCategories.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

abstract contract IFancyTraitCategories {

    mapping(address => mapping(string => bool)) public categoryApprovedByCollection;
    mapping(address => string[]) public categoryListByCollection;

    function getCategoriesByCollection(address _collection) public virtual view returns (string[] memory);
}

File 4 of 24 : IFancyBearTraits.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

abstract contract IFancyBearTraits is IERC1155 {

    struct Trait {
        string name;
        string category;
        uint256 honeyConsumptionRequirement;
        bool set;
    }

    mapping(uint256 => Trait) public traits;

    mapping(string => bool) public categoryValidation;
    uint256 public categoryPointer;
    string[] public categories;
    function getTrait(uint256 _tokenId) public virtual returns (string memory, string memory, uint256);
    function getCategories() public virtual returns (string[] memory);
    function mint(address _account, uint256 _id, uint256 _amount, bytes memory _data) public virtual;
    function mintBatch(address _account, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) public virtual;
}

File 5 of 24 : IFancyBearStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

abstract contract IFancyBearStaking {

    struct TokenStakingData {
        address owner;
        uint256 timestamp;
    }

    mapping(uint256 => TokenStakingData) public stakingDataByTokenId;
    uint256 public minimumHoneyConsumption;
    uint256 public cooldown;

    function getOwnerOf(uint256 _tokenId) public virtual returns (address);
    function getTimestampOf(uint256 _tokenId) public virtual returns (uint256);
}

File 6 of 24 : IFancy721.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

abstract contract IFancy721 is IERC721Enumerable {

    mapping(string => bool) public categoryValidation;
    uint256 public categoryPointer;
    string[] public categories;

    function safeMint(address _to, uint256[] calldata _apeTokenIds) public virtual;
    function tokensInWallet(address _owner) public virtual returns(uint256[] memory);
    function getCategories() public virtual returns (string[] memory);

}

File 7 of 24 : Tag.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

//                      ---------------[ ]---------------
//                      -------[ ]-------------[ ]-------
//                      ---------------------------------
//                      ----[ ]--------[ ]--------[ ]----
//                      ---------------------------------
//                      -------[ ]-------------[ ]-------
//                      ---------------[ ]---------------

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

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 9 of 24 : 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 10 of 24 : 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 11 of 24 : 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 12 of 24 : 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 24 : 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 14 of 24 : 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 15 of 24 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 16 of 24 : 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 17 of 24 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}

File 18 of 24 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 19 of 24 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

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

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

File 20 of 24 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

File 21 of 24 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 22 of 24 : 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 23 of 24 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

File 24 of 24 : 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());
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IFancyBearTraits","name":"_fancyTraitContract","type":"address"},{"internalType":"contract IFancyTraitCategories","name":"_fancyTraitCategories","type":"address"},{"internalType":"contract IFancyBearStaking","name":"_fancyBearStakingContract","type":"address"},{"internalType":"address","name":"_fancyBearContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"}],"name":"CollectionAdded","type":"event"},{"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum TraitSwap.State","name":"_state","type":"uint8"}],"name":"StateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_traitContract","type":"address"}],"name":"TraitContractAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_traitContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"_traitId","type":"uint256"},{"indexed":false,"internalType":"string","name":"_category","type":"string"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"TraitStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"_category","type":"string"},{"indexed":false,"internalType":"uint256","name":"_oldTraitId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_oldTraitContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newTraitId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_newTraitContract","type":"address"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"TraitSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_traitId","type":"uint256"},{"indexed":false,"internalType":"string","name":"_category","type":"string"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"TraitUnstaked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"addCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_traitContract","type":"address"}],"name":"addTraitContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum TraitSwap.State","name":"_state","type":"uint8"}],"name":"changeState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fancyBearStakingContract","outputs":[{"internalType":"contract IFancyBearStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fancyTraitCategories","outputs":[{"internalType":"contract IFancyTraitCategories","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fancyTraitContract","outputs":[{"internalType":"contract IFancyBearTraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApprovedCollection","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApprovedTraitContracts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getStakedTraits","outputs":[{"internalType":"string[]","name":"","type":"string[]"},{"components":[{"internalType":"address","name":"traitContract","type":"address"},{"internalType":"uint256","name":"traitId","type":"uint256"}],"internalType":"struct TraitSwap.Trait[]","name":"","type":"tuple[]"}],"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":[{"internalType":"address","name":"_address","type":"address"}],"name":"isCollectionApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isTraitContractApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","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":[{"internalType":"address[]","name":"_collections","type":"address[]"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address[]","name":"_traitContracts","type":"address[]"},{"internalType":"uint256[][]","name":"_traitIds","type":"uint256[][]"}],"name":"stakeTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"enum TraitSwap.State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string","name":"","type":"string"}],"name":"traitsByCategoryByTokenByCollection","outputs":[{"internalType":"address","name":"traitContract","type":"address"},{"internalType":"uint256","name":"traitId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string[]","name":"_categoriesToUnstake","type":"string[]"}],"name":"unstakeTraits","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620032e1380380620032e1833981016040819052620000349162000211565b62000041600033620000a2565b600680546001600160a01b03199081166001600160a01b03968716179091556007805482169486169490941790935560088054841692851692909217909155600980549092169216919091179055600b805460ff1916600117905562000279565b620000b98282620000e560201b62001d501760201c565b6000828152600160209081526040909120620000e091839062001dd462000186821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000182576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001413390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006200019d836001600160a01b038416620001a6565b90505b92915050565b6000818152600183016020526040812054620001ef57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001a0565b506000620001a0565b6001600160a01b03811681146200020e57600080fd5b50565b600080600080608085870312156200022857600080fd5b84516200023581620001f8565b60208601519094506200024881620001f8565b60408601519093506200025b81620001f8565b60608601519092506200026e81620001f8565b939692955090935050565b61305880620002896000396000f3fe608060405234801561001057600080fd5b50600436106101a85760003560e01c8063a174e77a116100f9578063cf2ba67511610097578063ec87621c11610071578063ec87621c1461043a578063f23a6e611461044f578063f8cf7e9c1461046e578063fc01f9031461048157600080fd5b8063cf2ba67514610401578063d547741f14610414578063dedf14b01461042757600080fd5b8063ba86798c116100d3578063ba86798c14610389578063bc197c811461039c578063c19d93fb146103d4578063ca15c873146103ee57600080fd5b8063a174e77a1461035b578063a217fddf1461036e578063b86be5451461037657600080fd5b80632f2ff15d1161016657806367adbbbf1161014057806367adbbbf146102b55780639010d07c146102bd57806391d14854146102d057806392a22480146102e357600080fd5b80632f2ff15d1461026e57806336568abe146102815780633ca2a7d51461029457600080fd5b80623dadb7146101ad57806301ffc9a7146101dd5780631655a4181461020057806323e3fbc114610215578063248a9ca314610228578063268f115314610259575b600080fd5b6006546101c0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101f06101eb366004612332565b610494565b60405190151581526020016101d4565b6102086104a5565b6040516101d4919061235c565b6008546101c0906001600160a01b031681565b61024b6102363660046123a9565b60009081526020819052604090206001015490565b6040519081526020016101d4565b61026c6102673660046123c2565b6104b6565b005b61026c61027c3660046123fb565b6105b7565b61026c61028f3660046123fb565b6105e2565b6102a76102a236600461242b565b610660565b6040516101d49291906124b3565b610208610806565b6101c06102cb366004612561565b610812565b6101f06102de3660046123fb565b610831565b61033c6102f136600461262e565b600a602090815260009384526040808520825292845291909220825180840183018051928152908301939092019290922091905280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101d4565b61026c61036936600461269a565b61085a565b61024b600081565b61026c6103843660046126fb565b6108b7565b61026c61039736600461269a565b61186e565b6103bb6103aa366004612867565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016101d4565b600b546103e19060ff1681565b6040516101d4919061292a565b61024b6103fc3660046123a9565b6118cb565b6007546101c0906001600160a01b031681565b61026c6104223660046123fb565b6118e2565b6101f061043536600461269a565b611908565b61024b60008051602061300383398151915281565b6103bb61045d366004612952565b63f23a6e6160e01b95945050505050565b61026c61047c3660046129ba565b611915565b6101f061048f36600461269a565b611d43565b600061049f82611de9565b92915050565b60606104b16002611e0e565b905090565b6000805160206130038339815191526104cf8133611e1b565b8160018111156104e1576104e1612914565b600b5460ff1660018111156104f8576104f8612914565b036105595760405162461bcd60e51b815260206004820152602660248201527f6368616e676553746174653a206e6f207374617465206368616e6765207265716044820152651d595cdd195960d21b60648201526084015b60405180910390fd5b600b805483919060ff19166001838181111561057757610577612914565b02179055507f551dc40198cc79684bb69e4931dba4ac16e4598792ee1c0a5000aeea366d7bb6826040516105ab919061292a565b60405180910390a15050565b6000828152602081905260409020600101546105d38133611e1b565b6105dd8383611e7f565b505050565b6001600160a01b03811633146106525760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610550565b61065c8282611ea1565b5050565b60075460405163175afed760e21b81526001600160a01b038481166004830152606092839260009290911690635d6bfb5c90602401600060405180830381865afa1580156106b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106da9190810190612a62565b9050600081516001600160401b038111156106f7576106f7612583565b60405190808252806020026020018201604052801561073c57816020015b60408051808201909152600080825260208201528152602001906001900390816107155790505b50905060005b81518110156107f8576001600160a01b0387166000908152600a602090815260408083208984529091529020835184908390811061078257610782612b12565b60200260200101516040516107979190612b28565b90815260408051918290036020908101832083830190925281546001600160a01b031683526001909101549082015282518390839081106107da576107da612b12565b602002602001018190525080806107f090612b5a565b915050610742565b5090925090505b9250929050565b60606104b16004611e0e565b600082815260016020526040812061082a9083611ec3565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206130038339815191526108738133611e1b565b61087e600283611dd4565b506040516001600160a01b038316907f7701426aaa4c0c88a30924a7aba88dce66b18c4020b54e4e19c9e0eb0abc299290600090a25050565b6001600b5460ff1660018111156108d0576108d0612914565b1461093c5760405162461bcd60e51b815260206004820152603660248201527f7374616b655472616974733a207374617465206d757374206265206f6e20696e604482015275206f7264657220746f207374616b652074726169747360501b6064820152608401610550565b8685811461099e5760405162461bcd60e51b815260206004820152602960248201527f7374616b655472616974733a20746f6b656e4964732061727261792073697a65604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610550565b838114610a065760405162461bcd60e51b815260206004820152603060248201527f7374616b655472616974733a207472616974436f6c6c656374696f6e2061727260448201526f0c2f240e6d2f4ca40dad2e6dac2e8c6d60831b6064820152608401610550565b818114610a675760405162461bcd60e51b815260206004820152602960248201527f7374616b655472616974733a2074726169744964732061727261792073697a65604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610550565b60005b8181101561186257610a9c8a8a83818110610a8757610a87612b12565b9050602002016020810190610435919061269a565b610af45760405162461bcd60e51b8152602060048201526024808201527f7374616b655472616974733a20636f6c6c656374696f6e206e6f7420617070726044820152631bdd995960e21b6064820152608401610550565b6009546001600160a01b03168a8a83818110610b1257610b12612b12565b9050602002016020810190610b27919061269a565b6001600160a01b031603610cac57338a8a83818110610b4857610b48612b12565b9050602002016020810190610b5d919061269a565b6001600160a01b0316636352211e8a8a85818110610b7d57610b7d612b12565b905060200201356040518263ffffffff1660e01b8152600401610ba291815260200190565b602060405180830381865afa158015610bbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be39190612b73565b6001600160a01b03161480610c8b575060085433906001600160a01b031663836387108a8a85818110610c1857610c18612b12565b905060200201356040518263ffffffff1660e01b8152600401610c3d91815260200190565b6020604051808303816000875af1158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c809190612b73565b6001600160a01b0316145b610ca75760405162461bcd60e51b815260040161055090612b90565b610d80565b338a8a83818110610cbf57610cbf612b12565b9050602002016020810190610cd4919061269a565b6001600160a01b0316636352211e8a8a85818110610cf457610cf4612b12565b905060200201356040518263ffffffff1660e01b8152600401610d1991815260200190565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190612b73565b6001600160a01b031614610d805760405162461bcd60e51b815260040161055090612b90565b6006546001600160a01b0316868683818110610d9e57610d9e612b12565b9050602002016020810190610db3919061269a565b6001600160a01b03161480610ded5750610ded868683818110610dd857610dd8612b12565b905060200201602081019061048f919061269a565b610e4a5760405162461bcd60e51b815260206004820152602860248201527f7374616b655472616974733a20747261697420636f6e7472616374206e6f7420604482015267185c1c1c9bdd995960c21b6064820152608401610550565b606060005b858584818110610e6157610e61612b12565b9050602002810190610e739190612be4565b905081101561184d576000888885818110610e9057610e90612b12565b9050602002016020810190610ea5919061269a565b6001600160a01b031662fdd58e33898988818110610ec557610ec5612b12565b9050602002810190610ed79190612be4565b86818110610ee757610ee7612b12565b6040516001600160e01b031960e087901b1681526001600160a01b0390941660048501526020029190910135602483015250604401602060405180830381865afa158015610f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5d9190612c2d565b11610fb95760405162461bcd60e51b815260206004820152602660248201527f7374616b655472616974733a2063616c6c657220646f6573206e6f74206f776e604482015265081d1c985a5d60d21b6064820152608401610550565b6006546001600160a01b0316888885818110610fd757610fd7612b12565b9050602002016020810190610fec919061269a565b6001600160a01b0316036110b5576006546001600160a01b031663acb586df87878681811061101d5761101d612b12565b905060200281019061102f9190612be4565b8481811061103f5761103f612b12565b905060200201356040518263ffffffff1660e01b815260040161106491815260200190565b6000604051808303816000875af1158015611083573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110ab9190810190612c46565b50925061118e9050565b8787848181106110c7576110c7612b12565b90506020020160208101906110dc919061269a565b6001600160a01b031663acb586df8787868181106110fc576110fc612b12565b905060200281019061110e9190612be4565b8481811061111e5761111e612b12565b905060200201356040518263ffffffff1660e01b815260040161114391815260200190565b6000604051808303816000875af1158015611162573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261118a9190810190612cb2565b9250505b6007546001600160a01b03166343b29ef28d8d868181106111b1576111b1612b12565b90506020020160208101906111c6919061269a565b846040518363ffffffff1660e01b81526004016111e4929190612d15565b602060405180830381865afa158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112259190612d39565b61128b5760405162461bcd60e51b815260206004820152603160248201527f7374616b655472616974733a2063617465676f7279206e6f7420617070726f7660448201527032b2103337b91031b7b63632b1ba34b7b760791b6064820152608401610550565b6000600a60008e8e878181106112a3576112a3612b12565b90506020020160208101906112b8919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008c8c878181106112ec576112ec612b12565b9050602002013581526020019081526020016000208360405161130f9190612b28565b90815260408051918290036020908101832083830190925281546001600160a01b0316808452600190920154908301529091501561145a5780516020820151604051637921219560e11b81526001600160a01b039092169163f242432a916113809130913391600190600401612d5b565b600060405180830381600087803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b50505050600a60008e8e878181106113c8576113c8612b12565b90506020020160208101906113dd919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008c8c8781811061141157611411612b12565b905060200201358152602001908152602001600020836040516114349190612b28565b90815260405190819003602001902080546001600160a01b031916815560006001909101555b88888581811061146c5761146c612b12565b9050602002016020810190611481919061269a565b6001600160a01b031663f242432a33308a8a898181106114a3576114a3612b12565b90506020028101906114b59190612be4565b878181106114c5576114c5612b12565b9050602002013560016040518563ffffffff1660e01b81526004016114ed9493929190612d5b565b600060405180830381600087803b15801561150757600080fd5b505af115801561151b573d6000803e3d6000fd5b5050505060405180604001604052808a8a8781811061153c5761153c612b12565b9050602002016020810190611551919061269a565b6001600160a01b0316815260200188888781811061157157611571612b12565b90506020028101906115839190612be4565b8581811061159357611593612b12565b90506020020135815250600a60008f8f888181106115b3576115b3612b12565b90506020020160208101906115c8919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008d8d888181106115fc576115fc612b12565b9050602002013581526020019081526020016000208460405161161f9190612b28565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b0391821617825592909101516001909101558151166117475786868581811061166f5761166f612b12565b90506020028101906116819190612be4565b8381811061169157611691612b12565b905060200201358b8b868181106116aa576116aa612b12565b905060200201358e8e878181106116c3576116c3612b12565b90506020020160208101906116d8919061269a565b6001600160a01b03167fbc10332272bcab294088ab2a6e58645500fd29ec549daf09dee26931231709d48c8c8981811061171457611714612b12565b9050602002016020810190611729919061269a565b873360405161173a93929190612d93565b60405180910390a461183a565b8a8a8581811061175957611759612b12565b905060200201358d8d8681811061177257611772612b12565b9050602002016020810190611787919061269a565b6001600160a01b03167fc467a55c78b7547002858593d1954b4d187435c66faa3c2d9c2f378758052ff985846020015185600001518c8c8b8181106117ce576117ce612b12565b90506020028101906117e09190612be4565b898181106117f0576117f0612b12565b905060200201358f8f8c81811061180957611809612b12565b905060200201602081019061181e919061269a565b3360405161183196959493929190612dc8565b60405180910390a35b508061184581612b5a565b915050610e4f565b5050808061185a90612b5a565b915050610a6a565b50505050505050505050565b6000805160206130038339815191526118878133611e1b565b611892600483611dd4565b506040516001600160a01b038316907fc5c248ba8a680b1129036871a8b1d24c4e91fab1124533a78306f57e1d290fd090600090a25050565b600081815260016020526040812061049f90611ecf565b6000828152602081905260409020600101546118fe8133611e1b565b6105dd8383611ea1565b600061049f600283611ed9565b6009546001600160a01b0390811690851603611a41576040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa158015611972573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119969190612b73565b6001600160a01b03161480611a205750600854604051630836387160e41b81526004810185905233916001600160a01b0316906383638710906024016020604051808303816000875af11580156119f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a159190612b73565b6001600160a01b0316145b611a3c5760405162461bcd60e51b815260040161055090612e12565b611ad2565b6040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa158015611a88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aac9190612b73565b6001600160a01b031614611ad25760405162461bcd60e51b815260040161055090612e12565b604080518082019091526000808252602082015260005b82811015611d3b576001600160a01b0386166000908152600a602090815260408083208884529091529020848483818110611b2657611b26612b12565b9050602002810190611b389190612e68565b604051611b46929190612eae565b90815260408051918290036020908101832083830190925281546001600160a01b031680845260019092015490830152909250611bd85760405162461bcd60e51b815260206004820152602a60248201527f756e7374616b655472616974733a206e6f207472616974207374616b656420696044820152696e2063617465676f727960b01b6064820152608401610550565b81516020830151604051637921219560e11b81526001600160a01b039092169163f242432a91611c119130913391600190600401612d5b565b600060405180830381600087803b158015611c2b57600080fd5b505af1158015611c3f573d6000803e3d6000fd5b505050506001600160a01b0386166000908152600a602090815260408083208884529091529020848483818110611c7857611c78612b12565b9050602002810190611c8a9190612e68565b604051611c98929190612eae565b9081526040516020918190038201902080546001600160a01b03191681556000600190910155820151856001600160a01b0388167f6e3dbea6ec257b51593facd75f60fc3eb86e02fcbfea0f781ebecf7ef73aa7e1878786818110611cff57611cff612b12565b9050602002810190611d119190612e68565b33604051611d2193929190612ebe565b60405180910390a480611d3381612b5a565b915050611ae9565b505050505050565b600061049f600483611ed9565b611d5a8282610831565b61065c576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611d903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061082a836001600160a01b038416611efb565b60006001600160e01b03198216635a05180f60e01b148061049f575061049f82611f4a565b6060600061082a83611f6f565b611e258282610831565b61065c57611e3d816001600160a01b03166014611fcb565b611e48836020611fcb565b604051602001611e59929190612eff565b60408051601f198184030181529082905262461bcd60e51b825261055091600401612f74565b611e898282611d50565b60008281526001602052604090206105dd9082611dd4565b611eab8282612166565b60008281526001602052604090206105dd90826121cb565b600061082a83836121e0565b600061049f825490565b6001600160a01b0381166000908152600183016020526040812054151561082a565b6000818152600183016020526040812054611f425750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561049f565b50600061049f565b60006001600160e01b03198216637965db0b60e01b148061049f575061049f8261220a565b606081600001805480602002602001604051908101604052809291908181526020018280548015611fbf57602002820191906000526020600020905b815481526020019060010190808311611fab575b50505050509050919050565b60606000611fda836002612f87565b611fe5906002612fa6565b6001600160401b03811115611ffc57611ffc612583565b6040519080825280601f01601f191660200182016040528015612026576020820181803683370190505b509050600360fc1b8160008151811061204157612041612b12565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061207057612070612b12565b60200101906001600160f81b031916908160001a9053506000612094846002612f87565b61209f906001612fa6565b90505b6001811115612117576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106120d3576120d3612b12565b1a60f81b8282815181106120e9576120e9612b12565b60200101906001600160f81b031916908160001a90535060049490941c9361211081612fbe565b90506120a2565b50831561082a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610550565b6121708282610831565b1561065c576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061082a836001600160a01b03841661223f565b60008260000182815481106121f7576121f7612b12565b9060005260206000200154905092915050565b60006001600160e01b03198216630271189760e51b148061049f57506301ffc9a760e01b6001600160e01b031983161461049f565b60008181526001830160205260408120548015612328576000612263600183612fd5565b855490915060009061227790600190612fd5565b90508181146122dc57600086600001828154811061229757612297612b12565b90600052602060002001549050808760000184815481106122ba576122ba612b12565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806122ed576122ed612fec565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061049f565b600091505061049f565b60006020828403121561234457600080fd5b81356001600160e01b03198116811461082a57600080fd5b6020808252825182820181905260009190848201906040850190845b8181101561239d5783516001600160a01b031683529284019291840191600101612378565b50909695505050505050565b6000602082840312156123bb57600080fd5b5035919050565b6000602082840312156123d457600080fd5b81356002811061082a57600080fd5b6001600160a01b03811681146123f857600080fd5b50565b6000806040838503121561240e57600080fd5b823591506020830135612420816123e3565b809150509250929050565b6000806040838503121561243e57600080fd5b8235612449816123e3565b946020939093013593505050565b60005b8381101561247257818101518382015260200161245a565b83811115612481576000848401525b50505050565b6000815180845261249f816020860160208601612457565b601f01601f19169290920160200192915050565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561250a57605f198987030185526124f8868351612487565b955093820193908201906001016124dc565b50508684038188015287518085528882019482019350915060005b8281101561255357845180516001600160a01b03168552820151828501529381019392850192600101612525565b509198975050505050505050565b6000806040838503121561257457600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156125c1576125c1612583565b604052919050565b60006001600160401b038211156125e2576125e2612583565b50601f01601f191660200190565b60006126036125fe846125c9565b612599565b905082815283838301111561261757600080fd5b828260208301376000602084830101529392505050565b60008060006060848603121561264357600080fd5b833561264e816123e3565b92506020840135915060408401356001600160401b0381111561267057600080fd5b8401601f8101861361268157600080fd5b612690868235602084016125f0565b9150509250925092565b6000602082840312156126ac57600080fd5b813561082a816123e3565b60008083601f8401126126c957600080fd5b5081356001600160401b038111156126e057600080fd5b6020830191508360208260051b85010111156107ff57600080fd5b6000806000806000806000806080898b03121561271757600080fd5b88356001600160401b038082111561272e57600080fd5b61273a8c838d016126b7565b909a50985060208b013591508082111561275357600080fd5b61275f8c838d016126b7565b909850965060408b013591508082111561277857600080fd5b6127848c838d016126b7565b909650945060608b013591508082111561279d57600080fd5b506127aa8b828c016126b7565b999c989b5096995094979396929594505050565b60006001600160401b038211156127d7576127d7612583565b5060051b60200190565b600082601f8301126127f257600080fd5b813560206128026125fe836127be565b82815260059290921b8401810191818101908684111561282157600080fd5b8286015b8481101561283c5780358352918301918301612825565b509695505050505050565b600082601f83011261285857600080fd5b61082a838335602085016125f0565b600080600080600060a0868803121561287f57600080fd5b853561288a816123e3565b9450602086013561289a816123e3565b935060408601356001600160401b03808211156128b657600080fd5b6128c289838a016127e1565b945060608801359150808211156128d857600080fd5b6128e489838a016127e1565b935060808801359150808211156128fa57600080fd5b5061290788828901612847565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b602081016002831061294c57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060a0868803121561296a57600080fd5b8535612975816123e3565b94506020860135612985816123e3565b9350604086013592506060860135915060808601356001600160401b038111156129ae57600080fd5b61290788828901612847565b600080600080606085870312156129d057600080fd5b84356129db816123e3565b93506020850135925060408501356001600160401b038111156129fd57600080fd5b612a09878288016126b7565b95989497509550505050565b600082601f830112612a2657600080fd5b8151612a346125fe826125c9565b818152846020838601011115612a4957600080fd5b612a5a826020830160208701612457565b949350505050565b60006020808385031215612a7557600080fd5b82516001600160401b0380821115612a8c57600080fd5b818501915085601f830112612aa057600080fd5b8151612aae6125fe826127be565b81815260059190911b83018401908481019088831115612acd57600080fd5b8585015b83811015612b0557805185811115612ae95760008081fd5b612af78b89838a0101612a15565b845250918601918601612ad1565b5098975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60008251612b3a818460208701612457565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b600060018201612b6c57612b6c612b44565b5060010190565b600060208284031215612b8557600080fd5b815161082a816123e3565b60208082526034908201527f7374616b655472616974733a2063616c6c657220646f6573206e6f74206f776e604082015273103a37b5b2b71037b71031b7b63632b1ba34b7b760611b606082015260800190565b6000808335601e19843603018112612bfb57600080fd5b8301803591506001600160401b03821115612c1557600080fd5b6020019150600581901b36038213156107ff57600080fd5b600060208284031215612c3f57600080fd5b5051919050565b600080600060608486031215612c5b57600080fd5b83516001600160401b0380821115612c7257600080fd5b612c7e87838801612a15565b94506020860151915080821115612c9457600080fd5b50612ca186828701612a15565b925050604084015190509250925092565b60008060408385031215612cc557600080fd5b82516001600160401b0380821115612cdc57600080fd5b612ce886838701612a15565b93506020850151915080821115612cfe57600080fd5b50612d0b85828601612a15565b9150509250929050565b6001600160a01b0383168152604060208201819052600090612a5a90830184612487565b600060208284031215612d4b57600080fd5b8151801515811461082a57600080fd5b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b600060018060a01b03808616835260606020840152612db56060840186612487565b9150808416604084015250949350505050565b60c081526000612ddb60c0830189612487565b6020830197909752506001600160a01b0394851660408201526060810193909352908316608083015290911660a090910152919050565b60208082526036908201527f756e7374616b655472616974733a2063616c6c657220646f6573206e6f74206f6040820152753bb7103a37b5b2b71037b71031b7b63632b1ba34b7b760511b606082015260800190565b6000808335601e19843603018112612e7f57600080fd5b8301803591506001600160401b03821115612e9957600080fd5b6020019150368190038213156107ff57600080fd5b8183823760009101908152919050565b6040815282604082015282846060830137600060608483018101919091526001600160a01b03929092166020820152601f909201601f191690910101919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f37816017850160208801612457565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f68816028840160208801612457565b01602801949350505050565b60208152600061082a6020830184612487565b6000816000190483118215151615612fa157612fa1612b44565b500290565b60008219821115612fb957612fb9612b44565b500190565b600081612fcd57612fcd612b44565b506000190190565b600082821015612fe757612fe7612b44565b500390565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122098f6f9427722021ab9e9024c44138abcd8b8ff609e588399b6d5564dfe1fe62964736f6c634300080e0033000000000000000000000000ce15f018b083844a0b650b8000a00f227fb8cfbe00000000000000000000000016ab24748f101d775291e03b9714e3fd8f3f6b5f000000000000000000000000786075ff1962f45ca0fa122d677b9f2925f4a8c600000000000000000000000087084ec881d5a15c918057f326790db177d218f2

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a85760003560e01c8063a174e77a116100f9578063cf2ba67511610097578063ec87621c11610071578063ec87621c1461043a578063f23a6e611461044f578063f8cf7e9c1461046e578063fc01f9031461048157600080fd5b8063cf2ba67514610401578063d547741f14610414578063dedf14b01461042757600080fd5b8063ba86798c116100d3578063ba86798c14610389578063bc197c811461039c578063c19d93fb146103d4578063ca15c873146103ee57600080fd5b8063a174e77a1461035b578063a217fddf1461036e578063b86be5451461037657600080fd5b80632f2ff15d1161016657806367adbbbf1161014057806367adbbbf146102b55780639010d07c146102bd57806391d14854146102d057806392a22480146102e357600080fd5b80632f2ff15d1461026e57806336568abe146102815780633ca2a7d51461029457600080fd5b80623dadb7146101ad57806301ffc9a7146101dd5780631655a4181461020057806323e3fbc114610215578063248a9ca314610228578063268f115314610259575b600080fd5b6006546101c0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101f06101eb366004612332565b610494565b60405190151581526020016101d4565b6102086104a5565b6040516101d4919061235c565b6008546101c0906001600160a01b031681565b61024b6102363660046123a9565b60009081526020819052604090206001015490565b6040519081526020016101d4565b61026c6102673660046123c2565b6104b6565b005b61026c61027c3660046123fb565b6105b7565b61026c61028f3660046123fb565b6105e2565b6102a76102a236600461242b565b610660565b6040516101d49291906124b3565b610208610806565b6101c06102cb366004612561565b610812565b6101f06102de3660046123fb565b610831565b61033c6102f136600461262e565b600a602090815260009384526040808520825292845291909220825180840183018051928152908301939092019290922091905280546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016101d4565b61026c61036936600461269a565b61085a565b61024b600081565b61026c6103843660046126fb565b6108b7565b61026c61039736600461269a565b61186e565b6103bb6103aa366004612867565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016101d4565b600b546103e19060ff1681565b6040516101d4919061292a565b61024b6103fc3660046123a9565b6118cb565b6007546101c0906001600160a01b031681565b61026c6104223660046123fb565b6118e2565b6101f061043536600461269a565b611908565b61024b60008051602061300383398151915281565b6103bb61045d366004612952565b63f23a6e6160e01b95945050505050565b61026c61047c3660046129ba565b611915565b6101f061048f36600461269a565b611d43565b600061049f82611de9565b92915050565b60606104b16002611e0e565b905090565b6000805160206130038339815191526104cf8133611e1b565b8160018111156104e1576104e1612914565b600b5460ff1660018111156104f8576104f8612914565b036105595760405162461bcd60e51b815260206004820152602660248201527f6368616e676553746174653a206e6f207374617465206368616e6765207265716044820152651d595cdd195960d21b60648201526084015b60405180910390fd5b600b805483919060ff19166001838181111561057757610577612914565b02179055507f551dc40198cc79684bb69e4931dba4ac16e4598792ee1c0a5000aeea366d7bb6826040516105ab919061292a565b60405180910390a15050565b6000828152602081905260409020600101546105d38133611e1b565b6105dd8383611e7f565b505050565b6001600160a01b03811633146106525760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610550565b61065c8282611ea1565b5050565b60075460405163175afed760e21b81526001600160a01b038481166004830152606092839260009290911690635d6bfb5c90602401600060405180830381865afa1580156106b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106da9190810190612a62565b9050600081516001600160401b038111156106f7576106f7612583565b60405190808252806020026020018201604052801561073c57816020015b60408051808201909152600080825260208201528152602001906001900390816107155790505b50905060005b81518110156107f8576001600160a01b0387166000908152600a602090815260408083208984529091529020835184908390811061078257610782612b12565b60200260200101516040516107979190612b28565b90815260408051918290036020908101832083830190925281546001600160a01b031683526001909101549082015282518390839081106107da576107da612b12565b602002602001018190525080806107f090612b5a565b915050610742565b5090925090505b9250929050565b60606104b16004611e0e565b600082815260016020526040812061082a9083611ec3565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206130038339815191526108738133611e1b565b61087e600283611dd4565b506040516001600160a01b038316907f7701426aaa4c0c88a30924a7aba88dce66b18c4020b54e4e19c9e0eb0abc299290600090a25050565b6001600b5460ff1660018111156108d0576108d0612914565b1461093c5760405162461bcd60e51b815260206004820152603660248201527f7374616b655472616974733a207374617465206d757374206265206f6e20696e604482015275206f7264657220746f207374616b652074726169747360501b6064820152608401610550565b8685811461099e5760405162461bcd60e51b815260206004820152602960248201527f7374616b655472616974733a20746f6b656e4964732061727261792073697a65604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610550565b838114610a065760405162461bcd60e51b815260206004820152603060248201527f7374616b655472616974733a207472616974436f6c6c656374696f6e2061727260448201526f0c2f240e6d2f4ca40dad2e6dac2e8c6d60831b6064820152608401610550565b818114610a675760405162461bcd60e51b815260206004820152602960248201527f7374616b655472616974733a2074726169744964732061727261792073697a65604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610550565b60005b8181101561186257610a9c8a8a83818110610a8757610a87612b12565b9050602002016020810190610435919061269a565b610af45760405162461bcd60e51b8152602060048201526024808201527f7374616b655472616974733a20636f6c6c656374696f6e206e6f7420617070726044820152631bdd995960e21b6064820152608401610550565b6009546001600160a01b03168a8a83818110610b1257610b12612b12565b9050602002016020810190610b27919061269a565b6001600160a01b031603610cac57338a8a83818110610b4857610b48612b12565b9050602002016020810190610b5d919061269a565b6001600160a01b0316636352211e8a8a85818110610b7d57610b7d612b12565b905060200201356040518263ffffffff1660e01b8152600401610ba291815260200190565b602060405180830381865afa158015610bbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be39190612b73565b6001600160a01b03161480610c8b575060085433906001600160a01b031663836387108a8a85818110610c1857610c18612b12565b905060200201356040518263ffffffff1660e01b8152600401610c3d91815260200190565b6020604051808303816000875af1158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c809190612b73565b6001600160a01b0316145b610ca75760405162461bcd60e51b815260040161055090612b90565b610d80565b338a8a83818110610cbf57610cbf612b12565b9050602002016020810190610cd4919061269a565b6001600160a01b0316636352211e8a8a85818110610cf457610cf4612b12565b905060200201356040518263ffffffff1660e01b8152600401610d1991815260200190565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190612b73565b6001600160a01b031614610d805760405162461bcd60e51b815260040161055090612b90565b6006546001600160a01b0316868683818110610d9e57610d9e612b12565b9050602002016020810190610db3919061269a565b6001600160a01b03161480610ded5750610ded868683818110610dd857610dd8612b12565b905060200201602081019061048f919061269a565b610e4a5760405162461bcd60e51b815260206004820152602860248201527f7374616b655472616974733a20747261697420636f6e7472616374206e6f7420604482015267185c1c1c9bdd995960c21b6064820152608401610550565b606060005b858584818110610e6157610e61612b12565b9050602002810190610e739190612be4565b905081101561184d576000888885818110610e9057610e90612b12565b9050602002016020810190610ea5919061269a565b6001600160a01b031662fdd58e33898988818110610ec557610ec5612b12565b9050602002810190610ed79190612be4565b86818110610ee757610ee7612b12565b6040516001600160e01b031960e087901b1681526001600160a01b0390941660048501526020029190910135602483015250604401602060405180830381865afa158015610f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5d9190612c2d565b11610fb95760405162461bcd60e51b815260206004820152602660248201527f7374616b655472616974733a2063616c6c657220646f6573206e6f74206f776e604482015265081d1c985a5d60d21b6064820152608401610550565b6006546001600160a01b0316888885818110610fd757610fd7612b12565b9050602002016020810190610fec919061269a565b6001600160a01b0316036110b5576006546001600160a01b031663acb586df87878681811061101d5761101d612b12565b905060200281019061102f9190612be4565b8481811061103f5761103f612b12565b905060200201356040518263ffffffff1660e01b815260040161106491815260200190565b6000604051808303816000875af1158015611083573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110ab9190810190612c46565b50925061118e9050565b8787848181106110c7576110c7612b12565b90506020020160208101906110dc919061269a565b6001600160a01b031663acb586df8787868181106110fc576110fc612b12565b905060200281019061110e9190612be4565b8481811061111e5761111e612b12565b905060200201356040518263ffffffff1660e01b815260040161114391815260200190565b6000604051808303816000875af1158015611162573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261118a9190810190612cb2565b9250505b6007546001600160a01b03166343b29ef28d8d868181106111b1576111b1612b12565b90506020020160208101906111c6919061269a565b846040518363ffffffff1660e01b81526004016111e4929190612d15565b602060405180830381865afa158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112259190612d39565b61128b5760405162461bcd60e51b815260206004820152603160248201527f7374616b655472616974733a2063617465676f7279206e6f7420617070726f7660448201527032b2103337b91031b7b63632b1ba34b7b760791b6064820152608401610550565b6000600a60008e8e878181106112a3576112a3612b12565b90506020020160208101906112b8919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008c8c878181106112ec576112ec612b12565b9050602002013581526020019081526020016000208360405161130f9190612b28565b90815260408051918290036020908101832083830190925281546001600160a01b0316808452600190920154908301529091501561145a5780516020820151604051637921219560e11b81526001600160a01b039092169163f242432a916113809130913391600190600401612d5b565b600060405180830381600087803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b50505050600a60008e8e878181106113c8576113c8612b12565b90506020020160208101906113dd919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008c8c8781811061141157611411612b12565b905060200201358152602001908152602001600020836040516114349190612b28565b90815260405190819003602001902080546001600160a01b031916815560006001909101555b88888581811061146c5761146c612b12565b9050602002016020810190611481919061269a565b6001600160a01b031663f242432a33308a8a898181106114a3576114a3612b12565b90506020028101906114b59190612be4565b878181106114c5576114c5612b12565b9050602002013560016040518563ffffffff1660e01b81526004016114ed9493929190612d5b565b600060405180830381600087803b15801561150757600080fd5b505af115801561151b573d6000803e3d6000fd5b5050505060405180604001604052808a8a8781811061153c5761153c612b12565b9050602002016020810190611551919061269a565b6001600160a01b0316815260200188888781811061157157611571612b12565b90506020028101906115839190612be4565b8581811061159357611593612b12565b90506020020135815250600a60008f8f888181106115b3576115b3612b12565b90506020020160208101906115c8919061269a565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008d8d888181106115fc576115fc612b12565b9050602002013581526020019081526020016000208460405161161f9190612b28565b90815260405160209181900382019020825181546001600160a01b0319166001600160a01b0391821617825592909101516001909101558151166117475786868581811061166f5761166f612b12565b90506020028101906116819190612be4565b8381811061169157611691612b12565b905060200201358b8b868181106116aa576116aa612b12565b905060200201358e8e878181106116c3576116c3612b12565b90506020020160208101906116d8919061269a565b6001600160a01b03167fbc10332272bcab294088ab2a6e58645500fd29ec549daf09dee26931231709d48c8c8981811061171457611714612b12565b9050602002016020810190611729919061269a565b873360405161173a93929190612d93565b60405180910390a461183a565b8a8a8581811061175957611759612b12565b905060200201358d8d8681811061177257611772612b12565b9050602002016020810190611787919061269a565b6001600160a01b03167fc467a55c78b7547002858593d1954b4d187435c66faa3c2d9c2f378758052ff985846020015185600001518c8c8b8181106117ce576117ce612b12565b90506020028101906117e09190612be4565b898181106117f0576117f0612b12565b905060200201358f8f8c81811061180957611809612b12565b905060200201602081019061181e919061269a565b3360405161183196959493929190612dc8565b60405180910390a35b508061184581612b5a565b915050610e4f565b5050808061185a90612b5a565b915050610a6a565b50505050505050505050565b6000805160206130038339815191526118878133611e1b565b611892600483611dd4565b506040516001600160a01b038316907fc5c248ba8a680b1129036871a8b1d24c4e91fab1124533a78306f57e1d290fd090600090a25050565b600081815260016020526040812061049f90611ecf565b6000828152602081905260409020600101546118fe8133611e1b565b6105dd8383611ea1565b600061049f600283611ed9565b6009546001600160a01b0390811690851603611a41576040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa158015611972573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119969190612b73565b6001600160a01b03161480611a205750600854604051630836387160e41b81526004810185905233916001600160a01b0316906383638710906024016020604051808303816000875af11580156119f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a159190612b73565b6001600160a01b0316145b611a3c5760405162461bcd60e51b815260040161055090612e12565b611ad2565b6040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa158015611a88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aac9190612b73565b6001600160a01b031614611ad25760405162461bcd60e51b815260040161055090612e12565b604080518082019091526000808252602082015260005b82811015611d3b576001600160a01b0386166000908152600a602090815260408083208884529091529020848483818110611b2657611b26612b12565b9050602002810190611b389190612e68565b604051611b46929190612eae565b90815260408051918290036020908101832083830190925281546001600160a01b031680845260019092015490830152909250611bd85760405162461bcd60e51b815260206004820152602a60248201527f756e7374616b655472616974733a206e6f207472616974207374616b656420696044820152696e2063617465676f727960b01b6064820152608401610550565b81516020830151604051637921219560e11b81526001600160a01b039092169163f242432a91611c119130913391600190600401612d5b565b600060405180830381600087803b158015611c2b57600080fd5b505af1158015611c3f573d6000803e3d6000fd5b505050506001600160a01b0386166000908152600a602090815260408083208884529091529020848483818110611c7857611c78612b12565b9050602002810190611c8a9190612e68565b604051611c98929190612eae565b9081526040516020918190038201902080546001600160a01b03191681556000600190910155820151856001600160a01b0388167f6e3dbea6ec257b51593facd75f60fc3eb86e02fcbfea0f781ebecf7ef73aa7e1878786818110611cff57611cff612b12565b9050602002810190611d119190612e68565b33604051611d2193929190612ebe565b60405180910390a480611d3381612b5a565b915050611ae9565b505050505050565b600061049f600483611ed9565b611d5a8282610831565b61065c576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611d903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061082a836001600160a01b038416611efb565b60006001600160e01b03198216635a05180f60e01b148061049f575061049f82611f4a565b6060600061082a83611f6f565b611e258282610831565b61065c57611e3d816001600160a01b03166014611fcb565b611e48836020611fcb565b604051602001611e59929190612eff565b60408051601f198184030181529082905262461bcd60e51b825261055091600401612f74565b611e898282611d50565b60008281526001602052604090206105dd9082611dd4565b611eab8282612166565b60008281526001602052604090206105dd90826121cb565b600061082a83836121e0565b600061049f825490565b6001600160a01b0381166000908152600183016020526040812054151561082a565b6000818152600183016020526040812054611f425750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561049f565b50600061049f565b60006001600160e01b03198216637965db0b60e01b148061049f575061049f8261220a565b606081600001805480602002602001604051908101604052809291908181526020018280548015611fbf57602002820191906000526020600020905b815481526020019060010190808311611fab575b50505050509050919050565b60606000611fda836002612f87565b611fe5906002612fa6565b6001600160401b03811115611ffc57611ffc612583565b6040519080825280601f01601f191660200182016040528015612026576020820181803683370190505b509050600360fc1b8160008151811061204157612041612b12565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061207057612070612b12565b60200101906001600160f81b031916908160001a9053506000612094846002612f87565b61209f906001612fa6565b90505b6001811115612117576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106120d3576120d3612b12565b1a60f81b8282815181106120e9576120e9612b12565b60200101906001600160f81b031916908160001a90535060049490941c9361211081612fbe565b90506120a2565b50831561082a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610550565b6121708282610831565b1561065c576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061082a836001600160a01b03841661223f565b60008260000182815481106121f7576121f7612b12565b9060005260206000200154905092915050565b60006001600160e01b03198216630271189760e51b148061049f57506301ffc9a760e01b6001600160e01b031983161461049f565b60008181526001830160205260408120548015612328576000612263600183612fd5565b855490915060009061227790600190612fd5565b90508181146122dc57600086600001828154811061229757612297612b12565b90600052602060002001549050808760000184815481106122ba576122ba612b12565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806122ed576122ed612fec565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061049f565b600091505061049f565b60006020828403121561234457600080fd5b81356001600160e01b03198116811461082a57600080fd5b6020808252825182820181905260009190848201906040850190845b8181101561239d5783516001600160a01b031683529284019291840191600101612378565b50909695505050505050565b6000602082840312156123bb57600080fd5b5035919050565b6000602082840312156123d457600080fd5b81356002811061082a57600080fd5b6001600160a01b03811681146123f857600080fd5b50565b6000806040838503121561240e57600080fd5b823591506020830135612420816123e3565b809150509250929050565b6000806040838503121561243e57600080fd5b8235612449816123e3565b946020939093013593505050565b60005b8381101561247257818101518382015260200161245a565b83811115612481576000848401525b50505050565b6000815180845261249f816020860160208601612457565b601f01601f19169290920160200192915050565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561250a57605f198987030185526124f8868351612487565b955093820193908201906001016124dc565b50508684038188015287518085528882019482019350915060005b8281101561255357845180516001600160a01b03168552820151828501529381019392850192600101612525565b509198975050505050505050565b6000806040838503121561257457600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156125c1576125c1612583565b604052919050565b60006001600160401b038211156125e2576125e2612583565b50601f01601f191660200190565b60006126036125fe846125c9565b612599565b905082815283838301111561261757600080fd5b828260208301376000602084830101529392505050565b60008060006060848603121561264357600080fd5b833561264e816123e3565b92506020840135915060408401356001600160401b0381111561267057600080fd5b8401601f8101861361268157600080fd5b612690868235602084016125f0565b9150509250925092565b6000602082840312156126ac57600080fd5b813561082a816123e3565b60008083601f8401126126c957600080fd5b5081356001600160401b038111156126e057600080fd5b6020830191508360208260051b85010111156107ff57600080fd5b6000806000806000806000806080898b03121561271757600080fd5b88356001600160401b038082111561272e57600080fd5b61273a8c838d016126b7565b909a50985060208b013591508082111561275357600080fd5b61275f8c838d016126b7565b909850965060408b013591508082111561277857600080fd5b6127848c838d016126b7565b909650945060608b013591508082111561279d57600080fd5b506127aa8b828c016126b7565b999c989b5096995094979396929594505050565b60006001600160401b038211156127d7576127d7612583565b5060051b60200190565b600082601f8301126127f257600080fd5b813560206128026125fe836127be565b82815260059290921b8401810191818101908684111561282157600080fd5b8286015b8481101561283c5780358352918301918301612825565b509695505050505050565b600082601f83011261285857600080fd5b61082a838335602085016125f0565b600080600080600060a0868803121561287f57600080fd5b853561288a816123e3565b9450602086013561289a816123e3565b935060408601356001600160401b03808211156128b657600080fd5b6128c289838a016127e1565b945060608801359150808211156128d857600080fd5b6128e489838a016127e1565b935060808801359150808211156128fa57600080fd5b5061290788828901612847565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b602081016002831061294c57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060a0868803121561296a57600080fd5b8535612975816123e3565b94506020860135612985816123e3565b9350604086013592506060860135915060808601356001600160401b038111156129ae57600080fd5b61290788828901612847565b600080600080606085870312156129d057600080fd5b84356129db816123e3565b93506020850135925060408501356001600160401b038111156129fd57600080fd5b612a09878288016126b7565b95989497509550505050565b600082601f830112612a2657600080fd5b8151612a346125fe826125c9565b818152846020838601011115612a4957600080fd5b612a5a826020830160208701612457565b949350505050565b60006020808385031215612a7557600080fd5b82516001600160401b0380821115612a8c57600080fd5b818501915085601f830112612aa057600080fd5b8151612aae6125fe826127be565b81815260059190911b83018401908481019088831115612acd57600080fd5b8585015b83811015612b0557805185811115612ae95760008081fd5b612af78b89838a0101612a15565b845250918601918601612ad1565b5098975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60008251612b3a818460208701612457565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b600060018201612b6c57612b6c612b44565b5060010190565b600060208284031215612b8557600080fd5b815161082a816123e3565b60208082526034908201527f7374616b655472616974733a2063616c6c657220646f6573206e6f74206f776e604082015273103a37b5b2b71037b71031b7b63632b1ba34b7b760611b606082015260800190565b6000808335601e19843603018112612bfb57600080fd5b8301803591506001600160401b03821115612c1557600080fd5b6020019150600581901b36038213156107ff57600080fd5b600060208284031215612c3f57600080fd5b5051919050565b600080600060608486031215612c5b57600080fd5b83516001600160401b0380821115612c7257600080fd5b612c7e87838801612a15565b94506020860151915080821115612c9457600080fd5b50612ca186828701612a15565b925050604084015190509250925092565b60008060408385031215612cc557600080fd5b82516001600160401b0380821115612cdc57600080fd5b612ce886838701612a15565b93506020850151915080821115612cfe57600080fd5b50612d0b85828601612a15565b9150509250929050565b6001600160a01b0383168152604060208201819052600090612a5a90830184612487565b600060208284031215612d4b57600080fd5b8151801515811461082a57600080fd5b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b600060018060a01b03808616835260606020840152612db56060840186612487565b9150808416604084015250949350505050565b60c081526000612ddb60c0830189612487565b6020830197909752506001600160a01b0394851660408201526060810193909352908316608083015290911660a090910152919050565b60208082526036908201527f756e7374616b655472616974733a2063616c6c657220646f6573206e6f74206f6040820152753bb7103a37b5b2b71037b71031b7b63632b1ba34b7b760511b606082015260800190565b6000808335601e19843603018112612e7f57600080fd5b8301803591506001600160401b03821115612e9957600080fd5b6020019150368190038213156107ff57600080fd5b8183823760009101908152919050565b6040815282604082015282846060830137600060608483018101919091526001600160a01b03929092166020820152601f909201601f191690910101919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f37816017850160208801612457565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612f68816028840160208801612457565b01602801949350505050565b60208152600061082a6020830184612487565b6000816000190483118215151615612fa157612fa1612b44565b500290565b60008219821115612fb957612fb9612b44565b500190565b600081612fcd57612fcd612b44565b506000190190565b600082821015612fe757612fe7612b44565b500390565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122098f6f9427722021ab9e9024c44138abcd8b8ff609e588399b6d5564dfe1fe62964736f6c634300080e0033

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

000000000000000000000000ce15f018b083844a0b650b8000a00f227fb8cfbe00000000000000000000000016ab24748f101d775291e03b9714e3fd8f3f6b5f000000000000000000000000786075ff1962f45ca0fa122d677b9f2925f4a8c600000000000000000000000087084ec881d5a15c918057f326790db177d218f2

-----Decoded View---------------
Arg [0] : _fancyTraitContract (address): 0xCE15f018b083844a0B650B8000A00F227fB8cfbe
Arg [1] : _fancyTraitCategories (address): 0x16ab24748F101D775291E03B9714e3Fd8F3f6b5f
Arg [2] : _fancyBearStakingContract (address): 0x786075FF1962F45ca0Fa122d677b9F2925f4a8C6
Arg [3] : _fancyBearContract (address): 0x87084ec881d5A15C918057F326790dB177D218F2

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000ce15f018b083844a0b650b8000a00f227fb8cfbe
Arg [1] : 00000000000000000000000016ab24748f101d775291e03b9714e3fd8f3f6b5f
Arg [2] : 000000000000000000000000786075ff1962f45ca0fa122d677b9f2925f4a8c6
Arg [3] : 00000000000000000000000087084ec881d5a15c918057f326790db177d218f2


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.