Contract 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222cCollect442166042022-12-07 0:20:0632 secs ago0x898688eba25755568eada6e3f30ef937322bd67d IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00009045
0xe6b258f51473bc7608eac057e552bbf6882cc5c1bbdb7d931571ce080012846fCollect442157642022-12-07 0:13:456 mins ago0xace9bf249a3d28b2471ca2ec655ca42aefd5e27a IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00008787
0xa04c4fbc48f8307ebbb5fba32c0c77d6579adbfdb275c6596584afbec23784fcCollect442096142022-12-06 23:33:0647 mins ago0x901f0655ed6c15955d55c4c6419b9c3fab53479e IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00008796
0xb5a6572329ccea3d693e8354d049dd58f07b0c4308bdd1d092f018169a5d9817Collect442049052022-12-06 23:05:151 hr 15 mins ago0x331164ccc0e0daee2a92a347b51fcf48016fbd7c IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00005728
0xb1977c3390094a33203fd22a9b082cbfcf19e242eca452883c7003df979834a6Collect442047422022-12-06 23:04:191 hr 16 mins ago0x9cf5dec27768855d478152128851ebde74f6a3ed IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00010969
0x655656382e7b44a18b3edccbe694499002c64ec76181264b765f0afc953691e5Collect441985352022-12-06 22:27:061 hr 53 mins ago0xe47a238367162e597e93aff689c54555d350d455 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.0002117
0xe0e9b837a0140133b7fbfc66324582206af9e3398788c305c6c59a9cca393085Collect441929872022-12-06 21:53:572 hrs 26 mins ago0x69f40ae0e91845ac3bdb1cf80d09d662afd30576 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00013857
0x8246ae514d43c8cb357faed6993e85654ed30c2acafd98a078db8e5ee4119b83Collect441907082022-12-06 21:41:282 hrs 39 mins ago0xce13bda9dbb5d9edac09188b3455e7b6b54d5009 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00050571
0xbdabe0c52e34aa7e83c8d075927eac91e1ffada84d3672aac964faf42078943bCollect441898722022-12-06 21:36:452 hrs 43 mins ago0x5d64a0fd6af0d76a7ed189d4061ffa6823fbf97e IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00025057
0x4e24e02b52c408cdca50db70d7747042b3438eb5ba98f9a97773a6ca7f4762f2Collect441877092022-12-06 21:25:102 hrs 55 mins ago0xc6974e9a312404c083d07f80b68854ffd4c6d616 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00005448
0xe792e1d69b1427a7a71255f7b86da6d0064e2c3332e2429a5c55acb34ebb17d3Collect441838872022-12-06 21:03:523 hrs 16 mins ago0x31575e07c79011949a434b683e933ecae2e66484 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00004408
0x41c256cec37ffce4e38bd0465c4a011df330931732848812523f39e5bcf996b2Collect441831362022-12-06 20:59:423 hrs 20 mins ago0x71ac01152cf805fab95f9d874c542fd35be2c913 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00005312
0x09b69786a8064a24f4c6e824c1b4e4143d0ecbc7045cafa0ea3ebe02845a1e73Collect441794502022-12-06 20:39:383 hrs 41 mins ago0xdb995c1264821e0fe5230ae86db05a6592478723 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.0000465
0xb86cb4f20a6a671bca8b90cefb3ad5df434902b5bbe353fba5a95c950f32e2f3Collect441769312022-12-06 20:25:383 hrs 55 mins ago0x913128fd10227e06906eee42d68896be2ef6d905 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00029773
0x5243aa6a46df302c0f76640b0b8edf3377c40bb04f03674c1a97eeba3260302fCollect441743962022-12-06 20:11:234 hrs 9 mins ago0x97735db6fbbc87eb32ac63b28510ab5da2829a52 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00004968
0xd12abf2c97f08260d6393de2afe24de4a0a25b61da4ec23a8f8761ffc4d3a7ceCollect441737302022-12-06 20:07:164 hrs 13 mins ago0x5d263946ffec02f00618d7c86335351ad3a1546b IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.0002128
0x908be1fe5b9a829c8ba87114b0d9b89aec42216a2736424b37a0e9aa9d7f8d48Collect441736442022-12-06 20:06:554 hrs 13 mins ago0xaeb6d9c366fa3251c50306c73e4f049152795b7a IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00006488
0x41fde64d9f6f01d97458c5af70c3ccbfecf165630057e55c983e2c8b8bee1426Collect441658682022-12-06 19:28:464 hrs 51 mins ago0xe2bdae527f99a68724b9d5c271438437fc2a4695 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00009886
0xfc35b4f171463a32ce74a80167d1c38a76a546f65976e5995f1aa7bc808aa665Collect441629882022-12-06 19:15:335 hrs 5 mins ago0x97ccb2db265fa5eba774cb609a4f7a625c286856 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00008025
0xcf7f3183b8afac0cf345ad836346648fc78c7f647649eecbcb9bcc33f6413a47Collect441478762022-12-06 18:06:106 hrs 14 mins ago0x097e1fa1b3454355bd48409e19cfdb3c0d1dcc46 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00011526
0xac58a00595e6cdab7f18cfafd38812ca78f37b1a00a303d3a2f874ba93d45562Collect441457862022-12-06 17:57:006 hrs 23 mins ago0xc8a060763581d1e9cfdea7046a46fa7c23a8984a IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00011774
0x345e84763ef987401f68784c167dd93cc432987192fadc065e5e71642c56e542Collect441417662022-12-06 17:38:576 hrs 41 mins ago0xe27597af91352537f4ea74622b5a2ba6d464d9ee IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00006589
0xdd76577d558e0c25a10cccae534a94349449ddf638254be247cb8c7ee9e6ca1cCollect441284332022-12-06 16:40:317 hrs 40 mins ago0xa1f8082b4a40a1d3f8d2ef15d598accfffffd671 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00005377
0x34f5d3639a02ee5fbf5cc88a5ab265b3c99be0c55d3ccc396535c417191a778eCollect441219732022-12-06 16:12:008 hrs 8 mins ago0xdfe7ad3e0cc6fb0798e66c67c72927c49fc42478 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00009256
0x26283a40b92af97fc931754f2b4e8826f309dc6ad6cc8cbc5f655973fa5d68e9Collect440922332022-12-06 13:58:0610 hrs 22 mins ago0xd6278e5eea2981b1d4ad89f3d6c44670cad6e427 IN  0xe92868215ddc50f91e298d3fe56ac39e6a0b13c50 ETH0.00005928
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xce3051ff2ed963406b55ef505751ef88b8f0d7910 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5Treasure DAO: Magic Token0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xe3b4d0bf4f433bf981bd452134657ba1dc28f5580 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xce3051ff2ed963406b55ef505751ef88b8f0d7910 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5Treasure DAO: Magic Token0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0x4de95c1e202102e22e801590c51d7b979f167fbb0 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xdd346af623900e15ad6293b938984373d7967ed30 ETH
0xcf2c64697eb83389a9c6c5a9ff1f331eb9922b7313db0c988f86ec22412e222c442166042022-12-07 0:20:0632 secs ago 0xe92868215ddc50f91e298d3fe56ac39e6a0b13c5 0xe3b4d0bf4f433bf981bd452134657ba1dc28f5580 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CollectibleProducer

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : CollectibleProducer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "../Realm/IRealm.sol";
import "../Staker/IStructureStaker.sol";
import "../Reactor/IReactor.sol";
import "./ICollectible.sol";
import "../Utils/IProduction.sol";

