Contract 0x1c1d2502026a6d9719234a9895f4f4f12d974d27

Contract Overview

Balance:
0 BNB
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x0640741094e7c1d676e55a7b1c93734ec1740e221516126a0ba895af266f3abcBond93451982021-06-01 7:32:30111 days 13 hrs ago0xa89d38296370979010b4cc2c553443829ef4afe9 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x181b4f997357f9cd7ca7c2665d06a6aea1fe8c80a35444092e8a60ca50ede2e5Unbond93338402021-05-31 22:04:36111 days 23 hrs ago0x81037bad66a3838eb29bf9f2509393092d7e6ed6 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00288669
0x20d8b7f74ebfbeddb5864e68289e64a426808e75e1982e4015fa9764fcd1d73dBond93311952021-05-31 19:52:21112 days 1 hr ago0x81037bad66a3838eb29bf9f2509393092d7e6ed6 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x7ecf528d24dd85f746ca10a34a2a83d061276b746be7ac4795c4cf8220e9f69aBond93265902021-05-31 16:02:06112 days 5 hrs ago0x0feaf063f92c78a9b1b79d3685889092902c125a IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xc2cbe2eb2c4a4686fc5ac9eca933734575835b1f39809c3f178c541a5f1300d5Bond93213482021-05-31 11:40:00112 days 9 hrs ago0x1329b9d689788033a6c146e8c3857fa3bcf81e7d IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xf6d514e0b8cd4672b03d5f196f993ad5e6edf87b72080b1190a4bd0b7a067e6bBond93212232021-05-31 11:33:45112 days 9 hrs ago0xf4873f5ad3af7b151509299b56a375af0e3e4f97 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xbf9256067f8d585a452e2f00ba67a5958e8011ea8c1ee9c98d1dda532eb8e8b0Unbond93159582021-05-31 6:49:17112 days 14 hrs ago0x73b24c0dd69cc5a35518da2ddee98efd3905af72 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00288669
0xf446d4047bdf684c18184f552a90217085a0eef720356c804d8aad092a2a7cbcBond93159522021-05-31 6:48:52112 days 14 hrs ago0x73b24c0dd69cc5a35518da2ddee98efd3905af72 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x87a09bc2f04fa61174937aa695512433c5cc741377f255bd45e85092c0144d32Unbond93122332021-05-31 3:37:23112 days 17 hrs ago0xf9d6bc62ddc982e1dd90361ca619bd2cadbd93d4 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00288717
0x78ca979980fe8db322145972fc92befd768efc6b8173aa7906db19677b84d3a7Bond93122262021-05-31 3:37:02112 days 17 hrs ago0xf9d6bc62ddc982e1dd90361ca619bd2cadbd93d4 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326664
0xc6eae59daf57544f0e78dc8f6b37b723f5ddf72c039669290d6dd0f75df542dfUnbond93120982021-05-31 3:30:38112 days 17 hrs ago0xf4721f314793bda2affcd9d154c20a22a634fd4a IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00288705
0x00e18b04e08eb6d62b8399ef7950b3386680c84dbc52b53028db8a2bba1e0d94Bond93120832021-05-31 3:29:53112 days 17 hrs ago0xf4721f314793bda2affcd9d154c20a22a634fd4a IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x95a08d900f8395bd5922d6c07de654e885325383f0fab8edbd22b4b31ae41af8Unbond93110162021-05-31 2:36:32112 days 18 hrs ago0x7b99210a0cc810c84a1af58ccd6b713f33249c98 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00288705
0xef1046797f19139668c8376e8e3773fa0a5bdca256ab22fbb69ca23b37cf4a45Bond93110092021-05-31 2:36:11112 days 18 hrs ago0x7b99210a0cc810c84a1af58ccd6b713f33249c98 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.0032664
0x81ed03b3b411a7c0c947d70f59c9e76885870572e4b0f54c28c8bd3cb6b312a0Bond93091062021-05-31 1:01:02112 days 20 hrs ago0x52efb116a62da225bba9664916a65973d23bab97 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00183055
0x4400e711cfeaeb404e34469729b861155f388e5522af6513c2c3144e32bb0727Withdraw93089852021-05-31 0:54:59112 days 20 hrs ago0x52efb116a62da225bba9664916a65973d23bab97 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.01234212
0x2ae7fb459e55914c90f44835ca69e2de093939e0bc00f36d53a75f4f1bc3ee25Bond93089452021-05-31 0:52:59112 days 20 hrs ago0x52efb116a62da225bba9664916a65973d23bab97 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00228055
0xdd78ab3935039d29eee643f563a9972df50f817a9a1d5363c6e51cfed2888b0aBond92982412021-05-30 15:57:37113 days 5 hrs ago0x26783c189100bdb9e3b353dbb8f1966f01b2dc7b IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326664
0xd2fd53822990ef7811047b113787837054b95902d553ecc699e30b80b04907dcBond92897212021-05-30 8:26:14113 days 12 hrs ago0x3712a1b3478dce8351ea333a1c1aab3dcd75a8a7 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x5d2f671f8b03635805bb57f576cca8bfff2e49c5f685d0f4f72a5d530799f8f5Bond92896442021-05-30 8:22:23113 days 12 hrs ago0x783bf9d1671c4d0f5d3f133334b16dd305702f6b IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xc8f1635b18f703150679b9655aef36c8ade996bbd698117583651ef7b2a505f3Bond92895402021-05-30 8:17:11113 days 12 hrs ago0xf84df001729420559fe14d44ecbc00590612b2e7 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xe9acdc1ee8bbc28d52bff0c79dbfedfa68235a3a2b62b3af5c382115757dcab4Bond92894382021-05-30 8:12:05113 days 12 hrs ago0xfc6d6a4eb431065ad11dc8244cc647f598016e89 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0x1a00fa97412a2aa23e832891b1c2c84583a8ba41a39f5e963804e08efe6c6a20Bond92882972021-05-30 7:15:02113 days 13 hrs ago0x1b876d41a45e0f6be33d0e177f48e0d81bfaa329 IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xb4d83a1c833ce4b8d1c4b109c7f59e574da245d7063a87e655b06a592c9a228cBond92881482021-05-30 7:07:35113 days 13 hrs ago0x4985bbc7561508fdf3195059b25e834aeb62871e IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
0xca1f90332247d3c537998ebcde9e61bab3e49a27f8ee6df0c55fa71d526a4582Bond92878042021-05-30 6:50:23113 days 14 hrs ago0x4ae5f5e9fb4593d4c2f373d3817a833c1051447a IN  0x1c1d2502026a6d9719234a9895f4f4f12d974d270 BNB0.00326652
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
0xbdbd16fe009fbe0fc7096a832efdb4e461292a3eecb11f178dfa4efbca1f047094151302021-06-03 17:50:35109 days 3 hrs ago 0x1c1d2502026a6d9719234a9895f4f4f12d974d27 0x5820790a4f100b6d53bf046fde2288f70687ea4d0 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LiquidityMine

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : LiquidityMine.sol
pragma solidity >=0.6.6;

import "@openzeppelin/upgrades/contracts/Initializable.sol";
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
import "../interfaces/IDAO.sol";
import "../interfaces/IStabilizerNode.sol";

import "./LPPrivileged.sol";

contract LiquidityMine is Initializable, LiquidityMinePrivileged {
  function initialize(
    string calldata _mineName,
    address _rewardToken,
    address _maltToken,
    address _stakeToken,
    uint256 duration,
    uint256 _startTime,
    address _dao,
    address _treasuryMultisig,
    address _router,
    address _stabilizerNode,
    address _timelock,
    address _reinvestor
  ) external initializer {
    _adminSetup(_timelock);
    _setupRole(STABILIZER_NODE_ROLE, _stabilizerNode);
    _setupRole(REINVESTOR_ROLE, _reinvestor);

    rewardToken = ERC20(_rewardToken);
    stakeToken = ERC20(_stakeToken);
    malt = ERC20(_maltToken);

    treasuryMultisig = _treasuryMultisig;
    router = IUniswapV2Router02(_router);
    stabilizerNode = IStabilizerNode(_stabilizerNode);
    mineName = _mineName;
    payoutDuration = duration; // In epochs
    startTime = _startTime;
    dao = IDAO(_dao);
    reinvestor = _reinvestor;

    // Max approval
    uint256 MAX_INT = 2**256 - 1;
    rewardToken.approve(_reinvestor, MAX_INT);
    malt.approve(_reinvestor, MAX_INT);
  }

  /* Core external functions */
  function bond(uint256 amount) external checkStart {
    bondToAccount(msg.sender, amount);
  }

  function bondToAccount(address account, uint256 amount)
    public
    checkStart
  {
    advance();
    require(amount > 0, "Cannot bond 0");

    _handleStakePadding(account, amount);
    _bond(account, amount);

    uint256 currentEpoch = dao.epoch();

    epochRewards[currentEpoch].totalBonded = _globals.bonded;
  }

  function unbond(uint256 amount)
    external
    checkStart
  {
    require(amount > 0, "Cannot unbond 0");

    // Check if the user has any malt locked due to governance voting
    // uint256 lockedMalt = dao.getLockedMalt(msg.sender);
    (uint256 accountTotalBondedValue,) = realValueOfBonded(msg.sender);
    (uint256 realMaltValue,) = maltPoolPeriphery.realValueOfLPToken(amount);

    // Users total available balance must be gte the value they are trying to withdraw
    require(accountTotalBondedValue >= realMaltValue, "Insufficient balance to unbond");

    uint256 bondedBalance = balanceOfBonded(msg.sender);
    require(bondedBalance > 0, "Insufficient bonded balance");
    require(amount <= bondedBalance, "Insufficient bonded balance");

    advance();

    _checkForForfeit(amount, bondedBalance);

    _removeFromEpochBonding(msg.sender, amount);

    uint256 lessStakePadding = balanceOfStakePadding(msg.sender).mul(amount).div(bondedBalance);
    uint256 lessMaltStakePadding = balanceOfMaltStakePadding(msg.sender).mul(amount).div(bondedBalance);

    _removeFromStakePadding(msg.sender, lessStakePadding, lessMaltStakePadding, "Insufficient stake padding");

    _updateCurrentEpochTotalRewards();

    _clearSubsidizedLP(msg.sender, bondedBalance);

    _unbond(amount);

    uint256 currentEpoch = dao.epoch();

    epochRewards[currentEpoch].totalBonded = _globals.bonded;
  }

  function withdraw(uint256 rewardAmount, uint256 maltAmount)
    external
    checkStart
  {
    advance();
    (uint256 rewardEarned, uint256 maltEarned) = earned(msg.sender);

    require(rewardAmount <= rewardEarned, "Cannot withdraw more than earned");
    require(maltAmount <= maltEarned, "Cannot withdraw more malt than earned");

    // Remove from reward and add equivalent to stake padding.
    // Conservation of reward space volume
    _addToStakePadding(msg.sender, rewardAmount, maltAmount);
    _globals.declaredBalance = _globals.declaredBalance.sub(rewardAmount);
    _globals.declaredMaltBalance = _globals.declaredMaltBalance.sub(maltAmount);

    _updateCurrentEpochTotalRewards();

    _addToEpochWithdraw(msg.sender, rewardAmount, maltAmount);

    _removeFromUnbondedBalance(msg.sender, rewardEarned, maltEarned);

    _withdraw(rewardAmount, maltAmount);
  }
}

File 2 of 21 : Initializable.sol
pragma solidity >=0.4.24 <0.7.0;


/**
 * @title Initializable
 *
 * @dev Helper contract to support initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 */
contract Initializable {

  /**
   * @dev Indicates that the contract has been initialized.
   */
  bool private initialized;

  /**
   * @dev Indicates that the contract is in the process of being initialized.
   */
  bool private initializing;

  /**
   * @dev Modifier to use in the initializer function of a contract.
   */
  modifier initializer() {
    require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");

    bool isTopLevelCall = !initializing;
    if (isTopLevelCall) {
      initializing = true;
      initialized = true;
    }

    _;

    if (isTopLevelCall) {
      initializing = false;
    }
  }

  /// @dev Returns true if and only if the function is running in the constructor
  function isConstructor() private view returns (bool) {
    // extcodesize checks the size of the code stored in an address, and
    // address returns the current address. Since the code is still not
    // deployed when running a constructor, any checks on its code size will
    // yield zero, making it an effective way to detect if a contract is
    // under construction or not.
    address self = address(this);
    uint256 cs;
    assembly { cs := extcodesize(self) }
    return cs == 0;
  }

  // Reserved storage space to allow for layout changes in the future.
  uint256[50] private ______gap;
}

File 3 of 21 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 4 of 21 : IDAO.sol
pragma solidity >=0.6.6;

interface IDAO {
  function epoch() external view returns (uint256);
  function epochLength() external view returns (uint256);
  function genesisTime() external view returns (uint256);
  function getEpochStartTime(uint256 _epoch) external view returns (uint256);
  function getLockedMalt(address account) external view returns (uint256);
}

File 5 of 21 : IStabilizerNode.sol
pragma solidity >=0.6.6;

import "./IAuction.sol";

interface IStabilizerNode {
  function initialize(address dao) external;
  function requiredMint() external;
  function distributeSupply(uint256 amount) external;
  function liquidityMine() external view returns (address);
  function requestMint(uint256 amount) external;
  function requestBurn(uint256 amount) external;
  function stabilize() external;
  function auction() external view returns (IAuction);
  function auctionPreBurn(
    uint256 maxSpend,
    uint256 rRatio,
    uint256 decimals
  ) external returns (
    uint256 initialReservePledge,
    uint256 initialBurn
  );
}

