GLMR Price: $0.019182 (-7.53%)

Contract

0xfF3D57b4c92E41546Eedd3912D6130906A324677

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Mint Multiple To...37428172023-06-09 9:42:54965 days ago1686303774IN
0xfF3D57b4...06A324677
0 GLMR0.99357401147.61430364
Mint Multiple To...37428162023-06-09 9:42:42965 days ago1686303762IN
0xfF3D57b4...06A324677
0 GLMR0.99259634147.46905254
Mint Multiple To...37428152023-06-09 9:42:30965 days ago1686303750IN
0xfF3D57b4...06A324677
0 GLMR0.99161397147.32310252
Mint Multiple To...37428142023-06-09 9:42:18965 days ago1686303738IN
0xfF3D57b4...06A324677
0 GLMR0.99067868147.18414663
Mint Multiple To...37428112023-06-09 9:41:42965 days ago1686303702IN
0xfF3D57b4...06A324677
0 GLMR0.98780392146.7570464
Mint Multiple To...37428102023-06-09 9:41:30965 days ago1686303690IN
0xfF3D57b4...06A324677
0 GLMR0.98674592146.59986072
Mint Multiple To...37428092023-06-09 9:41:18965 days ago1686303678IN
0xfF3D57b4...06A324677
0 GLMR0.98590463146.47487084
Mint Multiple To...37428082023-06-09 9:41:06965 days ago1686303666IN
0xfF3D57b4...06A324677
0 GLMR0.98499079146.33910332
Mint Multiple To...37428072023-06-09 9:40:48965 days ago1686303648IN
0xfF3D57b4...06A324677
0 GLMR0.98408082146.20390989
Mint Multiple To...37428062023-06-09 9:40:36965 days ago1686303636IN
0xfF3D57b4...06A324677
0 GLMR0.98313187146.06292578
Mint Multiple To...37428052023-06-09 9:40:24965 days ago1686303624IN
0xfF3D57b4...06A324677
0 GLMR0.98219178145.92325632
Mint Multiple To...37428042023-06-09 9:40:12965 days ago1686303612IN
0xfF3D57b4...06A324677
0 GLMR0.98103886145.7519693
Mint Multiple To...37428032023-06-09 9:39:54965 days ago1686303594IN
0xfF3D57b4...06A324677
0 GLMR0.97979778145.5675832
Mint Multiple To...37428022023-06-09 9:39:36965 days ago1686303576IN
0xfF3D57b4...06A324677
0 GLMR0.97869707145.40405078
Mint Multiple To...37428012023-06-09 9:39:24965 days ago1686303564IN
0xfF3D57b4...06A324677
0 GLMR0.97774055145.26194235
Mint Multiple To...37428002023-06-09 9:39:12965 days ago1686303552IN
0xfF3D57b4...06A324677
0 GLMR0.97675184145.11505096
Mint Multiple To...37427992023-06-09 9:39:00965 days ago1686303540IN
0xfF3D57b4...06A324677
0 GLMR0.97558783144.94211383
Mint Multiple To...37427982023-06-09 9:38:48965 days ago1686303528IN
0xfF3D57b4...06A324677
0 GLMR0.97481256144.82693413
Mint Multiple To...37427972023-06-09 9:38:36965 days ago1686303516IN
0xfF3D57b4...06A324677
0 GLMR0.97384835144.68368216
Mint Multiple To...37427962023-06-09 9:38:24965 days ago1686303504IN
0xfF3D57b4...06A324677
0 GLMR0.9730799144.56951324
Mint Multiple To...37427942023-06-09 9:37:54965 days ago1686303474IN
0xfF3D57b4...06A324677
0 GLMR0.97021259144.14352115
Mint Multiple To...37427932023-06-09 9:37:42965 days ago1686303462IN
0xfF3D57b4...06A324677
0 GLMR0.96932307144.01136486
Mint Multiple To...37427922023-06-09 9:37:30965 days ago1686303450IN
0xfF3D57b4...06A324677
0 GLMR0.96855821143.89773016
Mint Multiple To...37427912023-06-09 9:37:18965 days ago1686303438IN
0xfF3D57b4...06A324677
0 GLMR0.96736781143.72087473
Mint Multiple To...37427902023-06-09 9:37:00965 days ago1686303420IN
0xfF3D57b4...06A324677
0 GLMR0.96644993143.58450579
View all transactions

View more zero value Internal Transactions in Advanced View mode

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MetaFactory

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

import "../interfaces/IRMRKExtended.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@rmrk-team/evm-contracts/contracts/RMRK/access/Ownable.sol";
import "@rmrk-team/evm-contracts/contracts/RMRK/extension/soulbound/IERC6454.sol";
import "@rmrk-team/evm-contracts/contracts/RMRK/nestable/IERC6059.sol";

error InvalidNumberOfAssets();
error InvalidNumberOfDestinationIds();
error InvalidNumberOfToAddresses();
error NotOwnerOrContributor();