import "../Manager/ManagerModifier.sol";

contract CollectibleProducer is ReentrancyGuard, Pausable, ManagerModifier {
  using SafeERC20 for IERC20;

  //=======================================
  // Immutables
  //=======================================
  IRealm public immutable REALM;
  IStructureStaker public immutable STRUCTURE_STAKER;
  IReactor public immutable REACTOR;
  IProduction public immutable PRODUCTION;
  ICollectible public immutable COLLECTIBLE;
  address public immutable VAULT;
  IERC20 public immutable TOKEN;

  //=======================================
  // Uintss
  //=======================================
  uint256 public defaultCooldownAddition;
  uint256 public maxCollectibles;
  uint256 public maxSeconds;

  //=======================================
  // Arrays
  //=======================================
  uint256[] public cooldowns;
  uint256[] public costs;

  //=======================================
  // Mappings
  //=======================================
  mapping(uint256 => mapping(uint256 => bool)) public geos;
  mapping(uint256 => uint256) public exotics;
  mapping(uint256 => uint256) public rarityHolder;

  //=======================================
  // Events
  //=======================================
  event Activated(uint256 realmId);
  event Produced(
    uint256 realmId,
    uint256 collectibleId,
    uint256 quantity,
    uint256 cost
  );

  //=======================================
  // Constructor
  //=======================================
  constructor(
    address _realm,
    address _manager,
    address _structureStaker,
    address _reactor,
    address _production,
    address _collectible,
    address _vault,
    address _token,
    uint256 _maxCollectibles,
    uint256 _maxSeconds
  ) ManagerModifier(_manager) {
    REALM = IRealm(_realm);
    STRUCTURE_STAKER = IStructureStaker(_structureStaker);
    REACTOR = IReactor(_reactor);
    PRODUCTION = IProduction(_production);
    COLLECTIBLE = ICollectible(_collectible);
    VAULT = _vault;
    TOKEN = IERC20(_token);

    maxCollectibles = _maxCollectibles;
    maxSeconds = _maxSeconds;

    exotics[0] = 1;
    exotics[1] = 23;
    exotics[2] = 16;
    exotics[3] = 34;

    // Nourishment
    geos[0][0] = true; // Pond
    geos[0][1] = true; // Valley
    geos[0][5] = true; // Canal
    geos[0][7] = true; // Prairie
    geos[0][11] = true; // River
    geos[0][25] = true; // Biosphere
    geos[0][26] = true; // Lagoon
    geos[0][31] = true; // Oasis
    geos[0][32] = true; // Waterfall

    // Aquatic
    geos[1][12] = true; // Sea
    geos[1][14] = true; // Lake
    geos[1][20] = true; // Fjord
    geos[1][23] = true; // Ocean
    geos[1][13] = true; // Cove
    geos[1][2] = true; // Gulf
    geos[1][17] = true; // Bay
    geos[1][33] = true; // Reef

    // Technological
    geos[2][16] = true; // Tundra
    geos[2][24] = true; // Desert
    geos[2][30] = true; // Cave
    geos[2][6] = true; // Cape
    geos[2][10] = true; // Peninsula
    geos[2][15] = true; // Swamp
    geos[2][19] = true; // Dune
    geos[2][28] = true; // Island
    geos[2][21] = true; // Geyser

    // Earthen
    geos[3][3] = true; // Basin
    geos[3][8] = true; // Plateau
    geos[3][9] = true; // Mesa
    geos[3][18] = true; // Ice Shelf
    geos[3][22] = true; // Glacier
    geos[3][4] = true; // Butte
    geos[3][29] = true; // Canyon
    geos[3][27] = true; // Mountain
    geos[3][34] = true; // Volcano

    // Common
    rarityHolder[0] = 0;
    rarityHolder[1] = 0;
    rarityHolder[10] = 0;
    rarityHolder[11] = 0;
    rarityHolder[20] = 0;
    rarityHolder[21] = 0;
    rarityHolder[30] = 0;
    rarityHolder[31] = 0;

    // Uncommon
    rarityHolder[2] = 1;
    rarityHolder[3] = 1;
    rarityHolder[12] = 1;
    rarityHolder[13] = 1;
    rarityHolder[22] = 1;
    rarityHolder[23] = 1;
    rarityHolder[32] = 1;
    rarityHolder[33] = 1;

    // Rare
    rarityHolder[4] = 2;
    rarityHolder[5] = 2;
    rarityHolder[14] = 2;
    rarityHolder[15] = 2;
    rarityHolder[24] = 2;
    rarityHolder[25] = 2;
    rarityHolder[34] = 2;
    rarityHolder[35] = 2;

    // Epic
    rarityHolder[6] = 3;
    rarityHolder[16] = 3;
    rarityHolder[26] = 3;
    rarityHolder[36] = 3;

    // Legendary
    rarityHolder[7] = 4;
    rarityHolder[17] = 4;
    rarityHolder[27] = 4;
    rarityHolder[37] = 4;

    // Mythic
    rarityHolder[8] = 5;
    rarityHolder[18] = 5;
    rarityHolder[28] = 5;
    rarityHolder[38] = 5;

    // Exotic
    rarityHolder[9] = 6;
    rarityHolder[19] = 6;
    rarityHolder[29] = 6;
    rarityHolder[39] = 6;

    cooldowns = [43200, 43200, 86400, 86400, 129600, 129600, 172800];
    costs = [
      100000000000000000,
      150000000000000000,
      300000000000000000,
      500000000000000000,
      1000000000000000000,
      1250000000000000000,
      2000000000000000000
    ];

    _pause();
  }

  //=======================================
  // External
  //=======================================
  function collect(
    uint256[] calldata _realmIds,
    uint256[][] calldata _collectibleIds,
    uint256[][] calldata _quantities
  ) external nonReentrant whenNotPaused {
    for (uint256 h = 0; h < _realmIds.length; h++) {
      uint256 realmId = _realmIds[h];

      // Check ownership
      require(
        REALM.ownerOf(realmId) == msg.sender,
        "CollectibleProducer: You do not own this Realm"
      );

      uint256[] memory collectibleIds = _collectibleIds[h];
      uint256[] memory quantities = _quantities[h];

      // Check if _collectibleIds are below max
      require(
        collectibleIds.length <= maxCollectibles,
        "CollectibleProducer: Above max Collectibles"
      );

      // Check if reactor is productive
      require(
        STRUCTURE_STAKER.hasStaked(realmId, address(REACTOR), 0),
        "CollectibleProducer: Not productive"
      );

      // If not productive, set to 6 days ago
      if (!PRODUCTION.isProductive(realmId)) {
        PRODUCTION.setProduction(realmId, block.timestamp - 6 days);
      }

      uint256 startedAt = PRODUCTION.getStartedAt(realmId);

      for (uint256 j = 0; j < collectibleIds.length; j++) {
        uint256 collectibleId = collectibleIds[j];
        uint256 desiredQuantity = quantities[j];

        // Collect
        _collect(realmId, collectibleId, desiredQuantity, startedAt);
      }
    }
  }

  function getSecondsElapsed(uint256 _realmId) external view returns (uint256) {
    uint256 startedAt = PRODUCTION.getStartedAt(_realmId);

    // Return 0 if production hasn't been started
    if (startedAt == 0) return 0;

    return _secondsElapsed(startedAt);
  }

  function getQuantity(uint256 _realmId, uint256 _collectibleId)
    external
    view
    returns (uint256)
  {
    uint256 rarity = _getRarity(_collectibleId);
    uint256 startedAt = PRODUCTION.getStartedAt(_realmId);

    // Return 0 if production hasn't been started
    if (startedAt == 0) return 0;

    uint256 cooldown = cooldowns[rarity];

    return _secondsElapsed(startedAt) / cooldown;
  }

  function secondsTillIncrease(uint256 _realmId, uint256 _collectibleId)
    external
    view
    returns (uint256)
  {
    uint256 rarity = _getRarity(_collectibleId);
    uint256 startedAt = PRODUCTION.getStartedAt(_realmId);

    // Return 0 if production hasn't been started
    if (startedAt == 0) return 0;

    uint256 cooldown = cooldowns[rarity];
    uint256 elapsedTime = _secondsElapsed(startedAt);

    return cooldown - (elapsedTime - ((elapsedTime / cooldown) * cooldown));
  }

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

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

  function updateCosts(uint256[] calldata _costs) external onlyAdmin {
    costs = _costs;
  }

  function updateCooldowns(uint256[] calldata _cooldowns) external onlyAdmin {
    cooldowns = _cooldowns;
  }

  function updateMaxCollectibles(uint256 _maxCollectibles) external onlyAdmin {
    maxCollectibles = _maxCollectibles;
  }

  function updateMaxSeconds(uint256 _maxSeconds) external onlyAdmin {
    maxSeconds = _maxSeconds;
  }

  //=======================================
  // Internal
  //=======================================

  function _collect(
    uint256 _realmId,
    uint256 _collectibleId,
    uint256 _desiredQuantity,
    uint256 _startedAt
  ) internal {
    // Get rarity
    uint256 rarity = _getRarity(_collectibleId);

    // Get cooldown
    uint256 cooldown = cooldowns[rarity];

    // Get category
    uint256 category = _getCategory(_collectibleId);

    // Store if has Geo Feature
    bool hasGeo = _hasGeo(_realmId, category);

    // Check if trying to collect Exotic
    if (rarity == 6) {
      require(
        _hasExotic(_realmId, category),
        "CollectibleProducer: You cannot produce Exotic Collectible"
      );
    }

    // Require Geo Feature if not Common Rarity
    if (rarity != 0) {
      require(
        hasGeo,
        "CollectibleProducer: You cannot produce this Collectible"
      );
    }

    // Seconds elapsed
    uint256 secondsElapsed = _secondsElapsed(_startedAt);

    // Check over max seconds to collect
    if (secondsElapsed > maxSeconds) {
      secondsElapsed = maxSeconds;
    }

    // Get quantity
    uint256 quantity = secondsElapsed / cooldown;

    // Check if quantity is greater than 0
    require(
      quantity > 0,
      "CollectibleProducer: Max quantity allowed must be above 0"
    );

    // Check if desired quantity is allowed
    require(
      quantity >= _desiredQuantity,
      "CollectibleProducer: Desired quantity is above max quantity allowed"
    );

    // Update production
    PRODUCTION.setProduction(_realmId, block.timestamp);

    // Get cost
    uint256 cost = costs[rarity] * _desiredQuantity;

    // Transfer to vault
    TOKEN.safeTransferFrom(msg.sender, VAULT, cost);

    // Mint
    COLLECTIBLE.mintFor(msg.sender, _collectibleId, _desiredQuantity);

    emit Produced(_realmId, _collectibleId, _desiredQuantity, cost);
  }

  function _getCategory(uint256 _collectibleId)
    internal
    pure
    returns (uint256)
  {
    if (_collectibleId < 10) {
      return 0;
    } else if (_collectibleId < 20) {
      return 1;
    } else if (_collectibleId < 30) {
      return 2;
    } else {
      return 3;
    }
  }

  function _secondsElapsed(uint256 _time) internal view returns (uint256) {
    if (block.timestamp <= _time) {
      return 0;
    }

    return (block.timestamp - _time);
  }

  function _getRarity(uint256 _collectibleId) internal view returns (uint256) {
    return rarityHolder[_collectibleId];
  }

  function _hasGeo(uint256 _realmId, uint256 _category)
    internal
    view
    returns (bool)
  {
    (uint256 a, uint256 b, uint256 c) = _realmFeatures(_realmId);

    if (geos[_category][a] || geos[_category][b] || geos[_category][c]) {
      return true;
    }

    return false;
  }

  function _hasExotic(uint256 _realmId, uint256 _category)
    internal
    view
    returns (bool)
  {
    (uint256 a, uint256 b, uint256 c) = _realmFeatures(_realmId);

    if (
      a == exotics[_category] ||
      b == exotics[_category] ||
      c == exotics[_category]
    ) {
      return true;
    }

    return false;
  }

  function _realmFeatures(uint256 _realmId)
    internal
    view
    returns (
      uint256,
      uint256,
      uint256
    )
  {
    return (
      REALM.realmFeatures(_realmId, 0),
      REALM.realmFeatures(_realmId, 1),
      REALM.realmFeatures(_realmId, 2)
    );
  }
}

