Address Details
contract

0xfD9651862Bc1965349E92073152112289393b57d

Contract Name
Reserve
Creator
0x56fd3f–9b8d81 at 0x28717b–abcae7
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
1 Transactions
Transfers
0 Transfers
Gas Used
28,704
Last Balance Update
25167222
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
Reserve




Optimization enabled
true
Compiler version
v0.5.17+commit.d19bba13




Optimization runs
10000
EVM Version
istanbul




Verified at
2023-03-10T06:56:17.126228Z

lib/mento-core/contracts/Reserve.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/Address.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";

import "./interfaces/IReserve.sol";
import "./interfaces/ISortedOracles.sol";

import "./common/FixidityLib.sol";
import "./common/Initializable.sol";
import "./common/UsingRegistry.sol";
import "./common/interfaces/ICeloVersionedContract.sol";
import "./common/ReentrancyGuard.sol";

/**
 * @title Ensures price stability of StableTokens with respect to their pegs
 */
// solhint-disable-next-line max-states-count
contract Reserve is IReserve, ICeloVersionedContract, Ownable, Initializable, UsingRegistry, ReentrancyGuard {
  using SafeMath for uint256;
  using FixidityLib for FixidityLib.Fraction;
  using Address for address payable; // prettier-ignore
  using SafeERC20 for IERC20;

  struct TobinTaxCache {
    uint128 numerator;
    uint128 timestamp;
  }

  mapping(address => bool) public isToken;
  address[] private _tokens;
  TobinTaxCache public tobinTaxCache;
  uint256 public tobinTaxStalenessThreshold;
  uint256 public tobinTax;
  uint256 public tobinTaxReserveRatio;
  mapping(address => bool) public isSpender;

  mapping(address => bool) public isOtherReserveAddress;
  address[] public otherReserveAddresses;

  bytes32[] public assetAllocationSymbols;
  mapping(bytes32 => uint256) public assetAllocationWeights;

  uint256 public lastSpendingDay;
  uint256 public spendingLimit;
  FixidityLib.Fraction private spendingRatio;

  uint256 public frozenReserveGoldStartBalance;
  uint256 public frozenReserveGoldStartDay;
  uint256 public frozenReserveGoldDays;

  mapping(address => bool) public isExchangeSpender;
  address[] public exchangeSpenderAddresses;
  mapping(address => FixidityLib.Fraction) private collateralAssetDailySpendingRatio;
  mapping(address => uint256) public collateralAssetLastSpendingDay;
  address[] public collateralAssets;
  mapping(address => bool) public isCollateralAsset;
  mapping(address => uint256) public collateralAssetSpendingLimit;

  event TobinTaxStalenessThresholdSet(uint256 value);
  event DailySpendingRatioSet(uint256 ratio);
  event TokenAdded(address indexed token);
  event TokenRemoved(address indexed token, uint256 index);
  event SpenderAdded(address indexed spender);
  event SpenderRemoved(address indexed spender);
  event OtherReserveAddressAdded(address indexed otherReserveAddress);
  event OtherReserveAddressRemoved(address indexed otherReserveAddress, uint256 index);
  event AssetAllocationSet(bytes32[] symbols, uint256[] weights);
  event ReserveGoldTransferred(address indexed spender, address indexed to, uint256 value);
  event TobinTaxSet(uint256 value);
  event TobinTaxReserveRatioSet(uint256 value);
  event ExchangeSpenderAdded(address indexed exchangeSpender);
  event ExchangeSpenderRemoved(address indexed exchangeSpender);
  event DailySpendingRatioForCollateralAssetSet(address collateralAsset, uint256 collateralAssetDailySpendingRatios);
  event ReserveCollateralAssetsTransferred(address indexed spender, address indexed to, uint256 value, address token);
  event CollateralAssetRemoved(address collateralAsset);
  event CollateralAssetAdded(address collateralAsset);

  /**
   * @notice Sets initialized == true on implementation contracts
   * @param test Set to true to skip implementation initialization
   */
  constructor(bool test) public Initializable(test) {}

  modifier isStableToken(address token) {
    require(isToken[token], "token addr was never registered");
    _;
  }

  /**
   * @notice Returns the storage, major, minor, and patch version of the contract.
   * @return Storage version of the contract.
   * @return Major version of the contract.
   * @return Minor version of the contract.
   * @return Patch version of the contract.
   */
  function getVersionNumber()
    external
    pure
    returns (
      uint256,
      uint256,
      uint256,
      uint256
    )
  {
    return (2, 1, 0, 0);
  }

  function() external payable {} // solhint-disable no-empty-blocks

  /**
   * @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
   * @param registryAddress The address of the registry core smart contract.
   * @param _tobinTaxStalenessThreshold The initial number of seconds to cache tobin tax value for.
   * @param _spendingRatioForCelo The relative daily spending limit for the reserve spender.
   * @param _frozenGold The balance of reserve gold that is frozen.
   * @param _frozenDays The number of days during which the frozen gold thaws.
   * @param _assetAllocationSymbols The symbols of the reserve assets.
   * @param _assetAllocationWeights The reserve asset weights.
   * @param _tobinTax The tobin tax value as a fixidity fraction.
   * @param _tobinTaxReserveRatio When to turn on the tobin tax, as a fixidity fraction.
   * @param _collateralAssets The relative daily spending limit
   * of an ERC20 collateral asset for the reserve spender.
   * @param _collateralAssetDailySpendingRatios The address of an ERC20 collateral asset
   */
  function initialize(
    address registryAddress,
    uint256 _tobinTaxStalenessThreshold,
    uint256 _spendingRatioForCelo,
    uint256 _frozenGold,
    uint256 _frozenDays,
    bytes32[] calldata _assetAllocationSymbols,
    uint256[] calldata _assetAllocationWeights,
    uint256 _tobinTax,
    uint256 _tobinTaxReserveRatio,
    address[] calldata _collateralAssets,
    uint256[] calldata _collateralAssetDailySpendingRatios
  ) external initializer {
    _transferOwnership(msg.sender);
    setRegistry(registryAddress);
    setTobinTaxStalenessThreshold(_tobinTaxStalenessThreshold);
    setDailySpendingRatio(_spendingRatioForCelo);
    setFrozenGold(_frozenGold, _frozenDays);
    setAssetAllocations(_assetAllocationSymbols, _assetAllocationWeights);
    setTobinTax(_tobinTax);
    setTobinTaxReserveRatio(_tobinTaxReserveRatio);
    for (uint256 i = 0; i < _collateralAssets.length; i++) {
      addCollateralAsset(_collateralAssets[i]);
    }
    setDailySpendingRatioForCollateralAssets(_collateralAssets, _collateralAssetDailySpendingRatios);
  }

  /**
   * @notice Sets the number of seconds to cache the tobin tax value for.
   * @param value The number of seconds to cache the tobin tax value for.
   */
  function setTobinTaxStalenessThreshold(uint256 value) public onlyOwner {
    require(value > 0, "value was zero");
    tobinTaxStalenessThreshold = value;
    emit TobinTaxStalenessThresholdSet(value);
  }

  /**
   * @notice Sets the tobin tax.
   * @param value The tobin tax.
   */
  function setTobinTax(uint256 value) public onlyOwner {
    require(FixidityLib.wrap(value).lte(FixidityLib.fixed1()), "tobin tax cannot be larger than 1");
    tobinTax = value;
    emit TobinTaxSet(value);
  }

  /**
   * @notice Sets the reserve ratio at which the tobin tax sets in.
   * @param value The reserve ratio at which the tobin tax sets in.
   */
  function setTobinTaxReserveRatio(uint256 value) public onlyOwner {
    tobinTaxReserveRatio = value;
    emit TobinTaxReserveRatioSet(value);
  }

  /**
   * @notice Set the ratio of reserve that is spendable per day.
   * @param ratio Spending ratio as unwrapped Fraction.
   */
  function setDailySpendingRatio(uint256 ratio) public onlyOwner {
    spendingRatio = FixidityLib.wrap(ratio);
    require(spendingRatio.lte(FixidityLib.fixed1()), "spending ratio cannot be larger than 1");
    emit DailySpendingRatioSet(ratio);
  }

  /**
   * @notice Set the ratio of reserve for a given collateral asset
   * that is spendable per day.
   * @param _collateralAssets Collection of the addresses of collateral assets
   * we're setting a limit for.
   * @param collateralAssetDailySpendingRatios Collection of the relative daily spending limits
   * of collateral assets.
   */
  function setDailySpendingRatioForCollateralAssets(
    address[] memory _collateralAssets,
    uint256[] memory collateralAssetDailySpendingRatios
  ) public onlyOwner {
    require(
      _collateralAssets.length == collateralAssetDailySpendingRatios.length,
      "token addresses and spending ratio lengths have to be the same"
    );
    for (uint256 i = 0; i < _collateralAssets.length; i++) {
      if (_collateralAssets[i] != address(0) && collateralAssetDailySpendingRatios[i] != 0) {
        require(
          checkIsCollateralAsset(_collateralAssets[i]),
          "the address specified is not a reserve collateral asset"
        );
        require(
          FixidityLib.wrap(collateralAssetDailySpendingRatios[i]).lte(FixidityLib.fixed1()),
          "spending ratio cannot be larger than 1"
        );
        collateralAssetDailySpendingRatio[_collateralAssets[i]] = FixidityLib.wrap(
          collateralAssetDailySpendingRatios[i]
        );
        emit DailySpendingRatioForCollateralAssetSet(_collateralAssets[i], collateralAssetDailySpendingRatios[i]);
      }
    }
  }

  /**
   * @notice Get daily spending ratio.
   * @return Spending ratio as unwrapped Fraction.
   */
  function getDailySpendingRatio() public view returns (uint256) {
    return spendingRatio.unwrap();
  }

  /**
   * @notice Get daily spending ratio of a collateral asset.
   * @param collateralAsset The address of a collateral asset we're getting a spending ratio for.
   * @return Daily spending ratio for the collateral asset as unwrapped Fraction.
   */
  function getDailySpendingRatioForCollateralAsset(address collateralAsset) public view returns (uint256) {
    return collateralAssetDailySpendingRatio[collateralAsset].unwrap();
  }

  /**
   * @notice Sets the balance of reserve gold frozen from transfer.
   * @param frozenGold The amount of CELO frozen.
   * @param frozenDays The number of days the frozen CELO thaws over.
   */
  function setFrozenGold(uint256 frozenGold, uint256 frozenDays) public onlyOwner {
    require(frozenGold <= address(this).balance, "Cannot freeze more than balance");
    frozenReserveGoldStartBalance = frozenGold;
    frozenReserveGoldStartDay = now / 1 days;
    frozenReserveGoldDays = frozenDays;
  }

  /**
   * @notice Sets target allocations for CELO and a diversified basket of non-Celo assets.
   * @param symbols The symbol of each asset in the Reserve portfolio.
   * @param weights The weight for the corresponding asset as unwrapped Fixidity.Fraction.
   */
  function setAssetAllocations(bytes32[] memory symbols, uint256[] memory weights) public onlyOwner {
    require(symbols.length == weights.length, "Array length mismatch");
    FixidityLib.Fraction memory sum = FixidityLib.wrap(0);
    for (uint256 i = 0; i < weights.length; i = i.add(1)) {
      sum = sum.add(FixidityLib.wrap(weights[i]));
    }
    require(sum.equals(FixidityLib.fixed1()), "Sum of asset allocation must be 1");
    for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) {
      delete assetAllocationWeights[assetAllocationSymbols[i]];
    }
    assetAllocationSymbols = symbols;
    for (uint256 i = 0; i < symbols.length; i = i.add(1)) {
      require(assetAllocationWeights[symbols[i]] == 0, "Cannot set weight twice");
      assetAllocationWeights[symbols[i]] = weights[i];
    }
    // NOTE: The CELO asset launched as "Celo Gold" (cGLD), but was renamed to
    // just CELO by the community.
    // TODO: Change "cGLD" to "CELO" in this file, after ensuring that any
    // off chain tools working with asset allocation weights are aware of this
    // change.
    require(assetAllocationWeights["cGLD"] != 0, "Must set cGLD asset weight");
    emit AssetAllocationSet(symbols, weights);
  }

  /**
   * @notice Add a token that the reserve will stabilize.
   * @param token The address of the token being stabilized.
   * @return Returns true if the transaction succeeds.
   */
  function addToken(address token) external onlyOwner returns (bool) {
    require(!isToken[token], "token addr already registered");
    isToken[token] = true;
    _tokens.push(token);
    emit TokenAdded(token);
    return true;
  }

  /**
   * @notice Remove a token that the reserve will no longer stabilize.
   * @param token The address of the token no longer being stabilized.
   * @param index The index of the token in _tokens.
   * @return Returns true if the transaction succeeds.
   */
  function removeToken(address token, uint256 index) external onlyOwner isStableToken(token) returns (bool) {
    require(index < _tokens.length && _tokens[index] == token, "index into tokens list not mapped to token");
    isToken[token] = false;
    address lastItem = _tokens[_tokens.length.sub(1)];
    _tokens[index] = lastItem;
    _tokens.length = _tokens.length.sub(1);
    emit TokenRemoved(token, index);
    return true;
  }

  /**
   * @notice Add a reserve address whose balance shall be included in the reserve ratio.
   * @param reserveAddress The reserve address to add.
   * @return Returns true if the transaction succeeds.
   */
  function addOtherReserveAddress(address reserveAddress) external onlyOwner returns (bool) {
    require(!isOtherReserveAddress[reserveAddress], "reserve addr already added");
    isOtherReserveAddress[reserveAddress] = true;
    otherReserveAddresses.push(reserveAddress);
    emit OtherReserveAddressAdded(reserveAddress);
    return true;
  }

  /**
   * @notice Remove reserve address whose balance shall no longer be included in the reserve ratio.
   * @param reserveAddress The reserve address to remove.
   * @param index The index of the reserve address in otherReserveAddresses.
   * @return Returns true if the transaction succeeds.
   */
  function removeOtherReserveAddress(address reserveAddress, uint256 index) external onlyOwner returns (bool) {
    require(isOtherReserveAddress[reserveAddress], "reserve addr was never added");
    require(
      index < otherReserveAddresses.length && otherReserveAddresses[index] == reserveAddress,
      "index into reserve list not mapped to address"
    );
    isOtherReserveAddress[reserveAddress] = false;
    address lastItem = otherReserveAddresses[otherReserveAddresses.length.sub(1)];
    otherReserveAddresses[index] = lastItem;
    otherReserveAddresses.length = otherReserveAddresses.length.sub(1);
    emit OtherReserveAddressRemoved(reserveAddress, index);
    return true;
  }

  /**
   * @notice Gives an address permission to spend Reserve funds.
   * @param spender The address that is allowed to spend Reserve funds.
   */
  function addSpender(address spender) external onlyOwner {
    require(address(0) != spender, "Spender can't be null");
    isSpender[spender] = true;
    emit SpenderAdded(spender);
  }

  /**
   * @notice Takes away an address's permission to spend Reserve funds.
   * @param spender The address that is to be no longer allowed to spend Reserve funds.
   */
  function removeSpender(address spender) external onlyOwner {
    require(isSpender[spender], "Spender hasn't been added");
    isSpender[spender] = false;
    emit SpenderRemoved(spender);
  }

  /**
   * @notice Checks if an address is able to spend as an exchange.
   * @dev isExchangeSpender was introduced after cUSD, so the cUSD Exchange is not included in it.
   * If cUSD's Exchange were to be added to isExchangeSpender, the check with the
   * registry could be removed.
   * @param spender The address to be checked.
   */
  modifier isAllowedToSpendExchange(address spender) {
    require(
      isExchangeSpender[spender] || (registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID) == spender),
      "Address not allowed to spend"
    );
    _;
  }

  /**
   * @notice Gives an address permission to spend Reserve without limit.
   * @param spender The address that is allowed to spend Reserve funds.
   */
  function addExchangeSpender(address spender) external onlyOwner {
    require(address(0) != spender, "Spender can't be null");
    require(!isExchangeSpender[spender], "Address is already Exchange Spender");
    isExchangeSpender[spender] = true;
    exchangeSpenderAddresses.push(spender);
    emit ExchangeSpenderAdded(spender);
  }

  /**
   * @notice Takes away an address's permission to spend Reserve funds without limits.
   * @param spender The address that is to be no longer allowed to spend Reserve funds.
   * @param index The index in exchangeSpenderAddresses of spender.
   */
  function removeExchangeSpender(address spender, uint256 index) external onlyOwner {
    isExchangeSpender[spender] = false;
    uint256 numAddresses = exchangeSpenderAddresses.length;
    require(index < numAddresses, "Index is invalid");
    require(spender == exchangeSpenderAddresses[index], "Index does not match spender");
    uint256 newNumAddresses = numAddresses.sub(1);

    if (index != newNumAddresses) {
      exchangeSpenderAddresses[index] = exchangeSpenderAddresses[newNumAddresses];
    }

    exchangeSpenderAddresses[newNumAddresses] = address(0x0);
    exchangeSpenderAddresses.length = newNumAddresses;
    emit ExchangeSpenderRemoved(spender);
  }

  /**
   * @notice Returns addresses of exchanges permitted to spend Reserve funds.
   * Because exchangeSpenderAddresses was introduced after cUSD, cUSD's exchange
   * is not included in this list.
   * @return An array of addresses permitted to spend Reserve funds.
   */
  function getExchangeSpenders() external view returns (address[] memory) {
    return exchangeSpenderAddresses;
  }

  /**
   * @notice Transfer gold to a whitelisted address subject to reserve spending limits.
   * @param to The address that will receive the gold.
   * @param value The amount of gold to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function transferGold(address payable to, uint256 value) external returns (bool) {
    require(isSpender[msg.sender], "sender not allowed to transfer Reserve funds");
    require(isOtherReserveAddress[to], "can only transfer to other reserve address");
    uint256 currentDay = now / 1 days;
    if (currentDay > lastSpendingDay) {
      uint256 balance = getUnfrozenReserveGoldBalance();
      lastSpendingDay = currentDay;
      spendingLimit = spendingRatio.multiply(FixidityLib.newFixed(balance)).fromFixed();
    }
    require(spendingLimit >= value, "Exceeding spending limit");
    spendingLimit = spendingLimit.sub(value);
    return _transferGold(to, value);
  }

  /**
   * @notice Transfer collateral asset subject to reserve spending limits to the trader,
   * if the limit is set, othersise the limit is 100%.
   * @param collateralAsset The token address you're transferring.
   * @param to The address that will receive the funds.
   * @param value The amount of collateral assets to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function transferCollateralAsset(
    address collateralAsset,
    address payable to,
    uint256 value
  ) external returns (bool) {
    require(isSpender[msg.sender], "sender not allowed to transfer Reserve funds");
    require(isOtherReserveAddress[to], "can only transfer to other reserve address");
    require(
      getDailySpendingRatioForCollateralAsset(collateralAsset) > 0,
      "this asset has no spending ratio, therefore can't be transferred"
    );
    uint256 currentDay = now / 1 days;
    if (currentDay > collateralAssetLastSpendingDay[collateralAsset]) {
      uint256 balance = getReserveAddressesCollateralAssetBalance(collateralAsset);
      collateralAssetLastSpendingDay[collateralAsset] = currentDay;
      collateralAssetSpendingLimit[collateralAsset] = collateralAssetDailySpendingRatio[collateralAsset]
        .multiply(FixidityLib.newFixed(balance))
        .fromFixed();
    }
    uint256 spendingLimitForThisAsset = collateralAssetSpendingLimit[collateralAsset];
    require(spendingLimitForThisAsset >= value, "Exceeding spending limit");

    collateralAssetSpendingLimit[collateralAsset] = spendingLimitForThisAsset.sub(value);
    return _transferCollateralAsset(collateralAsset, to, value);
  }

  /**
   * @notice Transfer collateral asset to any address.
   * @param collateralAsset The token address you're transferring.
   * @param to The address that will receive the funds.
   * @param value The amount of collateral assets to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function _transferCollateralAsset(
    address collateralAsset,
    address payable to,
    uint256 value
  ) internal returns (bool) {
    require(value <= getReserveAddressesCollateralAssetBalance(collateralAsset), "Exceeding the amount reserve holds");
    IERC20(collateralAsset).safeTransfer(to, value);
    emit ReserveCollateralAssetsTransferred(msg.sender, to, value, collateralAsset);
    return true;
  }

  /**
   * @notice Transfer collateral asset to any address.
   * @dev Transfers are not subject to a daily spending limit.
   * @param collateralAsset The address of collateral asset being transferred.
   * @param to The address that will receive the collateral asset.
   * @param value The amount of collateral asset to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function transferExchangeCollateralAsset(
    address collateralAsset,
    address payable to,
    uint256 value
  ) external returns (bool) {
    require(isExchangeSpender[msg.sender], "Address not allowed to spend");
    return _transferCollateralAsset(collateralAsset, to, value);
  }

  /**
   * @notice Transfer unfrozen gold to any address.
   * @param to The address that will receive the gold.
   * @param value The amount of gold to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function _transferGold(address payable to, uint256 value) internal returns (bool) {
    require(value <= getUnfrozenBalance(), "Exceeding unfrozen reserves");
    to.sendValue(value);
    emit ReserveGoldTransferred(msg.sender, to, value);
    return true;
  }

  /**
   * @notice Transfer unfrozen gold to any address, used for one side of CP-DOTO.
   * @dev Transfers are not subject to a daily spending limit.
   * @param to The address that will receive the gold.
   * @param value The amount of gold to transfer.
   * @return Returns true if the transaction succeeds.
   */
  function transferExchangeGold(address payable to, uint256 value)
    external
    isAllowedToSpendExchange(msg.sender)
    returns (bool)
  {
    return _transferGold(to, value);
  }

  /**
   * @notice Returns the tobin tax, recomputing it if it's stale.
   * @return The numerator - tobin tax amount as a fraction.
   * @return The denominator - tobin tax amount as a fraction.
   */
  function getOrComputeTobinTax() external nonReentrant returns (uint256, uint256) {
    // solhint-disable-next-line not-rely-on-time
    if (now.sub(tobinTaxCache.timestamp) > tobinTaxStalenessThreshold) {
      tobinTaxCache.numerator = uint128(computeTobinTax().unwrap());
      tobinTaxCache.timestamp = uint128(now); // solhint-disable-line not-rely-on-time
    }
    return (uint256(tobinTaxCache.numerator), FixidityLib.fixed1().unwrap());
  }

  /**
   * @notice Returns the list of stabilized token addresses.
   * @return An array of addresses of stabilized tokens.
   */
  function getTokens() external view returns (address[] memory) {
    return _tokens;
  }

  /**
   * @notice Returns the list other addresses included in the reserve total.
   * @return An array of other addresses included in the reserve total.
   */
  function getOtherReserveAddresses() external view returns (address[] memory) {
    return otherReserveAddresses;
  }

  /**
   * @notice Returns a list of token symbols that have been allocated.
   * @return An array of token symbols that have been allocated.
   */
  function getAssetAllocationSymbols() external view returns (bytes32[] memory) {
    return assetAllocationSymbols;
  }

  /**
   * @notice Returns a list of weights used for the allocation of reserve assets.
   * @return An array of a list of weights used for the allocation of reserve assets.
   */
  function getAssetAllocationWeights() external view returns (uint256[] memory) {
    uint256[] memory weights = new uint256[](assetAllocationSymbols.length);
    for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) {
      weights[i] = assetAllocationWeights[assetAllocationSymbols[i]];
    }
    return weights;
  }

  /**
   * @notice Returns the amount of unfrozen CELO in the reserve.
   * @return The total unfrozen CELO in the reserve.
   */
  function getUnfrozenBalance() public view returns (uint256) {
    uint256 balance = address(this).balance;
    uint256 frozenReserveGold = getFrozenReserveGoldBalance();
    return balance > frozenReserveGold ? balance.sub(frozenReserveGold) : 0;
  }

  /**
   * @notice Returns the amount of CELO included in the reserve.
   * @return The CELO amount included in the reserve.
   */
  function getReserveGoldBalance() public view returns (uint256) {
    return address(this).balance.add(getOtherReserveAddressesGoldBalance());
  }

  /**
   * @notice Returns the amount of CELO included in other reserve addresses.
   * @return The CELO amount included in other reserve addresses.
   */
  function getOtherReserveAddressesGoldBalance() public view returns (uint256) {
    uint256 reserveGoldBalance = 0;
    for (uint256 i = 0; i < otherReserveAddresses.length; i = i.add(1)) {
      reserveGoldBalance = reserveGoldBalance.add(otherReserveAddresses[i].balance);
    }
    return reserveGoldBalance;
  }

  /**
   * @notice Returns the amount of unfrozen CELO included in the reserve.
   * @return The unfrozen CELO amount included in the reserve.
   */
  function getUnfrozenReserveGoldBalance() public view returns (uint256) {
    return getUnfrozenBalance().add(getOtherReserveAddressesGoldBalance());
  }

  /**
   * @notice Returns the amount of particular collateral asset
   * in reserve including other reserve addresses.
   * @param collateralAsset the asset we're checking a balance of
   * @return The balance of particular collateral asset.
   */
  function getReserveAddressesCollateralAssetBalance(address collateralAsset) public view returns (uint256) {
    require(checkIsCollateralAsset(collateralAsset), "specified address is not a collateral asset");
    uint256 reserveCollateralAssetBalance = 0;
    for (uint256 i = 0; i < otherReserveAddresses.length; i++) {
      reserveCollateralAssetBalance = reserveCollateralAssetBalance.add(
        IERC20(collateralAsset).balanceOf(otherReserveAddresses[i])
      );
    }
    return reserveCollateralAssetBalance.add(IERC20(collateralAsset).balanceOf(address(this)));
  }

  /**
   * @notice Add a collateral asset in the reserve.
   * @param collateralAsset The address of the token being added.
   * @return Returns true if the transaction succeeds.
   */
  function addCollateralAsset(address collateralAsset) public onlyOwner returns (bool) {
    require(!checkIsCollateralAsset(collateralAsset), "specified address is already added as a collateral asset");
    require(collateralAsset != address(0), "can't be a zero address");
    isCollateralAsset[collateralAsset] = true;
    collateralAssets.push(collateralAsset);
    emit CollateralAssetAdded(collateralAsset);
    return true;
  }

  /**
   * @notice Remove a collateral asset in the reserve.
   * @param collateralAsset The address of the token being removed.
   * @param index The index of the token being removed.
   * @return Returns true if the transaction succeeds.
   */
  function removeCollateralAsset(address collateralAsset, uint256 index) external onlyOwner returns (bool) {
    require(checkIsCollateralAsset(collateralAsset), "specified address is not a collateral asset");
    require(
      index < collateralAssets.length && collateralAssets[index] == collateralAsset,
      "index into collateralAssets list not mapped to token"
    );
    collateralAssets[index] = collateralAssets[collateralAssets.length.sub(1)];
    collateralAssets.pop();
    delete isCollateralAsset[collateralAsset];
    emit CollateralAssetRemoved(collateralAsset);
    return true;
  }

  /**
   * @notice Check if a collateral asset is added to the reserve.
   * @param collateralAsset The address of the token being checked.
   * @return Returns true if the token was added as a collateral asset.
   */
  function checkIsCollateralAsset(address collateralAsset) public view returns (bool) {
    return isCollateralAsset[collateralAsset];
  }

  /**
   * @notice Returns the amount of frozen CELO in the reserve.
   * @return The total frozen CELO in the reserve.
   */
  function getFrozenReserveGoldBalance() public view returns (uint256) {
    uint256 currentDay = now / 1 days;
    uint256 frozenDays = currentDay.sub(frozenReserveGoldStartDay);
    if (frozenDays >= frozenReserveGoldDays) return 0;
    return frozenReserveGoldStartBalance.sub(frozenReserveGoldStartBalance.mul(frozenDays).div(frozenReserveGoldDays));
  }

  /**
   * @notice Computes the ratio of current reserve balance to total stable token valuation.
   * @return Reserve ratio in a fixed point format.
   */
  function getReserveRatio() public view returns (uint256) {
    address sortedOraclesAddress = registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID);
    ISortedOracles sortedOracles = ISortedOracles(sortedOraclesAddress);
    uint256 reserveGoldBalance = getUnfrozenReserveGoldBalance();
    uint256 stableTokensValueInGold = 0;
    FixidityLib.Fraction memory cgldWeight = FixidityLib.wrap(assetAllocationWeights["cGLD"]);

    for (uint256 i = 0; i < _tokens.length; i = i.add(1)) {
      uint256 stableAmount;
      uint256 goldAmount;
      (stableAmount, goldAmount) = sortedOracles.medianRate(_tokens[i]);

      if (goldAmount != 0) {
        // tokens with no oracle reports don't count towards collateralization ratio
        uint256 stableTokenSupply = IERC20(_tokens[i]).totalSupply();
        uint256 aStableTokenValueInGold = stableTokenSupply.mul(goldAmount).div(stableAmount);
        stableTokensValueInGold = stableTokensValueInGold.add(aStableTokenValueInGold);
      }
    }
    return
      FixidityLib
        .newFixed(reserveGoldBalance)
        .divide(cgldWeight)
        .divide(FixidityLib.newFixed(stableTokensValueInGold))
        .unwrap();
  }

  /*
   * Internal functions
   */

  /**
   * @notice Computes a tobin tax based on the reserve ratio.
   * @return The tobin tax expresesed as a fixidity fraction.
   */
  function computeTobinTax() private view returns (FixidityLib.Fraction memory) {
    FixidityLib.Fraction memory ratio = FixidityLib.wrap(getReserveRatio());
    if (ratio.gte(FixidityLib.wrap(tobinTaxReserveRatio))) {
      return FixidityLib.wrap(0);
    } else {
      return FixidityLib.wrap(tobinTax);
    }
  }

  function isStableAsset(address token) external view returns (bool) {
    return isToken[token];
  }
}
        