File 6 of 21 : LPPrivileged.sol
pragma solidity >=0.6.6;

import "./LPSetters.sol";

contract LiquidityMinePrivileged is LiquidityMineSetters {
  function declareReward(uint256 amount)
    external
    onlyRole(STABILIZER_NODE_ROLE, "Only stabilizer node")
  {
    _rewardCheck(amount, 0);

    if (totalBonded() == 0) {
      // There is no accounts to distribute the rewards to so forfeit it to the dao
      _forfeit(amount);
      _updateCurrentEpochTotalRewards();
      return;
    } 
    
    _addEpochRewards(amount, 0);

    emit DeclareReward(0, amount, address(rewardToken));
  }

  function declareMaltReward(uint256 amount)
    external
    onlyRole(STABILIZER_NODE_ROLE, "Only stabilizer node")
  {
    _rewardCheck(0, amount);

    if (totalBonded() == 0) {
      // There is no accounts to distribute the rewards to so forfeit it to the dao
      _forfeitMalt(amount);
      _updateCurrentEpochTotalRewards();
      return;
    } 

    _addEpochRewards(0, amount);
    emit DeclareReward(amount, 0, address(rewardToken));
  }

  function setNewPoolPeriphery(address _periphery)
    external
    onlyRole(TIMELOCK_ROLE, "Must have timelock role")
  {
    maltPoolPeriphery = IMaltPoolPeriphery(_periphery);
    emit SetNewMaltPeriphery(_periphery);
  }

  function setNewStabilizerNode(address _node)
    external
    onlyRole(TIMELOCK_ROLE, "Must have timelock role")
  {
    _swapRole(_node, address(stabilizerNode), STABILIZER_NODE_ROLE);
    stabilizerNode = IStabilizerNode(_node);
    emit SetStabilizerNode(_node);
  }

  function setNewReinvestor(address _reinvestor)
    external
    onlyRole(TIMELOCK_ROLE, "Must have timelock role")
  {
    _swapRole(_reinvestor, reinvestor, REINVESTOR_ROLE);
    reinvestor = _reinvestor;
    emit SetNewReinvestor(_reinvestor);
  }

  function updateBond(address account, uint256 amountReward, uint256 maltRemoval, uint256 liquidity)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    _updateBond(account, amountReward, maltRemoval, liquidity);
  }

  function finalizeSubsidy(address account, uint256 amountReward, uint256 liquidity)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    // Remove from reward and add equivalent to stake padding.
    // This reward now exists in LP tokens instead
    _addToStakePadding(account, amountReward, 0);
    _globals.declaredBalance = _globals.declaredBalance.sub(amountReward);

    _updateCurrentEpochTotalRewards();

    uint256 currentEpoch = dao.epoch();

    _addToEpochWithdraw(account, amountReward, 0);

    _handleStakePadding(account, liquidity);

    _addToBonded(account, liquidity);
    _addToSubsidizedLP(account, liquidity.div(2));

    epochRewards[currentEpoch].totalBonded = _globals.bonded;

    _balanceCheck();
  }

  function transferExcessMalt(address account, uint256 requiredMalt, uint256 maltAmount)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    if (requiredMalt > maltAmount) {
      malt.safeTransferFrom(account, address(this), requiredMalt.sub(maltAmount));
    }
  }

  function transferExcessReward(address account, uint256 requiredReward, uint256 rewardAmount)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    if (requiredReward > rewardAmount) {
      rewardToken.safeTransferFrom(account, address(this), requiredReward.sub(rewardAmount));
    }
  }

  function requestMint(uint256 amount)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    stabilizerNode.requestMint(amount);
    malt.safeTransfer(reinvestor, amount);
  }

  function requestBurn(uint256 amount)
    external
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    malt.transfer(address(stabilizerNode), amount);
    stabilizerNode.requestBurn(amount);
  }

  function reinvestLiquidity(
    address account,
    uint256 liquidityMalt,
    uint256 liquidityReward,
    bool rebalanceMalt,
    uint256 otherQuantity
  )
    public
    onlyRole(REINVESTOR_ROLE, "Must have reinvestor role")
  {
    // rebalanceMalt defines whether we may need to transfer back malt or reward tokens to the caller
    // otherQuantity is how much of the other token's rewards is used to make up the liquidity.
    // As opposed to being transfered in by the user.
    ReinvestRebalance memory rebalance = ReinvestRebalance({
      rewardRemoval: 0,
      maltRemoval: 0,
      excess: 0,
      minMalt: liquidityMalt.mul(95).div(100),
      minReward: liquidityReward.mul(95).div(100)
    });

    malt.approve(address(router), liquidityMalt);
    rewardToken.approve(address(router), liquidityReward);

    (
      uint256 amountMalt,
      uint256 amountReward,
      uint256 liquidity
    ) = router.addLiquidity(
      address(malt),
      address(rewardToken),
      liquidityMalt,
      liquidityReward,
      rebalance.minMalt, // 5% slippage
      rebalance.minReward, // 5% slippage
      address(this),
      now
    );

    if (rebalanceMalt) {
      rebalance.rewardRemoval = amountReward;
      rebalance.maltRemoval = otherQuantity;

      if (amountMalt < liquidityMalt) {
        rebalance.excess = liquidityMalt.sub(amountMalt);

        if (amountMalt > otherQuantity) {
          // Transfer excess back
          malt.safeTransfer(account, rebalance.excess);
        } else {
          // Not all of otherQuantity was used so don't remove it all
          rebalance.maltRemoval = amountMalt;
          malt.safeTransfer(account, liquidityMalt.sub(otherQuantity));
        }
      }
    } else {
      rebalance.rewardRemoval = otherQuantity;
      rebalance.maltRemoval = amountMalt;

      if (amountReward < liquidityReward) {
        rebalance.excess = liquidityReward.sub(amountReward);

        if (amountReward > otherQuantity) {
          // Transfer excess back
          rewardToken.safeTransfer(account, rebalance.excess);
        } else {
          // Not all of desiredReward was used so don't remove it all
          rebalance.rewardRemoval = amountReward;
          rewardToken.safeTransfer(account, liquidityReward.sub(otherQuantity));
        }
      }
    }

    _updateBond(account, rebalance.rewardRemoval, rebalance.maltRemoval, liquidity);
  }
}

File 7 of 21 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 8 of 21 : IAuction.sol
pragma solidity >=0.6.6;

interface IAuction {
  function checkAuctionFinalization() external returns (
    bool shouldFinalize,
    uint256 id
  );
  function currentAuctionId() external view returns (uint256);
  function auctionActive(uint256 _id) external view returns (bool);
  function capCommitment(
    uint256 _id,
    uint256 _commitment
  ) external view returns (
    uint256 realCommitment,
    uint256 purchaseCommitment
  );
  function commitFunds(
    uint256 _id,
    uint256 _commitment,
    uint256 _maltPurchased,
    address account
  ) external;
  function userClaimableArbTokens(
    address account,
    uint256 auctionId
  ) external view returns (uint256);
  function claimArb(
    uint256 _id,
    address account,
    uint256 amount
  ) external returns (bool);
  function claimableArbitrageRewards() external view returns (uint256);
  function setupAuctionFinalization(uint256 _id) external returns (
    uint256 averageMaltPrice,
    uint256 commitments,
    uint256 startingPrice,
    uint256 finalPrice,
    uint256 preAuctionReserveRatio,
    uint256 initialReservePledge
  );
  function allocateArbRewards(
    uint256 rewarded,
    uint256 replenishSplit
  ) external returns (uint256);
  function createAuction(uint256 pegPrice) external returns (
    uint256 initialPurchase,
    bool executeBurn
  );
  function getActiveAuction() external view returns (
    uint256 auctionId,
    uint256 maxCommitments,
    uint256 commitments,
    uint256 maltPurchased,
    uint256 startingPrice,
    uint256 endingPrice,
    uint256 finalPrice,
    uint256 pegPrice,
    uint256 startingTime,
    uint256 endingTime,
    uint256 initialReservePledge
  );
  function getAuction(uint256 id) external view returns (
    uint256 auctionId,
    uint256 maxCommitments,
    uint256 commitments,
    uint256 maltPurchased,
    uint256 startingPrice,
    uint256 endingPrice,
    uint256 finalPrice,
    uint256 pegPrice,
    uint256 startingTime,
    uint256 endingTime,
    uint256 initialReservePledge
  );
  function balanceOfArbTokens(
    uint256 auctionId,
    address account
  ) external view returns (uint256);
  function getAuctionCommitments(uint256 auctionId) external view returns (uint256, uint256);
}

File 9 of 21 : LPSetters.sol
pragma solidity >=0.6.6;

import "./LPGetters.sol";