File 2 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 4 of 15 : 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 5 of 15 : 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 6 of 15 : IStructureStaker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IStructureStaker {
  function stakeFor(
    address _staker,
    uint256 _realmId,
    address _addr,
    uint256 _structureId
  ) external;

  function unstakeFor(
    address _staker,
    uint256 _realmId,
    address _addr,
    uint256 _structureId
  ) external;

  function stakeBatchFor(
    address _staker,
    uint256[] calldata _realmIds,
    address[] calldata _addrs,
    uint256[] calldata _structureIds
  ) external;

  function unstakeBatchFor(
    address _staker,
    uint256[] calldata _realmIds,
    address[] calldata _addrs,
    uint256[] calldata _structureIds
  ) external;

  function getStaker(
    uint256 _realmId,
    address _addr,
    uint256 _structureId
  ) external;

  function hasStaked(
    uint256 _realmId,
    address _addr,
    uint256 _count
  ) external returns (bool);
}

File 7 of 15 : IReactor.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

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

  function mintFor(address _for, uint256 _quantity) external returns (uint256);

  function burn(uint256 _id) external;
}

File 8 of 15 : ICollectible.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface ICollectible {
  function mintFor(
    address _for,
    uint256 _id,
    uint256 _amount
  ) external;

  function mintBatchFor(
    address _for,
    uint256[] memory _ids,
    uint256[] memory _amounts
  ) external;

  function burn(uint256 _id, uint256 _amount) external;

  function burnBatch(uint256[] memory ids, uint256[] memory amounts) external;

  function safeBatchTransferFrom(
    address _from,
    address _to,
    uint256[] calldata _ids,
    uint256[] calldata _amounts,
    bytes calldata data
  ) external;

  function safeTransferFrom(
    address _from,
    address _to,
    uint256 _ids,
    uint256 _amounts,
    bytes calldata data
  ) external;
}

File 9 of 15 : IProduction.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

interface IProduction {
  function setProduction(uint256 _realmId, uint256 _timestamp) external;

  function isProductive(uint256 _realmId) external view returns (bool);

  function getStartedAt(uint256 _realmId) external view returns (uint256);
}

File 10 of 15 : 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 11 of 15 : 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 12 of 15 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 13 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 15 : 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 15 of 15 : 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;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "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":"_structureStaker","type":"address"},{"internalType":"address","name":"_reactor","type":"address"},{"internalType":"address","name":"_production","type":"address"},{"internalType":"address","name":"_collectible","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_maxCollectibles","type":"uint256"},{"internalType":"uint256","name":"_maxSeconds","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"}],"name":"Activated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"realmId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectibleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cost","type":"uint256"}],"name":"Produced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"COLLECTIBLE","outputs":[{"internalType":"contract ICollectible","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"contract IManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRODUCTION","outputs":[{"internalType":"contract IProduction","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REACTOR","outputs":[{"internalType":"contract IReactor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REALM","outputs":[{"internalType":"contract IRealm","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRUCTURE_STAKER","outputs":[{"internalType":"contract IStructureStaker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAULT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_realmIds","type":"uint256[]"},{"internalType":"uint256[][]","name":"_collectibleIds","type":"uint256[][]"},{"internalType":"uint256[][]","name":"_quantities","type":"uint256[][]"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"costs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultCooldownAddition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"exotics","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"geos","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"uint256","name":"_collectibleId","type":"uint256"}],"name":"getQuantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"}],"name":"getSecondsElapsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxCollectibles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSeconds","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rarityHolder","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_realmId","type":"uint256"},{"internalType":"uint256","name":"_collectibleId","type":"uint256"}],"name":"secondsTillIncrease","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_cooldowns","type":"uint256[]"}],"name":"updateCooldowns","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_costs","type":"uint256[]"}],"name":"updateCosts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxCollectibles","type":"uint256"}],"name":"updateMaxCollectibles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSeconds","type":"uint256"}],"name":"updateMaxSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101806040523480156200001257600080fd5b506040516200329738038062003297833981016040819052620000359162000ed5565b60016000818155815460ff1990811683556001600160601b031960608d811b821660809081528f821b831660a09081528e831b841660c09081528e841b851660e09081528e851b8616610100528d851b8616610120528c851b8616610140528b851b9095166101605260038a815560048a81557f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c78a905560177fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f5560107f6add646517a5b0f6793cd5891b7937d28a5b2981a5d88ebc7cd776088fea90415560227f625b35f5e76f098dd7c3a05b10e2e5e78a4a01228d60c3b143426cdf36d26455557fc65916d663d52b0a18b63681e34ad6e3e8bb58d57f662b8e7e045ab09fab0385805489168b1790557ffa778a20fba1b88d7c7b188dc1c4eb115a1fb0693025fb44b92eb4ffe9dbb68e805489168b1790557fffa0c0040464b28f77e634cb8748fa449c3b1537a6cb81e3df7edc85d6b9b115805489168b1790557fbb8ed44a7e49a4e6ea29a69612411a663b6df945ff6d97e29596bd4b57e5b656805489168b1790557f94bdc6f4fb79ac45b89e4e48cde5228b43341f1ca75c468aa392b7d49373c8ac805489168b1790557fd68ee3cda496c237e48f69d89d4a77c54b3e48df3b37300bc57f4415e1bc978a805489168b1790557f7d794a0dd7cbb36288ab3be17a2ed4deeac4a671e4ba28095db070d26cde3061805489168b1790557fb0eb5576ae9c000e39e33470fa423e254389fd7d35ba4c74b2d9cfa55219f855805489168b1790557f5b56bc9d44ab1e47a60c94b4f5bbdd4d6ba8cdbb40f63644700e064c35a32041805489168b1790557f2e092d9faac5008297dfd461433b6c53e70951aa5edea4d9ffe49b2c04257274805489168b1790557fc10b5d3205bc796e061c934dd767c8733c66d6f3243c2bebe28408bb87071dd8805489168b1790557fdf6c5ee4bd0af5cfa73c537d7f1b26975dc72ef0fc8deb15fe2f3cf9f38866f1805489168b1790557f55b775e8a7a7b7d828162d56970c181a8486c2ac944f0b132f1961610e20a686805489168b1790557f2fdc951c73850dfe5bebdbdcb6040d8cde51a7988035054433e3efcdbcd88bd2805489168b1790557fae5957d19e851187bdb8518f7f1b23fbcf1fdb4f1669df5cf30a17b1260123a8805489168b1790557fdfb7339143670f2fc7676c1c841d8ba093f6afb02004aaab2ada654bf390aa2d805489168b1790557f87cfcd80896e81ad3bc128292b0f85066050e95b6573f862db610733fd58beee805489168b1790557f7ca950e8156ee6aa56397771b1477cecb6629fe269392f3f4111535c1e4cb3e6805489168b1790557f536dd0466f09b4a44448794237698601cb3403fb21ed8092763b35ac2140f4cb805489168b1790557fe2076c14da388d82461839efa9a38781b22272161738baf0608ee1e64a4d4016805489168b1790557fb6a2aefd09002e6f7a2724006dadcd3ffd95b6f4e19fd81315979ef32446e7a6805489168b1790557f02b80b9d696dbcf8b8011c6cc58f9a51227d94620050af65c296c6fcf2b84a6d805489168b1790557f6dfe49111ae69c486408e3bfd5db17df427c0fcd18cf69623f36b15cde4336ec805489168b1790557f1cd5e7fd7f7dcd1556a7c33e54d524af526c06c9daae18797993309e3e71495c805489168b1790557ff69e924975e41febd0819edddbf1e1c94652c7141611552d5b56de39a5017299805489168b1790557f3c4c4069d8967c13b4437fb7eb1cf458372f90cd840321664a8aec7991148f3f805489168b1790557fcb515f4ba914fbc5ab9702a562432cdc8e1740c800f5f72184fff18008a9d72b805489168b1790557f5607bcd0602c133c61b8dbce3773fb36a1858d5b0cc5398b213f353a880ccad7805489168b1790557f37f38b16d7d333016eede9d9dd92ebdd9271f881fbc07700dea2ba57f16726a0805489168b1790557f4130da77b5d87ac9740e6b28607a789b5a8c1edbb549cef66490a224433ba16e805489168b1790557f5d32b40c964e657d5f96a4e7ebc0602846c33c5dce89e2e15614ce4246f07875805489168b1790557f304946a2526614e3e0001e6b52f77994e2cb930bee85a99ff54b21d65e7a8a21805489168b1790557ff50580989b0ef43acc5dae2f23fcabf03bba11a94b49bb4f15260765609a7fc7805489168b1790557f8ee94c35ffb036375d396055fde9540d727569f4ca1102ca8ac84c2c79baae11805489168b1790557f8562ca62fc54934c470ffb60a9619dd0c37dd17c5a2326c6c280d4fa7e7589ce80549098168a17909755600960209081527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b8990557f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a368990557f502e20e4e219e0c509d693958f17384c185f07a810a5d31c46c2be981e979c258990557f0d9cf2cd531699eed8dd34e40ff2884a14a698c4898184fba85194e6f6772d248990557f60a5a5a37b4d1dd7d7b24e4897f9467e8debaad1cd5a21b57a3edb667b34643f8990557f1cd9b38a3a53bab494aa1d85adb715d6959eb17b9c356637d3fa91f568fbb49d8990557fba813966250df53e8742361bee196aca3139d68609981c9283b9bd74a15a86e88990557f04e46bb1bb2d8a8e64e23570b4b0c755e74dfd455311952241a58ee59d43ee398990557f6cde3cea4b3a3fb2488b2808bae7556f4a405e50f65e1794383bc026131b13c38a90557fc575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e78a90557fc7b54da85b38015141aec405fe9a03fa9e057971f48e8d0d8fc78485848a23108a90557fdec90e20065e511a0428d28bf1b6b0d715e4b1cb865c1f0580815586cc6ebf9e8a90557f31500e3e63276b9e30de61d3b3eba79d113a6ecb97bdb48e6ff3bfbcf39843a08a90557f1e54f96c5e2b78f60d79048ee9c858e18221042b03d4c3a1edb674a7958c6dbe8a90557f0be59b18168b57ec65c0c8e445cffd739914e4617bf4e1f6b492b57dcd4f78d68a90557f1158e7856e424bc35a28252f518c89c1af91164333f54fc19b5724835112c6819990995560027f8dc18c4ccfd75f5c815b63770fa542fd953e8fef7e0e44bbdd4913470ce7e9cb8190557f74b05292d1d4b2b48b65261b07099d24244bcb069f138d9a6bfdcf776becac4c8190557f14f5f4d78ba809fa1eb5eee80339f56eaa489b7b6b892ddb58602e51e8dad7ef8190557fc6578e0b5f8d37c135f99fcd184697bbb8facaa7556a48605034ca65d4c39fbf8190557f9fa182d41d71a497043a8da03c1b347327908b20231c7ad3a623a2ed42be1e298190557f967884e4895c9fc5fcc0d7afd0f0d6557102e822f9f19daef11a1defa828ca978190557f280fb8a25848fb992f554b4c8d4afc13dff52a3691d85dbf26c3555afd6243528190557f25ac479b898599910fcac5655ef89881608fbe6ebfe7a0189ab76e3e210bec95557fbb6daa0c283751197dfdc76590680f9005e97d6f23870deb1164ab60b28b9f5f8190557fbe671448d730349025d29d2778ce42e0b1bf32e5fba806216bd490316c20b57d8190557f2d13cb1e06f1c209c154bf72388128a0c41c5f78e83fa6fa3a15e7af7ce926728190557f327f5a96ce8922d13e926b5301182a995f2dad0da1f81621072d6188be90cf40557fae6299332bcd708cd60e3a8defa55de28078a50a4cf2b3de3a546253240ff9e18690557fe7636fba95dbff23a0d59c2aaba91ac476df033d3d0194af04c6e0be3aa731688690557f39c1220ceb2b65f0545b9700381d45e66fb4c48160af52f2313cff52e7d1816f8690557f72fe66faf096e1b8c9ecc3b66c7af137c79b7e17c40297754fb1c70cc4869abc9590955560057fc7694af312c4f286114180fd0ba6a52461fcee8a381636770b19a343af92538a8190557fe84bfcbbf6b4a03922a064640cc123c559d873e4452e4de9b4c8ae3d625b15f08190557f0198fab112c143739d2c64cd1e8f8579226b9625635561ef7f569630690cb0808190557ff4b500520e6ff7e2b980c7c3b7ac9e6a58ea5f6006cd6e18c840f4d551c1954d81905560067f87e8a52529e8ece4ef759037313542a6429ff494a9fab9027fb79db90124eba68190557f20eb389d0739387175ea0af71ea83e439c1e64b1f1d88bc1a63c293936f1ddf98190557f664326ee2c9cf6e3ccb8f5f75d62b49a2f2f40a7f0634c3c1ccd8b8768761c3681905560279097527fa12453ef3d78204b880f3cf8b9444bb252df0f872a15667124da9103a917c3579690965560408051948501815261a8c08086529785019790975262015180968401879052918301959095526201fa409482018590528101939093526202a3009083015262000cd291600762000e01565b506040805160e08101825267016345785d8a00008152670214e8348c4f00006020820152670429d069189e0000918101919091526706f05b59d3b200006060820152670de0b6b3a76400006080820152671158e460913d000060a0820152671bc16d674ec8000060c082015262000d4e90600690600762000e58565b5062000d5962000d69565b5050505050505050505062000f91565b62000d7362000db4565b6001805460ff1916811790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b60015460ff161562000dff5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b565b82805482825590600052602060002090810192821562000e46579160200282015b8281111562000e46578251829062ffffff1690559160200191906001019062000e22565b5062000e5492915062000ea1565b5090565b82805482825590600052602060002090810192821562000e46579160200282015b8281111562000e4657825182906001600160401b031690559160200191906001019062000e79565b5b8082111562000e54576000815560010162000ea2565b80516001600160a01b038116811462000ed057600080fd5b919050565b6000806000806000806000806000806101408b8d03121562000ef5578586fd5b62000f008b62000eb8565b995062000f1060208c0162000eb8565b985062000f2060408c0162000eb8565b975062000f3060608c0162000eb8565b965062000f4060808c0162000eb8565b955062000f5060a08c0162000eb8565b945062000f6060c08c0162000eb8565b935062000f7060e08c0162000eb8565b92506101008b015191506101208b015190509295989b9194979a5092959850565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c6101205160601c6101405160601c6101605160601c6121ee620010a9600039600081816102ed01526116d701526000818161025501526116fa015260008181610456015261174201526000818161031c0152818161095b01528181610e7701528181610f0701528181610faa015281816110fc015281816111cb015261162b0152600081816103690152610d5e0152600081816103c70152610d8d0152600081816102c601528181610afc01528181611a0f01528181611aa60152611b450152600081816101fb01528181610496015281816105630152818161061b015281816106f9015281816107c4015261087c01526121ee6000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80639d6fac6f116100f9578063ca2d959911610097578063db03071211610071578063db03071214610435578063e6e434be14610448578063e80d2cc214610451578063edeb5bcd1461047857600080fd5b8063ca2d9599146103fc578063d4ad055f1461040f578063da97790c1461042257600080fd5b8063bad3dc84116100d3578063bad3dc841461038b578063bd8c48a4146103b9578063c5ef9fd9146103c2578063c7a1bb56146103e957600080fd5b80639d6fac6f1461033e578063af5204f614610351578063b96035701461036457600080fd5b806349b3b29f1161016657806379604a171161014057806379604a17146102c157806382bfefc8146102e85780638456cb591461030f5780639707175e1461031757600080fd5b806349b3b29f146102775780634be9125a1461028a5780635c975abb146102aa57600080fd5b806301f61086146101ae5780630e82c913146101c35780631b2df850146101f65780633f27ec1c146102355780633f4ba83a14610248578063411557d114610250575b600080fd5b6101c16101bc366004611ef8565b610481565b005b6101e36101d1366004611fee565b60096020526000908152604090205481565b6040519081526020015b60405180910390f35b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101ed565b6101c1610243366004611fee565b61054e565b6101c1610606565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101e3610285366004611fee565b6106c3565b6101e3610298366004611fee565b60086020526000908152604090205481565b60015460ff165b60405190151581526020016101ed565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101c16106e4565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101e361034c366004611fee565b61079f565b6101c161035f366004611fee565b6107af565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6102b161039936600461201e565b600760209081526000928352604080842090915290825290205460ff1681565b6101e360045481565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101c16103f7366004611ef8565b610867565b6101e361040a36600461201e565b610926565b6101c161041d366004611f38565b610a5a565b6101e3610430366004611fee565b6110d9565b6101e361044336600461201e565b611196565b6101e360025481565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6101e360035481565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b1580156104e057600080fd5b505afa1580156104f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105189190611fce565b61053d5760405162461bcd60e51b81526004016105349061208e565b60405180910390fd5b61054960068383611e27565b505050565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b1580156105ad57600080fd5b505afa1580156105c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e59190611fce565b6106015760405162461bcd60e51b81526004016105349061208e565b600355565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b15801561066557600080fd5b505afa158015610679573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069d9190611fce565b6106b95760405162461bcd60e51b81526004016105349061208e565b6106c16112a5565b565b600681815481106106d357600080fd5b600091825260209091200154905081565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b15801561074357600080fd5b505afa158015610757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077b9190611fce565b6107975760405162461bcd60e51b81526004016105349061208e565b6106c16112f7565b600581815481106106d357600080fd5b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b15801561080e57600080fd5b505afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108469190611fce565b6108625760405162461bcd60e51b81526004016105349061208e565b600455565b604051630935e01b60e21b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906324d7806c9060240160206040518083038186803b1580156108c657600080fd5b505afa1580156108da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fe9190611fce565b61091a5760405162461bcd60e51b81526004016105349061208e565b61054960058383611e27565b600081815260096020526040812054819060405163ac0de66f60e01b8152600481018690529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ac0de66f9060240160206040518083038186803b15801561099d57600080fd5b505afa1580156109b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d59190612006565b9050806109e757600092505050610a54565b600060058381548110610a0a57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490506000610a2283611332565b905081610a2f8183612105565b610a399190612125565b610a439082612144565b610a4d9083612144565b9450505050505b92915050565b60026000541415610aad5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610534565b6002600055610aba61134d565b60005b858110156110cb576000878783818110610ae757634e487b7160e01b600052603260045260246000fd5b905060200201359050336001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636352211e836040518263ffffffff1660e01b8152600401610b4891815260200190565b60206040518083038186803b158015610b6057600080fd5b505afa158015610b74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b989190611ed1565b6001600160a01b031614610c055760405162461bcd60e51b815260206004820152602e60248201527f436f6c6c65637469626c6550726f64756365723a20596f7520646f206e6f742060448201526d6f776e2074686973205265616c6d60901b6064820152608401610534565b6000868684818110610c2757634e487b7160e01b600052603260045260246000fd5b9050602002810190610c3991906120bd565b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250939450889250879150869050818110610c8f57634e487b7160e01b600052603260045260246000fd5b9050602002810190610ca191906120bd565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003548551939450909211159150610d4090505760405162461bcd60e51b815260206004820152602b60248201527f436f6c6c65637469626c6550726f64756365723a2041626f7665206d6178204360448201526a6f6c6c65637469626c657360a81b6064820152608401610534565b60405163327b6f6560e01b8152600481018490526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166024830152600060448301527f0000000000000000000000000000000000000000000000000000000000000000169063327b6f6590606401602060405180830381600087803b158015610dd157600080fd5b505af1158015610de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e099190611fce565b610e615760405162461bcd60e51b815260206004820152602360248201527f436f6c6c65637469626c6550726f64756365723a204e6f742070726f6475637460448201526269766560e81b6064820152608401610534565b604051633431eceb60e01b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633431eceb9060240160206040518083038186803b158015610ec157600080fd5b505afa158015610ed5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef99190611fce565b610f91576001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016639113b76c84610f3a6207e90042612144565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015610f7857600080fd5b505af1158015610f8c573d6000803e3d6000fd5b505050505b60405163ac0de66f60e01b8152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ac0de66f9060240160206040518083038186803b158015610ff457600080fd5b505afa158015611008573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102c9190612006565b905060005b83518110156110b357600084828151811061105c57634e487b7160e01b600052603260045260246000fd5b60200260200101519050600084838151811061108857634e487b7160e01b600052603260045260246000fd5b6020026020010151905061109e87838387611393565b505080806110ab90612187565b915050611031565b505050505080806110c390612187565b915050610abd565b505060016000555050505050565b60405163ac0de66f60e01b81526004810182905260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ac0de66f9060240160206040518083038186803b15801561113e57600080fd5b505afa158015611152573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111769190612006565b9050806111865750600092915050565b61118f81611332565b9392505050565b600081815260096020526040812054819060405163ac0de66f60e01b8152600481018690529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ac0de66f9060240160206040518083038186803b15801561120d57600080fd5b505afa158015611221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112459190612006565b90508061125757600092505050610a54565b60006005838154811061127a57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508061129183611332565b61129b9190612105565b9695505050505050565b6112ad6117fc565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6112ff61134d565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336112da565b600081421161134357506000919050565b610a548242612144565b60015460ff16156106c15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610534565b60008381526009602052604081205490506000600582815481106113c757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905060006113df86611845565b905060006113ed8883611882565b9050836006141561147457611402888361191b565b6114745760405162461bcd60e51b815260206004820152603a60248201527f436f6c6c65637469626c6550726f64756365723a20596f752063616e6e6f742060448201527f70726f647563652045786f74696320436f6c6c65637469626c650000000000006064820152608401610534565b83156114ed57806114ed5760405162461bcd60e51b815260206004820152603860248201527f436f6c6c65637469626c6550726f64756365723a20596f752063616e6e6f742060448201527f70726f64756365207468697320436f6c6c65637469626c6500000000000000006064820152608401610534565b60006114f886611332565b905060045481111561150957506004545b60006115158583612105565b90506000811161158d5760405162461bcd60e51b815260206004820152603960248201527f436f6c6c65637469626c6550726f64756365723a204d6178207175616e74697460448201527f7920616c6c6f776564206d7573742062652061626f76652030000000000000006064820152608401610534565b8781101561160f5760405162461bcd60e51b815260206004820152604360248201527f436f6c6c65637469626c6550726f64756365723a20446573697265642071756160448201527f6e746974792069732061626f7665206d6178207175616e7469747920616c6c6f6064820152621dd95960ea1b608482015260a401610534565b604051632444eddb60e21b8152600481018b90524260248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639113b76c90604401600060405180830381600087803b15801561167757600080fd5b505af115801561168b573d6000803e3d6000fd5b50505050600088600688815481106116b357634e487b7160e01b600052603260045260246000fd5b90600052602060002001546116c89190612125565b905061171f6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016337f000000000000000000000000000000000000000000000000000000000000000084611983565b60405163aab68bdb60e01b8152336004820152602481018b9052604481018a90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aab68bdb90606401600060405180830381600087803b15801561178e57600080fd5b505af11580156117a2573d6000803e3d6000fd5b5050604080518e8152602081018e90529081018c9052606081018490527f1fb743507f2df169c0235d1dbe98cd0f75fcb016edf00f67609a31fb629177579250608001905060405180910390a15050505050505050505050565b60015460ff166106c15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610534565b6000600a82101561185857506000919050565b601482101561186957506001919050565b601e82101561187a57506002919050565b506003919050565b600080600080611891866119e3565b6000888152600760209081526040808320868452909152902054929550909350915060ff16806118da5750600085815260076020908152604080832085845290915290205460ff165b806118fe5750600085815260076020908152604080832084845290915290205460ff165b1561190f5760019350505050610a54565b50600095945050505050565b60008060008061192a866119e3565b600088815260086020526040902054929550909350915083148061195b575060008581526008602052604090205482145b806118fe575060008581526008602052604090205481141561190f5760019350505050610a54565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119dd908590611bd4565b50505050565b604051634c0a04bb60e01b81526004810182905260006024820181905290819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634c0a04bb9060440160206040518083038186803b158015611a5157600080fd5b505afa158015611a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a899190612006565b604051634c0a04bb60e01b815260048101869052600160248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c0a04bb9060440160206040518083038186803b158015611af057600080fd5b505afa158015611b04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b289190612006565b604051634c0a04bb60e01b815260048101879052600260248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c0a04bb9060440160206040518083038186803b158015611b8f57600080fd5b505afa158015611ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc79190612006565b9250925092509193909250565b6000611c29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ca69092919063ffffffff16565b8051909150156105495780806020019051810190611c479190611fce565b6105495760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610534565b6060611cb58484600085611cbd565b949350505050565b606082471015611d1e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610534565b6001600160a01b0385163b611d755760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610534565b600080866001600160a01b03168587604051611d91919061203f565b60006040518083038185875af1925050503d8060008114611dce576040519150601f19603f3d011682016040523d82523d6000602084013e611dd3565b606091505b5091509150611de3828286611dee565b979650505050505050565b60608315611dfd57508161118f565b825115611e0d5782518084602001fd5b8160405162461bcd60e51b8152600401610534919061205b565b828054828255906000526020600020908101928215611e62579160200282015b82811115611e62578235825591602001919060010190611e47565b50611e6e929150611e72565b5090565b5b80821115611e6e5760008155600101611e73565b60008083601f840112611e98578182fd5b50813567ffffffffffffffff811115611eaf578182fd5b6020830191508360208260051b8501011115611eca57600080fd5b9250929050565b600060208284031215611ee2578081fd5b81516001600160a01b038116811461118f578182fd5b60008060208385031215611f0a578081fd5b823567ffffffffffffffff811115611f20578182fd5b611f2c85828601611e87565b90969095509350505050565b60008060008060008060608789031215611f50578182fd5b863567ffffffffffffffff80821115611f67578384fd5b611f738a838b01611e87565b90985096506020890135915080821115611f8b578384fd5b611f978a838b01611e87565b90965094506040890135915080821115611faf578384fd5b50611fbc89828a01611e87565b979a9699509497509295939492505050565b600060208284031215611fdf578081fd5b8151801515811461118f578182fd5b600060208284031215611fff578081fd5b5035919050565b600060208284031215612017578081fd5b5051919050565b60008060408385031215612030578182fd5b50508035926020909101359150565b6000825161205181846020870161215b565b9190910192915050565b602081526000825180602084015261207a81604085016020870161215b565b601f01601f19169190910160400192915050565b60208082526015908201527426b0b730b3b2b91d102737ba1030b71020b236b4b760591b604082015260600190565b6000808335601e198436030181126120d3578283fd5b83018035915067ffffffffffffffff8211156120ed578283fd5b6020019150600581901b3603821315611eca57600080fd5b60008261212057634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561213f5761213f6121a2565b500290565b600082821015612156576121566121a2565b500390565b60005b8381101561217657818101518382015260200161215e565b838111156119dd5750506000910152565b600060001982141561219b5761219b6121a2565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220157340373f194bbe5c855c0c7b20ccdcd42c1328919b7ff4a8e91b9593ffa59764736f6c634300080400330000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861000000000000000000000000e3b4d0bf4f433bf981bd452134657ba1dc28f5580000000000000000000000008ec68f970e1c61b44b6d81c3b78ca931c6ffc92d000000000000000000000000dd346af623900e15ad6293b938984373d7967ed3000000000000000000000000ce3051ff2ed963406b55ef505751ef88b8f0d791000000000000000000000000a41bc2035a8ec2d6b5d41b6a820564ae57b1ae99000000000000000000000000539bde0d7dbd336b79148aa742883198bbf603420000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000007e900

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

0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861000000000000000000000000e3b4d0bf4f433bf981bd452134657ba1dc28f5580000000000000000000000008ec68f970e1c61b44b6d81c3b78ca931c6ffc92d000000000000000000000000dd346af623900e15ad6293b938984373d7967ed3000000000000000000000000ce3051ff2ed963406b55ef505751ef88b8f0d791000000000000000000000000a41bc2035a8ec2d6b5d41b6a820564ae57b1ae99000000000000000000000000539bde0d7dbd336b79148aa742883198bbf603420000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000007e900

-----Decoded View---------------
Arg [0] : _realm (address): 0x4de95c1e202102e22e801590c51d7b979f167fbb
Arg [1] : _manager (address): 0x4e572433a3bfa336b6396d13afc9f69b58252861
Arg [2] : _structureStaker (address): 0xe3b4d0bf4f433bf981bd452134657ba1dc28f558
Arg [3] : _reactor (address): 0x8ec68f970e1c61b44b6d81c3b78ca931c6ffc92d
Arg [4] : _production (address): 0xdd346af623900e15ad6293b938984373d7967ed3
Arg [5] : _collectible (address): 0xce3051ff2ed963406b55ef505751ef88b8f0d791
Arg [6] : _vault (address): 0xa41bc2035a8ec2d6b5d41b6a820564ae57b1ae99
Arg [7] : _token (address): 0x539bde0d7dbd336b79148aa742883198bbf60342
Arg [8] : _maxCollectibles (uint256): 1
Arg [9] : _maxSeconds (uint256): 518400

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000004de95c1e202102e22e801590c51d7b979f167fbb
Arg [1] : 0000000000000000000000004e572433a3bfa336b6396d13afc9f69b58252861
Arg [2] : 000000000000000000000000e3b4d0bf4f433bf981bd452134657ba1dc28f558
Arg [3] : 0000000000000000000000008ec68f970e1c61b44b6d81c3b78ca931c6ffc92d
Arg [4] : 000000000000000000000000dd346af623900e15ad6293b938984373d7967ed3
Arg [5] : 000000000000000000000000ce3051ff2ed963406b55ef505751ef88b8f0d791
Arg [6] : 000000000000000000000000a41bc2035a8ec2d6b5d41b6a820564ae57b1ae99
Arg [7] : 000000000000000000000000539bde0d7dbd336b79148aa742883198bbf60342
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 000000000000000000000000000000000000000000000000000000000007e900


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.