Address Details
contract

0x5B2C9E7932B08D8F2Ce70ef9E5c98528256f9aB4

Contract Name
GrandaMento
Creator
0xf3eb91–a79239 at 0xdbefeb–706500
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
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
10405323
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
GrandaMento




Optimization enabled
false
Compiler version
v0.5.13+commit.5b0b510c




EVM Version
istanbul




Verified at
2021-09-23T21:03:20.904288Z

Contract source code

pragma solidity ^0.5.13;

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

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

/**
 * @title Facilitates large exchanges between CELO stable tokens.
 */
contract GrandaMento is
  ICeloVersionedContract,
  Ownable,
  Initializable,
  UsingRegistry,
  ReentrancyGuard
{
  using FixidityLib for FixidityLib.Fraction;
  using SafeMath for uint256;

  // Emitted when a new exchange proposal is created.
  event ExchangeProposalCreated(
    uint256 indexed proposalId,
    address indexed exchanger,
    string stableTokenRegistryId,
    uint256 sellAmount,
    uint256 buyAmount,
    bool sellCelo
  );

  // Emitted when an exchange proposal is approved by the approver.
  event ExchangeProposalApproved(uint256 indexed proposalId);

  // Emitted when an exchange proposal is cancelled.
  event ExchangeProposalCancelled(uint256 indexed proposalId);

  // Emitted when an exchange proposal is executed.
  event ExchangeProposalExecuted(uint256 indexed proposalId);

  // Emitted when the approver is set.
  event ApproverSet(address approver);

  // Emitted when maxApprovalExchangeRateChange is set.
  event MaxApprovalExchangeRateChangeSet(uint256 maxApprovalExchangeRateChange);

  // Emitted when the spread is set.
  event SpreadSet(uint256 spread);

  // Emitted when the veto period in seconds is set.
  event VetoPeriodSecondsSet(uint256 vetoPeriodSeconds);

  // Emitted when the exchange limits for a stable token are set.
  event StableTokenExchangeLimitsSet(
    string stableTokenRegistryId,
    uint256 minExchangeAmount,
    uint256 maxExchangeAmount
  );

  enum ExchangeProposalState { None, Proposed, Approved, Executed, Cancelled }

  struct ExchangeLimits {
    // The minimum amount of an asset that can be exchanged in a single proposal.
    uint256 minExchangeAmount;
    // The maximum amount of an asset that can be exchanged in a single proposal.
    uint256 maxExchangeAmount;
  }

  struct ExchangeProposal {
    // The exchanger/proposer of the exchange proposal.
    address payable exchanger;
    // The stable token involved in this proposal. This is stored rather than
    // the stable token's registry ID in case the contract address is changed
    // after a proposal is created, which could affect refunding or burning the
    // stable token.
    address stableToken;
    // The state of the exchange proposal.
    ExchangeProposalState state;
    // Whether the exchanger is selling CELO and buying stableToken.
    bool sellCelo;
    // The amount of the sell token being sold. If a stable token is being sold,
    // the amount of stable token in "units" is stored rather than the "value."
    // This is because stable tokens may experience demurrage/inflation, where
    // the amount of stable token "units" doesn't change with time, but the "value"
    // does. This is important to ensure the correct inflation-adjusted amount
    // of the stable token is transferred out of this contract when a deposit is
    // refunded or an exchange selling the stable token is executed.
    // See StableToken.sol for more details on what "units" vs "values" are.
    uint256 sellAmount;
    // The amount of the buy token being bought. For stable tokens, this is
    // kept track of as the value, not units.
    uint256 buyAmount;
    // The price of CELO quoted in stableToken at the time of the exchange proposal
    // creation. This is the price used to calculate the buyAmount. Used for a
    // safety check when an approval is being made that the price isn't wildly
    // different. Recalculating buyAmount is not sufficient because if a stable token
    // is being sold that has demurrage enabled, the original value when the stable
    // tokens were deposited cannot be calculated.
    uint256 celoStableTokenExchangeRate;
    // The veto period in seconds at the time the proposal was created. This is kept
    // track of on a per-proposal basis to lock-in the veto period for a proposal so
    // that changes to the contract's vetoPeriodSeconds do not affect existing
    // proposals.
    uint256 vetoPeriodSeconds;
    // The timestamp (`block.timestamp`) at which the exchange proposal was approved
    // in seconds. If the exchange proposal has not ever been approved, is 0.
    uint256 approvalTimestamp;
  }

  // The address with the authority to approve exchange proposals.
  address public approver;

  // The maximum allowed change in the CELO/stable token price when an exchange proposal
  // is being approved relative to the rate when the exchange proposal was created.
  FixidityLib.Fraction public maxApprovalExchangeRateChange;

  // The percent fee imposed upon an exchange execution.
  FixidityLib.Fraction public spread;

  // The period in seconds after an approval during which an exchange proposal can be vetoed.
  uint256 public vetoPeriodSeconds;

  // The minimum and maximum amount of the stable token that can be minted or
  // burned in a single exchange. Indexed by the stable token registry identifier string.
  mapping(string => ExchangeLimits) public stableTokenExchangeLimits;

  // State for all exchange proposals. Indexed by the exchange proposal ID.
  mapping(uint256 => ExchangeProposal) public exchangeProposals;

  // An array containing a superset of the IDs of exchange proposals that are currently
  // in the Proposed or Approved state. Intended to allow easy viewing of all active
  // exchange proposals. It's possible for a proposal ID in this array to no longer be
  // active, so filtering is required to find the true set of active proposal IDs.
  // A superset is kept because exchange proposal vetoes, intended to be done
  // by Governance, effectively go through a multi-day timelock. If the veto
  // call was required to provide the index in an array of activeProposalIds to
  // remove corresponding to the vetoed exchange proposal, the timelock could result
  // in the provided index being stale by the time the veto would be executed.
  // Alternative approaches exist, like maintaining a linkedlist of active proposal
  // IDs, but this approach was chosen for its low implementation complexity.
  uint256[] public activeProposalIdsSuperset;

  // Number of exchange proposals that have ever been created. Used for assigning
  // an exchange proposal ID to a new proposal.
  uint256 public exchangeProposalCount;

  /**
   * @notice Reverts if the sender is not the approver.
   */
  modifier onlyApprover() {
    require(msg.sender == approver, "Sender must be approver");
    _;
  }

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

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

  /**
   * @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
   * @param _registry The address of the registry.
   * @param _approver The approver that has the ability to approve exchange proposals.
   * @param _maxApprovalExchangeRateChange The maximum allowed change in CELO price
   * between an exchange proposal's creation and approval.
   * @param _spread The spread charged on exchanges.
   * @param _vetoPeriodSeconds The length of the veto period in seconds.
   */
  function initialize(
    address _registry,
    address _approver,
    uint256 _maxApprovalExchangeRateChange,
    uint256 _spread,
    uint256 _vetoPeriodSeconds
  ) external initializer {
    _transferOwnership(msg.sender);
    setRegistry(_registry);
    setApprover(_approver);
    setMaxApprovalExchangeRateChange(_maxApprovalExchangeRateChange);
    setSpread(_spread);
    setVetoPeriodSeconds(_vetoPeriodSeconds);
  }

  /**
   * @notice Creates a new exchange proposal and deposits the tokens being sold.
   * @dev Stable token value amounts are used for the sellAmount, not unit amounts.
   * @param stableTokenRegistryId The string registry ID for the stable token
   * involved in the exchange.
   * @param sellAmount The amount of the sell token being sold.
   * @param sellCelo Whether CELO is being sold.
   * @return The proposal identifier for the newly created exchange proposal.
   */
  function createExchangeProposal(
    string calldata stableTokenRegistryId,
    uint256 sellAmount,
    bool sellCelo
  ) external nonReentrant returns (uint256) {
    address stableToken = registry.getAddressForStringOrDie(stableTokenRegistryId);

    // Gets the price of CELO quoted in stableToken.
    uint256 celoStableTokenExchangeRate = getOracleExchangeRate(stableToken).unwrap();

    // Using the current oracle exchange rate, calculate what the buy amount is.
    // This takes the spread into consideration.
    uint256 buyAmount = getBuyAmount(celoStableTokenExchangeRate, sellAmount, sellCelo);

    // Create new scope to prevent a stack too deep error.
    {
      // Get the minimum and maximum amount of stable token than can be involved
      // in the exchange. This reverts if exchange limits for the stable token have
      // not been set.
      (uint256 minExchangeAmount, uint256 maxExchangeAmount) = getStableTokenExchangeLimits(
        stableTokenRegistryId
      );
      // Ensure that the amount of stableToken being bought or sold is within
      // the configurable exchange limits.
      uint256 stableTokenExchangeAmount = sellCelo ? buyAmount : sellAmount;
      require(
        stableTokenExchangeAmount <= maxExchangeAmount &&
          stableTokenExchangeAmount >= minExchangeAmount,
        "Stable token exchange amount not within limits"
      );
    }

    // Deposit the assets being sold.
    IERC20 sellToken = sellCelo ? getGoldToken() : IERC20(stableToken);
    require(
      sellToken.transferFrom(msg.sender, address(this), sellAmount),
      "Transfer in of sell token failed"
    );

    // Record the proposal.
    // Add 1 to the running proposal count, and use the updated proposal count as
    // the proposal ID. Proposal IDs intentionally start at 1.
    exchangeProposalCount = exchangeProposalCount.add(1);
    // For stable tokens, the amount is stored in units to deal with demurrage.
    uint256 storedSellAmount = sellCelo
      ? sellAmount
      : IStableToken(stableToken).valueToUnits(sellAmount);
    exchangeProposals[exchangeProposalCount] = ExchangeProposal({
      exchanger: msg.sender,
      stableToken: stableToken,
      state: ExchangeProposalState.Proposed,
      sellCelo: sellCelo,
      sellAmount: storedSellAmount,
      buyAmount: buyAmount,
      celoStableTokenExchangeRate: celoStableTokenExchangeRate,
      vetoPeriodSeconds: vetoPeriodSeconds,
      approvalTimestamp: 0 // initial value when not approved yet
    });
    // StableToken.unitsToValue (called within getSellTokenAndSellAmount) can
    // overflow for very large StableToken amounts. Call it here as a sanity
    // check, so that the overflow happens here, blocking proposal creation
    // rather than when attempting to execute the proposal, which would lock
    // funds in this contract.
    getSellTokenAndSellAmount(exchangeProposals[exchangeProposalCount]);
    // Push it into the array of active proposals.
    activeProposalIdsSuperset.push(exchangeProposalCount);
    // Even if stable tokens are being sold, the sellAmount emitted is the "value."
    emit ExchangeProposalCreated(
      exchangeProposalCount,
      msg.sender,
      stableTokenRegistryId,
      sellAmount,
      buyAmount,
      sellCelo
    );
    return exchangeProposalCount;
  }

  /**
   * @notice Approves an existing exchange proposal.
   * @dev Sender must be the approver. Exchange proposal must be in the Proposed state.
   * @param proposalId The identifier of the proposal to approve.
   */
  function approveExchangeProposal(uint256 proposalId) external nonReentrant onlyApprover {
    ExchangeProposal storage proposal = exchangeProposals[proposalId];
    // Ensure the proposal is in the Proposed state.
    require(proposal.state == ExchangeProposalState.Proposed, "Proposal must be in Proposed state");
    // Ensure the change in the current price of CELO quoted in the stable token
    // relative to the value when the proposal was created is within the allowed limit.
    FixidityLib.Fraction memory currentRate = getOracleExchangeRate(proposal.stableToken);
    FixidityLib.Fraction memory proposalRate = FixidityLib.wrap(
      proposal.celoStableTokenExchangeRate
    );
    (FixidityLib.Fraction memory lesserRate, FixidityLib.Fraction memory greaterRate) = currentRate
      .lt(proposalRate)
      ? (currentRate, proposalRate)
      : (proposalRate, currentRate);
    FixidityLib.Fraction memory rateChange = greaterRate.subtract(lesserRate).divide(proposalRate);
    require(
      rateChange.lte(maxApprovalExchangeRateChange),
      "CELO exchange rate is too different from the proposed price"
    );

    // Set the time the approval occurred and change the state.
    proposal.approvalTimestamp = block.timestamp;
    proposal.state = ExchangeProposalState.Approved;
    emit ExchangeProposalApproved(proposalId);
  }

  /**
   * @notice Cancels an exchange proposal.
   * @dev Only callable by the exchanger if the proposal is in the Proposed state
   * or the owner if the proposal is in the Approved state.
   * @param proposalId The identifier of the proposal to cancel.
   */
  function cancelExchangeProposal(uint256 proposalId) external nonReentrant {
    ExchangeProposal storage proposal = exchangeProposals[proposalId];
    // Require the appropriate state and sender.
    // This will also revert if a proposalId is given that does not correspond
    // to a previously created exchange proposal.
    if (proposal.state == ExchangeProposalState.Proposed) {
      require(proposal.exchanger == msg.sender, "Sender must be exchanger");
    } else if (proposal.state == ExchangeProposalState.Approved) {
      require(isOwner(), "Sender must be owner");
    } else {
      revert("Proposal must be in Proposed or Approved state");
    }
    // Mark the proposal as cancelled. Do so prior to refunding as a measure against reentrancy.
    proposal.state = ExchangeProposalState.Cancelled;
    // Get the token and amount that will be refunded to the proposer.
    (IERC20 refundToken, uint256 refundAmount) = getSellTokenAndSellAmount(proposal);
    // Finally, transfer out the deposited funds.
    require(
      refundToken.transfer(proposal.exchanger, refundAmount),
      "Transfer out of refund token failed"
    );
    emit ExchangeProposalCancelled(proposalId);
  }

  /**
   * @notice Executes an exchange proposal that's been approved and not vetoed.
   * @dev Callable by anyone. Reverts if the proposal is not in the Approved state
   * or proposal.vetoPeriodSeconds has not elapsed since approval.
   * @param proposalId The identifier of the proposal to execute.
   */
  function executeExchangeProposal(uint256 proposalId) external nonReentrant {
    ExchangeProposal storage proposal = exchangeProposals[proposalId];
    // Require that the proposal is in the Approved state.
    require(proposal.state == ExchangeProposalState.Approved, "Proposal must be in Approved state");
    // Require that the veto period has elapsed since the approval time.
    require(
      proposal.approvalTimestamp.add(proposal.vetoPeriodSeconds) <= block.timestamp,
      "Veto period not elapsed"
    );
    // Mark the proposal as executed. Do so prior to exchanging as a measure against reentrancy.
    proposal.state = ExchangeProposalState.Executed;
    // Perform the exchange.
    (IERC20 sellToken, uint256 sellAmount) = getSellTokenAndSellAmount(proposal);
    // If the exchange sells CELO, the CELO is sent to the Reserve from this contract
    // and stable token is minted to the exchanger.
    if (proposal.sellCelo) {
      // Send the CELO from this contract to the reserve.
      require(
        sellToken.transfer(address(getReserve()), sellAmount),
        "Transfer out of CELO to Reserve failed"
      );
      // Mint stable token to the exchanger.
      require(
        IStableToken(proposal.stableToken).mint(proposal.exchanger, proposal.buyAmount),
        "Stable token mint failed"
      );
    } else {
      // If the exchange is selling stable token, the stable token is burned from
      // this contract and CELO is transferred from the Reserve to the exchanger.

      // Burn the stable token from this contract.
      require(IStableToken(proposal.stableToken).burn(sellAmount), "Stable token burn failed");
      // Transfer the CELO from the Reserve to the exchanger.
      require(
        getReserve().transferExchangeGold(proposal.exchanger, proposal.buyAmount),
        "Transfer out of CELO from Reserve failed"
      );
    }
    emit ExchangeProposalExecuted(proposalId);
  }

  /**
   * @notice Gets the sell token and the sell amount for a proposal.
   * @dev For stable token sell amounts that are stored as units, the value
   * is returned. Ensures sell amount is not greater than this contract's balance.
   * @param proposal The proposal to get the sell token and sell amount for.
   * @return (the IERC20 sell token, the value sell amount).
   */
  function getSellTokenAndSellAmount(ExchangeProposal memory proposal)
    private
    view
    returns (IERC20, uint256)
  {
    IERC20 sellToken;
    uint256 sellAmount;
    if (proposal.sellCelo) {
      sellToken = getGoldToken();
      sellAmount = proposal.sellAmount;
    } else {
      address stableToken = proposal.stableToken;
      sellToken = IERC20(stableToken);
      // When selling stableToken, the sell amount is stored in units.
      // Units must be converted to value when refunding.
      sellAmount = IStableToken(stableToken).unitsToValue(proposal.sellAmount);
    }
    // In the event a precision issue from the unit <-> value calculations results
    // in sellAmount being greater than this contract's balance, set the sellAmount
    // to the entire balance.
    // This check should not be necessary for CELO, but is done so regardless
    // for extra certainty that cancelling an exchange proposal can never fail
    // if for some reason the CELO balance of this contract is less than the
    // recorded sell amount.
    uint256 totalBalance = sellToken.balanceOf(address(this));
    if (totalBalance < sellAmount) {
      sellAmount = totalBalance;
    }
    return (sellToken, sellAmount);
  }

  /**
   * @notice Using the oracle price, charges the spread and calculates the amount of
   * the asset being bought.
   * @dev Stable token value amounts are used for the sellAmount, not unit amounts.
   * Assumes both CELO and the stable token have 18 decimals.
   * @param celoStableTokenExchangeRate The unwrapped fraction exchange rate of CELO
   * quoted in the stable token.
   * @param sellAmount The amount of the sell token being sold.
   * @param sellCelo Whether CELO is being sold.
   * @return The amount of the asset being bought.
   */
  function getBuyAmount(uint256 celoStableTokenExchangeRate, uint256 sellAmount, bool sellCelo)
    public
    view
    returns (uint256)
  {
    FixidityLib.Fraction memory exchangeRate = FixidityLib.wrap(celoStableTokenExchangeRate);
    // If stableToken is being sold, instead use the price of stableToken
    // quoted in CELO.
    if (!sellCelo) {
      exchangeRate = exchangeRate.reciprocal();
    }
    // The sell amount taking the spread into account, ie:
    // (1 - spread) * sellAmount
    FixidityLib.Fraction memory adjustedSellAmount = FixidityLib.fixed1().subtract(spread).multiply(
      FixidityLib.newFixed(sellAmount)
    );
    // Calculate the buy amount:
    // exchangeRate * adjustedSellAmount
    return exchangeRate.multiply(adjustedSellAmount).fromFixed();
  }

  /**
   * @notice Removes the proposal ID found at the provided index of activeProposalIdsSuperset
   * if the exchange proposal is not active.
   * @dev Anyone can call. Reverts if the exchange proposal is active.
   * @param index The index of the proposal ID to remove from activeProposalIdsSuperset.
   */
  function removeFromActiveProposalIdsSuperset(uint256 index) external {
    require(index < activeProposalIdsSuperset.length, "Index out of bounds");
    uint256 proposalId = activeProposalIdsSuperset[index];
    // Require the exchange proposal to be inactive.
    require(
      exchangeProposals[proposalId].state != ExchangeProposalState.Proposed &&
        exchangeProposals[proposalId].state != ExchangeProposalState.Approved,
      "Exchange proposal not inactive"
    );
    // If not removing the last element, overwrite the index with the value of
    // the last element.
    uint256 lastIndex = activeProposalIdsSuperset.length.sub(1);
    if (index < lastIndex) {
      activeProposalIdsSuperset[index] = activeProposalIdsSuperset[lastIndex];
    }
    // Delete the last element.
    activeProposalIdsSuperset.length--;
  }

  /**
   * @notice Gets the proposal identifiers of exchange proposals in the
   * Proposed or Approved state. Returns a version of activeProposalIdsSuperset
   * with inactive proposal IDs set as 0.
   * @dev Elements with a proposal ID of 0 should be filtered out by the consumer.
   * @return An array of active exchange proposals IDs.
   */
  function getActiveProposalIds() external view returns (uint256[] memory) {
    // Solidity doesn't play well with dynamically sized memory arrays.
    // Instead, this array is created with the same length as activeProposalIdsSuperset,
    // and will replace elements that are inactive proposal IDs with the value 0.
    uint256[] memory activeProposalIds = new uint256[](activeProposalIdsSuperset.length);

    for (uint256 i = 0; i < activeProposalIdsSuperset.length; i = i.add(1)) {
      uint256 proposalId = activeProposalIdsSuperset[i];
      if (
        exchangeProposals[proposalId].state == ExchangeProposalState.Proposed ||
        exchangeProposals[proposalId].state == ExchangeProposalState.Approved
      ) {
        activeProposalIds[i] = proposalId;
      }
    }
    return activeProposalIds;
  }

  /**
   * @notice Gets the oracle CELO price quoted in the stable token.
   * @dev Reverts if there is not a rate for the provided stable token.
   * @param stableToken The stable token to get the oracle price for.
   * @return The oracle CELO price quoted in the stable token.
   */
  function getOracleExchangeRate(address stableToken)
    private
    view
    returns (FixidityLib.Fraction memory)
  {
    uint256 rateNumerator;
    uint256 rateDenominator;
    (rateNumerator, rateDenominator) = getSortedOracles().medianRate(stableToken);
    // When rateDenominator is 0, it means there are no rates known to SortedOracles.
    require(rateDenominator > 0, "No oracle rates present for token");
    return FixidityLib.wrap(rateNumerator).divide(FixidityLib.wrap(rateDenominator));
  }

  /**
   * @notice Gets the minimum and maximum amount of a stable token that can be
   * involved in a single exchange.
   * @dev Reverts if there is no explicit exchange limit for the stable token.
   * @param stableTokenRegistryId The string registry ID for the stable token.
   * @return (minimum exchange amount, maximum exchange amount).
   */
  function getStableTokenExchangeLimits(string memory stableTokenRegistryId)
    public
    view
    returns (uint256, uint256)
  {
    ExchangeLimits memory exchangeLimits = stableTokenExchangeLimits[stableTokenRegistryId];
    // Require the configurable stableToken max exchange amount to be > 0.
    // This covers the case where a stableToken has never been explicitly permitted.
    require(
      exchangeLimits.maxExchangeAmount > 0,
      "Max stable token exchange amount must be defined"
    );
    return (exchangeLimits.minExchangeAmount, exchangeLimits.maxExchangeAmount);
  }

  /**
   * @notice Sets the approver.
   * @dev Sender must be owner. New approver is allowed to be address(0).
   * @param newApprover The new value for the approver.
   */
  function setApprover(address newApprover) public onlyOwner {
    approver = newApprover;
    emit ApproverSet(newApprover);
  }

  /**
   * @notice Sets the maximum allowed change in the CELO/stable token price when
   * an exchange proposal is being approved relative to the price when the proposal
   * was created.
   * @dev Sender must be owner.
   * @param newMaxApprovalExchangeRateChange The new value for maxApprovalExchangeRateChange
   * to be wrapped.
   */
  function setMaxApprovalExchangeRateChange(uint256 newMaxApprovalExchangeRateChange)
    public
    onlyOwner
  {
    maxApprovalExchangeRateChange = FixidityLib.wrap(newMaxApprovalExchangeRateChange);
    emit MaxApprovalExchangeRateChangeSet(newMaxApprovalExchangeRateChange);
  }

  /**
   * @notice Sets the spread.
   * @dev Sender must be owner.
   * @param newSpread The new value for the spread to be wrapped. Must be <= fixed 1.
   */
  function setSpread(uint256 newSpread) public onlyOwner {
    require(newSpread <= FixidityLib.fixed1().unwrap(), "Spread must be smaller than 1");
    spread = FixidityLib.wrap(newSpread);
    emit SpreadSet(newSpread);
  }

  /**
   * @notice Sets the minimum and maximum amount of the stable token an exchange can involve.
   * @dev Sender must be owner. Setting the maxExchangeAmount to 0 effectively disables new
   * exchange proposals for the token.
   * @param stableTokenRegistryId The registry ID string for the stable token to set limits for.
   * @param minExchangeAmount The new minimum exchange amount for the stable token.
   * @param maxExchangeAmount The new maximum exchange amount for the stable token.
   */
  function setStableTokenExchangeLimits(
    string calldata stableTokenRegistryId,
    uint256 minExchangeAmount,
    uint256 maxExchangeAmount
  ) external onlyOwner {
    require(
      minExchangeAmount <= maxExchangeAmount,
      "Min exchange amount must not be greater than max"
    );
    stableTokenExchangeLimits[stableTokenRegistryId] = ExchangeLimits({
      minExchangeAmount: minExchangeAmount,
      maxExchangeAmount: maxExchangeAmount
    });
    emit StableTokenExchangeLimitsSet(stableTokenRegistryId, minExchangeAmount, maxExchangeAmount);
  }

  /**
   * @notice Sets the veto period in seconds.
   * @dev Sender must be owner.
   * @param newVetoPeriodSeconds The new value for the veto period in seconds.
   */
  function setVetoPeriodSeconds(uint256 newVetoPeriodSeconds) public onlyOwner {
    // Hardcode a max of 4 weeks.
    // A minimum is not enforced for flexibility. A case of interest is if
    // Governance were to be set as the `approver`, it would be desirable to
    // set the veto period to 0 seconds.
    require(newVetoPeriodSeconds <= 4 weeks, "Veto period cannot exceed 4 weeks");
    vetoPeriodSeconds = newVetoPeriodSeconds;
    emit VetoPeriodSecondsSet(newVetoPeriodSeconds);
  }
}
        

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
   */
  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
    // solium-disable-next-line 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");
    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());
  }
}
          