/lib/mento-core/contracts/common/FixidityLib.sol

pragma solidity ^0.5.13;

/**
 * @title FixidityLib
 * @author Gadi Guy, Alberto Cuesta Canada
 * @notice This library provides fixed point arithmetic with protection against
 * overflow.
 * All operations are done with uint256 and the operands must have been created
 * with any of the newFrom* functions, which shift the comma digits() to the
 * right and check for limits, or with wrap() which expects a number already
 * in the internal representation of a fraction.
 * When using this library be sure to use maxNewFixed() as the upper limit for
 * creation of fixed point numbers.
 * @dev All contained functions are pure and thus marked internal to be inlined
 * on consuming contracts at compile time for gas efficiency.
 */
library FixidityLib {
  struct Fraction {
    uint256 value;
  }

  /**
   * @notice Number of positions that the comma is shifted to the right.
   */
  function digits() internal pure returns (uint8) {
    return 24;
  }

  uint256 private constant FIXED1_UINT = 1000000000000000000000000;

  /**
   * @notice This is 1 in the fixed point units used in this library.
   * @dev Test fixed1() equals 10^digits()
   * Hardcoded to 24 digits.
   */
  function fixed1() internal pure returns (Fraction memory) {
    return Fraction(FIXED1_UINT);
  }

  /**
   * @notice Wrap a uint256 that represents a 24-decimal fraction in a Fraction
   * struct.
   * @param x Number that already represents a 24-decimal fraction.
   * @return A Fraction struct with contents x.
   */
  function wrap(uint256 x) internal pure returns (Fraction memory) {
    return Fraction(x);
  }

  /**
   * @notice Unwraps the uint256 inside of a Fraction struct.
   */
  function unwrap(Fraction memory x) internal pure returns (uint256) {
    return x.value;
  }

  /**
   * @notice The amount of decimals lost on each multiplication operand.
   * @dev Test mulPrecision() equals sqrt(fixed1)
   */
  function mulPrecision() internal pure returns (uint256) {
    return 1000000000000;
  }

  /**
   * @notice Maximum value that can be converted to fixed point. Optimize for deployment.
   * @dev
   * Test maxNewFixed() equals maxUint256() / fixed1()
   */
  function maxNewFixed() internal pure returns (uint256) {
    return 115792089237316195423570985008687907853269984665640564;
  }

  /**
   * @notice Converts a uint256 to fixed point Fraction
   * @dev Test newFixed(0) returns 0
   * Test newFixed(1) returns fixed1()
   * Test newFixed(maxNewFixed()) returns maxNewFixed() * fixed1()
   * Test newFixed(maxNewFixed()+1) fails
   */
  function newFixed(uint256 x) internal pure returns (Fraction memory) {
    require(x <= maxNewFixed(), "can't create fixidity number larger than maxNewFixed()");
    return Fraction(x * FIXED1_UINT);
  }

  /**
   * @notice Converts a uint256 in the fixed point representation of this
   * library to a non decimal. All decimal digits will be truncated.
   */
  function fromFixed(Fraction memory x) internal pure returns (uint256) {
    return x.value / FIXED1_UINT;
  }

  /**
   * @notice Converts two uint256 representing a fraction to fixed point units,
   * equivalent to multiplying dividend and divisor by 10^digits().
   * @param numerator numerator must be <= maxNewFixed()
   * @param denominator denominator must be <= maxNewFixed() and denominator can't be 0
   * @dev
   * Test newFixedFraction(1,0) fails
   * Test newFixedFraction(0,1) returns 0
   * Test newFixedFraction(1,1) returns fixed1()
   * Test newFixedFraction(1,fixed1()) returns 1
   */
  function newFixedFraction(uint256 numerator, uint256 denominator) internal pure returns (Fraction memory) {
    Fraction memory convertedNumerator = newFixed(numerator);
    Fraction memory convertedDenominator = newFixed(denominator);
    return divide(convertedNumerator, convertedDenominator);
  }

  /**
   * @notice Returns the integer part of a fixed point number.
   * @dev
   * Test integer(0) returns 0
   * Test integer(fixed1()) returns fixed1()
   * Test integer(newFixed(maxNewFixed())) returns maxNewFixed()*fixed1()
   */
  function integer(Fraction memory x) internal pure returns (Fraction memory) {
    return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
  }

  /**
   * @notice Returns the fractional part of a fixed point number.
   * In the case of a negative number the fractional is also negative.
   * @dev
   * Test fractional(0) returns 0
   * Test fractional(fixed1()) returns 0
   * Test fractional(fixed1()-1) returns 10^24-1
   */
  function fractional(Fraction memory x) internal pure returns (Fraction memory) {
    return Fraction(x.value - (x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow
  }

  /**
   * @notice x+y.
   * @dev The maximum value that can be safely used as an addition operator is defined as
   * maxFixedAdd = maxUint256()-1 / 2, or
   * 57896044618658097711785492504343953926634992332820282019728792003956564819967.
   * Test add(maxFixedAdd,maxFixedAdd) equals maxFixedAdd + maxFixedAdd
   * Test add(maxFixedAdd+1,maxFixedAdd+1) throws
   */
  function add(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    uint256 z = x.value + y.value;
    require(z >= x.value, "add overflow detected");
    return Fraction(z);
  }

  /**
   * @notice x-y.
   * @dev
   * Test subtract(6, 10) fails
   */
  function subtract(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    require(x.value >= y.value, "substraction underflow detected");
    return Fraction(x.value - y.value);
  }

  /**
   * @notice x*y. If any of the operators is higher than the max multiplier value it
   * might overflow.
   * @dev The maximum value that can be safely used as a multiplication operator
   * (maxFixedMul) is calculated as sqrt(maxUint256()*fixed1()),
   * or 340282366920938463463374607431768211455999999999999
   * Test multiply(0,0) returns 0
   * Test multiply(maxFixedMul,0) returns 0
   * Test multiply(0,maxFixedMul) returns 0
   * Test multiply(fixed1()/mulPrecision(),fixed1()*mulPrecision()) returns fixed1()
   * Test multiply(maxFixedMul,maxFixedMul) is around maxUint256()
   * Test multiply(maxFixedMul+1,maxFixedMul+1) fails
   */
  // solhint-disable-next-line code-complexity
  function multiply(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    if (x.value == 0 || y.value == 0) return Fraction(0);
    if (y.value == FIXED1_UINT) return x;
    if (x.value == FIXED1_UINT) return y;

    // Separate into integer and fractional parts
    // x = x1 + x2, y = y1 + y2
    uint256 x1 = integer(x).value / FIXED1_UINT;
    uint256 x2 = fractional(x).value;
    uint256 y1 = integer(y).value / FIXED1_UINT;
    uint256 y2 = fractional(y).value;

    // (x1 + x2) * (y1 + y2) = (x1 * y1) + (x1 * y2) + (x2 * y1) + (x2 * y2)
    uint256 x1y1 = x1 * y1;
    if (x1 != 0) require(x1y1 / x1 == y1, "overflow x1y1 detected");

    // x1y1 needs to be multiplied back by fixed1
    // solhint-disable-next-line var-name-mixedcase
    uint256 fixed_x1y1 = x1y1 * FIXED1_UINT;
    if (x1y1 != 0) require(fixed_x1y1 / x1y1 == FIXED1_UINT, "overflow x1y1 * fixed1 detected");
    x1y1 = fixed_x1y1;

    uint256 x2y1 = x2 * y1;
    if (x2 != 0) require(x2y1 / x2 == y1, "overflow x2y1 detected");

    uint256 x1y2 = x1 * y2;
    if (x1 != 0) require(x1y2 / x1 == y2, "overflow x1y2 detected");

    x2 = x2 / mulPrecision();
    y2 = y2 / mulPrecision();
    uint256 x2y2 = x2 * y2;
    if (x2 != 0) require(x2y2 / x2 == y2, "overflow x2y2 detected");

    // result = fixed1() * x1 * y1 + x1 * y2 + x2 * y1 + x2 * y2 / fixed1();
    Fraction memory result = Fraction(x1y1);
    result = add(result, Fraction(x2y1)); // Add checks for overflow
    result = add(result, Fraction(x1y2)); // Add checks for overflow
    result = add(result, Fraction(x2y2)); // Add checks for overflow
    return result;
  }

  /**
   * @notice 1/x
   * @dev
   * Test reciprocal(0) fails
   * Test reciprocal(fixed1()) returns fixed1()
   * Test reciprocal(fixed1()*fixed1()) returns 1 // Testing how the fractional is truncated
   * Test reciprocal(1+fixed1()*fixed1()) returns 0 // Testing how the fractional is truncated
   * Test reciprocal(newFixedFraction(1, 1e24)) returns newFixed(1e24)
   */
  function reciprocal(Fraction memory x) internal pure returns (Fraction memory) {
    require(x.value != 0, "can't call reciprocal(0)");
    return Fraction((FIXED1_UINT * FIXED1_UINT) / x.value); // Can't overflow
  }

  /**
   * @notice x/y. If the dividend is higher than the max dividend value, it
   * might overflow. You can use multiply(x,reciprocal(y)) instead.
   * @dev The maximum value that can be safely used as a dividend (maxNewFixed) is defined as
   * divide(maxNewFixed,newFixedFraction(1,fixed1())) is around maxUint256().
   * This yields the value 115792089237316195423570985008687907853269984665640564.
   * Test maxNewFixed equals maxUint256()/fixed1()
   * Test divide(maxNewFixed,1) equals maxNewFixed*(fixed1)
   * Test divide(maxNewFixed+1,multiply(mulPrecision(),mulPrecision())) throws
   * Test divide(fixed1(),0) fails
   * Test divide(maxNewFixed,1) = maxNewFixed*(10^digits())
   * Test divide(maxNewFixed+1,1) throws
   */
  function divide(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
    require(y.value != 0, "can't divide by 0");
    // solhint-disable-next-line var-name-mixedcase
    uint256 X = x.value * FIXED1_UINT;
    require(X / FIXED1_UINT == x.value, "overflow at divide");
    return Fraction(X / y.value);
  }

  /**
   * @notice x > y
   */
  function gt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value > y.value;
  }

  /**
   * @notice x >= y
   */
  function gte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value >= y.value;
  }

  /**
   * @notice x < y
   */
  function lt(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value < y.value;
  }

  /**
   * @notice x <= y
   */
  function lte(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value <= y.value;
  }

  /**
   * @notice x == y
   */
  function equals(Fraction memory x, Fraction memory y) internal pure returns (bool) {
    return x.value == y.value;
  }

  /**
   * @notice x <= 1
   */
  function isProperFraction(Fraction memory x) internal pure returns (bool) {
    return lte(x, fixed1());
  }
}
          

