Contract 0x92ba0953f8cea4ce596ce3422bd3962416ef111d 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x434c79d28055f6d83d81d9b04874bacf6e9f1011fe3da80743b09dbdc9abd4d5Capture2018616762024-04-17 5:57:0642 mins ago0xcf911e8cd853286c5d1e22178738db80b9f15008 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000434 0.01
0x73307b200fbab6b1232406be218a16830b2b33268f5205e468c4f1d9d6da8eb6Capture2018609222024-04-17 5:53:4845 mins ago0xcf911e8cd853286c5d1e22178738db80b9f15008 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000437 0.01
0xb0eb7b9eb760b82389ed64119b7d252bc7981a49b54a418f510567d237cd223cCapture2018526572024-04-17 5:18:531 hr 20 mins ago0xdeed2dd82d82f7a785a2c7131605837a6a56cba7 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00001373 0.01
0x67eef76adf084ee3d9fe591a8e88a68ea59f540a153c2dccaa85906a43abd4c5Capture2018474412024-04-17 4:56:361 hr 42 mins ago0x6189717673e1ed5da55080d0898c70f91d2784d0 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000009580.01
0x336f5225f73dc30118599e85e5239eaac06d97837539220b9a38355d46f70755Capture2018161912024-04-17 2:44:553 hrs 54 mins ago0x9243fed0055c8aeaa31baf425c3e96c19de9cd43 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000398 0.01
0x3a7d3d50f43487acb72e253ecd23d61ff9e4e3f7690870a32543c2e3de0d6150Capture2018084082024-04-17 2:12:084 hrs 27 mins ago0x7939dd1154247695146f069df6374b808f6d95dd IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000967 0.01
0x33776fe306ee1eeeca77b59bb23e8eaa9de178bca376d30b427263a23ce3c714Capture2017914012024-04-17 0:59:475 hrs 39 mins ago0x7e655f4cf388267be54ccd66302457569887c274 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00001328 0.01
0x185c233c8d908d6048037636ea131356ea957dcef60ceb5c1aeec06b88114bb0Capture2017856212024-04-17 0:35:226 hrs 4 mins ago0xb8702d021ced6674d43f817aa325f00ae05e7eb0 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000746 0.01
0x5e82c080d482f6ca99e4f27a95d940e203bd0be5f57357ec3faca6b1e74f8e6bCapture2017855352024-04-17 0:35:006 hrs 4 mins ago0x7d2b1bfe5664928e26c9d74cf1904d825a793ec8 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000746 0.01
0x2594e1be2a95792213a7b6fa51255ea6423932bf1ad10f45a4cb2b8ab5d6f3cbCapture2017815382024-04-17 0:18:056 hrs 21 mins ago0x92caa39f24eb9877001bd050133080b285d9b889 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00001858 0.01
0x7c49ee800cd2f682b513330c8e24bf53beb4191a07fb8aab12089c981111c590Capture2017607932024-04-16 22:50:407 hrs 48 mins ago0xdbba8a6454669aa8867dc9557682dcb646ea9f51 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00001234 0.01
0xf05662877dc6837bd6bf3d6d26979d7150d3a94b58f938ffc8b4da370ba4a4ceCapture2017544512024-04-16 22:24:028 hrs 15 mins ago0xf7a44792b4cfddeace37672221b4c7b09c40f9c2 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000003930.01
0xcca126830058dde340668bf3f058f6acc417df0242591e53cd39c9502cb61f65Capture2017459202024-04-16 21:47:568 hrs 51 mins ago0x504552190ee73a58ce0c9ad2690e82f67ef14479 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000007110.011999
0xd5cb482531f3d0ce10669c34bfe6b7fd79eaad0c57322a70927d2a1aa7561b07Capture2017454742024-04-16 21:46:048 hrs 53 mins ago0xa4c4141637eac06d6ad22d9e354058eabdca684a IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00003511 0.01
0x788fcd36e60690f7673d4fa593dfce5d28cc115a03f8afdec0977765852256b9Capture2017445222024-04-16 21:42:008 hrs 57 mins ago0xca432d0e2a7014679c3671597a6863892e511ebd IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000022790.01
0xca870b63b827a01e6cff88ae59a34f357368e7bf679e325e0ad1adfe65517061Capture2017432862024-04-16 21:36:449 hrs 2 mins ago0x9281dcf84ca14f0663028c53674c663a849cb36b IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000605 0.01
0x8b0722024c15aceeaebf602f0b21af89cac04475d59d302836398777fa58c0daCapture2017318042024-04-16 20:47:459 hrs 51 mins ago0x49b31bd6f6625e2a0353ca7030049feefca5db97 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000007950.01
0xd43d56e758721abadf01c75e2d7f6bf3f4ef84b9daef2e253506372f84d65bc7Capture2017287592024-04-16 20:35:0110 hrs 4 mins ago0x71d1988c74a2321a4e71b99490a4d61c72fe2c96 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000008630.01
0x420152d536cee555f225d77783409975719b582033e2409b07ea3d92efb68615Capture2017170022024-04-16 19:45:3810 hrs 53 mins ago0xe58bc0de746eb83efaef6eebd55e9ecced6346fa IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.0000266 0.01
0xeb23226346f803bf2031979341e005e501a72fe690a2c1898e3eec8ff966f98fCapture2017168302024-04-16 19:44:5310 hrs 54 mins ago0x565eec140f8cc346f0b2fcce7342a1cbdf4f5fdd IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00002313 0.01
0xdddb0247b93172405ebe9959125416561f952fe92c8d14ec1a4980f5c62d76f8Capture2017165622024-04-16 19:43:4510 hrs 55 mins ago0x565eec140f8cc346f0b2fcce7342a1cbdf4f5fdd IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000673 0.01
0x0bdb272d3e5c9d9a7abe973b391e8588a838bbc5154977171ce180ee17aa502cCapture2017161062024-04-16 19:41:4510 hrs 57 mins ago0xe58bc0de746eb83efaef6eebd55e9ecced6346fa IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00002625 0.01
0x122013e28592a0cfc8fb0970ad1d32c75dd749ecc59c5e1ff4e2b040cc6105fbCapture2016723142024-04-16 16:35:2414 hrs 3 mins ago0x789d5b85b3e88ec2d1ba8579c88c36f4d75386cd IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00000937 0.010161
0xb8e08101d015868d4e215c2095e7a00bf2317c025c934c423a527409e065457cCapture2016596442024-04-16 15:41:0514 hrs 58 mins ago0x5a49d30d54d0f05b76b6e65f42d627da10eaf0c1 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.00006652 0.015895
0xfb44ede0d4e173f7864d212a27dd68c564ccdd5789b05ade5f25f060b77cea06Capture2016588532024-04-16 15:37:4115 hrs 1 min ago0xc95b7339a006b5a1eb1d8e500e80019547627a89 IN  0x92ba0953f8cea4ce596ce3422bd3962416ef111d0 ETH0.000007730.012966
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ParticleMinter

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 18 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 2 of 18 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

File 3 of 18 : IERC20.sol
// 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);
}

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

pragma solidity ^0.8.0;

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

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

File 5 of 18 : IAdventurerGateway.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IAdventurerGateway {
  function checkAddress(address _addr, bytes32[] calldata _proof) external view;
}

File 6 of 18 : IBatchAdventurerData.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

uint constant ADVENTURER_DATA_BASE = 0;
uint constant ADVENTURER_DATA_AOV = 1;
uint constant ADVENTURER_DATA_EXTENSION = 2;

interface IBatchAdventurerData {
  function add(address _addr, uint256 _id, uint256 _type, uint256 _prop, uint256 _val) external;

  function addBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256[][] calldata _prop,
    uint256[][] calldata _val
  ) external;

  function addBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256 _prop,
    uint256 _val
  ) external;

  function addBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256 _prop,
    uint256[] calldata _val
  ) external;

  function update(address _addr, uint256 _id, uint256 _type, uint256 _prop, uint256 _val) external;

  function updateRaw(address _addr, uint256 _id, uint256 _type, uint24[10] calldata _val) external;

  function updateBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256 _prop,
    uint256[] calldata _val
  ) external;

  function updateBatchRaw(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint24[10][] calldata _val
  ) external;

  function remove(address _addr, uint256 _id, uint256 _type, uint256 _prop, uint256 _val) external;

  function removeBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256[][] calldata _prop,
    uint256[][] calldata _val
  ) external;

  function get(address _addr, uint256 _id, uint256 _type, uint256 _prop) external returns (uint256);

  function getRaw(address _addr, uint256 _id, uint256 _type) external returns (uint24[10] memory);

  function getMulti(
    address _addr,
    uint256 _id,
    uint256 _type,
    uint256[] calldata _prop
  ) external returns (uint256[] memory result);

  function getBatch(
    address[] calldata _addr,
    uint256[] calldata _id,
    uint256 _type,
    uint256 _prop
  ) external returns (uint256[] memory);

  function getBatchMulti(
    address[] calldata _addrs,
    uint256[] calldata _ids,
    uint256 _type,
    uint256[] calldata _props
  ) external returns (uint256[][] memory);

  function getRawBatch(
    address[] calldata _addrs,
    uint256[] calldata _ids,
    uint256 _type
  ) external returns (uint24[10][] memory result);
}

File 7 of 18 : TraitConstants.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.17;