Initializable.sol

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;
    _;
  }
}
          

UsingRegistry.sol

pragma solidity ^0.5.13;

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

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

import "../governance/interfaces/IElection.sol";
import "../governance/interfaces/IGovernance.sol";
import "../governance/interfaces/ILockedGold.sol";
import "../governance/interfaces/IValidators.sol";

import "../identity/interfaces/IRandom.sol";
import "../identity/interfaces/IAttestations.sol";

import "../stability/interfaces/IExchange.sol";
import "../stability/interfaces/IReserve.sol";
import "../stability/interfaces/ISortedOracles.sol";
import "../stability/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 getAccounts() internal view returns (IAccounts) {
    return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
  }

  function getAttestations() internal view returns (IAttestations) {
    return IAttestations(registry.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID));
  }

  function getElection() internal view returns (IElection) {
    return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID));
  }

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

  function getFeeCurrencyWhitelistRegistry() internal view returns (IFeeCurrencyWhitelist) {
    return IFeeCurrencyWhitelist(registry.getAddressForOrDie(FEE_CURRENCY_WHITELIST_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 getGovernance() internal view returns (IGovernance) {
    return IGovernance(registry.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
  }

  function getLockedGold() internal view returns (ILockedGold) {
    return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID));
  }

  function getRandom() internal view returns (IRandom) {
    return IRandom(registry.getAddressForOrDie(RANDOM_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));
  }

  function getValidators() internal view returns (IValidators) {
    return IValidators(registry.getAddressForOrDie(VALIDATORS_REGISTRY_ID));
  }
}
          

IAccounts.sol

pragma solidity ^0.5.13;

interface IAccounts {
  function isAccount(address) external view returns (bool);
  function voteSignerToAccount(address) external view returns (address);
  function validatorSignerToAccount(address) external view returns (address);
  function attestationSignerToAccount(address) external view returns (address);
  function signerToAccount(address) external view returns (address);
  function getAttestationSigner(address) external view returns (address);
  function getValidatorSigner(address) external view returns (address);
  function getVoteSigner(address) external view returns (address);
  function hasAuthorizedVoteSigner(address) external view returns (bool);
  function hasAuthorizedValidatorSigner(address) external view returns (bool);
  function hasAuthorizedAttestationSigner(address) external view returns (bool);

  function setAccountDataEncryptionKey(bytes calldata) external;
  function setMetadataURL(string calldata) external;
  function setName(string calldata) external;
  function setWalletAddress(address, uint8, bytes32, bytes32) external;
  function setAccount(string calldata, bytes calldata, address, uint8, bytes32, bytes32) external;

  function getDataEncryptionKey(address) external view returns (bytes memory);
  function getWalletAddress(address) external view returns (address);
  function getMetadataURL(address) external view returns (string memory);
  function batchGetMetadataURL(address[] calldata)
    external
    view
    returns (uint256[] memory, bytes memory);
  function getName(address) external view returns (string memory);

  function authorizeVoteSigner(address, uint8, bytes32, bytes32) external;
  function authorizeValidatorSigner(address, uint8, bytes32, bytes32) external;
  function authorizeValidatorSignerWithPublicKey(address, uint8, bytes32, bytes32, bytes calldata)
    external;
  function authorizeValidatorSignerWithKeys(
    address,
    uint8,
    bytes32,
    bytes32,
    bytes calldata,
    bytes calldata,
    bytes calldata
  ) external;
  function authorizeAttestationSigner(address, uint8, bytes32, bytes32) external;
  function createAccount() external returns (bool);
}
          

ICeloVersionedContract.sol

pragma solidity ^0.5.13;

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

IFeeCurrencyWhitelist.sol

pragma solidity ^0.5.13;

interface IFeeCurrencyWhitelist {
  function addToken(address) external;
  function getWhitelist() external view returns (address[] memory);
}
          

IFreezer.sol

pragma solidity ^0.5.13;

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

IRegistry.sol

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);
}
          