/lib/mento-core/contracts/common/Initializable.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

contract Initializable {
  bool public initialized;

  constructor(bool testingDeployment) public {
    if (!testingDeployment) {
      initialized = true;
    }
  }

  modifier initializer() {
    require(!initialized, "contract already initialized");
    initialized = true;
    _;
  }
}
          

/lib/mento-core/contracts/common/ReentrancyGuard.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io>
 * @dev If you mark a function `nonReentrant`, you should also
 * mark it `external`.
 */
contract ReentrancyGuard {
  /// @dev counter to allow mutex lock with only one SSTORE operation
  uint256 private _guardCounter;

  constructor() internal {
    // The counter starts at one to prevent changing it from zero to a non-zero
    // value, which is a more expensive operation.
    _guardCounter = 1;
  }

  /**
   * @dev Prevents a contract from calling itself, directly or indirectly.
   * Calling a `nonReentrant` function from another `nonReentrant`
   * function is not supported. It is possible to prevent this from happening
   * by making the `nonReentrant` function external, and make it call a
   * `private` function that does the actual work.
   */
  modifier nonReentrant() {
    _guardCounter += 1;
    uint256 localCounter = _guardCounter;
    _;
    require(localCounter == _guardCounter, "reentrant call");
  }
}
          

/lib/mento-core/contracts/common/UsingRegistry.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

import "./interfaces/IFreezer.sol";
import "./interfaces/IRegistry.sol";

import "../interfaces/IExchange.sol";
import "../interfaces/IReserve.sol";
import "../interfaces/ISortedOracles.sol";
import "../interfaces/IStableToken.sol";

contract UsingRegistry is Ownable {
  event RegistrySet(address indexed registryAddress);

  // solhint-disable state-visibility
  bytes32 constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));
  bytes32 constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations"));
  bytes32 constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("DowntimeSlasher"));
  bytes32 constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("DoubleSigningSlasher"));
  bytes32 constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));
  bytes32 constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange"));
  bytes32 constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256(abi.encodePacked("FeeCurrencyWhitelist"));
  bytes32 constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer"));
  bytes32 constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));
  bytes32 constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));
  bytes32 constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("GovernanceSlasher"));
  bytes32 constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
  bytes32 constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve"));
  bytes32 constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random"));
  bytes32 constant SORTED_ORACLES_REGISTRY_ID = keccak256(abi.encodePacked("SortedOracles"));
  bytes32 constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken"));
  bytes32 constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators"));
  // solhint-enable state-visibility

  IRegistry public registry;

  modifier onlyRegisteredContract(bytes32 identifierHash) {
    require(registry.getAddressForOrDie(identifierHash) == msg.sender, "only registered contract");
    _;
  }

  modifier onlyRegisteredContracts(bytes32[] memory identifierHashes) {
    require(registry.isOneOf(identifierHashes, msg.sender), "only registered contracts");
    _;
  }

  /**
   * @notice Updates the address pointing to a Registry contract.
   * @param registryAddress The address of a registry contract for routing to other contracts.
   */
  function setRegistry(address registryAddress) public onlyOwner {
    require(registryAddress != address(0), "Cannot register the null address");
    registry = IRegistry(registryAddress);
    emit RegistrySet(registryAddress);
  }

  function getExchange() internal view returns (IExchange) {
    return IExchange(registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID));
  }

  function getFreezer() internal view returns (IFreezer) {
    return IFreezer(registry.getAddressForOrDie(FREEZER_REGISTRY_ID));
  }

  function getGoldToken() internal view returns (IERC20) {
    return IERC20(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID));
  }

  function getReserve() internal view returns (IReserve) {
    return IReserve(registry.getAddressForOrDie(RESERVE_REGISTRY_ID));
  }

  function getSortedOracles() internal view returns (ISortedOracles) {
    return ISortedOracles(registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID));
  }

  function getStableToken() internal view returns (IStableToken) {
    return IStableToken(registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID));
  }
}
          

/lib/mento-core/contracts/common/interfaces/ICeloVersionedContract.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

interface ICeloVersionedContract {
  /**
   * @notice Returns the storage, major, minor, and patch version of the contract.
   * @return Storage version of the contract.
   * @return Major version of the contract.
   * @return Minor version of the contract.
   * @return Patch version of the contract.
   */
  function getVersionNumber()
    external
    pure
    returns (
      uint256,
      uint256,
      uint256,
      uint256
    );
}
          

/lib/mento-core/contracts/common/interfaces/IFreezer.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

interface IFreezer {
  function isFrozen(address) external view returns (bool);
}
          

/lib/mento-core/contracts/common/interfaces/IRegistry.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

interface IRegistry {
  function setAddressFor(string calldata, address) external;

  function getAddressForOrDie(bytes32) external view returns (address);

  function getAddressFor(bytes32) external view returns (address);

  function getAddressForStringOrDie(string calldata identifier) external view returns (address);

  function getAddressForString(string calldata identifier) external view returns (address);

  function isOneOf(bytes32[] calldata, address) external view returns (bool);
}
          

/lib/mento-core/contracts/common/linkedlists/LinkedList.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";

/**
 * @title Maintains a doubly linked list keyed by bytes32.
 * @dev Following the `next` pointers will lead you to the head, rather than the tail.
 */