contract MetaFactory is ERC721Holder {
    event NewRmrkNft(uint256 tokenId, address indexed rmrkCollectionContract);
    event NewRmrkAsset(
        uint256 assetId,
        uint256 tokenId,
        address indexed rmrkCollectionContract
    );

    modifier onlyCollectionOwner(address collection) {
        _checkCollectionOwner(collection);
        _;
    }

    /**
     * @notice Creates a new asset entry and adds it to the token
     * @param collection The address of the RMRK collection
     * @param tokenId The ID of the token
     * @param asset The asset to set
     */
    function createNewAssetAndAddToToken(
        address collection,
        uint256 tokenId,
        string calldata asset
    ) public onlyCollectionOwner(collection) {
        _createNewAssetAndAddToToken(collection, tokenId, asset);
    }

    function _createNewAssetAndAddToToken(
        address collection,
        uint256 tokenId,
        string calldata asset
    ) public {
        uint64 assetId = uint64(IRMRKExtended(collection).addAssetEntry(asset));

        // Resource is autoaccepted if it is a RMRK implementation and it is the first asset, or it is owned by the caller
        IRMRKExtended(collection).addAssetToToken(
            tokenId,
            assetId,
            0 // 0 is the default value as we don't overwrite anything
        );

        emit NewRmrkAsset(assetId, tokenId, collection);
    }

    function mintTokenWithAsset(
        address collection,
        string calldata asset,
        address to
    ) public payable onlyCollectionOwner(collection) {
        uint256 tokenId = IRMRKExtended(collection).mint{value: msg.value}(
            to,
            1
        );

        _createNewAssetAndAddToToken(collection, tokenId, asset);
        emit NewRmrkNft(tokenId, collection);
    }

    // @dev If collection uses soulbound, only the first asset is accepted
    function mintTokenWithMultipleAssets(
        address collection,
        string[] calldata assets,
        address to
    ) public payable onlyCollectionOwner(collection) {
        bool isSoulbound = IERC165(collection).supportsInterface(
            type(IERC6454).interfaceId
        );
        uint256 tokenId;
        if (isSoulbound) {
            // Mint directly to destination
            tokenId = IRMRKExtended(collection).mint{value: msg.value}(to, 1);
        } else {
            // Mint to this contract first, so all assets are auto accepted
            tokenId = IRMRKExtended(collection).mint{value: msg.value}(
                address(this),
                1
            );
        }

        for (uint256 i; i < assets.length; ) {
            _createNewAssetAndAddToToken(collection, tokenId, assets[i]);
            unchecked {
                ++i;
            }
        }

        if (!isSoulbound) {
            // Transfer to destination
            IERC721(collection).safeTransferFrom(address(this), to, tokenId);
        }
        emit NewRmrkNft(tokenId, collection);
    }

    function _mintTokenWithAsset(
        address collection,
        string calldata asset,
        address to
    ) private {
        uint256 tokenId = IRMRKExtended(collection).mint{value: msg.value}(
            to,
            1
        );

        _createNewAssetAndAddToToken(collection, tokenId, asset);
        emit NewRmrkNft(tokenId, collection);
    }

    function mintMultipleTokensWithSameAsset(
        address collection,
        string calldata asset,
        address[] calldata toAddresses,
        uint256 amount
    ) public payable onlyCollectionOwner(collection) {
        uint64 assetId = uint64(IRMRKExtended(collection).addAssetEntry(asset));
        for (uint256 i; i < amount; ) {
            uint256 tokenId = IRMRKExtended(collection).mint{value: msg.value}(
                toAddresses[i],
                1
            );
            // Resource is autoaccepted if it is a RMRK implementation because it is the first asset
            IRMRKExtended(collection).addAssetToToken(
                tokenId,
                assetId,
                0 // 0 is the default value as we don't overwrite anything
            );
            emit NewRmrkNft(tokenId, collection);
            unchecked {
                ++i;
            }
        }
    }

    function mintMultipleTokensWithDifferentAsset(
        address collection,
        string[] calldata assets,
        address[] calldata toAddresses,
        uint256 amount
    ) public payable onlyCollectionOwner(collection) {
        if (assets.length != amount) {
            revert InvalidNumberOfAssets();
        }
        if (toAddresses.length != amount) {
            revert InvalidNumberOfToAddresses();
        }

        for (uint256 i; i < amount; ) {
            _mintTokenWithAsset(collection, assets[i], toAddresses[i]);
            unchecked {
                ++i;
            }
        }
    }

    function nestMintTokenWithAsset(
        address collection,
        string calldata asset,
        address to,
        uint256 destinationId
    ) public payable onlyCollectionOwner(collection) {
        _nestMintTokenWithAsset(collection, asset, to, destinationId);
    }

    // @dev If collection uses soulbound, only the first asset is accepted
    function nestMintTokenWithMultipleAssets(
        address collection,
        string[] calldata assets,
        address to,
        uint256 destinationId
    ) public payable onlyCollectionOwner(collection) {
        bool isSoulbound = IERC165(collection).supportsInterface(
            type(IERC6454).interfaceId
        );
        uint256 tokenId;
        if (isSoulbound) {
            // Mint directly to destination
            tokenId = IRMRKExtended(collection).nestMint{value: msg.value}(
                to,
                1,
                destinationId
            );
        } else {
            // Mint to this contract first, so all assets are auto accepted
            tokenId = IRMRKExtended(collection).mint{value: msg.value}(
                address(this),
                1
            );
        }

        for (uint256 i; i < assets.length; ) {
            _createNewAssetAndAddToToken(collection, tokenId, assets[i]);
            unchecked {
                ++i;
            }
        }

        if (!isSoulbound) {
            // Transfer to destination
            IERC6059(collection).nestTransferFrom(
                address(this),
                to,
                tokenId,
                destinationId,
                ""
            );
        }
        emit NewRmrkNft(tokenId, collection);
    }

    function _nestMintTokenWithAsset(
        address collection,
        string calldata asset,
        address to,
        uint256 destinationId
    ) private {
        uint256 tokenId = IRMRKExtended(collection).nestMint{value: msg.value}(
            to,
            1,
            destinationId
        );

        _createNewAssetAndAddToToken(collection, tokenId, asset);
        emit NewRmrkNft(tokenId, collection);
    }

    function nestMintMultipleTokensWithSameAsset(
        address collection,
        string calldata asset, // Same asset for all tokens
        address to, // We expect the destination collection to be the same for all tokens
        uint256[] calldata destinationIds, // We expect the destination collection to be different for all tokens
        uint256 amount
    ) public payable onlyCollectionOwner(collection) {
        if (destinationIds.length != amount) {
            revert InvalidNumberOfDestinationIds();
        }

        uint64 assetId = uint64(IRMRKExtended(collection).addAssetEntry(asset));
        for (uint256 i; i < amount; ) {
            uint256 tokenId = IRMRKExtended(collection).nestMint{
                value: msg.value
            }(to, 1, destinationIds[i]);
            // Resource is autoaccepted if it is a RMRK implementation because it is the first asset
            IRMRKExtended(collection).addAssetToToken(
                tokenId,
                assetId,
                0 // 0 is the default value as we don't overwrite anything
            );
            emit NewRmrkNft(tokenId, collection);
            unchecked {
                ++i;
            }
        }
    }

    function nestMintMultipleTokensWithDifferentAsset(
        address collection,
        string[] calldata assets, // One asset per token
        address to, // We expect the destination collection to be the same for all tokens
        uint256[] calldata destinationIds, // We expect the destination collection to be different for all tokens
        uint256 amount
    ) public payable onlyCollectionOwner(collection) {
        if (destinationIds.length != amount) {
            revert InvalidNumberOfDestinationIds();
        }
        if (assets.length != amount) {
            revert InvalidNumberOfAssets();
        }

        for (uint256 i; i < amount; ) {
            _nestMintTokenWithAsset(
                collection,
                assets[i],
                to,
                destinationIds[i]
            );
            unchecked {
                ++i;
            }
        }
    }

    function _checkCollectionOwner(address collection) internal view {
        if (
            Ownable(collection).owner() != msg.sender &&
            !Ownable(collection).isContributor(msg.sender)
        ) {
            revert NotOwnerOrContributor();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

File 3 of 12 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts 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);
}

// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/utils/Context.sol";
import "../library/RMRKErrors.sol";

/**
 * @title Ownable
 * @author RMRK team
 * @notice A minimal ownable smart contractf or owner and contributors.
 * @dev This smart contract is based on "openzeppelin's access/Ownable.sol".
 */
contract Ownable is Context {
    address private _owner;
    mapping(address => uint256) private _contributors;

    /**
     * @notice Used to anounce the transfer of ownership.
     * @param previousOwner Address of the account that transferred their ownership role
     * @param newOwner Address of the account receiving the ownership role
     */
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    /**
     * @notice Event that signifies that an address was granted contributor role or that the permission has been
     *  revoked.
     * @dev This can only be triggered by a current owner, so there is no need to include that information in the event.
     * @param contributor Address of the account that had contributor role status updated
     * @param isContributor A boolean value signifying whether the role has been granted (`true`) or revoked (`false`)
     */
    event ContributorUpdate(address indexed contributor, bool isContributor);

    /**
     * @dev Reverts if called by any account other than the owner or an approved contributor.
     */
    modifier onlyOwnerOrContributor() {
        _onlyOwnerOrContributor();
        _;
    }

    /**
     * @dev Reverts if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _onlyOwner();
        _;
    }

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

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

    /**
     * @notice Leaves the contract without owner. Functions using the `onlyOwner` modifier will be disabled.
     * @dev Can only be called by the current owner.
     * @dev Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is
     *  only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @notice Transfers ownership of the contract to a new owner.
     * @dev Can only be called by the current owner.
     * @param newOwner Address of the new owner's account
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) revert RMRKNewOwnerIsZeroAddress();
        _transferOwnership(newOwner);
    }

    /**
     * @notice Transfers ownership of the contract to a new owner.
     * @dev Internal function without access restriction.
     * @dev Emits ***OwnershipTransferred*** event.
     * @param newOwner Address of the new owner's account
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @notice Adds or removes a contributor to the smart contract.
     * @dev Can only be called by the owner.
     * @dev Emits ***ContributorUpdate*** event.
     * @param contributor Address of the contributor's account
     * @param grantRole A boolean value signifying whether the contributor role is being granted (`true`) or revoked
     *  (`false`)
     */
    function manageContributor(
        address contributor,
        bool grantRole
    ) external onlyOwner {
        if (contributor == address(0)) revert RMRKNewContributorIsZeroAddress();
        grantRole
            ? _contributors[contributor] = 1
            : _contributors[contributor] = 0;
        emit ContributorUpdate(contributor, grantRole);
    }

    /**
     * @notice Used to check if the address is one of the contributors.
     * @param contributor Address of the contributor whose status we are checking
     * @return Boolean value indicating whether the address is a contributor or not
     */
    function isContributor(address contributor) public view returns (bool) {
        return _contributors[contributor] == 1;
    }

    /**
     * @notice Used to verify that the caller is either the owner or a contributor.
     * @dev If the caller is not the owner or a contributor, the execution will be reverted.
     */
    function _onlyOwnerOrContributor() private view {
        if (owner() != _msgSender() && !isContributor(_msgSender()))
            revert RMRKNotOwnerOrContributor();
    }

    /**
     * @notice Used to verify that the caller is the owner.
     * @dev If the caller is not the owner, the execution will be reverted.
     */
    function _onlyOwner() private view {
        if (owner() != _msgSender()) revert RMRKNotOwner();
    }
}

// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IERC6454
 * @author RMRK team
 * @notice A minimal extension to identify the transferability of Non-Fungible Tokens.
 */
interface IERC6454 is IERC165 {
    /**
     * @notice Used to check whether the given token is transferable or not.
     * @dev If this function returns `false`, the transfer of the token MUST revert execution.
     * @dev If the tokenId does not exist, this method MUST revert execution, unless the token is being checked for
     *  minting.
     * @param tokenId ID of the token being checked
     * @param from Address from which the token is being transferred
     * @param to Address to which the token is being transferred
     * @return Boolean value indicating whether the given token is transferable
     */
    function isTransferable(
        uint256 tokenId,
        address from,
        address to
    ) external view returns (bool);
}

File 9 of 12 : RMRKErrors.sol
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

/// @title RMRKErrors
/// @author RMRK team
/// @notice A collection of errors used in the RMRK suite
/// @dev Errors are kept in a centralised file in order to provide a central point of reference and to avoid error
///  naming collisions due to inheritance

/// Attempting to grant the token to 0x0 address
error ERC721AddressZeroIsNotaValidOwner();
/// Attempting to grant approval to the current owner of the token
error ERC721ApprovalToCurrentOwner();
/// Attempting to grant approval when not being owner or approved for all should not be permitted
error ERC721ApproveCallerIsNotOwnerNorApprovedForAll();
/// Attempting to get approvals for a token owned by 0x0 (considered non-existent)
error ERC721ApprovedQueryForNonexistentToken();
/// Attempting to grant approval to self
error ERC721ApproveToCaller();
/// Attempting to use an invalid token ID
error ERC721InvalidTokenId();
/// Attempting to mint to 0x0 address
error ERC721MintToTheZeroAddress();
/// Attempting to manage a token without being its owner or approved by the owner
error ERC721NotApprovedOrOwner();
/// Attempting to mint an already minted token
error ERC721TokenAlreadyMinted();
/// Attempting to transfer the token from an address that is not the owner
error ERC721TransferFromIncorrectOwner();
/// Attempting to safe transfer to an address that is unable to receive the token
error ERC721TransferToNonReceiverImplementer();
/// Attempting to transfer the token to a 0x0 address
error ERC721TransferToTheZeroAddress();
/// Attempting to grant approval of assets to their current owner
error RMRKApprovalForAssetsToCurrentOwner();
/// Attempting to grant approval of assets without being the caller or approved for all
error RMRKApproveForAssetsCallerIsNotOwnerNorApprovedForAll();
/// Attempting to incorrectly configue a Catalog item
error RMRKBadConfig();
/// Attempting to set the priorities with an array of length that doesn't match the length of active assets array
error RMRKBadPriorityListLength();
/// Attempting to add an asset entry with `Part`s, without setting the `Catalog` address
error RMRKCatalogRequiredForParts();
/// Attempting to transfer a soulbound (non-transferrable) token
error RMRKCannotTransferSoulbound();
/// Attempting to accept a child that has already been accepted
error RMRKChildAlreadyExists();
/// Attempting to interact with a child, using index that is higher than the number of children
error RMRKChildIndexOutOfRange();
/// Attempting to find the index of a child token on a parent which does not own it.
error RMRKChildNotFoundInParent();
/// Attempting to pass collaborator address array and collaborator permission array of different lengths
error RMRKCollaboratorArraysNotEqualLength();
/// Attempting to register a collection that is already registered
error RMRKCollectionAlreadyRegistered();
/// Attempting to manage or interact with colleciton that is not registered
error RMRKCollectionNotRegistered();
/// Attempting to equip a `Part` with a child not approved by the Catalog
error RMRKEquippableEquipNotAllowedByCatalog();
/// Attempting to use ID 0, which is not supported
/// @dev The ID 0 in RMRK suite is reserved for empty values. Guarding against its use ensures the expected operation
error RMRKIdZeroForbidden();
/// Attempting to interact with an asset, using index greater than number of assets
error RMRKIndexOutOfRange();
/// Attempting to reclaim a child that can't be reclaimed
error RMRKInvalidChildReclaim();
/// Attempting to interact with an end-user account when the contract account is expected
error RMRKIsNotContract();
/// Attempting to interact with a contract that had its operation locked
error RMRKLocked();
/// Attempting to add a pending child after the number of pending children has reached the limit (default limit is 128)
error RMRKMaxPendingChildrenReached();
/// Attempting to add a pending asset after the number of pending assets has reached the limit (default limit is
///  128)
error RMRKMaxPendingAssetsReached();
/// Attempting to burn a total number of recursive children higher than maximum set
/// @param childContract Address of the collection smart contract in which the maximum number of recursive burns was reached
/// @param childId ID of the child token at which the maximum number of recursive burns was reached
error RMRKMaxRecursiveBurnsReached(address childContract, uint256 childId);
/// Attempting to mint a number of tokens that would cause the total supply to be greater than maximum supply
error RMRKMintOverMax();
/// Attempting to mint a nested token to a smart contract that doesn't support nesting
error RMRKMintToNonRMRKNestableImplementer();
/// Attempting to pass complementary arrays of different lengths
error RMRKMismachedArrayLength();
/// Attempting to transfer a child before it is unequipped
error RMRKMustUnequipFirst();
/// Attempting to nest a child over the nestable limit (current limit is 100 levels of nesting)
error RMRKNestableTooDeep();
/// Attempting to nest the token to own descendant, which would create a loop and leave the looped tokens in limbo
error RMRKNestableTransferToDescendant();
/// Attempting to nest the token to a smart contract that doesn't support nesting
error RMRKNestableTransferToNonRMRKNestableImplementer();
/// Attempting to nest the token into itself
error RMRKNestableTransferToSelf();
/// Attempting to interact with an asset that can not be found
error RMRKNoAssetMatchingId();
/// Attempting to manage an asset without owning it or having been granted permission by the owner to do so
error RMRKNotApprovedForAssetsOrOwner();
/// Attempting to interact with a token without being its owner or having been granted permission by the
///  owner to do so
/// @dev When a token is nested, only the direct owner (NFT parent) can mange it. In that case, approved addresses are
///  not allowed to manage it, in order to ensure the expected behaviour
error RMRKNotApprovedOrDirectOwner();
/// Attempting to manage a collection without being the collection's collaborator
error RMRKNotCollectionCollaborator();
/// Attemting to manage a collection without being the collection's issuer
error RMRKNotCollectionIssuer();
/// Attempting to manage a collection without being the collection's issuer or collaborator
error RMRKNotCollectionIssuerOrCollaborator();
/// Attempting to compose an asset wihtout having an associated Catalog
error RMRKNotComposableAsset();
/// Attempting to unequip an item that isn't equipped
error RMRKNotEquipped();
/// Attempting to interact with a management function without being the smart contract's owner
error RMRKNotOwner();
/// Attempting to interact with a function without being the owner or contributor of the collection
error RMRKNotOwnerOrContributor();
/// Attempting to manage a collection without being the specific address
error RMRKNotSpecificAddress();
/// Attempting to manage a token without being its owner
error RMRKNotTokenOwner();
/// Attempting to transfer the ownership to the 0x0 address
error RMRKNewOwnerIsZeroAddress();
/// Attempting to assign a 0x0 address as a contributor
error RMRKNewContributorIsZeroAddress();
/// Attemtping to use `Ownable` interface without implementing it
error RMRKOwnableNotImplemented();
/// Attempting an operation requiring the token being nested, while it is not
error RMRKParentIsNotNFT();
/// Attempting to add a `Part` with an ID that is already used
error RMRKPartAlreadyExists();
/// Attempting to use a `Part` that doesn't exist
error RMRKPartDoesNotExist();
/// Attempting to use a `Part` that is `Fixed` when `Slot` kind of `Part` should be used
error RMRKPartIsNotSlot();
/// Attempting to interact with a pending child using an index greater than the size of pending array
error RMRKPendingChildIndexOutOfRange();
/// Attempting to add an asset using an ID that has already been used
error RMRKAssetAlreadyExists();
/// Attempting to equip an item into a slot that already has an item equipped
error RMRKSlotAlreadyUsed();
/// Attempting to equip an item into a `Slot` that the target asset does not implement
error RMRKTargetAssetCannotReceiveSlot();
/// Attempting to equip a child into a `Slot` and parent that the child's collection doesn't support
error RMRKTokenCannotBeEquippedWithAssetIntoSlot();
/// Attempting to compose a NFT of a token without active assets
error RMRKTokenDoesNotHaveAsset();
/// Attempting to determine the asset with the top priority on a token without assets
error RMRKTokenHasNoAssets();
/// Attempting to accept or transfer a child which does not match the one at the specified index
error RMRKUnexpectedChildId();
/// Attempting to reject all pending assets but more assets than expected are pending
error RMRKUnexpectedNumberOfAssets();
/// Attempting to reject all pending children but children assets than expected are pending
error RMRKUnexpectedNumberOfChildren();
/// Attempting to accept or reject an asset which does not match the one at the specified index
error RMRKUnexpectedAssetId();
/// Attempting an operation expecting a parent to the token which is not the actual one
error RMRKUnexpectedParent();
/// Attempting not to pass an empty array of equippable addresses when adding or setting the equippable addresses
error RMRKZeroLengthIdsPassed();
/// Attempting to set the royalties to a value higher than 100% (10000 in base points)
error RMRKRoyaltiesTooHigh();
/// Attempting to do a bulk operation on a token that is not owned by the caller
error RMRKCanOnlyDoBulkOperationsOnOwnedTokens();
/// Attempting to do a bulk operation with multiple tokens at a time
error RMRKCanOnlyDoBulkOperationsWithOneTokenAtATime();

// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IERC5773
 * @author RMRK team
 * @notice Interface smart contract of the RMRK multi asset module.
 */
interface IERC5773 is IERC165 {
    /**
     * @notice Used to notify listeners that an asset object is initialized at `assetId`.
     * @param assetId ID of the asset that was initialized
     */
    event AssetSet(uint64 indexed assetId);

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is added to token's pending asset
     *  array.
     * @param tokenIds An array of token IDs that received a new pending asset
     * @param assetId ID of the asset that has been added to the token's pending assets array
     * @param replacesId ID of the asset that would be replaced
     */
    event AssetAddedToTokens(
        uint256[] tokenIds,
        uint64 indexed assetId,
        uint64 indexed replacesId
    );

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is accepted by the token and migrated
     *  from token's pending assets array to active assets array of the token.
     * @param tokenId ID of the token that had a new asset accepted
     * @param assetId ID of the asset that was accepted
     * @param replacesId ID of the asset that was replaced
     */
    event AssetAccepted(
        uint256 indexed tokenId,
        uint64 indexed assetId,
        uint64 indexed replacesId
    );

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is rejected from token and is dropped
     *  from the pending assets array of the token.
     * @param tokenId ID of the token that had an asset rejected
     * @param assetId ID of the asset that was rejected
     */
    event AssetRejected(uint256 indexed tokenId, uint64 indexed assetId);

    /**
     * @notice Used to notify listeners that token's prioritiy array is reordered.
     * @param tokenId ID of the token that had the asset priority array updated
     */
    event AssetPrioritySet(uint256 indexed tokenId);

    /**
     * @notice Used to notify listeners that owner has granted an approval to the user to manage the assets of a
     *  given token.
     * @dev Approvals must be cleared on transfer
     * @param owner Address of the account that has granted the approval for all token's assets
     * @param approved Address of the account that has been granted approval to manage the token's assets
     * @param tokenId ID of the token on which the approval was granted
     */
    event ApprovalForAssets(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );

    /**
     * @notice Used to notify listeners that owner has granted approval to the user to manage assets of all of their
     *  tokens.
     * @param owner Address of the account that has granted the approval for all assets on all of their tokens
     * @param operator Address of the account that has been granted the approval to manage the token's assets on all of
     *  the tokens
     * @param approved Boolean value signifying whether the permission has been granted (`true`) or revoked (`false`)
     */
    event ApprovalForAllForAssets(
        address indexed owner,
        address indexed operator,
        bool approved
    );

    /**
     * @notice Accepts an asset at from the pending array of given token.
     * @dev Migrates the asset from the token's pending asset array to the token's active asset array.
     * @dev Active assets cannot be removed by anyone, but can be replaced by a new asset.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token's assets
     *  - `tokenId` must exist.
     *  - `index` must be in range of the length of the pending asset array.
     * @dev Emits an {AssetAccepted} event.
     * @param tokenId ID of the token for which to accept the pending asset
     * @param index Index of the asset in the pending array to accept
     * @param assetId ID of the asset expected to be in the index
     */
    function acceptAsset(
        uint256 tokenId,
        uint256 index,
        uint64 assetId
    ) external;

    /**
     * @notice Rejects an asset from the pending array of given token.
     * @dev Removes the asset from the token's pending asset array.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token's assets
     *  - `tokenId` must exist.
     *  - `index` must be in range of the length of the pending asset array.
     * @dev Emits a {AssetRejected} event.
     * @param tokenId ID of the token that the asset is being rejected from
     * @param index Index of the asset in the pending array to be rejected
     * @param assetId ID of the asset expected to be in the index
     */
    function rejectAsset(
        uint256 tokenId,
        uint256 index,
        uint64 assetId
    ) external;

    /**
     * @notice Rejects all assets from the pending array of a given token.
     * @dev Effecitvely deletes the pending array.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token's assets
     *  - `tokenId` must exist.
     * @dev Emits a {AssetRejected} event with assetId = 0.
     * @param tokenId ID of the token of which to clear the pending array.
     * @param maxRejections Maximum number of expected assets to reject, used to prevent from rejecting assets which
     *  arrive just before this operation.
     */
    function rejectAllAssets(uint256 tokenId, uint256 maxRejections) external;

    /**
     * @notice Sets a new priority array for a given token.
     * @dev The priority array is a non-sequential list of `uint64`s, where the lowest value is considered highest
     *  priority.
     * @dev Value `0` of a priority is a special case equivalent to unitialized.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token's assets
     *  - `tokenId` must exist.
     *  - The length of `priorities` must be equal the length of the active assets array.
     * @dev Emits a {AssetPrioritySet} event.
     * @param tokenId ID of the token to set the priorities for
     * @param priorities An array of priorities of active assets. The succesion of items in the priorities array
     *  matches that of the succesion of items in the active array
     */
    function setPriority(
        uint256 tokenId,
        uint64[] calldata priorities
    ) external;

    /**
     * @notice Used to retrieve IDs of the active assets of given token.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @dev You can safely get 10k
     * @param tokenId ID of the token to retrieve the IDs of the active assets
     * @return An array of active asset IDs of the given token
     */
    function getActiveAssets(
        uint256 tokenId
    ) external view returns (uint64[] memory);

    /**
     * @notice Used to retrieve IDs of the pending assets of given token.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @param tokenId ID of the token to retrieve the IDs of the pending assets
     * @return An array of pending asset IDs of the given token
     */
    function getPendingAssets(
        uint256 tokenId
    ) external view returns (uint64[] memory);

    /**
     * @notice Used to retrieve the priorities of the active resoources of a given token.
     * @dev Asset priorities are a non-sequential array of uint64 values with an array size equal to active asset
     *  priorites.
     * @param tokenId ID of the token for which to retrieve the priorities of the active assets
     * @return An array of priorities of the active assets of the given token
     */
    function getActiveAssetPriorities(
        uint256 tokenId
    ) external view returns (uint64[] memory);

    /**
     * @notice Used to retrieve the asset that will be replaced if a given asset from the token's pending array
     *  is accepted.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @param tokenId ID of the token to check
     * @param newAssetId ID of the pending asset which will be accepted
     * @return ID of the asset which will be replaced
     */
    function getAssetReplacements(
        uint256 tokenId,
        uint64 newAssetId
    ) external view returns (uint64);

    /**
     * @notice Used to fetch the asset metadata of the specified token's active asset with the given index.
     * @dev Assets are stored by reference mapping `_assets[assetId]`.
     * @dev Can be overriden to implement enumerate, fallback or other custom logic.
     * @param tokenId ID of the token from which to retrieve the asset metadata
     * @param assetId Asset Id, must be in the active assets array
     * @return The metadata of the asset belonging to the specified index in the token's active assets
     *  array
     */
    function getAssetMetadata(
        uint256 tokenId,
        uint64 assetId
    ) external view returns (string memory);

    // Approvals

    /**
     * @notice Used to grant permission to the user to manage token's assets.
     * @dev This differs from transfer approvals, as approvals are not cleared when the approved party accepts or
     *  rejects an asset, or sets asset priorities. This approval is cleared on token transfer.
     * @dev Only a single account can be approved at a time, so approving the `0x0` address clears previous approvals.
     * @dev Requirements:
     *
     *  - The caller must own the token or be an approved operator.
     *  - `tokenId` must exist.
     * @dev Emits an {ApprovalForAssets} event.
     * @param to Address of the account to grant the approval to
     * @param tokenId ID of the token for which the approval to manage the assets is granted
     */
    function approveForAssets(address to, uint256 tokenId) external;

    /**
     * @notice Used to retrieve the address of the account approved to manage assets of a given token.
     * @dev Requirements:
     *
     *  - `tokenId` must exist.
     * @param tokenId ID of the token for which to retrieve the approved address
     * @return Address of the account that is approved to manage the specified token's assets
     */
    function getApprovedForAssets(
        uint256 tokenId
    ) external view returns (address);

    /**
     * @notice Used to add or remove an operator of assets for the caller.
     * @dev Operators can call {acceptAsset}, {rejectAsset}, {rejectAllAssets} or {setPriority} for any token
     *  owned by the caller.
     * @dev Requirements:
     *
     *  - The `operator` cannot be the caller.
     * @dev Emits an {ApprovalForAllForAssets} event.
     * @param operator Address of the account to which the operator role is granted or revoked from
     * @param approved The boolean value indicating whether the operator role is being granted (`true`) or revoked
     *  (`false`)
     */
    function setApprovalForAllForAssets(
        address operator,
        bool approved
    ) external;

    /**
     * @notice Used to check whether the address has been granted the operator role by a given address or not.
     * @dev See {setApprovalForAllForAssets}.
     * @param owner Address of the account that we are checking for whether it has granted the operator role
     * @param operator Address of the account that we are checking whether it has the operator role or not
     * @return A boolean value indicating wehter the account we are checking has been granted the operator role
     */
    function isApprovedForAllForAssets(
        address owner,
        address operator
    ) external view returns (bool);
}

// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IERC6059
 * @author RMRK team
 * @notice Interface smart contract of the RMRK nestable module.
 */
interface IERC6059 is IERC165 {
    /**
     * @notice The core struct of RMRK ownership.
     * @dev The `DirectOwner` struct is used to store information of the next immediate owner, be it the parent token or
     *  the externally owned account.
     * @dev If the token is owned by the externally owned account, the `tokenId` should equal `0`.
     * @param tokenId ID of the parent token
     * @param ownerAddress Address of the owner of the token. If the owner is another token, then the address should be
     *  the one of the parent token's collection smart contract. If the owner is externally owned account, the address
     *  should be the address of this account
     * @param isNft A boolean value signifying whether the token is owned by another token (`true`) or by an externally
     *  owned account (`false`)
     */
    struct DirectOwner {
        uint256 tokenId;
        address ownerAddress;
    }

    /**
     * @notice Used to notify listeners that the token is being transferred.
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     * @param from Address of the previous immediate owner, which is a smart contract if the token was nested.
     * @param to Address of the new immediate owner, which is a smart contract if the token is being nested.
     * @param fromTokenId ID of the previous parent token. If the token was not nested before, the value should be `0`
     * @param toTokenId ID of the new parent token. If the token is not being nested, the value should be `0`
     * @param tokenId ID of the token being transferred
     */
    event NestTransfer(
        address indexed from,
        address indexed to,
        uint256 fromTokenId,
        uint256 toTokenId,
        uint256 indexed tokenId
    );

    /**
     * @notice Used to notify listeners that a new token has been added to a given token's pending children array.
     * @dev Emitted when a child NFT is added to a token's pending array.
     * @param tokenId ID of the token that received a new pending child token
     * @param childIndex Index of the proposed child token in the parent token's pending children array
     * @param childAddress Address of the proposed child token's collection smart contract
     * @param childId ID of the child token in the child token's collection smart contract
     */
    event ChildProposed(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId
    );

    /**
     * @notice Used to notify listeners that a new child token was accepted by the parent token.
     * @dev Emitted when a parent token accepts a token from its pending array, migrating it to the active array.
     * @param tokenId ID of the token that accepted a new child token
     * @param childIndex Index of the newly accepted child token in the parent token's active children array
     * @param childAddress Address of the child token's collection smart contract
     * @param childId ID of the child token in the child token's collection smart contract
     */
    event ChildAccepted(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId
    );

    /**
     * @notice Used to notify listeners that all pending child tokens of a given token have been rejected.
     * @dev Emitted when a token removes all a child tokens from its pending array.
     * @param tokenId ID of the token that rejected all of the pending children
     */
    event AllChildrenRejected(uint256 indexed tokenId);

    /**
     * @notice Used to notify listeners a child token has been transferred from parent token.
     * @dev Emitted when a token transfers a child from itself, transferring ownership to the root owner.
     * @param tokenId ID of the token that transferred a child token
     * @param childIndex Index of a child in the array from which it is being transferred
     * @param childAddress Address of the child token's collection smart contract
     * @param childId ID of the child token in the child token's collection smart contract
     * @param fromPending A boolean value signifying whether the token was in the pending child tokens array (`true`) or
     *  in the active child tokens array (`false`)
     * @param toZero A boolean value signifying whether the token is being transferred to the `0x0` address (`true`) or
     *  not (`false`)
     */
    event ChildTransferred(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId,
        bool fromPending,
        bool toZero
    );

    /**
     * @notice The core child token struct, holding the information about the child tokens.
     * @return tokenId ID of the child token in the child token's collection smart contract
     * @return contractAddress Address of the child token's smart contract
     */
    struct Child {
        uint256 tokenId;
        address contractAddress;
    }

    /**
     * @notice Used to retrieve the *root* owner of a given token.
     * @dev The *root* owner of the token is an externally owned account (EOA). If the given token is child of another
     *  NFT, this will return an EOA address. Otherwise, if the token is owned by an EOA, this EOA wil be returned.
     * @param tokenId ID of the token for which the *root* owner has been retrieved
     * @return owner The *root* owner of the token
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @notice Used to retrieve the immediate owner of the given token.
     * @dev If the immediate owner is another token, the address returned, should be the one of the parent token's
     *  collection smart contract.
     * @param tokenId ID of the token for which the RMRK owner is being retrieved
     * @return Address of the given token's owner
     * @return The ID of the parent token. Should be `0` if the owner is an externally owned account
     * @return The boolean value signifying whether the owner is an NFT or not
     */
    function directOwnerOf(
        uint256 tokenId
    ) external view returns (address, uint256, bool);

    /**
     * @notice Used to burn a given token.
     * @dev When a token is burned, all of its child tokens are recursively burned as well.
     * @dev When specifying the maximum recursive burns, the execution will be reverted if there are more children to be
     *  burned.
     * @dev Setting the `maxRecursiveBurn` value to 0 will only attempt to burn the specified token and revert if there
     *  are any child tokens present.
     * @dev The approvals are cleared when the token is burned.
     * @dev Requirements:
     *
     *  - `tokenId` must exist.
     * @dev Emits a {Transfer} event.
     * @param tokenId ID of the token to burn
     * @param maxRecursiveBurns Maximum number of tokens to recursively burn
     * @return Number of recursively burned children
     */
    function burn(
        uint256 tokenId,
        uint256 maxRecursiveBurns
    ) external returns (uint256);

    /**
     * @notice Used to add a child token to a given parent token.
     * @dev This adds the child token into the given parent token's pending child tokens array.
     * @dev Requirements:
     *
     *  - `directOwnerOf` on the child contract must resolve to the called contract.
     *  - the pending array of the parent contract must not be full.
     * @param parentId ID of the parent token to receive the new child token
     * @param childId ID of the new proposed child token
     * @param data Additional data with no specified format
     */
    function addChild(
        uint256 parentId,
        uint256 childId,
        bytes memory data
    ) external;

    /**
     * @notice Used to accept a pending child token for a given parent token.
     * @dev This moves the child token from parent token's pending child tokens array into the active child tokens
     *  array.
     * @param parentId ID of the parent token for which the child token is being accepted
     * @param childIndex Index of a child tokem in the given parent's pending children array
     * @param childAddress Address of the collection smart contract of the child token expected to be located at the
     *  specified index of the given parent token's pending children array
     * @param childId ID of the child token expected to be located at the specified index of the given parent token's
     *  pending children array
     */
    function acceptChild(
        uint256 parentId,
        uint256 childIndex,
        address childAddress,
        uint256 childId
    ) external;

    /**
     * @notice Used to reject all pending children of a given parent token.
     * @dev Removes the children from the pending array mapping.
     * @dev This does not update the ownership storage data on children. If necessary, ownership can be reclaimed by the
     *  rootOwner of the previous parent.
     * @dev Requirements:
     *
     * Requirements:
     *
     * - `parentId` must exist
     * @param parentId ID of the parent token for which to reject all of the pending tokens.
     * @param maxRejections Maximum number of expected children to reject, used to prevent from rejecting children which
     *  arrive just before this operation.
     */
    function rejectAllChildren(
        uint256 parentId,
        uint256 maxRejections
    ) external;

    /**
     * @notice Used to transfer a child token from a given parent token.
     * @dev When transferring a child token, the owner of the token is set to `to`, or is not updated in the event of
     *  `to` being the `0x0` address.
     * @param tokenId ID of the parent token from which the child token is being transferred
     * @param to Address to which to transfer the token to
     * @param destinationId ID of the token to receive this child token (MUST be 0 if the destination is not a token)
     * @param childIndex Index of a token we are transferring, in the array it belongs to (can be either active array or
     *  pending array)
     * @param childAddress Address of the child token's collection smart contract.
     * @param childId ID of the child token in its own collection smart contract.
     * @param isPending A boolean value indicating whether the child token being transferred is in the pending array of
     *  the parent token (`true`) or in the active array (`false`)
     * @param data Additional data with no specified format, sent in call to `_to`
     */
    function transferChild(
        uint256 tokenId,
        address to,
        uint256 destinationId,
        uint256 childIndex,
        address childAddress,
        uint256 childId,
        bool isPending,
        bytes memory data
    ) external;

    /**
     * @notice Used to retrieve the active child tokens of a given parent token.
     * @dev Returns array of Child structs existing for parent token.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which to retrieve the active child tokens
     * @return An array of Child structs containing the parent token's active child tokens
     */
    function childrenOf(
        uint256 parentId
    ) external view returns (Child[] memory);

    /**
     * @notice Used to retrieve the pending child tokens of a given parent token.
     * @dev Returns array of pending Child structs existing for given parent.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which to retrieve the pending child tokens
     * @return An array of Child structs containing the parent token's pending child tokens
     */
    function pendingChildrenOf(
        uint256 parentId
    ) external view returns (Child[] memory);

    /**
     * @notice Used to retrieve a specific active child token for a given parent token.
     * @dev Returns a single Child struct locating at `index` of parent token's active child tokens array.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which the child is being retrieved
     * @param index Index of the child token in the parent token's active child tokens array
     * @return A Child struct containing data about the specified child
     */
    function childOf(
        uint256 parentId,
        uint256 index
    ) external view returns (Child memory);

    /**
     * @notice Used to retrieve a specific pending child token from a given parent token.
     * @dev Returns a single Child struct locating at `index` of parent token's active child tokens array.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which the pending child token is being retrieved
     * @param index Index of the child token in the parent token's pending child tokens array
     * @return A Child struct containting data about the specified child
     */
    function pendingChildOf(
        uint256 parentId,
        uint256 index
    ) external view returns (Child memory);

    /**
     * @notice Used to transfer the token into another token.
     * @param from Address of the direct owner of the token to be transferred
     * @param to Address of the receiving token's collection smart contract
     * @param tokenId ID of the token being transferred
     * @param destinationId ID of the token to receive the token being transferred
     * @param data Additional data with no specified format, sent in the addChild call
     */
    function nestTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        uint256 destinationId,
        bytes memory data
    ) external;
}

// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.18;

import "@rmrk-team/evm-contracts/contracts/RMRK/multiasset/IERC5773.sol";

interface IRMRKExtended is IERC5773 {
    /**
     * @notice EXTENDED functions not available in the standard RMRK MultiResource interface
     */

    function addAssetEntry(
        string memory metadataURI
    ) external returns (uint256);

    function addAssetToToken(
        uint256 tokenId,
        uint64 resourceId,
        uint64 replacesAssetWithId
    ) external;

    function mint(
        address to,
        uint256 numToMint
    ) external payable returns (uint256);

    function nestMint(
        address to,
        uint256 numToMint,
        uint256 destinationId
    ) external payable returns (uint256);

    function totalSupply() external view returns (uint256);

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"InvalidNumberOfAssets","type":"error"},{"inputs":[],"name":"InvalidNumberOfDestinationIds","type":"error"},{"inputs":[],"name":"InvalidNumberOfToAddresses","type":"error"},{"inputs":[],"name":"NotOwnerOrContributor","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"assetId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"rmrkCollectionContract","type":"address"}],"name":"NewRmrkAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"rmrkCollectionContract","type":"address"}],"name":"NewRmrkNft","type":"event"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"asset","type":"string"}],"name":"_createNewAssetAndAddToToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"asset","type":"string"}],"name":"createNewAssetAndAddToToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string[]","name":"assets","type":"string[]"},{"internalType":"address[]","name":"toAddresses","type":"address[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintMultipleTokensWithDifferentAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string","name":"asset","type":"string"},{"internalType":"address[]","name":"toAddresses","type":"address[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintMultipleTokensWithSameAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string","name":"asset","type":"string"},{"internalType":"address","name":"to","type":"address"}],"name":"mintTokenWithAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string[]","name":"assets","type":"string[]"},{"internalType":"address","name":"to","type":"address"}],"name":"mintTokenWithMultipleAssets","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string[]","name":"assets","type":"string[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"destinationIds","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"nestMintMultipleTokensWithDifferentAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string","name":"asset","type":"string"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"destinationIds","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"nestMintMultipleTokensWithSameAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string","name":"asset","type":"string"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"destinationId","type":"uint256"}],"name":"nestMintTokenWithAsset","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"string[]","name":"assets","type":"string[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"destinationId","type":"uint256"}],"name":"nestMintTokenWithMultipleAssets","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061168d806100206000396000f3fe60806040526004361061008c5760003560e01c8063150b7a0214610091578063281654f1146100d25780632ba2749c146100f4578063635d5187146101075780636526ce0b1461011a57806374ce404f1461012d5780637c33145914610140578063a7ca55ae14610153578063d27904e114610166578063d88d6da214610179578063e7db89de14610199575b600080fd5b34801561009d57600080fd5b506100bc6100ac366004610fd1565b630a85bd0160e11b949350505050565b6040516100c991906110b0565b60405180910390f35b3480156100de57600080fd5b506100f26100ed36600461110d565b6101ac565b005b6100f26101023660046111ac565b6101c9565b6100f261011536600461124b565b610278565b6100f26101283660046112b2565b61033e565b6100f261013b366004611300565b610524565b6100f261014e36600461136f565b61079e565b6100f26101613660046113f9565b610964565b6100f2610174366004611441565b610bb4565b34801561018557600080fd5b506100f261019436600461110d565b610bd3565b6100f26101a736600461148b565b610d02565b836101b681610dbd565b6101c285858585610bd3565b5050505050565b866101d381610dbd565b8282146101f35760405163922a120f60e01b815260040160405180910390fd5b85821461021357604051630999f77960e01b815260040160405180910390fd5b60005b8281101561026d5761026589898984818110610234576102346114d7565b905060200281019061024691906114ed565b89898987818110610259576102596114d7565b90506020020135610ec6565b600101610216565b505050505050505050565b8361028281610dbd565b6000856001600160a01b03166340c10f19348560016040518463ffffffff1660e01b81526004016102b4929190611533565b60206040518083038185885af11580156102d2573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102f7919061154c565b905061030586828787610bd3565b856001600160a01b03166000805160206116388339815191528260405161032e91815260200190565b60405180910390a2505050505050565b8661034881610dbd565b8282146103685760405163922a120f60e01b815260040160405180910390fd5b60405163187fd8eb60e11b81526000906001600160a01b038a16906330ffb1d690610399908b908b90600401611565565b6020604051808303816000875af11580156103b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103dc919061154c565b905060005b838110156105185760008a6001600160a01b03166364e8f13d348a60018b8b88818110610410576104106114d7565b905060200201356040518563ffffffff1660e01b815260040161043593929190611594565b60206040518083038185885af1158015610453573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610478919061154c565b604051631c7bb46160e01b81529091506001600160a01b038c1690631c7bb461906104ac90849087906000906004016115b5565b600060405180830381600087803b1580156104c657600080fd5b505af11580156104da573d6000803e3d6000fd5b505050508a6001600160a01b03166000805160206116388339815191528260405161050791815260200190565b60405180910390a2506001016103e1565b50505050505050505050565b8461052e81610dbd565b6040516301ffc9a760e01b81526000906001600160a01b038816906301ffc9a790610564906391a6262f60e01b906004016110b0565b602060405180830381865afa158015610581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a591906115d4565b90506000811561062c576040516364e8f13d60e01b81526001600160a01b038916906364e8f13d9034906105e29089906001908a90600401611594565b60206040518083038185885af1158015610600573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610625919061154c565b90506106a3565b6040516340c10f1960e01b81526001600160a01b038916906340c10f1990349061065d903090600190600401611533565b60206040518083038185885af115801561067b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106a0919061154c565b90505b60005b868110156106df576106d789838a8a858181106106c5576106c56114d7565b905060200281019061019491906114ed565b6001016106a6565b508161076357604051630326051d60e11b81523060048201526001600160a01b038681166024830152604482018390526064820186905260a06084830152600060a483015289169063064c0a3a9060c401600060405180830381600087803b15801561074a57600080fd5b505af115801561075e573d6000803e3d6000fd5b505050505b876001600160a01b03166000805160206116388339815191528260405161078c91815260200190565b60405180910390a25050505050505050565b856107a881610dbd565b60405163187fd8eb60e11b81526000906001600160a01b038916906330ffb1d6906107d9908a908a90600401611565565b6020604051808303816000875af11580156107f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081c919061154c565b905060005b8381101561026d576000896001600160a01b03166340c10f193489898681811061084d5761084d6114d7565b905060200201602081019061086291906115fd565b60016040518463ffffffff1660e01b8152600401610881929190611533565b60206040518083038185885af115801561089f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108c4919061154c565b604051631c7bb46160e01b81529091506001600160a01b038b1690631c7bb461906108f890849087906000906004016115b5565b600060405180830381600087803b15801561091257600080fd5b505af1158015610926573d6000803e3d6000fd5b50505050896001600160a01b03166000805160206116388339815191528260405161095391815260200190565b60405180910390a250600101610821565b8361096e81610dbd565b6040516301ffc9a760e01b81526000906001600160a01b038716906301ffc9a7906109a4906391a6262f60e01b906004016110b0565b602060405180830381865afa1580156109c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e591906115d4565b905060008115610a6a576040516340c10f1960e01b81526001600160a01b038816906340c10f19903490610a20908890600190600401611533565b60206040518083038185885af1158015610a3e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a63919061154c565b9050610ae1565b6040516340c10f1960e01b81526001600160a01b038816906340c10f19903490610a9b903090600190600401611533565b60206040518083038185885af1158015610ab9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ade919061154c565b90505b60005b85811015610b0b57610b0388838989858181106106c5576106c56114d7565b600101610ae4565b5081610b7a57604051632142170760e11b81523060048201526001600160a01b038581166024830152604482018390528816906342842e0e90606401600060405180830381600087803b158015610b6157600080fd5b505af1158015610b75573d6000803e3d6000fd5b505050505b866001600160a01b031660008051602061163883398151915282604051610ba391815260200190565b60405180910390a250505050505050565b84610bbe81610dbd565b610bcb8686868686610ec6565b505050505050565b60405163187fd8eb60e11b81526000906001600160a01b038616906330ffb1d690610c049086908690600401611565565b6020604051808303816000875af1158015610c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c47919061154c565b604051631c7bb46160e01b81529091506001600160a01b03861690631c7bb46190610c7b90879085906000906004016115b5565b600060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b5050604080516001600160401b0385168152602081018890526001600160a01b03891693507f6ffce9e4d9433daeda4b29aa7959e75c335d504dd2acd31f390630cc6ee3d9b79250015b60405180910390a25050505050565b85610d0c81610dbd565b848214610d2c57604051630999f77960e01b815260040160405180910390fd5b828214610d4c5760405163adbaeed960e01b815260040160405180910390fd5b60005b82811015610db357610dab88888884818110610d6d57610d6d6114d7565b9050602002810190610d7f91906114ed565b888886818110610d9157610d916114d7565b9050602002016020810190610da691906115fd565b610efa565b600101610d4f565b5050505050505050565b336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e29919061161a565b6001600160a01b031614158015610ea55750604051631d0d35f560e01b81523360048201526001600160a01b03821690631d0d35f590602401602060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea391906115d4565b155b15610ec357604051633b95a46f60e11b815260040160405180910390fd5b50565b6000856001600160a01b03166364e8f13d34856001866040518563ffffffff1660e01b81526004016102b493929190611594565b6000846001600160a01b03166340c10f19348460016040518463ffffffff1660e01b8152600401610f2c929190611533565b60206040518083038185885af1158015610f4a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f6f919061154c565b9050610f7d85828686610bd3565b846001600160a01b031660008051602061163883398151915282604051610cf391815260200190565b6001600160a01b0381168114610ec357600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215610fe757600080fd5b8435610ff281610fa6565b9350602085013561100281610fa6565b92506040850135915060608501356001600160401b038082111561102557600080fd5b818701915087601f83011261103957600080fd5b81358181111561104b5761104b610fbb565b604051601f8201601f19908116603f0116810190838211818310171561107357611073610fbb565b816040528281528a602084870101111561108c57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6001600160e01b031991909116815260200190565b60008083601f8401126110d757600080fd5b5081356001600160401b038111156110ee57600080fd5b60208301915083602082850101111561110657600080fd5b9250929050565b6000806000806060858703121561112357600080fd5b843561112e81610fa6565b93506020850135925060408501356001600160401b0381111561115057600080fd5b61115c878288016110c5565b95989497509550505050565b60008083601f84011261117a57600080fd5b5081356001600160401b0381111561119157600080fd5b6020830191508360208260051b850101111561110657600080fd5b600080600080600080600060a0888a0312156111c757600080fd5b87356111d281610fa6565b965060208801356001600160401b03808211156111ee57600080fd5b6111fa8b838c01611168565b909850965060408a0135915061120f82610fa6565b9094506060890135908082111561122557600080fd5b506112328a828b01611168565b989b979a50959894979596608090950135949350505050565b6000806000806060858703121561126157600080fd5b843561126c81610fa6565b935060208501356001600160401b0381111561128757600080fd5b611293878288016110c5565b90945092505060408501356112a781610fa6565b939692955090935050565b600080600080600080600060a0888a0312156112cd57600080fd5b87356112d881610fa6565b965060208801356001600160401b03808211156112f457600080fd5b6111fa8b838c016110c5565b60008060008060006080868803121561131857600080fd5b853561132381610fa6565b945060208601356001600160401b0381111561133e57600080fd5b61134a88828901611168565b909550935050604086013561135e81610fa6565b949793965091946060013592915050565b6000806000806000806080878903121561138857600080fd5b863561139381610fa6565b955060208701356001600160401b03808211156113af57600080fd5b6113bb8a838b016110c5565b909750955060408901359150808211156113d457600080fd5b506113e189828a01611168565b979a9699509497949695606090950135949350505050565b6000806000806060858703121561140f57600080fd5b843561141a81610fa6565b935060208501356001600160401b0381111561143557600080fd5b61129387828801611168565b60008060008060006080868803121561145957600080fd5b853561146481610fa6565b945060208601356001600160401b0381111561147f57600080fd5b61134a888289016110c5565b600080600080600080608087890312156114a457600080fd5b86356114af81610fa6565b955060208701356001600160401b03808211156114cb57600080fd5b6113bb8a838b01611168565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261150457600080fd5b8301803591506001600160401b0382111561151e57600080fd5b60200191503681900382131561110657600080fd5b6001600160a01b03929092168252602082015260400190565b60006020828403121561155e57600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6001600160a01b039390931683526020830191909152604082015260600190565b9283526001600160401b03918216602084015216604082015260600190565b6000602082840312156115e657600080fd5b815180151581146115f657600080fd5b9392505050565b60006020828403121561160f57600080fd5b81356115f681610fa6565b60006020828403121561162c57600080fd5b81516115f681610fa656fe2877f6b051948c6a0599dd31fe41e7d7a3af74eb43eef81af44bcf17bf0b7a0da264697066735822122022cbb7ebfda261f414f1f452362bd6d8d6ab61735359e428c15eddae6a6e57ac64736f6c63430008120033

