ETH Price: $2,104.43 (+2.36%)
Gas: 0.09 Gwei

Token

Vault Two ()
 

Overview

Max Total Supply

0 Vault Two

Holders

0

Transfers

-
0

Market

Onchain Market Cap

-

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 0 Decimals)

Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
AssetVault

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/*
  It saves bytecode to revert on custom errors instead of using require
  statements. We are just declaring these errors for reverting with upon various
  conditions later in this contract.
*/
error CallerIsNotPanicOwner();
error CallerIsNotWhitelistedDepositor();
error CannotChangePanicDetailsOnLockedVault();
error EtherTransferWasUnsuccessful();
error MustSendAssetsToAtLeastOneRecipient();
error Unsupported1155Interface();
error Unsupported721Interface();

/**
  @title A vault for securely holding assets. This vault can hold Ether, ERC-20
    tokens, ERC-721 tokens, or ERC-1155 tokens.
  @author Tim Clancy
  @author Egor Dergunov

  The context of this vault contract is such that it is intended for use when
  owned by a separate multisignature-driven timelock contract. The justification
  for the timelock is such that, if the multisignature wallet is compromised,
  this vault empowers signatories to mitigate potential damage from an attacker
  via the `panic` function.

  It is recommended that assets be sent to this vault using the `deposit`
  function, which will correctly configure contract storage such that the
  `panic` function covers all assets. In the event that using `deposit` is not
  possible, assets may be manually configured via the `configure` function.

  August 30th, 2022.
*/
contract AssetVault is
  ERC721Holder,
  ERC1155Holder,
  Ownable,
  ReentrancyGuard
{
  using EnumerableSet for EnumerableSet.AddressSet;
  using SafeERC20 for IERC20;

  /**
    The ERC-165 interface identifier for ERC-721. We use this to detect whether
    or not an asset in this vault is actually a valid ERC-721 item.
  */
  bytes4 private constant ERC721_INTERFACE_ID = 0x80ac58cd;

  /**
    The ERC-165 interface identifier for ERC-1155. We use this to detect whether
    or not an asset in this vault is actually a valid ERC-1155 item.
  */
  bytes4 private constant ERC1155_INTERFACE_ID = 0xd9b67a26;

  /// A version number for this TokenVault contract's interface.
  uint256 public constant version = 2;

  /// A user-specified, descriptive name for this TokenVault.
  string public name;

  /**
    The panic owner is an optional address allowed to immediately send the
    contents of the vault to the address specified in `panicDestination`. The
    intention of this system is to support a series of cascading vaults secured
    by their own multisignature wallets. If, for instance, vault one is
    compromised via its attached multisignature wallet, vault two could
    intercede to save the tokens from vault one before the malicious token send
    clears the owning timelock.
  */
  address public panicOwner;

  /**
    An address where tokens may be immediately sent by `panicOwner`. If this
    address is the zero address, then the vault will attempt to burn assets
    immediately upon panic.
  */
  address public panicDestination;

  /**
    A counter to limit the number of times a vault can panic before taking a
    final emergency action on the underlying supply of tokens. This limit is in
    place to protect against a situation where multiple vaults linked in a
    cycle are all compromised. In the event of such an attack, this still gives
    the original multisignature holders the chance to either evacuate or burn
    the tokens by repeatedly calling `panic` before the attacker can use `send`.

    When the panic limit is reached, assets will be sent to
    `evacuationDestination`. If they fail to transfer, they will be burnt.
  */
  uint256 public immutable panicLimit;

  /**
    An address where tokens are attempted to be evacuated to in the event the
    `panicLimit` is tripped.
  */
  address public immutable evacuationDestination;

  /**
    A backup burn destination to use in the event that an asset is not
    conventionally-burnable, i.e. cannot be burnt using a `burn` function. It is
    recommended to use a recognized blackhole address such as `0x...DEAD`.
  */
  address public immutable backupBurnDestination;

  /**
    A mapping for certifying whether or not a particular caller is a whitelisted
    depositor. Only the owner of this contract may add or remove depositors.
  */
  mapping ( address => bool ) public depositors;

  /**
    A flag to determine whether or not alteration of this vault's `panicOwner`
    and `panicDestination` panic routing details have been locked.
  */
  bool public panicDetailsLocked;

  /// A counter for the number of times this vault has panicked.
  uint256 public panicCounter;

  /**
    An enumerable set that stores values of ERC-20 contract addresses which are
    known to the `panic` function. Assets handled via `deposit` will be
    automatically added to this set' they may otherwise be configured via
    `configure`.
  */
  EnumerableSet.AddressSet private erc20Assets;

  /**
    An enumerable set that stores values of ERC-721 contract addresses which are
    known to the `panic` function. Assets handled via `deposit` will be
    automatically added to this set' they may otherwise be configured via
    `configure`.
  */
  EnumerableSet.AddressSet private erc721Assets;

  /**
    An enumerable set that stores values of ERC-1155 contract addresses which
    are known to the `panic` function. Assets handled via `deposit` will be
    automatically added to this set' they may otherwise be configured via
    `configure`.
  */
  EnumerableSet.AddressSet private erc1155Assets;

  /**
    Enumerate all possible asset types which this vault may handle. These asset
    types are used to flag the type of each `Asset` struct when handling the
    transfer of specific tokens.

    @param Ether This value denotes that an asset is Ether.
    @param ERC20 This value denotes that an asset is an ERC-20 token.
    @param ERC721 This value denotes that an asset is an ERC-721 token.
    @param ERC1155 This value denotes that an asset is an ERC-1155 token.
  */
  enum AssetType {
    Ether,
    ERC20,
    ERC721,
    ERC1155
  }

  /**
    This struct defines one or more instances of a single specific type of asset
    in this vault. It is used to prepare this vault's configuration to accept
    ERC-20, ERC-721, and ERC-1155 tokens. It is used when sending tokens to
    specify the amount of the specific asset to send. In the case of ERC-721
    items, it specifies the particular IDs under a contract address to send. In
    the case of ERC-1155 items, it specifies the particular IDs and their
    corresponding amounts to send.

    @param assetType An `AssetType` type to classify this asset.
    @param amounts An array of token amounts, keyed against the elements in
      `ids`. In the case that `assetType` is Ether or ERC20, this should be a
      singleton array containing just the amount that should be transfered.
    @param ids An array of IDs which should be transfered in the event that
      `assetType` is ERC721 or ERC1155.
  */
  struct Asset {
    AssetType assetType;
    uint256[] amounts;
    uint256[] ids;
  }

  /**
    This mapping links the addresses of ERC-721 or ERC-1155 item collections to
    `Asset` structs that indicate the current holdings of this vault.
  */
  mapping ( address => Asset ) public assets;

  /**
    This struct defines a single operation on some single specific type of asset
    in this vault. It is used to prepare this vault's configuration to accept
    ERC-20, ERC-721, and ERC-1155 tokens. It is used when sending tokens to
    specify the amount of the specific asset to send. In the case of ERC-721
    items, it specifies the particular IDs under a contract address to send. In
    the case of ERC-1155 items, it specifies the particular IDs and their
    corresponding amounts to send. It includes the address of the smart contract
    which the `Asset` struct otherwise lacks.

    @param assetType An `AssetType` type to classify this asset.
    @param assetAddress The address of the asset's smart contract.
    @param amounts An array of token amounts, keyed against the elements in
      `ids`. In the case that `assetType` is Ether or ERC20, this should be a
      singleton array containing just the amount that should be transfered.
    @param ids An array of IDs which should be transfered in the event that
      `assetType` is ERC721 or ERC1155.
  */
  struct AssetSpecification {
    AssetType assetType;
    address assetAddress;
    uint256[] amounts;
    uint256[] ids;
  }

  /**
    This struct defines the information required to send some single specific
    type of asset in this vault to a recipient. It is used when sending tokens
    to specify the amount of the specific asset to send. In the case of ERC-721
    items, it specifies the particular IDs under a contract address to send. In
    the case of ERC-1155 items, it specifies the particular IDs and their
    corresponding amounts to send. It includes the address of the smart contract
    which the `Asset` struct otherwise lacks.

    @param assetType An `AssetType` type to classify this asset.
    @param recipientAddress The address of the recipient to send the asset to.
    @param assetAddress The address of the asset's smart contract.
    @param amounts An array of token amounts, keyed against the elements in
      `ids`. In the case that `assetType` is Ether or ERC20, this should be a
      singleton array containing just the amount that should be transfered.
    @param ids An array of IDs which should be transfered in the event that
      `assetType` is ERC721 or ERC1155.
  */
  struct SendSpecification {
    AssetType assetType;
    address recipientAddress;
    address assetAddress;
    uint256[] amounts;
    uint256[] ids;
  }

  /**
    This struct defines the information required to update the whitelist status
    of a specific potential depositor address. This allows the owner of this
    vault to control which callers may or may not deposit assets.

    @param depositor The address of the depositor to update.
    @param status Whether or not the `depositor` should be whitelisted.
  */
  struct UpdateDepositor {
    address depositor;
    bool status;
  }

  /**
    An event for tracking a deposit of assets into this vault.

    @param etherAmount The amount of Ether that was deposited.
    @param erc20Count The number of different instances of ERC-20 tokens
      deposited.
    @param erc721Count The number of different instances of deposits from
      different ERC-721 addresses.
    @param erc1155Count The number of different instances of deposits from
      different ERC-1155 addresses.
  */
  event Deposit (
    uint256 etherAmount,
    uint256 erc20Count,
    uint256 erc721Count,
    uint256 erc1155Count
  );

  /// An event emitted when vault asset reconfiguration occurs.
  event Reconfigured ();

  /**
    An event for tracking a disbursement of assets from this vault.

    @param etherAmount The amount of Ether that was transferred.
    @param erc20Count The number of different instances of ERC-20 token
      transfers.
    @param erc721Count The number of different instances of transfers from
      different ERC-721 addresses.
    @param erc1155Count The number of different instances of transfers from
      different ERC-1155 addresses.
  */
  event Send (
    uint256 etherAmount,
    uint256 erc20Count,
    uint256 erc721Count,
    uint256 erc1155Count
  );

  /**
    An event for tracking a change in panic details.

    @param panicOwner The address of this vault's new panic owner.
    @param panicDestination The address of the vault's new panic destination.
  */
  event PanicDetailsChange (
    address indexed panicOwner,
    address indexed panicDestination
  );

  /// An event for tracking a lock on alteration of panic details.
  event PanicDetailsLocked ();

  /**
    An event for tracking a panic transfer of tokens. This kind of emergency
    operation attempts to destroy all assets in the vault.

    @param panicCounter The count of the number of times the vault has panicked
      when this event is emitted.
    @param etherAmount The amount of Ether that was burnt.
    @param erc20Count The number of different ERC-20 tokens that were burnt.
    @param erc721Count The number of different ERC-721 addresses from which
      items were burnt.
    @param erc1155Count The number of different ERC-1155 addresses from which
      items were burnt.
  */
  event PanicBurn (
    uint256 panicCounter,
    uint256 etherAmount,
    uint256 erc20Count,
    uint256 erc721Count,
    uint256 erc1155Count
  );

  /**
    An event for tracking a panic transfer of tokens. This kind of emergency
    transfer is initiated by the `panicOwner` and sends all vault assets to the
    `panicDestination`.

    @param panicCounter The count of the number of times the vault has panicked
      when this event is emitted.
    @param etherAmount The amount of Ether that was panic transferred.
    @param erc20Count The number of different ERC-20 tokens that were panic
      transferred.
    @param erc721Count The number of different ERC-721 addresses from which
      items were panic transferred.
    @param erc1155Count The number of different ERC-1155 addresses from which
      items were panic transferred.
    @param panicDestination The address that the items were transferred to.
  */
  event PanicTransfer (
    uint256 panicCounter,
    uint256 etherAmount,
    uint256 erc20Count,
    uint256 erc721Count,
    uint256 erc1155Count,
    address indexed panicDestination
  );

  /**
    An event for tracking when the whitelist status of a depositor changes.

    @param depositor The depositor whose whitelist status has changed.
    @param isWhitelisted Whether or not the depositor is allowed to deposit.
  */
  event WhitelistedDepositor (
    address indexed depositor,
    bool isWhitelisted
  );

  /**
    An event indicating that the vault contract has received Ether.

    @param caller The address of the caller which sent Ether to this vault.
    @param amount The amount of Ether that `caller` sent to this vault.
  */
  event Receive (
    address caller,
    uint256 amount
  );

  /// A modifier to see if a caller is a member of the whitelisted `depositors`.
  modifier onlyDepositors () {
    if (!depositors[_msgSender()]) {
      revert CallerIsNotWhitelistedDepositor();
    }
    _;
  }

  /// A modifier to see if a caller is the `panicOwner`.
  modifier onlyPanicOwner () {
    if (panicOwner != _msgSender()) {
      revert CallerIsNotPanicOwner();
    }
    _;
  }

  /**
    Construct a new asset vault by providing it a name and configuration details
    for the vault's panic routing features.

    Please note that if the goal is to support emergency token burning without
    reaching the panic limit, consider using an address such as `0x...DEAD`
    instead of the zero address as the `_panicDestination`. This will result in
    better support for non-burnable tokens.

    @param _name The name of this vault.
    @param _panicOwner The address to grant emergency withdrawal powers to.
    @param _panicDestination The destination to withdraw to in emergency.
    @param _panicLimit A limit for the number of times `panic` can be called
      before assets are self-destructed.
    @param _evacuationDestination An address where tokens are attempted to be
      evacuated to in the event the `panicLimit` is tripped.
    @param _backupBurnDestination A backup burn destination to use in the event
      that an asset is not conventionally-burnable.
  */
  constructor (
    string memory _name,
    address _panicOwner,
    address _panicDestination,
    uint256 _panicLimit,
    address _evacuationDestination,
    address _backupBurnDestination
  ) {
    name = _name;
    panicOwner = _panicOwner;
    panicDestination = _panicDestination;
    panicLimit = _panicLimit;
    evacuationDestination = _evacuationDestination;
    backupBurnDestination = _backupBurnDestination;
  }

  /**
    A private helper function to configure this vault to add assets to the
    contract that may have been directly transferred without using `deposit`.
    Assets must first be configured in order to be transferrable via `panic`.

    @param _assets An array of `AssetSpecification` structs containing
      configuration details about each asset being configured.
  */
  function _configure (
    AssetSpecification[] memory _assets
  ) private {

    /*
      If it isn't already present, add each asset being configured to its
      appropriate set. Then, update the asset details mapping.
    */
    for (uint256 i = 0; i < _assets.length;) {

      // Add any new ERC-20 token addresses.
      if (_assets[i].assetType == AssetType.ERC20 &&
        !erc20Assets.contains(_assets[i].assetAddress)) {
        erc20Assets.add(_assets[i].assetAddress);
      }

      // Add any new ERC-721 token addresses.
      if (_assets[i].assetType == AssetType.ERC721 &&
        !erc721Assets.contains(_assets[i].assetAddress)) {
        erc721Assets.add(_assets[i].assetAddress);
      }

      // Add any new ERC-1155 token addresses.
      if (_assets[i].assetType == AssetType.ERC1155 &&
        !erc1155Assets.contains(_assets[i].assetAddress)) {
        erc1155Assets.add(_assets[i].assetAddress);
      }

      // Update the asset details mapping.
      assets[_assets[i].assetAddress] = Asset({
        assetType: _assets[i].assetType,
        ids: _assets[i].ids,
        amounts: _assets[i].amounts
      });
      unchecked { ++i; }
    }

    // Emit an event indicating that reconfiguration occurred.
    emit Reconfigured();
  }

  /**
    Deposit assets directly into this vault such that panic details are
    automatically configured. Calling this deposit function requires first
    approving any involved assets for transfer.

    @param _assets An array of `AssetSpecification` structs containing
      configuration details about each asset being deposited.
  */
  function deposit (
    AssetSpecification[] memory _assets
  ) external payable nonReentrant onlyDepositors {

    // Transfer each asset to the vault. This requires approving the vault.
    uint256 erc20Count = 0;
    uint256 erc721Count = 0;
    uint256 erc1155Count = 0;
    for (uint256 i = 0; i < _assets.length;) {
      address assetAddress = _assets[i].assetAddress;
      AssetSpecification memory asset = _assets[i];

      // Send ERC-20 tokens to the vault.
      if (asset.assetType == AssetType.ERC20) {
        uint256 amount = asset.amounts[0];
        IERC20(assetAddress).safeTransferFrom(
          _msgSender(),
          address(this),
          amount
        );
        erc20Count += 1;
      }

      // Send ERC-721 tokens to the recipient.
      if (asset.assetType == AssetType.ERC721) {
        IERC721 item = IERC721(assetAddress);

        // Only attempt to send valid ERC-721 items.
        if (!item.supportsInterface(
          ERC721_INTERFACE_ID
        )) {
          revert Unsupported721Interface();
        }

        // Perform a transfer of each asset.
        for (uint256 j = 0; j < asset.ids.length;) {
          item.safeTransferFrom(
            _msgSender(),
            address(this),
            asset.ids[j]
          );
          unchecked { ++j; }
        }
        erc721Count += 1;
      }

      // Send ERC-1155 tokens to the recipient.
      if (asset.assetType == AssetType.ERC1155) {
        IERC1155 item = IERC1155(assetAddress);

        // Only attempt to send valid ERC-1155 items.
        if (!item.supportsInterface(
          ERC1155_INTERFACE_ID
        )) {
          revert Unsupported1155Interface();
        }

        // Perform a transfer of each asset.
        item.safeBatchTransferFrom(
          _msgSender(),
          address(this),
          asset.ids,
          asset.amounts,
          ""
        );
        erc1155Count += 1;
      }
      unchecked { ++i; }
    }

    // Configure all assets which were just deposited.
    _configure(_assets);

    // Emit a deposit event.
    emit Deposit(msg.value, erc20Count, erc721Count, erc1155Count);
  }

  /**
    Configure this vault to add assets to the contract that may have been
    directly transferred without using `deposit`. Assets must first be
    configured in order to be transferrable via `panic`.

    @param _assets An array of `AssetSpecification` structs containing
      configuration details about each asset being configured.
  */
  function configure (
    AssetSpecification[] memory _assets
  ) external nonReentrant onlyOwner {
    _configure(_assets);
  }

  /**
    This private helper function removes from panic storage the particular
    `_asset` details from their corresponding contract addresses because said
    assets were transferred out of the vault and should no longer be tracked.

    @param _asset An `AssetSpecification` struct tracking the assets which were
      transferred and ought to be removed from panic storage.
  */
  function _removeToken (
    AssetSpecification memory _asset
  ) private {

    // Remove a tracked ERC-20 asset if the vault no longer has a balance.
    if (_asset.assetType == AssetType.ERC20) {
      IERC20 token = IERC20(_asset.assetAddress);
      uint256 balance = token.balanceOf(address(this));
      if (balance == 0) {
        erc20Assets.remove(_asset.assetAddress);
      }
    }

    // Remove an ERC-721 asset entirely if the vault no longer has a balance.
    if (_asset.assetType == AssetType.ERC721) {
      IERC721 token = IERC721(_asset.assetAddress);
      uint256 balance = token.balanceOf(address(this));
      if (balance == 0) {
        erc721Assets.remove(_asset.assetAddress);

      // The vault still carries a balance; remove particular ERC-721 token IDs.
      } else {

        // Remove specific elements in `_asset` from the storage asset.
        uint256[] storage oldIds = assets[_asset.assetAddress].ids;
        for (uint256 i; i < oldIds.length;) {
          for (uint256 j = 0; j < _asset.ids.length;) {
            uint256 candidateId = _asset.ids[j];

            // Remove the element at the matching index.
            if (candidateId == oldIds[i]) {
              if (i != oldIds.length - 1) {
                oldIds[i] = oldIds[oldIds.length - 1];
              }
              oldIds.pop();
              break;
            }
            unchecked { ++j; }
          }
          unchecked { ++i; }
        }
      }
    }

    /*
      Reduce the tracked supply of each ERC-1155 item in this vault. Remove a
      tracked ID entirely if its supply is zero. Removed a tracked ERC-1155 item
      entirely if no IDs are held.
    */
    if (_asset.assetType == AssetType.ERC1155) {

      // Reduce the amount held of specific IDs in `_asset`.
      uint256[] storage oldIds = assets[_asset.assetAddress].ids;
      uint256[] storage oldAmounts = assets[_asset.assetAddress].amounts;
      for (uint256 i; i < oldIds.length;) {
        for (uint256 j = 0; j < _asset.ids.length;) {
          uint256 candidateId = _asset.ids[j];
          uint256 candidateAmount = _asset.amounts[j];

          // Process the element at the matching index.
          if (candidateId == oldIds[i]) {

            /*
              We are removing the entire supply of the specified token ID and
              therefore should remove the ID being tracked in `assets` entirely.
            */
            if (candidateAmount == oldAmounts[i]) {
              if (i != oldIds.length - 1) {
                oldIds[i] = oldIds[oldIds.length - 1];
                oldAmounts[i] = oldAmounts[oldAmounts.length - 1];
              }
              oldIds.pop();
              oldAmounts.pop();

            // Otherwise, we are only removing some of the supply.
            } else {
              oldAmounts[i] -= candidateAmount;
            }
            break;
          }
          unchecked { ++j; }
        }
        unchecked { ++i; }
      }

      // If we removed every component ID, remove the ERC-1155 asset entirely.
      if (oldIds.length == 0) {
        erc1155Assets.remove(_asset.assetAddress);
      }
    }
  }

  /**
    Allows this vault's owner to send assets out of the vault.

    @param _sends An array of `SendSpecification` structs that each request
      sending some specific assets from this vault to a recipient.
  */
  function send (
    SendSpecification[] memory _sends
  ) external nonReentrant onlyOwner {
    if (_sends.length == 0) {
      revert MustSendAssetsToAtLeastOneRecipient();
    }

    /*
      Iterate through every specified recipient and send them each corresponding
      asset in the correct amount.
    */
    uint256 totalEth = 0;
    uint256 erc20Count = 0;
    uint256 erc721Count = 0;
    uint256 erc1155Count = 0;
    for (uint256 i = 0; i < _sends.length;) {
      SendSpecification memory send = _sends[i];

      // Send Ether to the recipient.
      if (send.assetType == AssetType.Ether) {
        uint256 amount = send.amounts[0];
        (bool success, ) = send.recipientAddress.call{ value: amount }("");
        if (!success) {
          revert EtherTransferWasUnsuccessful();
        }
        totalEth += amount;
      }

      // Send ERC-20 tokens to the recipient.
      if (send.assetType == AssetType.ERC20) {
        uint256 amount = send.amounts[0];
        IERC20(send.assetAddress).safeTransfer(send.recipientAddress, amount);
        erc20Count += 1;
      }

      // Send ERC-721 tokens to the recipient.
      if (send.assetType == AssetType.ERC721) {
        IERC721 item = IERC721(send.assetAddress);

        // Only attempt to send valid ERC-721 items.
        if (!item.supportsInterface(
          ERC721_INTERFACE_ID
        )) {
          revert Unsupported721Interface();
        }

        // Perform a transfer of each asset.
        for (uint256 j = 0; j < send.ids.length;) {
          item.safeTransferFrom(
            address(this),
            send.recipientAddress,
            send.ids[j]
          );
          unchecked { ++j; }
        }
        erc721Count += 1;
      }

      // Send ERC-1155 tokens to the recipient.
      if (send.assetType == AssetType.ERC1155) {
        IERC1155 item = IERC1155(send.assetAddress);

        // Only attempt to send valid ERC-1155 items.
        if (!item.supportsInterface(
          ERC1155_INTERFACE_ID
        )) {
          revert Unsupported1155Interface();
        }

        // Perform a transfer of each asset.
        item.safeBatchTransferFrom(
          address(this),
          send.recipientAddress,
          send.ids,
          send.amounts,
          ""
        );
        erc1155Count += 1;
      }

      // Remove the transferred asset from vault storage.
      _removeToken(AssetSpecification({
        assetAddress: send.assetAddress,
        assetType: send.assetType,
        ids: send.ids,
        amounts: send.amounts
      }));
      unchecked { ++i; }
    }

    // Emit an event tracking details about this asset transfer.
    emit Send(totalEth, erc20Count, erc721Count, erc1155Count);
  }

  /**
    Allow the owner of this vault to update the `panicOwner` and
    `panicDestination` details governing its panic functionality.

    @param _panicOwner The new panic owner to set.
    @param _panicDestination The new emergency destination to send tokens to.
  */
  function changePanicDetails (
    address _panicOwner,
    address _panicDestination
  ) external nonReentrant onlyOwner {
    if (panicDetailsLocked) {
      revert CannotChangePanicDetailsOnLockedVault();
    }

    // Panic details are not locked, so update them and emit an event.
    panicOwner = _panicOwner;
    panicDestination = _panicDestination;
    emit PanicDetailsChange(panicOwner, panicDestination);
  }

  /**
    Allow the owner of the vault to lock the the state of `panicOwner` and
    `panicDestination` to prevent all future panic detail changes.
  */
  function lock () external nonReentrant onlyOwner {
    panicDetailsLocked = true;
    emit PanicDetailsLocked();
  }

  /**
    Allow this vault's `panicOwner` to immediately send the contents of this
    vault to the predefined `panicDestination`. This can be used to circumvent
    the timelock in case of an emergency.
  */
  function panic () external nonReentrant onlyPanicOwner {
    uint256 totalBalanceEth = address(this).balance;
    uint256 totalAmountERC20 = erc20Assets.length();
    uint256 totalAmountERC721 = erc721Assets.length();
    uint256 totalAmountERC1155 = erc1155Assets.length();

    /*
      If the panic limit is reached, or the panic destination is the zero
      address, attempt to burn all assets in the vault.
    */
    if (panicCounter == panicLimit || panicDestination == address(0)) {
      address targetedAddress = evacuationDestination;
      if (panicDestination == address(0)) {
        targetedAddress = address(0);
      }

      // Attempt to burn all Ether; we proceed whether this succeeds or not.
      address(targetedAddress).call{ value: totalBalanceEth }("");

      /*
        Attempt to burn all ERC-20 tokens. If they supply a burn function, we
        will try to use it. In the event that a "proper" burn fails, we will
        transfer the tokens to a configurable backup burn address.
      */
      for (uint256 i = 0; i < totalAmountERC20;) {
        address assetAddress = erc20Assets.at(i);
        IERC20 token = IERC20(assetAddress);
        uint256 tokenBalance = token.balanceOf(address(this));
        if (targetedAddress == address(0)) {
          ERC20Burnable burnable = ERC20Burnable(assetAddress);
          try burnable.burn(tokenBalance) {
          } catch {
            token.safeTransfer(backupBurnDestination, tokenBalance);
          }
        } else {
          try token.transfer(targetedAddress, tokenBalance) {
          } catch {
            token.safeTransfer(backupBurnDestination, tokenBalance);
          }
        }
        unchecked { ++i; }
      }

      /*
        Attempt to burn all ERC-721 items held by this vault. Invalid items will
        be left behind.
      */
      for (uint256 i = 0; i < totalAmountERC721;) {
        address assetAddress = erc721Assets.at(i);
        IERC721 item = IERC721(assetAddress);
        Asset memory asset = assets[assetAddress];

        /*
          Panic burning is an emergency self-destruct and therefore we will not
          fail upon encountering potentially-invalid items. It is more important
          to ensure that whatever items may be burnt are burnt.
        */
        if (item.supportsInterface(ERC721_INTERFACE_ID)) {
          for (uint256 j = 0; j < asset.ids.length;) {
            if (targetedAddress == address(0)) {
              ERC721Burnable burnable = ERC721Burnable(assetAddress);
              try burnable.burn(asset.ids[j]) {
              } catch {
                item.safeTransferFrom(
                  address(this),
                  backupBurnDestination,
                  asset.ids[j]
                );
              }
            } else {
              try item.safeTransferFrom(
                address(this),
                targetedAddress,
                asset.ids[j]
              ) {
              } catch {
                item.safeTransferFrom(
                  address(this),
                  backupBurnDestination,
                  asset.ids[j]
                );
              }
            }
            unchecked { ++j; }
          }
        }
        unchecked { ++i; }
      }

      /*
        Attempt to transfer all ERC-1155 items held by this vault. Invalid items
        will be left behind.
      */
      for (uint256 i = 0; i < totalAmountERC1155;) {
        address assetAddress = erc1155Assets.at(i);
        IERC1155 item = IERC1155(assetAddress);
        Asset memory asset = assets[assetAddress];

        /*
          Panic burning is an emergency self-destruct and therefore we will not
          fail upon encountering potentially-invalid items. It is more important
          to ensure that whatever items may be burnt are burnt.
        */
        if (item.supportsInterface(ERC1155_INTERFACE_ID)) {
          if (targetedAddress == address(0)) {
            ERC1155Burnable burnable = ERC1155Burnable(assetAddress);
            try burnable.burnBatch(
              address(this),
              asset.ids,
              asset.amounts
            ) {
            } catch {
              item.safeBatchTransferFrom(
                address(this),
                backupBurnDestination,
                asset.ids,
                asset.amounts,
                ""
              );
            }
          } else {
            try item.safeBatchTransferFrom(
              address(this),
              targetedAddress,
              asset.ids,
              asset.amounts,
              ""
            ) {
            } catch {
              item.safeBatchTransferFrom(
                address(this),
                backupBurnDestination,
                asset.ids,
                asset.amounts,
                ""
              );
            }
          }
        }
        unchecked { ++i; }
      }

      // Emit an event recording the panic burn that happened.
      emit PanicBurn(
        panicCounter,
        totalBalanceEth,
        totalAmountERC20,
        totalAmountERC721,
        totalAmountERC1155
      );

    /*
      Attempt a panic transfer to immediately send all assets to the
      configured `panicDestination`.
    */
    } else {

      // Attempt to transfer all Ether.
      (bool success, ) = panicDestination.call{ value: totalBalanceEth }("");
      if (!success) {
        revert EtherTransferWasUnsuccessful();
      }

      /*
        Attempt to transfer all ERC-20 tokens. For each token in the ERC-20
        assets set, retrieve this vault's balance and transfer it to the
        `panicDestination`.
      */
      for (uint256 i = 0; i < totalAmountERC20;) {
        IERC20 token = IERC20(erc20Assets.at(i));
        uint256 tokenBalance = token.balanceOf(address(this));
        token.safeTransfer(panicDestination, tokenBalance);
        unchecked { ++i; }
      }

      /*
        Attempt to transfer all ERC-721 items held by this vault. Invalid items
        will be left behind.
      */
      for (uint256 i = 0; i < totalAmountERC721;) {
        address assetAddress = erc721Assets.at(i);
        IERC721 item = IERC721(assetAddress);
        Asset memory asset = assets[assetAddress];

        /*
          Panic is an emergency withdrawal function and therefore we will not
          fail upon encountering potentially-invalid items. It is more important
          to ensure that whatever items may be properly transferred are properly
          transferred.
        */
        if (item.supportsInterface(ERC721_INTERFACE_ID)) {
          for (uint256 j = 0; j < asset.ids.length;) {
            item.safeTransferFrom(
              address(this),
              panicDestination,
              asset.ids[j]
            );
            unchecked { ++j; }
          }
        }
        unchecked { ++i; }
      }

      /*
        Attempt to transfer all ERC-1155 items held by this vault. Invalid items
        will be left behind.
      */
      for (uint256 i = 0; i < totalAmountERC1155;) {
        address assetAddress = erc1155Assets.at(i);
        IERC1155 item = IERC1155(assetAddress);
        Asset memory asset = assets[assetAddress];

        /*
          Panic is an emergency withdrawal function and therefore we will not
          fail upon encountering potentially-invalid items. It is more important
          to ensure that whatever items may be properly transferred are properly
          transferred.
        */
        if (item.supportsInterface(ERC1155_INTERFACE_ID)) {
          item.safeBatchTransferFrom(
            address(this),
            panicDestination,
            asset.ids,
            asset.amounts,
            ""
          );
        }
        unchecked { ++i; }
      }

      // Record the happening of this panic operation and emit an event.
      panicCounter += 1;
      emit PanicTransfer(
        panicCounter,
        totalBalanceEth,
        totalAmountERC20,
        totalAmountERC721,
        totalAmountERC1155,
        panicDestination
      );
    }
  }

  /**
    Configure this vault by updating the whitelisted depositing status of
    various potential depositors.

    @param _depositors An array of `UpdateDepositor` structs containing
      configuration details about each depositor being updated.
  */
  function updateDepositors (
    UpdateDepositor[] memory _depositors
  ) external nonReentrant onlyOwner {
    for (uint256 i = 0; i < _depositors.length;) {
      UpdateDepositor memory update = _depositors[i];
      depositors[update.depositor] = update.status;
      emit WhitelistedDepositor(update.depositor, update.status);
      unchecked { ++i; }
    }
  }

  /**
    Emit a payment receipt event upon this vault receiving Ether.
  */
  receive () external payable {
    emit Receive(_msgSender(), msg.value);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 3 of 29 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

File 5 of 29 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 9 of 29 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

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

File 11 of 29 : ERC1155Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    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);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}

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

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: 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();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

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

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

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

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

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

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

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        address operator = _msgSender();

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

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

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

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

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

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

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

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

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

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

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

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

        address operator = _msgSender();

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

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

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

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

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits 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 {}

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

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

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

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

        return array;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC1155.sol";

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

File 29 of 29 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_panicOwner","type":"address"},{"internalType":"address","name":"_panicDestination","type":"address"},{"internalType":"uint256","name":"_panicLimit","type":"uint256"},{"internalType":"address","name":"_evacuationDestination","type":"address"},{"internalType":"address","name":"_backupBurnDestination","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerIsNotPanicOwner","type":"error"},{"inputs":[],"name":"CallerIsNotWhitelistedDepositor","type":"error"},{"inputs":[],"name":"CannotChangePanicDetailsOnLockedVault","type":"error"},{"inputs":[],"name":"EtherTransferWasUnsuccessful","type":"error"},{"inputs":[],"name":"MustSendAssetsToAtLeastOneRecipient","type":"error"},{"inputs":[],"name":"Unsupported1155Interface","type":"error"},{"inputs":[],"name":"Unsupported721Interface","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"etherAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc20Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc721Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc1155Count","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"panicCounter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"etherAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc20Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc721Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc1155Count","type":"uint256"}],"name":"PanicBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"panicOwner","type":"address"},{"indexed":true,"internalType":"address","name":"panicDestination","type":"address"}],"name":"PanicDetailsChange","type":"event"},{"anonymous":false,"inputs":[],"name":"PanicDetailsLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"panicCounter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"etherAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc20Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc721Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc1155Count","type":"uint256"},{"indexed":true,"internalType":"address","name":"panicDestination","type":"address"}],"name":"PanicTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Receive","type":"event"},{"anonymous":false,"inputs":[],"name":"Reconfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"etherAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc20Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc721Count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"erc1155Count","type":"uint256"}],"name":"Send","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"WhitelistedDepositor","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"assets","outputs":[{"internalType":"enum AssetVault.AssetType","name":"assetType","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"backupBurnDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_panicOwner","type":"address"},{"internalType":"address","name":"_panicDestination","type":"address"}],"name":"changePanicDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum AssetVault.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct AssetVault.AssetSpecification[]","name":"_assets","type":"tuple[]"}],"name":"configure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum AssetVault.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct AssetVault.AssetSpecification[]","name":"_assets","type":"tuple[]"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositors","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"evacuationDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"panicCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panicDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panicDetailsLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panicLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panicOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum AssetVault.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"recipientAddress","type":"address"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct AssetVault.SendSpecification[]","name":"_sends","type":"tuple[]"}],"name":"send","outputs":[],"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":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"internalType":"struct AssetVault.UpdateDepositor[]","name":"_depositors","type":"tuple[]"}],"name":"updateDepositors","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e06040523480156200001157600080fd5b5060405162003ff138038062003ff183398101604081905262000034916200011b565b6200003f3362000098565b600180556002620000518782620002d2565b50600380546001600160a01b03199081166001600160a01b03978816179091556004805490911694861694909417909355608091909152821660a0521660c052506200039e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200011657600080fd5b919050565b60008060008060008060c087890312156200013557600080fd5b86516001600160401b03808211156200014d57600080fd5b818901915089601f8301126200016257600080fd5b815181811115620001775762000177620000e8565b604051601f8201601f19908116603f01168101908382118183101715620001a257620001a2620000e8565b81604052828152602093508c84848701011115620001bf57600080fd5b600091505b82821015620001e35784820184015181830185015290830190620001c4565b6000848483010152809a50505050620001fe818a01620000fe565b965050506200021060408801620000fe565b9350606087015192506200022760808801620000fe565b91506200023760a08801620000fe565b90509295509295509295565b600181811c908216806200025857607f821691505b6020821081036200027957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002cd57600081815260208120601f850160051c81016020861015620002a85750805b601f850160051c820191505b81811015620002c957828155600101620002b4565b5050505b505050565b81516001600160401b03811115620002ee57620002ee620000e8565b6200030681620002ff845462000243565b846200027f565b602080601f8311600181146200033e5760008415620003255750858301515b600019600386901b1c1916600185901b178555620002c9565b600085815260208120601f198616915b828110156200036f578886015182559484019460019091019084016200034e565b50858210156200038e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c051613beb620004066000396000818161043f015281816109d101528181610a7a01528181610cfd01528181610e1f0152818161110501526111ff0152600081816102bd015261084f015260008181610221015261080e0152613beb6000f3fe60806040526004361061016a5760003560e01c8063b38fcb19116100d1578063d25220d21161008a578063f23a6e6111610064578063f23a6e61146104ee578063f2fde38b1461051a578063f83d08ba1461053a578063fcde1dc11461054f57600080fd5b8063d25220d214610461578063eed75f6d14610481578063f11b8188146104b157600080fd5b8063b38fcb1914610394578063b63e5bc6146103a7578063b96fbcb7146103c7578063bc197c81146103e7578063c153cc3514610413578063cd2aaa481461042d57600080fd5b8063328b86f611610123578063328b86f6146102f75780634700d3051461031757806354fd4d501461032c5780636eacbd8714610341578063715018a6146103615780638da5cb5b1461037657600080fd5b806301ffc9a7146101b857806306fdde03146101ed57806308f5516c1461020f578063090209d014610251578063150b7a021461027357806329bc4c34146102ab57600080fd5b366101b3577fd6717f327e0cb88b4a97a7f67a453e9258252c34937ccbdd86de7cb840e7def333604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156101c457600080fd5b506101d86101d33660046131b4565b610565565b60405190151581526020015b60405180910390f35b3480156101f957600080fd5b5061020261059c565b6040516101e49190613202565b34801561021b57600080fd5b506102437f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101e4565b34801561025d57600080fd5b5061027161026c366004613339565b61062a565b005b34801561027f57600080fd5b5061029e61028e36600461346a565b630a85bd0160e11b949350505050565b6040516101e491906134d2565b3480156102b757600080fd5b506102df7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101e4565b34801561030357600080fd5b5061027161031236600461355c565b61072e565b34801561032357600080fd5b5061027161078f565b34801561033857600080fd5b50610243600281565b34801561034d57600080fd5b5061027161035c36600461368a565b6118db565b34801561036d57600080fd5b506102716119b2565b34801561038257600080fd5b506000546001600160a01b03166102df565b6102716103a236600461355c565b6119e8565b3480156103b357600080fd5b506003546102df906001600160a01b031681565b3480156103d357600080fd5b506004546102df906001600160a01b031681565b3480156103f357600080fd5b5061029e6104023660046136bd565b63bc197c8160e01b95945050505050565b34801561041f57600080fd5b506006546101d89060ff1681565b34801561043957600080fd5b506102df7f000000000000000000000000000000000000000000000000000000000000000081565b34801561046d57600080fd5b5061027161047c366004613767565b611def565b34801561048d57600080fd5b506101d861049c36600461389d565b60056020526000908152604090205460ff1681565b3480156104bd57600080fd5b506104e16104cc36600461389d565b600e6020526000908152604090205460ff1681565b6040516101e491906138ce565b3480156104fa57600080fd5b5061029e6105093660046138f6565b63f23a6e6160e01b95945050505050565b34801561052657600080fd5b5061027161053536600461389d565b612315565b34801561054657600080fd5b506102716123b0565b34801561055b57600080fd5b5061024360075481565b60006001600160e01b03198216630271189760e51b148061059657506301ffc9a760e01b6001600160e01b03198316145b92915050565b600280546105a99061395b565b80601f01602080910402602001604051908101604052809291908181526020018280546105d59061395b565b80156106225780601f106105f757610100808354040283529160200191610622565b820191906000526020600020905b81548152906001019060200180831161060557829003601f168201915b505050505081565b6002600154036106555760405162461bcd60e51b815260040161064c90613995565b60405180910390fd5b60026001556000546001600160a01b031633146106845760405162461bcd60e51b815260040161064c906139cc565b60005b81518110156107265760008282815181106106a4576106a4613a01565b602090810291909101810151808201805182516001600160a01b03908116600090815260058652604090819020805460ff19169315159390931790925583519251915191151582529294509116917f7a1c66af088657be8056e5d428b01e4258763977949a676689da12a50d262250910160405180910390a250600101610687565b505060018055565b6002600154036107505760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b0316331461077f5760405162461bcd60e51b815260040161064c906139cc565b6107888161243d565b5060018055565b6002600154036107b15760405162461bcd60e51b815260040161064c90613995565b60026001556003546001600160a01b031633146107e1576040516305003d7d60e21b815260040160405180910390fd5b4760006107ee6008612783565b905060006107fc600a612783565b9050600061080a600c612783565b90507f0000000000000000000000000000000000000000000000000000000000000000600754148061084557506004546001600160a01b0316155b156112c1576004547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316610880575060005b6040516001600160a01b038216908690600081818185875af1925050503d80600081146108c9576040519150601f19603f3d011682016040523d82523d6000602084013e6108ce565b606091505b50505060005b84811015610ab45760006108e960088361278d565b6040516370a0823160e01b815230600482015290915081906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610935573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109599190613a17565b90506001600160a01b0385166109fc57604051630852cd8d60e31b81526004810182905283906001600160a01b038216906342966c6890602401600060405180830381600087803b1580156109ad57600080fd5b505af19250505080156109be575060015b6109f6576109f66001600160a01b0384167f0000000000000000000000000000000000000000000000000000000000000000846127a0565b50610aa6565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905283169063a9059cbb906044016020604051808303816000875af1925050508015610a67575060408051601f3d908101601f19168201909252610a6491810190613a30565b60015b610aa457610a9f6001600160a01b0383167f0000000000000000000000000000000000000000000000000000000000000000836127a0565b610aa6565b505b8360010193505050506108d4565b5060005b83811015610ec5576000610acd600a8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115610b0c57610b0c6138b8565b6003811115610b1d57610b1d6138b8565b815260200160018201805480602002602001604051908101604052809291908181526020018280548015610b7057602002820191906000526020600020905b815481526020019060010190808311610b5c575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610bc857602002820191906000526020600020905b815481526020019060010190808311610bb4575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a790610c08906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015610c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c499190613a30565b15610eb75760005b816040015151811015610eb5576001600160a01b038616610d91576000849050806001600160a01b03166342966c6884604001518481518110610c9657610c96613a01565b60200260200101516040518263ffffffff1660e01b8152600401610cbc91815260200190565b600060405180830381600087803b158015610cd657600080fd5b505af1925050508015610ce7575060015b610d8b57836001600160a01b03166342842e0e307f000000000000000000000000000000000000000000000000000000000000000086604001518681518110610d3257610d32613a01565b60200260200101516040518463ffffffff1660e01b8152600401610d5893929190613a4d565b600060405180830381600087803b158015610d7257600080fd5b505af1158015610d86573d6000803e3d6000fd5b505050505b50610ead565b826001600160a01b03166342842e0e308885604001518581518110610db857610db8613a01565b60200260200101516040518463ffffffff1660e01b8152600401610dde93929190613a4d565b600060405180830381600087803b158015610df857600080fd5b505af1925050508015610e09575060015b610ead57826001600160a01b03166342842e0e307f000000000000000000000000000000000000000000000000000000000000000085604001518581518110610e5457610e54613a01565b60200260200101516040518463ffffffff1660e01b8152600401610e7a93929190613a4d565b600060405180830381600087803b158015610e9457600080fd5b505af1158015610ea8573d6000803e3d6000fd5b505050505b600101610c51565b505b836001019350505050610ab8565b5060005b82811015611269576000610ede600c8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115610f1d57610f1d6138b8565b6003811115610f2e57610f2e6138b8565b815260200160018201805480602002602001604051908101604052809291908181526020018280548015610f8157602002820191906000526020600020905b815481526020019060010190808311610f6d575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610fd957602002820191906000526020600020905b815481526020019060010190808311610fc5575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a79061101990636cdb3d1360e11b906004016134d2565b602060405180830381865afa158015611036573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105a9190613a30565b1561125b576001600160a01b0385166111675760408082015160208301519151631ac8311560e21b815285926001600160a01b03841692636b20c454926110a692309291600401613aac565b600060405180830381600087803b1580156110c057600080fd5b505af19250505080156110d1575060015b6111615760408083015160208401519151631759616b60e11b81526001600160a01b03861692632eb2c2d69261112e9230927f00000000000000000000000000000000000000000000000000000000000000009291600401613aec565b600060405180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050505b5061125b565b60408082015160208301519151631759616b60e11b81526001600160a01b03851692632eb2c2d6926111a09230928b9291600401613aec565b600060405180830381600087803b1580156111ba57600080fd5b505af19250505080156111cb575060015b61125b5760408082015160208301519151631759616b60e11b81526001600160a01b03851692632eb2c2d6926112289230927f00000000000000000000000000000000000000000000000000000000000000009291600401613aec565b600060405180830381600087803b15801561124257600080fd5b505af1158015611256573d6000803e3d6000fd5b505050505b836001019350505050610ec9565b506007546040805191825260208201879052810185905260608101849052608081018390527fd3fca8a3809833d8f402a971dc00f56d78f14f1ad6d43ad90aa395deec28ebbf9060a00160405180910390a1506118d1565b6004546040516000916001600160a01b03169086908381818185875af1925050503d806000811461130e576040519150601f19603f3d011682016040523d82523d6000602084013e611313565b606091505b505090508061133557604051630fe362ff60e21b815260040160405180910390fd5b60005b848110156113e257600061134d60088361278d565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190613a17565b6004549091506113d8906001600160a01b038481169116836127a0565b5050600101611338565b5060005b8381101561163b5760006113fb600a8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff16600381111561143a5761143a6138b8565b600381111561144b5761144b6138b8565b81526020016001820180548060200260200160405190810160405280929190818152602001828054801561149e57602002820191906000526020600020905b81548152602001906001019080831161148a575b50505050508152602001600282018054806020026020016040519081016040528092919081815260200182805480156114f657602002820191906000526020600020905b8154815260200190600101908083116114e2575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a790611536906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015611553573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115779190613a30565b1561162d5760005b81604001515181101561162b57826001600160a01b03166342842e0e30600460009054906101000a90046001600160a01b0316856040015185815181106115c8576115c8613a01565b60200260200101516040518463ffffffff1660e01b81526004016115ee93929190613a4d565b600060405180830381600087803b15801561160857600080fd5b505af115801561161c573d6000803e3d6000fd5b5050505080600101905061157f565b505b8360010193505050506113e6565b5060005b82811015611856576000611654600c8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115611693576116936138b8565b60038111156116a4576116a46138b8565b8152602001600182018054806020026020016040519081016040528092919081815260200182805480156116f757602002820191906000526020600020905b8154815260200190600101908083116116e3575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561174f57602002820191906000526020600020905b81548152602001906001019080831161173b575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a79061178f90636cdb3d1360e11b906004016134d2565b602060405180830381865afa1580156117ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d09190613a30565b15611848576004805460408381015160208501519151631759616b60e11b81526001600160a01b0387811695632eb2c2d6956118159530959390911693909101613aec565b600060405180830381600087803b15801561182f57600080fd5b505af1158015611843573d6000803e3d6000fd5b505050505b83600101935050505061163f565b5060016007600082825461186a9190613b5d565b90915550506004546007546040805191825260208201889052810186905260608101859052608081018490526001600160a01b03909116907f3e8418d56b08633836f00d7a16a5af020b3a46aa031d54bdf0005e03c1ea6ba69060a00160405180910390a2505b5050600180555050565b6002600154036118fd5760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b0316331461192c5760405162461bcd60e51b815260040161064c906139cc565b60065460ff161561195057604051637eb5760360e11b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b03858116918217909355600480549092169284169283179091556040517f36b0e973537cec6363634d2393f62c9798f8c7a0031a30e302b2b413ac0e4be890600090a3505060018055565b6000546001600160a01b031633146119dc5760405162461bcd60e51b815260040161064c906139cc565b6119e66000612808565b565b600260015403611a0a5760405162461bcd60e51b815260040161064c90613995565b60026001553360009081526005602052604090205460ff16611a3f5760405163686023d960e01b815260040160405180910390fd5b6000806000805b8451811015611d93576000858281518110611a6357611a63613a01565b60200260200101516020015190506000868381518110611a8557611a85613a01565b6020026020010151905060016003811115611aa257611aa26138b8565b81516003811115611ab557611ab56138b8565b03611b085760008160400151600081518110611ad357611ad3613a01565b60200260200101519050611af9611ae73390565b6001600160a01b038516903084612858565b611b04600188613b5d565b9650505b600281516003811115611b1d57611b1d6138b8565b03611c5f576040516301ffc9a760e01b815282906001600160a01b038216906301ffc9a790611b57906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015611b74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b989190613a30565b611bb55760405163260e61d560e11b815260040160405180910390fd5b60005b826060015151811015611c4f576001600160a01b0382166342842e0e333086606001518581518110611bec57611bec613a01565b60200260200101516040518463ffffffff1660e01b8152600401611c1293929190613a4d565b600060405180830381600087803b158015611c2c57600080fd5b505af1158015611c40573d6000803e3d6000fd5b50505050806001019050611bb8565b50611c5b600187613b5d565b9550505b600381516003811115611c7457611c746138b8565b03611d89576040516301ffc9a760e01b815282906001600160a01b038216906301ffc9a790611cae90636cdb3d1360e11b906004016134d2565b602060405180830381865afa158015611ccb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cef9190613a30565b611d0c576040516345d7afc960e01b815260040160405180910390fd5b60608201516040808401519051631759616b60e11b81526001600160a01b03841692632eb2c2d692611d4692339230929091600401613aec565b600060405180830381600087803b158015611d6057600080fd5b505af1158015611d74573d6000803e3d6000fd5b50505050600185611d859190613b5d565b9450505b5050600101611a46565b50611d9d8461243d565b6040805134815260208101859052908101839052606081018290527f9b776d199f09c774f5b205c9bc2ac6f40d508c347aaea919867eeaf06ebef0e99060800160405180910390a15050600180555050565b600260015403611e115760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b03163314611e405760405162461bcd60e51b815260040161064c906139cc565b8051600003611e625760405163fa40b62d60e01b815260040160405180910390fd5b60008060008060005b85518110156122c1576000868281518110611e8857611e88613a01565b6020026020010151905060006003811115611ea557611ea56138b8565b81516003811115611eb857611eb86138b8565b03611f675760008160600151600081518110611ed657611ed6613a01565b60200260200101519050600082602001516001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f31576040519150601f19603f3d011682016040523d82523d6000602084013e611f36565b606091505b5050905080611f5857604051630fe362ff60e21b815260040160405180910390fd5b611f628289613b5d565b975050505b600181516003811115611f7c57611f7c6138b8565b03611fd95760008160600151600081518110611f9a57611f9a613a01565b60200260200101519050611fca82602001518284604001516001600160a01b03166127a09092919063ffffffff16565b611fd5600187613b5d565b9550505b600281516003811115611fee57611fee6138b8565b036121375760408082015190516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061202b906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015612048573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206c9190613a30565b6120895760405163260e61d560e11b815260040160405180910390fd5b60005b82608001515181101561212757816001600160a01b03166342842e0e308560200151866080015185815181106120c4576120c4613a01565b60200260200101516040518463ffffffff1660e01b81526004016120ea93929190613a4d565b600060405180830381600087803b15801561210457600080fd5b505af1158015612118573d6000803e3d6000fd5b5050505080600101905061208c565b50612133600186613b5d565b9450505b60038151600381111561214c5761214c6138b8565b036122655760408082015190516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061218990636cdb3d1360e11b906004016134d2565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca9190613a30565b6121e7576040516345d7afc960e01b815260040160405180910390fd5b602082015160808301516060840151604051631759616b60e11b81526001600160a01b03851693632eb2c2d693612222933093600401613aec565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b505050506001846122619190613b5d565b9350505b6122b8604051806080016040528083600001516003811115612289576122896138b8565b815260200183604001516001600160a01b0316815260200183606001518152602001836080015181525061287f565b50600101611e6b565b506040805185815260208101859052908101839052606081018290527f1001480bf7dd22532f4eeef914c161e31e7d76dfaef9955e7523a04abc0840e69060800160405180910390a1505060018055505050565b6000546001600160a01b0316331461233f5760405162461bcd60e51b815260040161064c906139cc565b6001600160a01b0381166123a45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064c565b6123ad81612808565b50565b6002600154036123d25760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b031633146124015760405162461bcd60e51b815260040161064c906139cc565b6006805460ff191660011790556040517faa186e234585182c7568ce5333d181a17ddf037ed0062ba95af526ce81d47cf490600090a160018055565b60005b815181101561275657600182828151811061245d5761245d613a01565b602002602001015160000151600381111561247a5761247a6138b8565b1480156124b557506124b382828151811061249757612497613a01565b6020026020010151602001516008612d4990919063ffffffff16565b155b156124ed576124eb8282815181106124cf576124cf613a01565b6020026020010151602001516008612d6b90919063ffffffff16565b505b600282828151811061250157612501613a01565b602002602001015160000151600381111561251e5761251e6138b8565b148015612559575061255782828151811061253b5761253b613a01565b602002602001015160200151600a612d4990919063ffffffff16565b155b156125915761258f82828151811061257357612573613a01565b602002602001015160200151600a612d6b90919063ffffffff16565b505b60038282815181106125a5576125a5613a01565b60200260200101516000015160038111156125c2576125c26138b8565b1480156125fd57506125fb8282815181106125df576125df613a01565b602002602001015160200151600c612d4990919063ffffffff16565b155b156126355761263382828151811061261757612617613a01565b602002602001015160200151600c612d6b90919063ffffffff16565b505b604051806060016040528083838151811061265257612652613a01565b602002602001015160000151600381111561266f5761266f6138b8565b815260200183838151811061268657612686613a01565b60200260200101516040015181526020018383815181106126a9576126a9613a01565b602002602001015160600151815250600e60008484815181106126ce576126ce613a01565b6020908102919091018101518101516001600160a01b0316825281019190915260400160002081518154829060ff19166001836003811115612712576127126138b8565b0217905550602082810151805161272f9260018501920190613154565b506040820151805161274b916002840191602090910190613154565b505050600101612440565b506040517f9e9713f54b59c699c6ca8ddbd5a61862e103911093e89710d333329afa5512b990600090a150565b6000610596825490565b60006127998383612d80565b9392505050565b6040516001600160a01b03831660248201526044810182905261280390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612daa565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612879846323b872dd60e01b8585856040516024016127cc93929190613a4d565b50505050565b600181516003811115612894576128946138b8565b036129295760208101516040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156128e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129099190613a17565b90508060000361292657602083015161292490600890612e7c565b505b50505b60028151600381111561293e5761293e6138b8565b03612af65760208101516040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561298f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b39190613a17565b9050806000036129d45760208301516129ce90600a90612e7c565b50612af3565b6020808401516001600160a01b03166000908152600e90915260408120600201905b8154811015612af05760005b856060015151811015612ae757600086606001518281518110612a2757612a27613a01565b60200260200101519050838381548110612a4357612a43613a01565b90600052602060002001548103612ade578354612a6290600190613b70565b8314612ab25783548490612a7890600190613b70565b81548110612a8857612a88613a01565b9060005260206000200154848481548110612aa557612aa5613a01565b6000918252602090912001555b83805480612ac257612ac2613b83565b6001900381819060005260206000200160009055905550612ae7565b50600101612a02565b506001016129f6565b50505b50505b600381516003811115612b0b57612b0b6138b8565b036123ad57602080820180516001600160a01b039081166000908152600e90935260408084209251909116835282206002909101916001909101905b8254811015612d2e5760005b846060015151811015612d2557600085606001518281518110612b7857612b78613a01565b60200260200101519050600086604001518381518110612b9a57612b9a613a01565b60200260200101519050858481548110612bb657612bb6613a01565b90600052602060002001548203612d1b57848481548110612bd957612bd9613a01565b90600052602060002001548103612ce2578554612bf890600190613b70565b8414612c915785548690612c0e90600190613b70565b81548110612c1e57612c1e613a01565b9060005260206000200154868581548110612c3b57612c3b613a01565b60009182526020909120015584548590612c5790600190613b70565b81548110612c6757612c67613a01565b9060005260206000200154858581548110612c8457612c84613a01565b6000918252602090912001555b85805480612ca157612ca1613b83565b6001900381819060005260206000200160009055905584805480612cc757612cc7613b83565b60019003818190600052602060002001600090559055612d14565b80858581548110612cf557612cf5613a01565b906000526020600020016000828254612d0e9190613b70565b90915550505b5050612d25565b5050600101612b53565b50600101612b47565b50815460000361280357602083015161287990600c90612e7c565b6001600160a01b03811660009081526001830160205260408120541515612799565b6000612799836001600160a01b038416612e91565b6000826000018281548110612d9757612d97613a01565b9060005260206000200154905092915050565b6000612dff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ee09092919063ffffffff16565b8051909150156128035780806020019051810190612e1d9190613a30565b6128035760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161064c565b6000612799836001600160a01b038416612ef7565b6000818152600183016020526040812054612ed857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610596565b506000610596565b6060612eef8484600085612fea565b949350505050565b60008181526001830160205260408120548015612fe0576000612f1b600183613b70565b8554909150600090612f2f90600190613b70565b9050818114612f94576000866000018281548110612f4f57612f4f613a01565b9060005260206000200154905080876000018481548110612f7257612f72613a01565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612fa557612fa5613b83565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610596565b6000915050610596565b60608247101561304b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161064c565b6001600160a01b0385163b6130a25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161064c565b600080866001600160a01b031685876040516130be9190613b99565b60006040518083038185875af1925050503d80600081146130fb576040519150601f19603f3d011682016040523d82523d6000602084013e613100565b606091505b509150915061311082828661311b565b979650505050505050565b6060831561312a575081612799565b82511561313a5782518084602001fd5b8160405162461bcd60e51b815260040161064c9190613202565b82805482825590600052602060002090810192821561318f579160200282015b8281111561318f578251825591602001919060010190613174565b5061319b92915061319f565b5090565b5b8082111561319b57600081556001016131a0565b6000602082840312156131c657600080fd5b81356001600160e01b03198116811461279957600080fd5b60005b838110156131f95781810151838201526020016131e1565b50506000910152565b60208152600082518060208401526132218160408501602087016131de565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561326e5761326e613235565b60405290565b6040516080810167ffffffffffffffff8111828210171561326e5761326e613235565b60405160a0810167ffffffffffffffff8111828210171561326e5761326e613235565b604051601f8201601f1916810167ffffffffffffffff811182821017156132e3576132e3613235565b604052919050565b600067ffffffffffffffff82111561330557613305613235565b5060051b60200190565b80356001600160a01b038116811461332657600080fd5b919050565b80151581146123ad57600080fd5b6000602080838503121561334c57600080fd5b823567ffffffffffffffff81111561336357600080fd5b8301601f8101851361337457600080fd5b8035613387613382826132eb565b6132ba565b81815260069190911b820183019083810190878311156133a657600080fd5b928401925b8284101561311057604084890312156133c45760008081fd5b6133cc61324b565b6133d58561330f565b8152858501356133e48161332b565b81870152825260409390930192908401906133ab565b600082601f83011261340b57600080fd5b813567ffffffffffffffff81111561342557613425613235565b613438601f8201601f19166020016132ba565b81815284602083860101111561344d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561348057600080fd5b6134898561330f565b93506134976020860161330f565b925060408501359150606085013567ffffffffffffffff8111156134ba57600080fd5b6134c6878288016133fa565b91505092959194509250565b6001600160e01b031991909116815260200190565b80356004811061332657600080fd5b600082601f83011261350757600080fd5b81356020613517613382836132eb565b82815260059290921b8401810191818101908684111561353657600080fd5b8286015b84811015613551578035835291830191830161353a565b509695505050505050565b6000602080838503121561356f57600080fd5b823567ffffffffffffffff8082111561358757600080fd5b818501915085601f83011261359b57600080fd5b81356135a9613382826132eb565b81815260059190911b830184019084810190888311156135c857600080fd5b8585015b8381101561367d578035858111156135e357600080fd5b86016080818c03601f190112156135fa5760008081fd5b613602613274565b61360d8983016134e7565b8152604061361c81840161330f565b8a830152606080840135898111156136345760008081fd5b6136428f8d838801016134f6565b8385015250608084013591508882111561365c5760008081fd5b61366a8e8c848701016134f6565b90830152508452509186019186016135cc565b5098975050505050505050565b6000806040838503121561369d57600080fd5b6136a68361330f565b91506136b46020840161330f565b90509250929050565b600080600080600060a086880312156136d557600080fd5b6136de8661330f565b94506136ec6020870161330f565b9350604086013567ffffffffffffffff8082111561370957600080fd5b61371589838a016134f6565b9450606088013591508082111561372b57600080fd5b61373789838a016134f6565b9350608088013591508082111561374d57600080fd5b5061375a888289016133fa565b9150509295509295909350565b6000602080838503121561377a57600080fd5b823567ffffffffffffffff8082111561379257600080fd5b818501915085601f8301126137a657600080fd5b81356137b4613382826132eb565b81815260059190911b830184019084810190888311156137d357600080fd5b8585015b8381101561367d578035858111156137ee57600080fd5b860160a0818c03601f190112156138055760008081fd5b61380d613297565b6138188983016134e7565b8152604061382781840161330f565b8a830152606061383881850161330f565b828401526080915081840135898111156138525760008081fd5b6138608f8d838801016134f6565b82850152505060a0830135888111156138795760008081fd5b6138878e8c838701016134f6565b91830191909152508452509186019186016137d7565b6000602082840312156138af57600080fd5b6127998261330f565b634e487b7160e01b600052602160045260246000fd5b60208101600483106138f057634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060a0868803121561390e57600080fd5b6139178661330f565b94506139256020870161330f565b93506040860135925060608601359150608086013567ffffffffffffffff81111561394f57600080fd5b61375a888289016133fa565b600181811c9082168061396f57607f821691505b60208210810361398f57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613a2957600080fd5b5051919050565b600060208284031215613a4257600080fd5b81516127998161332b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600081518084526020808501945080840160005b83811015613aa157815187529582019590820190600101613a85565b509495945050505050565b6001600160a01b0384168152606060208201819052600090613ad090830185613a71565b8281036040840152613ae28185613a71565b9695505050505050565b6001600160a01b0385811682528416602082015260a060408201819052600090613b1890830185613a71565b8281036060840152613b2a8185613a71565b838103608090940193909352505060008152602001949350505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561059657610596613b47565b8181038181111561059657610596613b47565b634e487b7160e01b600052603160045260246000fd5b60008251613bab8184602087016131de565b919091019291505056fea26469706673582212205962ac3e40c0c1bbbd7273e3251c6ad2f10a84e3c77fcd471afa4ededaaf263b64736f6c6343000810003300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000ae4d498ee9288f67c5cf15921f1680d0155c0d8e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000eeeeeeee13395ead20444602ab017275e4533945000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000095661756c742054776f0000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061016a5760003560e01c8063b38fcb19116100d1578063d25220d21161008a578063f23a6e6111610064578063f23a6e61146104ee578063f2fde38b1461051a578063f83d08ba1461053a578063fcde1dc11461054f57600080fd5b8063d25220d214610461578063eed75f6d14610481578063f11b8188146104b157600080fd5b8063b38fcb1914610394578063b63e5bc6146103a7578063b96fbcb7146103c7578063bc197c81146103e7578063c153cc3514610413578063cd2aaa481461042d57600080fd5b8063328b86f611610123578063328b86f6146102f75780634700d3051461031757806354fd4d501461032c5780636eacbd8714610341578063715018a6146103615780638da5cb5b1461037657600080fd5b806301ffc9a7146101b857806306fdde03146101ed57806308f5516c1461020f578063090209d014610251578063150b7a021461027357806329bc4c34146102ab57600080fd5b366101b3577fd6717f327e0cb88b4a97a7f67a453e9258252c34937ccbdd86de7cb840e7def333604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156101c457600080fd5b506101d86101d33660046131b4565b610565565b60405190151581526020015b60405180910390f35b3480156101f957600080fd5b5061020261059c565b6040516101e49190613202565b34801561021b57600080fd5b506102437f000000000000000000000000000000000000000000000000000000000000000381565b6040519081526020016101e4565b34801561025d57600080fd5b5061027161026c366004613339565b61062a565b005b34801561027f57600080fd5b5061029e61028e36600461346a565b630a85bd0160e11b949350505050565b6040516101e491906134d2565b3480156102b757600080fd5b506102df7f000000000000000000000000eeeeeeee13395ead20444602ab017275e453394581565b6040516001600160a01b0390911681526020016101e4565b34801561030357600080fd5b5061027161031236600461355c565b61072e565b34801561032357600080fd5b5061027161078f565b34801561033857600080fd5b50610243600281565b34801561034d57600080fd5b5061027161035c36600461368a565b6118db565b34801561036d57600080fd5b506102716119b2565b34801561038257600080fd5b506000546001600160a01b03166102df565b6102716103a236600461355c565b6119e8565b3480156103b357600080fd5b506003546102df906001600160a01b031681565b3480156103d357600080fd5b506004546102df906001600160a01b031681565b3480156103f357600080fd5b5061029e6104023660046136bd565b63bc197c8160e01b95945050505050565b34801561041f57600080fd5b506006546101d89060ff1681565b34801561043957600080fd5b506102df7f000000000000000000000000000000000000000000000000000000000000dead81565b34801561046d57600080fd5b5061027161047c366004613767565b611def565b34801561048d57600080fd5b506101d861049c36600461389d565b60056020526000908152604090205460ff1681565b3480156104bd57600080fd5b506104e16104cc36600461389d565b600e6020526000908152604090205460ff1681565b6040516101e491906138ce565b3480156104fa57600080fd5b5061029e6105093660046138f6565b63f23a6e6160e01b95945050505050565b34801561052657600080fd5b5061027161053536600461389d565b612315565b34801561054657600080fd5b506102716123b0565b34801561055b57600080fd5b5061024360075481565b60006001600160e01b03198216630271189760e51b148061059657506301ffc9a760e01b6001600160e01b03198316145b92915050565b600280546105a99061395b565b80601f01602080910402602001604051908101604052809291908181526020018280546105d59061395b565b80156106225780601f106105f757610100808354040283529160200191610622565b820191906000526020600020905b81548152906001019060200180831161060557829003601f168201915b505050505081565b6002600154036106555760405162461bcd60e51b815260040161064c90613995565b60405180910390fd5b60026001556000546001600160a01b031633146106845760405162461bcd60e51b815260040161064c906139cc565b60005b81518110156107265760008282815181106106a4576106a4613a01565b602090810291909101810151808201805182516001600160a01b03908116600090815260058652604090819020805460ff19169315159390931790925583519251915191151582529294509116917f7a1c66af088657be8056e5d428b01e4258763977949a676689da12a50d262250910160405180910390a250600101610687565b505060018055565b6002600154036107505760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b0316331461077f5760405162461bcd60e51b815260040161064c906139cc565b6107888161243d565b5060018055565b6002600154036107b15760405162461bcd60e51b815260040161064c90613995565b60026001556003546001600160a01b031633146107e1576040516305003d7d60e21b815260040160405180910390fd5b4760006107ee6008612783565b905060006107fc600a612783565b9050600061080a600c612783565b90507f0000000000000000000000000000000000000000000000000000000000000003600754148061084557506004546001600160a01b0316155b156112c1576004547f000000000000000000000000eeeeeeee13395ead20444602ab017275e4533945906001600160a01b0316610880575060005b6040516001600160a01b038216908690600081818185875af1925050503d80600081146108c9576040519150601f19603f3d011682016040523d82523d6000602084013e6108ce565b606091505b50505060005b84811015610ab45760006108e960088361278d565b6040516370a0823160e01b815230600482015290915081906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610935573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109599190613a17565b90506001600160a01b0385166109fc57604051630852cd8d60e31b81526004810182905283906001600160a01b038216906342966c6890602401600060405180830381600087803b1580156109ad57600080fd5b505af19250505080156109be575060015b6109f6576109f66001600160a01b0384167f000000000000000000000000000000000000000000000000000000000000dead846127a0565b50610aa6565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905283169063a9059cbb906044016020604051808303816000875af1925050508015610a67575060408051601f3d908101601f19168201909252610a6491810190613a30565b60015b610aa457610a9f6001600160a01b0383167f000000000000000000000000000000000000000000000000000000000000dead836127a0565b610aa6565b505b8360010193505050506108d4565b5060005b83811015610ec5576000610acd600a8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115610b0c57610b0c6138b8565b6003811115610b1d57610b1d6138b8565b815260200160018201805480602002602001604051908101604052809291908181526020018280548015610b7057602002820191906000526020600020905b815481526020019060010190808311610b5c575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610bc857602002820191906000526020600020905b815481526020019060010190808311610bb4575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a790610c08906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015610c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c499190613a30565b15610eb75760005b816040015151811015610eb5576001600160a01b038616610d91576000849050806001600160a01b03166342966c6884604001518481518110610c9657610c96613a01565b60200260200101516040518263ffffffff1660e01b8152600401610cbc91815260200190565b600060405180830381600087803b158015610cd657600080fd5b505af1925050508015610ce7575060015b610d8b57836001600160a01b03166342842e0e307f000000000000000000000000000000000000000000000000000000000000dead86604001518681518110610d3257610d32613a01565b60200260200101516040518463ffffffff1660e01b8152600401610d5893929190613a4d565b600060405180830381600087803b158015610d7257600080fd5b505af1158015610d86573d6000803e3d6000fd5b505050505b50610ead565b826001600160a01b03166342842e0e308885604001518581518110610db857610db8613a01565b60200260200101516040518463ffffffff1660e01b8152600401610dde93929190613a4d565b600060405180830381600087803b158015610df857600080fd5b505af1925050508015610e09575060015b610ead57826001600160a01b03166342842e0e307f000000000000000000000000000000000000000000000000000000000000dead85604001518581518110610e5457610e54613a01565b60200260200101516040518463ffffffff1660e01b8152600401610e7a93929190613a4d565b600060405180830381600087803b158015610e9457600080fd5b505af1158015610ea8573d6000803e3d6000fd5b505050505b600101610c51565b505b836001019350505050610ab8565b5060005b82811015611269576000610ede600c8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115610f1d57610f1d6138b8565b6003811115610f2e57610f2e6138b8565b815260200160018201805480602002602001604051908101604052809291908181526020018280548015610f8157602002820191906000526020600020905b815481526020019060010190808311610f6d575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610fd957602002820191906000526020600020905b815481526020019060010190808311610fc5575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a79061101990636cdb3d1360e11b906004016134d2565b602060405180830381865afa158015611036573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105a9190613a30565b1561125b576001600160a01b0385166111675760408082015160208301519151631ac8311560e21b815285926001600160a01b03841692636b20c454926110a692309291600401613aac565b600060405180830381600087803b1580156110c057600080fd5b505af19250505080156110d1575060015b6111615760408083015160208401519151631759616b60e11b81526001600160a01b03861692632eb2c2d69261112e9230927f000000000000000000000000000000000000000000000000000000000000dead9291600401613aec565b600060405180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050505b5061125b565b60408082015160208301519151631759616b60e11b81526001600160a01b03851692632eb2c2d6926111a09230928b9291600401613aec565b600060405180830381600087803b1580156111ba57600080fd5b505af19250505080156111cb575060015b61125b5760408082015160208301519151631759616b60e11b81526001600160a01b03851692632eb2c2d6926112289230927f000000000000000000000000000000000000000000000000000000000000dead9291600401613aec565b600060405180830381600087803b15801561124257600080fd5b505af1158015611256573d6000803e3d6000fd5b505050505b836001019350505050610ec9565b506007546040805191825260208201879052810185905260608101849052608081018390527fd3fca8a3809833d8f402a971dc00f56d78f14f1ad6d43ad90aa395deec28ebbf9060a00160405180910390a1506118d1565b6004546040516000916001600160a01b03169086908381818185875af1925050503d806000811461130e576040519150601f19603f3d011682016040523d82523d6000602084013e611313565b606091505b505090508061133557604051630fe362ff60e21b815260040160405180910390fd5b60005b848110156113e257600061134d60088361278d565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190613a17565b6004549091506113d8906001600160a01b038481169116836127a0565b5050600101611338565b5060005b8381101561163b5760006113fb600a8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff16600381111561143a5761143a6138b8565b600381111561144b5761144b6138b8565b81526020016001820180548060200260200160405190810160405280929190818152602001828054801561149e57602002820191906000526020600020905b81548152602001906001019080831161148a575b50505050508152602001600282018054806020026020016040519081016040528092919081815260200182805480156114f657602002820191906000526020600020905b8154815260200190600101908083116114e2575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a790611536906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015611553573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115779190613a30565b1561162d5760005b81604001515181101561162b57826001600160a01b03166342842e0e30600460009054906101000a90046001600160a01b0316856040015185815181106115c8576115c8613a01565b60200260200101516040518463ffffffff1660e01b81526004016115ee93929190613a4d565b600060405180830381600087803b15801561160857600080fd5b505af115801561161c573d6000803e3d6000fd5b5050505080600101905061157f565b505b8360010193505050506113e6565b5060005b82811015611856576000611654600c8361278d565b6001600160a01b0381166000908152600e602052604080822081516060810190925280549394508493829060ff166003811115611693576116936138b8565b60038111156116a4576116a46138b8565b8152602001600182018054806020026020016040519081016040528092919081815260200182805480156116f757602002820191906000526020600020905b8154815260200190600101908083116116e3575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561174f57602002820191906000526020600020905b81548152602001906001019080831161173b575b5050509190925250506040516301ffc9a760e01b8152919250506001600160a01b038316906301ffc9a79061178f90636cdb3d1360e11b906004016134d2565b602060405180830381865afa1580156117ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d09190613a30565b15611848576004805460408381015160208501519151631759616b60e11b81526001600160a01b0387811695632eb2c2d6956118159530959390911693909101613aec565b600060405180830381600087803b15801561182f57600080fd5b505af1158015611843573d6000803e3d6000fd5b505050505b83600101935050505061163f565b5060016007600082825461186a9190613b5d565b90915550506004546007546040805191825260208201889052810186905260608101859052608081018490526001600160a01b03909116907f3e8418d56b08633836f00d7a16a5af020b3a46aa031d54bdf0005e03c1ea6ba69060a00160405180910390a2505b5050600180555050565b6002600154036118fd5760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b0316331461192c5760405162461bcd60e51b815260040161064c906139cc565b60065460ff161561195057604051637eb5760360e11b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b03858116918217909355600480549092169284169283179091556040517f36b0e973537cec6363634d2393f62c9798f8c7a0031a30e302b2b413ac0e4be890600090a3505060018055565b6000546001600160a01b031633146119dc5760405162461bcd60e51b815260040161064c906139cc565b6119e66000612808565b565b600260015403611a0a5760405162461bcd60e51b815260040161064c90613995565b60026001553360009081526005602052604090205460ff16611a3f5760405163686023d960e01b815260040160405180910390fd5b6000806000805b8451811015611d93576000858281518110611a6357611a63613a01565b60200260200101516020015190506000868381518110611a8557611a85613a01565b6020026020010151905060016003811115611aa257611aa26138b8565b81516003811115611ab557611ab56138b8565b03611b085760008160400151600081518110611ad357611ad3613a01565b60200260200101519050611af9611ae73390565b6001600160a01b038516903084612858565b611b04600188613b5d565b9650505b600281516003811115611b1d57611b1d6138b8565b03611c5f576040516301ffc9a760e01b815282906001600160a01b038216906301ffc9a790611b57906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015611b74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b989190613a30565b611bb55760405163260e61d560e11b815260040160405180910390fd5b60005b826060015151811015611c4f576001600160a01b0382166342842e0e333086606001518581518110611bec57611bec613a01565b60200260200101516040518463ffffffff1660e01b8152600401611c1293929190613a4d565b600060405180830381600087803b158015611c2c57600080fd5b505af1158015611c40573d6000803e3d6000fd5b50505050806001019050611bb8565b50611c5b600187613b5d565b9550505b600381516003811115611c7457611c746138b8565b03611d89576040516301ffc9a760e01b815282906001600160a01b038216906301ffc9a790611cae90636cdb3d1360e11b906004016134d2565b602060405180830381865afa158015611ccb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cef9190613a30565b611d0c576040516345d7afc960e01b815260040160405180910390fd5b60608201516040808401519051631759616b60e11b81526001600160a01b03841692632eb2c2d692611d4692339230929091600401613aec565b600060405180830381600087803b158015611d6057600080fd5b505af1158015611d74573d6000803e3d6000fd5b50505050600185611d859190613b5d565b9450505b5050600101611a46565b50611d9d8461243d565b6040805134815260208101859052908101839052606081018290527f9b776d199f09c774f5b205c9bc2ac6f40d508c347aaea919867eeaf06ebef0e99060800160405180910390a15050600180555050565b600260015403611e115760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b03163314611e405760405162461bcd60e51b815260040161064c906139cc565b8051600003611e625760405163fa40b62d60e01b815260040160405180910390fd5b60008060008060005b85518110156122c1576000868281518110611e8857611e88613a01565b6020026020010151905060006003811115611ea557611ea56138b8565b81516003811115611eb857611eb86138b8565b03611f675760008160600151600081518110611ed657611ed6613a01565b60200260200101519050600082602001516001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f31576040519150601f19603f3d011682016040523d82523d6000602084013e611f36565b606091505b5050905080611f5857604051630fe362ff60e21b815260040160405180910390fd5b611f628289613b5d565b975050505b600181516003811115611f7c57611f7c6138b8565b03611fd95760008160600151600081518110611f9a57611f9a613a01565b60200260200101519050611fca82602001518284604001516001600160a01b03166127a09092919063ffffffff16565b611fd5600187613b5d565b9550505b600281516003811115611fee57611fee6138b8565b036121375760408082015190516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061202b906380ac58cd60e01b906004016134d2565b602060405180830381865afa158015612048573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206c9190613a30565b6120895760405163260e61d560e11b815260040160405180910390fd5b60005b82608001515181101561212757816001600160a01b03166342842e0e308560200151866080015185815181106120c4576120c4613a01565b60200260200101516040518463ffffffff1660e01b81526004016120ea93929190613a4d565b600060405180830381600087803b15801561210457600080fd5b505af1158015612118573d6000803e3d6000fd5b5050505080600101905061208c565b50612133600186613b5d565b9450505b60038151600381111561214c5761214c6138b8565b036122655760408082015190516301ffc9a760e01b81526001600160a01b038216906301ffc9a79061218990636cdb3d1360e11b906004016134d2565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca9190613a30565b6121e7576040516345d7afc960e01b815260040160405180910390fd5b602082015160808301516060840151604051631759616b60e11b81526001600160a01b03851693632eb2c2d693612222933093600401613aec565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b505050506001846122619190613b5d565b9350505b6122b8604051806080016040528083600001516003811115612289576122896138b8565b815260200183604001516001600160a01b0316815260200183606001518152602001836080015181525061287f565b50600101611e6b565b506040805185815260208101859052908101839052606081018290527f1001480bf7dd22532f4eeef914c161e31e7d76dfaef9955e7523a04abc0840e69060800160405180910390a1505060018055505050565b6000546001600160a01b0316331461233f5760405162461bcd60e51b815260040161064c906139cc565b6001600160a01b0381166123a45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064c565b6123ad81612808565b50565b6002600154036123d25760405162461bcd60e51b815260040161064c90613995565b60026001556000546001600160a01b031633146124015760405162461bcd60e51b815260040161064c906139cc565b6006805460ff191660011790556040517faa186e234585182c7568ce5333d181a17ddf037ed0062ba95af526ce81d47cf490600090a160018055565b60005b815181101561275657600182828151811061245d5761245d613a01565b602002602001015160000151600381111561247a5761247a6138b8565b1480156124b557506124b382828151811061249757612497613a01565b6020026020010151602001516008612d4990919063ffffffff16565b155b156124ed576124eb8282815181106124cf576124cf613a01565b6020026020010151602001516008612d6b90919063ffffffff16565b505b600282828151811061250157612501613a01565b602002602001015160000151600381111561251e5761251e6138b8565b148015612559575061255782828151811061253b5761253b613a01565b602002602001015160200151600a612d4990919063ffffffff16565b155b156125915761258f82828151811061257357612573613a01565b602002602001015160200151600a612d6b90919063ffffffff16565b505b60038282815181106125a5576125a5613a01565b60200260200101516000015160038111156125c2576125c26138b8565b1480156125fd57506125fb8282815181106125df576125df613a01565b602002602001015160200151600c612d4990919063ffffffff16565b155b156126355761263382828151811061261757612617613a01565b602002602001015160200151600c612d6b90919063ffffffff16565b505b604051806060016040528083838151811061265257612652613a01565b602002602001015160000151600381111561266f5761266f6138b8565b815260200183838151811061268657612686613a01565b60200260200101516040015181526020018383815181106126a9576126a9613a01565b602002602001015160600151815250600e60008484815181106126ce576126ce613a01565b6020908102919091018101518101516001600160a01b0316825281019190915260400160002081518154829060ff19166001836003811115612712576127126138b8565b0217905550602082810151805161272f9260018501920190613154565b506040820151805161274b916002840191602090910190613154565b505050600101612440565b506040517f9e9713f54b59c699c6ca8ddbd5a61862e103911093e89710d333329afa5512b990600090a150565b6000610596825490565b60006127998383612d80565b9392505050565b6040516001600160a01b03831660248201526044810182905261280390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612daa565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612879846323b872dd60e01b8585856040516024016127cc93929190613a4d565b50505050565b600181516003811115612894576128946138b8565b036129295760208101516040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156128e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129099190613a17565b90508060000361292657602083015161292490600890612e7c565b505b50505b60028151600381111561293e5761293e6138b8565b03612af65760208101516040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561298f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b39190613a17565b9050806000036129d45760208301516129ce90600a90612e7c565b50612af3565b6020808401516001600160a01b03166000908152600e90915260408120600201905b8154811015612af05760005b856060015151811015612ae757600086606001518281518110612a2757612a27613a01565b60200260200101519050838381548110612a4357612a43613a01565b90600052602060002001548103612ade578354612a6290600190613b70565b8314612ab25783548490612a7890600190613b70565b81548110612a8857612a88613a01565b9060005260206000200154848481548110612aa557612aa5613a01565b6000918252602090912001555b83805480612ac257612ac2613b83565b6001900381819060005260206000200160009055905550612ae7565b50600101612a02565b506001016129f6565b50505b50505b600381516003811115612b0b57612b0b6138b8565b036123ad57602080820180516001600160a01b039081166000908152600e90935260408084209251909116835282206002909101916001909101905b8254811015612d2e5760005b846060015151811015612d2557600085606001518281518110612b7857612b78613a01565b60200260200101519050600086604001518381518110612b9a57612b9a613a01565b60200260200101519050858481548110612bb657612bb6613a01565b90600052602060002001548203612d1b57848481548110612bd957612bd9613a01565b90600052602060002001548103612ce2578554612bf890600190613b70565b8414612c915785548690612c0e90600190613b70565b81548110612c1e57612c1e613a01565b9060005260206000200154868581548110612c3b57612c3b613a01565b60009182526020909120015584548590612c5790600190613b70565b81548110612c6757612c67613a01565b9060005260206000200154858581548110612c8457612c84613a01565b6000918252602090912001555b85805480612ca157612ca1613b83565b6001900381819060005260206000200160009055905584805480612cc757612cc7613b83565b60019003818190600052602060002001600090559055612d14565b80858581548110612cf557612cf5613a01565b906000526020600020016000828254612d0e9190613b70565b90915550505b5050612d25565b5050600101612b53565b50600101612b47565b50815460000361280357602083015161287990600c90612e7c565b6001600160a01b03811660009081526001830160205260408120541515612799565b6000612799836001600160a01b038416612e91565b6000826000018281548110612d9757612d97613a01565b9060005260206000200154905092915050565b6000612dff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ee09092919063ffffffff16565b8051909150156128035780806020019051810190612e1d9190613a30565b6128035760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161064c565b6000612799836001600160a01b038416612ef7565b6000818152600183016020526040812054612ed857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610596565b506000610596565b6060612eef8484600085612fea565b949350505050565b60008181526001830160205260408120548015612fe0576000612f1b600183613b70565b8554909150600090612f2f90600190613b70565b9050818114612f94576000866000018281548110612f4f57612f4f613a01565b9060005260206000200154905080876000018481548110612f7257612f72613a01565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612fa557612fa5613b83565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610596565b6000915050610596565b60608247101561304b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161064c565b6001600160a01b0385163b6130a25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161064c565b600080866001600160a01b031685876040516130be9190613b99565b60006040518083038185875af1925050503d80600081146130fb576040519150601f19603f3d011682016040523d82523d6000602084013e613100565b606091505b509150915061311082828661311b565b979650505050505050565b6060831561312a575081612799565b82511561313a5782518084602001fd5b8160405162461bcd60e51b815260040161064c9190613202565b82805482825590600052602060002090810192821561318f579160200282015b8281111561318f578251825591602001919060010190613174565b5061319b92915061319f565b5090565b5b8082111561319b57600081556001016131a0565b6000602082840312156131c657600080fd5b81356001600160e01b03198116811461279957600080fd5b60005b838110156131f95781810151838201526020016131e1565b50506000910152565b60208152600082518060208401526132218160408501602087016131de565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561326e5761326e613235565b60405290565b6040516080810167ffffffffffffffff8111828210171561326e5761326e613235565b60405160a0810167ffffffffffffffff8111828210171561326e5761326e613235565b604051601f8201601f1916810167ffffffffffffffff811182821017156132e3576132e3613235565b604052919050565b600067ffffffffffffffff82111561330557613305613235565b5060051b60200190565b80356001600160a01b038116811461332657600080fd5b919050565b80151581146123ad57600080fd5b6000602080838503121561334c57600080fd5b823567ffffffffffffffff81111561336357600080fd5b8301601f8101851361337457600080fd5b8035613387613382826132eb565b6132ba565b81815260069190911b820183019083810190878311156133a657600080fd5b928401925b8284101561311057604084890312156133c45760008081fd5b6133cc61324b565b6133d58561330f565b8152858501356133e48161332b565b81870152825260409390930192908401906133ab565b600082601f83011261340b57600080fd5b813567ffffffffffffffff81111561342557613425613235565b613438601f8201601f19166020016132ba565b81815284602083860101111561344d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561348057600080fd5b6134898561330f565b93506134976020860161330f565b925060408501359150606085013567ffffffffffffffff8111156134ba57600080fd5b6134c6878288016133fa565b91505092959194509250565b6001600160e01b031991909116815260200190565b80356004811061332657600080fd5b600082601f83011261350757600080fd5b81356020613517613382836132eb565b82815260059290921b8401810191818101908684111561353657600080fd5b8286015b84811015613551578035835291830191830161353a565b509695505050505050565b6000602080838503121561356f57600080fd5b823567ffffffffffffffff8082111561358757600080fd5b818501915085601f83011261359b57600080fd5b81356135a9613382826132eb565b81815260059190911b830184019084810190888311156135c857600080fd5b8585015b8381101561367d578035858111156135e357600080fd5b86016080818c03601f190112156135fa5760008081fd5b613602613274565b61360d8983016134e7565b8152604061361c81840161330f565b8a830152606080840135898111156136345760008081fd5b6136428f8d838801016134f6565b8385015250608084013591508882111561365c5760008081fd5b61366a8e8c848701016134f6565b90830152508452509186019186016135cc565b5098975050505050505050565b6000806040838503121561369d57600080fd5b6136a68361330f565b91506136b46020840161330f565b90509250929050565b600080600080600060a086880312156136d557600080fd5b6136de8661330f565b94506136ec6020870161330f565b9350604086013567ffffffffffffffff8082111561370957600080fd5b61371589838a016134f6565b9450606088013591508082111561372b57600080fd5b61373789838a016134f6565b9350608088013591508082111561374d57600080fd5b5061375a888289016133fa565b9150509295509295909350565b6000602080838503121561377a57600080fd5b823567ffffffffffffffff8082111561379257600080fd5b818501915085601f8301126137a657600080fd5b81356137b4613382826132eb565b81815260059190911b830184019084810190888311156137d357600080fd5b8585015b8381101561367d578035858111156137ee57600080fd5b860160a0818c03601f190112156138055760008081fd5b61380d613297565b6138188983016134e7565b8152604061382781840161330f565b8a830152606061383881850161330f565b828401526080915081840135898111156138525760008081fd5b6138608f8d838801016134f6565b82850152505060a0830135888111156138795760008081fd5b6138878e8c838701016134f6565b91830191909152508452509186019186016137d7565b6000602082840312156138af57600080fd5b6127998261330f565b634e487b7160e01b600052602160045260246000fd5b60208101600483106138f057634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060a0868803121561390e57600080fd5b6139178661330f565b94506139256020870161330f565b93506040860135925060608601359150608086013567ffffffffffffffff81111561394f57600080fd5b61375a888289016133fa565b600181811c9082168061396f57607f821691505b60208210810361398f57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613a2957600080fd5b5051919050565b600060208284031215613a4257600080fd5b81516127998161332b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600081518084526020808501945080840160005b83811015613aa157815187529582019590820190600101613a85565b509495945050505050565b6001600160a01b0384168152606060208201819052600090613ad090830185613a71565b8281036040840152613ae28185613a71565b9695505050505050565b6001600160a01b0385811682528416602082015260a060408201819052600090613b1890830185613a71565b8281036060840152613b2a8185613a71565b838103608090940193909352505060008152602001949350505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561059657610596613b47565b8181038181111561059657610596613b47565b634e487b7160e01b600052603160045260246000fd5b60008251613bab8184602087016131de565b919091019291505056fea26469706673582212205962ac3e40c0c1bbbd7273e3251c6ad2f10a84e3c77fcd471afa4ededaaf263b64736f6c63430008100033

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

00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000ae4d498ee9288f67c5cf15921f1680d0155c0d8e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000eeeeeeee13395ead20444602ab017275e4533945000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000095661756c742054776f0000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Vault Two
Arg [1] : _panicOwner (address): 0xAe4d498Ee9288F67c5Cf15921f1680D0155c0d8E
Arg [2] : _panicDestination (address): 0x0000000000000000000000000000000000000000
Arg [3] : _panicLimit (uint256): 3
Arg [4] : _evacuationDestination (address): 0xEEEEEEee13395EAd20444602ab017275E4533945
Arg [5] : _backupBurnDestination (address): 0x000000000000000000000000000000000000dEaD

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 000000000000000000000000ae4d498ee9288f67c5cf15921f1680d0155c0d8e
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [4] : 000000000000000000000000eeeeeeee13395ead20444602ab017275e4533945
Arg [5] : 000000000000000000000000000000000000000000000000000000000000dead
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [7] : 5661756c742054776f0000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.