ETH Price: $2,505.55 (+0.25%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buy193212032024-02-27 20:14:11466 days ago1709064851IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0052504163.45144584
Buy190326362024-01-18 8:43:47507 days ago1705567427IN
0x8a5149B1...bf83d79FB
0.14847 ETH0.0027911327.95410657
Buy190070762024-01-14 19:00:47510 days ago1705258847IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0018692522.59001313
Buy189932992024-01-12 20:47:47512 days ago1705092467IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0020046224.22601376
Buy189399242024-01-05 8:34:23520 days ago1704443663IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0011726814.17198853
Buy189398222024-01-05 8:13:47520 days ago1704442427IN
0x8a5149B1...bf83d79FB
0.1335 ETH0.0004141612.39980822
Buy189212952024-01-02 17:50:59522 days ago1704217859IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0019543623.61857022
Buy188845812023-12-28 14:04:11527 days ago1703772251IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0027620733.37978798
Buy188845742023-12-28 14:02:47527 days ago1703772167IN
0x8a5149B1...bf83d79FB
0 ETH0.0011708135.05328267
Buy188187942023-12-19 8:24:23537 days ago1702974263IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.0045006145.07508637
Buy187580562023-12-10 20:00:47545 days ago1702238447IN
0x8a5149B1...bf83d79FB
0.118776 ETH0.0030220636.52176019
Buy186913932023-12-01 11:53:59555 days ago1701431639IN
0x8a5149B1...bf83d79FB
0.118776 ETH0.0025378730.67030724
Buy186911572023-12-01 11:06:23555 days ago1701428783IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.0023601628.52266038
Buy185835002023-11-16 9:17:59570 days ago1700126279IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.0028349128.39254303
Buy184832522023-11-02 8:35:47584 days ago1698914147IN
0x8a5149B1...bf83d79FB
0.133623 ETH0.0014413717.41910787
Buy183571392023-10-15 17:02:35601 days ago1697389355IN
0x8a5149B1...bf83d79FB
0.059388 ETH0.000528336.38492339
Buy183051472023-10-08 10:23:59609 days ago1696760639IN
0x8a5149B1...bf83d79FB
0.044541 ETH0.000485255.86434359
Buy181998262023-09-23 16:52:35623 days ago1695487955IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000715167.16262301
Buy181042862023-09-10 6:48:23637 days ago1694328503IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000736728.9033517
Buy181042842023-09-10 6:47:59637 days ago1694328479IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000814789.84664986
Buy181042842023-09-10 6:47:59637 days ago1694328479IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000814789.84664986
Buy181042802023-09-10 6:47:11637 days ago1694328431IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000817039.87394782
Buy181042792023-09-10 6:46:59637 days ago1694328419IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000744648.99900202
Buy181042772023-09-10 6:46:35637 days ago1694328395IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000784489.48048211
Buy181042762023-09-10 6:46:23637 days ago1694328383IN
0x8a5149B1...bf83d79FB
0.014847 ETH0.000786619.50628616
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer193212032024-02-27 20:14:11466 days ago1709064851
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer190326362024-01-18 8:43:47507 days ago1705567427
0x8a5149B1...bf83d79FB
0.14847 ETH
Transfer190070762024-01-14 19:00:47510 days ago1705258847
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer189932992024-01-12 20:47:47512 days ago1705092467
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer189399242024-01-05 8:34:23520 days ago1704443663
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer189212952024-01-02 17:50:59522 days ago1704217859
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer188845812023-12-28 14:04:11527 days ago1703772251
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer188187942023-12-19 8:24:23537 days ago1702974263
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer187580562023-12-10 20:00:47545 days ago1702238447
0x8a5149B1...bf83d79FB
0.118776 ETH
Transfer186913932023-12-01 11:53:59555 days ago1701431639
0x8a5149B1...bf83d79FB
0.118776 ETH
Transfer186911572023-12-01 11:06:23555 days ago1701428783
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer185835002023-11-16 9:17:59570 days ago1700126279
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer184832522023-11-02 8:35:47584 days ago1698914147
0x8a5149B1...bf83d79FB
0.133623 ETH
Transfer183571392023-10-15 17:02:35601 days ago1697389355
0x8a5149B1...bf83d79FB
0.059388 ETH
Transfer183051472023-10-08 10:23:59609 days ago1696760639
0x8a5149B1...bf83d79FB
0.044541 ETH
Transfer181998262023-09-23 16:52:35623 days ago1695487955
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042862023-09-10 6:48:23637 days ago1694328503
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042842023-09-10 6:47:59637 days ago1694328479
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042842023-09-10 6:47:59637 days ago1694328479
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042802023-09-10 6:47:11637 days ago1694328431
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042792023-09-10 6:46:59637 days ago1694328419
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042772023-09-10 6:46:35637 days ago1694328395
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042762023-09-10 6:46:23637 days ago1694328383
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042662023-09-10 6:44:23637 days ago1694328263
0x8a5149B1...bf83d79FB
0.014847 ETH
Transfer181042472023-09-10 6:40:35637 days ago1694328035
0x8a5149B1...bf83d79FB
0.014847 ETH
View All Internal Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
FERC1155Seller

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

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

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Holder.sol)

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

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

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

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

// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

interface IWETH {

    function deposit() external payable;

    function withdraw(uint) external;

    function approve(address, uint) external returns(bool);

    function transfer(address, uint) external returns(bool);

    function transferFrom(address, address, uint) external returns(bool);

    function balanceOf(address) external view returns(uint);

}

interface ISettings {
    function feeReceiver() external view returns(address);
}

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

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

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

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

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

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

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

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

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

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

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

interface IFERC1155 is IERC1155 {
  function burn(
    address,
    uint256,
    uint256
  ) external;

  function totalSupply(uint256) external view returns (uint256);
}

// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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

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

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

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

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

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

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

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

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

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

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

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

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

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

// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

contract Vault is ERC721Holder, ERC1155Holder {
  using EnumerableSet for EnumerableSet.UintSet;
  string public version = "2.0";

  /// @notice weth address
  address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

  /// -------------------------------------
  /// -------- AUCTION INFORMATION --------
  /// -------------------------------------

  /// @notice the unix timestamp end time of the token auction
  uint256 public auctionEnd;
  /// @notice the length of auctions
  uint256 public constant LENGTH = 2 days;
  /// @notice the current price of the token during an auction
  uint256 public livePrice;
  /// @notice the current user winning the token auction
  address public winning;

  enum State {
    inactive,
    live,
    ended,
    redeemed
  }
  State public auctionState;

  /// -----------------------------------
  /// -------- VAULT INFORMATION --------
  /// -----------------------------------

  bool initialized = false;
  /// @notice the governance contract which gets paid in ETH
  address public immutable settings;
  address public immutable curator;
  address public immutable fractions;
  uint256 public immutable fractionsID;
  address public immutable underlying;
  uint256 public immutable underlyingID;

  // set of prices with over 1% voting for it
  EnumerableSet.UintSet prices;
  // all prices and the number voting for them
  mapping(uint256 => uint256) public priceToCount;
  // each users price
  mapping(address => uint256) public userPrices;

  /// ------------------------
  /// -------- EVENTS --------
  /// ------------------------

  event Redeem(address indexed redeemer);
  event Bid(address indexed buyer, uint256 price);
  event Won(address indexed buyer, uint256 price);
  event Start(address indexed buyer, uint256 price);
  event Cash(address indexed owner, uint256 shares);
  event PriceUpdate(address indexed user, uint256 price);
  event WithdrawETH(address indexed to);
  event WithdrawERC20(address indexed token, address indexed to);
  event WithdrawERC721(
    address indexed token,
    uint256 tokenId,
    address indexed to
  );
  event WithdrawERC1155(
    address indexed token,
    uint256 tokenId,
    uint256 amount,
    address indexed to
  );

  constructor(
    address _fractions,
    uint256 _fractionsID,
    address _underlying,
    uint256 _underlyingID,
    address _curator
  ) {
    settings = msg.sender;
    fractions = _fractions;
    fractionsID = _fractionsID;
    underlying = _underlying;
    underlyingID = _underlyingID;
    curator = _curator;
  }

  function token() external view returns (address) {
    return underlying;
  }

  function id() external view returns (uint256) {
    return underlyingID;
  }

  function isLivePrice(uint256 _price) external view returns (bool) {
    return prices.contains(_price);
  }

  function updateUserPrice(uint256 _new) external {
    uint256 balance = IFERC1155(fractions).balanceOf(msg.sender, fractionsID);

    _addToPrice(balance, _new);
    _removeFromPrice(balance, userPrices[msg.sender]);

    userPrices[msg.sender] = _new;

    emit PriceUpdate(msg.sender, _new);
  }

  function onTransfer(
    address _from,
    address _to,
    uint256 _amount
  ) external {
    require(msg.sender == fractions, "not allowed");

    // we are burning
    if (_to == address(0)) {
      _removeFromPrice(_amount, userPrices[_from]);
      // we are minting
    } else if (_from == address(0)) {
      _addToPrice(_amount, userPrices[_to]);
    } else {
      _removeFromPrice(_amount, userPrices[_from]);
      _addToPrice(_amount, userPrices[_to]);
    }
  }

  // add to a price count
  // add price to reserve calc if 1% are voting for it
  function _addToPrice(uint256 _amount, uint256 _price) internal {
    priceToCount[_price] += _amount;
    if (
      priceToCount[_price] * 100 >=
      IFERC1155(fractions).totalSupply(fractionsID) &&
      !prices.contains(_price)
    ) {
      prices.add(_price);
    }
  }

  // remove a price count
  // remove price from reserve calc if less than 1% are voting for it
  function _removeFromPrice(uint256 _amount, uint256 _price) internal {
    priceToCount[_price] -= _amount;
    if (
      priceToCount[_price] * 100 <
      IFERC1155(fractions).totalSupply(fractionsID) &&
      prices.contains(_price)
    ) {
      prices.remove(_price);
    }
  }

  function swap(
    uint256[] memory array,
    uint256 i,
    uint256 j
  ) internal pure {
    (array[i], array[j]) = (array[j], array[i]);
  }

  function sort(
    uint256[] memory array,
    uint256 begin,
    uint256 last
  ) internal pure {
    if (begin < last) {
      uint256 j = begin;
      uint256 pivot = array[j];
      for (uint256 i = begin + 1; i < last; ++i) {
        if (array[i] < pivot) {
          swap(array, i, ++j);
        }
      }
      swap(array, begin, j);
      sort(array, begin, j);
      sort(array, j + 1, last);
    }
  }

  function reservePrice()
    public
    view
    returns (uint256 voting, uint256 reserve)
  {
    uint256[] memory tempPrices = prices.values();
    sort(tempPrices, 0, tempPrices.length);
    voting = 0;
    for (uint256 x = 0; x < tempPrices.length; x++) {
      if (tempPrices[x] != 0) {
        voting += priceToCount[tempPrices[x]];
      }
    }

    uint256 count = 0;
    for (uint256 y = 0; y < tempPrices.length; y++) {
      if (tempPrices[y] != 0) {
        count += priceToCount[tempPrices[y]];
      }
      if (count * 2 >= voting) {
        reserve = tempPrices[y];
        break;
      }
    }
  }

  /// @notice kick off an auction. Must send reservePrice in ETH
  function start() external payable {
    require(auctionState == State.inactive, "start:no auction starts");
    (uint256 voting, uint256 reserve) = reservePrice();
    require(msg.value >= reserve, "start:too low bid");
    require(
      voting * 2 >= IFERC1155(fractions).totalSupply(fractionsID),
      "start:not enough voters"
    );

    auctionEnd = block.timestamp + LENGTH;
    auctionState = State.live;
    livePrice = msg.value;
    winning = msg.sender;
    emit Start(msg.sender, msg.value);
  }

  /// @notice an external function to bid on purchasing the vaults NFT. The msg.value is the bid amount
  function bid() external payable {
    require(auctionState == State.live, "bid:auction is not live");
    require(msg.value * 100 >= livePrice * 105, "bid:too low bid");
    require(block.timestamp < auctionEnd, "bid:auction ended");

    if (auctionEnd - block.timestamp <= 15 minutes) {
      auctionEnd += 15 minutes;
    }
    _sendETHOrWETH(winning, livePrice);
    livePrice = msg.value;
    winning = msg.sender;
    emit Bid(msg.sender, msg.value);
  }

  /// @notice an external function to end an auction after the timer has run out
  function end() external {
    require(auctionState == State.live, "end:vault has already closed");
    require(block.timestamp >= auctionEnd, "end:auction live");

    IERC721(underlying).transferFrom(address(this), winning, underlyingID);
    auctionState = State.ended;

    if (ISettings(settings).feeReceiver() != address(0)) {
      _sendETHOrWETH(ISettings(settings).feeReceiver(), livePrice / 40);
    }

    emit Won(winning, livePrice);
  }

  /// @notice an external function to burn all ERC20 tokens to receive the ERC721 token
  function redeem() external {
    require(auctionState == State.inactive, "redeem:no redeeming");

    IFERC1155(fractions).burn(
      msg.sender,
      fractionsID,
      IFERC1155(fractions).totalSupply(fractionsID)
    );
    IERC721(underlying).transferFrom(address(this), msg.sender, underlyingID);

    auctionState = State.redeemed;
    winning = msg.sender;
    emit Redeem(msg.sender);
  }

  /// @notice an external function to burn ERC20 tokens to receive ETH from ERC721 token purchase
  function cash() external {
    require(auctionState == State.ended, "cash:vault not closed yet");
    uint256 bal = IFERC1155(fractions).balanceOf(msg.sender, fractionsID);
    require(bal > 0, "cash:no tokens to cash out");
    uint256 share = (bal * address(this).balance) /
      IFERC1155(fractions).totalSupply(fractionsID);

    IFERC1155(fractions).burn(msg.sender, fractionsID, bal);
    _sendETHOrWETH(msg.sender, share);
    emit Cash(msg.sender, share);
  }

  function _sendETHOrWETH(address to, uint256 value) internal {
    if (!_attemptETHTransfer(to, value)) {
      IWETH(weth).deposit{ value: value }();
      IWETH(weth).transfer(to, value);
    }
  }

  function _attemptETHTransfer(address to, uint256 value)
    internal
    returns (bool)
  {
    (bool success, ) = to.call{ value: value, gas: 30000 }("");
    return success;
  }

  function withdrawERC721(address _token, uint256 _tokenId) external {
    require(
      auctionState == State.ended || auctionState == State.redeemed,
      "vault not closed yet"
    );
    require(msg.sender == winning, "withdraw:not allowed");
    IERC721(_token).transferFrom(address(this), msg.sender, _tokenId);
    emit WithdrawERC721(_token, _tokenId, msg.sender);
  }

  function withdrawERC1155(
    address _token,
    uint256 _tokenId,
    uint256 _amount
  ) external {
    require(
      auctionState == State.ended || auctionState == State.redeemed,
      "vault not closed yet"
    );
    require(msg.sender == winning, "withdraw:not allowed");
    IERC1155(_token).safeTransferFrom(
      address(this),
      msg.sender,
      _tokenId,
      _amount,
      "0"
    );
    emit WithdrawERC1155(_token, _tokenId, _amount, msg.sender);
  }

  function withdrawETH() external {
    require(auctionState == State.redeemed, "vault not closed yet");
    require(msg.sender == winning, "withdraw:not allowed");
    payable(msg.sender).transfer(address(this).balance);
    emit WithdrawETH(msg.sender);
  }

  function withdrawERC20(address _token) external {
    require(
      auctionState == State.ended || auctionState == State.redeemed,
      "vault not closed yet"
    );
    require(msg.sender == winning, "withdraw:not allowed");
    IERC20(_token).transfer(
      msg.sender,
      IERC20(_token).balanceOf(address(this))
    );
    emit WithdrawERC20(_token, msg.sender);
  }

  receive() external payable {}
}

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

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

// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

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

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

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

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

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

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

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

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

        return batchBalances;
    }

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

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

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

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

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

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

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

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

        address operator = _msgSender();

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

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

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

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

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

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

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

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

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

        address operator = _msgSender();

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

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

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

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

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

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

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

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

        return array;
    }
}

// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

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

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

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

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

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

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

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

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

interface IVault {
  function onTransfer(
    address,
    address,
    uint256
  ) external;
}

contract FERC1155 is ERC1155, Ownable {
  using Strings for uint256;

  string private baseURI;
  mapping(address => bool) public minters;
  mapping(uint256 => uint256) private _totalSupply;

  uint256 public count = 0;

  mapping(uint256 => address) public idToVault;

  constructor() ERC1155("") {}

  modifier onlyMinter() {
    require(minters[msg.sender]);
    _;
  }

  /// Owner Functions ///

  function addMinter(address minter) external onlyOwner {
    minters[minter] = true;
  }

  function removeMinter(address minter) external onlyOwner {
    minters[minter] = false;
  }

  function updateBaseUri(string calldata base) external onlyOwner {
    baseURI = base;
  }

  /// Minter Function ///

  function mint(address vault, uint256 amount)
    external
    onlyMinter
    returns (uint256)
  {
    count++;
    idToVault[count] = vault;
    _mint(msg.sender, count, amount, "0");
    _totalSupply[count] = amount;
    return count;
  }

  function mint(uint256 amount, uint256 id) external onlyMinter {
    require(id <= count, "doesn't exist");
    _mint(msg.sender, id, amount, "0");
    _totalSupply[count] += amount;
  }

  function burn(
    address account,
    uint256 id,
    uint256 value
  ) public virtual {
    require(
      account == _msgSender() || isApprovedForAll(account, _msgSender()),
      "ERC1155: caller is not owner nor approved"
    );
    _burn(account, id, value);
    _totalSupply[id] -= value;
  }

  /// Public Functions ///

  function totalSupply(uint256 id) public view virtual returns (uint256) {
    return _totalSupply[id];
  }

  function uri(uint256 id) public view override returns (string memory) {
    return
      bytes(baseURI).length > 0
        ? string(abi.encodePacked(baseURI, id.toString()))
        : baseURI;
  }

  function _beforeTokenTransfer(
    address operator,
    address from,
    address to,
    uint256[] memory ids,
    uint256[] memory amounts,
    bytes memory data
  ) internal virtual override {
    require(ids.length == 1, "too long");
    super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

    IVault(idToVault[ids[0]]).onTransfer(from, to, amounts[0]);
  }
}