Deployed Bytecode

0x60806040526004361061008c5760003560e01c8063150b7a0214610091578063281654f1146100d25780632ba2749c146100f4578063635d5187146101075780636526ce0b1461011a57806374ce404f1461012d5780637c33145914610140578063a7ca55ae14610153578063d27904e114610166578063d88d6da214610179578063e7db89de14610199575b600080fd5b34801561009d57600080fd5b506100bc6100ac366004610fd1565b630a85bd0160e11b949350505050565b6040516100c991906110b0565b60405180910390f35b3480156100de57600080fd5b506100f26100ed36600461110d565b6101ac565b005b6100f26101023660046111ac565b6101c9565b6100f261011536600461124b565b610278565b6100f26101283660046112b2565b61033e565b6100f261013b366004611300565b610524565b6100f261014e36600461136f565b61079e565b6100f26101613660046113f9565b610964565b6100f2610174366004611441565b610bb4565b34801561018557600080fd5b506100f261019436600461110d565b610bd3565b6100f26101a736600461148b565b610d02565b836101b681610dbd565b6101c285858585610bd3565b5050505050565b866101d381610dbd565b8282146101f35760405163922a120f60e01b815260040160405180910390fd5b85821461021357604051630999f77960e01b815260040160405180910390fd5b60005b8281101561026d5761026589898984818110610234576102346114d7565b905060200281019061024691906114ed565b89898987818110610259576102596114d7565b90506020020135610ec6565b600101610216565b505050505050505050565b8361028281610dbd565b6000856001600160a01b03166340c10f19348560016040518463ffffffff1660e01b81526004016102b4929190611533565b60206040518083038185885af11580156102d2573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102f7919061154c565b905061030586828787610bd3565b856001600160a01b03166000805160206116388339815191528260405161032e91815260200190565b60405180910390a2505050505050565b8661034881610dbd565b8282146103685760405163922a120f60e01b815260040160405180910390fd5b60405163187fd8eb60e11b81526000906001600160a01b038a16906330ffb1d690610399908b908b90600401611565565b6020604051808303816000875af11580156103b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103dc919061154c565b905060005b838110156105185760008a6001600160a01b03166364e8f13d348a60018b8b88818110610410576104106114d7565b905060200201356040518563ffffffff1660e01b815260040161043593929190611594565b60206040518083038185885af1158015610453573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610478919061154c565b604051631c7bb46160e01b81529091506001600160a01b038c1690631c7bb461906104ac90849087906000906004016115b5565b600060405180830381600087803b1580156104c657600080fd5b505af11580156104da573d6000803e3d6000fd5b505050508a6001600160a01b03166000805160206116388339815191528260405161050791815260200190565b60405180910390a2506001016103e1565b50505050505050505050565b8461052e81610dbd565b6040516301ffc9a760e01b81526000906001600160a01b038816906301ffc9a790610564906391a6262f60e01b906004016110b0565b602060405180830381865afa158015610581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a591906115d4565b90506000811561062c576040516364e8f13d60e01b81526001600160a01b038916906364e8f13d9034906105e29089906001908a90600401611594565b60206040518083038185885af1158015610600573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610625919061154c565b90506106a3565b6040516340c10f1960e01b81526001600160a01b038916906340c10f1990349061065d903090600190600401611533565b60206040518083038185885af115801561067b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106a0919061154c565b90505b60005b868110156106df576106d789838a8a858181106106c5576106c56114d7565b905060200281019061019491906114ed565b6001016106a6565b508161076357604051630326051d60e11b81523060048201526001600160a01b038681166024830152604482018390526064820186905260a06084830152600060a483015289169063064c0a3a9060c401600060405180830381600087803b15801561074a57600080fd5b505af115801561075e573d6000803e3d6000fd5b505050505b876001600160a01b03166000805160206116388339815191528260405161078c91815260200190565b60405180910390a25050505050505050565b856107a881610dbd565b60405163187fd8eb60e11b81526000906001600160a01b038916906330ffb1d6906107d9908a908a90600401611565565b6020604051808303816000875af11580156107f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081c919061154c565b905060005b8381101561026d576000896001600160a01b03166340c10f193489898681811061084d5761084d6114d7565b905060200201602081019061086291906115fd565b60016040518463ffffffff1660e01b8152600401610881929190611533565b60206040518083038185885af115801561089f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108c4919061154c565b604051631c7bb46160e01b81529091506001600160a01b038b1690631c7bb461906108f890849087906000906004016115b5565b600060405180830381600087803b15801561091257600080fd5b505af1158015610926573d6000803e3d6000fd5b50505050896001600160a01b03166000805160206116388339815191528260405161095391815260200190565b60405180910390a250600101610821565b8361096e81610dbd565b6040516301ffc9a760e01b81526000906001600160a01b038716906301ffc9a7906109a4906391a6262f60e01b906004016110b0565b602060405180830381865afa1580156109c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e591906115d4565b905060008115610a6a576040516340c10f1960e01b81526001600160a01b038816906340c10f19903490610a20908890600190600401611533565b60206040518083038185885af1158015610a3e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a63919061154c565b9050610ae1565b6040516340c10f1960e01b81526001600160a01b038816906340c10f19903490610a9b903090600190600401611533565b60206040518083038185885af1158015610ab9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ade919061154c565b90505b60005b85811015610b0b57610b0388838989858181106106c5576106c56114d7565b600101610ae4565b5081610b7a57604051632142170760e11b81523060048201526001600160a01b038581166024830152604482018390528816906342842e0e90606401600060405180830381600087803b158015610b6157600080fd5b505af1158015610b75573d6000803e3d6000fd5b505050505b866001600160a01b031660008051602061163883398151915282604051610ba391815260200190565b60405180910390a250505050505050565b84610bbe81610dbd565b610bcb8686868686610ec6565b505050505050565b60405163187fd8eb60e11b81526000906001600160a01b038616906330ffb1d690610c049086908690600401611565565b6020604051808303816000875af1158015610c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c47919061154c565b604051631c7bb46160e01b81529091506001600160a01b03861690631c7bb46190610c7b90879085906000906004016115b5565b600060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b5050604080516001600160401b0385168152602081018890526001600160a01b03891693507f6ffce9e4d9433daeda4b29aa7959e75c335d504dd2acd31f390630cc6ee3d9b79250015b60405180910390a25050505050565b85610d0c81610dbd565b848214610d2c57604051630999f77960e01b815260040160405180910390fd5b828214610d4c5760405163adbaeed960e01b815260040160405180910390fd5b60005b82811015610db357610dab88888884818110610d6d57610d6d6114d7565b9050602002810190610d7f91906114ed565b888886818110610d9157610d916114d7565b9050602002016020810190610da691906115fd565b610efa565b600101610d4f565b5050505050505050565b336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e29919061161a565b6001600160a01b031614158015610ea55750604051631d0d35f560e01b81523360048201526001600160a01b03821690631d0d35f590602401602060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea391906115d4565b155b15610ec357604051633b95a46f60e11b815260040160405180910390fd5b50565b6000856001600160a01b03166364e8f13d34856001866040518563ffffffff1660e01b81526004016102b493929190611594565b6000846001600160a01b03166340c10f19348460016040518463ffffffff1660e01b8152600401610f2c929190611533565b60206040518083038185885af1158015610f4a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f6f919061154c565b9050610f7d85828686610bd3565b846001600160a01b031660008051602061163883398151915282604051610cf391815260200190565b6001600160a01b0381168114610ec357600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215610fe757600080fd5b8435610ff281610fa6565b9350602085013561100281610fa6565b92506040850135915060608501356001600160401b038082111561102557600080fd5b818701915087601f83011261103957600080fd5b81358181111561104b5761104b610fbb565b604051601f8201601f19908116603f0116810190838211818310171561107357611073610fbb565b816040528281528a602084870101111561108c57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6001600160e01b031991909116815260200190565b60008083601f8401126110d757600080fd5b5081356001600160401b038111156110ee57600080fd5b60208301915083602082850101111561110657600080fd5b9250929050565b6000806000806060858703121561112357600080fd5b843561112e81610fa6565b93506020850135925060408501356001600160401b0381111561115057600080fd5b61115c878288016110c5565b95989497509550505050565b60008083601f84011261117a57600080fd5b5081356001600160401b0381111561119157600080fd5b6020830191508360208260051b850101111561110657600080fd5b600080600080600080600060a0888a0312156111c757600080fd5b87356111d281610fa6565b965060208801356001600160401b03808211156111ee57600080fd5b6111fa8b838c01611168565b909850965060408a0135915061120f82610fa6565b9094506060890135908082111561122557600080fd5b506112328a828b01611168565b989b979a50959894979596608090950135949350505050565b6000806000806060858703121561126157600080fd5b843561126c81610fa6565b935060208501356001600160401b0381111561128757600080fd5b611293878288016110c5565b90945092505060408501356112a781610fa6565b939692955090935050565b600080600080600080600060a0888a0312156112cd57600080fd5b87356112d881610fa6565b965060208801356001600160401b03808211156112f457600080fd5b6111fa8b838c016110c5565b60008060008060006080868803121561131857600080fd5b853561132381610fa6565b945060208601356001600160401b0381111561133e57600080fd5b61134a88828901611168565b909550935050604086013561135e81610fa6565b949793965091946060013592915050565b6000806000806000806080878903121561138857600080fd5b863561139381610fa6565b955060208701356001600160401b03808211156113af57600080fd5b6113bb8a838b016110c5565b909750955060408901359150808211156113d457600080fd5b506113e189828a01611168565b979a9699509497949695606090950135949350505050565b6000806000806060858703121561140f57600080fd5b843561141a81610fa6565b935060208501356001600160401b0381111561143557600080fd5b61129387828801611168565b60008060008060006080868803121561145957600080fd5b853561146481610fa6565b945060208601356001600160401b0381111561147f57600080fd5b61134a888289016110c5565b600080600080600080608087890312156114a457600080fd5b86356114af81610fa6565b955060208701356001600160401b03808211156114cb57600080fd5b6113bb8a838b01611168565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261150457600080fd5b8301803591506001600160401b0382111561151e57600080fd5b60200191503681900382131561110657600080fd5b6001600160a01b03929092168252602082015260400190565b60006020828403121561155e57600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6001600160a01b039390931683526020830191909152604082015260600190565b9283526001600160401b03918216602084015216604082015260600190565b6000602082840312156115e657600080fd5b815180151581146115f657600080fd5b9392505050565b60006020828403121561160f57600080fd5b81356115f681610fa6565b60006020828403121561162c57600080fd5b81516115f681610fa656fe2877f6b051948c6a0599dd31fe41e7d7a3af74eb43eef81af44bcf17bf0b7a0da264697066735822122022cbb7ebfda261f414f1f452362bd6d8d6ab61735359e428c15eddae6a6e57ac64736f6c63430008120033

Block Transaction Gas Used Reward
view all blocks collator

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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.