ReentrancyGuard.sol

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");
  }
}
          

IElection.sol

pragma solidity ^0.5.13;

interface IElection {
  function electValidatorSigners() external view returns (address[] memory);
  function electNValidatorSigners(uint256, uint256) external view returns (address[] memory);
  function vote(address, uint256, address, address) external returns (bool);
  function activate(address) external returns (bool);
  function revokeActive(address, uint256, address, address, uint256) external returns (bool);
  function revokeAllActive(address, address, address, uint256) external returns (bool);
  function revokePending(address, uint256, address, address, uint256) external returns (bool);
  function markGroupIneligible(address) external;
  function markGroupEligible(address, address, address) external;
  function forceDecrementVotes(
    address,
    uint256,
    address[] calldata,
    address[] calldata,
    uint256[] calldata
  ) external returns (uint256);

  // view functions
  function getElectableValidators() external view returns (uint256, uint256);
  function getElectabilityThreshold() external view returns (uint256);
  function getNumVotesReceivable(address) external view returns (uint256);
  function getTotalVotes() external view returns (uint256);
  function getActiveVotes() external view returns (uint256);
  function getTotalVotesByAccount(address) external view returns (uint256);
  function getPendingVotesForGroupByAccount(address, address) external view returns (uint256);
  function getActiveVotesForGroupByAccount(address, address) external view returns (uint256);
  function getTotalVotesForGroupByAccount(address, address) external view returns (uint256);
  function getActiveVoteUnitsForGroupByAccount(address, address) external view returns (uint256);
  function getTotalVotesForGroup(address) external view returns (uint256);
  function getActiveVotesForGroup(address) external view returns (uint256);
  function getPendingVotesForGroup(address) external view returns (uint256);
  function getGroupEligibility(address) external view returns (bool);
  function getGroupEpochRewards(address, uint256, uint256[] calldata)
    external
    view
    returns (uint256);
  function getGroupsVotedForByAccount(address) external view returns (address[] memory);
  function getEligibleValidatorGroups() external view returns (address[] memory);
  function getTotalVotesForEligibleValidatorGroups()
    external
    view
    returns (address[] memory, uint256[] memory);
  function getCurrentValidatorSigners() external view returns (address[] memory);
  function canReceiveVotes(address, uint256) external view returns (bool);
  function hasActivatablePendingVotes(address, address) external view returns (bool);