contract LiquidityMineSetters is LiquidityMineGetters {
  function advance() public {
    uint256 currentEpoch = dao.epoch();

    // This is should be called right at the start of the epoch to lock in how much
    // was bonded and how much stake padding etc there is to make accounting easier
    if (!epochRewards[currentEpoch].advanced) {
      uint256 bonded = totalBonded();
      (uint256 maltValue, uint256 rewardValue) = maltPoolPeriphery.realValueOfLPToken(bonded);
      epochRewards[currentEpoch].totalBonded = bonded;
      epochRewards[currentEpoch].advanced = true;
      epochRewards[currentEpoch].valueOfBondedMalt = maltValue;
      epochRewards[currentEpoch].valueOfBondedReward = rewardValue;
      epochRewards[currentEpoch].stakePadding = _globals.stakePadding;
      epochRewards[currentEpoch].maltStakePadding = _globals.maltStakePadding;

      emit Advance(currentEpoch, now);
    }

    _updateCurrentEpochTotalRewards();
  }

  function _bond(address account, uint256 amount) internal notSameBlock {
    stakeToken.safeTransferFrom(msg.sender, address(this), amount);

    _addToBonded(account, amount);

    _balanceCheck();

    emit Bond(account, amount);
  }

  function _unbond(uint256 amountLPToken) internal notSameBlock {
    _removeFromBonded(msg.sender, amountLPToken, "LP: Insufficient bonded balance");

    stakeToken.safeTransfer(msg.sender, amountLPToken);

    _balanceCheck();

    emit Unbond(msg.sender, amountLPToken);
  }

  function _withdraw(uint256 amountReward, uint256 maltReward) internal notSameBlock {
    rewardToken.safeTransfer(msg.sender, amountReward);
    malt.safeTransfer(msg.sender, maltReward);

    _balanceCheck();

    emit Withdraw(msg.sender, amountReward, maltReward);
  }

  function _addToBonded(address account, uint256 amount) internal {
    userState[account].bonded = userState[account].bonded.add(amount);
    _globals.bonded = _globals.bonded.add(amount);
  }

  function _addToSubsidizedLP(address account, uint256 amount) internal {
    userState[account].subsidizedLP = userState[account].subsidizedLP.add(amount);
    _globals.subsidizedLP = _globals.subsidizedLP.add(amount);
  }

  function _removeFromBonded(address account, uint256 amount, string memory reason) internal {
    userState[account].bonded = userState[account].bonded.sub(amount, reason);
    _globals.bonded = _globals.bonded.sub(amount, reason);
  }

  function removeFromSubsidizedLP(address account, uint256 amount, string memory reason) internal {
    userState[account].subsidizedLP = userState[account].subsidizedLP.sub(amount, reason);
    _globals.subsidizedLP = _globals.subsidizedLP.sub(amount, reason);
  }

  function _updateBond(address account, uint256 amountReward, uint256 maltRemoval, uint256 liquidity) internal {
    // Remove from reward and add equivalent to stake padding.
    // Conservation of reward space volume
    // This reward now exists in LP tokens instead
    _addToStakePadding(account, amountReward, maltRemoval);
    _globals.declaredBalance = _globals.declaredBalance.sub(amountReward);
    _globals.declaredMaltBalance = _globals.declaredMaltBalance.sub(maltRemoval);

    _updateCurrentEpochTotalRewards();

    uint256 currentEpoch = dao.epoch();

    _addToEpochWithdraw(account, amountReward, maltRemoval);

    _handleStakePadding(account, liquidity);

    _addToBonded(account, liquidity);

    epochRewards[currentEpoch].totalBonded = _globals.bonded;

    _balanceCheck();

    emit Bond(account, liquidity);
  }

  function _handleStakePadding(address account, uint256 amount) internal {
    // Bond the new LP tokens to the user
    _addToEpochBonding(account, amount);
    
    uint256 totalRewardedWithStakePadding = totalRewarded().add(totalStakePadding());
    uint256 totalMaltWithStakePadding = totalMaltRewarded().add(totalMaltStakePadding());

    uint256 INITIAL_STAKE_SHARE_MULTIPLE = 1e6;

    uint256 newStakePadding = totalBonded() == 0 ?
      totalRewarded() == 0 ? amount.mul(INITIAL_STAKE_SHARE_MULTIPLE) : 0 :
      totalRewardedWithStakePadding.mul(amount).div(totalBonded());

    uint256 newMaltStakePadding = totalBonded() == 0 ?
      totalMaltRewarded() == 0 ? amount.mul(INITIAL_STAKE_SHARE_MULTIPLE) : 0 :
      totalMaltWithStakePadding.mul(amount).div(totalBonded());
    
    _addToStakePadding(account, newStakePadding, newMaltStakePadding);

    if (balanceOfBonded(account) == 0) {
      userState[account].bondedEpoch = dao.epoch();
    }
  }

  function _addToStakePadding(address account, uint256 amount, uint256 amountMalt) internal {
    userState[account].stakePadding = userState[account].stakePadding.add(amount);
    userState[account].maltStakePadding = userState[account].maltStakePadding.add(amountMalt);
    _globals.stakePadding = _globals.stakePadding.add(amount);
    _globals.maltStakePadding = _globals.maltStakePadding.add(amountMalt);

    uint256 currentEpoch = dao.epoch();

    epochRewards[currentEpoch].stakePadding = _globals.stakePadding;
    epochRewards[currentEpoch].maltStakePadding = _globals.maltStakePadding;

    userState[account].epochStakePadding[currentEpoch].reward = userState[account].epochStakePadding[currentEpoch].reward + int256(amount);
    userState[account].epochStakePadding[currentEpoch].malt = userState[account].epochStakePadding[currentEpoch].malt + int256(amountMalt);
  }

  function _removeFromStakePadding(address account, uint256 amount, uint256 amountMalt, string memory reason) internal {
    userState[account].stakePadding = userState[account].stakePadding.sub(amount, reason);
    userState[account].maltStakePadding = userState[account].maltStakePadding.sub(amountMalt, reason);
    _globals.stakePadding = _globals.stakePadding.sub(amount, reason);
    _globals.maltStakePadding = _globals.maltStakePadding.sub(amountMalt, reason);

    uint256 currentEpoch = dao.epoch();

    epochRewards[currentEpoch].stakePadding = _globals.stakePadding;
    epochRewards[currentEpoch].maltStakePadding = _globals.maltStakePadding;

    // These are signed ints. It should be allowed to go negative
    userState[account].epochStakePadding[currentEpoch].reward = userState[account].epochStakePadding[currentEpoch].reward - int256(amount);
    userState[account].epochStakePadding[currentEpoch].malt = userState[account].epochStakePadding[currentEpoch].malt - int256(amountMalt);
  }

  function _addToEpochBonding(address account, uint256 amount) internal {
    uint256 currentEpoch = dao.epoch();
    userState[account].bondEpochs.push(currentEpoch);
    userState[account].epochBonds[currentEpoch] = userState[account].epochBonds[currentEpoch].add(amount);
  }

  function _removeFromEpochBonding(address account, uint256 amount) internal {
    uint256 currentEpoch = dao.epoch();
    userState[account].unbondEpochs.push(currentEpoch);
    userState[account].epochUnbonds[currentEpoch] = userState[account].epochUnbonds[currentEpoch].add(amount);
  }

  function _addToEpochWithdraw(address account, uint256 amountReward, uint256 amountMalt) internal {
    uint256 currentEpoch = dao.epoch();
    userState[account].withdrawEpochs.push(currentEpoch);
    userState[account].epochWithdraws[currentEpoch].reward = userState[account].epochWithdraws[currentEpoch].reward.add(amountReward);
    userState[account].epochWithdraws[currentEpoch].malt = userState[account].epochWithdraws[currentEpoch].malt.add(amountMalt);
  }

  function _addToUnbondedBalance(address account, uint256 amount, uint256 amountMalt) internal {
    _globals.unbondedBalance = _globals.unbondedBalance + amount;
    _globals.unbondedMaltBalance = _globals.unbondedMaltBalance + amountMalt;

    userState[account].unbondedBalance = userState[account].unbondedBalance + amount;
    userState[account].unbondedMaltBalance = userState[account].unbondedMaltBalance + amountMalt;
  }

  function _removeFromUnbondedBalance(address account, uint256 amount, uint256 amountMalt) internal {
    uint256 rewardRemoval = 0;
    uint256 maltRemoval = 0;

    if (amount > userState[account].unbondedBalance) {
      rewardRemoval = userState[account].unbondedBalance;
      userState[account].unbondedBalance = 0;
    } else {
      rewardRemoval = amount;
      userState[account].unbondedBalance = userState[account].unbondedBalance.sub(amount);
    }

    if (amountMalt > userState[account].unbondedMaltBalance) {
      maltRemoval = userState[account].unbondedMaltBalance;
      userState[account].unbondedMaltBalance = 0;
    } else {
      maltRemoval = amountMalt;
      userState[account].unbondedMaltBalance = userState[account].unbondedMaltBalance.sub(amountMalt);
    }

    _globals.unbondedBalance = _globals.unbondedBalance.sub(rewardRemoval);
    _globals.unbondedMaltBalance = _globals.unbondedMaltBalance.sub(maltRemoval);
  }

  function _clearSubsidizedLP(address account, uint256 bondedBalance) internal {
    uint256 subsidies = balanceOfSubsidizedLP(account);

    if (subsidies > 0) {
      _removeFromEpochBonding(account, subsidies);

      uint256 lessStakePadding = balanceOfStakePadding(account).mul(subsidies).div(bondedBalance.add(subsidies));
      uint256 lessMaltStakePadding = balanceOfMaltStakePadding(account).mul(subsidies).div(bondedBalance.add(subsidies));

      _removeFromStakePadding(account, lessStakePadding, lessMaltStakePadding, "Insufficient stake padding");

      _removeFromBonded(account, subsidies, "LP: Insufficient bonded balance");
      removeFromSubsidizedLP(account, subsidies, "Subsidized LP: Insufficient balance");

      stakeToken.safeTransfer(treasuryMultisig, subsidies);
      _balanceCheck();
    }
  }

  function _checkForForfeit(uint256 amount, uint256 bondedBalance) internal {
    (uint256 rewardEarned, uint256 maltEarned) = earned(msg.sender);
    uint256 amountClaimable = rewardEarned.mul(amount).div(bondedBalance).sub(userState[msg.sender].unbondedBalance);
    uint256 maltClaimable = maltEarned.mul(amount).div(bondedBalance).sub(userState[msg.sender].unbondedMaltBalance);
    uint256 currentEpoch = dao.epoch();

    uint256 allocation = balanceOfRewards(msg.sender).mul(amount).div(bondedBalance);
    uint256 maltAllocation = balanceOfMaltRewards(msg.sender).mul(amount).div(bondedBalance);

    uint256 forfeited = allocation.sub(amountClaimable);

    if (forfeited > 0) {
      _forfeit(forfeited);
      userState[msg.sender].epochForfeits[currentEpoch].reward = userState[msg.sender].epochForfeits[currentEpoch].reward + forfeited;
    }

    uint256 forfeitedMalt = maltAllocation.sub(maltClaimable);

    if (forfeitedMalt > 0) {
      _forfeitMalt(forfeitedMalt);
      userState[msg.sender].epochForfeits[currentEpoch].malt = userState[msg.sender].epochForfeits[currentEpoch].malt + forfeitedMalt;
    }

    if (forfeited > 0 || forfeitedMalt > 0) {
      _addToStakePadding(msg.sender, forfeited, forfeitedMalt);
    }

    _addToUnbondedBalance(msg.sender, amountClaimable, maltClaimable);

    _updateCurrentEpochTotalRewards();
  }

  function _updateCurrentEpochTotalRewards() internal {
    uint256 currentEpoch = dao.epoch();

    epochRewards[currentEpoch].totalReward = _globals.declaredBalance;
    epochRewards[currentEpoch].totalMaltReward = _globals.declaredMaltBalance;
  }

  function _forfeit(uint256 forfeited) internal {
    _globals.declaredBalance = _globals.declaredBalance.sub(forfeited);

    rewardToken.safeTransfer(treasuryMultisig, forfeited);

    emit Forfeit(msg.sender, address(rewardToken), forfeited);
  }

  function _forfeitMalt(uint256 forfeited) internal {
    _globals.declaredMaltBalance = _globals.declaredMaltBalance.sub(forfeited);

    malt.safeTransfer(treasuryMultisig, forfeited);

    emit Forfeit(msg.sender, address(malt), forfeited);
  }

  function _addEpochRewards(uint256 reward, uint256 maltReward) internal {
    uint256 currentEpoch = dao.epoch();

    if (reward > 0) {
      epochRewards[currentEpoch].reward = epochRewards[currentEpoch].reward + reward;
    }
    if (maltReward > 0) {
      epochRewards[currentEpoch].maltReward = epochRewards[currentEpoch].maltReward + maltReward;
    }

    _updateCurrentEpochTotalRewards();

    if (epochRewards[currentEpoch].completionTime == 0) {
      epochRewards[currentEpoch].completionTime = dao.getEpochStartTime(
        currentEpoch.add(payoutDuration)
      );
    }

    advance();
  }
}

File 10 of 21 : LPGetters.sol
pragma solidity >=0.6.6;

import "./LPState.sol";