library traits {
  uint256 public constant ADV_TRAIT_GROUP_BASE = 0;

  // Base, _type = 0
  uint256 public constant ADV_TRAIT_BASE_LEVEL = 0;
  uint256 public constant ADV_TRAIT_BASE_XP = 1;
  uint256 public constant ADV_TRAIT_BASE_STRENGTH = 2;
  uint256 public constant ADV_TRAIT_BASE_DEXTERITY = 3;
  uint256 public constant ADV_TRAIT_BASE_CONSTITUTION = 4;
  uint256 public constant ADV_TRAIT_BASE_INTELLIGENCE = 5;
  uint256 public constant ADV_TRAIT_BASE_WISDOM = 6;
  uint256 public constant ADV_TRAIT_BASE_CHARISMA = 7;
  uint256 public constant ADV_TRAIT_BASE_CLASS = 8;

  uint256 public constant ADV_TRAIT_GROUP_ADVANCED = 1;
  // Advanced, _type = 1
  uint256 public constant ADV_TRAIT_ADVANCED_ARCHETYPE = 0;
  uint256 public constant ADV_TRAIT_ADVANCED_PROFESSION = 1;
  uint256 public constant ADV_TRAIT_ADVANCED_TRAINING_POINTS = 2;

  // Base Ttraits
  // See AdventurerData.sol for details
  uint256 public constant LEGACY_ADV_BASE_TRAIT_XP = 0;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_XP_BROKEN = 1;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_STRENGTH = 2;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_DEXTERITY = 3;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_CONSTITUTION = 4;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_INTELLIGENCE = 5;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_WISDOM = 6;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_CHARISMA = 7;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_HP = 8;
  uint256 public constant LEGACY_ADV_BASE_TRAIT_HP_USED = 9;

  // AoV Traits
  // See AdventurerData.sol for details
  uint256 public constant LEGACY_ADV_AOV_TRAIT_LEVEL = 0;
  uint256 public constant LEGACY_ADV_AOV_TRAIT_ARCHETYPE = 1;
  uint256 public constant LEGACY_ADV_AOV_TRAIT_CLASS = 2;
  uint256 public constant LEGACY_ADV_AOV_TRAIT_PROFESSION = 3;

  function baseTraitNames() public pure returns (string[10] memory) {
    return [
      "Level",
      "XP",
      "Strength",
      "Dexterity",
      "Constitution",
      "Intelligence",
      "Wisdom",
      "Charisma",
      "Class",
      ""
    ];
  }

  function advancedTraitNames() public pure returns (string[2] memory) {
    return ["Archetype", "Profession"];
  }

  function baseTraitName(uint256 traitId) public pure returns (string memory) {
    return baseTraitNames()[traitId];
  }

  function advancedTraitName(uint256 traitId) public pure returns (string memory) {
    return advancedTraitNames()[traitId];
  }
}

File 8 of 18 : IData.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IData {
  function data(
    uint256 _realmId,
    uint256 _type
  ) external view returns (uint256);

  function collect(uint256 _realmId) external;

  function addToBuildQueue(
    uint256 _realmId,
    uint256 _queueSlot,
    uint256 _hours
  ) external;

  function addGoldSupply(uint256 _realmId, uint256 _gold) external;

  function add(uint256 _realmId, uint256 _type, uint256 _amount) external;

  function remove(uint256 _realmId, uint256 _type, uint256 _amount) external;

  function addBonus(uint256 _realmId, uint256 _type, uint256 _amount) external;

  function removeBonus(
    uint256 _realmId,
    uint256 _type,
    uint256 _amount
  ) external;

  function addDataName(uint256 _type, string memory _name) external;
}

File 9 of 18 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import "./IERC721A.sol";

/**
 * @dev ERC721 token receiver interface.
 */