  // only owner
  function setElectableValidators(uint256, uint256) external returns (bool);
  function setMaxNumGroupsVotedFor(uint256) external returns (bool);
  function setElectabilityThreshold(uint256) external returns (bool);

  // only VM
  function distributeEpochRewards(address, uint256, address, address) external;
}
          

IGovernance.sol

pragma solidity ^0.5.13;

interface IGovernance {
  function isVoting(address) external view returns (bool);
}
          

ILockedGold.sol

pragma solidity ^0.5.13;

interface ILockedGold {
  function incrementNonvotingAccountBalance(address, uint256) external;
  function decrementNonvotingAccountBalance(address, uint256) external;
  function getAccountTotalLockedGold(address) external view returns (uint256);
  function getTotalLockedGold() external view returns (uint256);
  function getPendingWithdrawals(address)
    external
    view
    returns (uint256[] memory, uint256[] memory);
  function getTotalPendingWithdrawals(address) external view returns (uint256);
  function lock() external payable;
  function unlock(uint256) external;
  function relock(uint256, uint256) external;
  function withdraw(uint256) external;
  function slash(
    address account,
    uint256 penalty,
    address reporter,
    uint256 reward,
    address[] calldata lessers,
    address[] calldata greaters,
    uint256[] calldata indices
  ) external;
  function isSlasher(address) external view returns (bool);
}
          

IValidators.sol

pragma solidity ^0.5.13;

interface IValidators {
  function registerValidator(bytes calldata, bytes calldata, bytes calldata)
    external
    returns (bool);
  function deregisterValidator(uint256) external returns (bool);
  function affiliate(address) external returns (bool);
  function deaffiliate() external returns (bool);
  function updateBlsPublicKey(bytes calldata, bytes calldata) external returns (bool);
  function registerValidatorGroup(uint256) external returns (bool);
  function deregisterValidatorGroup(uint256) external returns (bool);
  function addMember(address) external returns (bool);
  function addFirstMember(address, address, address) external returns (bool);
  function removeMember(address) external returns (bool);
  function reorderMember(address, address, address) external returns (bool);
  function updateCommission() external;
  function setNextCommissionUpdate(uint256) external;
  function resetSlashingMultiplier() external;

  // only owner
  function setCommissionUpdateDelay(uint256) external;
  function setMaxGroupSize(uint256) external returns (bool);
  function setMembershipHistoryLength(uint256) external returns (bool);
  function setValidatorScoreParameters(uint256, uint256) external returns (bool);
  function setGroupLockedGoldRequirements(uint256, uint256) external returns (bool);
  function setValidatorLockedGoldRequirements(uint256, uint256) external returns (bool);
  function setSlashingMultiplierResetPeriod(uint256) external;

  // view functions
  function getMaxGroupSize() external view returns (uint256);
  function getCommissionUpdateDelay() external view returns (uint256);
  function getValidatorScoreParameters() external view returns (uint256, uint256);
  function getMembershipHistory(address)
    external
    view
    returns (uint256[] memory, address[] memory, uint256, uint256);
  function calculateEpochScore(uint256) external view returns (uint256);
  function calculateGroupEpochScore(uint256[] calldata) external view returns (uint256);
  function getAccountLockedGoldRequirement(address) external view returns (uint256);
  function meetsAccountLockedGoldRequirements(address) external view returns (bool);
  function getValidatorBlsPublicKeyFromSigner(address) external view returns (bytes memory);
  function getValidator(address account)
    external
    view
    returns (bytes memory, bytes memory, address, uint256, address);
  function getValidatorGroup(address)
    external
    view
    returns (address[] memory, uint256, uint256, uint256, uint256[] memory, uint256, uint256);
  function getGroupNumMembers(address) external view returns (uint256);
  function getTopGroupValidators(address, uint256) external view returns (address[] memory);
  function getGroupsNumMembers(address[] calldata accounts)
    external
    view
    returns (uint256[] memory);
  function getNumRegisteredValidators() external view returns (uint256);
  function groupMembershipInEpoch(address, uint256, uint256) external view returns (address);

  // only registered contract
  function updateEcdsaPublicKey(address, address, bytes calldata) external returns (bool);
  function updatePublicKeys(address, address, bytes calldata, bytes calldata, bytes calldata)
    external
    returns (bool);
  function getValidatorLockedGoldRequirements() external view returns (uint256, uint256);
  function getGroupLockedGoldRequirements() external view returns (uint256, uint256);
  function getRegisteredValidators() external view returns (address[] memory);
  function getRegisteredValidatorSigners() external view returns (address[] memory);
  function getRegisteredValidatorGroups() external view returns (address[] memory);
  function isValidatorGroup(address) external view returns (bool);
  function isValidator(address) external view returns (bool);
  function getValidatorGroupSlashingMultiplier(address) external view returns (uint256);
  function getMembershipInLastEpoch(address) external view returns (address);
  function getMembershipInLastEpochFromSigner(address) external view returns (address);

  // only VM
  function updateValidatorScoreFromSigner(address, uint256) external;
  function distributeEpochPaymentsFromSigner(address, uint256) external returns (uint256);

  // only slasher
  function forceDeaffiliateIfValidator(address) external;
  function halveSlashingMultiplier(address) external;

}
          

IAttestations.sol

pragma solidity ^0.5.13;

interface IAttestations {
  function request(bytes32, uint256, address) external;
  function selectIssuers(bytes32) external;
  function complete(bytes32, uint8, bytes32, bytes32) external;
  function revoke(bytes32, uint256) external;
  function withdraw(address) external;
  function approveTransfer(bytes32, uint256, address, address, bool) external;

  // view functions
  function getUnselectedRequest(bytes32, address) external view returns (uint32, uint32, address);
  function getAttestationIssuers(bytes32, address) external view returns (address[] memory);
  function getAttestationStats(bytes32, address) external view returns (uint32, uint32);
  function batchGetAttestationStats(bytes32[] calldata)
    external
    view
    returns (uint256[] memory, address[] memory, uint64[] memory, uint64[] memory);
  function getAttestationState(bytes32, address, address)
    external
    view
    returns (uint8, uint32, address);
  function getCompletableAttestations(bytes32, address)
    external
    view
    returns (uint32[] memory, address[] memory, uint256[] memory, bytes memory);
  function getAttestationRequestFee(address) external view returns (uint256);
  function getMaxAttestations() external view returns (uint256);
  function validateAttestationCode(bytes32, address, uint8, bytes32, bytes32)
    external
    view
    returns (address);
  function lookupAccountsForIdentifier(bytes32) external view returns (address[] memory);
  function requireNAttestationsRequested(bytes32, address, uint32) external view;

  // only owner
  function setAttestationRequestFee(address, uint256) external;
  function setAttestationExpiryBlocks(uint256) external;
  function setSelectIssuersWaitBlocks(uint256) external;
  function setMaxAttestations(uint256) external;
}
          

IRandom.sol

pragma solidity ^0.5.13;

interface IRandom {
  function revealAndCommit(bytes32, bytes32, address) external;
  function randomnessBlockRetentionWindow() external view returns (uint256);
  function random() external view returns (bytes32);
  function getBlockRandomness(uint256) external view returns (bytes32);
}
          

IExchange.sol

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);
}
          

IReserve.sol

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

ISortedOracles.sol

pragma solidity ^0.5.13;

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);
}
          