contract FERC1155Seller is ERC1155Holder, ReentrancyGuard {
    FERC1155 public immutable fnft;

    struct List {
        uint256 price;
        uint256 start;
        uint256 end;
    }
    mapping(uint256 => List) public fIdToListing;

    event Listing(
        address indexed fnft,
        uint256 indexed fId,
        address indexed seller,
        uint256 amount,
        uint256 start,
        uint256 end,
        uint256 price
    );
    event Purchase(
        address indexed buyer,
        address indexed fnft,
        uint256 indexed fId,
        uint256 amount,
        uint256 price
    );
    event End(address indexed fnft, uint256 indexed fId);
    event UpdatePrice(address indexed fnft, uint256 indexed fId, uint256 price);

    constructor(address _fractions) {
        fnft = FERC1155(_fractions);
    }

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    function getCurator(uint256 fId) internal returns (address) {
        return Vault(payable(fnft.idToVault(fId))).curator();
    }

    function getPrice(uint256 fId) public view returns (uint256) {
        return fIdToListing[fId].price;
    }

    function getStartEnd(uint256 fId) public view returns (uint256, uint256) {
        return (fIdToListing[fId].start, fIdToListing[fId].end);
    }

    modifier onlyCurator(uint256 fId) {
        require(msg.sender == getCurator(fId));
        _;
    }
    modifier whileActive(uint256 fId) {
        (uint256 start, uint256 end) = getStartEnd(fId);
        require(block.timestamp > start && block.timestamp < end, "inactive");
        _;
    }

    function list(
        uint256 _fId,
        uint256 _price,
        uint256 _amount,
        uint256 _start,
        uint256 _end
    ) public onlyCurator(_fId) {
        require(fnft.balanceOf(address(this), _fId) == 0, "already listed");
        fIdToListing[_fId].price = _price;
        fIdToListing[_fId].start = _start;
        fIdToListing[_fId].end = _end;
        fnft.safeTransferFrom(msg.sender, address(this), _fId, _amount, "0");
        emit Listing(
            address(fnft),
            _fId,
            msg.sender,
            _amount,
            _start,
            _end,
            _price
        );
    }

    function buy(uint256 _fId, uint256 _amount)
        external
        payable
        nonReentrant
        whileActive(_fId)
    {
        uint256 price = fIdToListing[_fId].price;
        require(msg.value == price * _amount, "wrong price");
        /* safeTransferETH(getCurator(_fId), msg.value); */
        payable(getCurator(_fId)).transfer(msg.value);

        fnft.safeTransferFrom(address(this), msg.sender, _fId, _amount, "0");
        emit Purchase(msg.sender, address(fnft), _fId, _amount, price);
        if (fnft.balanceOf(address(this), _fId) == 0)
            emit End(address(fnft), _fId);
    }

    function end(uint256 _fId) external onlyCurator(_fId) {
        uint256 bal = fnft.balanceOf(address(this), _fId);
        fnft.safeTransferFrom(address(this), msg.sender, _fId, bal, "0");
        emit End(address(fnft), _fId);
    }

    function update(uint256 _fId, uint256 _price) external onlyCurator(_fId) {
        fIdToListing[_fId].price = _price;
        emit UpdatePrice(address(fnft), _fId, _price);
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_fractions","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fnft","type":"address"},{"indexed":true,"internalType":"uint256","name":"fId","type":"uint256"}],"name":"End","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fnft","type":"address"},{"indexed":true,"internalType":"uint256","name":"fId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Listing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"fnft","type":"address"},{"indexed":true,"internalType":"uint256","name":"fId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Purchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fnft","type":"address"},{"indexed":true,"internalType":"uint256","name":"fId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"UpdatePrice","type":"event"},{"inputs":[{"internalType":"uint256","name":"_fId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fId","type":"uint256"}],"name":"end","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fIdToListing","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fnft","outputs":[{"internalType":"contract FERC1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fId","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fId","type":"uint256"}],"name":"getStartEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"list","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b5060405161105e38038061105e83398101604081905261002f91610045565b60016000556001600160a01b0316608052610075565b60006020828403121561005757600080fd5b81516001600160a01b038116811461006e57600080fd5b9392505050565b608051610f7a6100e4600039600081816102ae01528181610364015281816103f00152818161046b015281816104ff0152818161059e0152818161068901528181610717015281816108db01528181610961015281816109cb01528181610a500152610abe0152610f7a6000f3fe60806040526004361061009c5760003560e01c80633ac30e4b116100645780633ac30e4b146101bd578063bc197c81146101dd578063d6febde814610222578063e757223014610235578063f23a6e6114610270578063fb81a8b51461029c57600080fd5b806301ffc9a7146100a15780630ad24528146100d65780630cecb026146100f85780630f5ea1b51461014e5780632fb565e81461019d575b600080fd5b3480156100ad57600080fd5b506100c16100bc366004610b92565b6102e8565b60405190151581526020015b60405180910390f35b3480156100e257600080fd5b506100f66100f1366004610bc3565b61031f565b005b34801561010457600080fd5b50610133610113366004610bc3565b600160208190526000918252604090912080549181015460029091015483565b604080519384526020840192909252908201526060016100cd565b34801561015a57600080fd5b50610188610169366004610bc3565b6000908152600160208190526040909120908101546002909101549091565b604080519283526020830191909152016100cd565b3480156101a957600080fd5b506100f66101b8366004610bdc565b6104b8565b3480156101c957600080fd5b506100f66101d8366004610bfe565b61055c565b3480156101e957600080fd5b506102096101f8366004610d88565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016100cd565b6100f6610230366004610bdc565b610775565b34801561024157600080fd5b50610262610250366004610bc3565b60009081526001602052604090205490565b6040519081526020016100cd565b34801561027c57600080fd5b5061020961028b366004610e36565b63f23a6e6160e01b95945050505050565b3480156102a857600080fd5b506102d07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100cd565b60006001600160e01b03198216630271189760e51b148061031957506301ffc9a760e01b6001600160e01b03198316145b92915050565b8061032981610aa5565b6001600160a01b0316336001600160a01b03161461034657600080fd5b604051627eeac760e11b8152306004820152602481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa1580156103b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d69190610e9f565b604051637921219560e11b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a9061042b903090339088908790600401610eb8565b600060405180830381600087803b15801561044557600080fd5b505af1158015610459573d6000803e3d6000fd5b50506040518592506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691507f7d7570b046e5ead3a4f3fbc9fa2445113625a1e79823776146316bafed6b8cc590600090a3505050565b816104c281610aa5565b6001600160a01b0316336001600160a01b0316146104df57600080fd5b600083815260016020526040908190208390555183906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907f7c3bda8adcb9df1edd0059da351d966538bcc99f067c0770872170ac97fb68879061054f9086815260200190565b60405180910390a3505050565b8461056681610aa5565b6001600160a01b0316336001600160a01b03161461058357600080fd5b604051627eeac760e11b8152306004820152602481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa1580156105ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106109190610e9f565b156106535760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b1a5cdd195960921b60448201526064015b60405180910390fd5b60008681526001602081905260409182902087815590810185905560020183905551637921219560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a906106c490339030908b908a90600401610eb8565b600060405180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b50506040805187815260208101879052908101859052606081018890523392508891507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316907ff842c35eb56407b011a697320581ecc26a6b71a4ef12fd665bd16790b42170df9060800160405180910390a4505050505050565b600260005414156107c85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161064a565b600260008181558381526001602081905260408220908101549201548492915081421180156107f657508042105b61082d5760405162461bcd60e51b8152602060048201526008602482015267696e61637469766560c01b604482015260640161064a565b6000858152600160205260409020546108468582610efa565b34146108825760405162461bcd60e51b815260206004820152600b60248201526a77726f6e6720707269636560a81b604482015260640161064a565b61088b86610aa5565b6001600160a01b03166108fc349081150290604051600060405180830381858888f193505050501580156108c3573d6000803e3d6000fd5b50604051637921219560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a9061091690309033908b908b90600401610eb8565b600060405180830381600087803b15801561093057600080fd5b505af1158015610944573d6000803e3d6000fd5b505060408051888152602081018590528993506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925033917f8f7a55179307cea51948432d653dbd53a23fedc388bcb3e04e311f8220d87864910160405180910390a4604051627eeac760e11b8152306004820152602481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062fdd58e90604401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190610e9f565b610a985760405186906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907f7d7570b046e5ead3a4f3fbc9fa2445113625a1e79823776146316bafed6b8cc590600090a35b5050600160005550505050565b604051633d4f6d6160e21b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f53db58490602401602060405180830381865afa158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b319190610f27565b6001600160a01b031663e66f53b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610f27565b600060208284031215610ba457600080fd5b81356001600160e01b031981168114610bbc57600080fd5b9392505050565b600060208284031215610bd557600080fd5b5035919050565b60008060408385031215610bef57600080fd5b50508035926020909101359150565b600080600080600060a08688031215610c1657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6001600160a01b0381168114610c4e57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610c9057610c90610c51565b604052919050565b600082601f830112610ca957600080fd5b8135602067ffffffffffffffff821115610cc557610cc5610c51565b8160051b610cd4828201610c67565b9283528481018201928281019087851115610cee57600080fd5b83870192505b84831015610d0d57823582529183019190830190610cf4565b979650505050505050565b600082601f830112610d2957600080fd5b813567ffffffffffffffff811115610d4357610d43610c51565b610d56601f8201601f1916602001610c67565b818152846020838601011115610d6b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215610da057600080fd5b8535610dab81610c39565b94506020860135610dbb81610c39565b9350604086013567ffffffffffffffff80821115610dd857600080fd5b610de489838a01610c98565b94506060880135915080821115610dfa57600080fd5b610e0689838a01610c98565b93506080880135915080821115610e1c57600080fd5b50610e2988828901610d18565b9150509295509295909350565b600080600080600060a08688031215610e4e57600080fd5b8535610e5981610c39565b94506020860135610e6981610c39565b93506040860135925060608601359150608086013567ffffffffffffffff811115610e9357600080fd5b610e2988828901610d18565b600060208284031215610eb157600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052600190820152600360fc1b60c082015260e00190565b6000816000190483118215151615610f2257634e487b7160e01b600052601160045260246000fd5b500290565b600060208284031215610f3957600080fd5b8151610bbc81610c3956fea2646970667358221220f128e6d8ca4ea346fdabe409edc9159f5d15cbcf8c69303269c84b7bf893740464736f6c634300080a0033000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e

Deployed Bytecode

0x60806040526004361061009c5760003560e01c80633ac30e4b116100645780633ac30e4b146101bd578063bc197c81146101dd578063d6febde814610222578063e757223014610235578063f23a6e6114610270578063fb81a8b51461029c57600080fd5b806301ffc9a7146100a15780630ad24528146100d65780630cecb026146100f85780630f5ea1b51461014e5780632fb565e81461019d575b600080fd5b3480156100ad57600080fd5b506100c16100bc366004610b92565b6102e8565b60405190151581526020015b60405180910390f35b3480156100e257600080fd5b506100f66100f1366004610bc3565b61031f565b005b34801561010457600080fd5b50610133610113366004610bc3565b600160208190526000918252604090912080549181015460029091015483565b604080519384526020840192909252908201526060016100cd565b34801561015a57600080fd5b50610188610169366004610bc3565b6000908152600160208190526040909120908101546002909101549091565b604080519283526020830191909152016100cd565b3480156101a957600080fd5b506100f66101b8366004610bdc565b6104b8565b3480156101c957600080fd5b506100f66101d8366004610bfe565b61055c565b3480156101e957600080fd5b506102096101f8366004610d88565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016100cd565b6100f6610230366004610bdc565b610775565b34801561024157600080fd5b50610262610250366004610bc3565b60009081526001602052604090205490565b6040519081526020016100cd565b34801561027c57600080fd5b5061020961028b366004610e36565b63f23a6e6160e01b95945050505050565b3480156102a857600080fd5b506102d07f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e81565b6040516001600160a01b0390911681526020016100cd565b60006001600160e01b03198216630271189760e51b148061031957506301ffc9a760e01b6001600160e01b03198316145b92915050565b8061032981610aa5565b6001600160a01b0316336001600160a01b03161461034657600080fd5b604051627eeac760e11b8152306004820152602481018390526000907f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e6001600160a01b03169062fdd58e90604401602060405180830381865afa1580156103b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d69190610e9f565b604051637921219560e11b81529091506001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e169063f242432a9061042b903090339088908790600401610eb8565b600060405180830381600087803b15801561044557600080fd5b505af1158015610459573d6000803e3d6000fd5b50506040518592506001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e1691507f7d7570b046e5ead3a4f3fbc9fa2445113625a1e79823776146316bafed6b8cc590600090a3505050565b816104c281610aa5565b6001600160a01b0316336001600160a01b0316146104df57600080fd5b600083815260016020526040908190208390555183906001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e16907f7c3bda8adcb9df1edd0059da351d966538bcc99f067c0770872170ac97fb68879061054f9086815260200190565b60405180910390a3505050565b8461056681610aa5565b6001600160a01b0316336001600160a01b03161461058357600080fd5b604051627eeac760e11b8152306004820152602481018790527f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e6001600160a01b03169062fdd58e90604401602060405180830381865afa1580156105ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106109190610e9f565b156106535760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b1a5cdd195960921b60448201526064015b60405180910390fd5b60008681526001602081905260409182902087815590810185905560020183905551637921219560e11b81526001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e169063f242432a906106c490339030908b908a90600401610eb8565b600060405180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b50506040805187815260208101879052908101859052606081018890523392508891507f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e6001600160a01b0316907ff842c35eb56407b011a697320581ecc26a6b71a4ef12fd665bd16790b42170df9060800160405180910390a4505050505050565b600260005414156107c85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161064a565b600260008181558381526001602081905260408220908101549201548492915081421180156107f657508042105b61082d5760405162461bcd60e51b8152602060048201526008602482015267696e61637469766560c01b604482015260640161064a565b6000858152600160205260409020546108468582610efa565b34146108825760405162461bcd60e51b815260206004820152600b60248201526a77726f6e6720707269636560a81b604482015260640161064a565b61088b86610aa5565b6001600160a01b03166108fc349081150290604051600060405180830381858888f193505050501580156108c3573d6000803e3d6000fd5b50604051637921219560e11b81526001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e169063f242432a9061091690309033908b908b90600401610eb8565b600060405180830381600087803b15801561093057600080fd5b505af1158015610944573d6000803e3d6000fd5b505060408051888152602081018590528993506001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e16925033917f8f7a55179307cea51948432d653dbd53a23fedc388bcb3e04e311f8220d87864910160405180910390a4604051627eeac760e11b8152306004820152602481018790527f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e6001600160a01b03169062fdd58e90604401602060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190610e9f565b610a985760405186906001600160a01b037f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e16907f7d7570b046e5ead3a4f3fbc9fa2445113625a1e79823776146316bafed6b8cc590600090a35b5050600160005550505050565b604051633d4f6d6160e21b8152600481018290526000907f000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e6001600160a01b03169063f53db58490602401602060405180830381865afa158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b319190610f27565b6001600160a01b031663e66f53b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610f27565b600060208284031215610ba457600080fd5b81356001600160e01b031981168114610bbc57600080fd5b9392505050565b600060208284031215610bd557600080fd5b5035919050565b60008060408385031215610bef57600080fd5b50508035926020909101359150565b600080600080600060a08688031215610c1657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6001600160a01b0381168114610c4e57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610c9057610c90610c51565b604052919050565b600082601f830112610ca957600080fd5b8135602067ffffffffffffffff821115610cc557610cc5610c51565b8160051b610cd4828201610c67565b9283528481018201928281019087851115610cee57600080fd5b83870192505b84831015610d0d57823582529183019190830190610cf4565b979650505050505050565b600082601f830112610d2957600080fd5b813567ffffffffffffffff811115610d4357610d43610c51565b610d56601f8201601f1916602001610c67565b818152846020838601011115610d6b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215610da057600080fd5b8535610dab81610c39565b94506020860135610dbb81610c39565b9350604086013567ffffffffffffffff80821115610dd857600080fd5b610de489838a01610c98565b94506060880135915080821115610dfa57600080fd5b610e0689838a01610c98565b93506080880135915080821115610e1c57600080fd5b50610e2988828901610d18565b9150509295509295909350565b600080600080600060a08688031215610e4e57600080fd5b8535610e5981610c39565b94506020860135610e6981610c39565b93506040860135925060608601359150608086013567ffffffffffffffff811115610e9357600080fd5b610e2988828901610d18565b600060208284031215610eb157600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052600190820152600360fc1b60c082015260e00190565b6000816000190483118215151615610f2257634e487b7160e01b600052601160045260246000fd5b500290565b600060208284031215610f3957600080fd5b8151610bbc81610c3956fea2646970667358221220f128e6d8ca4ea346fdabe409edc9159f5d15cbcf8c69303269c84b7bf893740464736f6c634300080a0033

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

000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e

-----Decoded View---------------
Arg [0] : _fractions (address): 0xb2469a7dd9E154c97b99b33E88196f7024F2979e

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000b2469a7dd9e154c97b99b33e88196f7024f2979e


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.