library LinkedList {
  using SafeMath for uint256;

  struct Element {
    bytes32 previousKey;
    bytes32 nextKey;
    bool exists;
  }

  struct List {
    bytes32 head;
    bytes32 tail;
    uint256 numElements;
    mapping(bytes32 => Element) elements;
  }

  /**
   * @notice Inserts an element into a doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   * @param previousKey The key of the element that comes before the element to insert.
   * @param nextKey The key of the element that comes after the element to insert.
   */
  function insert(
    List storage list,
    bytes32 key,
    bytes32 previousKey,
    bytes32 nextKey
  ) internal {
    require(key != bytes32(0), "Key must be defined");
    require(!contains(list, key), "Can't insert an existing element");
    require(previousKey != key && nextKey != key, "Key cannot be the same as previousKey or nextKey");

    Element storage element = list.elements[key];
    element.exists = true;

    if (list.numElements == 0) {
      list.tail = key;
      list.head = key;
    } else {
      require(previousKey != bytes32(0) || nextKey != bytes32(0), "Either previousKey or nextKey must be defined");

      element.previousKey = previousKey;
      element.nextKey = nextKey;

      if (previousKey != bytes32(0)) {
        require(contains(list, previousKey), "If previousKey is defined, it must exist in the list");
        Element storage previousElement = list.elements[previousKey];
        require(previousElement.nextKey == nextKey, "previousKey must be adjacent to nextKey");
        previousElement.nextKey = key;
      } else {
        list.tail = key;
      }

      if (nextKey != bytes32(0)) {
        require(contains(list, nextKey), "If nextKey is defined, it must exist in the list");
        Element storage nextElement = list.elements[nextKey];
        require(nextElement.previousKey == previousKey, "previousKey must be adjacent to nextKey");
        nextElement.previousKey = key;
      } else {
        list.head = key;
      }
    }

    list.numElements = list.numElements.add(1);
  }

  /**
   * @notice Inserts an element at the tail of the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   */
  function push(List storage list, bytes32 key) internal {
    insert(list, key, bytes32(0), list.tail);
  }

  /**
   * @notice Removes an element from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to remove.
   */
  function remove(List storage list, bytes32 key) internal {
    Element storage element = list.elements[key];
    require(key != bytes32(0) && contains(list, key), "key not in list");
    if (element.previousKey != bytes32(0)) {
      Element storage previousElement = list.elements[element.previousKey];
      previousElement.nextKey = element.nextKey;
    } else {
      list.tail = element.nextKey;
    }

    if (element.nextKey != bytes32(0)) {
      Element storage nextElement = list.elements[element.nextKey];
      nextElement.previousKey = element.previousKey;
    } else {
      list.head = element.previousKey;
    }

    delete list.elements[key];
    list.numElements = list.numElements.sub(1);
  }

  /**
   * @notice Updates an element in the list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @param previousKey The key of the element that comes before the updated element.
   * @param nextKey The key of the element that comes after the updated element.
   */
  function update(
    List storage list,
    bytes32 key,
    bytes32 previousKey,
    bytes32 nextKey
  ) internal {
    require(key != bytes32(0) && key != previousKey && key != nextKey && contains(list, key), "key on in list");
    remove(list, key);
    insert(list, key, previousKey, nextKey);
  }

  /**
   * @notice Returns whether or not a particular key is present in the sorted list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @return Whether or not the key is in the sorted list.
   */
  function contains(List storage list, bytes32 key) internal view returns (bool) {
    return list.elements[key].exists;
  }

  /**
   * @notice Returns the keys of the N elements at the head of the list.
   * @param list A storage pointer to the underlying list.
   * @param n The number of elements to return.
   * @return The keys of the N elements at the head of the list.
   * @dev Reverts if n is greater than the number of elements in the list.
   */
  function headN(List storage list, uint256 n) internal view returns (bytes32[] memory) {
    require(n <= list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    bytes32 key = list.head;
    for (uint256 i = 0; i < n; i = i.add(1)) {
      keys[i] = key;
      key = list.elements[key].previousKey;
    }
    return keys;
  }

  /**
   * @notice Gets all element keys from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @return All element keys from head to tail.
   */
  function getKeys(List storage list) internal view returns (bytes32[] memory) {
    return headN(list, list.numElements);
  }
}
          

/lib/mento-core/contracts/common/linkedlists/SortedLinkedList.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./LinkedList.sol";

/**
 * @title Maintains a sorted list of unsigned ints keyed by bytes32.
 */
library SortedLinkedList {
  using SafeMath for uint256;
  using LinkedList for LinkedList.List;

  struct List {
    LinkedList.List list;
    mapping(bytes32 => uint256) values;
  }

  /**
   * @notice Inserts an element into a doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   * @param value The element value.
   * @param lesserKey The key of the element less than the element to insert.
   * @param greaterKey The key of the element greater than the element to insert.
   */
  function insert(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) internal {
    require(key != bytes32(0) && key != lesserKey && key != greaterKey && !contains(list, key), "invalid key");
    require(
      (lesserKey != bytes32(0) || greaterKey != bytes32(0)) || list.list.numElements == 0,
      "greater and lesser key zero"
    );
    require(contains(list, lesserKey) || lesserKey == bytes32(0), "invalid lesser key");
    require(contains(list, greaterKey) || greaterKey == bytes32(0), "invalid greater key");
    (lesserKey, greaterKey) = getLesserAndGreater(list, value, lesserKey, greaterKey);
    list.list.insert(key, lesserKey, greaterKey);
    list.values[key] = value;
  }

  /**
   * @notice Removes an element from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to remove.
   */
  function remove(List storage list, bytes32 key) internal {
    list.list.remove(key);
    list.values[key] = 0;
  }

  /**
   * @notice Updates an element in the list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @param value The element value.
   * @param lesserKey The key of the element will be just left of `key` after the update.
   * @param greaterKey The key of the element will be just right of `key` after the update.
   * @dev Note that only one of "lesserKey" or "greaterKey" needs to be correct to reduce friction.
   */
  function update(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) internal {
    remove(list, key);
    insert(list, key, value, lesserKey, greaterKey);
  }

  /**
   * @notice Inserts an element at the tail of the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   */
  function push(List storage list, bytes32 key) internal {
    insert(list, key, 0, bytes32(0), list.list.tail);
  }

  /**
   * @notice Removes N elements from the head of the list and returns their keys.
   * @param list A storage pointer to the underlying list.
   * @param n The number of elements to pop.
   * @return The keys of the popped elements.
   */
  function popN(List storage list, uint256 n) internal returns (bytes32[] memory) {
    require(n <= list.list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    for (uint256 i = 0; i < n; i = i.add(1)) {
      bytes32 key = list.list.head;
      keys[i] = key;
      remove(list, key);
    }
    return keys;
  }

  /**
   * @notice Returns whether or not a particular key is present in the sorted list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @return Whether or not the key is in the sorted list.
   */
  function contains(List storage list, bytes32 key) internal view returns (bool) {
    return list.list.contains(key);
  }

  /**
   * @notice Returns the value for a particular key in the sorted list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @return The element value.
   */
  function getValue(List storage list, bytes32 key) internal view returns (uint256) {
    return list.values[key];
  }

  /**
   * @notice Gets all elements from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @return Array of all keys in the list.
   * @return Values corresponding to keys, which will be ordered largest to smallest.
   */
  function getElements(List storage list) internal view returns (bytes32[] memory, uint256[] memory) {
    bytes32[] memory keys = getKeys(list);
    uint256[] memory values = new uint256[](keys.length);
    for (uint256 i = 0; i < keys.length; i = i.add(1)) {
      values[i] = list.values[keys[i]];
    }
    return (keys, values);
  }

  /**
   * @notice Gets all element keys from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @return All element keys from head to tail.
   */
  function getKeys(List storage list) internal view returns (bytes32[] memory) {
    return list.list.getKeys();
  }

  /**
   * @notice Returns first N greatest elements of the list.
   * @param list A storage pointer to the underlying list.
   * @param n The number of elements to return.
   * @return The keys of the first n elements.
   * @dev Reverts if n is greater than the number of elements in the list.
   */
  function headN(List storage list, uint256 n) internal view returns (bytes32[] memory) {
    return list.list.headN(n);
  }

  /**
   * @notice Returns the keys of the elements greaterKey than and less than the provided value.
   * @param list A storage pointer to the underlying list.
   * @param value The element value.
   * @param lesserKey The key of the element which could be just left of the new value.
   * @param greaterKey The key of the element which could be just right of the new value.
   * @return The correct lesserKey keys.
   * @return The correct greaterKey keys.
   */
  function getLesserAndGreater(
    List storage list,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) private view returns (bytes32, bytes32) {
    // Check for one of the following conditions and fail if none are met:
    //   1. The value is less than the current lowest value
    //   2. The value is greater than the current greatest value
    //   3. The value is just greater than the value for `lesserKey`
    //   4. The value is just less than the value for `greaterKey`
    if (lesserKey == bytes32(0) && isValueBetween(list, value, lesserKey, list.list.tail)) {
      return (lesserKey, list.list.tail);
    } else if (greaterKey == bytes32(0) && isValueBetween(list, value, list.list.head, greaterKey)) {
      return (list.list.head, greaterKey);
    } else if (
      lesserKey != bytes32(0) && isValueBetween(list, value, lesserKey, list.list.elements[lesserKey].nextKey)
    ) {
      return (lesserKey, list.list.elements[lesserKey].nextKey);
    } else if (
      greaterKey != bytes32(0) && isValueBetween(list, value, list.list.elements[greaterKey].previousKey, greaterKey)
    ) {
      return (list.list.elements[greaterKey].previousKey, greaterKey);
    } else {
      require(false, "get lesser and greater failure");
    }
  }

  /**
   * @notice Returns whether or not a given element is between two other elements.
   * @param list A storage pointer to the underlying list.
   * @param value The element value.
   * @param lesserKey The key of the element whose value should be lesserKey.
   * @param greaterKey The key of the element whose value should be greaterKey.
   * @return True if the given element is between the two other elements.
   */
  function isValueBetween(
    List storage list,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) private view returns (bool) {
    bool isLesser = lesserKey == bytes32(0) || list.values[lesserKey] <= value;
    bool isGreater = greaterKey == bytes32(0) || list.values[greaterKey] >= value;
    return isLesser && isGreater;
  }
}
          

/lib/mento-core/contracts/common/linkedlists/SortedLinkedListWithMedian.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./LinkedList.sol";
import "./SortedLinkedList.sol";

/**
 * @title Maintains a sorted list of unsigned ints keyed by bytes32.
 */
library SortedLinkedListWithMedian {
  using SafeMath for uint256;
  using SortedLinkedList for SortedLinkedList.List;

  enum MedianAction {
    None,
    Lesser,
    Greater
  }

  enum MedianRelation {
    Undefined,
    Lesser,
    Greater,
    Equal
  }

  struct List {
    SortedLinkedList.List list;
    bytes32 median;
    mapping(bytes32 => MedianRelation) relation;
  }

  /**
   * @notice Inserts an element into a doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   * @param value The element value.
   * @param lesserKey The key of the element less than the element to insert.
   * @param greaterKey The key of the element greater than the element to insert.
   */
  function insert(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) internal {
    list.list.insert(key, value, lesserKey, greaterKey);
    LinkedList.Element storage element = list.list.list.elements[key];

    MedianAction action = MedianAction.None;
    if (list.list.list.numElements == 1) {
      list.median = key;
      list.relation[key] = MedianRelation.Equal;
    } else if (list.list.list.numElements % 2 == 1) {
      // When we have an odd number of elements, and the element that we inserted is less than
      // the previous median, we need to slide the median down one element, since we had previously
      // selected the greater of the two middle elements.
      if (element.previousKey == bytes32(0) || list.relation[element.previousKey] == MedianRelation.Lesser) {
        action = MedianAction.Lesser;
        list.relation[key] = MedianRelation.Lesser;
      } else {
        list.relation[key] = MedianRelation.Greater;
      }
    } else {
      // When we have an even number of elements, and the element that we inserted is greater than
      // the previous median, we need to slide the median up one element, since we always select
      // the greater of the two middle elements.
      if (element.nextKey == bytes32(0) || list.relation[element.nextKey] == MedianRelation.Greater) {
        action = MedianAction.Greater;
        list.relation[key] = MedianRelation.Greater;
      } else {
        list.relation[key] = MedianRelation.Lesser;
      }
    }
    updateMedian(list, action);
  }

  /**
   * @notice Removes an element from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to remove.
   */
  function remove(List storage list, bytes32 key) internal {
    MedianAction action = MedianAction.None;
    if (list.list.list.numElements == 0) {
      list.median = bytes32(0);
    } else if (list.list.list.numElements % 2 == 0) {
      // When we have an even number of elements, we always choose the higher of the two medians.
      // Thus, if the element we're removing is greaterKey than or equal to the median we need to
      // slide the median left by one.
      if (list.relation[key] == MedianRelation.Greater || list.relation[key] == MedianRelation.Equal) {
        action = MedianAction.Lesser;
      }
    } else {
      // When we don't have an even number of elements, we just choose the median value.
      // Thus, if the element we're removing is less than or equal to the median, we need to slide
      // median right by one.
      if (list.relation[key] == MedianRelation.Lesser || list.relation[key] == MedianRelation.Equal) {
        action = MedianAction.Greater;
      }
    }
    updateMedian(list, action);

    list.list.remove(key);
  }

  /**
   * @notice Updates an element in the list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @param value The element value.
   * @param lesserKey The key of the element will be just left of `key` after the update.
   * @param greaterKey The key of the element will be just right of `key` after the update.
   * @dev Note that only one of "lesserKey" or "greaterKey" needs to be correct to reduce friction.
   */
  function update(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) internal {
    remove(list, key);
    insert(list, key, value, lesserKey, greaterKey);
  }

  /**
   * @notice Inserts an element at the tail of the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @param key The key of the element to insert.
   */
  function push(List storage list, bytes32 key) internal {
    insert(list, key, 0, bytes32(0), list.list.list.tail);
  }

  /**
   * @notice Removes N elements from the head of the list and returns their keys.
   * @param list A storage pointer to the underlying list.
   * @param n The number of elements to pop.
   * @return The keys of the popped elements.
   */
  function popN(List storage list, uint256 n) internal returns (bytes32[] memory) {
    require(n <= list.list.list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    for (uint256 i = 0; i < n; i = i.add(1)) {
      bytes32 key = list.list.list.head;
      keys[i] = key;
      remove(list, key);
    }
    return keys;
  }

  /**
   * @notice Returns whether or not a particular key is present in the sorted list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @return Whether or not the key is in the sorted list.
   */
  function contains(List storage list, bytes32 key) internal view returns (bool) {
    return list.list.contains(key);
  }

  /**
   * @notice Returns the value for a particular key in the sorted list.
   * @param list A storage pointer to the underlying list.
   * @param key The element key.
   * @return The element value.
   */
  function getValue(List storage list, bytes32 key) internal view returns (uint256) {
    return list.list.values[key];
  }

  /**
   * @notice Returns the median value of the sorted list.
   * @param list A storage pointer to the underlying list.
   * @return The median value.
   */
  function getMedianValue(List storage list) internal view returns (uint256) {
    return getValue(list, list.median);
  }

  /**
   * @notice Returns the key of the first element in the list.
   * @param list A storage pointer to the underlying list.
   * @return The key of the first element in the list.
   */
  function getHead(List storage list) internal view returns (bytes32) {
    return list.list.list.head;
  }

  /**
   * @notice Returns the key of the median element in the list.
   * @param list A storage pointer to the underlying list.
   * @return The key of the median element in the list.
   */
  function getMedian(List storage list) internal view returns (bytes32) {
    return list.median;
  }

  /**
   * @notice Returns the key of the last element in the list.
   * @param list A storage pointer to the underlying list.
   * @return The key of the last element in the list.
   */
  function getTail(List storage list) internal view returns (bytes32) {
    return list.list.list.tail;
  }

  /**
   * @notice Returns the number of elements in the list.
   * @param list A storage pointer to the underlying list.
   * @return The number of elements in the list.
   */
  function getNumElements(List storage list) internal view returns (uint256) {
    return list.list.list.numElements;
  }

  /**
   * @notice Gets all elements from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @return Array of all keys in the list.
   * @return Values corresponding to keys, which will be ordered largest to smallest.
   * @return Array of relations to median of corresponding list elements.
   */
  function getElements(List storage list)
    internal
    view
    returns (
      bytes32[] memory,
      uint256[] memory,
      MedianRelation[] memory
    )
  {
    bytes32[] memory keys = getKeys(list);
    uint256[] memory values = new uint256[](keys.length);
    MedianRelation[] memory relations = new MedianRelation[](keys.length);
    for (uint256 i = 0; i < keys.length; i = i.add(1)) {
      values[i] = list.list.values[keys[i]];
      relations[i] = list.relation[keys[i]];
    }
    return (keys, values, relations);
  }

  /**
   * @notice Gets all element keys from the doubly linked list.
   * @param list A storage pointer to the underlying list.
   * @return All element keys from head to tail.
   */
  function getKeys(List storage list) internal view returns (bytes32[] memory) {
    return list.list.getKeys();
  }

  /**
   * @notice Moves the median pointer right or left of its current value.
   * @param list A storage pointer to the underlying list.
   * @param action Which direction to move the median pointer.
   */
  function updateMedian(List storage list, MedianAction action) private {
    LinkedList.Element storage previousMedian = list.list.list.elements[list.median];
    if (action == MedianAction.Lesser) {
      list.relation[list.median] = MedianRelation.Greater;
      list.median = previousMedian.previousKey;
    } else if (action == MedianAction.Greater) {
      list.relation[list.median] = MedianRelation.Lesser;
      list.median = previousMedian.nextKey;
    }
    list.relation[list.median] = MedianRelation.Equal;
  }
}
          

/lib/mento-core/contracts/interfaces/IExchange.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

interface IExchange {
  function buy(
    uint256,
    uint256,
    bool
  ) external returns (uint256);

  function sell(
    uint256,
    uint256,
    bool
  ) external returns (uint256);

  function exchange(
    uint256,
    uint256,
    bool
  ) external returns (uint256);

  function setUpdateFrequency(uint256) external;

  function getBuyTokenAmount(uint256, bool) external view returns (uint256);

  function getSellTokenAmount(uint256, bool) external view returns (uint256);

  function getBuyAndSellBuckets(bool) external view returns (uint256, uint256);
}
          

/lib/mento-core/contracts/interfaces/IReserve.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

interface IReserve {
  function setTobinTaxStalenessThreshold(uint256) external;

  function addToken(address) external returns (bool);

  function removeToken(address, uint256) external returns (bool);

  function transferGold(address payable, uint256) external returns (bool);

  function transferExchangeGold(address payable, uint256) external returns (bool);

  function transferCollateralAsset(
    address collateralAsset,
    address payable to,
    uint256 value
  ) external returns (bool);

  function getReserveGoldBalance() external view returns (uint256);

  function getUnfrozenReserveGoldBalance() external view returns (uint256);

  function getOrComputeTobinTax() external returns (uint256, uint256);

  function getTokens() external view returns (address[] memory);

  function getReserveRatio() external view returns (uint256);

  function addExchangeSpender(address) external;

  function removeExchangeSpender(address, uint256) external;

  function addSpender(address) external;

  function removeSpender(address) external;

  function isStableAsset(address) external view returns (bool);

  function isCollateralAsset(address) external view returns (bool);

  function getDailySpendingRatioForCollateralAsset(address collateralAsset) external view returns (uint256);

  function isExchangeSpender(address exchange) external view returns (bool);

  function addCollateralAsset(address asset) external returns (bool);

  function transferExchangeCollateralAsset(
    address collateralAsset,
    address payable to,
    uint256 value
  ) external returns (bool);
}
          

/lib/mento-core/contracts/interfaces/ISortedOracles.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

import "../common/linkedlists/SortedLinkedListWithMedian.sol";

interface ISortedOracles {
  function addOracle(address, address) external;

  function removeOracle(
    address,
    address,
    uint256
  ) external;

  function report(
    address,
    uint256,
    address,
    address
  ) external;

  function removeExpiredReports(address, uint256) external;

  function isOldestReportExpired(address token) external view returns (bool, address);

  function numRates(address) external view returns (uint256);

  function medianRate(address) external view returns (uint256, uint256);

  function numTimestamps(address) external view returns (uint256);

  function medianTimestamp(address) external view returns (uint256);

  function getOracles(address) external view returns (address[] memory);

  function getTimestamps(address token)
    external
    view
    returns (
      address[] memory,
      uint256[] memory,
      SortedLinkedListWithMedian.MedianRelation[] memory
    );
}
          

/lib/mento-core/contracts/interfaces/IStableToken.sol

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.5.13;

/**
 * @title This interface describes the functions specific to Celo Stable Tokens, and in the
 * absence of interface inheritance is intended as a companion to IERC20.sol and ICeloToken.sol.
 */
interface IStableToken {
  function mint(address, uint256) external returns (bool);

  function burn(uint256) external returns (bool);

  function setInflationParameters(uint256, uint256) external;

  function valueToUnits(uint256) external view returns (uint256);

  function unitsToValue(uint256) external view returns (uint256);

  function getInflationParameters()
    external
    view
    returns (
      uint256,
      uint256,
      uint256,
      uint256
    );

  function getExchangeRegistryId() external view returns (bytes32);

  // NOTE: duplicated with IERC20.sol, remove once interface inheritance is supported.
  function balanceOf(address) external view returns (uint256);
}
          

/lib/mento-core/lib/openzeppelin-contracts/contracts/GSN/Context.sol

pragma solidity ^0.5.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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

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

/lib/mento-core/lib/openzeppelin-contracts/contracts/math/SafeMath.sol

pragma solidity ^0.5.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.
     *
     * _Available since v2.4.0._
     */
    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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}
          

/lib/mento-core/lib/openzeppelin-contracts/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _owner;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
          

/lib/mento-core/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
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);
}
          

/lib/mento-core/lib/openzeppelin-contracts/contracts/token/ERC20/SafeERC20.sol