interface ERC721A__IERC721Receiver {
  function onERC721Received(
    address operator,
    address from,
    uint256 tokenId,
    bytes calldata data
  ) external returns (bytes4);
}

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
 * including the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at `_startTokenId()`
 * (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
  // Mask of an entry in packed address data.
  uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

  // The bit position of `numberMinted` in packed address data.
  uint256 private constant BITPOS_NUMBER_MINTED = 64;

  // The bit position of `numberBurned` in packed address data.
  uint256 private constant BITPOS_NUMBER_BURNED = 128;

  // The bit position of `aux` in packed address data.
  uint256 private constant BITPOS_AUX = 192;

  // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
  uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

  // The bit position of `startTimestamp` in packed ownership.
  uint256 private constant BITPOS_START_TIMESTAMP = 160;

  // The bit mask of the `burned` bit in packed ownership.
  uint256 private constant BITMASK_BURNED = 1 << 224;

  // The bit position of the `nextInitialized` bit in packed ownership.
  uint256 private constant BITPOS_NEXT_INITIALIZED = 225;

  // The bit mask of the `nextInitialized` bit in packed ownership.
  uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;

  // The bit position of `extraData` in packed ownership.
  uint256 private constant BITPOS_EXTRA_DATA = 232;

  // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
  uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

  // The mask of the lower 160 bits for addresses.
  uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;

  // The maximum `quantity` that can be minted with `_mintERC2309`.
  // This limit is to prevent overflows on the address data entries.
  // For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309`
  // is required to cause an overflow, which is unrealistic.
  uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

  // The tokenId of the next token to be minted.
  uint256 private _currentIndex;

  // The number of tokens burned.
  uint256 private _burnCounter;

  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Mapping from token ID to ownership details
  // An empty struct value does not necessarily mean the token is unowned.
  // See `_packedOwnershipOf` implementation for details.
  //
  // Bits Layout:
  // - [0..159]   `addr`
  // - [160..223] `startTimestamp`
  // - [224]      `burned`
  // - [225]      `nextInitialized`
  // - [232..255] `extraData`
  mapping(uint256 => uint256) private _packedOwnerships;

  // Mapping owner address to address data.
  //
  // Bits Layout:
  // - [0..63]    `balance`
  // - [64..127]  `numberMinted`
  // - [128..191] `numberBurned`
  // - [192..255] `aux`
  mapping(address => uint256) private _packedAddressData;

  // 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;

  constructor(string memory name_, string memory symbol_) {
    _name = name_;
    _symbol = symbol_;
    _currentIndex = _startTokenId();
  }

  /**
   * @dev Returns the starting token ID.
   * To change the starting token ID, please override this function.
   */
  function _startTokenId() internal view virtual returns (uint256) {
    return 0;
  }

  /**
   * @dev Returns the next token ID to be minted.
   */
  function _nextTokenId() internal view returns (uint256) {
    return _currentIndex;
  }

  /**
   * @dev Returns the total number of tokens in existence.
   * Burned tokens will reduce the count.
   * To get the total number of tokens minted, please see `_totalMinted`.
   */
  function totalSupply() public view override returns (uint256) {
    // Counter underflow is impossible as _burnCounter cannot be incremented
    // more than `_currentIndex - _startTokenId()` times.
    unchecked {
      return _currentIndex - _burnCounter - _startTokenId();
    }
  }

  /**
   * @dev Returns the total amount of tokens minted in the contract.
   */
  function _totalMinted() internal view returns (uint256) {
    // Counter underflow is impossible as _currentIndex does not decrement,
    // and it is initialized to `_startTokenId()`
    unchecked {
      return _currentIndex - _startTokenId();
    }
  }

  /**
   * @dev Returns the total number of tokens burned.
   */
  function _totalBurned() internal view returns (uint256) {
    return _burnCounter;
  }

  /**
   * @dev See {IERC165-supportsInterface}.
   */
  function supportsInterface(
    bytes4 interfaceId
  ) public view virtual override returns (bool) {
    // The interface IDs are constants representing the first 4 bytes of the XOR of
    // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
    // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
    return
      interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
      interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
      interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
  }

  /**
   * @dev See {IERC721-balanceOf}.
   */
  function balanceOf(address owner) public view override returns (uint256) {
    if (owner == address(0)) revert BalanceQueryForZeroAddress();
    return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;
  }

  /**
   * Returns the number of tokens minted by `owner`.
   */
  function _numberMinted(address owner) internal view returns (uint256) {
    return
      (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) &
      BITMASK_ADDRESS_DATA_ENTRY;
  }

  /**
   * Returns the number of tokens burned by or on behalf of `owner`.
   */
  function _numberBurned(address owner) internal view returns (uint256) {
    return
      (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) &
      BITMASK_ADDRESS_DATA_ENTRY;
  }

  /**
   * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
   */
  function _getAux(address owner) internal view returns (uint64) {
    return uint64(_packedAddressData[owner] >> BITPOS_AUX);
  }

  /**
   * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
   * If there are multiple variables, please pack them into a uint64.
   */
  function _setAux(address owner, uint64 aux) internal {
    uint256 packed = _packedAddressData[owner];
    uint256 auxCasted;
    // Cast `aux` with assembly to avoid redundant masking.
    assembly {
      auxCasted := aux
    }
    packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
    _packedAddressData[owner] = packed;
  }

  /**
   * Returns the packed ownership data of `tokenId`.
   */
  function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
    uint256 curr = tokenId;

    unchecked {
      if (_startTokenId() <= curr)
        if (curr < _currentIndex) {
          uint256 packed = _packedOwnerships[curr];
          // If not burned.
          if (packed & BITMASK_BURNED == 0) {
            // Invariant:
            // There will always be an ownership that has an address and is not burned
            // before an ownership that does not have an address and is not burned.
            // Hence, curr will not underflow.
            //
            // We can directly compare the packed value.
            // If the address is zero, packed is zero.
            while (packed == 0) {
              packed = _packedOwnerships[--curr];
            }
            return packed;
          }
        }
    }
    revert OwnerQueryForNonexistentToken();
  }

  /**
   * Returns the unpacked `TokenOwnership` struct from `packed`.
   */
  function _unpackedOwnership(
    uint256 packed
  ) private pure returns (TokenOwnership memory ownership) {
    ownership.addr = address(uint160(packed));
    ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);
    ownership.burned = packed & BITMASK_BURNED != 0;
    ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA);
  }

  /**
   * Returns the unpacked `TokenOwnership` struct at `index`.
   */
  function _ownershipAt(
    uint256 index
  ) internal view returns (TokenOwnership memory) {
    return _unpackedOwnership(_packedOwnerships[index]);
  }

  /**
   * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
   */
  function _initializeOwnershipAt(uint256 index) internal {
    if (_packedOwnerships[index] == 0) {
      _packedOwnerships[index] = _packedOwnershipOf(index);
    }
  }

  /**
   * Gas spent here starts off proportional to the maximum mint batch size.
   * It gradually moves to O(1) as tokens get transferred around in the collection over time.
   */
  function _ownershipOf(
    uint256 tokenId
  ) internal view returns (TokenOwnership memory) {
    return _unpackedOwnership(_packedOwnershipOf(tokenId));
  }

  /**
   * @dev Packs ownership data into a single uint256.
   */
  function _packOwnershipData(
    address owner,
    uint256 flags
  ) private view returns (uint256 result) {
    assembly {
      // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
      owner := and(owner, BITMASK_ADDRESS)
      // `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`.
      result := or(owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags))
    }
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(uint256 tokenId) public view override returns (address) {
    return address(uint160(_packedOwnershipOf(tokenId)));
  }

  /**
   * @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) {
    if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

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

  /**
   * @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, it can be overridden in child contracts.
   */
  function _baseURI() internal view virtual returns (string memory) {
    return "";
  }

  /**
   * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
   */
  function _nextInitializedFlag(
    uint256 quantity
  ) private pure returns (uint256 result) {
    // For branchless setting of the `nextInitialized` flag.
    assembly {
      // `(quantity == 1) << BITPOS_NEXT_INITIALIZED`.
      result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
    }
  }

  /**
   * @dev See {IERC721-approve}.
   */
  function approve(address to, uint256 tokenId) public override {
    address owner = ownerOf(tokenId);

    if (_msgSenderERC721A() != owner)
      if (!isApprovedForAll(owner, _msgSenderERC721A())) {
        revert ApprovalCallerNotOwnerNorApproved();
      }

    _tokenApprovals[tokenId] = to;
    emit Approval(owner, to, tokenId);
  }

  /**
   * @dev See {IERC721-getApproved}.
   */
  function getApproved(uint256 tokenId) public view override returns (address) {
    if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

    return _tokenApprovals[tokenId];
  }

  /**
   * @dev See {IERC721-setApprovalForAll}.
   */
  function setApprovalForAll(
    address operator,
    bool approved
  ) public virtual override {
    if (operator == _msgSenderERC721A()) revert ApproveToCaller();

    _operatorApprovals[_msgSenderERC721A()][operator] = approved;
    emit ApprovalForAll(_msgSenderERC721A(), 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-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 {
    transferFrom(from, to, tokenId);
    if (to.code.length != 0)
      if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
        revert TransferToNonERC721ReceiverImplementer();
      }
  }

  /**
   * @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`),
   */
  function _exists(uint256 tokenId) internal view returns (bool) {
    return
      _startTokenId() <= tokenId &&
      tokenId < _currentIndex && // If within bounds,
      _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
  }

  /**
   * @dev Equivalent to `_safeMint(to, quantity, '')`.
   */
  function _safeMint(address to, uint256 quantity) internal returns (uint256) {
    return _safeMint(to, quantity, "");
  }

  /**
   * @dev Safely mints `quantity` tokens and transfers them to `to`.
   *
   * Requirements:
   *
   * - If `to` refers to a smart contract, it must implement
   *   {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
   * - `quantity` must be greater than 0.
   *
   * See {_mint}.
   *
   * Emits a {Transfer} event for each mint.
   */
  function _safeMint(
    address to,
    uint256 quantity,
    bytes memory _data
  ) internal returns (uint256) {
    uint256 startTokenId = _mint(to, quantity);

    unchecked {
      if (to.code.length != 0) {
        uint256 end = _currentIndex;
        uint256 index = end - quantity;
        do {
          if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
            revert TransferToNonERC721ReceiverImplementer();
          }
        } while (index < end);
        // Reentrancy protection.
        if (_currentIndex != end) revert();
      }
    }

    return startTokenId;
  }

  /**
   * @dev Mints `quantity` tokens and transfers them to `to`.
   *
   * Requirements:
   *
   * - `to` cannot be the zero address.
   * - `quantity` must be greater than 0.
   *
   * Emits a {Transfer} event for each mint.
   */
  function _mint(address to, uint256 quantity) internal returns (uint256) {
    uint256 startTokenId = _currentIndex;
    if (to == address(0)) revert MintToZeroAddress();
    if (quantity == 0) revert MintZeroQuantity();

    _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    // Overflows are incredibly unrealistic.
    // `balance` and `numberMinted` have a maximum limit of 2**64.
    // `tokenId` has a maximum limit of 2**256.
    unchecked {
      // Updates:
      // - `balance += quantity`.
      // - `numberMinted += quantity`.
      //
      // We can directly add to the `balance` and `numberMinted`.
      _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

      // Updates:
      // - `address` to the owner.
      // - `startTimestamp` to the timestamp of minting.
      // - `burned` to `false`.
      // - `nextInitialized` to `quantity == 1`.
      _packedOwnerships[startTokenId] = _packOwnershipData(
        to,
        _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
      );

      uint256 tokenId = startTokenId;
      uint256 end = startTokenId + quantity;
      do {
        emit Transfer(address(0), to, tokenId++);
      } while (tokenId < end);

      _currentIndex = end;
    }
    _afterTokenTransfers(address(0), to, startTokenId, quantity);

    return startTokenId;
  }

  /**
   * @dev Mints `quantity` tokens and transfers them to `to`.
   *
   * This function is intended for efficient minting only during contract creation.
   *
   * It emits only one {ConsecutiveTransfer} as defined in
   * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
   * instead of a sequence of {Transfer} event(s).
   *
   * Calling this function outside of contract creation WILL make your contract
   * non-compliant with the ERC721 standard.
   * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
   * {ConsecutiveTransfer} event is only permissible during contract creation.
   *
   * Requirements:
   *
   * - `to` cannot be the zero address.
   * - `quantity` must be greater than 0.
   *
   * Emits a {ConsecutiveTransfer} event.
   */
  function _mintERC2309(address to, uint256 quantity) internal {
    uint256 startTokenId = _currentIndex;
    if (to == address(0)) revert MintToZeroAddress();
    if (quantity == 0) revert MintZeroQuantity();
    if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT)
      revert MintERC2309QuantityExceedsLimit();

    _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
    unchecked {
      // Updates:
      // - `balance += quantity`.
      // - `numberMinted += quantity`.
      //
      // We can directly add to the `balance` and `numberMinted`.
      _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

      // Updates:
      // - `address` to the owner.
      // - `startTimestamp` to the timestamp of minting.
      // - `burned` to `false`.
      // - `nextInitialized` to `quantity == 1`.
      _packedOwnerships[startTokenId] = _packOwnershipData(
        to,
        _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
      );

      emit ConsecutiveTransfer(
        startTokenId,
        startTokenId + quantity - 1,
        address(0),
        to
      );

      _currentIndex = startTokenId + quantity;
    }
    _afterTokenTransfers(address(0), to, startTokenId, quantity);
  }

  /**
   * @dev Returns the storage slot and value for the approved address of `tokenId`.
   */
  function _getApprovedAddress(
    uint256 tokenId
  )
    private
    view
    returns (uint256 approvedAddressSlot, address approvedAddress)
  {
    mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
    // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
    assembly {
      // Compute the slot.
      mstore(0x00, tokenId)
      mstore(0x20, tokenApprovalsPtr.slot)
      approvedAddressSlot := keccak256(0x00, 0x40)
      // Load the slot's value from storage.
      approvedAddress := sload(approvedAddressSlot)
    }
  }

  /**
   * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
   */
  function _isOwnerOrApproved(
    address approvedAddress,
    address from,
    address msgSender
  ) private pure returns (bool result) {
    assembly {
      // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
      from := and(from, BITMASK_ADDRESS)
      // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
      msgSender := and(msgSender, BITMASK_ADDRESS)
      // `msgSender == from || msgSender == approvedAddress`.
      result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
    }
  }

  /**
   * @dev Transfers `tokenId` from `from` to `to`.
   *
   * Requirements:
   *
   * - `to` cannot be the zero address.
   * - `tokenId` token must be owned by `from`.
   *
   * Emits a {Transfer} event.
   */
  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  ) public virtual override {
    uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

    if (address(uint160(prevOwnershipPacked)) != from)
      revert TransferFromIncorrectOwner();

    (
      uint256 approvedAddressSlot,
      address approvedAddress
    ) = _getApprovedAddress(tokenId);

    // The nested ifs save around 20+ gas over a compound boolean condition.
    if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
      if (!isApprovedForAll(from, _msgSenderERC721A()))
        revert TransferCallerNotOwnerNorApproved();

    if (to == address(0)) revert TransferToZeroAddress();

    _beforeTokenTransfers(from, to, tokenId, 1);

    // Clear approvals from the previous owner.
    assembly {
      if approvedAddress {
        // This is equivalent to `delete _tokenApprovals[tokenId]`.
        sstore(approvedAddressSlot, 0)
      }
    }

    // Underflow of the sender's balance is impossible because we check for
    // ownership above and the recipient's balance can't realistically overflow.
    // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
    unchecked {
      // We can directly increment and decrement the balances.
      --_packedAddressData[from]; // Updates: `balance -= 1`.
      ++_packedAddressData[to]; // Updates: `balance += 1`.

      // Updates:
      // - `address` to the next owner.
      // - `startTimestamp` to the timestamp of transfering.
      // - `burned` to `false`.
      // - `nextInitialized` to `true`.
      _packedOwnerships[tokenId] = _packOwnershipData(
        to,
        BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
      );

      // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
      if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
        uint256 nextTokenId = tokenId + 1;
        // If the next slot's address is zero and not burned (i.e. packed value is zero).
        if (_packedOwnerships[nextTokenId] == 0) {
          // If the next slot is within bounds.
          if (nextTokenId != _currentIndex) {
            // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
            _packedOwnerships[nextTokenId] = prevOwnershipPacked;
          }
        }
      }
    }

    emit Transfer(from, to, tokenId);
    _afterTokenTransfers(from, to, tokenId, 1);
  }

  /**
   * @dev Equivalent to `_burn(tokenId, false)`.
   */
  function _burn(uint256 tokenId) internal virtual {
    _burn(tokenId, false);
  }

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

    address from = address(uint160(prevOwnershipPacked));

    (
      uint256 approvedAddressSlot,
      address approvedAddress
    ) = _getApprovedAddress(tokenId);

    if (approvalCheck) {
      // The nested ifs save around 20+ gas over a compound boolean condition.
      if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
        if (!isApprovedForAll(from, _msgSenderERC721A()))
          revert TransferCallerNotOwnerNorApproved();
    }

    _beforeTokenTransfers(from, address(0), tokenId, 1);

    // Clear approvals from the previous owner.
    assembly {
      if approvedAddress {
        // This is equivalent to `delete _tokenApprovals[tokenId]`.
        sstore(approvedAddressSlot, 0)
      }
    }

    // Underflow of the sender's balance is impossible because we check for
    // ownership above and the recipient's balance can't realistically overflow.
    // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
    unchecked {
      // Updates:
      // - `balance -= 1`.
      // - `numberBurned += 1`.
      //
      // We can directly decrement the balance, and increment the number burned.
      // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`.
      _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;

      // Updates:
      // - `address` to the last owner.
      // - `startTimestamp` to the timestamp of burning.
      // - `burned` to `true`.
      // - `nextInitialized` to `true`.
      _packedOwnerships[tokenId] = _packOwnershipData(
        from,
        (BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) |
          _nextExtraData(from, address(0), prevOwnershipPacked)
      );

      // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
      if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
        uint256 nextTokenId = tokenId + 1;
        // If the next slot's address is zero and not burned (i.e. packed value is zero).
        if (_packedOwnerships[nextTokenId] == 0) {
          // If the next slot is within bounds.
          if (nextTokenId != _currentIndex) {
            // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
            _packedOwnerships[nextTokenId] = prevOwnershipPacked;
          }
        }
      }
    }

    emit Transfer(from, address(0), tokenId);
    _afterTokenTransfers(from, address(0), tokenId, 1);

    // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
    unchecked {
      _burnCounter++;
    }
  }

  /**
   * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received(
    address from,
    address to,
    uint256 tokenId,
    bytes memory _data
  ) private returns (bool) {
    try
      ERC721A__IERC721Receiver(to).onERC721Received(
        _msgSenderERC721A(),
        from,
        tokenId,
        _data
      )
    returns (bytes4 retval) {
      return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
    } catch (bytes memory reason) {
      if (reason.length == 0) {
        revert TransferToNonERC721ReceiverImplementer();
      } else {
        assembly {
          revert(add(32, reason), mload(reason))
        }
      }
    }
  }

  /**
   * @dev Directly sets the extra data for the ownership data `index`.
   */
  function _setExtraDataAt(uint256 index, uint24 extraData) internal {
    uint256 packed = _packedOwnerships[index];
    if (packed == 0) revert OwnershipNotInitializedForExtraData();
    uint256 extraDataCasted;
    // Cast `extraData` with assembly to avoid redundant masking.
    assembly {
      extraDataCasted := extraData
    }
    packed =
      (packed & BITMASK_EXTRA_DATA_COMPLEMENT) |
      (extraDataCasted << BITPOS_EXTRA_DATA);
    _packedOwnerships[index] = packed;
  }

  /**
   * @dev Returns the next extra data for the packed ownership data.
   * The returned result is shifted into position.
   */
  function _nextExtraData(
    address from,
    address to,
    uint256 prevOwnershipPacked
  ) private view returns (uint256) {
    uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);
    return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;
  }

  /**
   * @dev Called during each token transfer to set the 24bit `extraData` field.
   * Intended to be overridden by the cosumer contract.
   *
   * `previousExtraData` - the value of `extraData` before transfer.
   *
   * 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, `tokenId` will be burned by `from`.
   * - `from` and `to` are never both zero.
   */
  function _extraData(
    address from,
    address to,
    uint24 previousExtraData
  ) internal view virtual returns (uint24) {}

  /**
   * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred.
   * This includes minting.
   * And also called before burning one token.
   *
   * startTokenId - the first token id to be transferred
   * quantity - the amount to be transferred
   *
   * 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, `tokenId` will be burned by `from`.
   * - `from` and `to` are never both zero.
   */
  function _beforeTokenTransfers(
    address from,
    address to,
    uint256 startTokenId,
    uint256 quantity
  ) internal virtual {}

  /**
   * @dev Hook that is called after a set of serially-ordered token ids have been transferred.
   * This includes minting.
   * And also called after one token has been burned.
   *
   * startTokenId - the first token id to be transferred
   * quantity - the amount to be transferred
   *
   * Calling conditions:
   *
   * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
   * transferred to `to`.
   * - When `from` is zero, `tokenId` has been minted for `to`.
   * - When `to` is zero, `tokenId` has been burned by `from`.
   * - `from` and `to` are never both zero.
   */
  function _afterTokenTransfers(
    address from,
    address to,
    uint256 startTokenId,
    uint256 quantity
  ) internal virtual {}

  /**
   * @dev Returns the message sender (defaults to `msg.sender`).
   *
   * If you are writing GSN compatible contracts, you need to override this function.
   */
  function _msgSenderERC721A() internal view virtual returns (address) {
    return msg.sender;
  }

  /**
   * @dev Converts a `uint256` to its ASCII `string` decimal representation.
   */
  function _toString(uint256 value) internal pure returns (string memory ptr) {
    assembly {
      // The maximum value of a uint256 contains 78 digits (1 byte per digit),
      // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
      // We will need 1 32-byte word to store the length,
      // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
      ptr := add(mload(0x40), 128)
      // Update the free memory pointer to allocate.
      mstore(0x40, ptr)

      // Cache the end of the memory to calculate the length later.
      let end := ptr

      // We write the string from the rightmost digit to the leftmost digit.
      // The following is essentially a do-while loop that also handles the zero case.
      // Costs a bit more than early returning for the zero case,
      // but cheaper in terms of deployment and overall runtime costs.
      for {
        // Initialize and perform the first pass without check.
        let temp := value
        // Move the pointer 1 byte leftwards to point to an empty character slot.
        ptr := sub(ptr, 1)
        // Write the character to the pointer. 48 is the ASCII index of '0'.
        mstore8(ptr, add(48, mod(temp, 10)))
        temp := div(temp, 10)
      } temp {
        // Keep dividing `temp` until zero.
        temp := div(temp, 10)
      } {
        // Body of the for loop.
        ptr := sub(ptr, 1)
        mstore8(ptr, add(48, mod(temp, 10)))
      }

      let length := sub(end, ptr)
      // Move the pointer 32 bytes leftwards to make room for the length.
      ptr := sub(ptr, 32)
      // Store the length.
      mstore(ptr, length)
    }
  }
}