IStableToken.sol

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

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

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

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

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

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);
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"ApproverSet","inputs":[{"type":"address","name":"approver","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ExchangeProposalApproved","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ExchangeProposalCancelled","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ExchangeProposalCreated","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256","indexed":true},{"type":"address","name":"exchanger","internalType":"address","indexed":true},{"type":"string","name":"stableTokenRegistryId","internalType":"string","indexed":false},{"type":"uint256","name":"sellAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"buyAmount","internalType":"uint256","indexed":false},{"type":"bool","name":"sellCelo","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"ExchangeProposalExecuted","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"MaxApprovalExchangeRateChangeSet","inputs":[{"type":"uint256","name":"maxApprovalExchangeRateChange","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":"SpreadSet","inputs":[{"type":"uint256","name":"spread","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StableTokenExchangeLimitsSet","inputs":[{"type":"string","name":"stableTokenRegistryId","internalType":"string","indexed":false},{"type":"uint256","name":"minExchangeAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"maxExchangeAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"VetoPeriodSecondsSet","inputs":[{"type":"uint256","name":"vetoPeriodSeconds","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"activeProposalIdsSuperset","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"approveExchangeProposal","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"approver","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"cancelExchangeProposal","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"createExchangeProposal","inputs":[{"type":"string","name":"stableTokenRegistryId","internalType":"string"},{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"bool","name":"sellCelo","internalType":"bool"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"exchangeProposalCount","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"exchanger","internalType":"address payable"},{"type":"address","name":"stableToken","internalType":"address"},{"type":"uint8","name":"state","internalType":"enum GrandaMento.ExchangeProposalState"},{"type":"bool","name":"sellCelo","internalType":"bool"},{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"uint256","name":"buyAmount","internalType":"uint256"},{"type":"uint256","name":"celoStableTokenExchangeRate","internalType":"uint256"},{"type":"uint256","name":"vetoPeriodSeconds","internalType":"uint256"},{"type":"uint256","name":"approvalTimestamp","internalType":"uint256"}],"name":"exchangeProposals","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"executeExchangeProposal","inputs":[{"type":"uint256","name":"proposalId","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getActiveProposalIds","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBuyAmount","inputs":[{"type":"uint256","name":"celoStableTokenExchangeRate","internalType":"uint256"},{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"bool","name":"sellCelo","internalType":"bool"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getStableTokenExchangeLimits","inputs":[{"type":"string","name":"stableTokenRegistryId","internalType":"string"}],"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":"_registry","internalType":"address"},{"type":"address","name":"_approver","internalType":"address"},{"type":"uint256","name":"_maxApprovalExchangeRateChange","internalType":"uint256"},{"type":"uint256","name":"_spread","internalType":"uint256"},{"type":"uint256","name":"_vetoPeriodSeconds","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":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"name":"maxApprovalExchangeRateChange","inputs":[],"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":[],"name":"removeFromActiveProposalIdsSuperset","inputs":[{"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":"setApprover","inputs":[{"type":"address","name":"newApprover","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMaxApprovalExchangeRateChange","inputs":[{"type":"uint256","name":"newMaxApprovalExchangeRateChange","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":"setSpread","inputs":[{"type":"uint256","name":"newSpread","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setStableTokenExchangeLimits","inputs":[{"type":"string","name":"stableTokenRegistryId","internalType":"string"},{"type":"uint256","name":"minExchangeAmount","internalType":"uint256"},{"type":"uint256","name":"maxExchangeAmount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setVetoPeriodSeconds","inputs":[{"type":"uint256","name":"newVetoPeriodSeconds","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"name":"spread","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"minExchangeAmount","internalType":"uint256"},{"type":"uint256","name":"maxExchangeAmount","internalType":"uint256"}],"name":"stableTokenExchangeLimits","inputs":[{"type":"string","name":"","internalType":"string"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"vetoPeriodSeconds","inputs":[],"constant":true}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b5060405162004c8438038062004c84833981810160405260208110156200003757600080fd5b81019080805190602001909291905050508060006200005b6200012b60201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350806200011b576001600060146101000a81548160ff0219169083151502179055505b5060016002819055505062000133565b600033905090565b614b4180620001436000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80637b10399911610104578063be4c0d2c116100a2578063e33ddfc011610071578063e33ddfc0146109e2578063e7be36c814610a6f578063e7f6d98014610a9d578063f2fde38b14610abb576101da565b8063be4c0d2c1461082e578063c89f6e1714610904578063cb60cca014610932578063d13f90b414610960576101da565b8063a91ee0dc116100de578063a91ee0dc14610770578063aa853da4146107b4578063b66a261c146107d2578063b7430ab014610800576101da565b80637b103999146106ba5780638da5cb5b146107045780638f32d59b1461074e576101da565b80633ff9d6371161017c5780635c25c76c1161014b5780635c25c76c146105905780635eb8fc76146105ae578063715018a61461065157806371a1aea71461065b576101da565b80633ff9d637146104a557806344ca493a146104c357806349dc646a1461050557806354255be01461055d576101da565b8063158ef93e116101b8578063158ef93e1461032d5780631f4328b51461034f5780633156560e1461037d5780633b5b4f2c146103c1576101da565b8063049ecbd9146101df578063139fdcff1461020d578063141a8dd8146102e3575b600080fd5b61020b600480360360208110156101f557600080fd5b8101908080359060200190929190505050610aff565b005b6102c66004803603602081101561022357600080fd5b810190808035906020019064010000000081111561024057600080fd5b82018360208201111561025257600080fd5b8035906020019184600183028401116401000000008311171561027457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610c16565b604051808381526020018281526020019250505060405180910390f35b6102eb610d1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610335610d42565b604051808215151515815260200191505060405180910390f35b61037b6004803603602081101561036557600080fd5b8101908080359060200190929190505050610d55565b005b6103bf6004803603602081101561039357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d4565b005b6103ed600480360360208110156103d757600080fd5b81019080803590602001909291905050506111f5565b604051808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188600481111561046157fe5b60ff16815260200187151515158152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390f35b6104ad61129d565b6040518082815260200191505060405180910390f35b6104ef600480360360208110156104d957600080fd5b81019080803590602001909291905050506112a9565b6040518082815260200191505060405180910390f35b6105476004803603606081101561051b57600080fd5b8101908080359060200190929190803590602001909291908035151590602001909291905050506112ca565b6040518082815260200191505060405180910390f35b61056561136a565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b610598611390565b6040518082815260200191505060405180910390f35b61063b600480360360608110156105c457600080fd5b81019080803590602001906401000000008111156105e157600080fd5b8201836020820111156105f357600080fd5b8035906020019184600183028401116401000000008311171561061557600080fd5b90919293919293908035906020019092919080351515906020019092919050505061139c565b6040518082815260200191505060405180910390f35b610659611bfe565b005b610663611d37565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106a657808201518184015260208101905061068b565b505050509050019250505060405180910390f35b6106c2611e64565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61070c611e8a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610756611eb3565b604051808215151515815260200191505060405180910390f35b6107b26004803603602081101561078657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f11565b005b6107bc6120b5565b6040518082815260200191505060405180910390f35b6107fe600480360360208110156107e857600080fd5b81019080803590602001909291905050506120bb565b005b61082c6004803603602081101561081657600080fd5b810190808035906020019092919050505061220c565b005b6108e76004803603602081101561084457600080fd5b810190808035906020019064010000000081111561086157600080fd5b82018360208201111561087357600080fd5b8035906020019184600183028401116401000000008311171561089557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506122d8565b604051808381526020018281526020019250505060405180910390f35b6109306004803603602081101561091a57600080fd5b8101908080359060200190929190505050612312565b005b61095e6004803603602081101561094857600080fd5b810190808035906020019092919050505061288a565b005b6109e0600480360360a081101561097657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190505050613101565b005b610a6d600480360360608110156109f857600080fd5b8101908080359060200190640100000000811115610a1557600080fd5b820183602082011115610a2757600080fd5b80359060200191846001830284011164010000000083111715610a4957600080fd5b909192939192939080359060200190929190803590602001909291905050506131dc565b005b610a9b60048036036020811015610a8557600080fd5b810190808035906020019092919050505061337b565b005b610aa561357b565b6040518082815260200191505060405180910390f35b610afd60048036036020811015610ad157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613581565b005b610b07611eb3565b610b79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6224ea00811115610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614aec6021913960400191505060405180910390fd5b806006819055507f444fcf883d2258a54ed4f56fa23112232c0eef64dc4af5cab8c3dd7546a028b9816040518082815260200191505060405180910390a150565b600080610c21614844565b6007846040518082805190602001908083835b60208310610c575780518252602082019150602081019050602083039250610c34565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206040518060400160405290816000820154815260200160018201548152505090506000816020015111610d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806149b96030913960400191505060405180910390fd5b806000015181602001519250925050915091565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b600160026000828254019250508190555060006002549050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f53656e646572206d75737420626520617070726f76657200000000000000000081525060200191505060405180910390fd5b600060086000848152602001908152602001600020905060016004811115610e5457fe5b8160010160149054906101000a900460ff166004811115610e7157fe5b14610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061494f6022913960400191505060405180910390fd5b610ecf61485e565b610efc8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16613607565b9050610f0661485e565b610f138360040154613767565b9050610f1d61485e565b610f2561485e565b610f38838561378590919063ffffffff16565b610f43578284610f46565b83835b91509150610f5261485e565b610f7784610f69858561379a90919063ffffffff16565b61384190919063ffffffff16565b9050610fa260046040518060200160405290816000820154815250508261398a90919063ffffffff16565b610ff7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180614a45603b913960400191505060405180910390fd5b42866006018190555060028660010160146101000a81548160ff0219169083600481111561102157fe5b0217905550877f8b2b870c73325a932fadfc3f0d07358f8086320c6e6c27d36b5ea14d7c3d541360405160405180910390a250505050505060025481146110d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b6110dc611eb3565b61114e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fa03757d836cb0b61c0fbba2147f5d51d6071ff3dd5bf6963beb55563d64878e181604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160149054906101000a900460ff16908060010160159054906101000a900460ff16908060020154908060030154908060040154908060050154908060060154905089565b60048060000154905081565b600981815481106112b657fe5b906000526020600020016000915090505481565b60006112d461485e565b6112dd85613767565b9050826112f0576112ed816139a0565b90505b6112f861485e565b61134261130486613a52565b6113346005604051806020016040529081600082015481525050611326613adc565b61379a90919063ffffffff16565b613b0290919063ffffffff16565b905061135f61135a8284613b0290919063ffffffff16565b613f61565b925050509392505050565b600080600080600180600080839350829250819150809050935093509350935090919293565b60058060000154905081565b60006001600260008282540192505081905550600060025490506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638932cbf488886040518363ffffffff1660e01b815260040180806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050935050505060206040518083038186803b15801561145757600080fd5b505afa15801561146b573d6000803e3d6000fd5b505050506040513d602081101561148157600080fd5b8101908080519060200190929190505050905060006114a76114a283613607565b613f82565b905060006114b68288886112ca565b90506000806115088b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c16565b91509150600088611519578961151b565b835b905081811115801561152d5750828110155b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614a17602e913960400191505060405180910390fd5b505050600086611592578361159b565b61159a613f90565b5b90508073ffffffffffffffffffffffffffffffffffffffff166323b872dd33308b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561165857600080fd5b505af115801561166c573d6000803e3d6000fd5b505050506040513d602081101561168257600080fd5b8101908080519060200190929190505050611705576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5472616e7366657220696e206f662073656c6c20746f6b656e206661696c656481525060200191505060405180910390fd5b61171b6001600a5461408b90919063ffffffff16565b600a819055506000876117b9578473ffffffffffffffffffffffffffffffffffffffff166312c6c0998a6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561177957600080fd5b505afa15801561178d573d6000803e3d6000fd5b505050506040513d60208110156117a357600080fd5b81019080805190602001909291905050506117bb565b885b90506040518061012001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020016001600481111561180e57fe5b815260200189151581526020018281526020018481526020018581526020016006548152602001600081525060086000600a54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a81548160ff0219169083600481111561190157fe5b021790555060608201518160010160156101000a81548160ff0219169083151502179055506080820151816002015560a0820151816003015560c0820151816004015560e082015181600501556101008201518160060155905050611aab60086000600a548152602001908152602001600020604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff166004811115611a4a57fe5b6004811115611a5557fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b50506009600a5490806001815401808255809150509060018203906000526020600020016000909192909190915055503373ffffffffffffffffffffffffffffffffffffffff16600a547f988f3fd60d91f43c99361ce5de82a51999ffd3deda06baac9235df289bb7c6498d8d8d888e6040518080602001858152602001848152602001831515151581526020018281038252878782818152602001925080828437600081840152601f19601f820116905080830192505050965050505050505060405180910390a3600a54965050505050506002548114611bf5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50949350505050565b611c06611eb3565b611c78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606080600980549050604051908082528060200260200182016040528015611d6e5781602001602082028038833980820191505090505b50905060008090505b600980549050811015611e5c57600060098281548110611d9357fe5b9060005260206000200154905060016004811115611dad57fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff166004811115611ddc57fe5b1480611e21575060026004811115611df057fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff166004811115611e1f57fe5b145b15611e405780838381518110611e3357fe5b6020026020010181815250505b50611e5560018261408b90919063ffffffff16565b9050611d77565b508091505090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611ef56142af565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b611f19611eb3565b611f8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561202e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b600a5481565b6120c3611eb3565b612135576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612145612140613adc565b613f82565b8111156121ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f537072656164206d75737420626520736d616c6c6572207468616e203100000081525060200191505060405180910390fd5b6121c381613767565b6005600082015181600001559050507f8946f328efcc515b5cc3282f6cd95e87a6c0d3508421af0b52d4d3620b3e2db3816040518082815260200191505060405180910390a150565b612214611eb3565b612286576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61228f81613767565b6004600082015181600001559050507f64efcc8d6bb33e1eb5c31f8bec9ac8a42321a1fa36c6d831c759a6da5c2797f7816040518082815260200191505060405180910390a150565b6007818051602081018201805184825260208301602085012081835280955050505050506000915090508060000154908060010154905082565b60016002600082825401925050819055506000600254905060006008600084815260200190815260200160002090506001600481111561234e57fe5b8160010160149054906101000a900460ff16600481111561236b57fe5b141561243b573373ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612436576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f53656e646572206d7573742062652065786368616e676572000000000000000081525060200191505060405180910390fd5b61253c565b6002600481111561244857fe5b8160010160149054906101000a900460ff16600481111561246557fe5b14156124ea57612473611eb3565b6124e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f53656e646572206d757374206265206f776e657200000000000000000000000081525060200191505060405180910390fd5b61253b565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806149e9602e913960400191505060405180910390fd5b5b60048160010160146101000a81548160ff0219169083600481111561255d57fe5b02179055506000806126a083604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff16600481111561263f57fe5b600481111561264a57fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b915091508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561274f57600080fd5b505af1158015612763573d6000803e3d6000fd5b505050506040513d602081101561277957600080fd5b81019080805190602001909291905050506127df576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614ac96023913960400191505060405180910390fd5b847f80079243b2a36fa4656ef4ac30e5a3ebe1d048ca90b5b91cf3d597bf526dcaa760405160405180910390a25050506002548114612886576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b6001600260008282540192505081905550600060025490506000600860008481526020019081526020016000209050600260048111156128c657fe5b8160010160149054906101000a900460ff1660048111156128e357fe5b14612939576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806149716022913960400191505060405180910390fd5b426129558260050154836006015461408b90919063ffffffff16565b11156129c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5665746f20706572696f64206e6f7420656c617073656400000000000000000081525060200191505060405180910390fd5b60038160010160146101000a81548160ff021916908360048111156129ea57fe5b0217905550600080612b2d83604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff166004811115612acc57fe5b6004811115612ad757fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b915091508260010160159054906101000a900460ff1615612deb578173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb612b6c6142b7565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612bd657600080fd5b505af1158015612bea573d6000803e3d6000fd5b505050506040513d6020811015612c0057600080fd5b8101908080519060200190929190505050612c66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806149936026913960400191505060405180910390fd5b8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f198460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600301546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612d3957600080fd5b505af1158015612d4d573d6000803e3d6000fd5b505050506040513d6020811015612d6357600080fd5b8101908080519060200190929190505050612de6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f537461626c6520746f6b656e206d696e74206661696c6564000000000000000081525060200191505060405180910390fd5b613056565b8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612e6257600080fd5b505af1158015612e76573d6000803e3d6000fd5b505050506040513d6020811015612e8c57600080fd5b8101908080519060200190929190505050612f0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f537461626c6520746f6b656e206275726e206661696c6564000000000000000081525060200191505060405180910390fd5b612f176142b7565b73ffffffffffffffffffffffffffffffffffffffff166303a0fea38460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600301546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612fc557600080fd5b505af1158015612fd9573d6000803e3d6000fd5b505050506040513d6020811015612fef57600080fd5b8101908080519060200190929190505050613055576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180614a806028913960400191505060405180910390fd5b5b847f0b4c107dd8ed767c40dcc74867774b42e6987abba9874b97b9740d3bcb5c9ccb60405160405180910390a250505060025481146130fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b600060149054906101000a900460ff1615613184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff0219169083151502179055506131a8336143b2565b6131b185611f11565b6131ba846110d4565b6131c38361220c565b6131cc826120bb565b6131d581610aff565b5050505050565b6131e4611eb3565b613256576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b808211156132af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806148e96030913960400191505060405180910390fd5b60405180604001604052808381526020018281525060078585604051808383808284378083019250505092505050908152602001604051809103902060008201518160000155602082015181600101559050507f64b64d5a316c373e148f92eebf62bd8ce51e1c34b056eb81c7a4d1f0e47636668484848460405180806020018481526020018381526020018281038252868682818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a150505050565b60098054905081106133f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e646578206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b60006009828154811061340457fe5b906000526020600020015490506001600481111561341e57fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff16600481111561344d57fe5b1415801561349557506002600481111561346357fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff16600481111561349257fe5b14155b613507576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45786368616e67652070726f706f73616c206e6f7420696e616374697665000081525060200191505060405180910390fd5b600061352260016009805490506144f690919063ffffffff16565b905080831015613560576009818154811061353957fe5b90600052602060002001546009848154811061355157fe5b90600052602060002001819055505b60098054809190600190036135759190614871565b50505050565b60065481565b613589611eb3565b6135fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613604816143b2565b50565b61360f61485e565b60008061361a614540565b73ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561369557600080fd5b505afa1580156136a9573d6000803e3d6000fd5b505050506040513d60408110156136bf57600080fd5b81019080805190602001909291908051906020019092919050505080925081935050506000811161373b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614aa86021913960400191505060405180910390fd5b61375e61374782613767565b61375084613767565b61384190919063ffffffff16565b92505050919050565b61376f61485e565b6040518060200160405280838152509050919050565b60008160000151836000015110905092915050565b6137a261485e565b816000015183600001511015613820576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b61384961485e565b6000826000015114156138c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f63616e277420646976696465206279203000000000000000000000000000000081525060200191505060405180910390fd5b600069d3c21bcecceda10000008460000151029050836000015169d3c21bcecceda100000082816138f157fe5b0414613965576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6f766572666c6f7720617420646976696465000000000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808460000151838161397d57fe5b0481525091505092915050565b6000816000015183600001511115905092915050565b6139a861485e565b600082600001511415613a23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f63616e27742063616c6c207265636970726f63616c283029000000000000000081525060200191505060405180910390fd5b6040518060200160405280836000015169d3c21bcecceda1000000800281613a4757fe5b048152509050919050565b613a5a61485e565b613a6261463b565b821115613aba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806149196036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b613ae461485e565b604051806020016040528069d3c21bcecceda1000000815250905090565b613b0a61485e565b600083600001511480613b21575060008260000151145b15613b3d57604051806020016040528060008152509050613f5b565b69d3c21bcecceda100000082600001511415613b5b57829050613f5b565b69d3c21bcecceda100000083600001511415613b7957819050613f5b565b600069d3c21bcecceda1000000613b8f8561465a565b6000015181613b9a57fe5b0490506000613ba885614691565b600001519050600069d3c21bcecceda1000000613bc48661465a565b6000015181613bcf57fe5b0490506000613bdd86614691565b6000015190506000828502905060008514613c715782858281613bfc57fe5b0414613c70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda10000008202905060008214613d135769d3c21bcecceda1000000828281613c9e57fe5b0414613d12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b8091506000848602905060008614613da45784868281613d2f57fe5b0414613da3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6000848802905060008814613e325784888281613dbd57fe5b0414613e31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b613e3a6146ce565b8781613e4257fe5b049650613e4d6146ce565b8581613e5557fe5b0494506000858802905060008814613ee65785888281613e7157fe5b0414613ee5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b613eee61485e565b6040518060200160405280878152509050613f17816040518060200160405280878152506146db565b9050613f31816040518060200160405280868152506146db565b9050613f4b816040518060200160405280858152506146db565b9050809a50505050505050505050505b92915050565b600069d3c21bcecceda1000000826000015181613f7a57fe5b049050919050565b600081600001519050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561404b57600080fd5b505afa15801561405f573d6000803e3d6000fd5b505050506040513d602081101561407557600080fd5b8101908080519060200190929190505050905090565b600080828401905083811015614109576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000806000808460600151156141395761412b613f90565b9150846080015190506141d9565b6000856020015190508092508073ffffffffffffffffffffffffffffffffffffffff1663af31f58787608001516040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561419a57600080fd5b505afa1580156141ae573d6000803e3d6000fd5b505050506040513d60208110156141c457600080fd5b81019080805190602001909291905050509150505b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561425857600080fd5b505afa15801561426c573d6000803e3d6000fd5b505050506040513d602081101561428257600080fd5b81019080805190602001909291905050509050818110156142a1578091505b828294509450505050915091565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561437257600080fd5b505afa158015614386573d6000803e3d6000fd5b505050506040513d602081101561439c57600080fd5b8101908080519060200190929190505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806148c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600061453883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614784565b905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156145fb57600080fd5b505afa15801561460f573d6000803e3d6000fd5b505050506040513d602081101561462557600080fd5b8101908080519060200190929190505050905090565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b61466261485e565b604051806020016040528069d3c21bcecceda10000008085600001518161468557fe5b04028152509050919050565b61469961485e565b604051806020016040528069d3c21bcecceda1000000808560000151816146bc57fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b6146e361485e565b600082600001518460000151019050836000015181101561476c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b6000838311158290614831576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156147f65780820151818401526020810190506147db565b50505050905090810190601f1680156148235780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b81548183558181111561489857818360005260206000209182019101614897919061489d565b5b505050565b6148bf91905b808211156148bb5760008160009055506001016148a3565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d696e2065786368616e676520616d6f756e74206d757374206e6f742062652067726561746572207468616e206d617863616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282950726f706f73616c206d75737420626520696e2050726f706f73656420737461746550726f706f73616c206d75737420626520696e20417070726f7665642073746174655472616e73666572206f7574206f662043454c4f20746f2052657365727665206661696c65644d617820737461626c6520746f6b656e2065786368616e676520616d6f756e74206d75737420626520646566696e656450726f706f73616c206d75737420626520696e2050726f706f736564206f7220417070726f766564207374617465537461626c6520746f6b656e2065786368616e676520616d6f756e74206e6f742077697468696e206c696d69747343454c4f2065786368616e6765207261746520697320746f6f20646966666572656e742066726f6d207468652070726f706f7365642070726963655472616e73666572206f7574206f662043454c4f2066726f6d2052657365727665206661696c65644e6f206f7261636c652072617465732070726573656e7420666f7220746f6b656e5472616e73666572206f7574206f6620726566756e6420746f6b656e206661696c65645665746f20706572696f642063616e6e6f74206578636565642034207765656b73a265627a7a723158201edbd5b94be98fb71917cb916ebf5822420cc43f975b249e0cfe669c046a796364736f6c634300050d00320000000000000000000000000000000000000000000000000000000000000000

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80637b10399911610104578063be4c0d2c116100a2578063e33ddfc011610071578063e33ddfc0146109e2578063e7be36c814610a6f578063e7f6d98014610a9d578063f2fde38b14610abb576101da565b8063be4c0d2c1461082e578063c89f6e1714610904578063cb60cca014610932578063d13f90b414610960576101da565b8063a91ee0dc116100de578063a91ee0dc14610770578063aa853da4146107b4578063b66a261c146107d2578063b7430ab014610800576101da565b80637b103999146106ba5780638da5cb5b146107045780638f32d59b1461074e576101da565b80633ff9d6371161017c5780635c25c76c1161014b5780635c25c76c146105905780635eb8fc76146105ae578063715018a61461065157806371a1aea71461065b576101da565b80633ff9d637146104a557806344ca493a146104c357806349dc646a1461050557806354255be01461055d576101da565b8063158ef93e116101b8578063158ef93e1461032d5780631f4328b51461034f5780633156560e1461037d5780633b5b4f2c146103c1576101da565b8063049ecbd9146101df578063139fdcff1461020d578063141a8dd8146102e3575b600080fd5b61020b600480360360208110156101f557600080fd5b8101908080359060200190929190505050610aff565b005b6102c66004803603602081101561022357600080fd5b810190808035906020019064010000000081111561024057600080fd5b82018360208201111561025257600080fd5b8035906020019184600183028401116401000000008311171561027457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610c16565b604051808381526020018281526020019250505060405180910390f35b6102eb610d1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610335610d42565b604051808215151515815260200191505060405180910390f35b61037b6004803603602081101561036557600080fd5b8101908080359060200190929190505050610d55565b005b6103bf6004803603602081101561039357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d4565b005b6103ed600480360360208110156103d757600080fd5b81019080803590602001909291905050506111f5565b604051808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188600481111561046157fe5b60ff16815260200187151515158152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390f35b6104ad61129d565b6040518082815260200191505060405180910390f35b6104ef600480360360208110156104d957600080fd5b81019080803590602001909291905050506112a9565b6040518082815260200191505060405180910390f35b6105476004803603606081101561051b57600080fd5b8101908080359060200190929190803590602001909291908035151590602001909291905050506112ca565b6040518082815260200191505060405180910390f35b61056561136a565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b610598611390565b6040518082815260200191505060405180910390f35b61063b600480360360608110156105c457600080fd5b81019080803590602001906401000000008111156105e157600080fd5b8201836020820111156105f357600080fd5b8035906020019184600183028401116401000000008311171561061557600080fd5b90919293919293908035906020019092919080351515906020019092919050505061139c565b6040518082815260200191505060405180910390f35b610659611bfe565b005b610663611d37565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106a657808201518184015260208101905061068b565b505050509050019250505060405180910390f35b6106c2611e64565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61070c611e8a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610756611eb3565b604051808215151515815260200191505060405180910390f35b6107b26004803603602081101561078657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f11565b005b6107bc6120b5565b6040518082815260200191505060405180910390f35b6107fe600480360360208110156107e857600080fd5b81019080803590602001909291905050506120bb565b005b61082c6004803603602081101561081657600080fd5b810190808035906020019092919050505061220c565b005b6108e76004803603602081101561084457600080fd5b810190808035906020019064010000000081111561086157600080fd5b82018360208201111561087357600080fd5b8035906020019184600183028401116401000000008311171561089557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506122d8565b604051808381526020018281526020019250505060405180910390f35b6109306004803603602081101561091a57600080fd5b8101908080359060200190929190505050612312565b005b61095e6004803603602081101561094857600080fd5b810190808035906020019092919050505061288a565b005b6109e0600480360360a081101561097657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190505050613101565b005b610a6d600480360360608110156109f857600080fd5b8101908080359060200190640100000000811115610a1557600080fd5b820183602082011115610a2757600080fd5b80359060200191846001830284011164010000000083111715610a4957600080fd5b909192939192939080359060200190929190803590602001909291905050506131dc565b005b610a9b60048036036020811015610a8557600080fd5b810190808035906020019092919050505061337b565b005b610aa561357b565b6040518082815260200191505060405180910390f35b610afd60048036036020811015610ad157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613581565b005b610b07611eb3565b610b79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6224ea00811115610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614aec6021913960400191505060405180910390fd5b806006819055507f444fcf883d2258a54ed4f56fa23112232c0eef64dc4af5cab8c3dd7546a028b9816040518082815260200191505060405180910390a150565b600080610c21614844565b6007846040518082805190602001908083835b60208310610c575780518252602082019150602081019050602083039250610c34565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206040518060400160405290816000820154815260200160018201548152505090506000816020015111610d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806149b96030913960400191505060405180910390fd5b806000015181602001519250925050915091565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b600160026000828254019250508190555060006002549050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f53656e646572206d75737420626520617070726f76657200000000000000000081525060200191505060405180910390fd5b600060086000848152602001908152602001600020905060016004811115610e5457fe5b8160010160149054906101000a900460ff166004811115610e7157fe5b14610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061494f6022913960400191505060405180910390fd5b610ecf61485e565b610efc8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16613607565b9050610f0661485e565b610f138360040154613767565b9050610f1d61485e565b610f2561485e565b610f38838561378590919063ffffffff16565b610f43578284610f46565b83835b91509150610f5261485e565b610f7784610f69858561379a90919063ffffffff16565b61384190919063ffffffff16565b9050610fa260046040518060200160405290816000820154815250508261398a90919063ffffffff16565b610ff7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180614a45603b913960400191505060405180910390fd5b42866006018190555060028660010160146101000a81548160ff0219169083600481111561102157fe5b0217905550877f8b2b870c73325a932fadfc3f0d07358f8086320c6e6c27d36b5ea14d7c3d541360405160405180910390a250505050505060025481146110d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b6110dc611eb3565b61114e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fa03757d836cb0b61c0fbba2147f5d51d6071ff3dd5bf6963beb55563d64878e181604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160149054906101000a900460ff16908060010160159054906101000a900460ff16908060020154908060030154908060040154908060050154908060060154905089565b60048060000154905081565b600981815481106112b657fe5b906000526020600020016000915090505481565b60006112d461485e565b6112dd85613767565b9050826112f0576112ed816139a0565b90505b6112f861485e565b61134261130486613a52565b6113346005604051806020016040529081600082015481525050611326613adc565b61379a90919063ffffffff16565b613b0290919063ffffffff16565b905061135f61135a8284613b0290919063ffffffff16565b613f61565b925050509392505050565b600080600080600180600080839350829250819150809050935093509350935090919293565b60058060000154905081565b60006001600260008282540192505081905550600060025490506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638932cbf488886040518363ffffffff1660e01b815260040180806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050935050505060206040518083038186803b15801561145757600080fd5b505afa15801561146b573d6000803e3d6000fd5b505050506040513d602081101561148157600080fd5b8101908080519060200190929190505050905060006114a76114a283613607565b613f82565b905060006114b68288886112ca565b90506000806115088b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c16565b91509150600088611519578961151b565b835b905081811115801561152d5750828110155b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614a17602e913960400191505060405180910390fd5b505050600086611592578361159b565b61159a613f90565b5b90508073ffffffffffffffffffffffffffffffffffffffff166323b872dd33308b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561165857600080fd5b505af115801561166c573d6000803e3d6000fd5b505050506040513d602081101561168257600080fd5b8101908080519060200190929190505050611705576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5472616e7366657220696e206f662073656c6c20746f6b656e206661696c656481525060200191505060405180910390fd5b61171b6001600a5461408b90919063ffffffff16565b600a819055506000876117b9578473ffffffffffffffffffffffffffffffffffffffff166312c6c0998a6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561177957600080fd5b505afa15801561178d573d6000803e3d6000fd5b505050506040513d60208110156117a357600080fd5b81019080805190602001909291905050506117bb565b885b90506040518061012001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020016001600481111561180e57fe5b815260200189151581526020018281526020018481526020018581526020016006548152602001600081525060086000600a54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a81548160ff0219169083600481111561190157fe5b021790555060608201518160010160156101000a81548160ff0219169083151502179055506080820151816002015560a0820151816003015560c0820151816004015560e082015181600501556101008201518160060155905050611aab60086000600a548152602001908152602001600020604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff166004811115611a4a57fe5b6004811115611a5557fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b50506009600a5490806001815401808255809150509060018203906000526020600020016000909192909190915055503373ffffffffffffffffffffffffffffffffffffffff16600a547f988f3fd60d91f43c99361ce5de82a51999ffd3deda06baac9235df289bb7c6498d8d8d888e6040518080602001858152602001848152602001831515151581526020018281038252878782818152602001925080828437600081840152601f19601f820116905080830192505050965050505050505060405180910390a3600a54965050505050506002548114611bf5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50949350505050565b611c06611eb3565b611c78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606080600980549050604051908082528060200260200182016040528015611d6e5781602001602082028038833980820191505090505b50905060008090505b600980549050811015611e5c57600060098281548110611d9357fe5b9060005260206000200154905060016004811115611dad57fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff166004811115611ddc57fe5b1480611e21575060026004811115611df057fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff166004811115611e1f57fe5b145b15611e405780838381518110611e3357fe5b6020026020010181815250505b50611e5560018261408b90919063ffffffff16565b9050611d77565b508091505090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611ef56142af565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b611f19611eb3565b611f8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561202e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b600a5481565b6120c3611eb3565b612135576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612145612140613adc565b613f82565b8111156121ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f537072656164206d75737420626520736d616c6c6572207468616e203100000081525060200191505060405180910390fd5b6121c381613767565b6005600082015181600001559050507f8946f328efcc515b5cc3282f6cd95e87a6c0d3508421af0b52d4d3620b3e2db3816040518082815260200191505060405180910390a150565b612214611eb3565b612286576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61228f81613767565b6004600082015181600001559050507f64efcc8d6bb33e1eb5c31f8bec9ac8a42321a1fa36c6d831c759a6da5c2797f7816040518082815260200191505060405180910390a150565b6007818051602081018201805184825260208301602085012081835280955050505050506000915090508060000154908060010154905082565b60016002600082825401925050819055506000600254905060006008600084815260200190815260200160002090506001600481111561234e57fe5b8160010160149054906101000a900460ff16600481111561236b57fe5b141561243b573373ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612436576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f53656e646572206d7573742062652065786368616e676572000000000000000081525060200191505060405180910390fd5b61253c565b6002600481111561244857fe5b8160010160149054906101000a900460ff16600481111561246557fe5b14156124ea57612473611eb3565b6124e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f53656e646572206d757374206265206f776e657200000000000000000000000081525060200191505060405180910390fd5b61253b565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806149e9602e913960400191505060405180910390fd5b5b60048160010160146101000a81548160ff0219169083600481111561255d57fe5b02179055506000806126a083604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff16600481111561263f57fe5b600481111561264a57fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b915091508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561274f57600080fd5b505af1158015612763573d6000803e3d6000fd5b505050506040513d602081101561277957600080fd5b81019080805190602001909291905050506127df576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614ac96023913960400191505060405180910390fd5b847f80079243b2a36fa4656ef4ac30e5a3ebe1d048ca90b5b91cf3d597bf526dcaa760405160405180910390a25050506002548114612886576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b6001600260008282540192505081905550600060025490506000600860008481526020019081526020016000209050600260048111156128c657fe5b8160010160149054906101000a900460ff1660048111156128e357fe5b14612939576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806149716022913960400191505060405180910390fd5b426129558260050154836006015461408b90919063ffffffff16565b11156129c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5665746f20706572696f64206e6f7420656c617073656400000000000000000081525060200191505060405180910390fd5b60038160010160146101000a81548160ff021916908360048111156129ea57fe5b0217905550600080612b2d83604051806101200160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff166004811115612acc57fe5b6004811115612ad757fe5b81526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050614113565b915091508260010160159054906101000a900460ff1615612deb578173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb612b6c6142b7565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612bd657600080fd5b505af1158015612bea573d6000803e3d6000fd5b505050506040513d6020811015612c0057600080fd5b8101908080519060200190929190505050612c66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806149936026913960400191505060405180910390fd5b8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f198460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600301546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612d3957600080fd5b505af1158015612d4d573d6000803e3d6000fd5b505050506040513d6020811015612d6357600080fd5b8101908080519060200190929190505050612de6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f537461626c6520746f6b656e206d696e74206661696c6564000000000000000081525060200191505060405180910390fd5b613056565b8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612e6257600080fd5b505af1158015612e76573d6000803e3d6000fd5b505050506040513d6020811015612e8c57600080fd5b8101908080519060200190929190505050612f0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f537461626c6520746f6b656e206275726e206661696c6564000000000000000081525060200191505060405180910390fd5b612f176142b7565b73ffffffffffffffffffffffffffffffffffffffff166303a0fea38460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600301546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612fc557600080fd5b505af1158015612fd9573d6000803e3d6000fd5b505050506040513d6020811015612fef57600080fd5b8101908080519060200190929190505050613055576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180614a806028913960400191505060405180910390fd5b5b847f0b4c107dd8ed767c40dcc74867774b42e6987abba9874b97b9740d3bcb5c9ccb60405160405180910390a250505060025481146130fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050565b600060149054906101000a900460ff1615613184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff0219169083151502179055506131a8336143b2565b6131b185611f11565b6131ba846110d4565b6131c38361220c565b6131cc826120bb565b6131d581610aff565b5050505050565b6131e4611eb3565b613256576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b808211156132af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806148e96030913960400191505060405180910390fd5b60405180604001604052808381526020018281525060078585604051808383808284378083019250505092505050908152602001604051809103902060008201518160000155602082015181600101559050507f64b64d5a316c373e148f92eebf62bd8ce51e1c34b056eb81c7a4d1f0e47636668484848460405180806020018481526020018381526020018281038252868682818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a150505050565b60098054905081106133f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e646578206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b60006009828154811061340457fe5b906000526020600020015490506001600481111561341e57fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff16600481111561344d57fe5b1415801561349557506002600481111561346357fe5b6008600083815260200190815260200160002060010160149054906101000a900460ff16600481111561349257fe5b14155b613507576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45786368616e67652070726f706f73616c206e6f7420696e616374697665000081525060200191505060405180910390fd5b600061352260016009805490506144f690919063ffffffff16565b905080831015613560576009818154811061353957fe5b90600052602060002001546009848154811061355157fe5b90600052602060002001819055505b60098054809190600190036135759190614871565b50505050565b60065481565b613589611eb3565b6135fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613604816143b2565b50565b61360f61485e565b60008061361a614540565b73ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561369557600080fd5b505afa1580156136a9573d6000803e3d6000fd5b505050506040513d60408110156136bf57600080fd5b81019080805190602001909291908051906020019092919050505080925081935050506000811161373b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614aa86021913960400191505060405180910390fd5b61375e61374782613767565b61375084613767565b61384190919063ffffffff16565b92505050919050565b61376f61485e565b6040518060200160405280838152509050919050565b60008160000151836000015110905092915050565b6137a261485e565b816000015183600001511015613820576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b61384961485e565b6000826000015114156138c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f63616e277420646976696465206279203000000000000000000000000000000081525060200191505060405180910390fd5b600069d3c21bcecceda10000008460000151029050836000015169d3c21bcecceda100000082816138f157fe5b0414613965576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6f766572666c6f7720617420646976696465000000000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808460000151838161397d57fe5b0481525091505092915050565b6000816000015183600001511115905092915050565b6139a861485e565b600082600001511415613a23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f63616e27742063616c6c207265636970726f63616c283029000000000000000081525060200191505060405180910390fd5b6040518060200160405280836000015169d3c21bcecceda1000000800281613a4757fe5b048152509050919050565b613a5a61485e565b613a6261463b565b821115613aba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806149196036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b613ae461485e565b604051806020016040528069d3c21bcecceda1000000815250905090565b613b0a61485e565b600083600001511480613b21575060008260000151145b15613b3d57604051806020016040528060008152509050613f5b565b69d3c21bcecceda100000082600001511415613b5b57829050613f5b565b69d3c21bcecceda100000083600001511415613b7957819050613f5b565b600069d3c21bcecceda1000000613b8f8561465a565b6000015181613b9a57fe5b0490506000613ba885614691565b600001519050600069d3c21bcecceda1000000613bc48661465a565b6000015181613bcf57fe5b0490506000613bdd86614691565b6000015190506000828502905060008514613c715782858281613bfc57fe5b0414613c70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda10000008202905060008214613d135769d3c21bcecceda1000000828281613c9e57fe5b0414613d12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b8091506000848602905060008614613da45784868281613d2f57fe5b0414613da3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6000848802905060008814613e325784888281613dbd57fe5b0414613e31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b613e3a6146ce565b8781613e4257fe5b049650613e4d6146ce565b8581613e5557fe5b0494506000858802905060008814613ee65785888281613e7157fe5b0414613ee5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b613eee61485e565b6040518060200160405280878152509050613f17816040518060200160405280878152506146db565b9050613f31816040518060200160405280868152506146db565b9050613f4b816040518060200160405280858152506146db565b9050809a50505050505050505050505b92915050565b600069d3c21bcecceda1000000826000015181613f7a57fe5b049050919050565b600081600001519050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561404b57600080fd5b505afa15801561405f573d6000803e3d6000fd5b505050506040513d602081101561407557600080fd5b8101908080519060200190929190505050905090565b600080828401905083811015614109576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000806000808460600151156141395761412b613f90565b9150846080015190506141d9565b6000856020015190508092508073ffffffffffffffffffffffffffffffffffffffff1663af31f58787608001516040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561419a57600080fd5b505afa1580156141ae573d6000803e3d6000fd5b505050506040513d60208110156141c457600080fd5b81019080805190602001909291905050509150505b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561425857600080fd5b505afa15801561426c573d6000803e3d6000fd5b505050506040513d602081101561428257600080fd5b81019080805190602001909291905050509050818110156142a1578091505b828294509450505050915091565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561437257600080fd5b505afa158015614386573d6000803e3d6000fd5b505050506040513d602081101561439c57600080fd5b8101908080519060200190929190505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806148c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600061453883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614784565b905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156145fb57600080fd5b505afa15801561460f573d6000803e3d6000fd5b505050506040513d602081101561462557600080fd5b8101908080519060200190929190505050905090565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b61466261485e565b604051806020016040528069d3c21bcecceda10000008085600001518161468557fe5b04028152509050919050565b61469961485e565b604051806020016040528069d3c21bcecceda1000000808560000151816146bc57fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b6146e361485e565b600082600001518460000151019050836000015181101561476c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b6000838311158290614831576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156147f65780820151818401526020810190506147db565b50505050905090810190601f1680156148235780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b81548183558181111561489857818360005260206000209182019101614897919061489d565b5b505050565b6148bf91905b808211156148bb5760008160009055506001016148a3565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d696e2065786368616e676520616d6f756e74206d757374206e6f742062652067726561746572207468616e206d617863616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e65774669786564282950726f706f73616c206d75737420626520696e2050726f706f73656420737461746550726f706f73616c206d75737420626520696e20417070726f7665642073746174655472616e73666572206f7574206f662043454c4f20746f2052657365727665206661696c65644d617820737461626c6520746f6b656e2065786368616e676520616d6f756e74206d75737420626520646566696e656450726f706f73616c206d75737420626520696e2050726f706f736564206f7220417070726f766564207374617465537461626c6520746f6b656e2065786368616e676520616d6f756e74206e6f742077697468696e206c696d69747343454c4f2065786368616e6765207261746520697320746f6f20646966666572656e742066726f6d207468652070726f706f7365642070726963655472616e73666572206f7574206f662043454c4f2066726f6d2052657365727665206661696c65644e6f206f7261636c652072617465732070726573656e7420666f7220746f6b656e5472616e73666572206f7574206f6620726566756e6420746f6b656e206661696c65645665746f20706572696f642063616e6e6f74206578636565642034207765656b73a265627a7a723158201edbd5b94be98fb71917cb916ebf5822420cc43f975b249e0cfe669c046a796364736f6c634300050d0032