contract LiquidityMineGetters is LiquidityMineState {
  function totalBonded() public view returns (uint256) {
    return _globals.bonded;
  }

  function totalSubsidizedLp() public view returns (uint256) {
    return _globals.subsidizedLP;
  }

  function totalStakePadding() public view returns(uint256) {
    return _globals.stakePadding;  
  }

  function totalMaltStakePadding() public view returns(uint256) {
    return _globals.maltStakePadding;  
  }

  function totalRewarded() public view returns (uint256) {
    return _globals.declaredBalance;
  }

  function totalMaltRewarded() public view returns (uint256) {
    return _globals.declaredMaltBalance;
  }

  function totalBondedRewarded() public view returns (uint256) {
    return _globals.declaredBalance.sub(_globals.unbondedBalance);
  }

  function totalBondedMaltRewarded() public view returns (uint256) {
    return _globals.declaredMaltBalance.sub(_globals.unbondedMaltBalance);
  }

  function balanceOfBonded(address account) public view returns (uint256) {
    return userState[account].bonded.sub(userState[account].subsidizedLP);
  }

  function balanceOfSubsidizedLP(address account) public view returns (uint256) {
    return userState[account].subsidizedLP;
  }

  function balanceOfStakePadding(address account) public view returns (uint256) {
    return userState[account].stakePadding;
  }

  function balanceOfMaltStakePadding(address account) public view returns (uint256) {
    return userState[account].maltStakePadding;
  }

  function totalBondedAtEpoch(uint256 epoch) public view returns(uint256) {
    return epochRewards[epoch].totalBonded;
  }

  function totalRewardedAtEpoch(uint256 epoch) public view returns(uint256) {
    return epochRewards[epoch].reward;
  }

  function getEpochReward(uint256 epoch) public view returns (
    uint256 reward,
    uint256 maltReward,
    uint256 totalReward,
    uint256 totalMaltReward,
    uint256 stakePadding,
    uint256 maltStakePadding,
    uint256 completionTime,
    uint256 epochTotalBonded,
    uint256 valueOfBondedMalt,
    uint256 valueOfBondedReward
  ) {
    EpochRewards storage rewards = epochRewards[epoch];

    return (
      rewards.reward,
      rewards.maltReward,
      rewards.totalReward,
      rewards.totalMaltReward,
      rewards.stakePadding,
      rewards.maltStakePadding,
      rewards.completionTime,
      rewards.totalBonded,
      rewards.valueOfBondedMalt,
      rewards.valueOfBondedReward
    );
  }

  function getGlobalState() public view returns (
    uint256 bonded,
    uint256 subsidizedLP,
    uint256 stakePadding,
    uint256 maltStakePadding,
    uint256 unbondedBalance,
    uint256 unbondedMaltBalance,
    uint256 declaredBalance,
    uint256 declaredMaltBalance
  ) {
    return (
      _globals.bonded,
      _globals.subsidizedLP,
      _globals.stakePadding,
      _globals.maltStakePadding,
      _globals.unbondedBalance,
      _globals.unbondedMaltBalance,
      _globals.declaredBalance,
      _globals.declaredMaltBalance
    );
  }

  function getAccountState(address account) public view returns (
    uint256 bonded,
    uint256 subsidizedLP,
    uint256 stakePadding,
    uint256 maltStakePadding,
    uint256 bondedEpoch,
    uint256 unbondedBalance,
    uint256 unbondedMaltBalance
  ) {
    return (
      userState[account].bonded,
      userState[account].subsidizedLP,
      userState[account].stakePadding,
      userState[account].maltStakePadding,
      userState[account].bondedEpoch,
      userState[account].unbondedBalance,
      userState[account].unbondedMaltBalance
    );
  }

  function getAccountActionEpochs(address account) public view returns(
    uint256[] memory bondEpochs,
    uint256[] memory unbondEpochs,
    uint256[] memory withdrawEpochs
  ) {
    return (
      userState[account].bondEpochs,
      userState[account].unbondEpochs,
      userState[account].withdrawEpochs
    );
  }

  function getAccountEpochData(address account, uint256 epoch) public view returns (
    uint256 bonded,
    uint256 unbonded,
    uint256 withdrawnReward,
    uint256 withdrawnMalt,
    uint256 forfeitedReward,
    uint256 forfeitedMalt
  ) {
    return (
      userState[account].epochBonds[epoch],
      userState[account].epochUnbonds[epoch],
      userState[account].epochWithdraws[epoch].reward,
      userState[account].epochWithdraws[epoch].malt,
      userState[account].epochForfeits[epoch].reward,
      userState[account].epochForfeits[epoch].malt
    );
  }

  function getAccountEpochStakePadding(address account, uint256 epoch) public view returns (
    int256 rewardStakePadding,
    int256 maltStakePadding
  ) {
    return (
      userState[account].epochStakePadding[epoch].reward,
      userState[account].epochStakePadding[epoch].malt
    );
  }

  function _balanceCheck() internal view {
    require(stakeToken.balanceOf(address(this)) >= totalBonded(), "Balance inconsistency");
  }

  function earned(address account) public view returns (uint256 earnedReward, uint256 earnedMalt) {
    uint256 currentEpoch = dao.epoch();

    if (userState[account].bondedEpoch == currentEpoch) {
      return (0, 0);
    }

    Totals memory accountTotals;

    uint256 initialEpoch = 0;
    if (currentEpoch > payoutDuration) {
      initialEpoch = currentEpoch - payoutDuration;
    }
    if (initialEpoch < userState[account].bondedEpoch) {
      initialEpoch = userState[account].bondedEpoch;
    }
    uint256 bondedBalance = balanceOfBonded(account) + balanceOfSubsidizedLP(account);

    accountTotals.stakePadding.reward = int256(balanceOfStakePadding(account));
    accountTotals.stakePadding.malt = int256(balanceOfMaltStakePadding(account));

    uint256 earnedTotal = 0;
    uint256 allocated = 0;

    for (uint256 i = currentEpoch; i > initialEpoch; i -= 1) {
      bondedBalance = bondedBalance - userState[account].epochBonds[i] + userState[account].epochUnbonds[i];

      accountTotals.stakePadding.reward = accountTotals.stakePadding.reward - userState[account].epochStakePadding[i].reward;
      accountTotals.stakePadding.malt = accountTotals.stakePadding.malt - userState[account].epochStakePadding[i].malt;

      accountTotals.withdraws.reward = accountTotals.withdraws.reward + userState[account].epochWithdraws[i].reward;
      accountTotals.withdraws.malt = accountTotals.withdraws.malt + userState[account].epochWithdraws[i].malt;

      (earnedTotal, allocated) = _epochEarnedRewards(i, bondedBalance);
      accountTotals.earned.reward = accountTotals.earned.reward + earnedTotal;
      accountTotals.allocated.reward = accountTotals.allocated.reward + allocated;

      (earnedTotal, allocated) = _epochEarnedMaltRewards(i, bondedBalance);
      accountTotals.earned.malt = accountTotals.earned.malt + earnedTotal;
      accountTotals.allocated.malt = accountTotals.allocated.malt + allocated;

      accountTotals.forfeited.reward = accountTotals.forfeited.reward + userState[account].epochForfeits[i].reward;
      accountTotals.forfeited.malt = accountTotals.forfeited.malt + userState[account].epochForfeits[i].malt;
    }

    // TODO go through anywhere we can use a conditional to avoid writing a new value to storage Tue 30 Mar 2021 12:34:03 BST

    // Add full rewards from initialEpoch
    if (initialEpoch > userState[account].bondedEpoch) {
      bondedBalance = bondedBalance - userState[account].epochBonds[initialEpoch] + userState[account].epochUnbonds[initialEpoch];
      accountTotals.stakePadding.reward = accountTotals.stakePadding.reward - userState[account].epochStakePadding[initialEpoch].reward;
      accountTotals.stakePadding.malt = accountTotals.stakePadding.malt - userState[account].epochStakePadding[initialEpoch].malt;

      allocated = _epochBalanceOfRewards(initialEpoch, uint256(accountTotals.stakePadding.reward), bondedBalance);
      accountTotals.earned.reward = accountTotals.earned.reward + allocated;
      accountTotals.allocated.reward = accountTotals.allocated.reward + allocated;

      allocated = _epochBalanceOfMaltRewards(initialEpoch, uint256(accountTotals.stakePadding.malt), bondedBalance);
      accountTotals.earned.malt = accountTotals.earned.malt + allocated;
      accountTotals.allocated.malt = accountTotals.allocated.malt + allocated;
    }

    // Subtract totalWithdraws
    if (accountTotals.withdraws.reward >= accountTotals.earned.reward) {
      accountTotals.earned.reward = 0;
    } else {
      accountTotals.earned.reward = accountTotals.earned.reward - accountTotals.withdraws.reward;
    }

    if (accountTotals.withdraws.malt >= accountTotals.earned.malt) {
      accountTotals.earned.malt = 0;
    } else {
      accountTotals.earned.malt = accountTotals.earned.malt - accountTotals.withdraws.malt;
    }

    if (accountTotals.earned.reward > accountTotals.allocated.reward.sub(accountTotals.forfeited.reward)) {
      accountTotals.earned.reward = accountTotals.allocated.reward.sub(accountTotals.forfeited.reward);
    }

    if (accountTotals.earned.malt > accountTotals.allocated.malt.sub(accountTotals.forfeited.malt)) {
      accountTotals.earned.malt = accountTotals.allocated.malt.sub(accountTotals.forfeited.malt);
    }

    return (accountTotals.earned.reward, accountTotals.earned.malt);
  }

  function balanceOfRewards(address account) public view returns (uint256) {
    /*
     * This represents the rewards allocated to a given account but does not
     * mean all these rewards are unlocked yet. The earned method will
     * fetch the balance that is unlocked for an account
     */
    uint256 globalBondedTotal = totalBonded();
    if (globalBondedTotal == 0) {
      return 0;
    }

    uint256 totalRewardedWithStakePadding = totalBondedRewarded().add(totalStakePadding());
    uint256 balanceOfRewardedWithStakePadding = totalRewardedWithStakePadding
      .mul(balanceOfBonded(account).add(balanceOfSubsidizedLP(account)))
      .div(globalBondedTotal);

    uint256 stakePaddingBalance = balanceOfStakePadding(account);

    if (balanceOfRewardedWithStakePadding > stakePaddingBalance) {
      return balanceOfRewardedWithStakePadding - stakePaddingBalance;
    }
    return 0;
  }

  function balanceOfMaltRewards(address account) public view returns (uint256) {
    /*
     * This represents the malt rewards allocated to a given account but does not
     * mean all these rewards are unlocked yet. The earned method will
     * fetch the balance that is unlocked for an account
     */
    uint256 globalBondedTotal = totalBonded();
    if (globalBondedTotal == 0) {
      return 0;
    }

    uint256 totalRewardedWithStakePadding = totalBondedMaltRewarded().add(totalMaltStakePadding());
    uint256 balanceOfRewardedWithStakePadding = totalRewardedWithStakePadding
      .mul(balanceOfBonded(account).add(balanceOfSubsidizedLP(account)))
      .div(globalBondedTotal);

    uint256 stakePaddingBalance = balanceOfMaltStakePadding(account);
    if (balanceOfRewardedWithStakePadding > stakePaddingBalance) {
      return balanceOfRewardedWithStakePadding.sub(stakePaddingBalance);
    }
    return 0;
  }

  function _epochEarnedRewards(
    uint256 epoch,
    uint256 bondedBalance
  ) internal view returns (uint256, uint256) {
    if (epochRewards[epoch].reward == 0 || bondedBalance == 0) {
      return (0, 0);
    }

    uint256 previousEpoch = epoch > 0 ? epoch - 1 : 0;
    uint256 epochMaturity = block.timestamp - dao.getEpochStartTime(epoch);

    uint256 globalBondedTotal = epochRewards[previousEpoch].totalBonded;
    if (globalBondedTotal == 0) {
      return (0, 0);
    }

    uint256 rewardBalance = epochRewards[epoch].reward.mul(bondedBalance).div(globalBondedTotal);

    return (rewardBalance.mul(epochMaturity).div(payoutDuration * dao.epochLength()), rewardBalance);
  }

  function _epochEarnedMaltRewards(
    uint256 epoch,
    uint256 bondedBalance
  ) internal view returns (uint256, uint256) {
    if (epochRewards[epoch].maltReward == 0 || bondedBalance == 0) {
      return (0, 0);
    }

    uint256 previousEpoch = epoch > 0 ? epoch - 1 : 0;
    uint256 epochMaturity = block.timestamp - dao.getEpochStartTime(epoch);

    uint256 globalBondedTotal = epochRewards[previousEpoch].totalBonded;
    if (globalBondedTotal == 0) {
      return (0, 0);
    }

    uint256 rewardBalance = epochRewards[epoch].maltReward.mul(bondedBalance).div(globalBondedTotal);

    return (rewardBalance.mul(epochMaturity).div(payoutDuration * dao.epochLength()), rewardBalance);
  }

  function _epochBalanceOfRewards(
    uint256 epoch,
    uint256 stakePadding,
    uint256 bondedBalance
  ) internal view returns (uint256) {
    if (epochRewards[epoch].totalReward == 0 || bondedBalance == 0) {
      return 0;
    }

    uint256 previousEpoch = epoch > 0 ? epoch - 1 : 0;

    uint256 globalBondedTotal = epochRewards[previousEpoch].totalBonded;
    if (globalBondedTotal == 0) {
      return 0;
    }

    uint256 totalRewardedWithStakePadding = epochRewards[epoch].totalReward + epochRewards[previousEpoch].stakePadding;
    uint256 balanceOfRewardedWithStakePadding = totalRewardedWithStakePadding
      .mul(bondedBalance)
      .div(globalBondedTotal);

    if (balanceOfRewardedWithStakePadding > stakePadding) {
      return balanceOfRewardedWithStakePadding - stakePadding;
    }

    return 0;
  }

  function _epochBalanceOfMaltRewards(
    uint256 epoch,
    uint256 stakePadding,
    uint256 bondedBalance
  ) internal view returns (uint256) {
    if (epochRewards[epoch].totalMaltReward == 0 || bondedBalance == 0) {
      return 0;
    }

    uint256 previousEpoch = epoch > 0 ? epoch - 1 : 0;

    uint256 globalBondedTotal = epochRewards[previousEpoch].totalBonded;
    if (globalBondedTotal == 0) {
      return 0;
    }

    uint256 totalMaltRewardedWithStakePadding = epochRewards[epoch].totalMaltReward + epochRewards[previousEpoch].maltStakePadding;
    uint256 balanceOfMaltRewardedWithStakePadding = totalMaltRewardedWithStakePadding
      .mul(bondedBalance)
      .div(globalBondedTotal);

    if (balanceOfMaltRewardedWithStakePadding > stakePadding) {
      return balanceOfMaltRewardedWithStakePadding - stakePadding;
    }

    return 0;
  }

  function realValueOfBonded(address account) public view returns (uint256, uint256) {
    uint256 bondedBalance = balanceOfBonded(account);
    return maltPoolPeriphery.realValueOfLPToken(bondedBalance);
  }

  function realValueOfSubsidizedLP(address account) public view returns (uint256, uint256) {
    uint256 subsidizedBalance = balanceOfSubsidizedLP(account);
    return maltPoolPeriphery.realValueOfLPToken(subsidizedBalance);
  }

  function _rewardCheck(uint256 reward, uint256 rewardMalt) internal {
    require(reward > 0 || rewardMalt > 0, "Cannot declare 0 reward");

    _globals.declaredBalance = _globals.declaredBalance.add(reward);
    _globals.declaredMaltBalance = _globals.declaredMaltBalance.add(rewardMalt);

    require(_globals.declaredBalance <= rewardToken.balanceOf(address(this)), "Insufficient balance");
    require(_globals.declaredMaltBalance <= malt.balanceOf(address(this)), "Insufficient balance");
  }
}

File 11 of 21 : LPState.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';

import "../interfaces/IDAO.sol";
import "../interfaces/IStabilizerNode.sol";
import "../interfaces/IMaltPoolPeriphery.sol";
import "../Permissions.sol";

struct Pair {
  uint256 reward;
  uint256 malt;
}

struct SignedPair {
  int256 reward;
  int256 malt;
}

struct Totals {
  Pair withdraws;
  Pair earned;
  Pair forfeited;
  Pair allocated;
  SignedPair stakePadding;
}

struct State {
  uint256 bonded;
  uint256 subsidizedLP;
  uint256 stakePadding;
  uint256 maltStakePadding;
  uint256 unbondedBalance;
  uint256 unbondedMaltBalance;
  uint256 declaredBalance;
  uint256 declaredMaltBalance;
}

struct UserState {
  uint256 bonded;
  uint256 subsidizedLP;
  uint256 stakePadding;
  uint256 maltStakePadding;
  uint256 bondedEpoch;
  uint256 unbondedBalance;
  uint256 unbondedMaltBalance;
  uint256[] bondEpochs;
  uint256[] unbondEpochs;
  uint256[] withdrawEpochs;
  mapping(uint256 => uint256) epochBonds;
  mapping(uint256 => uint256) epochUnbonds;
  mapping(uint256 => Pair) epochWithdraws;
  mapping(uint256 => Pair) epochForfeits;
  mapping(uint256 => SignedPair) epochStakePadding;
}

struct EpochRewards {
  uint256 reward;
  uint256 maltReward;
  uint256 totalReward;
  uint256 totalMaltReward;
  uint256 stakePadding;
  uint256 maltStakePadding;
  uint256 completionTime;
  uint256 totalBonded;
  uint256 valueOfBondedMalt;
  uint256 valueOfBondedReward;
  bool advanced;
}

struct UnlockData {
  uint256 totalReward;
  uint256 unlockedReward;
  uint256 totalMalt;
  uint256 unlockedMalt;
  uint256 userBondedTotal;
}

struct ReinvestRebalance {
  uint256 rewardRemoval;
  uint256 maltRemoval;
  uint256 excess;
  uint256 minMalt;
  uint256 minReward;
}
  
contract LiquidityMineState is Permissions {
  using SafeMath for uint256;
  using SafeERC20 for ERC20;

  bytes32 public constant REINVESTOR_ROLE = keccak256("REINVESTOR_ROLE");

  ERC20 public malt;
  ERC20 public rewardToken;
  ERC20 public stakeToken;
  IDAO public dao;
  IUniswapV2Router02 public router;

  IMaltPoolPeriphery public maltPoolPeriphery;
  IStabilizerNode public stabilizerNode;
  address public reinvestor;

  address public treasuryMultisig;
  string public mineName;
  uint256 public payoutDuration;
  uint256 public startTime;

  State internal _globals;
  mapping(address => UserState) internal userState;
  mapping(uint256 => EpochRewards) public epochRewards;

  event Bond(address indexed account, uint256 value);
  event Unbond(address indexed account, uint256 value);
  event Withdraw(address indexed account, uint256 rewarded, uint256 maltReward);
  event Forfeit(address indexed account, address token, uint256 amount);
  event Advance(uint256 epoch, uint256 timestamp);
  event DeclareReward(uint256 amountMalt, uint256 amountReward, address rewardToken);
  event SetStabilizerNode(address stabilizerNode);
  event SetNewMaltPeriphery(address maltPeriphery);
  event SetNewReinvestor(address reinvestor);

  function _checkStart() internal view {
    require(
      block.timestamp >= startTime,
      "Before start time"
    );
  }

  // Calling internal function reduces bytecode size
  modifier checkStart() {
    _checkStart();
    _;
  }
}