File 10 of 18 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of an ERC721A compliant contract.
 */
interface IERC721A {
  /**
   * The caller must own the token or be an approved operator.
   */
  error ApprovalCallerNotOwnerNorApproved();

  /**
   * The token does not exist.
   */
  error ApprovalQueryForNonexistentToken();

  /**
   * The caller cannot approve to their own address.
   */
  error ApproveToCaller();

  /**
   * Cannot query the balance for the zero address.
   */
  error BalanceQueryForZeroAddress();

  /**
   * Cannot mint to the zero address.
   */
  error MintToZeroAddress();

  /**
   * The quantity of tokens minted must be more than zero.
   */
  error MintZeroQuantity();

  /**
   * The token does not exist.
   */
  error OwnerQueryForNonexistentToken();

  /**
   * The caller must own the token or be an approved operator.
   */
  error TransferCallerNotOwnerNorApproved();

  /**
   * The token must be owned by `from`.
   */
  error TransferFromIncorrectOwner();

  /**
   * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
   */
  error TransferToNonERC721ReceiverImplementer();

  /**
   * Cannot transfer to the zero address.
   */
  error TransferToZeroAddress();

  /**
   * The token does not exist.
   */
  error URIQueryForNonexistentToken();

  /**
   * The `quantity` minted with ERC2309 exceeds the safety limit.
   */
  error MintERC2309QuantityExceedsLimit();

  /**
   * The `extraData` cannot be set on an unintialized ownership slot.
   */
  error OwnershipNotInitializedForExtraData();

  struct TokenOwnership {
    // The address of the owner.
    address addr;
    // Keeps track of the start time of ownership with minimal overhead for tokenomics.
    uint64 startTimestamp;
    // Whether the token has been burned.
    bool burned;
    // Arbitrary data similar to `startTimestamp` that can be set through `_extraData`.
    uint24 extraData;
  }

  /**
   * @dev Returns the total amount of tokens stored by the contract.
   *
   * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
   */
  function totalSupply() external view returns (uint256);

  // ==============================
  //            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);

  // ==============================
  //            IERC721
  // ==============================

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

  // ==============================
  //        IERC721Metadata
  // ==============================

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

  // ==============================
  //            IERC2309
  // ==============================

  /**
   * @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`,
   * as defined in the ERC2309 standard. See `_mintERC2309` for more details.
   */
  event ConsecutiveTransfer(
    uint256 indexed fromTokenId,
    uint256 toTokenId,
    address indexed from,
    address indexed to
  );
}

File 11 of 18 : IManager.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IManager {
  function isAdmin(address _addr) external view returns (bool);

  function isManager(address _addr, uint256 _type) external view returns (bool);

  function addManager(address _addr, uint256 _type) external;

  function removeManager(address _addr, uint256 _type) external;

  function addAdmin(address _addr) external;

  function removeAdmin(address _addr) external;
}

File 12 of 18 : ManagerModifier.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "../Manager/IManager.sol";

abstract contract ManagerModifier {
  //=======================================
  // Immutables
  //=======================================
  IManager public immutable MANAGER;

  //=======================================
  // Constructor
  //=======================================
  constructor(address _manager) {
    MANAGER = IManager(_manager);
  }

  //=======================================
  // Modifiers
  //=======================================
  modifier onlyAdmin() {
    require(MANAGER.isAdmin(msg.sender), "Manager: Not an Admin");
    _;
  }

  modifier onlyManager() {
    require(MANAGER.isManager(msg.sender, 0), "Manager: Not manager");
    _;
  }

  modifier onlyMinter() {
    require(MANAGER.isManager(msg.sender, 1), "Manager: Not minter");
    _;
  }

  modifier onlyTokenMinter() {
    require(MANAGER.isManager(msg.sender, 2), "Manager: Not token minter");
    _;
  }

  modifier onlyBinder() {
    require(MANAGER.isManager(msg.sender, 3), "Manager: Not binder");
    _;
  }
}

File 13 of 18 : IParticle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IParticle is IERC20 {
  function mintFor(address _for, uint256 _amount) external;
}

File 14 of 18 : IParticleTracker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IParticleTracker {
  function timer(
    address _addr,
    uint256 _adventurerId
  ) external view returns (uint256);

  function currentRealm(
    address _addr,
    uint256 _adventurerId
  ) external view returns (uint256, bool);

  function getExplorerCount(uint256 _realmId) external view returns (uint256);

  function addExplorer(
    uint256 _realmId,
    address _addr,
    uint256 _adventurerId,
    uint256 _amount
  ) external;

  function removeExplorer(
    uint256 _realmId,
    address _addr,
    uint256 _adventurerId,
    uint256 _amount
  ) external;

  function setTimer(address _addr, uint256 _adventurerId) external;
}

File 15 of 18 : ParticleMinter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "../lib/ERC721A.sol";

import "../Realm/IRealm.sol";
import "../Data/IData.sol";
import "../Structure/IStructure.sol";
import "../Particle/IParticle.sol";
import "../Particle/IParticleTracker.sol";
import "../Utils/IPopulation.sol";
import "../Adventurer/IAdventurerGateway.sol";

import "../Manager/ManagerModifier.sol";
import "../Adventurer/IBatchAdventurerData.sol";
import "../Adventurer/TraitConstants.sol";