pragma solidity ^0.5.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 ERC20;` 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));
    }

    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.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "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");
        }
    }
}
          

/lib/mento-core/lib/openzeppelin-contracts/contracts/utils/Address.sol

pragma solidity ^0.5.5;

/**
 * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }

    /**
     * @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].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"AssetAllocationSet","inputs":[{"type":"bytes32[]","name":"symbols","internalType":"bytes32[]","indexed":false},{"type":"uint256[]","name":"weights","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"CollateralAssetAdded","inputs":[{"type":"address","name":"collateralAsset","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"CollateralAssetRemoved","inputs":[{"type":"address","name":"collateralAsset","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"DailySpendingRatioForCollateralAssetSet","inputs":[{"type":"address","name":"collateralAsset","internalType":"address","indexed":false},{"type":"uint256","name":"collateralAssetDailySpendingRatios","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DailySpendingRatioSet","inputs":[{"type":"uint256","name":"ratio","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ExchangeSpenderAdded","inputs":[{"type":"address","name":"exchangeSpender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ExchangeSpenderRemoved","inputs":[{"type":"address","name":"exchangeSpender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OtherReserveAddressAdded","inputs":[{"type":"address","name":"otherReserveAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OtherReserveAddressRemoved","inputs":[{"type":"address","name":"otherReserveAddress","internalType":"address","indexed":true},{"type":"uint256","name":"index","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RegistrySet","inputs":[{"type":"address","name":"registryAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveCollateralAssetsTransferred","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveGoldTransferred","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SpenderAdded","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SpenderRemoved","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TobinTaxReserveRatioSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TobinTaxSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TobinTaxStalenessThresholdSet","inputs":[{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenAdded","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TokenRemoved","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"index","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addExchangeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addOtherReserveAddress","inputs":[{"type":"address","name":"reserveAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addToken","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"assetAllocationSymbols","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"assetAllocationWeights","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkIsCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"collateralAssetLastSpendingDay","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"collateralAssetSpendingLimit","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"collateralAssets","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"exchangeSpenderAddresses","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldDays","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldStartBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"frozenReserveGoldStartDay","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"}],"name":"getAssetAllocationSymbols","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getAssetAllocationWeights","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDailySpendingRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDailySpendingRatioForCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getExchangeSpenders","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getFrozenReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getOrComputeTobinTax","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getOtherReserveAddresses","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getOtherReserveAddressesGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getReserveAddressesCollateralAssetBalance","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getReserveRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getTokens","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUnfrozenBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUnfrozenReserveGoldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"address","name":"registryAddress","internalType":"address"},{"type":"uint256","name":"_tobinTaxStalenessThreshold","internalType":"uint256"},{"type":"uint256","name":"_spendingRatioForCelo","internalType":"uint256"},{"type":"uint256","name":"_frozenGold","internalType":"uint256"},{"type":"uint256","name":"_frozenDays","internalType":"uint256"},{"type":"bytes32[]","name":"_assetAllocationSymbols","internalType":"bytes32[]"},{"type":"uint256[]","name":"_assetAllocationWeights","internalType":"uint256[]"},{"type":"uint256","name":"_tobinTax","internalType":"uint256"},{"type":"uint256","name":"_tobinTaxReserveRatio","internalType":"uint256"},{"type":"address[]","name":"_collateralAssets","internalType":"address[]"},{"type":"uint256[]","name":"_collateralAssetDailySpendingRatios","internalType":"uint256[]"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isCollateralAsset","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExchangeSpender","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOtherReserveAddress","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSpender","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isStableAsset","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isToken","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastSpendingDay","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"otherReserveAddresses","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeExchangeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeOtherReserveAddress","inputs":[{"type":"address","name":"reserveAddress","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAssetAllocations","inputs":[{"type":"bytes32[]","name":"symbols","internalType":"bytes32[]"},{"type":"uint256[]","name":"weights","internalType":"uint256[]"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setDailySpendingRatio","inputs":[{"type":"uint256","name":"ratio","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setDailySpendingRatioForCollateralAssets","inputs":[{"type":"address[]","name":"_collateralAssets","internalType":"address[]"},{"type":"uint256[]","name":"collateralAssetDailySpendingRatios","internalType":"uint256[]"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setFrozenGold","inputs":[{"type":"uint256","name":"frozenGold","internalType":"uint256"},{"type":"uint256","name":"frozenDays","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setRegistry","inputs":[{"type":"address","name":"registryAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTax","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTaxReserveRatio","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTobinTaxStalenessThreshold","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"spendingLimit","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTax","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint128","name":"numerator","internalType":"uint128"},{"type":"uint128","name":"timestamp","internalType":"uint128"}],"name":"tobinTaxCache","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTaxReserveRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tobinTaxStalenessThreshold","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"},{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferExchangeCollateralAsset","inputs":[{"type":"address","name":"collateralAsset","internalType":"address"},{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferExchangeGold","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferGold","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b506040516200586238038062005862833981810160405260208110156200003757600080fd5b50518060006200004f6001600160e01b03620000c016565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35080620000b3576000805460ff60a01b1916600160a01b1790555b50506001600255620000c4565b3390565b61578e80620000d46000396000f3fe60806040526004361061042f5760003560e01c80637b52207511610228578063ad62ad1011610128578063e6b76e9c116100bb578063f0b7182b1161008a578063f2fde38b1161006f578063f2fde38b1461126a578063f7165fee1461129d578063fa9ed95a146112c75761042f565b8063f0b7182b14611204578063f240dae3146112375761042f565b8063e6b76e9c1461114d578063e7e31e7a14611177578063e83b373b146111aa578063ec4f797b146111da5761042f565b8063d48bfca7116100f7578063d48bfca7146110db578063e30f579d1461110e578063e33a88e714611123578063e50a6c1e146111385761042f565b8063ad62ad1014610f11578063b003dcf114610f3b578063ca56d33b14610f74578063cae182fe146110a85761042f565b80638f32d59b116101bb5780639c3e2f0f1161018a578063a8b94b8d1161016f578063a8b94b8d14610e96578063a91ee0dc14610ec9578063aa6ca80814610efc5761042f565b80639c3e2f0f14610e57578063a1ab55b314610e6c5761042f565b80638f32d59b14610da9578063919a1fbe14610dbe578063965366f314610df15780639a206ece14610e245761042f565b80638b7df8d4116101f75780638b7df8d414610d375780638ce5877c14610d4c5780638d9a5e6f14610d7f5780638da5cb5b14610d945761042f565b80637b52207514610cc557806381b861a614610cf85780638438796a14610d0d578063894098d614610d225761042f565b806340899365116103335780636be383fc116102c657806372a6b8b01161029557806376769a601161027a57806376769a6014610c865780637897a78e14610c9b5780637b10399914610cb05761042f565b806372a6b8b014610ac9578063765c1fe914610c715761042f565b80636be383fc14610a2357806370022cb414610a665780637090db4e14610a9f578063715018a614610ab45761042f565b806354255be01161030257806354255be01461097057806356b6d0d5146109ab5780635a18b08b146109c05780635c4a3145146109ea5761042f565b806340899365146108915780634cea8ded146108d75780634f8e6e231461090a57806350614ba01461093d5761042f565b8063158ef93e116103c657806322015968116103955780632aa1c16d1161037a5780632aa1c16d1461083457806338345dec1461084957806339d7f76e1461087c5761042f565b806322015968146107bd57806322796e83146107f05761042f565b8063158ef93e1461070e57806317f9a6f71461072357806319f37361146107515780631c39c7d5146107845761042f565b80630db279be116104025780630db279be1461051257806311bb0dcd1461053c5780631218f9821461067057806313baf1e6146106d55761042f565b806301da32bd1461043157806303a0fea31461045b57806303d835f3146104a8578063042b7a54146104cf575b005b34801561043d57600080fd5b5061042f6004803603602081101561045457600080fd5b50356112dc565b34801561046757600080fd5b506104946004803603604081101561047e57600080fd5b506001600160a01b0381351690602001356113da565b604080519115158252519081900360200190f35b3480156104b457600080fd5b506104bd611535565b60408051918252519081900360200190f35b3480156104db57600080fd5b50610494600480360360608110156104f257600080fd5b506001600160a01b0381358116916020810135909116906040013561153b565b34801561051e57600080fd5b506104bd6004803603602081101561053557600080fd5b5035611785565b34801561054857600080fd5b5061042f6004803603604081101561055f57600080fd5b81019060208101813564010000000081111561057a57600080fd5b82018360208201111561058c57600080fd5b803590602001918460208302840111640100000000831117156105ae57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156105fe57600080fd5b82018360208201111561061057600080fd5b8035906020019184602083028401116401000000008311171561063257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506117a3945050505050565b34801561067c57600080fd5b50610685611a29565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106c15781810151838201526020016106a9565b505050509050019250505060405180910390f35b3480156106e157600080fd5b50610494600480360360408110156106f857600080fd5b506001600160a01b038135169060200135611a8c565b34801561071a57600080fd5b50610494611cd8565b34801561072f57600080fd5b50610738611cf9565b6040805192835260208301919091528051918290030190f35b34801561075d57600080fd5b506104946004803603602081101561077457600080fd5b50356001600160a01b0316611e36565b34801561079057600080fd5b50610494600480360360408110156107a757600080fd5b506001600160a01b038135169060200135611e4b565b3480156107c957600080fd5b50610494600480360360208110156107e057600080fd5b50356001600160a01b0316611fbf565b3480156107fc57600080fd5b50610805612131565b604080516fffffffffffffffffffffffffffffffff938416815291909216602082015281519081900390910190f35b34801561084057600080fd5b506104bd612161565b34801561085557600080fd5b506104bd6004803603602081101561086c57600080fd5b50356001600160a01b03166121d7565b34801561088857600080fd5b506104bd612398565b34801561089d57600080fd5b506108bb600480360360208110156108b457600080fd5b503561239e565b604080516001600160a01b039092168252519081900360200190f35b3480156108e357600080fd5b50610494600480360360208110156108fa57600080fd5b50356001600160a01b03166123c5565b34801561091657600080fd5b506104946004803603602081101561092d57600080fd5b50356001600160a01b03166123da565b34801561094957600080fd5b506104bd6004803603602081101561096057600080fd5b50356001600160a01b03166123f8565b34801561097c57600080fd5b5061098561240a565b604080519485526020850193909352838301919091526060830152519081900360800190f35b3480156109b757600080fd5b506104bd612417565b3480156109cc57600080fd5b506108bb600480360360208110156109e357600080fd5b5035612743565b3480156109f657600080fd5b5061049460048036036040811015610a0d57600080fd5b506001600160a01b038135169060200135612750565b348015610a2f57600080fd5b5061049460048036036060811015610a4657600080fd5b506001600160a01b03813581169160208101359091169060400135612999565b348015610a7257600080fd5b5061049460048036036040811015610a8957600080fd5b506001600160a01b038135169060200135612a08565b348015610aab57600080fd5b506104bd612c4f565b348015610ac057600080fd5b5061042f612c55565b348015610ad557600080fd5b5061042f6004803603610160811015610aed57600080fd5b6001600160a01b03823516916020810135916040820135916060810135916080820135919081019060c0810160a0820135640100000000811115610b3057600080fd5b820183602082011115610b4257600080fd5b80359060200191846020830284011164010000000083111715610b6457600080fd5b919390929091602081019035640100000000811115610b8257600080fd5b820183602082011115610b9457600080fd5b80359060200191846020830284011164010000000083111715610bb657600080fd5b919390928235926020810135929190606081019060400135640100000000811115610be057600080fd5b820183602082011115610bf257600080fd5b80359060200191846020830284011164010000000083111715610c1457600080fd5b919390929091602081019035640100000000811115610c3257600080fd5b820183602082011115610c4457600080fd5b80359060200191846020830284011164010000000083111715610c6657600080fd5b509092509050612d10565b348015610c7d57600080fd5b506104bd612f23565b348015610c9257600080fd5b506104bd612f85565b348015610ca757600080fd5b506104bd612f8b565b348015610cbc57600080fd5b506108bb612fac565b348015610cd157600080fd5b5061049460048036036020811015610ce857600080fd5b50356001600160a01b0316612fbb565b348015610d0457600080fd5b506104bd612fd0565b348015610d1957600080fd5b50610685612fd6565b348015610d2e57600080fd5b506104bd61302d565b348015610d4357600080fd5b506104bd613033565b348015610d5857600080fd5b5061042f60048036036020811015610d6f57600080fd5b50356001600160a01b0316613054565b348015610d8b57600080fd5b506104bd613163565b348015610da057600080fd5b506108bb61317d565b348015610db557600080fd5b5061049461318c565b348015610dca57600080fd5b506104bd60048036036020811015610de157600080fd5b50356001600160a01b03166131b0565b348015610dfd57600080fd5b5061049460048036036020811015610e1457600080fd5b50356001600160a01b03166131c2565b348015610e3057600080fd5b5061049460048036036020811015610e4757600080fd5b50356001600160a01b0316613377565b348015610e6357600080fd5b5061068561338c565b348015610e7857600080fd5b5061042f60048036036020811015610e8f57600080fd5b50356133ec565b348015610ea257600080fd5b506104bd60048036036020811015610eb957600080fd5b50356001600160a01b03166134d5565b348015610ed557600080fd5b5061042f60048036036020811015610eec57600080fd5b50356001600160a01b0316613504565b348015610f0857600080fd5b5061068561361a565b348015610f1d57600080fd5b5061042f60048036036020811015610f3457600080fd5b503561367a565b348015610f4757600080fd5b5061042f60048036036040811015610f5e57600080fd5b506001600160a01b03813516906020013561370e565b348015610f8057600080fd5b5061042f60048036036040811015610f9757600080fd5b810190602081018135640100000000811115610fb257600080fd5b820183602082011115610fc457600080fd5b80359060200191846020830284011164010000000083111715610fe657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561103657600080fd5b82018360208201111561104857600080fd5b8035906020019184602083028401116401000000008311171561106a57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061396b945050505050565b3480156110b457600080fd5b50610494600480360360208110156110cb57600080fd5b50356001600160a01b0316613d6f565b3480156110e757600080fd5b50610494600480360360208110156110fe57600080fd5b50356001600160a01b0316613d84565b34801561111a57600080fd5b506104bd613ef6565b34801561112f57600080fd5b506104bd613f22565b34801561114457600080fd5b50610685613f28565b34801561115957600080fd5b5061042f6004803603602081101561117057600080fd5b5035613fc4565b34801561118357600080fd5b5061042f6004803603602081101561119a57600080fd5b50356001600160a01b03166140a7565b3480156111b657600080fd5b5061042f600480360360408110156111cd57600080fd5b50803590602001356141a7565b3480156111e657600080fd5b506104bd600480360360208110156111fd57600080fd5b5035614269565b34801561121057600080fd5b5061042f6004803603602081101561122757600080fd5b50356001600160a01b031661427b565b34801561124357600080fd5b506104946004803603602081101561125a57600080fd5b50356001600160a01b031661442b565b34801561127657600080fd5b5061042f6004803603602081101561128d57600080fd5b50356001600160a01b0316614449565b3480156112a957600080fd5b506108bb600480360360208110156112c057600080fd5b50356144ae565b3480156112d357600080fd5b506104bd6144bb565b6112e461318c565b611335576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61133e816144c1565b5160105561136961134d6144db565b604080516020810190915260105481529063ffffffff6144ff16565b6113a45760405162461bcd60e51b81526004018080602001828103825260268152602001806155eb6026913960400191505060405180910390fd5b6040805182815290517fb08f0607338ad77f5b08ccf831e533cefcc2d373c173e87a8f61144f1d82be1e9181900360200190a150565b3360008181526014602052604081205490919060ff16806114d25750600154604080517f45786368616e676500000000000000000000000000000000000000000000000060208083019190915282518083036008018152602883018085528151918301919091207fdcf0aaed00000000000000000000000000000000000000000000000000000000909152602c83015291516001600160a01b0380861694169263dcf0aaed92604c8082019391829003018186803b15801561149b57600080fd5b505afa1580156114af573d6000803e3d6000fd5b505050506040513d60208110156114c557600080fd5b50516001600160a01b0316145b611523576040805162461bcd60e51b815260206004820152601c60248201527f41646472657373206e6f7420616c6c6f77656420746f207370656e6400000000604482015290519081900360640190fd5b61152d8484614507565b949350505050565b60115481565b3360009081526009602052604081205460ff166115895760405162461bcd60e51b815260040180806020018281038252602c815260200180615703602c913960400191505060405180910390fd5b6001600160a01b0383166000908152600a602052604090205460ff166115e05760405162461bcd60e51b815260040180806020018281038252602a8152602001806156d9602a913960400191505060405180910390fd5b60006115eb856134d5565b116116275760405162461bcd60e51b81526004018080602001828103825260408152602001806156456040913960400191505060405180910390fd5b6001600160a01b038416600090815260176020526040902054620151804204908111156116d9576000611659866121d7565b6001600160a01b038716600090815260176020526040902083905590506116be6116b9611685836145c7565b6001600160a01b0389166000908152601660209081526040918290208251918201909252905481529063ffffffff61463516565b6149a7565b6001600160a01b0387166000908152601a6020526040902055505b6001600160a01b0385166000908152601a602052604090205483811015611747576040805162461bcd60e51b815260206004820152601860248201527f457863656564696e67207370656e64696e67206c696d69740000000000000000604482015290519081900360640190fd5b611757818563ffffffff6149b816565b6001600160a01b0387166000908152601a602052604090205561177b8686866149fa565b9695505050505050565b600c818154811061179257fe5b600091825260209091200154905081565b6117ab61318c565b6117fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b805182511461183c5760405162461bcd60e51b815260040180806020018281038252603e81526020018061541a603e913960400191505060405180910390fd5b60005b8251811015611a245760006001600160a01b031683828151811061185f57fe5b60200260200101516001600160a01b031614158015611892575081818151811061188557fe5b6020026020010151600014155b15611a1c576118b38382815181106118a657fe5b602002602001015161442b565b6118ee5760405162461bcd60e51b81526004018080602001828103825260378152602001806154586037913960400191505060405180910390fd5b6119216118f96144db565b61191584848151811061190857fe5b60200260200101516144c1565b9063ffffffff6144ff16565b61195c5760405162461bcd60e51b81526004018080602001828103825260268152602001806155eb6026913960400191505060405180910390fd5b61196b82828151811061190857fe5b6016600085848151811061197b57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001559050507f15ff5079dfbf448e4bb45ac83498c2ecb0833ad35916946bb683ccb49f8013a38382815181106119dd57fe5b60200260200101518383815181106119f157fe5b602090810291909101810151604080516001600160a01b039094168452918301528051918290030190a15b60010161183f565b505050565b60606015805480602002602001604051908101604052809291908181526020018280548015611a8157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611a63575b505050505090505b90565b6000611a9661318c565b611ae7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038316600090815260036020526040902054839060ff16611b56576040805162461bcd60e51b815260206004820152601f60248201527f746f6b656e206164647220776173206e65766572207265676973746572656400604482015290519081900360640190fd5b60045483108015611b905750836001600160a01b031660048481548110611b7957fe5b6000918252602090912001546001600160a01b0316145b611bcb5760405162461bcd60e51b815260040180806020018281038252602a815260200180615685602a913960400191505060405180910390fd5b6001600160a01b0384166000908152600360205260408120805460ff1916905560048054611c0090600163ffffffff6149b816565b81548110611c0a57fe5b600091825260209091200154600480546001600160a01b039092169250829186908110611c3357fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055600454611c829060016149b8565b611c8d60048261533e565b506040805185815290516001600160a01b038716917fbe9bb4bdca0a094babd75e3a98b1d2e2390633430d0a2f6e2b9970e2ee03fb2e919081900360200190a2506001949350505050565b60005474010000000000000000000000000000000000000000900460ff1681565b600280546001019081905560065460055460009283929091611d4290429070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166149b8565b1115611db757611d58611d53614ab1565b614b14565b60058054426fffffffffffffffffffffffffffffffff908116700100000000000000000000000000000000029381167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090921691909117169190911790555b6005546fffffffffffffffffffffffffffffffff16611dd7611d536144db565b925092506002548114611e31576040805162461bcd60e51b815260206004820152600e60248201527f7265656e7472616e742063616c6c000000000000000000000000000000000000604482015290519081900360640190fd5b509091565b60036020526000908152604090205460ff1681565b3360009081526009602052604081205460ff16611e995760405162461bcd60e51b815260040180806020018281038252602c815260200180615703602c913960400191505060405180910390fd5b6001600160a01b0383166000908152600a602052604090205460ff16611ef05760405162461bcd60e51b815260040180806020018281038252602a8152602001806156d9602a913960400191505060405180910390fd5b600e5462015180420490811115611f42576000611f0b613033565b600e8390559050611f3d6116b9611f21836145c7565b604080516020810190915260105481529063ffffffff61463516565b600f55505b82600f541015611f99576040805162461bcd60e51b815260206004820152601860248201527f457863656564696e67207370656e64696e67206c696d69740000000000000000604482015290519081900360640190fd5b600f54611fac908463ffffffff6149b816565b600f5561152d8484614507565b92915050565b6000611fc961318c565b61201a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166000908152600a602052604090205460ff1615612088576040805162461bcd60e51b815260206004820152601a60248201527f72657365727665206164647220616c7265616479206164646564000000000000604482015290519081900360640190fd5b6001600160a01b0382166000818152600a6020526040808220805460ff19166001908117909155600b8054918201815583527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517fd78793225285ecf9cf5f0f84b1cdc335c2cb4d6810ff0b9fd156ad6026c89cea9190a2506001919050565b6005546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b60125460009062015180420490829061218190839063ffffffff6149b816565b9050601354811061219757600092505050611a89565b6121d06121c16013546121b584601154614b1890919063ffffffff16565b9063ffffffff614b7116565b6011549063ffffffff6149b816565b9250505090565b60006121e28261442b565b61221d5760405162461bcd60e51b815260040180806020018281038252602b81526020018061572f602b913960400191505060405180910390fd5b6000805b600b548110156122f3576122e9846001600160a01b03166370a08231600b848154811061224a57fe5b60009182526020918290200154604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0390921660048301525160248083019392829003018186803b1580156122b057600080fd5b505afa1580156122c4573d6000803e3d6000fd5b505050506040513d60208110156122da57600080fd5b5051839063ffffffff614bb316565b9150600101612221565b50604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051612391916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561235857600080fd5b505afa15801561236c573d6000803e3d6000fd5b505050506040513d602081101561238257600080fd5b5051829063ffffffff614bb316565b9392505050565b600f5481565b600b81815481106123ab57fe5b6000918252602090912001546001600160a01b0316905081565b60146020526000908152604090205460ff1681565b6001600160a01b031660009081526003602052604090205460ff1690565b60176020526000908152604090205481565b6002600160008090919293565b600154604080517f536f727465644f7261636c6573000000000000000000000000000000000000006020808301919091528251808303600d018152602d83018085528151918301919091207fdcf0aaed000000000000000000000000000000000000000000000000000000009091526031830152915160009384936001600160a01b039091169263dcf0aaed9260518083019392829003018186803b1580156124bf57600080fd5b505afa1580156124d3573d6000803e3d6000fd5b505050506040513d60208110156124e957600080fd5b505190508060006124f8613033565b90506000612504615362565b7f63474c4400000000000000000000000000000000000000000000000000000000600052600d6020527f486533e5ef5711c6fceba0b8e8d907d58b0d418a02599d00d65a64e01c112d7754612558906144c1565b905060005b60045481101561271057600080866001600160a01b031663ef90e1b06004858154811061258657fe5b600091825260209091200154604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301528051602480840193829003018186803b1580156125eb57600080fd5b505afa1580156125ff573d6000803e3d6000fd5b505050506040513d604081101561261557600080fd5b508051602090910151909250905080156126f55760006004848154811061263857fe5b60009182526020918290200154604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216926318160ddd92600480840193829003018186803b15801561269a57600080fd5b505afa1580156126ae573d6000803e3d6000fd5b505050506040513d60208110156126c457600080fd5b5051905060006126de846121b5848663ffffffff614b1816565b90506126f0878263ffffffff614bb316565b965050505b50612709905081600163ffffffff614bb316565b905061255d565b50612739611d53612720846145c7565b61272d8461272d886145c7565b9063ffffffff614c0d16565b9550505050505090565b601581815481106123ab57fe5b600061275a61318c565b6127ab576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0383166000908152600a602052604090205460ff16612818576040805162461bcd60e51b815260206004820152601c60248201527f72657365727665206164647220776173206e6576657220616464656400000000604482015290519081900360640190fd5b600b54821080156128525750826001600160a01b0316600b838154811061283b57fe5b6000918252602090912001546001600160a01b0316145b61288d5760405162461bcd60e51b815260040180806020018281038252602d815260200180615586602d913960400191505060405180910390fd5b6001600160a01b0383166000908152600a60205260408120805460ff19169055600b80546128c290600163ffffffff6149b816565b815481106128cc57fe5b600091825260209091200154600b80546001600160a01b0390921692508291859081106128f557fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055600b546129449060016149b8565b61294f600b8261533e565b506040805184815290516001600160a01b038616917f89b4ee5cecfdfb246ede373c10283b5038afe56a531fc1d2f3ed8c5507a52fcb919081900360200190a25060019392505050565b3360009081526014602052604081205460ff166129fd576040805162461bcd60e51b815260206004820152601c60248201527f41646472657373206e6f7420616c6c6f77656420746f207370656e6400000000604482015290519081900360640190fd5b61152d8484846149fa565b6000612a1261318c565b612a63576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b612a6c8361442b565b612aa75760405162461bcd60e51b815260040180806020018281038252602b81526020018061572f602b913960400191505060405180910390fd5b60185482108015612ae15750826001600160a01b031660188381548110612aca57fe5b6000918252602090912001546001600160a01b0316145b612b1c5760405162461bcd60e51b81526004018080602001828103825260348152602001806156116034913960400191505060405180910390fd5b60188054612b3190600163ffffffff6149b816565b81548110612b3b57fe5b600091825260209091200154601880546001600160a01b039092169184908110612b6157fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506018805480612b9a57fe5b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559092019092556001600160a01b03851680835260198252604092839020805460ff19169055825190815291517f4336391ada1af9dcb966fed43ebafa4404719b6d8e42c765ab28e3abc9a24e7a9281900390910190a150600192915050565b60135481565b612c5d61318c565b612cae576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005474010000000000000000000000000000000000000000900460ff1615612d80576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420616c726561647920696e697469616c697a656400000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055612dc833614cf1565b612dd18f613504565b612dda8e6133ec565b612de38d6112dc565b612ded8c8c6141a7565b612e5a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525061396b92505050565b612e6386613fc4565b612e6c8561367a565b60005b83811015612ea457612e9b858583818110612e8657fe5b905060200201356001600160a01b03166131c2565b50600101612e6f565b50612f12848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208088028281018201909352878252909350879250869182918501908490808284376000920191909152506117a392505050565b505050505050505050505050505050565b600080805b600b54811015612f7f57612f65600b8281548110612f4257fe5b60009182526020909120015483906001600160a01b03163163ffffffff614bb316565b9150612f7881600163ffffffff614bb316565b9050612f28565b50905090565b60085481565b60408051602081019091526010548152600090612fa790614b14565b905090565b6001546001600160a01b031681565b600a6020526000908152604090205460ff1681565b60125481565b6060600c805480602002602001604051908101604052809291908181526020018280548015611a8157602002820191906000526020600020905b815481526020019060010190808311613010575050505050905090565b60075481565b6000612fa7613040612f23565b613048613ef6565b9063ffffffff614bb316565b61305c61318c565b6130ad576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811660009081526009602052604090205460ff1661311a576040805162461bcd60e51b815260206004820152601960248201527f5370656e646572206861736e2774206265656e20616464656400000000000000604482015290519081900360640190fd5b6001600160a01b038116600081815260096020526040808220805460ff19169055517fab8cff50266d80b9c9d9703af934ca455b9218286bf4fcaa05653a564c499e4b9190a250565b6000612fa7613170612f23565b479063ffffffff614bb316565b6000546001600160a01b031690565b600080546001600160a01b03166131a1614da9565b6001600160a01b031614905090565b601a6020526000908152604090205481565b60006131cc61318c565b61321d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6132268261442b565b156132625760405162461bcd60e51b81526004018080602001828103825260388152602001806155b36038913960400191505060405180910390fd5b6001600160a01b0382166132bd576040805162461bcd60e51b815260206004820152601760248201527f63616e27742062652061207a65726f2061646472657373000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166000818152601960209081526040808320805460ff191660019081179091556018805491820181559093527fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e90920180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055815192835290517f0c7515883121475b5d9289febf21a9de4ad53f18349a856d90c7acd6e099600b9281900390910190a1506001919050565b60096020526000908152604090205460ff1681565b6060600b805480602002602001604051908101604052809291908181526020018280548015611a81576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611a63575050505050905090565b6133f461318c565b613445576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161349a576040805162461bcd60e51b815260206004820152600e60248201527f76616c756520776173207a65726f000000000000000000000000000000000000604482015290519081900360640190fd5b60068190556040805182815290517f7bfe94ca3147f135fcd6d94ebf61d33fa34fbe904f933ccae66911b9548544f29181900360200190a150565b6001600160a01b03811660009081526016602090815260408083208151928301909152548152611fb990614b14565b61350c61318c565b61355d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166135b8576040805162461bcd60e51b815260206004820181905260248201527f43616e6e6f7420726567697374657220746865206e756c6c2061646472657373604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b90600090a250565b60606004805480602002602001604051908101604052809291908181526020018280548015611a81576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611a63575050505050905090565b61368261318c565b6136d3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60088190556040805182815290517f4da8e8b2223fbbb897200fb9dfb6b986c1b4188621114d407ee8ec363569fc379181900360200190a150565b61371661318c565b613767576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166000908152601460205260409020805460ff191690556015548082106137de576040805162461bcd60e51b815260206004820152601060248201527f496e64657820697320696e76616c696400000000000000000000000000000000604482015290519081900360640190fd5b601582815481106137eb57fe5b6000918252602090912001546001600160a01b03848116911614613856576040805162461bcd60e51b815260206004820152601c60248201527f496e64657820646f6573206e6f74206d61746368207370656e64657200000000604482015290519081900360640190fd5b600061386982600163ffffffff6149b816565b90508083146138d4576015818154811061387f57fe5b600091825260209091200154601580546001600160a01b0390921691859081106138a557fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b6000601582815481106138e357fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790558061393060158261533e565b506040516001600160a01b038516907f20aaa18caa668680a42b328a15fd50d580bac65d8bd346e104355473c6373ff390600090a250505050565b61397361318c565b6139c4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8051825114613a1a576040805162461bcd60e51b815260206004820152601560248201527f4172726179206c656e677468206d69736d617463680000000000000000000000604482015290519081900360640190fd5b613a22615362565b613a2c60006144c1565b905060005b8251811015613a7357613a59613a4c84838151811061190857fe5b839063ffffffff614dad16565b9150613a6c81600163ffffffff614bb316565b9050613a31565b50613a8c613a7f6144db565b829063ffffffff614e2616565b613ac75760405162461bcd60e51b81526004018080602001828103825260218152602001806155446021913960400191505060405180910390fd5b60005b600c54811015613b1d57600d6000600c8381548110613ae557fe5b9060005260206000200154815260200190815260200160002060009055613b16600182614bb390919063ffffffff16565b9050613aca565b508251613b3190600c906020860190615375565b5060005b8351811015613c1257600d6000858381518110613b4e57fe5b6020026020010151815260200190815260200160002054600014613bb9576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f742073657420776569676874207477696365000000000000000000604482015290519081900360640190fd5b828181518110613bc557fe5b6020026020010151600d6000868481518110613bdd57fe5b6020026020010151815260200190815260200160002081905550613c0b600182614bb390919063ffffffff16565b9050613b35565b507f63474c4400000000000000000000000000000000000000000000000000000000600052600d6020527f486533e5ef5711c6fceba0b8e8d907d58b0d418a02599d00d65a64e01c112d7754613caf576040805162461bcd60e51b815260206004820152601a60248201527f4d757374207365742063474c4420617373657420776569676874000000000000604482015290519081900360640190fd5b7f55b488abd19ae7621712324d3d42c2ef7a9575f64f5503103286a1161fb408558383604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015613d16578181015183820152602001613cfe565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015613d55578181015183820152602001613d3d565b5050505090500194505050505060405180910390a1505050565b60196020526000908152604090205460ff1681565b6000613d8e61318c565b613ddf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03821660009081526003602052604090205460ff1615613e4d576040805162461bcd60e51b815260206004820152601d60248201527f746f6b656e206164647220616c72656164792072656769737465726564000000604482015290519081900360640190fd5b6001600160a01b038216600081815260036020526040808220805460ff1916600190811790915560048054918201815583527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49190a2506001919050565b60004781613f02612161565b9050808211613f125760006121d0565b6121d0828263ffffffff6149b816565b60065481565b606080600c80549050604051908082528060200260200182016040528015613f5a578160200160208202803883390190505b50905060005b600c54811015612f7f57600d6000600c8381548110613f7b57fe5b9060005260206000200154815260200190815260200160002054828281518110613fa157fe5b6020908102919091010152613fbd81600163ffffffff614bb316565b9050613f60565b613fcc61318c565b61401d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6140316140286144db565b611915836144c1565b61406c5760405162461bcd60e51b81526004018080602001828103825260218152602001806153f96021913960400191505060405180910390fd5b60078190556040805182815290517ffe69856ffb1b1d6cb00c1d8151726e6e95032b1666282eeb293ecadd58b29a6e9181900360200190a150565b6140af61318c565b614100576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661415b576040805162461bcd60e51b815260206004820152601560248201527f5370656e6465722063616e2774206265206e756c6c0000000000000000000000604482015290519081900360640190fd5b6001600160a01b038116600081815260096020526040808220805460ff19166001179055517f3139419c41cdd7abca84fa19dd21118cd285d3e2ce1a9444e8161ce9fa62fdcd9190a250565b6141af61318c565b614200576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b47821115614255576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f7420667265657a65206d6f7265207468616e2062616c616e636500604482015290519081900360640190fd5b601182905562015180420460125560135550565b600d6020526000908152604090205481565b61428361318c565b6142d4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661432f576040805162461bcd60e51b815260206004820152601560248201527f5370656e6465722063616e2774206265206e756c6c0000000000000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526014602052604090205460ff16156143875760405162461bcd60e51b81526004018080602001828103825260238152602001806154eb6023913960400191505060405180910390fd5b6001600160a01b038116600081815260146020526040808220805460ff1916600190811790915560158054918201815583527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4750180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517f71bccdb89fff4d914e3d2e472b327e3debaf4c4d6f1dfe528f430447e4cbcf5f9190a250565b6001600160a01b031660009081526019602052604090205460ff1690565b61445161318c565b6144a2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6144ab81614cf1565b50565b601881815481106123ab57fe5b600e5481565b6144c9615362565b50604080516020810190915290815290565b6144e3615362565b50604080516020810190915269d3c21bcecceda1000000815290565b519051111590565b6000614511613ef6565b821115614565576040805162461bcd60e51b815260206004820152601b60248201527f457863656564696e6720756e66726f7a656e2072657365727665730000000000604482015290519081900360640190fd5b61457e6001600160a01b0384168363ffffffff614e2d16565b6040805183815290516001600160a01b0385169133917f4dd1abe16ad3d4f829372dc77766ca2cce34e205af9b10f8cc1fab370425864f9181900360200190a350600192915050565b6145cf615362565b6145d7614f12565b8211156146155760405162461bcd60e51b815260040180806020018281038252603681526020018061550e6036913960400191505060405180910390fd5b50604080516020810190915269d3c21bcecceda100000082028152919050565b61463d615362565b8251158061464a57508151155b156146645750604080516020810190915260008152611fb9565b815169d3c21bcecceda1000000141561467e575081611fb9565b825169d3c21bcecceda10000001415614698575080611fb9565b600069d3c21bcecceda10000006146ae85614f2d565b51816146b657fe5b04905060006146c485614f62565b519050600069d3c21bcecceda10000006146dd86614f2d565b51816146e557fe5b04905060006146f386614f62565b519050838202841561475c578285828161470957fe5b041461475c576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207831793120646574656374656400000000000000000000604482015290519081900360640190fd5b69d3c21bcecceda1000000810281156147d65769d3c21bcecceda100000082828161478357fe5b04146147d6576040805162461bcd60e51b815260206004820152601f60248201527f6f766572666c6f772078317931202a2066697865643120646574656374656400604482015290519081900360640190fd5b905080848402851561483f57848682816147ec57fe5b041461483f576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207832793120646574656374656400000000000000000000604482015290519081900360640190fd5b86840287156148a5578488828161485257fe5b04146148a5576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207831793220646574656374656400000000000000000000604482015290519081900360640190fd5b6148ad614f9c565b87816148b557fe5b0496506148c0614f9c565b85816148c857fe5b049450868502871561493157858882816148de57fe5b0414614931576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207832793220646574656374656400000000000000000000604482015290519081900360640190fd5b614939615362565b604051806020016040528087815250905061496281604051806020016040528087815250614dad565b905061497c81604051806020016040528086815250614dad565b905061499681604051806020016040528085815250614dad565b9d9c50505050505050505050505050565b5169d3c21bcecceda1000000900490565b600061239183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614fa5565b6000614a05846121d7565b821115614a435760405162461bcd60e51b815260040180806020018281038252602281526020018061548f6022913960400191505060405180910390fd5b614a5d6001600160a01b038516848463ffffffff61503c16565b604080518381526001600160a01b03868116602083015282519086169233927fc171b15fb47a5beb3e11b1951d4518544f699edd6acd893d8695c91703922b60929081900390910190a35060019392505050565b614ab9615362565b614ac1615362565b614ad1614acc612417565b6144c1565b9050614aee614ae16008546144c1565b829063ffffffff6150bc16565b15614b0557614afd60006144c1565b915050611a89565b614afd6007546144c1565b5090565b5190565b600082614b2757506000611fb9565b82820282848281614b3457fe5b04146123915760405162461bcd60e51b81526004018080602001828103825260218152602001806155656021913960400191505060405180910390fd5b600061239183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506150c4565b600082820183811015612391576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b614c15615362565b8151614c68576040805162461bcd60e51b815260206004820152601160248201527f63616e2774206469766964652062792030000000000000000000000000000000604482015290519081900360640190fd5b825169d3c21bcecceda10000008181029190820414614cce576040805162461bcd60e51b815260206004820152601260248201527f6f766572666c6f77206174206469766964650000000000000000000000000000604482015290519081900360640190fd5b604051806020016040528084600001518381614ce657fe5b049052949350505050565b6001600160a01b038116614d365760405162461bcd60e51b81526004018080602001828103825260268152602001806153d36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b3390565b614db5615362565b8151835190810190811015614e11576040805162461bcd60e51b815260206004820152601560248201527f616464206f766572666c6f772064657465637465640000000000000000000000604482015290519081900360640190fd5b60408051602081019091529081529392505050565b5190511490565b80471015614e82576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114614ecd576040519150601f19603f3d011682016040523d82523d6000602084013e614ed2565b606091505b5050905080611a245760405162461bcd60e51b815260040180806020018281038252603a8152602001806154b1603a913960400191505060405180910390fd5b7601357c299a88ea76a58924d52ce4f26a85af186c2b9e7490565b614f35615362565b604051806020016040528069d3c21bcecceda100000080856000015181614f5857fe5b0402905292915050565b614f6a615362565b604051806020016040528069d3c21bcecceda100000080856000015181614f8d57fe5b95519504029093039092525090565b64e8d4a5100090565b600081848411156150345760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614ff9578181015183820152602001614fe1565b50505050905090810190601f1680156150265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611a24908490615129565b519051101590565b600081836151135760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614ff9578181015183820152602001614fe1565b50600083858161511f57fe5b0495945050505050565b61513b826001600160a01b0316615305565b61518c576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106151e857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016151ab565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461524a576040519150601f19603f3d011682016040523d82523d6000602084013e61524f565b606091505b5091509150816152a6576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156152ff578080602001905160208110156152c257600080fd5b50516152ff5760405162461bcd60e51b815260040180806020018281038252602a8152602001806156af602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061152d575050151592915050565b815481835581811115611a2457600083815260209020611a249181019083016153b8565b6040518060200160405280600081525090565b8280548282559060005260206000209081019282156153b0579160200282015b828111156153b0578251825591602001919060010190615395565b50614b109291505b611a8991905b80821115614b1057600081556001016153be56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f62696e207461782063616e6e6f74206265206c6172676572207468616e2031746f6b656e2061646472657373657320616e64207370656e64696e6720726174696f206c656e67746873206861766520746f206265207468652073616d65746865206164647265737320737065636966696564206973206e6f742061207265736572766520636f6c6c61746572616c206173736574457863656564696e672074686520616d6f756e74207265736572766520686f6c6473416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d617920686176652072657665727465644164647265737320697320616c72656164792045786368616e6765205370656e64657263616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282953756d206f6620617373657420616c6c6f636174696f6e206d7573742062652031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77696e64657820696e746f2072657365727665206c697374206e6f74206d617070656420746f2061646472657373737065636966696564206164647265737320697320616c7265616479206164646564206173206120636f6c6c61746572616c2061737365747370656e64696e6720726174696f2063616e6e6f74206265206c6172676572207468616e2031696e64657820696e746f20636f6c6c61746572616c417373657473206c697374206e6f74206d617070656420746f20746f6b656e7468697320617373657420686173206e6f207370656e64696e6720726174696f2c207468657265666f72652063616e2774206265207472616e73666572726564696e64657820696e746f20746f6b656e73206c697374206e6f74206d617070656420746f20746f6b656e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656463616e206f6e6c79207472616e7366657220746f206f746865722072657365727665206164647265737373656e646572206e6f7420616c6c6f77656420746f207472616e7366657220526573657276652066756e64737370656369666965642061646472657373206973206e6f74206120636f6c6c61746572616c206173736574a265627a7a72315820f41c84f60e3a2b532c8ead0ef1d59b8524e596c06c203056784abfa77c40bf6464736f6c634300051100320000000000000000000000000000000000000000000000000000000000000000

Deployed ByteCode

0x60806040526004361061042f5760003560e01c80637b52207511610228578063ad62ad1011610128578063e6b76e9c116100bb578063f0b7182b1161008a578063f2fde38b1161006f578063f2fde38b1461126a578063f7165fee1461129d578063fa9ed95a146112c75761042f565b8063f0b7182b14611204578063f240dae3146112375761042f565b8063e6b76e9c1461114d578063e7e31e7a14611177578063e83b373b146111aa578063ec4f797b146111da5761042f565b8063d48bfca7116100f7578063d48bfca7146110db578063e30f579d1461110e578063e33a88e714611123578063e50a6c1e146111385761042f565b8063ad62ad1014610f11578063b003dcf114610f3b578063ca56d33b14610f74578063cae182fe146110a85761042f565b80638f32d59b116101bb5780639c3e2f0f1161018a578063a8b94b8d1161016f578063a8b94b8d14610e96578063a91ee0dc14610ec9578063aa6ca80814610efc5761042f565b80639c3e2f0f14610e57578063a1ab55b314610e6c5761042f565b80638f32d59b14610da9578063919a1fbe14610dbe578063965366f314610df15780639a206ece14610e245761042f565b80638b7df8d4116101f75780638b7df8d414610d375780638ce5877c14610d4c5780638d9a5e6f14610d7f5780638da5cb5b14610d945761042f565b80637b52207514610cc557806381b861a614610cf85780638438796a14610d0d578063894098d614610d225761042f565b806340899365116103335780636be383fc116102c657806372a6b8b01161029557806376769a601161027a57806376769a6014610c865780637897a78e14610c9b5780637b10399914610cb05761042f565b806372a6b8b014610ac9578063765c1fe914610c715761042f565b80636be383fc14610a2357806370022cb414610a665780637090db4e14610a9f578063715018a614610ab45761042f565b806354255be01161030257806354255be01461097057806356b6d0d5146109ab5780635a18b08b146109c05780635c4a3145146109ea5761042f565b806340899365146108915780634cea8ded146108d75780634f8e6e231461090a57806350614ba01461093d5761042f565b8063158ef93e116103c657806322015968116103955780632aa1c16d1161037a5780632aa1c16d1461083457806338345dec1461084957806339d7f76e1461087c5761042f565b806322015968146107bd57806322796e83146107f05761042f565b8063158ef93e1461070e57806317f9a6f71461072357806319f37361146107515780631c39c7d5146107845761042f565b80630db279be116104025780630db279be1461051257806311bb0dcd1461053c5780631218f9821461067057806313baf1e6146106d55761042f565b806301da32bd1461043157806303a0fea31461045b57806303d835f3146104a8578063042b7a54146104cf575b005b34801561043d57600080fd5b5061042f6004803603602081101561045457600080fd5b50356112dc565b34801561046757600080fd5b506104946004803603604081101561047e57600080fd5b506001600160a01b0381351690602001356113da565b604080519115158252519081900360200190f35b3480156104b457600080fd5b506104bd611535565b60408051918252519081900360200190f35b3480156104db57600080fd5b50610494600480360360608110156104f257600080fd5b506001600160a01b0381358116916020810135909116906040013561153b565b34801561051e57600080fd5b506104bd6004803603602081101561053557600080fd5b5035611785565b34801561054857600080fd5b5061042f6004803603604081101561055f57600080fd5b81019060208101813564010000000081111561057a57600080fd5b82018360208201111561058c57600080fd5b803590602001918460208302840111640100000000831117156105ae57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156105fe57600080fd5b82018360208201111561061057600080fd5b8035906020019184602083028401116401000000008311171561063257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506117a3945050505050565b34801561067c57600080fd5b50610685611a29565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106c15781810151838201526020016106a9565b505050509050019250505060405180910390f35b3480156106e157600080fd5b50610494600480360360408110156106f857600080fd5b506001600160a01b038135169060200135611a8c565b34801561071a57600080fd5b50610494611cd8565b34801561072f57600080fd5b50610738611cf9565b6040805192835260208301919091528051918290030190f35b34801561075d57600080fd5b506104946004803603602081101561077457600080fd5b50356001600160a01b0316611e36565b34801561079057600080fd5b50610494600480360360408110156107a757600080fd5b506001600160a01b038135169060200135611e4b565b3480156107c957600080fd5b50610494600480360360208110156107e057600080fd5b50356001600160a01b0316611fbf565b3480156107fc57600080fd5b50610805612131565b604080516fffffffffffffffffffffffffffffffff938416815291909216602082015281519081900390910190f35b34801561084057600080fd5b506104bd612161565b34801561085557600080fd5b506104bd6004803603602081101561086c57600080fd5b50356001600160a01b03166121d7565b34801561088857600080fd5b506104bd612398565b34801561089d57600080fd5b506108bb600480360360208110156108b457600080fd5b503561239e565b604080516001600160a01b039092168252519081900360200190f35b3480156108e357600080fd5b50610494600480360360208110156108fa57600080fd5b50356001600160a01b03166123c5565b34801561091657600080fd5b506104946004803603602081101561092d57600080fd5b50356001600160a01b03166123da565b34801561094957600080fd5b506104bd6004803603602081101561096057600080fd5b50356001600160a01b03166123f8565b34801561097c57600080fd5b5061098561240a565b604080519485526020850193909352838301919091526060830152519081900360800190f35b3480156109b757600080fd5b506104bd612417565b3480156109cc57600080fd5b506108bb600480360360208110156109e357600080fd5b5035612743565b3480156109f657600080fd5b5061049460048036036040811015610a0d57600080fd5b506001600160a01b038135169060200135612750565b348015610a2f57600080fd5b5061049460048036036060811015610a4657600080fd5b506001600160a01b03813581169160208101359091169060400135612999565b348015610a7257600080fd5b5061049460048036036040811015610a8957600080fd5b506001600160a01b038135169060200135612a08565b348015610aab57600080fd5b506104bd612c4f565b348015610ac057600080fd5b5061042f612c55565b348015610ad557600080fd5b5061042f6004803603610160811015610aed57600080fd5b6001600160a01b03823516916020810135916040820135916060810135916080820135919081019060c0810160a0820135640100000000811115610b3057600080fd5b820183602082011115610b4257600080fd5b80359060200191846020830284011164010000000083111715610b6457600080fd5b919390929091602081019035640100000000811115610b8257600080fd5b820183602082011115610b9457600080fd5b80359060200191846020830284011164010000000083111715610bb657600080fd5b919390928235926020810135929190606081019060400135640100000000811115610be057600080fd5b820183602082011115610bf257600080fd5b80359060200191846020830284011164010000000083111715610c1457600080fd5b919390929091602081019035640100000000811115610c3257600080fd5b820183602082011115610c4457600080fd5b80359060200191846020830284011164010000000083111715610c6657600080fd5b509092509050612d10565b348015610c7d57600080fd5b506104bd612f23565b348015610c9257600080fd5b506104bd612f85565b348015610ca757600080fd5b506104bd612f8b565b348015610cbc57600080fd5b506108bb612fac565b348015610cd157600080fd5b5061049460048036036020811015610ce857600080fd5b50356001600160a01b0316612fbb565b348015610d0457600080fd5b506104bd612fd0565b348015610d1957600080fd5b50610685612fd6565b348015610d2e57600080fd5b506104bd61302d565b348015610d4357600080fd5b506104bd613033565b348015610d5857600080fd5b5061042f60048036036020811015610d6f57600080fd5b50356001600160a01b0316613054565b348015610d8b57600080fd5b506104bd613163565b348015610da057600080fd5b506108bb61317d565b348015610db557600080fd5b5061049461318c565b348015610dca57600080fd5b506104bd60048036036020811015610de157600080fd5b50356001600160a01b03166131b0565b348015610dfd57600080fd5b5061049460048036036020811015610e1457600080fd5b50356001600160a01b03166131c2565b348015610e3057600080fd5b5061049460048036036020811015610e4757600080fd5b50356001600160a01b0316613377565b348015610e6357600080fd5b5061068561338c565b348015610e7857600080fd5b5061042f60048036036020811015610e8f57600080fd5b50356133ec565b348015610ea257600080fd5b506104bd60048036036020811015610eb957600080fd5b50356001600160a01b03166134d5565b348015610ed557600080fd5b5061042f60048036036020811015610eec57600080fd5b50356001600160a01b0316613504565b348015610f0857600080fd5b5061068561361a565b348015610f1d57600080fd5b5061042f60048036036020811015610f3457600080fd5b503561367a565b348015610f4757600080fd5b5061042f60048036036040811015610f5e57600080fd5b506001600160a01b03813516906020013561370e565b348015610f8057600080fd5b5061042f60048036036040811015610f9757600080fd5b810190602081018135640100000000811115610fb257600080fd5b820183602082011115610fc457600080fd5b80359060200191846020830284011164010000000083111715610fe657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561103657600080fd5b82018360208201111561104857600080fd5b8035906020019184602083028401116401000000008311171561106a57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061396b945050505050565b3480156110b457600080fd5b50610494600480360360208110156110cb57600080fd5b50356001600160a01b0316613d6f565b3480156110e757600080fd5b50610494600480360360208110156110fe57600080fd5b50356001600160a01b0316613d84565b34801561111a57600080fd5b506104bd613ef6565b34801561112f57600080fd5b506104bd613f22565b34801561114457600080fd5b50610685613f28565b34801561115957600080fd5b5061042f6004803603602081101561117057600080fd5b5035613fc4565b34801561118357600080fd5b5061042f6004803603602081101561119a57600080fd5b50356001600160a01b03166140a7565b3480156111b657600080fd5b5061042f600480360360408110156111cd57600080fd5b50803590602001356141a7565b3480156111e657600080fd5b506104bd600480360360208110156111fd57600080fd5b5035614269565b34801561121057600080fd5b5061042f6004803603602081101561122757600080fd5b50356001600160a01b031661427b565b34801561124357600080fd5b506104946004803603602081101561125a57600080fd5b50356001600160a01b031661442b565b34801561127657600080fd5b5061042f6004803603602081101561128d57600080fd5b50356001600160a01b0316614449565b3480156112a957600080fd5b506108bb600480360360208110156112c057600080fd5b50356144ae565b3480156112d357600080fd5b506104bd6144bb565b6112e461318c565b611335576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61133e816144c1565b5160105561136961134d6144db565b604080516020810190915260105481529063ffffffff6144ff16565b6113a45760405162461bcd60e51b81526004018080602001828103825260268152602001806155eb6026913960400191505060405180910390fd5b6040805182815290517fb08f0607338ad77f5b08ccf831e533cefcc2d373c173e87a8f61144f1d82be1e9181900360200190a150565b3360008181526014602052604081205490919060ff16806114d25750600154604080517f45786368616e676500000000000000000000000000000000000000000000000060208083019190915282518083036008018152602883018085528151918301919091207fdcf0aaed00000000000000000000000000000000000000000000000000000000909152602c83015291516001600160a01b0380861694169263dcf0aaed92604c8082019391829003018186803b15801561149b57600080fd5b505afa1580156114af573d6000803e3d6000fd5b505050506040513d60208110156114c557600080fd5b50516001600160a01b0316145b611523576040805162461bcd60e51b815260206004820152601c60248201527f41646472657373206e6f7420616c6c6f77656420746f207370656e6400000000604482015290519081900360640190fd5b61152d8484614507565b949350505050565b60115481565b3360009081526009602052604081205460ff166115895760405162461bcd60e51b815260040180806020018281038252602c815260200180615703602c913960400191505060405180910390fd5b6001600160a01b0383166000908152600a602052604090205460ff166115e05760405162461bcd60e51b815260040180806020018281038252602a8152602001806156d9602a913960400191505060405180910390fd5b60006115eb856134d5565b116116275760405162461bcd60e51b81526004018080602001828103825260408152602001806156456040913960400191505060405180910390fd5b6001600160a01b038416600090815260176020526040902054620151804204908111156116d9576000611659866121d7565b6001600160a01b038716600090815260176020526040902083905590506116be6116b9611685836145c7565b6001600160a01b0389166000908152601660209081526040918290208251918201909252905481529063ffffffff61463516565b6149a7565b6001600160a01b0387166000908152601a6020526040902055505b6001600160a01b0385166000908152601a602052604090205483811015611747576040805162461bcd60e51b815260206004820152601860248201527f457863656564696e67207370656e64696e67206c696d69740000000000000000604482015290519081900360640190fd5b611757818563ffffffff6149b816565b6001600160a01b0387166000908152601a602052604090205561177b8686866149fa565b9695505050505050565b600c818154811061179257fe5b600091825260209091200154905081565b6117ab61318c565b6117fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b805182511461183c5760405162461bcd60e51b815260040180806020018281038252603e81526020018061541a603e913960400191505060405180910390fd5b60005b8251811015611a245760006001600160a01b031683828151811061185f57fe5b60200260200101516001600160a01b031614158015611892575081818151811061188557fe5b6020026020010151600014155b15611a1c576118b38382815181106118a657fe5b602002602001015161442b565b6118ee5760405162461bcd60e51b81526004018080602001828103825260378152602001806154586037913960400191505060405180910390fd5b6119216118f96144db565b61191584848151811061190857fe5b60200260200101516144c1565b9063ffffffff6144ff16565b61195c5760405162461bcd60e51b81526004018080602001828103825260268152602001806155eb6026913960400191505060405180910390fd5b61196b82828151811061190857fe5b6016600085848151811061197b57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001559050507f15ff5079dfbf448e4bb45ac83498c2ecb0833ad35916946bb683ccb49f8013a38382815181106119dd57fe5b60200260200101518383815181106119f157fe5b602090810291909101810151604080516001600160a01b039094168452918301528051918290030190a15b60010161183f565b505050565b60606015805480602002602001604051908101604052809291908181526020018280548015611a8157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611a63575b505050505090505b90565b6000611a9661318c565b611ae7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038316600090815260036020526040902054839060ff16611b56576040805162461bcd60e51b815260206004820152601f60248201527f746f6b656e206164647220776173206e65766572207265676973746572656400604482015290519081900360640190fd5b60045483108015611b905750836001600160a01b031660048481548110611b7957fe5b6000918252602090912001546001600160a01b0316145b611bcb5760405162461bcd60e51b815260040180806020018281038252602a815260200180615685602a913960400191505060405180910390fd5b6001600160a01b0384166000908152600360205260408120805460ff1916905560048054611c0090600163ffffffff6149b816565b81548110611c0a57fe5b600091825260209091200154600480546001600160a01b039092169250829186908110611c3357fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055600454611c829060016149b8565b611c8d60048261533e565b506040805185815290516001600160a01b038716917fbe9bb4bdca0a094babd75e3a98b1d2e2390633430d0a2f6e2b9970e2ee03fb2e919081900360200190a2506001949350505050565b60005474010000000000000000000000000000000000000000900460ff1681565b600280546001019081905560065460055460009283929091611d4290429070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166149b8565b1115611db757611d58611d53614ab1565b614b14565b60058054426fffffffffffffffffffffffffffffffff908116700100000000000000000000000000000000029381167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090921691909117169190911790555b6005546fffffffffffffffffffffffffffffffff16611dd7611d536144db565b925092506002548114611e31576040805162461bcd60e51b815260206004820152600e60248201527f7265656e7472616e742063616c6c000000000000000000000000000000000000604482015290519081900360640190fd5b509091565b60036020526000908152604090205460ff1681565b3360009081526009602052604081205460ff16611e995760405162461bcd60e51b815260040180806020018281038252602c815260200180615703602c913960400191505060405180910390fd5b6001600160a01b0383166000908152600a602052604090205460ff16611ef05760405162461bcd60e51b815260040180806020018281038252602a8152602001806156d9602a913960400191505060405180910390fd5b600e5462015180420490811115611f42576000611f0b613033565b600e8390559050611f3d6116b9611f21836145c7565b604080516020810190915260105481529063ffffffff61463516565b600f55505b82600f541015611f99576040805162461bcd60e51b815260206004820152601860248201527f457863656564696e67207370656e64696e67206c696d69740000000000000000604482015290519081900360640190fd5b600f54611fac908463ffffffff6149b816565b600f5561152d8484614507565b92915050565b6000611fc961318c565b61201a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166000908152600a602052604090205460ff1615612088576040805162461bcd60e51b815260206004820152601a60248201527f72657365727665206164647220616c7265616479206164646564000000000000604482015290519081900360640190fd5b6001600160a01b0382166000818152600a6020526040808220805460ff19166001908117909155600b8054918201815583527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517fd78793225285ecf9cf5f0f84b1cdc335c2cb4d6810ff0b9fd156ad6026c89cea9190a2506001919050565b6005546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b60125460009062015180420490829061218190839063ffffffff6149b816565b9050601354811061219757600092505050611a89565b6121d06121c16013546121b584601154614b1890919063ffffffff16565b9063ffffffff614b7116565b6011549063ffffffff6149b816565b9250505090565b60006121e28261442b565b61221d5760405162461bcd60e51b815260040180806020018281038252602b81526020018061572f602b913960400191505060405180910390fd5b6000805b600b548110156122f3576122e9846001600160a01b03166370a08231600b848154811061224a57fe5b60009182526020918290200154604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0390921660048301525160248083019392829003018186803b1580156122b057600080fd5b505afa1580156122c4573d6000803e3d6000fd5b505050506040513d60208110156122da57600080fd5b5051839063ffffffff614bb316565b9150600101612221565b50604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051612391916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561235857600080fd5b505afa15801561236c573d6000803e3d6000fd5b505050506040513d602081101561238257600080fd5b5051829063ffffffff614bb316565b9392505050565b600f5481565b600b81815481106123ab57fe5b6000918252602090912001546001600160a01b0316905081565b60146020526000908152604090205460ff1681565b6001600160a01b031660009081526003602052604090205460ff1690565b60176020526000908152604090205481565b6002600160008090919293565b600154604080517f536f727465644f7261636c6573000000000000000000000000000000000000006020808301919091528251808303600d018152602d83018085528151918301919091207fdcf0aaed000000000000000000000000000000000000000000000000000000009091526031830152915160009384936001600160a01b039091169263dcf0aaed9260518083019392829003018186803b1580156124bf57600080fd5b505afa1580156124d3573d6000803e3d6000fd5b505050506040513d60208110156124e957600080fd5b505190508060006124f8613033565b90506000612504615362565b7f63474c4400000000000000000000000000000000000000000000000000000000600052600d6020527f486533e5ef5711c6fceba0b8e8d907d58b0d418a02599d00d65a64e01c112d7754612558906144c1565b905060005b60045481101561271057600080866001600160a01b031663ef90e1b06004858154811061258657fe5b600091825260209091200154604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301528051602480840193829003018186803b1580156125eb57600080fd5b505afa1580156125ff573d6000803e3d6000fd5b505050506040513d604081101561261557600080fd5b508051602090910151909250905080156126f55760006004848154811061263857fe5b60009182526020918290200154604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216926318160ddd92600480840193829003018186803b15801561269a57600080fd5b505afa1580156126ae573d6000803e3d6000fd5b505050506040513d60208110156126c457600080fd5b5051905060006126de846121b5848663ffffffff614b1816565b90506126f0878263ffffffff614bb316565b965050505b50612709905081600163ffffffff614bb316565b905061255d565b50612739611d53612720846145c7565b61272d8461272d886145c7565b9063ffffffff614c0d16565b9550505050505090565b601581815481106123ab57fe5b600061275a61318c565b6127ab576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0383166000908152600a602052604090205460ff16612818576040805162461bcd60e51b815260206004820152601c60248201527f72657365727665206164647220776173206e6576657220616464656400000000604482015290519081900360640190fd5b600b54821080156128525750826001600160a01b0316600b838154811061283b57fe5b6000918252602090912001546001600160a01b0316145b61288d5760405162461bcd60e51b815260040180806020018281038252602d815260200180615586602d913960400191505060405180910390fd5b6001600160a01b0383166000908152600a60205260408120805460ff19169055600b80546128c290600163ffffffff6149b816565b815481106128cc57fe5b600091825260209091200154600b80546001600160a01b0390921692508291859081106128f557fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055600b546129449060016149b8565b61294f600b8261533e565b506040805184815290516001600160a01b038616917f89b4ee5cecfdfb246ede373c10283b5038afe56a531fc1d2f3ed8c5507a52fcb919081900360200190a25060019392505050565b3360009081526014602052604081205460ff166129fd576040805162461bcd60e51b815260206004820152601c60248201527f41646472657373206e6f7420616c6c6f77656420746f207370656e6400000000604482015290519081900360640190fd5b61152d8484846149fa565b6000612a1261318c565b612a63576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b612a6c8361442b565b612aa75760405162461bcd60e51b815260040180806020018281038252602b81526020018061572f602b913960400191505060405180910390fd5b60185482108015612ae15750826001600160a01b031660188381548110612aca57fe5b6000918252602090912001546001600160a01b0316145b612b1c5760405162461bcd60e51b81526004018080602001828103825260348152602001806156116034913960400191505060405180910390fd5b60188054612b3190600163ffffffff6149b816565b81548110612b3b57fe5b600091825260209091200154601880546001600160a01b039092169184908110612b6157fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506018805480612b9a57fe5b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690559092019092556001600160a01b03851680835260198252604092839020805460ff19169055825190815291517f4336391ada1af9dcb966fed43ebafa4404719b6d8e42c765ab28e3abc9a24e7a9281900390910190a150600192915050565b60135481565b612c5d61318c565b612cae576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005474010000000000000000000000000000000000000000900460ff1615612d80576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420616c726561647920696e697469616c697a656400000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055612dc833614cf1565b612dd18f613504565b612dda8e6133ec565b612de38d6112dc565b612ded8c8c6141a7565b612e5a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525061396b92505050565b612e6386613fc4565b612e6c8561367a565b60005b83811015612ea457612e9b858583818110612e8657fe5b905060200201356001600160a01b03166131c2565b50600101612e6f565b50612f12848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208088028281018201909352878252909350879250869182918501908490808284376000920191909152506117a392505050565b505050505050505050505050505050565b600080805b600b54811015612f7f57612f65600b8281548110612f4257fe5b60009182526020909120015483906001600160a01b03163163ffffffff614bb316565b9150612f7881600163ffffffff614bb316565b9050612f28565b50905090565b60085481565b60408051602081019091526010548152600090612fa790614b14565b905090565b6001546001600160a01b031681565b600a6020526000908152604090205460ff1681565b60125481565b6060600c805480602002602001604051908101604052809291908181526020018280548015611a8157602002820191906000526020600020905b815481526020019060010190808311613010575050505050905090565b60075481565b6000612fa7613040612f23565b613048613ef6565b9063ffffffff614bb316565b61305c61318c565b6130ad576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811660009081526009602052604090205460ff1661311a576040805162461bcd60e51b815260206004820152601960248201527f5370656e646572206861736e2774206265656e20616464656400000000000000604482015290519081900360640190fd5b6001600160a01b038116600081815260096020526040808220805460ff19169055517fab8cff50266d80b9c9d9703af934ca455b9218286bf4fcaa05653a564c499e4b9190a250565b6000612fa7613170612f23565b479063ffffffff614bb316565b6000546001600160a01b031690565b600080546001600160a01b03166131a1614da9565b6001600160a01b031614905090565b601a6020526000908152604090205481565b60006131cc61318c565b61321d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6132268261442b565b156132625760405162461bcd60e51b81526004018080602001828103825260388152602001806155b36038913960400191505060405180910390fd5b6001600160a01b0382166132bd576040805162461bcd60e51b815260206004820152601760248201527f63616e27742062652061207a65726f2061646472657373000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166000818152601960209081526040808320805460ff191660019081179091556018805491820181559093527fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e90920180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055815192835290517f0c7515883121475b5d9289febf21a9de4ad53f18349a856d90c7acd6e099600b9281900390910190a1506001919050565b60096020526000908152604090205460ff1681565b6060600b805480602002602001604051908101604052809291908181526020018280548015611a81576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611a63575050505050905090565b6133f461318c565b613445576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161349a576040805162461bcd60e51b815260206004820152600e60248201527f76616c756520776173207a65726f000000000000000000000000000000000000604482015290519081900360640190fd5b60068190556040805182815290517f7bfe94ca3147f135fcd6d94ebf61d33fa34fbe904f933ccae66911b9548544f29181900360200190a150565b6001600160a01b03811660009081526016602090815260408083208151928301909152548152611fb990614b14565b61350c61318c565b61355d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166135b8576040805162461bcd60e51b815260206004820181905260248201527f43616e6e6f7420726567697374657220746865206e756c6c2061646472657373604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b90600090a250565b60606004805480602002602001604051908101604052809291908181526020018280548015611a81576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311611a63575050505050905090565b61368261318c565b6136d3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60088190556040805182815290517f4da8e8b2223fbbb897200fb9dfb6b986c1b4188621114d407ee8ec363569fc379181900360200190a150565b61371661318c565b613767576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166000908152601460205260409020805460ff191690556015548082106137de576040805162461bcd60e51b815260206004820152601060248201527f496e64657820697320696e76616c696400000000000000000000000000000000604482015290519081900360640190fd5b601582815481106137eb57fe5b6000918252602090912001546001600160a01b03848116911614613856576040805162461bcd60e51b815260206004820152601c60248201527f496e64657820646f6573206e6f74206d61746368207370656e64657200000000604482015290519081900360640190fd5b600061386982600163ffffffff6149b816565b90508083146138d4576015818154811061387f57fe5b600091825260209091200154601580546001600160a01b0390921691859081106138a557fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b6000601582815481106138e357fe5b600091825260209091200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790558061393060158261533e565b506040516001600160a01b038516907f20aaa18caa668680a42b328a15fd50d580bac65d8bd346e104355473c6373ff390600090a250505050565b61397361318c565b6139c4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8051825114613a1a576040805162461bcd60e51b815260206004820152601560248201527f4172726179206c656e677468206d69736d617463680000000000000000000000604482015290519081900360640190fd5b613a22615362565b613a2c60006144c1565b905060005b8251811015613a7357613a59613a4c84838151811061190857fe5b839063ffffffff614dad16565b9150613a6c81600163ffffffff614bb316565b9050613a31565b50613a8c613a7f6144db565b829063ffffffff614e2616565b613ac75760405162461bcd60e51b81526004018080602001828103825260218152602001806155446021913960400191505060405180910390fd5b60005b600c54811015613b1d57600d6000600c8381548110613ae557fe5b9060005260206000200154815260200190815260200160002060009055613b16600182614bb390919063ffffffff16565b9050613aca565b508251613b3190600c906020860190615375565b5060005b8351811015613c1257600d6000858381518110613b4e57fe5b6020026020010151815260200190815260200160002054600014613bb9576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f742073657420776569676874207477696365000000000000000000604482015290519081900360640190fd5b828181518110613bc557fe5b6020026020010151600d6000868481518110613bdd57fe5b6020026020010151815260200190815260200160002081905550613c0b600182614bb390919063ffffffff16565b9050613b35565b507f63474c4400000000000000000000000000000000000000000000000000000000600052600d6020527f486533e5ef5711c6fceba0b8e8d907d58b0d418a02599d00d65a64e01c112d7754613caf576040805162461bcd60e51b815260206004820152601a60248201527f4d757374207365742063474c4420617373657420776569676874000000000000604482015290519081900360640190fd5b7f55b488abd19ae7621712324d3d42c2ef7a9575f64f5503103286a1161fb408558383604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015613d16578181015183820152602001613cfe565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015613d55578181015183820152602001613d3d565b5050505090500194505050505060405180910390a1505050565b60196020526000908152604090205460ff1681565b6000613d8e61318c565b613ddf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03821660009081526003602052604090205460ff1615613e4d576040805162461bcd60e51b815260206004820152601d60248201527f746f6b656e206164647220616c72656164792072656769737465726564000000604482015290519081900360640190fd5b6001600160a01b038216600081815260036020526040808220805460ff1916600190811790915560048054918201815583527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49190a2506001919050565b60004781613f02612161565b9050808211613f125760006121d0565b6121d0828263ffffffff6149b816565b60065481565b606080600c80549050604051908082528060200260200182016040528015613f5a578160200160208202803883390190505b50905060005b600c54811015612f7f57600d6000600c8381548110613f7b57fe5b9060005260206000200154815260200190815260200160002054828281518110613fa157fe5b6020908102919091010152613fbd81600163ffffffff614bb316565b9050613f60565b613fcc61318c565b61401d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6140316140286144db565b611915836144c1565b61406c5760405162461bcd60e51b81526004018080602001828103825260218152602001806153f96021913960400191505060405180910390fd5b60078190556040805182815290517ffe69856ffb1b1d6cb00c1d8151726e6e95032b1666282eeb293ecadd58b29a6e9181900360200190a150565b6140af61318c565b614100576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661415b576040805162461bcd60e51b815260206004820152601560248201527f5370656e6465722063616e2774206265206e756c6c0000000000000000000000604482015290519081900360640190fd5b6001600160a01b038116600081815260096020526040808220805460ff19166001179055517f3139419c41cdd7abca84fa19dd21118cd285d3e2ce1a9444e8161ce9fa62fdcd9190a250565b6141af61318c565b614200576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b47821115614255576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f7420667265657a65206d6f7265207468616e2062616c616e636500604482015290519081900360640190fd5b601182905562015180420460125560135550565b600d6020526000908152604090205481565b61428361318c565b6142d4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661432f576040805162461bcd60e51b815260206004820152601560248201527f5370656e6465722063616e2774206265206e756c6c0000000000000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526014602052604090205460ff16156143875760405162461bcd60e51b81526004018080602001828103825260238152602001806154eb6023913960400191505060405180910390fd5b6001600160a01b038116600081815260146020526040808220805460ff1916600190811790915560158054918201815583527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4750180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517f71bccdb89fff4d914e3d2e472b327e3debaf4c4d6f1dfe528f430447e4cbcf5f9190a250565b6001600160a01b031660009081526019602052604090205460ff1690565b61445161318c565b6144a2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6144ab81614cf1565b50565b601881815481106123ab57fe5b600e5481565b6144c9615362565b50604080516020810190915290815290565b6144e3615362565b50604080516020810190915269d3c21bcecceda1000000815290565b519051111590565b6000614511613ef6565b821115614565576040805162461bcd60e51b815260206004820152601b60248201527f457863656564696e6720756e66726f7a656e2072657365727665730000000000604482015290519081900360640190fd5b61457e6001600160a01b0384168363ffffffff614e2d16565b6040805183815290516001600160a01b0385169133917f4dd1abe16ad3d4f829372dc77766ca2cce34e205af9b10f8cc1fab370425864f9181900360200190a350600192915050565b6145cf615362565b6145d7614f12565b8211156146155760405162461bcd60e51b815260040180806020018281038252603681526020018061550e6036913960400191505060405180910390fd5b50604080516020810190915269d3c21bcecceda100000082028152919050565b61463d615362565b8251158061464a57508151155b156146645750604080516020810190915260008152611fb9565b815169d3c21bcecceda1000000141561467e575081611fb9565b825169d3c21bcecceda10000001415614698575080611fb9565b600069d3c21bcecceda10000006146ae85614f2d565b51816146b657fe5b04905060006146c485614f62565b519050600069d3c21bcecceda10000006146dd86614f2d565b51816146e557fe5b04905060006146f386614f62565b519050838202841561475c578285828161470957fe5b041461475c576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207831793120646574656374656400000000000000000000604482015290519081900360640190fd5b69d3c21bcecceda1000000810281156147d65769d3c21bcecceda100000082828161478357fe5b04146147d6576040805162461bcd60e51b815260206004820152601f60248201527f6f766572666c6f772078317931202a2066697865643120646574656374656400604482015290519081900360640190fd5b905080848402851561483f57848682816147ec57fe5b041461483f576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207832793120646574656374656400000000000000000000604482015290519081900360640190fd5b86840287156148a5578488828161485257fe5b04146148a5576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207831793220646574656374656400000000000000000000604482015290519081900360640190fd5b6148ad614f9c565b87816148b557fe5b0496506148c0614f9c565b85816148c857fe5b049450868502871561493157858882816148de57fe5b0414614931576040805162461bcd60e51b815260206004820152601660248201527f6f766572666c6f77207832793220646574656374656400000000000000000000604482015290519081900360640190fd5b614939615362565b604051806020016040528087815250905061496281604051806020016040528087815250614dad565b905061497c81604051806020016040528086815250614dad565b905061499681604051806020016040528085815250614dad565b9d9c50505050505050505050505050565b5169d3c21bcecceda1000000900490565b600061239183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614fa5565b6000614a05846121d7565b821115614a435760405162461bcd60e51b815260040180806020018281038252602281526020018061548f6022913960400191505060405180910390fd5b614a5d6001600160a01b038516848463ffffffff61503c16565b604080518381526001600160a01b03868116602083015282519086169233927fc171b15fb47a5beb3e11b1951d4518544f699edd6acd893d8695c91703922b60929081900390910190a35060019392505050565b614ab9615362565b614ac1615362565b614ad1614acc612417565b6144c1565b9050614aee614ae16008546144c1565b829063ffffffff6150bc16565b15614b0557614afd60006144c1565b915050611a89565b614afd6007546144c1565b5090565b5190565b600082614b2757506000611fb9565b82820282848281614b3457fe5b04146123915760405162461bcd60e51b81526004018080602001828103825260218152602001806155656021913960400191505060405180910390fd5b600061239183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506150c4565b600082820183811015612391576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b614c15615362565b8151614c68576040805162461bcd60e51b815260206004820152601160248201527f63616e2774206469766964652062792030000000000000000000000000000000604482015290519081900360640190fd5b825169d3c21bcecceda10000008181029190820414614cce576040805162461bcd60e51b815260206004820152601260248201527f6f766572666c6f77206174206469766964650000000000000000000000000000604482015290519081900360640190fd5b604051806020016040528084600001518381614ce657fe5b049052949350505050565b6001600160a01b038116614d365760405162461bcd60e51b81526004018080602001828103825260268152602001806153d36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b3390565b614db5615362565b8151835190810190811015614e11576040805162461bcd60e51b815260206004820152601560248201527f616464206f766572666c6f772064657465637465640000000000000000000000604482015290519081900360640190fd5b60408051602081019091529081529392505050565b5190511490565b80471015614e82576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114614ecd576040519150601f19603f3d011682016040523d82523d6000602084013e614ed2565b606091505b5050905080611a245760405162461bcd60e51b815260040180806020018281038252603a8152602001806154b1603a913960400191505060405180910390fd5b7601357c299a88ea76a58924d52ce4f26a85af186c2b9e7490565b614f35615362565b604051806020016040528069d3c21bcecceda100000080856000015181614f5857fe5b0402905292915050565b614f6a615362565b604051806020016040528069d3c21bcecceda100000080856000015181614f8d57fe5b95519504029093039092525090565b64e8d4a5100090565b600081848411156150345760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614ff9578181015183820152602001614fe1565b50505050905090810190601f1680156150265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611a24908490615129565b519051101590565b600081836151135760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614ff9578181015183820152602001614fe1565b50600083858161511f57fe5b0495945050505050565b61513b826001600160a01b0316615305565b61518c576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106151e857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016151ab565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461524a576040519150601f19603f3d011682016040523d82523d6000602084013e61524f565b606091505b5091509150816152a6576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156152ff578080602001905160208110156152c257600080fd5b50516152ff5760405162461bcd60e51b815260040180806020018281038252602a8152602001806156af602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061152d575050151592915050565b815481835581811115611a2457600083815260209020611a249181019083016153b8565b6040518060200160405280600081525090565b8280548282559060005260206000209081019282156153b0579160200282015b828111156153b0578251825591602001919060010190615395565b50614b109291505b611a8991905b80821115614b1057600081556001016153be56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f62696e207461782063616e6e6f74206265206c6172676572207468616e2031746f6b656e2061646472657373657320616e64207370656e64696e6720726174696f206c656e67746873206861766520746f206265207468652073616d65746865206164647265737320737065636966696564206973206e6f742061207265736572766520636f6c6c61746572616c206173736574457863656564696e672074686520616d6f756e74207265736572766520686f6c6473416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d617920686176652072657665727465644164647265737320697320616c72656164792045786368616e6765205370656e64657263616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282953756d206f6620617373657420616c6c6f636174696f6e206d7573742062652031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77696e64657820696e746f2072657365727665206c697374206e6f74206d617070656420746f2061646472657373737065636966696564206164647265737320697320616c7265616479206164646564206173206120636f6c6c61746572616c2061737365747370656e64696e6720726174696f2063616e6e6f74206265206c6172676572207468616e2031696e64657820696e746f20636f6c6c61746572616c417373657473206c697374206e6f74206d617070656420746f20746f6b656e7468697320617373657420686173206e6f207370656e64696e6720726174696f2c207468657265666f72652063616e2774206265207472616e73666572726564696e64657820696e746f20746f6b656e73206c697374206e6f74206d617070656420746f20746f6b656e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656463616e206f6e6c79207472616e7366657220746f206f746865722072657365727665206164647265737373656e646572206e6f7420616c6c6f77656420746f207472616e7366657220526573657276652066756e64737370656369666965642061646472657373206973206e6f74206120636f6c6c61746572616c206173736574a265627a7a72315820f41c84f60e3a2b532c8ead0ef1d59b8524e596c06c203056784abfa77c40bf6464736f6c63430005110032

External libraries

AddressLinkedList : 0x6200f54d73491d56b8d7a975c9ee18efb4d518df  
AddressSortedLinkedListWithMedian : 0xed477a99035d0c1e11369f1d7a4e587893cc002b