File 12 of 21 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 13 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

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

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

File 14 of 21 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

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

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

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

File 15 of 21 : IMaltPoolPeriphery.sol
pragma solidity >=0.6.6;

interface IMaltPoolPeriphery {
  function maltMarketPrice() external view returns (uint256 price, uint256 decimals);
  function reserves() external view returns (uint256 maltSupply, uint256 rewardSupply);
  function reserveRatio() external view returns (uint256, uint256); 
  function calculateAuctionPricing(
    uint256 rRatio
  ) external returns (uint256 startingPrice, uint256 endingPrice);
  function calculateMintingTradeSize(uint256 dampingFactor) external view returns (uint256);
  function calculateBurningTradeSize() external view returns (uint256);
  function calculateFixedReward(uint256, uint256) external view returns (uint256);
  function realValueOfLPToken(uint256 amount) external view returns (uint256, uint256);
  function getOptimalLiquidity(address tokenA, address tokenB, uint256 liquidityB) external view returns (uint256 liquidityA);
}

File 16 of 21 : Permissions.sol
pragma solidity >=0.6.6;

import "@openzeppelin/contracts/access/AccessControl.sol";

contract Permissions is AccessControl {
  // Timelock has absolute power across the system
  bytes32 public constant TIMELOCK_ROLE = keccak256("TIMELOCK_ROLE");
  bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE");

  // Can mint/burn Malt
  bytes32 public constant MONETARY_REGULATOR_ROLE = keccak256("MONETARY_REGULATOR_ROLE");

  // Contract types
  bytes32 public constant STABILIZER_NODE_ROLE = keccak256("STABILIZER_NODE_ROLE");
  bytes32 public constant LIQUIDITY_MINE_ROLE = keccak256("LIQUIDITY_MINE_ROLE");
  bytes32 public constant AUCTION_ROLE = keccak256("AUCTION_ROLE");

  address internal admin;

  mapping(address => uint256) public lastBlock; // protect against reentrancy

  function _adminSetup(address _timelock) internal {
    _roleSetup(TIMELOCK_ROLE, _timelock);
    _roleSetup(GOVERNOR_ROLE, _timelock);
    _roleSetup(MONETARY_REGULATOR_ROLE, _timelock);
    _roleSetup(STABILIZER_NODE_ROLE, _timelock);

    admin = _timelock;
  }

  function assignRole(bytes32 role, address _assignee)
    external
    onlyRole(TIMELOCK_ROLE, "Only timelock can assign roles")
  {
    _setupRole(role, _assignee);
  }

  function removeRole(bytes32 role, address _entity)
    external
    onlyRole(TIMELOCK_ROLE, "Only timelock can revoke roles")
  {
    revokeRole(role, _entity);
  }

  function reassignAdmin(address _admin)
    external
    onlyRole(TIMELOCK_ROLE, "Only timelock can assign roles")
  {
    _swapRole(_admin, admin, TIMELOCK_ROLE);
    _swapRole(_admin, admin, GOVERNOR_ROLE);
    _swapRole(_admin, admin, MONETARY_REGULATOR_ROLE);
    _swapRole(_admin, admin, STABILIZER_NODE_ROLE);

    admin = _admin;
  }

  function _swapRole(address newAccount, address oldAccount, bytes32 role) internal {
    revokeRole(role, oldAccount);
    _setupRole(role, newAccount);
  }

  function _roleSetup(bytes32 role, address account) internal {
    _setupRole(role, account);
    _setRoleAdmin(role, TIMELOCK_ROLE);
  }

  function _onlyRole(bytes32 role, string memory reason) internal view {
    require(
      hasRole(
        role,
        _msgSender()
      ),
      reason
    );
  }

  function _notSameBlock() internal {
    require(
      block.number > lastBlock[_msgSender()],
      "Can't carry out actions in the same block"
    );
    lastBlock[_msgSender()] = block.number;
  }

  // Using internal function calls here reduces compiled bytecode size
  modifier onlyRole(bytes32 role, string memory reason) {
    _onlyRole(role, reason);
    _;
  }

  modifier notSameBlock() {
    _notSameBlock();
    _;
  }
}