contract ParticleMinter is ManagerModifier, ReentrancyGuard, Pausable {
  //=======================================
  // Immutables
  //=======================================
  IRealm public immutable REALM;
  IData public immutable DATA;
  IStructure public immutable STRUCTURE;
  IBatchAdventurerData public immutable ADVENTURER_DATA;
  IParticle public immutable PARTICLE;
  IParticleTracker public immutable PARTICLE_TRACKER;
  IPopulation public immutable POPULATION;
  IAdventurerGateway public immutable GATEWAY;
  address public immutable AOV_ADDRESS;

  //=======================================
  // Uints
  //=======================================
  uint256 public adventurerBaseParticle;
  uint256 public realmerBaseParticle;
  uint256 public maxCaptureTime;
  uint256 public explorerWeight;
  uint256 public particleDivider;

  //=======================================
  // Events
  //=======================================
  event Init(uint256 realmId, address addr, uint256 adventurerId);
  event Captured(
    uint256 realmId,
    address addr,
    uint256 adventurerId,
    uint256 adventurerParticles,
    uint256 realmerParticles
  );

  //=======================================
  // Constructor
  //=======================================
  constructor(
    address _realm,
    address _manager,
    address _data,
    address _structure,
    address _adventurerData,
    address _particle,
    address _tracker,
    address _population,
    address _gateway,
    address _aov,
    uint256 _adventurerBaseParticle,
    uint256 _realmerBaseParticle
  ) ManagerModifier(_manager) {
    REALM = IRealm(_realm);
    DATA = IData(_data);
    STRUCTURE = IStructure(_structure);
    ADVENTURER_DATA = IBatchAdventurerData(_adventurerData);
    PARTICLE = IParticle(_particle);
    PARTICLE_TRACKER = IParticleTracker(_tracker);
    POPULATION = IPopulation(_population);
    GATEWAY = IAdventurerGateway(_gateway);

    AOV_ADDRESS = _aov;

    adventurerBaseParticle = _adventurerBaseParticle;
    realmerBaseParticle = _realmerBaseParticle;
    maxCaptureTime = 3600 * 24 * 7;
    explorerWeight = 10;
    particleDivider = 5;
  }

  //=======================================
  // External
  //=======================================

  // With realmIds
  function capture(
    address[] calldata _addresses,
    uint256[] calldata _adventurerIds,
    bytes32[][] calldata _proofs,
    uint256[] calldata _realmIds
  ) external nonReentrant whenNotPaused {
    for (uint256 j = 0; j < _adventurerIds.length; j++) {
      uint256 realmId = _realmIds[j];
      address addr = _addresses[j];
      uint256 adventurerId = _adventurerIds[j];

      // Check validity of address
      _checkAddress(addr, _proofs[j]);

      // Get current Realm exploring
      (uint256 currentRealmId, bool isRealmSet) = PARTICLE_TRACKER.currentRealm(addr, adventurerId);

      // Initialize if Realm is not set
      if (!isRealmSet) {
        // Check sender owns adventurer
        require(
          ERC721A(addr).ownerOf(adventurerId) == msg.sender,
          "ParticleMinter: You do not own Adventurer"
        );

        // Check Realm exists
        REALM.ownerOf(realmId);

        // Check if Realm has enough population
        _checkPopulation(realmId);

        // Set timer
        PARTICLE_TRACKER.setTimer(addr, adventurerId);

        // Add explorer
        PARTICLE_TRACKER.addExplorer(realmId, addr, adventurerId, explorerWeight);

        emit Init(realmId, addr, adventurerId);

        continue;
      }

      // Capture
      _capture(addr, adventurerId, currentRealmId);

      // Check if Realm has enough population
      _checkPopulation(realmId);

      // Remove explorer
      PARTICLE_TRACKER.removeExplorer(currentRealmId, addr, adventurerId, explorerWeight);

      // Add explorer
      PARTICLE_TRACKER.addExplorer(realmId, addr, adventurerId, explorerWeight);
    }
  }

  function capture(
    address[] calldata _addresses,
    uint256[] calldata _adventurerIds,
    bytes32[][] calldata _proofs
  ) external nonReentrant whenNotPaused {
    for (uint256 j = 0; j < _adventurerIds.length; j++) {
      address addr = _addresses[j];
      uint256 adventurerId = _adventurerIds[j];

      // Check validity of address
      _checkAddress(addr, _proofs[j]);

      // Get current Realm exploring
      (uint256 currentRealmId, bool isRealmSet) = PARTICLE_TRACKER.currentRealm(addr, adventurerId);

      // Check current Realm has been set
      require(isRealmSet, "ParticleMinter: You must choose a realm to explore first");

      // Capture
      _capture(addr, adventurerId, currentRealmId);
    }
  }

  function getElapsedTime(address _addr, uint256 _adventurerId) external view returns (uint256) {
    return _elapsedTime(_addr, _adventurerId);
  }

  function particlesAccumulatedForRealmer(
    uint256 _realmId,
    address _addr,
    uint256 _adventurerId
  ) external view returns (uint256) {
    return _totalParticlesForRealmer(_realmId, _addr, _adventurerId);
  }

  function particlesAccumulatedForAdventurer(
    address _addr,
    uint256 _adventurerId
  ) external returns (uint256) {
    return _totalParticlesForAdventurer(_addr, _adventurerId);
  }

  //=======================================
  // Admin
  //=======================================
  function pause() external onlyAdmin {
    _pause();
  }

  function unpause() external onlyAdmin {
    _unpause();
  }

  function updateAdventurerBaseParticle(uint256 _value) external onlyAdmin {
    adventurerBaseParticle = _value;
  }

  function updateRealmerBaseParticle(uint256 _value) external onlyAdmin {
    realmerBaseParticle = _value;
  }

  function updateMaxCaptureTime(uint256 _value) external onlyAdmin {
    maxCaptureTime = _value;
  }

  function updateExplorerWeight(uint256 _value) external onlyAdmin {
    explorerWeight = _value;
  }

  function updateParticleDivider(uint256 _value) external onlyAdmin {
    particleDivider = _value;
  }

  //=======================================
  // Internal
  //=======================================
  function _capture(address _addr, uint256 _adventurerId, uint256 _realmId) internal {
    // Check sender owns adventurer
    require(
      ERC721A(_addr).ownerOf(_adventurerId) == msg.sender,
      "ParticleMinter: You do not own Adventurer"
    );

    // Get total particles for adventurer
    uint256 adventurerParticles = _totalParticlesForAdventurer(_addr, _adventurerId);

    // Mint particles for Adventurer
    PARTICLE.mintFor(msg.sender, adventurerParticles);

    // Get total particles for realmer
    uint256 realmerParticles = _totalParticlesForRealmer(_realmId, _addr, _adventurerId);

    // Mint particles for Realmer
    PARTICLE.mintFor(_realmOwner(_realmId), realmerParticles);

    // Set timer
    PARTICLE_TRACKER.setTimer(_addr, _adventurerId);

    emit Captured(_realmId, _addr, _adventurerId, adventurerParticles, realmerParticles);
  }

  function _totalResources(uint256 _realmId) internal view returns (uint256) {
    uint256 total = DATA.data(_realmId, 0) +
      DATA.data(_realmId, 1) +
      DATA.data(_realmId, 3) +
      DATA.data(_realmId, 5) +
      STRUCTURE.data(_realmId, 0) +
      STRUCTURE.data(_realmId, 1) +
      STRUCTURE.data(_realmId, 2) +
      STRUCTURE.data(_realmId, 3);

    // Check if total is zero, default returned should be 1
    if (total == 0) return 1;

    return total;
  }

  function _totalParticlesForAdventurer(
    address _addr,
    uint256 _adventurerId
  ) internal returns (uint256) {
    uint256 particlesPerSecond = (ADVENTURER_DATA.get(
      _addr,
      _adventurerId,
      traits.ADV_TRAIT_GROUP_BASE,
      traits.ADV_TRAIT_BASE_LEVEL
    ) * adventurerBaseParticle) /
      24 /
      60 /
      60;

    if (_addr != AOV_ADDRESS) {
      particlesPerSecond = particlesPerSecond / particleDivider;
    }

    return _elapsedTime(_addr, _adventurerId) * particlesPerSecond;
  }

  function _totalParticlesForRealmer(
    uint256 _realmId,
    address _addr,
    uint256 _adventurerId
  ) internal view returns (uint256) {
    uint256 particlesPerSecond = (realmerBaseParticle * _totalResources(_realmId)) / 24 / 60 / 60;

    if (_addr != AOV_ADDRESS) {
      particlesPerSecond = particlesPerSecond / particleDivider;
    }

    return _elapsedTime(_addr, _adventurerId) * particlesPerSecond;
  }

  function _elapsedTime(address _addr, uint256 _adventurerId) internal view returns (uint256) {
    // Calculate elapsed time
    uint256 elapsedTime = block.timestamp - PARTICLE_TRACKER.timer(_addr, _adventurerId);

    // Check elapsed time is less than max capture time
    if (elapsedTime > maxCaptureTime) {
      return maxCaptureTime;
    }

    return elapsedTime;
  }

  function _realmOwner(uint256 _realmId) internal view returns (address) {
    return REALM.ownerOf(_realmId);
  }

  function _checkPopulation(uint256 _realmId) internal view {
    require(
      PARTICLE_TRACKER.getExplorerCount(_realmId) < POPULATION.getPopulation(_realmId),
      "ParticleMinter: Max Realm population reached"
    );
  }

  function _checkAddress(address _addr, bytes32[] calldata _proof) internal view {
    // Verify address
    GATEWAY.checkAddress(_addr, _proof);
  }
}

File 16 of 18 : IRealm.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IRealm {
  function balanceOf(address owner) external view returns (uint256);

  function ownerOf(uint256 _realmId) external view returns (address owner);

  function safeTransferFrom(address from, address to, uint256 tokenId) external;

  function isApprovedForAll(
    address owner,
    address operator
  ) external returns (bool);

  function realmFeatures(
    uint256 realmId,
    uint256 index
  ) external view returns (uint256);
}

File 17 of 18 : IStructure.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IStructure {
  function data(
    uint256 _realmId,
    uint256 _type
  ) external view returns (uint256);

  function add(uint256 _realmId, uint256 _type, uint256 _amount) external;

  function remove(uint256 _realmId, uint256 _type, uint256 _amount) external;
}

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

pragma solidity ^0.8.4;

interface IPopulation {
  function getPopulation(uint256 _realmId) external view returns (uint256);
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_realm","type":"address"},{"internalType":"address","name":"_manager","type":"address"},{"internalType":"address","name":"_data","type":"address"},{"internalType":"address","name":"_structure","type":"address"},{"internalType":"address","name":"_adventurerData","type":"address"},{"internalType":"address","name":"_particle","type":"address"},{"internalType":"address","name":"_tracker","type":"address"},{"internalType":"address","name":"_population","type":"address"},{"internalType":"address","name":"_gateway","type":"address"},{"internalType":"address","name":"_aov","type":"address"},{"internalType":"uint256","name":"_adventurerBaseParticle","type":"uint256"},{"internalType":"uint256","name":"_realmerBaseParticle","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"adventurerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"adventurerParticles","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"realmerParticles","type":"uint256"}],"name":"Captured","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"adventurerId","type":"uint256"}],"name":"Init","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADVENTURER_DATA","outputs":[{"internalType":"contract IBatchAdventurerData","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AOV_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DATA","outputs":[{"internalType":"contract IData","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GATEWAY","outputs":[{"internalType":"contract IAdventurerGateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"contract IManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PARTICLE","outputs":[{"internalType":"contract IParticle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PARTICLE_TRACKER","outputs":[{"internalType":"contract IParticleTracker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POPULATION","outputs":[{"internalType":"contract IPopulation","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REALM","outputs":[{"internalType":"contract IRealm","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRUCTURE","outputs":[{"internalType":"contract IStructure","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adventurerBaseParticle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256[]","name":"_adventurerIds","type":"uint256[]"},{"internalType":"bytes32[][]","name":"_proofs","type":"bytes32[][]"},{"internalType":"uint256[]","name":"_realmIds","type":"uint256[]"}],"name":"capture","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256[]","name":"_adventurerIds","type":"uint256[]"},{"internalType":"bytes32[][]","name":"_proofs","type":"bytes32[][]"}],"name":"capture","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"explorerWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"uint256","name":"_adventurerId","type":"uint256"}],"name":"getElapsedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxCaptureTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"particleDivider","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"uint256","name":"_adventurerId","type":"uint256"}],"name":"particlesAccumulatedForAdventurer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"},{"internalType":"uint256","name":"_adventurerId","type":"uint256"}],"name":"particlesAccumulatedForRealmer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"realmerBaseParticle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateAdventurerBaseParticle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateExplorerWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateMaxCaptureTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateParticleDivider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateRealmerBaseParticle","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101c06040523480156200001257600080fd5b506040516200266a3803806200266a8339810160408190526200003591620000c5565b6001600160a01b039a8b1660805260016000819055805460ff191690559a8a1660a05297891660c05295881660e05293871661010052918616610120528516610140528416610160528316610180529091166101a05260025560035562093a80600455600a6005908155600655620001a8565b80516001600160a01b0381168114620000c057600080fd5b919050565b6000806000806000806000806000806000806101808d8f031215620000e957600080fd5b620000f48d620000a8565b9b506200010460208e01620000a8565b9a506200011460408e01620000a8565b99506200012460608e01620000a8565b98506200013460808e01620000a8565b97506200014460a08e01620000a8565b96506200015460c08e01620000a8565b95506200016460e08e01620000a8565b9450620001756101008e01620000a8565b9350620001866101208e01620000a8565b92506101408d015191506101608d015190509295989b509295989b509295989b565b60805160a05160c05160e05161010051610120516101405161016051610180516101a05161235f6200030b600039600081816103a20152818161174d01526118760152600081816102e301526111e10152600081816101ce01526112650152600081816103d20152818161062c015281816107e90152818161087b0152818161097b01528181610a0f01528181610df8015281816110a0015281816112ee01526115b10152600081816103f90152818161148201526114f701526000818161046b01526116b4015260008181610296015281816119da01528181611a6201528181611af20152611b8201526000818161024801528181611c1201528181611ca201528181611d320152611dc20152600081816103600152818161074601526118f401526000818161026f015281816104b701528181610ab101528181610b6601528181610c1401528181610cbd01528181610f230152610fcc015261235f6000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637827d885116100f9578063c1a71c0811610097578063e0ee20c011610071578063e0ee20c014610441578063eaf094da14610454578063eb4de3c41461045d578063fcac08921461046657600080fd5b8063c1a71c08146103f4578063ca7702fa1461041b578063da52aafe1461042e57600080fd5b80638f84cee5116100d35780638f84cee51461038a578063910f1e001461039d578063b4570dba146103c4578063b74c6f76146103cd57600080fd5b80637827d8851461035257806379604a171461035b5780638456cb591461038257600080fd5b80632c280bd3116101665780633f4ba83a116101405780633f4ba83a14610318578063476513fb146103205780635c975abb1461033357806361e6fbfe1461034957600080fd5b80632c280bd3146102cb578063338c5371146102de57806333a878eb1461030557600080fd5b80630c0fd886116101a25780630c0fd886146102435780631b2df8501461026a5780631b62a26b1461029157806321712c73146102b857600080fd5b8063063c1f2f146101c957806306c37c571461020d5780630bd9449b1461022e575b600080fd5b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61022061021b366004611ea3565b61048d565b604051908152602001610204565b61024161023c366004611ecf565b6104a2565b005b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b6102416102c6366004611f34565b610554565b6102416102d9366004611ecf565b610a9c565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b610220610313366004611ea3565b610b45565b610241610b51565b61024161032e366004611ecf565b610bff565b60015460ff166040519015158152602001610204565b61022060055481565b61022060065481565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b610241610ca8565b610241610398366004611ff8565b610d54565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b61022060025481565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b610241610429366004611ecf565b610f0e565b61024161043c366004611ecf565b610fb7565b61022061044f366004612092565b611060565b61022060035481565b61022060045481565b6101f07f000000000000000000000000000000000000000000000000000000000000000081565b60006104998383611075565b90505b92915050565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052a91906120df565b61054f5760405162461bcd60e51b8152600401610546906120fa565b60405180910390fd5b600455565b61055c61112b565b610564611184565b60005b85811015610a8757600083838381811061058357610583612129565b90506020020135905060008a8a848181106105a0576105a0612129565b90506020020160208101906105b5919061213f565b905060008989858181106105cb576105cb612129565b905060200201359050610601828989878181106105ea576105ea612129565b90506020028101906105fc919061215c565b6111ca565b604051639928c11160e01b81526001600160a01b0383811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690639928c111906044016040805180830381865afa158015610672573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069691906121a6565b915091508061092f576040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906121d2565b6001600160a01b0316146107305760405162461bcd60e51b8152600401610546906121ef565b6040516331a9108f60e11b8152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b991906121d2565b506107c38561124f565b6040516306bd653160e21b81526001600160a01b038581166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690631af594c490604401600060405180830381600087803b15801561082d57600080fd5b505af1158015610841573d6000803e3d6000fd5b50506005546040516322a1955f60e11b8152600481018990526001600160a01b0388811660248301526044820188905260648201929092527f000000000000000000000000000000000000000000000000000000000000000090911692506345432abe9150608401600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b5050604080518881526001600160a01b03881660208201529081018690527f2327f5bf59b14c582eb64204b9ff63fc97b98dfd6e660acc6e5de7bb5f1160c39250606001905060405180910390a15050505050610a75565b61093a8484846113c6565b6109438561124f565b600554604051638b5e6a1b60e01b8152600481018490526001600160a01b0386811660248301526044820186905260648201929092527f000000000000000000000000000000000000000000000000000000000000000090911690638b5e6a1b90608401600060405180830381600087803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b50506005546040516322a1955f60e11b8152600481018990526001600160a01b0388811660248301526044820188905260648201929092527f000000000000000000000000000000000000000000000000000000000000000090911692506345432abe9150608401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b5050505050505050505b80610a7f8161224e565b915050610567565b50610a926001600055565b5050505050505050565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906120df565b610b405760405162461bcd60e51b8152600401610546906120fa565b600255565b6000610499838361166e565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd991906120df565b610bf55760405162461bcd60e51b8152600401610546906120fa565b610bfd6117a9565b565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906120df565b610ca35760405162461bcd60e51b8152600401610546906120fa565b600555565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3091906120df565b610d4c5760405162461bcd60e51b8152600401610546906120fa565b610bfd6117fb565b610d5c61112b565b610d64611184565b60005b83811015610efb576000878783818110610d8357610d83612129565b9050602002016020810190610d98919061213f565b90506000868684818110610dae57610dae612129565b905060200201359050610dcd828686868181106105ea576105ea612129565b604051639928c11160e01b81526001600160a01b0383811660048301526024820183905260009182917f00000000000000000000000000000000000000000000000000000000000000001690639928c111906044016040805180830381865afa158015610e3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6291906121a6565b9150915080610ed95760405162461bcd60e51b815260206004820152603860248201527f5061727469636c654d696e7465723a20596f75206d7573742063686f6f73652060448201527f61207265616c6d20746f206578706c6f726520666972737400000000000000006064820152608401610546565b610ee48484846113c6565b505050508080610ef39061224e565b915050610d67565b50610f066001600055565b505050505050565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9691906120df565b610fb25760405162461bcd60e51b8152600401610546906120fa565b600655565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c90602401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f91906120df565b61105b5760405162461bcd60e51b8152600401610546906120fa565b600355565b600061106d848484611836565b949350505050565b60405163d64f83f960e01b81526001600160a01b0383811660048301526024820183905260009182917f0000000000000000000000000000000000000000000000000000000000000000169063d64f83f990604401602060405180830381865afa1580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b9190612267565b6111159042612280565b905060045481111561049957505060045461049c565b60026000540361117d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610546565b6002600055565b60015460ff1615610bfd5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610546565b6040516320be298160e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063417c53029061121a90869086908690600401612293565b60006040518083038186803b15801561123257600080fd5b505afa158015611246573d6000803e3d6000fd5b50505050505050565b604051631634a51d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690631634a51d90602401602060405180830381865afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d89190612267565b6040516308c2855d60e21b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063230a157490602401602060405180830381865afa15801561133d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113619190612267565b106113c35760405162461bcd60e51b815260206004820152602c60248201527f5061727469636c654d696e7465723a204d6178205265616c6d20706f70756c6160448201526b1d1a5bdb881c995858da195960a21b6064820152608401610546565b50565b6040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e90602401602060405180830381865afa15801561140d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143191906121d2565b6001600160a01b0316146114575760405162461bcd60e51b8152600401610546906121ef565b6000611463848461166e565b60405163da1919b360e01b8152336004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063da1919b390604401600060405180830381600087803b1580156114ce57600080fd5b505af11580156114e2573d6000803e3d6000fd5b5050505060006114f3838686611836565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663da1919b361152d856118db565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561157557600080fd5b505af1158015611589573d6000803e3d6000fd5b50506040516306bd653160e21b81526001600160a01b038881166004830152602482018890527f0000000000000000000000000000000000000000000000000000000000000000169250631af594c49150604401600060405180830381600087803b1580156115f757600080fd5b505af115801561160b573d6000803e3d6000fd5b5050604080518681526001600160a01b038916602082015290810187905260608101859052608081018490527f7e9234980f69e2814f45bf433e66a0e95f02697ad3675a6aa7a793e2c1450c75925060a001905060405180910390a15050505050565b600254604051636ca5df7f60e01b81526001600160a01b0384811660048301526024820184905260006044830181905260648301819052928392603c92839260189290917f00000000000000000000000000000000000000000000000000000000000000001690636ca5df7f906084016020604051808303816000875af11580156116fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117219190612267565b61172b91906122dd565b61173591906122f4565b61173f91906122f4565b61174991906122f4565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146117945760065461179190826122f4565b90505b8061179f8585611075565b61106d91906122dd565b6117b1611967565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611803611184565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336117de565b600080603c806018611847886119b0565b60035461185491906122dd565b61185e91906122f4565b61186891906122f4565b61187291906122f4565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146118bd576006546118ba90826122f4565b90505b806118c88585611075565b6118d291906122dd565b95945050505050565b6040516331a9108f60e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049c91906121d2565b60015460ff16610bfd5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610546565b6040516328b9de8f60e11b8152600481018290526003602482015260009081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635173bd1e90604401602060405180830381865afa158015611a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a459190612267565b6040516328b9de8f60e11b815260048101859052600260248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad59190612267565b6040516328b9de8f60e11b815260048101869052600160248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b659190612267565b6040516328b9de8f60e11b815260048101879052600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf59190612267565b6040516328b9de8f60e11b815260048101889052600560248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190612267565b6040516328b9de8f60e11b815260048101899052600360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d159190612267565b6040516328b9de8f60e11b8152600481018a9052600160248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da59190612267565b6040516328b9de8f60e11b8152600481018b9052600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635173bd1e90604401602060405180830381865afa158015611e11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e359190612267565b611e3f9190612316565b611e499190612316565b611e539190612316565b611e5d9190612316565b611e679190612316565b611e719190612316565b611e7b9190612316565b90508060000361049c5750600192915050565b6001600160a01b03811681146113c357600080fd5b60008060408385031215611eb657600080fd5b8235611ec181611e8e565b946020939093013593505050565b600060208284031215611ee157600080fd5b5035919050565b60008083601f840112611efa57600080fd5b50813567ffffffffffffffff811115611f1257600080fd5b6020830191508360208260051b8501011115611f2d57600080fd5b9250929050565b6000806000806000806000806080898b031215611f5057600080fd5b883567ffffffffffffffff80821115611f6857600080fd5b611f748c838d01611ee8565b909a50985060208b0135915080821115611f8d57600080fd5b611f998c838d01611ee8565b909850965060408b0135915080821115611fb257600080fd5b611fbe8c838d01611ee8565b909650945060608b0135915080821115611fd757600080fd5b50611fe48b828c01611ee8565b999c989b5096995094979396929594505050565b6000806000806000806060878903121561201157600080fd5b863567ffffffffffffffff8082111561202957600080fd5b6120358a838b01611ee8565b9098509650602089013591508082111561204e57600080fd5b61205a8a838b01611ee8565b9096509450604089013591508082111561207357600080fd5b5061208089828a01611ee8565b979a9699509497509295939492505050565b6000806000606084860312156120a757600080fd5b8335925060208401356120b981611e8e565b929592945050506040919091013590565b805180151581146120da57600080fd5b919050565b6000602082840312156120f157600080fd5b610499826120ca565b60208082526015908201527426b0b730b3b2b91d102737ba1030b71020b236b4b760591b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561215157600080fd5b813561049981611e8e565b6000808335601e1984360301811261217357600080fd5b83018035915067ffffffffffffffff82111561218e57600080fd5b6020019150600581901b3603821315611f2d57600080fd5b600080604083850312156121b957600080fd5b825191506121c9602084016120ca565b90509250929050565b6000602082840312156121e457600080fd5b815161049981611e8e565b60208082526029908201527f5061727469636c654d696e7465723a20596f7520646f206e6f74206f776e2041604082015268323b32b73a3ab932b960b91b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60006001820161226057612260612238565b5060010190565b60006020828403121561227957600080fd5b5051919050565b8181038181111561049c5761049c612238565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b038311156122c357600080fd5b8260051b8085606085013791909101606001949350505050565b808202811582820484141761049c5761049c612238565b60008261231157634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561049c5761049c61223856fea2646970667358221220cc7fec9cf7d91a7b1a3f1c23c0d388586eece4a4363ea02726b87dc81fa9c32b64736f6c634300081400330000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f91496000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a000000000000000000000000aec1d99ea44b01071befc08c4ecc9b4f1780678d00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e630000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a60000000000000000000000009844fac4e399671ef24f775da12e88cafe0630360000000000000000000000009a9bbffe07ea36295a26b54379596b6d25234dc3000000000000000000000000747910b74d2651a06563c3182838eae4120f427700000000000000000000000000000000000000000000000000b1a2bc2ec500000000000000000000000000000000000000000000000000000000b5e620f48000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637827d885116100f9578063c1a71c0811610097578063e0ee20c011610071578063e0ee20c014610441578063eaf094da14610454578063eb4de3c41461045d578063fcac08921461046657600080fd5b8063c1a71c08146103f4578063ca7702fa1461041b578063da52aafe1461042e57600080fd5b80638f84cee5116100d35780638f84cee51461038a578063910f1e001461039d578063b4570dba146103c4578063b74c6f76146103cd57600080fd5b80637827d8851461035257806379604a171461035b5780638456cb591461038257600080fd5b80632c280bd3116101665780633f4ba83a116101405780633f4ba83a14610318578063476513fb146103205780635c975abb1461033357806361e6fbfe1461034957600080fd5b80632c280bd3146102cb578063338c5371146102de57806333a878eb1461030557600080fd5b80630c0fd886116101a25780630c0fd886146102435780631b2df8501461026a5780631b62a26b1461029157806321712c73146102b857600080fd5b8063063c1f2f146101c957806306c37c571461020d5780630bd9449b1461022e575b600080fd5b6101f07f0000000000000000000000009844fac4e399671ef24f775da12e88cafe06303681565b6040516001600160a01b0390911681526020015b60405180910390f35b61022061021b366004611ea3565b61048d565b604051908152602001610204565b61024161023c366004611ecf565b6104a2565b005b6101f07f000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f9149681565b6101f07f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b5825286181565b6101f07f000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a81565b6102416102c6366004611f34565b610554565b6102416102d9366004611ecf565b610a9c565b6101f07f0000000000000000000000009a9bbffe07ea36295a26b54379596b6d25234dc381565b610220610313366004611ea3565b610b45565b610241610b51565b61024161032e366004611ecf565b610bff565b60015460ff166040519015158152602001610204565b61022060055481565b61022060065481565b6101f07f0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb81565b610241610ca8565b610241610398366004611ff8565b610d54565b6101f07f000000000000000000000000747910b74d2651a06563c3182838eae4120f427781565b61022060025481565b6101f07f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a681565b6101f07f00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e6381565b610241610429366004611ecf565b610f0e565b61024161043c366004611ecf565b610fb7565b61022061044f366004612092565b611060565b61022060035481565b61022060045481565b6101f07f000000000000000000000000aec1d99ea44b01071befc08c4ecc9b4f1780678d81565b60006104998383611075565b90505b92915050565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052a91906120df565b61054f5760405162461bcd60e51b8152600401610546906120fa565b60405180910390fd5b600455565b61055c61112b565b610564611184565b60005b85811015610a8757600083838381811061058357610583612129565b90506020020135905060008a8a848181106105a0576105a0612129565b90506020020160208101906105b5919061213f565b905060008989858181106105cb576105cb612129565b905060200201359050610601828989878181106105ea576105ea612129565b90506020028101906105fc919061215c565b6111ca565b604051639928c11160e01b81526001600160a01b0383811660048301526024820183905260009182917f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a61690639928c111906044016040805180830381865afa158015610672573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069691906121a6565b915091508061092f576040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e90602401602060405180830381865afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906121d2565b6001600160a01b0316146107305760405162461bcd60e51b8152600401610546906121ef565b6040516331a9108f60e11b8152600481018690527f0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb6001600160a01b031690636352211e90602401602060405180830381865afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b991906121d2565b506107c38561124f565b6040516306bd653160e21b81526001600160a01b038581166004830152602482018590527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a61690631af594c490604401600060405180830381600087803b15801561082d57600080fd5b505af1158015610841573d6000803e3d6000fd5b50506005546040516322a1955f60e11b8152600481018990526001600160a01b0388811660248301526044820188905260648201929092527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a690911692506345432abe9150608401600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b5050604080518881526001600160a01b03881660208201529081018690527f2327f5bf59b14c582eb64204b9ff63fc97b98dfd6e660acc6e5de7bb5f1160c39250606001905060405180910390a15050505050610a75565b61093a8484846113c6565b6109438561124f565b600554604051638b5e6a1b60e01b8152600481018490526001600160a01b0386811660248301526044820186905260648201929092527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a690911690638b5e6a1b90608401600060405180830381600087803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b50506005546040516322a1955f60e11b8152600481018990526001600160a01b0388811660248301526044820188905260648201929092527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a690911692506345432abe9150608401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b5050505050505050505b80610a7f8161224e565b915050610567565b50610a926001600055565b5050505050505050565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906120df565b610b405760405162461bcd60e51b8152600401610546906120fa565b600255565b6000610499838361166e565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd991906120df565b610bf55760405162461bcd60e51b8152600401610546906120fa565b610bfd6117a9565b565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906120df565b610ca35760405162461bcd60e51b8152600401610546906120fa565b600555565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3091906120df565b610d4c5760405162461bcd60e51b8152600401610546906120fa565b610bfd6117fb565b610d5c61112b565b610d64611184565b60005b83811015610efb576000878783818110610d8357610d83612129565b9050602002016020810190610d98919061213f565b90506000868684818110610dae57610dae612129565b905060200201359050610dcd828686868181106105ea576105ea612129565b604051639928c11160e01b81526001600160a01b0383811660048301526024820183905260009182917f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a61690639928c111906044016040805180830381865afa158015610e3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6291906121a6565b9150915080610ed95760405162461bcd60e51b815260206004820152603860248201527f5061727469636c654d696e7465723a20596f75206d7573742063686f6f73652060448201527f61207265616c6d20746f206578706c6f726520666972737400000000000000006064820152608401610546565b610ee48484846113c6565b505050508080610ef39061224e565b915050610d67565b50610f066001600055565b505050505050565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa158015610f72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9691906120df565b610fb25760405162461bcd60e51b8152600401610546906120fa565b600655565b604051630935e01b60e21b81523360048201527f0000000000000000000000004e572433a3bfa336b6396d13afc9f69b582528616001600160a01b0316906324d7806c90602401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f91906120df565b61105b5760405162461bcd60e51b8152600401610546906120fa565b600355565b600061106d848484611836565b949350505050565b60405163d64f83f960e01b81526001600160a01b0383811660048301526024820183905260009182917f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a6169063d64f83f990604401602060405180830381865afa1580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b9190612267565b6111159042612280565b905060045481111561049957505060045461049c565b60026000540361117d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610546565b6002600055565b60015460ff1615610bfd5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610546565b6040516320be298160e11b81526001600160a01b037f0000000000000000000000009a9bbffe07ea36295a26b54379596b6d25234dc3169063417c53029061121a90869086908690600401612293565b60006040518083038186803b15801561123257600080fd5b505afa158015611246573d6000803e3d6000fd5b50505050505050565b604051631634a51d60e01b8152600481018290527f0000000000000000000000009844fac4e399671ef24f775da12e88cafe0630366001600160a01b031690631634a51d90602401602060405180830381865afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d89190612267565b6040516308c2855d60e21b8152600481018390527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a66001600160a01b03169063230a157490602401602060405180830381865afa15801561133d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113619190612267565b106113c35760405162461bcd60e51b815260206004820152602c60248201527f5061727469636c654d696e7465723a204d6178205265616c6d20706f70756c6160448201526b1d1a5bdb881c995858da195960a21b6064820152608401610546565b50565b6040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e90602401602060405180830381865afa15801561140d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143191906121d2565b6001600160a01b0316146114575760405162461bcd60e51b8152600401610546906121ef565b6000611463848461166e565b60405163da1919b360e01b8152336004820152602481018290529091507f00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e636001600160a01b03169063da1919b390604401600060405180830381600087803b1580156114ce57600080fd5b505af11580156114e2573d6000803e3d6000fd5b5050505060006114f3838686611836565b90507f00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e636001600160a01b031663da1919b361152d856118db565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561157557600080fd5b505af1158015611589573d6000803e3d6000fd5b50506040516306bd653160e21b81526001600160a01b038881166004830152602482018890527f0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a6169250631af594c49150604401600060405180830381600087803b1580156115f757600080fd5b505af115801561160b573d6000803e3d6000fd5b5050604080518681526001600160a01b038916602082015290810187905260608101859052608081018490527f7e9234980f69e2814f45bf433e66a0e95f02697ad3675a6aa7a793e2c1450c75925060a001905060405180910390a15050505050565b600254604051636ca5df7f60e01b81526001600160a01b0384811660048301526024820184905260006044830181905260648301819052928392603c92839260189290917f000000000000000000000000aec1d99ea44b01071befc08c4ecc9b4f1780678d1690636ca5df7f906084016020604051808303816000875af11580156116fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117219190612267565b61172b91906122dd565b61173591906122f4565b61173f91906122f4565b61174991906122f4565b90507f000000000000000000000000747910b74d2651a06563c3182838eae4120f42776001600160a01b0316846001600160a01b0316146117945760065461179190826122f4565b90505b8061179f8585611075565b61106d91906122dd565b6117b1611967565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611803611184565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336117de565b600080603c806018611847886119b0565b60035461185491906122dd565b61185e91906122f4565b61186891906122f4565b61187291906122f4565b90507f000000000000000000000000747910b74d2651a06563c3182838eae4120f42776001600160a01b0316846001600160a01b0316146118bd576006546118ba90826122f4565b90505b806118c88585611075565b6118d291906122dd565b95945050505050565b6040516331a9108f60e11b8152600481018290526000907f0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb6001600160a01b031690636352211e90602401602060405180830381865afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049c91906121d2565b60015460ff16610bfd5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610546565b6040516328b9de8f60e11b8152600481018290526003602482015260009081906001600160a01b037f000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a1690635173bd1e90604401602060405180830381865afa158015611a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a459190612267565b6040516328b9de8f60e11b815260048101859052600260248201527f000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a6001600160a01b031690635173bd1e90604401602060405180830381865afa158015611ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad59190612267565b6040516328b9de8f60e11b815260048101869052600160248201527f000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a6001600160a01b031690635173bd1e90604401602060405180830381865afa158015611b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b659190612267565b6040516328b9de8f60e11b815260048101879052600060248201527f000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a6001600160a01b031690635173bd1e90604401602060405180830381865afa158015611bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf59190612267565b6040516328b9de8f60e11b815260048101889052600560248201527f000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f914966001600160a01b031690635173bd1e90604401602060405180830381865afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190612267565b6040516328b9de8f60e11b815260048101899052600360248201527f000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f914966001600160a01b031690635173bd1e90604401602060405180830381865afa158015611cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d159190612267565b6040516328b9de8f60e11b8152600481018a9052600160248201527f000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f914966001600160a01b031690635173bd1e90604401602060405180830381865afa158015611d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da59190612267565b6040516328b9de8f60e11b8152600481018b9052600060248201527f000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f914966001600160a01b031690635173bd1e90604401602060405180830381865afa158015611e11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e359190612267565b611e3f9190612316565b611e499190612316565b611e539190612316565b611e5d9190612316565b611e679190612316565b611e719190612316565b611e7b9190612316565b90508060000361049c5750600192915050565b6001600160a01b03811681146113c357600080fd5b60008060408385031215611eb657600080fd5b8235611ec181611e8e565b946020939093013593505050565b600060208284031215611ee157600080fd5b5035919050565b60008083601f840112611efa57600080fd5b50813567ffffffffffffffff811115611f1257600080fd5b6020830191508360208260051b8501011115611f2d57600080fd5b9250929050565b6000806000806000806000806080898b031215611f5057600080fd5b883567ffffffffffffffff80821115611f6857600080fd5b611f748c838d01611ee8565b909a50985060208b0135915080821115611f8d57600080fd5b611f998c838d01611ee8565b909850965060408b0135915080821115611fb257600080fd5b611fbe8c838d01611ee8565b909650945060608b0135915080821115611fd757600080fd5b50611fe48b828c01611ee8565b999c989b5096995094979396929594505050565b6000806000806000806060878903121561201157600080fd5b863567ffffffffffffffff8082111561202957600080fd5b6120358a838b01611ee8565b9098509650602089013591508082111561204e57600080fd5b61205a8a838b01611ee8565b9096509450604089013591508082111561207357600080fd5b5061208089828a01611ee8565b979a9699509497509295939492505050565b6000806000606084860312156120a757600080fd5b8335925060208401356120b981611e8e565b929592945050506040919091013590565b805180151581146120da57600080fd5b919050565b6000602082840312156120f157600080fd5b610499826120ca565b60208082526015908201527426b0b730b3b2b91d102737ba1030b71020b236b4b760591b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561215157600080fd5b813561049981611e8e565b6000808335601e1984360301811261217357600080fd5b83018035915067ffffffffffffffff82111561218e57600080fd5b6020019150600581901b3603821315611f2d57600080fd5b600080604083850312156121b957600080fd5b825191506121c9602084016120ca565b90509250929050565b6000602082840312156121e457600080fd5b815161049981611e8e565b60208082526029908201527f5061727469636c654d696e7465723a20596f7520646f206e6f74206f776e2041604082015268323b32b73a3ab932b960b91b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60006001820161226057612260612238565b5060010190565b60006020828403121561227957600080fd5b5051919050565b8181038181111561049c5761049c612238565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b038311156122c357600080fd5b8260051b8085606085013791909101606001949350505050565b808202811582820484141761049c5761049c612238565b60008261231157634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561049c5761049c61223856fea2646970667358221220cc7fec9cf7d91a7b1a3f1c23c0d388586eece4a4363ea02726b87dc81fa9c32b64736f6c63430008140033

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

0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f91496000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a000000000000000000000000aec1d99ea44b01071befc08c4ecc9b4f1780678d00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e630000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a60000000000000000000000009844fac4e399671ef24f775da12e88cafe0630360000000000000000000000009a9bbffe07ea36295a26b54379596b6d25234dc3000000000000000000000000747910b74d2651a06563c3182838eae4120f427700000000000000000000000000000000000000000000000000b1a2bc2ec500000000000000000000000000000000000000000000000000000000b5e620f48000

-----Decoded View---------------
Arg [0] : _realm (address): 0x4de95c1E202102E22E801590C51D7B979f167FBB
Arg [1] : _manager (address): 0x4E572433A3Bfa336b6396D13AfC9F69b58252861
Arg [2] : _data (address): 0xAae3A78EA8De1b89C64D5c64A26d5b1FC8F91496
Arg [3] : _structure (address): 0xAc3b203e4B6555611A518D05483733b82156CA8a
Arg [4] : _adventurerData (address): 0xaEC1D99ea44b01071Befc08c4ECC9B4f1780678D
Arg [5] : _particle (address): 0x61462FF437b630e0C2f1F4711f5B276c47Af2e63
Arg [6] : _tracker (address): 0x7b37fb0e9Ec8B45dA1a753cCEb0936fd2a84e2A6
Arg [7] : _population (address): 0x9844fac4e399671EF24F775Da12e88CAfE063036
Arg [8] : _gateway (address): 0x9A9BbFfE07Ea36295A26b54379596B6D25234dc3
Arg [9] : _aov (address): 0x747910B74D2651A06563C3182838EAE4120F4277
Arg [10] : _adventurerBaseParticle (uint256): 50000000000000000
Arg [11] : _realmerBaseParticle (uint256): 200000000000000

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb
Arg [1] : 0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861
Arg [2] : 000000000000000000000000aae3a78ea8de1b89c64d5c64a26d5b1fc8f91496
Arg [3] : 000000000000000000000000ac3b203e4b6555611a518d05483733b82156ca8a
Arg [4] : 000000000000000000000000aec1d99ea44b01071befc08c4ecc9b4f1780678d
Arg [5] : 00000000000000000000000061462ff437b630e0c2f1f4711f5b276c47af2e63
Arg [6] : 0000000000000000000000007b37fb0e9ec8b45da1a753cceb0936fd2a84e2a6
Arg [7] : 0000000000000000000000009844fac4e399671ef24f775da12e88cafe063036
Arg [8] : 0000000000000000000000009a9bbffe07ea36295a26b54379596b6d25234dc3
Arg [9] : 000000000000000000000000747910b74d2651a06563c3182838eae4120f4277
Arg [10] : 00000000000000000000000000000000000000000000000000b1a2bc2ec50000
Arg [11] : 0000000000000000000000000000000000000000000000000000b5e620f48000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.