File 17 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 19 of 21 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 20 of 21 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 21 of 21 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

    struct Set {
        // Storage of set values
        bytes32[] _values;

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

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

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

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

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

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Advance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Bond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountMalt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReward","type":"uint256"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"}],"name":"DeclareReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Forfeit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"maltPeriphery","type":"address"}],"name":"SetNewMaltPeriphery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reinvestor","type":"address"}],"name":"SetNewReinvestor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"stabilizerNode","type":"address"}],"name":"SetStabilizerNode","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Unbond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewarded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maltReward","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"AUCTION_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUIDITY_MINE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MONETARY_REGULATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REINVESTOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STABILIZER_NODE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"advance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"_assignee","type":"address"}],"name":"assignRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfMaltRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfMaltStakePadding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfStakePadding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfSubsidizedLP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bondToAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract IDAO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"declareMaltReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"declareReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"earnedReward","type":"uint256"},{"internalType":"uint256","name":"earnedMalt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochRewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"maltReward","type":"uint256"},{"internalType":"uint256","name":"totalReward","type":"uint256"},{"internalType":"uint256","name":"totalMaltReward","type":"uint256"},{"internalType":"uint256","name":"stakePadding","type":"uint256"},{"internalType":"uint256","name":"maltStakePadding","type":"uint256"},{"internalType":"uint256","name":"completionTime","type":"uint256"},{"internalType":"uint256","name":"totalBonded","type":"uint256"},{"internalType":"uint256","name":"valueOfBondedMalt","type":"uint256"},{"internalType":"uint256","name":"valueOfBondedReward","type":"uint256"},{"internalType":"bool","name":"advanced","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amountReward","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"finalizeSubsidy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountActionEpochs","outputs":[{"internalType":"uint256[]","name":"bondEpochs","type":"uint256[]"},{"internalType":"uint256[]","name":"unbondEpochs","type":"uint256[]"},{"internalType":"uint256[]","name":"withdrawEpochs","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getAccountEpochData","outputs":[{"internalType":"uint256","name":"bonded","type":"uint256"},{"internalType":"uint256","name":"unbonded","type":"uint256"},{"internalType":"uint256","name":"withdrawnReward","type":"uint256"},{"internalType":"uint256","name":"withdrawnMalt","type":"uint256"},{"internalType":"uint256","name":"forfeitedReward","type":"uint256"},{"internalType":"uint256","name":"forfeitedMalt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getAccountEpochStakePadding","outputs":[{"internalType":"int256","name":"rewardStakePadding","type":"int256"},{"internalType":"int256","name":"maltStakePadding","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountState","outputs":[{"internalType":"uint256","name":"bonded","type":"uint256"},{"internalType":"uint256","name":"subsidizedLP","type":"uint256"},{"internalType":"uint256","name":"stakePadding","type":"uint256"},{"internalType":"uint256","name":"maltStakePadding","type":"uint256"},{"internalType":"uint256","name":"bondedEpoch","type":"uint256"},{"internalType":"uint256","name":"unbondedBalance","type":"uint256"},{"internalType":"uint256","name":"unbondedMaltBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochReward","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"maltReward","type":"uint256"},{"internalType":"uint256","name":"totalReward","type":"uint256"},{"internalType":"uint256","name":"totalMaltReward","type":"uint256"},{"internalType":"uint256","name":"stakePadding","type":"uint256"},{"internalType":"uint256","name":"maltStakePadding","type":"uint256"},{"internalType":"uint256","name":"completionTime","type":"uint256"},{"internalType":"uint256","name":"epochTotalBonded","type":"uint256"},{"internalType":"uint256","name":"valueOfBondedMalt","type":"uint256"},{"internalType":"uint256","name":"valueOfBondedReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalState","outputs":[{"internalType":"uint256","name":"bonded","type":"uint256"},{"internalType":"uint256","name":"subsidizedLP","type":"uint256"},{"internalType":"uint256","name":"stakePadding","type":"uint256"},{"internalType":"uint256","name":"maltStakePadding","type":"uint256"},{"internalType":"uint256","name":"unbondedBalance","type":"uint256"},{"internalType":"uint256","name":"unbondedMaltBalance","type":"uint256"},{"internalType":"uint256","name":"declaredBalance","type":"uint256"},{"internalType":"uint256","name":"declaredMaltBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_mineName","type":"string"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_maltToken","type":"address"},{"internalType":"address","name":"_stakeToken","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"address","name":"_dao","type":"address"},{"internalType":"address","name":"_treasuryMultisig","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_stabilizerNode","type":"address"},{"internalType":"address","name":"_timelock","type":"address"},{"internalType":"address","name":"_reinvestor","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"malt","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maltPoolPeriphery","outputs":[{"internalType":"contract IMaltPoolPeriphery","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mineName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payoutDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"realValueOfBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"realValueOfSubsidizedLP","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"reassignAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"liquidityMalt","type":"uint256"},{"internalType":"uint256","name":"liquidityReward","type":"uint256"},{"internalType":"bool","name":"rebalanceMalt","type":"bool"},{"internalType":"uint256","name":"otherQuantity","type":"uint256"}],"name":"reinvestLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reinvestor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"_entity","type":"address"}],"name":"removeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_periphery","type":"address"}],"name":"setNewPoolPeriphery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reinvestor","type":"address"}],"name":"setNewReinvestor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_node","type":"address"}],"name":"setNewStabilizerNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stabilizerNode","outputs":[{"internalType":"contract IStabilizerNode","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"totalBondedAtEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBondedMaltRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBondedRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMaltRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMaltStakePadding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"totalRewardedAtEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakePadding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSubsidizedLp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"requiredMalt","type":"uint256"},{"internalType":"uint256","name":"maltAmount","type":"uint256"}],"name":"transferExcessMalt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"requiredReward","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"transferExcessReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryMultisig","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unbond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amountReward","type":"uint256"},{"internalType":"uint256","name":"maltRemoval","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"updateBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"maltAmount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50615f9280620000216000396000f3fe608060405234801561001057600080fd5b50600436106104485760003560e01c80637565d49111610241578063bf6284081161013b578063dada88c5116100c3578063f6ba000711610087578063f6ba000714610f0e578063f7c618c114610f3a578063f887ea4014610f42578063fcc7cde914610f4a578063fda66a7214610f7657610448565b8063dada88c514610ec2578063dff87bcb14610eca578063ea105ac714610ed2578063f0ad0a5214610eda578063f288a2e214610f0657610448565b8063c981e7641161010a578063c981e76414610d39578063ca15c87314610e04578063ccc5749014610e21578063d418634a14610e29578063d547741f14610e9657610448565b8063bf62840814610ca4578063c5214f8b14610cac578063c7b68ecc14610cb4578063c8a9421514610cbc57610448565b806399b4c1ad116101c9578063a80722811161018d578063a807228114610bba578063a99baf4d14610bfa578063aed29d0714610c20578063aee4e40b14610c28578063be50079d14610c8757610448565b806399b4c1ad14610b005780639d31ddee14610b265780639ee2735b14610b4c578063a217fddf14610baa578063a58214b814610bb257610448565b80638ae05fbb116102105780638ae05fbb14610a525780639010d07c14610a5a57806391d1485414610a7d578063952ca92c14610abd5780639940686e14610ae357610448565b80637565d4911461091857806378e97925146109205780637cd3fd8814610928578063825ad60714610a2c57610448565b80633d24a1c4116103525780634ee5dbd7116102da5780636d5ebb151161029e5780636d5ebb15146108345780636f0b18531461085a57806370b0d35114610877578063743faee21461089d5780637451415d146108e657610448565b80634ee5dbd7146107f757806351ed6a30146107ff5780635bd3d740146108075780635ca6850d1461080f57806367311eb81461082c57610448565b8063441a3e7011610321578063441a3e701461073257806344d96e95146107555780634652f0cf1461075d57806349733d04146107655780634dc47d341461078257610448565b80633d24a1c4146106d35780634162169f1461070557806342012dc61461070d578063430730a31461072a57610448565b80632d730e4a116103d557806335d25ca2116103a457806335d25ca21461064d57806336568abe1461067357806339cb18261461069f57806339cb8637146106c35780633b18af59146106cb57610448565b80632d730e4a146105a05780632f2ff15d146105d85780632f8d75e31461060457806330a727b31461062157610448565b80631a8ffc7a1161041c5780631a8ffc7a1461051257806320aa1c9414610538578063248a9ca31461055e578063271d16031461057b57806327de9e321461058357610448565b80628cc2621461044d5780630ff6b0211461048c578063123c4706146104b45780631407e8c4146104da575b600080fd5b6104736004803603602081101561046357600080fd5b50356001600160a01b0316610fa8565b6040805192835260208301919091528051918290030190f35b6104b2600480360360208110156104a257600080fd5b50356001600160a01b0316611454565b005b6104b2600480360360208110156104ca57600080fd5b50356001600160a01b03166115d5565b610500600480360360208110156104f057600080fd5b50356001600160a01b03166116c4565b60408051918252519081900360200190f35b6105006004803603602081101561052857600080fd5b50356001600160a01b031661176b565b6104b26004803603602081101561054e57600080fd5b50356001600160a01b0316611789565b6105006004803603602081101561057457600080fd5b5035611873565b610500611888565b6104b26004803603602081101561059957600080fd5b50356118b3565b6104b2600480360360808110156105b657600080fd5b506001600160a01b038135169060208101359060408101359060600135611bd5565b6104b2600480360360408110156105ee57600080fd5b50803590602001356001600160a01b0316611c35565b6104b26004803603602081101561061a57600080fd5b5035611ca1565b6104b26004803603604081101561063757600080fd5b50803590602001356001600160a01b0316611ddc565b6104736004803603602081101561066357600080fd5b50356001600160a01b0316611e48565b6104b26004803603604081101561068957600080fd5b50803590602001356001600160a01b0316611edf565b6106a7611f40565b604080516001600160a01b039092168252519081900360200190f35b610500611f4f565b6106a7611f56565b6104b2600480360360608110156106e957600080fd5b506001600160a01b038135169060208101359060400135611f65565b6106a7611fef565b6104b26004803603602081101561072357600080fd5b5035611ffe565b6105006120e2565b6104b26004803603604081101561074857600080fd5b5080359060200135612106565b610500612219565b61050061221f565b6104b26004803603602081101561077b57600080fd5b503561224b565b61079f6004803603602081101561079857600080fd5b503561231f565b604080519b8c5260208c019a909a528a8a019890985260608a0196909652608089019490945260a088019290925260c087015260e0860152610100850152610120840152151561014083015251908190036101600190f35b61050061237b565b6106a76123a2565b6105006123b1565b6104b26004803603602081101561082557600080fd5b50356123cf565b6105006124a4565b6104736004803603602081101561084a57600080fd5b50356001600160a01b03166124aa565b6105006004803603602081101561087057600080fd5b50356124b8565b6105006004803603602081101561088d57600080fd5b50356001600160a01b03166124cd565b6108a56124eb565b604080519889526020890197909752878701959095526060870193909352608086019190915260a085015260c084015260e083015251908190036101000190f35b6104b2600480360360608110156108fc57600080fd5b506001600160a01b03813516906020810135906040013561250d565b610500612590565b6105006125bf565b61094e6004803603602081101561093e57600080fd5b50356001600160a01b03166125c5565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561099657818101518382015260200161097e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156109d55781810151838201526020016109bd565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015610a145781810151838201526020016109fc565b50505050905001965050505050505060405180910390f35b61050060048036036020811015610a4257600080fd5b50356001600160a01b03166126f3565b610500612727565b6106a760048036036040811015610a7057600080fd5b508035906020013561272d565b610aa960048036036040811015610a9357600080fd5b50803590602001356001600160a01b0316612752565b604080519115158252519081900360200190f35b61050060048036036020811015610ad357600080fd5b50356001600160a01b0316612770565b6104b260048036036020811015610af957600080fd5b5035612782565b61050060048036036020811015610b1657600080fd5b50356001600160a01b0316612797565b61050060048036036020811015610b3c57600080fd5b50356001600160a01b0316612811565b610b7260048036036020811015610b6257600080fd5b50356001600160a01b031661282f565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b610500612875565b6106a761287a565b6104b2600480360360a0811015610bd057600080fd5b506001600160a01b0381351690602081013590604081013590606081013515159060800135612889565b6104b260048036036020811015610c1057600080fd5b50356001600160a01b0316612c49565b610500612cf5565b610c5460048036036040811015610c3e57600080fd5b506001600160a01b038135169060200135612cfb565b604080519687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b61050060048036036020811015610c9d57600080fd5b5035612d59565b6106a7612d6b565b610500612d7a565b610500612d80565b610cc4612d99565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610cfe578181015183820152602001610ce6565b50505050905090810190601f168015610d2b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b26004803603610180811015610d5057600080fd5b810190602081018135640100000000811115610d6b57600080fd5b820183602082011115610d7d57600080fd5b80359060200191846001830284011164010000000083111715610d9f57600080fd5b91935091506001600160a01b0381358116916020810135821691604082013581169160608101359160808201359160a081013582169160c082013581169160e08101358216916101008201358116916101208101358216916101409091013516612e27565b61050060048036036020811015610e1a57600080fd5b50356130e3565b6105006130fa565b610e4660048036036020811015610e3f57600080fd5b503561311f565b604080519a8b5260208b0199909952898901979097526060890195909552608088019390935260a087019190915260c086015260e085015261010084015261012083015251908190036101400190f35b6104b260048036036040811015610eac57600080fd5b50803590602001356001600160a01b0316613171565b6105006131ca565b6106a76131d0565b6104b26131df565b6104b260048036036040811015610ef057600080fd5b506001600160a01b038135169060200135613383565b610500613478565b6104b260048036036040811015610f2457600080fd5b50803590602001356001600160a01b031661349d565b6106a7613503565b6106a7613512565b61047360048036036040811015610f6057600080fd5b506001600160a01b038135169060200135613521565b6104b260048036036060811015610f8c57600080fd5b506001600160a01b038135169060208101359060400135613557565b6000806000603960009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d602081101561102557600080fd5b50516001600160a01b0385166000908152604a602052604090206004015490915081141561105a57506000915081905061144f565b611062615c4f565b604054600090831115611076575060405482035b6001600160a01b0386166000908152604a60205260409020600401548110156110b757506001600160a01b0385166000908152604a60205260409020600401545b60006110c28761176b565b6110cb886126f3565b0190506110d787612811565b6080840151526110e6876124cd565b608084015160200152600080855b8481111561123c576001600160a01b038a166000908152604a60209081526040808320848452600b8101835281842054600a8201845282852054600e8301808652848720805460808f01805180519290920390915289895291875260019081015491518701805192909203909152878752600c90930180865293862080548d51805190910190529587905292845293015489519092018051909201909152909403909301926111a38185613697565b6020880151805183019052606088015180518201905290935091506111c88185613848565b6020808901518101805184019052606089015181018051830190526001600160a01b038d166000908152604a82526040808220868352600d018084528183208054928d01805180519094019093529287905283526001909101549051909101805190910190529093509150600019016110f4565b506001600160a01b0389166000908152604a6020526040902060040154841115611326576001600160a01b0389166000908152604a60209081526040808320878452600b8101835281842054600a8201845282852054600e909201808552928520805460808c018051805192909203909152958a90529284526001909201548451909301805193909303909252915151940301926112dc9085908561395f565b60208087015180518301905260608701518051830190526080870151015190915061130990859085613a1b565b602080870151810180518301905260608701510180518201905290505b6020850151518551511061134257602085015160009052611353565b845151602086015180519190910390525b8460200151602001518560000151602001511061137a576020808601516000910152611392565b84516020908101518187015190910180519190910390525b6040850151516060860151516113ad9163ffffffff613ab116565b60208601515111156113db576040850151516060860151516113d49163ffffffff613ab116565b6020860151525b6113fe856040015160200151866060015160200151613ab190919063ffffffff16565b856020015160200151111561143957611430856040015160200151866060015160200151613ab190919063ffffffff16565b60208087015101525b5050505060209081015180519101519093509150505b915091565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d018120818301909252601e81527f4f6e6c792074696d656c6f636b2063616e2061737369676e20726f6c6573000060208201526114b08282613af3565b603454604080516c54494d454c4f434b5f524f4c4560981b8152905190819003600d0190206114ec9185916001600160a01b0390911690613b89565b603454604080516c474f5645524e4f525f524f4c4560981b8152905190819003600d0190206115289185916001600160a01b0390911690613b89565b60345460408051764d4f4e45544152595f524547554c41544f525f524f4c4560481b8152905190819003601701902061156e9185916001600160a01b0390911690613b89565b603454604080517353544142494c495a45525f4e4f44455f524f4c4560601b815290519081900360140190206115b19185916001600160a01b0390911690613b89565b5050603480546001600160a01b0319166001600160a01b0392909216919091179055565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d01812081830190925260178152764d75737420686176652074696d656c6f636b20726f6c6560481b602082015261162b8282613af3565b603c54604080517353544142494c495a45525f4e4f44455f524f4c4560601b8152905190819003601401902061166e9185916001600160a01b0390911690613b89565b603c80546001600160a01b0385166001600160a01b0319909116811790915560408051918252517fb005afe47cf54482ad027af2f6e6afd7186a8b4fe9f1d5c2fb584db8f8ecc42d9181900360200190a1505050565b6000806116cf612219565b9050806116e0576000915050611766565b60006117016116ed611f4f565b6116f5612d80565b9063ffffffff613b9d16565b9050600061173a8361172e6117216117188961176b565b6116f58a6126f3565b859063ffffffff613bf716565b9063ffffffff613c5016565b9050600061174786612811565b90508082111561175d5790039250611766915050565b60009450505050505b919050565b6001600160a01b03166000908152604a602052604090206001015490565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d01812081830190925260178152764d75737420686176652074696d656c6f636b20726f6c6560481b60208201526117df8282613af3565b603d54604080516e5245494e564553544f525f524f4c4560881b8152905190819003600f01902061181d9185916001600160a01b0390911690613b89565b603d80546001600160a01b0385166001600160a01b0319909116811790915560408051918252517f3dd5bc87a7169750ef3a0da94936e590999d7895a65266ee213ae5259f3b1a399181900360200190a1505050565b60009081526033602052604090206002015490565b60408051724c49515549444954595f4d494e455f524f4c4560681b8152905190819003601301902081565b6118bb613c92565b60008111611902576040805162461bcd60e51b815260206004820152600f60248201526e043616e6e6f7420756e626f6e64203608c1b604482015290519081900360640190fd5b600061190d33611e48565b50603b546040805163a5abebb160e01b81526004810186905281519394506000936001600160a01b039093169263a5abebb192602480840193919291829003018186803b15801561195d57600080fd5b505afa158015611971573d6000803e3d6000fd5b505050506040513d604081101561198757600080fd5b50519050808210156119e0576040805162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e742062616c616e636520746f20756e626f6e640000604482015290519081900360640190fd5b60006119eb336126f3565b905060008111611a42576040805162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420626f6e6465642062616c616e63650000000000604482015290519081900360640190fd5b80841115611a97576040805162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420626f6e6465642062616c616e63650000000000604482015290519081900360640190fd5b611a9f6131df565b611aa98482613cdf565b611ab33385613ec5565b6000611ad28261172e87611ac633612811565b9063ffffffff613bf716565b90506000611ae78361172e88611ac6336124cd565b9050611b2a3383836040518060400160405280601a81526020017f496e73756666696369656e74207374616b652070616464696e67000000000000815250613fb4565b611b32614136565b611b3c33846141cd565b611b4586614301565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b158015611b8a57600080fd5b505afa158015611b9e573d6000803e3d6000fd5b505050506040513d6020811015611bb457600080fd5b50516042546000918252604b60205260409091206007015550505050505050565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f8339815191526020820152611c218282613af3565b611c2d868686866143a7565b505050505050565b600082815260336020526040902060020154611c5890611c536144db565b612752565b611c935760405162461bcd60e51b815260040180806020018281038252602f815260200180615d9f602f913960400191505060405180910390fd5b611c9d82826144df565b5050565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f8339815191526020820152611ced8282613af3565b603654603c546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919092169163a9059cbb9160448083019260209291908290030181600087803b158015611d4657600080fd5b505af1158015611d5a573d6000803e3d6000fd5b505050506040513d6020811015611d7057600080fd5b5050603c5460408051632f8d75e360e01b81526004810186905290516001600160a01b0390921691632f8d75e39160248082019260009290919082900301818387803b158015611dbf57600080fd5b505af1158015611dd3573d6000803e3d6000fd5b50505050505050565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d018120818301909252601e81527f4f6e6c792074696d656c6f636b2063616e2061737369676e20726f6c657300006020820152611e388282613af3565b611e428484611c93565b50505050565b6000806000611e56846126f3565b603b546040805163a5abebb160e01b81526004810184905281519394506001600160a01b039092169263a5abebb1926024808201939291829003018186803b158015611ea157600080fd5b505afa158015611eb5573d6000803e3d6000fd5b505050506040513d6040811015611ecb57600080fd5b508051602090910151909350915050915091565b611ee76144db565b6001600160a01b0316816001600160a01b031614611f365760405162461bcd60e51b815260040180806020018281038252602f815260200180615f2e602f913960400191505060405180910390fd5b611c9d828261454e565b603b546001600160a01b031681565b6044545b90565b603d546001600160a01b031681565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f8339815191526020820152611fb18282613af3565b82841115611fe857611fe88530611fce878763ffffffff613ab116565b6036546001600160a01b031692919063ffffffff6145bd16565b5050505050565b6039546001600160a01b031681565b604080517353544142494c495a45525f4e4f44455f524f4c4560601b8152815190819003601490810182208284019093528152734f6e6c792073746162696c697a6572206e6f646560601b60208201526120588282613af3565b612063836000614617565b61206b612219565b612085576120788361482b565b612080614136565b6120dd565b6120908360006148af565b6037546040805160008152602081018690526001600160a01b0390921682820152517f0d7dbe9278dcd44c7ab09d4efe828e089c5f359a8c7d049abd991851375896fe9181900360600190a15b505050565b604080516b41554354494f4e5f524f4c4560a01b8152905190819003600c01902081565b61210e613c92565b6121166131df565b60008061212233610fa8565b915091508184111561217b576040805162461bcd60e51b815260206004820181905260248201527f43616e6e6f74207769746864726177206d6f7265207468616e206561726e6564604482015290519081900360640190fd5b808311156121ba5760405162461bcd60e51b8152600401808060200182810382526025815260200180615dce6025913960400191505060405180910390fd5b6121c5338585614a1d565b6048546121d8908563ffffffff613ab116565b6048556049546121ee908463ffffffff613ab116565b6049556121f9614136565b612204338585614b99565b61220f338383614cc3565b611e428484614e23565b60425490565b604080517353544142494c495a45525f4e4f44455f524f4c4560601b8152905190819003601401902081565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f83398151915260208201526122978282613af3565b603c546040805163125ccf4160e21b81526004810186905290516001600160a01b03909216916349733d049160248082019260009290919082900301818387803b1580156122e457600080fd5b505af11580156122f8573d6000803e3d6000fd5b5050603d546036546120dd93506001600160a01b039081169250168563ffffffff614eab16565b604b60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a909a01549899979896979596949593949293919290919060ff168b565b604080516e5245494e564553544f525f524f4c4560881b8152905190819003600f01902081565b6038546001600160a01b031681565b6047546049546000916123ca919063ffffffff613ab116565b905090565b604080517353544142494c495a45525f4e4f44455f524f4c4560601b8152815190819003601490810182208284019093528152734f6e6c792073746162696c697a6572206e6f646560601b60208201526124298282613af3565b612434600084614617565b61243c612219565b6124495761207883614efd565b6124546000846148af565b60375460408051858152600060208201526001600160a01b0390921682820152517f0d7dbe9278dcd44c7ab09d4efe828e089c5f359a8c7d049abd991851375896fe9181900360600190a1505050565b60495490565b6000806000611e568461176b565b6000908152604b602052604090206007015490565b6001600160a01b03166000908152604a602052604090206003015490565b6042546043546044546045546046546047546048546049549091929394959697565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f83398151915260208201526125598282613af3565b82841115611fe857611fe88530612576878763ffffffff613ab116565b6037546001600160a01b031692919063ffffffff6145bd16565b60408051764d4f4e45544152595f524547554c41544f525f524f4c4560481b8152905190819003601701902081565b60415481565b6001600160a01b0381166000908152604a60209081526040918290206007810180548451818502810185019095528085526060948594859460088101936009909101929185919083018282801561263b57602002820191906000526020600020905b815481526020019060010190808311612627575b505050505092508180548060200260200160405190810160405280929190818152602001828054801561268d57602002820191906000526020600020905b815481526020019060010190808311612679575b50505050509150808054806020026020016040519081016040528092919081815260200182805480156126df57602002820191906000526020600020905b8154815260200190600101908083116126cb575b505050505090509250925092509193909250565b6001600160a01b0381166000908152604a60205260408120600181015490546127219163ffffffff613ab116565b92915050565b60455490565b600082815260336020526040812061274b908363ffffffff614f8116565b9392505050565b600082815260336020526040812061274b908363ffffffff614f8d16565b60356020526000908152604090205481565b61278a613c92565b6127943382613383565b50565b6000806127a2612219565b9050806127b3576000915050611766565b60006127c86127c0612727565b6116f56123b1565b905060006127df8361172e6117216117188961176b565b905060006127ec866124cd565b90508082111561175d57612806828263ffffffff613ab116565b945050505050611766565b6001600160a01b03166000908152604a602052604090206002015490565b6001600160a01b03166000908152604a60205260409020805460018201546002830154600384015460048501546005860154600690960154949693959294919390929190565b600081565b603c546001600160a01b031681565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f83398151915260208201526128d58282613af3565b6128dd615c9b565b6040518060a00160405280600081526020016000815260200160008152602001612916606461172e605f8c613bf790919063ffffffff16565b8152602001612931606461172e8a605f63ffffffff613bf716565b9052603654603a546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018c9052905193945091169163095ea7b3916044808201926020929091908290030181600087803b15801561298e57600080fd5b505af11580156129a2573d6000803e3d6000fd5b505050506040513d60208110156129b857600080fd5b5050603754603a546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018a90529051919092169163095ea7b39160448083019260209291908290030181600087803b158015612a1357600080fd5b505af1158015612a27573d6000803e3d6000fd5b505050506040513d6020811015612a3d57600080fd5b5050603a5460365460375460608085015160808601516040805162e8e33760e81b81526001600160a01b0396871660048201529486166024860152604485018e9052606485018d9052608485019290925260a48401523060c48401524260e4840152516000948594859491169263e8e33700926101048084019382900301818787803b158015612acc57600080fd5b505af1158015612ae0573d6000803e3d6000fd5b505050506040513d6060811015612af657600080fd5b508051602082015160409092015190945090925090508715612ba4578184526020840187905289831015612b9f57612b348a8463ffffffff613ab116565b604085015286831115612b6b576040840151603654612b66916001600160a01b03909116908d9063ffffffff614eab16565b612b9f565b60208401839052612b9f8b612b868c8a63ffffffff613ab116565b6036546001600160a01b0316919063ffffffff614eab16565b612c28565b8684526020840183905288821015612c2857612bc6898363ffffffff613ab116565b604085015286821115612bf8576040840151603754612b9f916001600160a01b03909116908d9063ffffffff614eab16565b818452612c288b612c0f8b8a63ffffffff613ab116565b6037546001600160a01b0316919063ffffffff614eab16565b612c3c8b85600001518660200151846143a7565b5050505050505050505050565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d01812081830190925260178152764d75737420686176652074696d656c6f636b20726f6c6560481b6020820152612c9f8282613af3565b603b80546001600160a01b0385166001600160a01b0319909116811790915560408051918252517fbbce34cfe6b0c0d753463048a17168edff5c1afe4185a1ef578a1d73f2d303999181900360200190a1505050565b60485490565b6001600160a01b03919091166000908152604a60209081526040808320938352600a8401825280832054600b8501835281842054600c860184528285208054600191820154600d909801909552929094208054920154909593949293565b6000908152604b602052604090205490565b603e546001600160a01b031681565b60405481565b6046546048546000916123ca919063ffffffff613ab116565b603f805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015612e1f5780601f10612df457610100808354040283529160200191612e1f565b820191906000526020600020905b815481529060010190602001808311612e0257829003601f168201915b505050505081565b600054610100900460ff1680612e405750612e40614fa2565b80612e4e575060005460ff16155b612e895760405162461bcd60e51b815260040180806020018281038252602e815260200180615ed6602e913960400191505060405180910390fd5b600054610100900460ff16158015612eb4576000805460ff1961ff0019909116610100171660011790555b612ebd83614fa8565b604080517353544142494c495a45525f4e4f44455f524f4c4560601b81529051908190036014019020612ef09085611c93565b604080516e5245494e564553544f525f524f4c4560881b8152905190819003600f019020612f1e9083611c93565b603780546001600160a01b03199081166001600160a01b038f8116919091179092556038805482168d84161790556036805482168e8416179055603e80548216898416179055603a80548216888416179055603c8054909116918616919091179055612f8c603f8f8f615cca565b5060408981556041899055603980546001600160a01b03808b166001600160a01b031992831617909255603d8054868416921682179055603754835163095ea7b360e01b8152600481019290925260001960248301819052935192169163095ea7b3916044808201926020929091908290030181600087803b15801561301157600080fd5b505af1158015613025573d6000803e3d6000fd5b505050506040513d602081101561303b57600080fd5b50506036546040805163095ea7b360e01b81526001600160a01b038681166004830152602482018590529151919092169163095ea7b39160448083019260209291908290030181600087803b15801561309357600080fd5b505af11580156130a7573d6000803e3d6000fd5b505050506040513d60208110156130bd57600080fd5b5050811590506130d3576000805461ff00191690555b5050505050505050505050505050565b60008181526033602052604081206127219061508b565b604080516c474f5645524e4f525f524f4c4560981b8152905190819003600d01902081565b6000908152604b60205260409020805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154979996989597949693959294919390929190565b60008281526033602052604090206002015461318f90611c536144db565b611f365760405162461bcd60e51b8152600401808060200182810382526030815260200180615e856030913960400191505060405180910390fd5b60435490565b6036546001600160a01b031681565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561322457600080fd5b505afa158015613238573d6000803e3d6000fd5b505050506040513d602081101561324e57600080fd5b50516000818152604b60205260409020600a015490915060ff1661337b576000613276612219565b603b546040805163a5abebb160e01b815260048101849052815193945060009384936001600160a01b03169263a5abebb19260248082019391829003018186803b1580156132c357600080fd5b505afa1580156132d7573d6000803e3d6000fd5b505050506040513d60408110156132ed57600080fd5b5080516020918201516000878152604b845260409081902060078101889055600a8101805460ff19166001179055600881018490556009810183905560445460048201556045546005909101558051888152429481019490945280519295509093507f80ed4614ab2b2c5fd2e6f2f0bb3c55b8bac2a16aee9296e0275b2214ebee6571928290030190a15050505b612794614136565b61338b613c92565b6133936131df565b600081116133d8576040805162461bcd60e51b815260206004820152600d60248201526c043616e6e6f7420626f6e64203609c1b604482015290519081900360640190fd5b6133e28282615096565b6133ec8282615233565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561343157600080fd5b505afa158015613445573d6000803e3d6000fd5b505050506040513d602081101561345b57600080fd5b50516042546000918252604b602052604090912060070155505050565b604080516c54494d454c4f434b5f524f4c4560981b8152905190819003600d01902081565b604080516c54494d454c4f434b5f524f4c4560981b8152815190819003600d018120818301909252601e81527f4f6e6c792074696d656c6f636b2063616e207265766f6b6520726f6c6573000060208201526134f98282613af3565b611e428484613171565b6037546001600160a01b031681565b603a546001600160a01b031681565b6001600160a01b0382166000908152604a60209081526040808320848452600e01909152902080546001909101545b9250929050565b604080516e5245494e564553544f525f524f4c4560881b8152815190819003600f01812081830190925260198152600080516020615e3f83398151915260208201526135a38282613af3565b6135af85856000614a1d565b6048546135c2908563ffffffff613ab116565b6048556135cd614136565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561361257600080fd5b505afa158015613626573d6000803e3d6000fd5b505050506040513d602081101561363c57600080fd5b5051905061364c86866000614b99565b6136568685615096565b61366086856152ae565b61367a8661367586600263ffffffff613c5016565b61530a565b6042546000828152604b6020526040902060070155611c2d61536c565b6000828152604b6020526040812054819015806136b2575082155b156136c257506000905080613550565b60008085116136d25760006136d7565b600185035b6039546040805163633e9e0960e01b81526004810189905290519293506000926001600160a01b039092169163633e9e0991602480820192602092909190829003018186803b15801561372957600080fd5b505afa15801561373d573d6000803e3d6000fd5b505050506040513d602081101561375357600080fd5b50516000838152604b60205260409020600701544291909103915080613783575060009350839250613550915050565b6000878152604b60205260408120546137a890839061172e908a63ffffffff613bf716565b905061383b603960009054906101000a90046001600160a01b03166001600160a01b03166357d775f86040518163ffffffff1660e01b815260040160206040518083038186803b1580156137fb57600080fd5b505afa15801561380f573d6000803e3d6000fd5b505050506040513d602081101561382557600080fd5b50516040540261172e838663ffffffff613bf716565b9890975095505050505050565b6000828152604b602052604081206001015481901580613866575082155b1561387657506000905080613550565b600080851161388657600061388b565b600185035b6039546040805163633e9e0960e01b81526004810189905290519293506000926001600160a01b039092169163633e9e0991602480820192602092909190829003018186803b1580156138dd57600080fd5b505afa1580156138f1573d6000803e3d6000fd5b505050506040513d602081101561390757600080fd5b50516000838152604b60205260409020600701544291909103915080613937575060009350839250613550915050565b6000878152604b60205260408120600101546137a890839061172e908a63ffffffff613bf716565b6000838152604b6020526040812060020154158061397b575081155b156139885750600061274b565b600080851161399857600061399d565b600185035b6000818152604b6020526040902060070154909150806139c25760009250505061274b565b6000828152604b6020526040808220600401548883529082206002015401906139f58361172e848963ffffffff613bf716565b905086811115613a0d5786810394505050505061274b565b506000979650505050505050565b6000838152604b60205260408120600301541580613a37575081155b15613a445750600061274b565b6000808511613a54576000613a59565b600185035b6000818152604b602052604090206007015490915080613a7e5760009250505061274b565b6000828152604b6020526040808220600501548883529082206003015401906139f58361172e848963ffffffff613bf716565b600061274b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615436565b613aff82611c536144db565b81906120dd5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613b4e578181015183820152602001613b36565b50505050905090810190601f168015613b7b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b613b938183613171565b6120dd8184611c93565b60008282018381101561274b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082613c0657506000612721565b82820282848281613c1357fe5b041461274b5760405162461bcd60e51b8152600401808060200182810382526021815260200180615eb56021913960400191505060405180910390fd5b600061274b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250615490565b604154421015613cdd576040805162461bcd60e51b81526020600482015260116024820152704265666f72652073746172742074696d6560781b604482015290519081900360640190fd5b565b600080613ceb33610fa8565b336000908152604a602052604081206005015492945090925090613d2990613d1d8661172e878a63ffffffff613bf716565b9063ffffffff613ab116565b336000908152604a602052604081206006015491925090613d5890613d1d8761172e878b63ffffffff613bf716565b90506000603960009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015613daa57600080fd5b505afa158015613dbe573d6000803e3d6000fd5b505050506040513d6020811015613dd457600080fd5b505190506000613deb8761172e8a611ac6336116c4565b90506000613e008861172e8b611ac633612797565b90506000613e14838763ffffffff613ab116565b90508015613e4957613e258161482b565b336000908152604a60209081526040808320878452600d0190915290208054820190555b6000613e5b838763ffffffff613ab116565b90508015613e9357613e6c81614efd565b336000908152604a60209081526040808320888452600d0190915290206001018054820190555b6000821180613ea25750600081115b15613eb257613eb2338383614a1d565b613ebd3388886154f5565b612c3c614136565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b158015613f0a57600080fd5b505afa158015613f1e573d6000803e3d6000fd5b505050506040513d6020811015613f3457600080fd5b50516001600160a01b0384166000908152604a6020908152604080832060088101805460018101825590855283852001859055848452600b01909152902054909150613f86908363ffffffff613b9d16565b6001600160a01b039093166000908152604a60209081526040808320938352600b9093019052209190915550565b6001600160a01b0384166000908152604a6020526040902060020154613fe190848363ffffffff61543616565b6001600160a01b0385166000908152604a6020526040902060028101919091556003015461401690838363ffffffff61543616565b6001600160a01b0385166000908152604a602052604090206003015560445461404690848363ffffffff61543616565b60445560455461405d90838363ffffffff61543616565b6045556039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b1580156140a557600080fd5b505afa1580156140b9573d6000803e3d6000fd5b505050506040513d60208110156140cf57600080fd5b50516044546000828152604b6020908152604080832060048101949094556045546005909401939093556001600160a01b03989098168152604a8852818120928152600e909201909652949094208054939093038355506001909101805491909103905550565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561417b57600080fd5b505afa15801561418f573d6000803e3d6000fd5b505050506040513d60208110156141a557600080fd5b50516048546000918252604b6020526040909120600281019190915560495460039091015550565b60006141d88361176b565b905080156120dd576141ea8382613ec5565b600061420c6141ff848463ffffffff613b9d16565b61172e84611ac688612811565b90506000614230614223858563ffffffff613b9d16565b61172e85611ac6896124cd565b90506142738583836040518060400160405280601a81526020017f496e73756666696369656e74207374616b652070616464696e67000000000000815250613fb4565b6142b385846040518060400160405280601f81526020017f4c503a20496e73756666696369656e7420626f6e6465642062616c616e636500815250615536565b6142d68584604051806060016040528060238152602001615e1c60239139615595565b603e546038546142f9916001600160a01b0391821691168563ffffffff614eab16565b611fe861536c565b6143096155fa565b61434933826040518060400160405280601f81526020017f4c503a20496e73756666696369656e7420626f6e6465642062616c616e636500815250615536565b603854614366906001600160a01b0316338363ffffffff614eab16565b61436e61536c565b60408051828152905133917fb735793e7250527232d5f7e07e8691c383c85e0c77673ac750944e8bd40e71c8919081900360200190a250565b6143b2848484614a1d565b6048546143c5908463ffffffff613ab116565b6048556049546143db908363ffffffff613ab116565b6049556143e6614136565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561442b57600080fd5b505afa15801561443f573d6000803e3d6000fd5b505050506040513d602081101561445557600080fd5b50519050614464858585614b99565b61446e8583615096565b61447885836152ae565b6042546000828152604b602052604090206007015561449561536c565b6040805183815290516001600160a01b038716917f6b1d99469ed62a423d7e402bfa68a467261ca2229127c55045ee41e5d9a0f21d919081900360200190a25050505050565b3390565b60008281526033602052604090206144fd908263ffffffff61568d16565b15611c9d5761450a6144db565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260336020526040902061456c908263ffffffff6156a216565b15611c9d576145796144db565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611e429085906156b7565b60008211806146265750600081115b614677576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465636c617265203020726577617264000000000000000000604482015290519081900360640190fd5b60485461468a908363ffffffff613b9d16565b6048556049546146a0908263ffffffff613b9d16565b604955603754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156146ee57600080fd5b505afa158015614702573d6000803e3d6000fd5b505050506040513d602081101561471857600080fd5b50516048541115614767576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b603654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156147b257600080fd5b505afa1580156147c6573d6000803e3d6000fd5b505050506040513d60208110156147dc57600080fd5b50516049541115611c9d576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b60485461483e908263ffffffff613ab116565b604855603e54603754614864916001600160a01b0391821691168363ffffffff614eab16565b603754604080516001600160a01b03909216825260208201839052805133927f37dee4fd557c602032bfdf4fe2f0cd15c8f38270f35e1c235f135c771048becc92908290030190a250565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b1580156148f457600080fd5b505afa158015614908573d6000803e3d6000fd5b505050506040513d602081101561491e57600080fd5b50519050821561493d576000818152604b602052604090208054840190555b811561495b576000818152604b602052604090206001018054830190555b614963614136565b6000818152604b6020526040902060060154614a15576039546040546001600160a01b039091169063633e9e09906149a290849063ffffffff613b9d16565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156149d657600080fd5b505afa1580156149ea573d6000803e3d6000fd5b505050506040513d6020811015614a0057600080fd5b50516000828152604b60205260409020600601555b6120dd6131df565b6001600160a01b0383166000908152604a6020526040902060020154614a49908363ffffffff613b9d16565b6001600160a01b0384166000908152604a60205260409020600281019190915560030154614a7d908263ffffffff613b9d16565b6001600160a01b0384166000908152604a6020526040902060030155604454614aac908363ffffffff613b9d16565b604455604554614ac2908263ffffffff613b9d16565b6045556039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b158015614b0a57600080fd5b505afa158015614b1e573d6000803e3d6000fd5b505050506040513d6020811015614b3457600080fd5b50516044546000828152604b6020908152604080832060048101949094556045546005909401939093556001600160a01b03979097168152604a8752818120928152600e90920190955293909320805492909201825560019091018054909101905550565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b158015614bde57600080fd5b505afa158015614bf2573d6000803e3d6000fd5b505050506040513d6020811015614c0857600080fd5b50516001600160a01b0385166000908152604a6020908152604080832060098101805460018101825590855283852001859055848452600c01909152902054909150614c5a908463ffffffff613b9d16565b6001600160a01b0385166000908152604a60209081526040808320858452600c01909152902090815560010154614c919083613b9d565b6001600160a01b039094166000908152604a60209081526040808320938352600c909301905220600101929092555050565b6001600160a01b0383166000908152604a60205260408120600501548190841115614d0f576001600160a01b0385166000908152604a6020526040812060050180549190559150614d5b565b6001600160a01b0385166000908152604a6020526040902060050154849250614d3e908363ffffffff613ab116565b6001600160a01b0386166000908152604a60205260409020600501555b6001600160a01b0385166000908152604a6020526040902060060154831115614da457506001600160a01b0384166000908152604a602052604081206006018054919055614df0565b506001600160a01b0384166000908152604a60205260409020600601548290614dd3908263ffffffff613ab116565b6001600160a01b0386166000908152604a60205260409020600601555b604654614e03908363ffffffff613ab116565b604655604754614e19908263ffffffff613ab116565b6047555050505050565b614e2b6155fa565b603754614e48906001600160a01b0316338463ffffffff614eab16565b603654614e65906001600160a01b0316338363ffffffff614eab16565b614e6d61536c565b6040805183815260208101839052815133927ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568928290030190a25050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526120dd9084906156b7565b604954614f10908263ffffffff613ab116565b604955603e54603654614f36916001600160a01b0391821691168363ffffffff614eab16565b603654604080516001600160a01b03909216825260208201839052805133927f37dee4fd557c602032bfdf4fe2f0cd15c8f38270f35e1c235f135c771048becc92908290030190a250565b600061274b8383615768565b600061274b836001600160a01b0384166157cc565b303b1590565b604080516c54494d454c4f434b5f524f4c4560981b8152905190819003600d019020614fd490826157e4565b604080516c474f5645524e4f525f524f4c4560981b8152905190819003600d01902061500090826157e4565b60408051764d4f4e45544152595f524547554c41544f525f524f4c4560481b8152905190819003601701902061503690826157e4565b604080517353544142494c495a45525f4e4f44455f524f4c4560601b8152905190819003601401902061506990826157e4565b603480546001600160a01b0319166001600160a01b0392909216919091179055565b60006127218261581b565b6150a0828261581f565b60006150b56150ad611f4f565b6116f5612cf5565b905060006150cc6150c4612727565b6116f56124a4565b9050620f424060006150dc612219565b15615101576150fc6150ec612219565b61172e868863ffffffff613bf716565b615125565b615109612cf5565b15615115576000615125565b615125858363ffffffff613bf716565b90506000615131612219565b1561515657615151615141612219565b61172e868963ffffffff613bf716565b61517a565b61515e6124a4565b1561516a57600061517a565b61517a868463ffffffff613bf716565b9050615187878383614a1d565b615190876126f3565b611dd357603960009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156151e257600080fd5b505afa1580156151f6573d6000803e3d6000fd5b505050506040513d602081101561520c57600080fd5b50516001600160a01b0388166000908152604a602052604090206004015550505050505050565b61523b6155fa565b603854615259906001600160a01b031633308463ffffffff6145bd16565b61526382826152ae565b61526b61536c565b6040805182815290516001600160a01b038416917f6b1d99469ed62a423d7e402bfa68a467261ca2229127c55045ee41e5d9a0f21d919081900360200190a25050565b6001600160a01b0382166000908152604a60205260409020546152d7908263ffffffff613b9d16565b6001600160a01b0383166000908152604a6020526040902055604254615303908263ffffffff613b9d16565b6042555050565b6001600160a01b0382166000908152604a6020526040902060010154615336908263ffffffff613b9d16565b6001600160a01b0383166000908152604a6020526040902060010155604354615365908263ffffffff613b9d16565b6043555050565b615374612219565b603854604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156153bf57600080fd5b505afa1580156153d3573d6000803e3d6000fd5b505050506040513d60208110156153e957600080fd5b50511015613cdd576040805162461bcd60e51b815260206004820152601560248201527442616c616e636520696e636f6e73697374656e637960581b604482015290519081900360640190fd5b600081848411156154885760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613b4e578181015183820152602001613b36565b505050900390565b600081836154df5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613b4e578181015183820152602001613b36565b5060008385816154eb57fe5b0495945050505050565b604680548301905560478054820190556001600160a01b039092166000908152604a6020526040902060058101805490920190915560060180549091019055565b6001600160a01b0383166000908152604a602052604090205461556090838363ffffffff61543616565b6001600160a01b0384166000908152604a602052604090205560425461558d90838363ffffffff61543616565b604255505050565b6001600160a01b0383166000908152604a60205260409020600101546155c290838363ffffffff61543616565b6001600160a01b0384166000908152604a60205260409020600101556043546155f290838363ffffffff61543616565b604355505050565b603560006156066144db565b6001600160a01b03166001600160a01b031681526020019081526020016000205443116156645760405162461bcd60e51b8152600401808060200182810382526029815260200180615df36029913960400191505060405180910390fd5b43603560006156716144db565b6001600160a01b03168152602081019190915260400160002055565b600061274b836001600160a01b03841661590e565b600061274b836001600160a01b038416615958565b606061570c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316615a1e9092919063ffffffff16565b8051909150156120dd5780806020019051602081101561572b57600080fd5b50516120dd5760405162461bcd60e51b815260040180806020018281038252602a815260200180615f04602a913960400191505060405180910390fd5b815460009082106157aa5760405162461bcd60e51b8152600401808060200182810382526022815260200180615d7d6022913960400191505060405180910390fd5b8260000182815481106157b957fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b6157ee8282611c93565b604080516c54494d454c4f434b5f524f4c4560981b8152905190819003600d019020611c9d908390615a35565b5490565b6039546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561586457600080fd5b505afa158015615878573d6000803e3d6000fd5b505050506040513d602081101561588e57600080fd5b50516001600160a01b0384166000908152604a6020908152604080832060078101805460018101825590855283852001859055848452600a019091529020549091506158e0908363ffffffff613b9d16565b6001600160a01b039093166000908152604a60209081526040808320938352600a9093019052209190915550565b600061591a83836157cc565b61595057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612721565b506000612721565b60008181526001830160205260408120548015615a14578354600019808301919081019060009087908390811061598b57fe5b90600052602060002001549050808760000184815481106159a857fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806159d857fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612721565b6000915050612721565b6060615a2d8484600085615a87565b949350505050565b600082815260336020526040808220600201549051839285917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a460009182526033602052604090912060020155565b606082471015615ac85760405162461bcd60e51b8152600401808060200182810382526026815260200180615e5f6026913960400191505060405180910390fd5b615ad185615be3565b615b22576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310615b615780518252601f199092019160209182019101615b42565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615bc3576040519150601f19603f3d011682016040523d82523d6000602084013e615bc8565b606091505b5091509150615bd8828286615be9565b979650505050505050565b3b151590565b60608315615bf857508161274b565b825115615c085782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315613b4e578181015183820152602001613b36565b6040518060a00160405280615c62615d48565b8152602001615c6f615d48565b8152602001615c7c615d48565b8152602001615c89615d48565b8152602001615c96615d48565b905290565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615d0b5782800160ff19823516178555615d38565b82800160010185558215615d38579182015b82811115615d38578235825591602001919060010190615d1d565b50615d44929150615d62565b5090565b604051806040016040528060008152602001600081525090565b611f5391905b80821115615d445760008155600101615d6856fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e7443616e6e6f74207769746864726177206d6f7265206d616c74207468616e206561726e656443616e2774206361727279206f757420616374696f6e7320696e207468652073616d6520626c6f636b537562736964697a6564204c503a20496e73756666696369656e742062616c616e63654d7573742068617665207265696e766573746f7220726f6c6500000000000000416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220ca9a1f9ec753d96ba1e408cbdcec69009d65b45f811a5a732e442037487d14e464736f6c63430006060033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading