Address Details
contract

0x563BA8Ed56bd32a964831aB6AfF1E53238177eDA

Contract Name
EpochRewards
Creator
0xf3eb91–a79239 at 0xff0c6c–db4107
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
19045171
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
EpochRewards




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




EVM Version
istanbul




Verified at
2021-11-03T14:56:46.412878Z

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/EpochRewards.sol

pragma solidity ^0.5.13;

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

import "../common/CalledByVm.sol";
import "../common/FixidityLib.sol";
import "../common/Freezable.sol";
import "../common/Initializable.sol";
import "../common/UsingRegistry.sol";
import "../common/UsingPrecompiles.sol";
import "../common/interfaces/ICeloVersionedContract.sol";

/**
 * @title Contract for calculating epoch rewards.
 */
contract EpochRewards is
  ICeloVersionedContract,
  Ownable,
  Initializable,
  UsingPrecompiles,
  UsingRegistry,
  Freezable,
  CalledByVm
{
  using FixidityLib for FixidityLib.Fraction;
  using SafeMath for uint256;

  uint256 constant GENESIS_GOLD_SUPPLY = 600000000 ether; // 600 million Gold
  uint256 constant GOLD_SUPPLY_CAP = 1000000000 ether; // 1 billion Gold
  uint256 constant YEARS_LINEAR = 15;
  uint256 constant SECONDS_LINEAR = YEARS_LINEAR * 365 * 1 days;

  // This struct governs how the rewards multiplier should deviate from 1.0 based on the ratio of
  // supply remaining to target supply remaining.
  struct RewardsMultiplierAdjustmentFactors {
    FixidityLib.Fraction underspend;
    FixidityLib.Fraction overspend;
  }

  // This struct governs the multiplier on the target rewards to give out in a given epoch due to
  // potential deviations in the actual Gold total supply from the target total supply.
  // In the case where the actual exceeds the target (i.e. the protocol has "overspent" with
  // respect to epoch rewards and payments) the rewards multiplier will be less than one.
  // In the case where the actual is less than the target (i.e. the protocol has "underspent" with
  // respect to epoch rewards and payments) the rewards multiplier will be greater than one.
  struct RewardsMultiplierParameters {
    RewardsMultiplierAdjustmentFactors adjustmentFactors;
    // The maximum rewards multiplier.
    FixidityLib.Fraction max;
  }

  // This struct governs the target yield awarded to voters in validator elections.
  struct TargetVotingYieldParameters {
    // The target yield awarded to users voting in validator elections.
    FixidityLib.Fraction target;
    // Governs the adjustment of the target yield based on the deviation of the percentage of
    // Gold voting in validator elections from the `targetVotingGoldFraction`.
    FixidityLib.Fraction adjustmentFactor;
    // The maximum target yield awarded to users voting in validator elections.
    FixidityLib.Fraction max;
  }

  uint256 public startTime = 0;
  RewardsMultiplierParameters private rewardsMultiplierParams;
  TargetVotingYieldParameters private targetVotingYieldParams;
  FixidityLib.Fraction private targetVotingGoldFraction;
  FixidityLib.Fraction private communityRewardFraction;
  FixidityLib.Fraction private carbonOffsettingFraction;
  address public carbonOffsettingPartner;
  uint256 public targetValidatorEpochPayment;

  event TargetVotingGoldFractionSet(uint256 fraction);
  event CommunityRewardFractionSet(uint256 fraction);
  event CarbonOffsettingFundSet(address indexed partner, uint256 fraction);
  event TargetValidatorEpochPaymentSet(uint256 payment);
  event TargetVotingYieldParametersSet(uint256 max, uint256 adjustmentFactor);
  event TargetVotingYieldSet(uint256 target);
  event RewardsMultiplierParametersSet(
    uint256 max,
    uint256 underspendAdjustmentFactor,
    uint256 overspendAdjustmentFactor
  );

  event TargetVotingYieldUpdated(uint256 fraction);

  /**
  * @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, 1, 0);
  }

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

  /**
   * @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
   * @param registryAddress The address of the registry contract.
   * @param targetVotingYieldInitial The initial relative target block reward for voters.
   * @param targetVotingYieldMax The max relative target block reward for voters.
   * @param targetVotingYieldAdjustmentFactor The target block reward adjustment factor for voters.
   * @param rewardsMultiplierMax The max multiplier on target epoch rewards.
   * @param rewardsMultiplierUnderspendAdjustmentFactor Adjusts the multiplier on target epoch
   *   rewards when the protocol is running behind the target Gold supply.
   * @param rewardsMultiplierOverspendAdjustmentFactor Adjusts the multiplier on target epoch
   *   rewards when the protocol is running ahead of the target Gold supply.
   * @param _targetVotingGoldFraction The percentage of floating Gold voting to target.
   * @param _targetValidatorEpochPayment The target validator epoch payment.
   * @param _communityRewardFraction The percentage of rewards that go the community funds.
   * @param _carbonOffsettingPartner The address of the carbon offsetting partner.
   * @param _carbonOffsettingFraction The percentage of rewards going to carbon offsetting partner.
   * @dev Should be called only once.
   */
  function initialize(
    address registryAddress,
    uint256 targetVotingYieldInitial,
    uint256 targetVotingYieldMax,
    uint256 targetVotingYieldAdjustmentFactor,
    uint256 rewardsMultiplierMax,
    uint256 rewardsMultiplierUnderspendAdjustmentFactor,
    uint256 rewardsMultiplierOverspendAdjustmentFactor,
    uint256 _targetVotingGoldFraction,
    uint256 _targetValidatorEpochPayment,
    uint256 _communityRewardFraction,
    address _carbonOffsettingPartner,
    uint256 _carbonOffsettingFraction
  ) external initializer {
    _transferOwnership(msg.sender);
    setRegistry(registryAddress);
    setTargetVotingYieldParameters(targetVotingYieldMax, targetVotingYieldAdjustmentFactor);
    setRewardsMultiplierParameters(
      rewardsMultiplierMax,
      rewardsMultiplierUnderspendAdjustmentFactor,
      rewardsMultiplierOverspendAdjustmentFactor
    );
    setTargetVotingGoldFraction(_targetVotingGoldFraction);
    setTargetValidatorEpochPayment(_targetValidatorEpochPayment);
    setCommunityRewardFraction(_communityRewardFraction);
    setCarbonOffsettingFund(_carbonOffsettingPartner, _carbonOffsettingFraction);
    setTargetVotingYield(targetVotingYieldInitial);
    startTime = now;
  }

  /**
   * @notice Returns the target voting yield parameters.
   * @return The target, max, and adjustment factor for target voting yield.
   */
  function getTargetVotingYieldParameters() external view returns (uint256, uint256, uint256) {
    TargetVotingYieldParameters storage params = targetVotingYieldParams;
    return (params.target.unwrap(), params.max.unwrap(), params.adjustmentFactor.unwrap());
  }

  /**
   * @notice Returns the rewards multiplier parameters.
   * @return The max multiplier and under/over spend adjustment factors.
   */
  function getRewardsMultiplierParameters() external view returns (uint256, uint256, uint256) {
    RewardsMultiplierParameters storage params = rewardsMultiplierParams;
    return (
      params.max.unwrap(),
      params.adjustmentFactors.underspend.unwrap(),
      params.adjustmentFactors.overspend.unwrap()
    );
  }

  /**
   * @notice Sets the community reward percentage
   * @param value The percentage of the total reward to be sent to the community funds.
   * @return True upon success.
   */
  function setCommunityRewardFraction(uint256 value) public onlyOwner returns (bool) {
    require(
      value != communityRewardFraction.unwrap() && value < FixidityLib.fixed1().unwrap(),
      "Value must be different from existing community reward fraction and less than 1"
    );
    communityRewardFraction = FixidityLib.wrap(value);
    emit CommunityRewardFractionSet(value);
    return true;
  }

  /**
   * @notice Returns the community reward fraction.
   * @return The percentage of total reward which goes to the community funds.
   */
  function getCommunityRewardFraction() external view returns (uint256) {
    return communityRewardFraction.unwrap();
  }

  /**
   * @notice Sets the carbon offsetting fund.
   * @param partner The address of the carbon offsetting partner.
   * @param value The percentage of the total reward to be sent to the carbon offsetting partner.
   * @return True upon success.
   */
  function setCarbonOffsettingFund(address partner, uint256 value) public onlyOwner returns (bool) {
    require(
      partner != carbonOffsettingPartner || value != carbonOffsettingFraction.unwrap(),
      "Partner and value must be different from existing carbon offsetting fund"
    );
    require(value < FixidityLib.fixed1().unwrap(), "Value must be less than 1");
    carbonOffsettingPartner = partner;
    carbonOffsettingFraction = FixidityLib.wrap(value);
    emit CarbonOffsettingFundSet(partner, value);
    return true;
  }

  /**
   * @notice Returns the carbon offsetting partner reward fraction.
   * @return The percentage of total reward which goes to the carbon offsetting partner.
   */
  function getCarbonOffsettingFraction() external view returns (uint256) {
    return carbonOffsettingFraction.unwrap();
  }

  /**
   * @notice Sets the target voting Gold fraction.
   * @param value The percentage of floating Gold voting to target.
   * @return True upon success.
   */
  function setTargetVotingGoldFraction(uint256 value) public onlyOwner returns (bool) {
    require(value != targetVotingGoldFraction.unwrap(), "Target voting gold fraction unchanged");
    require(
      value < FixidityLib.fixed1().unwrap(),
      "Target voting gold fraction cannot be larger than 1"
    );
    targetVotingGoldFraction = FixidityLib.wrap(value);
    emit TargetVotingGoldFractionSet(value);
    return true;
  }

  /**
   * @notice Returns the target voting Gold fraction.
   * @return The percentage of floating Gold voting to target.
   */
  function getTargetVotingGoldFraction() external view returns (uint256) {
    return targetVotingGoldFraction.unwrap();
  }

  /**
   * @notice Sets the target per-epoch payment in Celo Dollars for validators.
   * @param value The value in Celo Dollars.
   * @return True upon success.
   */
  function setTargetValidatorEpochPayment(uint256 value) public onlyOwner returns (bool) {
    require(value != targetValidatorEpochPayment, "Target validator epoch payment unchanged");
    targetValidatorEpochPayment = value;
    emit TargetValidatorEpochPaymentSet(value);
    return true;
  }

  /**
   * @notice Sets the rewards multiplier parameters.
   * @param max The max multiplier on target epoch rewards.
   * @param underspendAdjustmentFactor Adjusts the multiplier on target epoch rewards when the
   *   protocol is running behind the target Gold supply.
   * @param overspendAdjustmentFactor Adjusts the multiplier on target epoch rewards when the
   *   protocol is running ahead of the target Gold supply.
   * @return True upon success.
   */
  function setRewardsMultiplierParameters(
    uint256 max,
    uint256 underspendAdjustmentFactor,
    uint256 overspendAdjustmentFactor
  ) public onlyOwner returns (bool) {
    require(
      max != rewardsMultiplierParams.max.unwrap() ||
        overspendAdjustmentFactor != rewardsMultiplierParams.adjustmentFactors.overspend.unwrap() ||
        underspendAdjustmentFactor != rewardsMultiplierParams.adjustmentFactors.underspend.unwrap(),
      "Bad rewards multiplier parameters"
    );
    rewardsMultiplierParams = RewardsMultiplierParameters(
      RewardsMultiplierAdjustmentFactors(
        FixidityLib.wrap(underspendAdjustmentFactor),
        FixidityLib.wrap(overspendAdjustmentFactor)
      ),
      FixidityLib.wrap(max)
    );
    emit RewardsMultiplierParametersSet(max, underspendAdjustmentFactor, overspendAdjustmentFactor);
    return true;
  }

  /**
   * @notice Sets the target voting yield parameters.
   * @param max The max relative target block reward for voters.
   * @param adjustmentFactor The target block reward adjustment factor for voters.
   * @return True upon success.
   */
  function setTargetVotingYieldParameters(uint256 max, uint256 adjustmentFactor)
    public
    onlyOwner
    returns (bool)
  {
    require(
      max != targetVotingYieldParams.max.unwrap() ||
        adjustmentFactor != targetVotingYieldParams.adjustmentFactor.unwrap(),
      "Bad target voting yield parameters"
    );
    targetVotingYieldParams.max = FixidityLib.wrap(max);
    targetVotingYieldParams.adjustmentFactor = FixidityLib.wrap(adjustmentFactor);
    require(
      targetVotingYieldParams.max.lt(FixidityLib.fixed1()),
      "Max target voting yield must be lower than 100%"
    );
    emit TargetVotingYieldParametersSet(max, adjustmentFactor);
    return true;
  }

  /**
   * @notice Sets the target voting yield.  Uses fixed point arithmetic
   * for protection against overflow.
   * @param targetVotingYield The relative target block reward for voters.
   * @return True upon success.
   */
  function setTargetVotingYield(uint256 targetVotingYield) public onlyOwner returns (bool) {
    FixidityLib.Fraction memory target = FixidityLib.wrap(targetVotingYield);
    require(
      target.lte(targetVotingYieldParams.max),
      "Target voting yield must be less than or equal to max"
    );
    targetVotingYieldParams.target = target;
    emit TargetVotingYieldSet(targetVotingYield);
    return true;
  }

  /**
   * @notice Returns the target Gold supply according to the epoch rewards target schedule.
   * @return The target Gold supply according to the epoch rewards target schedule.
   */
  function getTargetGoldTotalSupply() public view returns (uint256) {
    uint256 timeSinceInitialization = now.sub(startTime);
    if (timeSinceInitialization < SECONDS_LINEAR) {
      // Pay out half of all block rewards linearly.
      uint256 linearRewards = GOLD_SUPPLY_CAP.sub(GENESIS_GOLD_SUPPLY).div(2);
      uint256 targetRewards = linearRewards.mul(timeSinceInitialization).div(SECONDS_LINEAR);
      return targetRewards.add(GENESIS_GOLD_SUPPLY);
    } else {
      require(false, "Block reward calculation for years 15-30 unimplemented");
      return 0;
    }
  }

  /**
   * @notice Returns the rewards multiplier based on the current and target Gold supplies.
   * @param targetGoldSupplyIncrease The target increase in current Gold supply.
   * @return The rewards multiplier based on the current and target Gold supplies.
   */
  function _getRewardsMultiplier(uint256 targetGoldSupplyIncrease)
    internal
    view
    returns (FixidityLib.Fraction memory)
  {
    uint256 targetSupply = getTargetGoldTotalSupply();
    uint256 totalSupply = getGoldToken().totalSupply();
    uint256 remainingSupply = GOLD_SUPPLY_CAP.sub(totalSupply.add(targetGoldSupplyIncrease));
    uint256 targetRemainingSupply = GOLD_SUPPLY_CAP.sub(targetSupply);
    FixidityLib.Fraction memory remainingToTargetRatio = FixidityLib
      .newFixed(remainingSupply)
      .divide(FixidityLib.newFixed(targetRemainingSupply));
    if (remainingToTargetRatio.gt(FixidityLib.fixed1())) {
      FixidityLib.Fraction memory delta = remainingToTargetRatio
        .subtract(FixidityLib.fixed1())
        .multiply(rewardsMultiplierParams.adjustmentFactors.underspend);
      FixidityLib.Fraction memory multiplier = FixidityLib.fixed1().add(delta);
      if (multiplier.lt(rewardsMultiplierParams.max)) {
        return multiplier;
      } else {
        return rewardsMultiplierParams.max;
      }
    } else if (remainingToTargetRatio.lt(FixidityLib.fixed1())) {
      FixidityLib.Fraction memory delta = FixidityLib
        .fixed1()
        .subtract(remainingToTargetRatio)
        .multiply(rewardsMultiplierParams.adjustmentFactors.overspend);
      if (delta.lt(FixidityLib.fixed1())) {
        return FixidityLib.fixed1().subtract(delta);
      } else {
        return FixidityLib.wrap(0);
      }
    } else {
      return FixidityLib.fixed1();
    }
  }

  /**
   * @notice Returns the total target epoch rewards for voters.
   * @return the total target epoch rewards for voters.
   */
  function getTargetVoterRewards() public view returns (uint256) {
    return
      FixidityLib
        .newFixed(getElection().getActiveVotes())
        .multiply(targetVotingYieldParams.target)
        .fromFixed();
  }

  /**
   * @notice Returns the total target epoch payments to validators, converted to Gold.
   * @return The total target epoch payments to validators, converted to Gold.
   */
  function getTargetTotalEpochPaymentsInGold() public view returns (uint256) {
    address stableTokenAddress = registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID);
    (uint256 numerator, uint256 denominator) = getSortedOracles().medianRate(stableTokenAddress);
    return
      numberValidatorsInCurrentSet().mul(targetValidatorEpochPayment).mul(denominator).div(
        numerator
      );
  }

  /**
   * @notice Returns the target gold supply increase used in calculating the rewards multiplier.
   * @return The target increase in gold w/out the rewards multiplier.
   */
  function _getTargetGoldSupplyIncrease() internal view returns (uint256) {
    uint256 targetEpochRewards = getTargetVoterRewards();
    uint256 targetTotalEpochPaymentsInGold = getTargetTotalEpochPaymentsInGold();
    uint256 targetGoldSupplyIncrease = targetEpochRewards.add(targetTotalEpochPaymentsInGold);
    // increase /= (1 - fraction) st the final community reward is fraction * increase
    targetGoldSupplyIncrease = FixidityLib
      .newFixed(targetGoldSupplyIncrease)
      .divide(
      FixidityLib.newFixed(1).subtract(communityRewardFraction).subtract(carbonOffsettingFraction)
    )
      .fromFixed();
    return targetGoldSupplyIncrease;
  }

  /**
   * @notice Returns the rewards multiplier based on the current and target Gold supplies.
   * @return The rewards multiplier based on the current and target Gold supplies.
   */
  function getRewardsMultiplier() external view returns (uint256) {
    return _getRewardsMultiplier(_getTargetGoldSupplyIncrease()).unwrap();
  }

  /**
   * @notice Returns the fraction of floating Gold being used for voting in validator elections.
   * @return The fraction of floating Gold being used for voting in validator elections.
   */
  function getVotingGoldFraction() public view returns (uint256) {
    uint256 liquidGold = getGoldToken().totalSupply().sub(getReserve().getReserveGoldBalance());
    uint256 votingGold = getElection().getTotalVotes();
    return FixidityLib.newFixed(votingGold).divide(FixidityLib.newFixed(liquidGold)).unwrap();
  }

  /**
   * @notice Updates the target voting yield based on the difference between the target and current
   *   voting Gold fraction.
   */
  function _updateTargetVotingYield() internal onlyWhenNotFrozen {
    FixidityLib.Fraction memory votingGoldFraction = FixidityLib.wrap(getVotingGoldFraction());
    if (votingGoldFraction.gt(targetVotingGoldFraction)) {
      FixidityLib.Fraction memory votingGoldFractionDelta = votingGoldFraction.subtract(
        targetVotingGoldFraction
      );
      FixidityLib.Fraction memory targetVotingYieldDelta = votingGoldFractionDelta.multiply(
        targetVotingYieldParams.adjustmentFactor
      );
      if (targetVotingYieldDelta.gte(targetVotingYieldParams.target)) {
        targetVotingYieldParams.target = FixidityLib.newFixed(0);
      } else {
        targetVotingYieldParams.target = targetVotingYieldParams.target.subtract(
          targetVotingYieldDelta
        );
      }
    } else if (votingGoldFraction.lt(targetVotingGoldFraction)) {
      FixidityLib.Fraction memory votingGoldFractionDelta = targetVotingGoldFraction.subtract(
        votingGoldFraction
      );
      FixidityLib.Fraction memory targetVotingYieldDelta = votingGoldFractionDelta.multiply(
        targetVotingYieldParams.adjustmentFactor
      );
      targetVotingYieldParams.target = targetVotingYieldParams.target.add(targetVotingYieldDelta);
      if (targetVotingYieldParams.target.gt(targetVotingYieldParams.max)) {
        targetVotingYieldParams.target = targetVotingYieldParams.max;
      }
    }
    emit TargetVotingYieldUpdated(targetVotingYieldParams.target.unwrap());
  }

  /**
   * @notice Updates the target voting yield based on the difference between the target and current
   *   voting Gold fraction.
   * @dev Only called directly by the protocol.
   */
  function updateTargetVotingYield() external onlyVm onlyWhenNotFrozen {
    _updateTargetVotingYield();
  }

  /**
   * @notice Determines if the reserve is low enough to demand a diversion from
   *    the community reward. Targets initial critical ratio of 2 with a linear
   *    decline until 25 years have passed where the critical ratio will be 1.
   */
  function isReserveLow() external view returns (bool) {
    // critical reserve ratio = 2 - time in second / 25 years
    FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime));
    FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days);
    FixidityLib.Fraction memory b = FixidityLib.newFixed(2);
    FixidityLib.Fraction memory criticalRatio;
    // Don't let the critical reserve ratio go under 1 after 25 years.
    if (timeSinceInitialization.gte(m)) {
      criticalRatio = FixidityLib.fixed1();
    } else {
      criticalRatio = b.subtract(timeSinceInitialization.divide(m));
    }
    FixidityLib.Fraction memory ratio = FixidityLib.wrap(getReserve().getReserveRatio());
    return ratio.lte(criticalRatio);
  }

  /**
   * @notice Calculates the per validator epoch payment and the total rewards to voters.
   * @return The per validator epoch reward, the total rewards to voters, the total community
   * reward, and the total carbon offsetting partner reward.
   */
  function calculateTargetEpochRewards()
    external
    view
    returns (uint256, uint256, uint256, uint256)
  {
    uint256 targetVoterReward = getTargetVoterRewards();
    uint256 targetGoldSupplyIncrease = _getTargetGoldSupplyIncrease();
    FixidityLib.Fraction memory rewardsMultiplier = _getRewardsMultiplier(targetGoldSupplyIncrease);
    return (
      FixidityLib.newFixed(targetValidatorEpochPayment).multiply(rewardsMultiplier).fromFixed(),
      FixidityLib.newFixed(targetVoterReward).multiply(rewardsMultiplier).fromFixed(),
      FixidityLib
        .newFixed(targetGoldSupplyIncrease)
        .multiply(communityRewardFraction)
        .multiply(rewardsMultiplier)
        .fromFixed(),
      FixidityLib
        .newFixed(targetGoldSupplyIncrease)
        .multiply(carbonOffsettingFraction)
        .multiply(rewardsMultiplier)
        .fromFixed()
    );
  }
}
        

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/CalledByVm.sol

pragma solidity ^0.5.13;

contract CalledByVm {
  modifier onlyVm() {
    require(msg.sender == address(0), "Only VM can call");
    _;
  }
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/FixidityLib.sol

pragma solidity ^0.5.13;

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

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

  uint256 private constant FIXED1_UINT = 1000000000000000000000000;

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

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

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

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

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

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

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

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

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

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

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

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

  /**
   * @notice x*y. If any of the operators is higher than the max multiplier value it
   * might overflow.
   * @dev The maximum value that can be safely used as a multiplication operator
   * (maxFixedMul) is calculated as sqrt(maxUint256()*fixed1()),
   * or 340282366920938463463374607431768211455999999999999
   * Test multiply(0,0) returns 0
   * Test multiply(maxFixedMul,0) returns 0
   * Test multiply(0,maxFixedMul) returns 0
   * Test multiply(fixed1()/mulPrecision(),fixed1()*mulPrecision()) returns fixed1()
   * Test multiply(maxFixedMul,maxFixedMul) is around maxUint256()
   * Test multiply(maxFixedMul+1,maxFixedMul+1) fails
   */
  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());
  }
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/Freezable.sol

pragma solidity ^0.5.13;

import "./UsingRegistry.sol";

contract Freezable is UsingRegistry {
  // onlyWhenNotFrozen functions can only be called when `frozen` is false, otherwise they will
  // revert.
  modifier onlyWhenNotFrozen() {
    require(!getFreezer().isFrozen(address(this)), "can't call when contract is frozen");
    _;
  }
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/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;
    _;
  }
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/UsingPrecompiles.sol

pragma solidity ^0.5.13;

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

contract UsingPrecompiles {
  using SafeMath for uint256;

  address constant TRANSFER = address(0xff - 2);
  address constant FRACTION_MUL = address(0xff - 3);
  address constant PROOF_OF_POSSESSION = address(0xff - 4);
  address constant GET_VALIDATOR = address(0xff - 5);
  address constant NUMBER_VALIDATORS = address(0xff - 6);
  address constant EPOCH_SIZE = address(0xff - 7);
  address constant BLOCK_NUMBER_FROM_HEADER = address(0xff - 8);
  address constant HASH_HEADER = address(0xff - 9);
  address constant GET_PARENT_SEAL_BITMAP = address(0xff - 10);
  address constant GET_VERIFIED_SEAL_BITMAP = address(0xff - 11);

  /**
   * @notice calculate a * b^x for fractions a, b to `decimals` precision
   * @param aNumerator Numerator of first fraction
   * @param aDenominator Denominator of first fraction
   * @param bNumerator Numerator of exponentiated fraction
   * @param bDenominator Denominator of exponentiated fraction
   * @param exponent exponent to raise b to
   * @param _decimals precision
   * @return numerator/denominator of the computed quantity (not reduced).
   */
  function fractionMulExp(
    uint256 aNumerator,
    uint256 aDenominator,
    uint256 bNumerator,
    uint256 bDenominator,
    uint256 exponent,
    uint256 _decimals
  ) public view returns (uint256, uint256) {
    require(aDenominator != 0 && bDenominator != 0, "a denominator is zero");
    uint256 returnNumerator;
    uint256 returnDenominator;
    bool success;
    bytes memory out;
    (success, out) = FRACTION_MUL.staticcall(
      abi.encodePacked(aNumerator, aDenominator, bNumerator, bDenominator, exponent, _decimals)
    );
    require(success, "error calling fractionMulExp precompile");
    returnNumerator = getUint256FromBytes(out, 0);
    returnDenominator = getUint256FromBytes(out, 32);
    return (returnNumerator, returnDenominator);
  }

  /**
   * @notice Returns the current epoch size in blocks.
   * @return The current epoch size in blocks.
   */
  function getEpochSize() public view returns (uint256) {
    bytes memory out;
    bool success;
    (success, out) = EPOCH_SIZE.staticcall(abi.encodePacked());
    require(success, "error calling getEpochSize precompile");
    return getUint256FromBytes(out, 0);
  }

  /**
   * @notice Returns the epoch number at a block.
   * @param blockNumber Block number where epoch number is calculated.
   * @return Epoch number.
   */
  function getEpochNumberOfBlock(uint256 blockNumber) public view returns (uint256) {
    return epochNumberOfBlock(blockNumber, getEpochSize());
  }

  /**
   * @notice Returns the epoch number at a block.
   * @return Current epoch number.
   */
  function getEpochNumber() public view returns (uint256) {
    return getEpochNumberOfBlock(block.number);
  }

  /**
   * @notice Returns the epoch number at a block.
   * @param blockNumber Block number where epoch number is calculated.
   * @param epochSize The epoch size in blocks.
   * @return Epoch number.
   */
  function epochNumberOfBlock(uint256 blockNumber, uint256 epochSize)
    internal
    pure
    returns (uint256)
  {
    // Follows GetEpochNumber from celo-blockchain/blob/master/consensus/istanbul/utils.go
    uint256 epochNumber = blockNumber / epochSize;
    if (blockNumber % epochSize == 0) {
      return epochNumber;
    } else {
      return epochNumber.add(1);
    }
  }

  /**
   * @notice Gets a validator address from the current validator set.
   * @param index Index of requested validator in the validator set.
   * @return Address of validator at the requested index.
   */
  function validatorSignerAddressFromCurrentSet(uint256 index) public view returns (address) {
    bytes memory out;
    bool success;
    (success, out) = GET_VALIDATOR.staticcall(abi.encodePacked(index, uint256(block.number)));
    require(success, "error calling validatorSignerAddressFromCurrentSet precompile");
    return address(getUint256FromBytes(out, 0));
  }

  /**
   * @notice Gets a validator address from the validator set at the given block number.
   * @param index Index of requested validator in the validator set.
   * @param blockNumber Block number to retrieve the validator set from.
   * @return Address of validator at the requested index.
   */
  function validatorSignerAddressFromSet(uint256 index, uint256 blockNumber)
    public
    view
    returns (address)
  {
    bytes memory out;
    bool success;
    (success, out) = GET_VALIDATOR.staticcall(abi.encodePacked(index, blockNumber));
    require(success, "error calling validatorSignerAddressFromSet precompile");
    return address(getUint256FromBytes(out, 0));
  }

  /**
   * @notice Gets the size of the current elected validator set.
   * @return Size of the current elected validator set.
   */
  function numberValidatorsInCurrentSet() public view returns (uint256) {
    bytes memory out;
    bool success;
    (success, out) = NUMBER_VALIDATORS.staticcall(abi.encodePacked(uint256(block.number)));
    require(success, "error calling numberValidatorsInCurrentSet precompile");
    return getUint256FromBytes(out, 0);
  }

  /**
   * @notice Gets the size of the validator set that must sign the given block number.
   * @param blockNumber Block number to retrieve the validator set from.
   * @return Size of the validator set.
   */
  function numberValidatorsInSet(uint256 blockNumber) public view returns (uint256) {
    bytes memory out;
    bool success;
    (success, out) = NUMBER_VALIDATORS.staticcall(abi.encodePacked(blockNumber));
    require(success, "error calling numberValidatorsInSet precompile");
    return getUint256FromBytes(out, 0);
  }

  /**
   * @notice Checks a BLS proof of possession.
   * @param sender The address signed by the BLS key to generate the proof of possession.
   * @param blsKey The BLS public key that the validator is using for consensus, should pass proof
   *   of possession. 48 bytes.
   * @param blsPop The BLS public key proof-of-possession, which consists of a signature on the
   *   account address. 96 bytes.
   * @return True upon success.
   */
  function checkProofOfPossession(address sender, bytes memory blsKey, bytes memory blsPop)
    public
    view
    returns (bool)
  {
    bool success;
    (success, ) = PROOF_OF_POSSESSION.staticcall(abi.encodePacked(sender, blsKey, blsPop));
    return success;
  }

  /**
   * @notice Parses block number out of header.
   * @param header RLP encoded header
   * @return Block number.
   */
  function getBlockNumberFromHeader(bytes memory header) public view returns (uint256) {
    bytes memory out;
    bool success;
    (success, out) = BLOCK_NUMBER_FROM_HEADER.staticcall(abi.encodePacked(header));
    require(success, "error calling getBlockNumberFromHeader precompile");
    return getUint256FromBytes(out, 0);
  }

  /**
   * @notice Computes hash of header.
   * @param header RLP encoded header
   * @return Header hash.
   */
  function hashHeader(bytes memory header) public view returns (bytes32) {
    bytes memory out;
    bool success;
    (success, out) = HASH_HEADER.staticcall(abi.encodePacked(header));
    require(success, "error calling hashHeader precompile");
    return getBytes32FromBytes(out, 0);
  }

  /**
   * @notice Gets the parent seal bitmap from the header at the given block number.
   * @param blockNumber Block number to retrieve. Must be within 4 epochs of the current number.
   * @return Bitmap parent seal with set bits at indices corresponding to signing validators.
   */
  function getParentSealBitmap(uint256 blockNumber) public view returns (bytes32) {
    bytes memory out;
    bool success;
    (success, out) = GET_PARENT_SEAL_BITMAP.staticcall(abi.encodePacked(blockNumber));
    require(success, "error calling getParentSealBitmap precompile");
    return getBytes32FromBytes(out, 0);
  }

  /**
   * @notice Verifies the BLS signature on the header and returns the seal bitmap.
   * The validator set used for verification is retrieved based on the parent hash field of the
   * header.  If the parent hash is not in the blockchain, verification fails.
   * @param header RLP encoded header
   * @return Bitmap parent seal with set bits at indices correspoinding to signing validators.
   */
  function getVerifiedSealBitmapFromHeader(bytes memory header) public view returns (bytes32) {
    bytes memory out;
    bool success;
    (success, out) = GET_VERIFIED_SEAL_BITMAP.staticcall(abi.encodePacked(header));
    require(success, "error calling getVerifiedSealBitmapFromHeader precompile");
    return getBytes32FromBytes(out, 0);
  }

  /**
   * @notice Converts bytes to uint256.
   * @param bs byte[] data
   * @param start offset into byte data to convert
   * @return uint256 data
   */
  function getUint256FromBytes(bytes memory bs, uint256 start) internal pure returns (uint256) {
    return uint256(getBytes32FromBytes(bs, start));
  }

  /**
   * @notice Converts bytes to bytes32.
   * @param bs byte[] data
   * @param start offset into byte data to convert
   * @return bytes32 data
   */
  function getBytes32FromBytes(bytes memory bs, uint256 start) internal pure returns (bytes32) {
    require(bs.length >= start.add(32), "slicing out of range");
    bytes32 x;
    assembly {
      x := mload(add(bs, add(start, 32)))
    }
    return x;
  }

  /**
   * @notice Returns the minimum number of required signers for a given block number.
   * @dev Computed in celo-blockchain as int(math.Ceil(float64(2*valSet.Size()) / 3))
   */
  function minQuorumSize(uint256 blockNumber) public view returns (uint256) {
    return numberValidatorsInSet(blockNumber).mul(2).add(2).div(3);
  }

  /**
   * @notice Computes byzantine quorum from current validator set size
   * @return Byzantine quorum of validators.
   */
  function minQuorumSizeInCurrentSet() public view returns (uint256) {
    return minQuorumSize(block.number);
  }

}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/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));
  }
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IFeeCurrencyWhitelist.sol

pragma solidity ^0.5.13;

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

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IFreezer.sol

pragma solidity ^0.5.13;

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

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/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;
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/IGovernance.sol

pragma solidity ^0.5.13;

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

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/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;

}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/identity/interfaces/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;
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/identity/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/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;
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/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);
}
          

/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/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);
}
          

/openzeppelin-solidity/contracts/GSN/Context.sol

pragma solidity ^0.5.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

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

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

/openzeppelin-solidity/contracts/math/SafeMath.sol

pragma solidity ^0.5.0;

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

/openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

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

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

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

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

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

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

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

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

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

/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol

pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"CarbonOffsettingFundSet","inputs":[{"type":"address","name":"partner","internalType":"address","indexed":true},{"type":"uint256","name":"fraction","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CommunityRewardFractionSet","inputs":[{"type":"uint256","name":"fraction","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":"RewardsMultiplierParametersSet","inputs":[{"type":"uint256","name":"max","internalType":"uint256","indexed":false},{"type":"uint256","name":"underspendAdjustmentFactor","internalType":"uint256","indexed":false},{"type":"uint256","name":"overspendAdjustmentFactor","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TargetValidatorEpochPaymentSet","inputs":[{"type":"uint256","name":"payment","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TargetVotingGoldFractionSet","inputs":[{"type":"uint256","name":"fraction","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TargetVotingYieldParametersSet","inputs":[{"type":"uint256","name":"max","internalType":"uint256","indexed":false},{"type":"uint256","name":"adjustmentFactor","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TargetVotingYieldSet","inputs":[{"type":"uint256","name":"target","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TargetVotingYieldUpdated","inputs":[{"type":"uint256","name":"fraction","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateTargetEpochRewards","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"carbonOffsettingPartner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkProofOfPossession","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"bytes","name":"blsKey","internalType":"bytes"},{"type":"bytes","name":"blsPop","internalType":"bytes"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fractionMulExp","inputs":[{"type":"uint256","name":"aNumerator","internalType":"uint256"},{"type":"uint256","name":"aDenominator","internalType":"uint256"},{"type":"uint256","name":"bNumerator","internalType":"uint256"},{"type":"uint256","name":"bDenominator","internalType":"uint256"},{"type":"uint256","name":"exponent","internalType":"uint256"},{"type":"uint256","name":"_decimals","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBlockNumberFromHeader","inputs":[{"type":"bytes","name":"header","internalType":"bytes"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCarbonOffsettingFraction","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCommunityRewardFraction","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getEpochNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getEpochNumberOfBlock","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getEpochSize","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getParentSealBitmap","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRewardsMultiplier","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRewardsMultiplierParameters","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTargetGoldTotalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTargetTotalEpochPaymentsInGold","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTargetVoterRewards","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTargetVotingGoldFraction","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTargetVotingYieldParameters","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getVerifiedSealBitmapFromHeader","inputs":[{"type":"bytes","name":"header","internalType":"bytes"}],"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":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVotingGoldFraction","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"hashHeader","inputs":[{"type":"bytes","name":"header","internalType":"bytes"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"address","name":"registryAddress","internalType":"address"},{"type":"uint256","name":"targetVotingYieldInitial","internalType":"uint256"},{"type":"uint256","name":"targetVotingYieldMax","internalType":"uint256"},{"type":"uint256","name":"targetVotingYieldAdjustmentFactor","internalType":"uint256"},{"type":"uint256","name":"rewardsMultiplierMax","internalType":"uint256"},{"type":"uint256","name":"rewardsMultiplierUnderspendAdjustmentFactor","internalType":"uint256"},{"type":"uint256","name":"rewardsMultiplierOverspendAdjustmentFactor","internalType":"uint256"},{"type":"uint256","name":"_targetVotingGoldFraction","internalType":"uint256"},{"type":"uint256","name":"_targetValidatorEpochPayment","internalType":"uint256"},{"type":"uint256","name":"_communityRewardFraction","internalType":"uint256"},{"type":"address","name":"_carbonOffsettingPartner","internalType":"address"},{"type":"uint256","name":"_carbonOffsettingFraction","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":"bool","name":"","internalType":"bool"}],"name":"isReserveLow","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minQuorumSize","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minQuorumSizeInCurrentSet","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numberValidatorsInCurrentSet","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numberValidatorsInSet","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setCarbonOffsettingFund","inputs":[{"type":"address","name":"partner","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setCommunityRewardFraction","inputs":[{"type":"uint256","name":"value","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":[{"type":"bool","name":"","internalType":"bool"}],"name":"setRewardsMultiplierParameters","inputs":[{"type":"uint256","name":"max","internalType":"uint256"},{"type":"uint256","name":"underspendAdjustmentFactor","internalType":"uint256"},{"type":"uint256","name":"overspendAdjustmentFactor","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setTargetValidatorEpochPayment","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setTargetVotingGoldFraction","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setTargetVotingYield","inputs":[{"type":"uint256","name":"targetVotingYield","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setTargetVotingYieldParameters","inputs":[{"type":"uint256","name":"max","internalType":"uint256"},{"type":"uint256","name":"adjustmentFactor","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startTime","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"targetValidatorEpochPayment","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"updateTargetVotingYield","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorSignerAddressFromCurrentSet","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorSignerAddressFromSet","inputs":[{"type":"uint256","name":"index","internalType":"uint256"},{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"constant":true}]
              

Contract Creation Code

Verify & Publish
0x6080604052600060025560006200001b620000bf60201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620000c7565b600033905090565b615e5680620000d76000396000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c80637d164125116101675780639b2b592f116100ce578063df4da46111610087578063df4da46114610eae578063e185aaa814610ecc578063e50e652d14610eea578063ec68307214610f2c578063f2fde38b14610fa7578063fae8db0a14610feb57610295565b80639b2b592f14610d60578063a1b9596214610da2578063a91ee0dc14610dc0578063ae098de214610e04578063b63b4a2314610e22578063cd52782e14610e6857610295565b806392ecd7451161012057806392ecd74514610c6c5780639402838414610c7657806396c3d2fd14610cbc5780639917907f14610d025780639a7b3be714610d205780639ad0cce714610d3e57610295565b80637d16412514610a9b5780638331c1d714610ab957806387ee8a0f14610b135780638a88362614610b315780638da5cb5b14610c005780638f32d59b14610c4a57610295565b80635049890f1161020b57806367960e91116101c457806367960e9114610873578063715018a6146109425780637385e5da1461094c57806378e979251461096a5780637b103999146109885780637cca2a3c146109d257610295565b80635049890f146106fb57806354255be0146107195780635918bb581461074c5780635d180adb1461079c5780635f396e4814610814578063643470431461084057610295565b806323f0ab651161025d57806323f0ab65146103be5780632848f9e3146105485780633b1eb4bf14610566578063434c99c4146105a85780634901c7251461060e5780634b2c2f441461062c57610295565b80630203ab241461029a578063123633ea146102b8578063158ef93e14610326578063171af90f1461034857806322dae21f14610374575b600080fd5b6102a261102d565b6040518082815260200191505060405180910390f35b6102e4600480360360208110156102ce57600080fd5b810190808035906020019092919050505061104c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032e61119d565b604051808215151515815260200191505060405180910390f35b6103506111b0565b60405180848152602001838152602001828152602001935050505060405180910390f35b61037c611229565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052e600480360360608110156103d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561041157600080fd5b82018360208201111561042357600080fd5b8035906020019184600183028401116401000000008311171561044557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156104a857600080fd5b8201836020820111156104ba57600080fd5b803590602001918460018302840111640100000000831117156104dc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061124f565b604051808215151515815260200191505060405180910390f35b610550611408565b6040518082815260200191505060405180910390f35b6105926004803603602081101561057c57600080fd5b81019080803590602001909291905050506114d2565b6040518082815260200191505060405180910390f35b6105f4600480360360408110156105be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114ec565b604051808215151515815260200191505060405180910390f35b61061661176d565b6040518082815260200191505060405180910390f35b6106e56004803603602081101561064257600080fd5b810190808035906020019064010000000081111561065f57600080fd5b82018360208201111561067157600080fd5b8035906020019184600183028401116401000000008311171561069357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061197d565b6040518082815260200191505060405180910390f35b610703611b11565b6040518082815260200191505060405180910390f35b610721611c3b565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6107826004803603604081101561076257600080fd5b810190808035906020019092919080359060200190929190505050611c62565b604051808215151515815260200191505060405180910390f35b6107d2600480360360408110156107b257600080fd5b810190808035906020019092919080359060200190929190505050611e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61081c611fdd565b60405180848152602001838152602001828152602001935050505060405180910390f35b61084861205c565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61092c6004803603602081101561088957600080fd5b81019080803590602001906401000000008111156108a657600080fd5b8201836020820111156108b857600080fd5b803590602001918460018302840111640100000000831117156108da57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061217c565b6040518082815260200191505060405180910390f35b61094a612310565b005b610954612449565b6040518082815260200191505060405180910390f35b610972612459565b6040518082815260200191505060405180910390f35b61099061245f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a9960048036036101808110156109e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612485565b005b610aa3612594565b6040518082815260200191505060405180910390f35b610af960048036036060811015610acf57600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506125ba565b604051808215151515815260200191505060405180910390f35b610b1b6127f0565b6040518082815260200191505060405180910390f35b610bea60048036036020811015610b4757600080fd5b8101908080359060200190640100000000811115610b6457600080fd5b820183602082011115610b7657600080fd5b80359060200191846001830284011164010000000083111715610b9857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612937565b6040518082815260200191505060405180910390f35b610c08612acb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610c52612af4565b604051808215151515815260200191505060405180910390f35b610c74612b52565b005b610ca260048036036020811015610c8c57600080fd5b8101908080359060200190929190505050612d13565b604051808215151515815260200191505060405180910390f35b610ce860048036036020811015610cd257600080fd5b8101908080359060200190929190505050612ec5565b604051808215151515815260200191505060405180910390f35b610d0a612fe3565b6040518082815260200191505060405180910390f35b610d28613009565b6040518082815260200191505060405180910390f35b610d46613019565b604051808215151515815260200191505060405180910390f35b610d8c60048036036020811015610d7657600080fd5b810190808035906020019092919050505061317b565b6040518082815260200191505060405180910390f35b610daa6132c4565b6040518082815260200191505060405180910390f35b610e0260048036036020811015610dd657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506134a8565b005b610e0c61364c565b6040518082815260200191505060405180910390f35b610e4e60048036036020811015610e3857600080fd5b8101908080359060200190929190505050613672565b604051808215151515815260200191505060405180910390f35b610e9460048036036020811015610e7e57600080fd5b81019080803590602001909291905050506137d7565b604051808215151515815260200191505060405180910390f35b610eb661393b565b6040518082815260200191505060405180910390f35b610ed4613a77565b6040518082815260200191505060405180910390f35b610f1660048036036020811015610f0057600080fd5b8101908080359060200190929190505050613a7d565b6040518082815260200191505060405180910390f35b610f8a600480360360c0811015610f4257600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050613ac8565b604051808381526020018281526020019250505060405180910390f35b610fe960048036036020811015610fbd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613cdc565b005b6110176004803603602081101561100157600080fd5b8101908080359060200190929190505050613d62565b6040518082815260200191505060405180910390f35b600061104761104261103d613eab565b613f62565b614267565b905090565b60006060600060fa73ffffffffffffffffffffffffffffffffffffffff16844360405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106110c557805182526020820191506020810190506020830392506110a2565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611125576040519150601f19603f3d011682016040523d82523d6000602084013e61112a565b606091505b50809350819250505080611189576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180615be1603d913960400191505060405180910390fd5b611194826000614275565b92505050919050565b600060149054906101000a900460ff1681565b600080600080600690506111db81600001604051806020016040529081600082015481525050614267565b6111fc82600201604051806020016040529081600082015481525050614267565b61121d83600101604051806020016040529081600082015481525050614267565b93509350935050909192565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060fb73ffffffffffffffffffffffffffffffffffffffff16858585604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140183805190602001908083835b602083106112d857805182526020820191506020810190506020830392506112b5565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106113295780518252602082019150602081019050602083039250611306565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040526040518082805190602001908083835b60208310611392578051825260208201915060208101905060208303925061136f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113f2576040519150601f19603f3d011682016040523d82523d6000602084013e6113f7565b606091505b505080915050809150509392505050565b60006114cd6114c860066000016040518060200160405290816000820154815250506114ba61143561428c565b73ffffffffffffffffffffffffffffffffffffffff16631f6042436040518163ffffffff1660e01b815260040160206040518083038186803b15801561147a57600080fd5b505afa15801561148e573d6000803e3d6000fd5b505050506040513d60208110156114a457600080fd5b8101908080519060200190929190505050614387565b61441190919063ffffffff16565b614870565b905090565b60006114e5826114e061393b565b614891565b9050919050565b60006114f6612af4565b611568576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806115e357506115df600b604051806020016040529081600082015481525050614267565b8214155b611638576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526048815260200180615db76048913960600191505060405180910390fd5b6116486116436148d9565b614267565b82106116bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f56616c7565206d757374206265206c657373207468616e20310000000000000081525060200191505060405180910390fd5b82600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611706826148ff565b600b600082015181600001559050508273ffffffffffffffffffffffffffffffffffffffff167fe296227209b47bb8f4a76768ebd564dcde1c44be325a5d262f27c1fd4fd4538b836040518082815260200191505060405180910390a26001905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f537461626c65546f6b656e000000000000000000000000000000000000000000815250600b019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561182957600080fd5b505afa15801561183d573d6000803e3d6000fd5b505050506040513d602081101561185357600080fd5b8101908080519060200190929190505050905060008061187161491d565b73ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b1580156118ec57600080fd5b505afa158015611900573d6000803e3d6000fd5b505050506040513d604081101561191657600080fd5b810190808051906020019092919080519060200190929190505050915091506119758261196783611959600d5461194b6127f0565b614a1890919063ffffffff16565b614a1890919063ffffffff16565b614a9e90919063ffffffff16565b935050505090565b60006060600060f473ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b602083106119d257805182526020820191506020810190506020830392506119af565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310611a395780518252602082019150602081019050602083039250611a16565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611a99576040519150601f19603f3d011682016040523d82523d6000602084013e611a9e565b606091505b50809350819250505080611afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180615b2f6038913960400191505060405180910390fd5b611b08826000614ae8565b92505050919050565b600080611b2960025442614b8990919063ffffffff16565b90506201518061016d600f0202811015611bdb576000611b7d6002611b6f6b01f04ef12cb04cf1580000006b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b614a9e90919063ffffffff16565b90506000611bb06201518061016d600f0202611ba28585614a1890919063ffffffff16565b614a9e90919063ffffffff16565b9050611bd16b01f04ef12cb04cf15800000082614bd390919063ffffffff16565b9350505050611c38565b6000611c32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615af96036913960400191505060405180910390fd5b60009150505b90565b60008060008060018060016000839350829250819150809050935093509350935090919293565b6000611c6c612af4565b611cde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611d006006600201604051806020016040529081600082015481525050614267565b83141580611d2f5750611d2b6006600101604051806020016040529081600082015481525050614267565b8214155b611d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615bbf6022913960400191505060405180910390fd5b611d8d836148ff565b600660020160008201518160000155905050611da8826148ff565b600660010160008201518160000155905050611ded611dc56148d9565b6006600201604051806020016040529081600082015481525050614c5b90919063ffffffff16565b611e42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180615d88602f913960400191505060405180910390fd5b7f1b76e38f3fdd1f284ed4d47c9d50ff407748c516ff9761616ff638c2331076258383604051808381526020018281526020019250505060405180910390a16001905092915050565b60006060600060fa73ffffffffffffffffffffffffffffffffffffffff16858560405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310611f045780518252602082019150602081019050602083039250611ee1565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611f64576040519150601f19603f3d011682016040523d82523d6000602084013e611f69565b606091505b50809350819250505080611fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615c886036913960400191505060405180910390fd5b611fd3826000614275565b9250505092915050565b6000806000806003905061200881600201604051806020016040529081600082015481525050614267565b61202c82600001600001604051806020016040529081600082015481525050614267565b61205083600001600101604051806020016040529081600082015481525050614267565b93509350935050909192565b600080600080600061206c611408565b90506000612078613eab565b90506120826159a1565b61208b82613f62565b90506120b26120ad8261209f600d54614387565b61441190919063ffffffff16565b614870565b6120d56120d0836120c287614387565b61441190919063ffffffff16565b614870565b61212061211b8461210d600a6040518060200160405290816000820154815250506120ff89614387565b61441190919063ffffffff16565b61441190919063ffffffff16565b614870565b61216b61216685612158600b60405180602001604052908160008201548152505061214a8a614387565b61441190919063ffffffff16565b61441190919063ffffffff16565b614870565b965096509650965050505090919293565b60006060600060f673ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b602083106121d157805182526020820191506020810190506020830392506121ae565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106122385780518252602082019150602081019050602083039250612215565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114612298576040519150601f19603f3d011682016040523d82523d6000602084013e61229d565b606091505b508093508192505050806122fc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180615dff6023913960400191505060405180910390fd5b612307826000614ae8565b92505050919050565b612318612af4565b61238a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061245443613a7d565b905090565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1615612508576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff02191690831515021790555061252c33614c70565b6125358c6134a8565b61253f8a8a611c62565b5061254b8888886125ba565b5061255585612d13565b5061255f84612ec5565b5061256983613672565b5061257482826114ec565b5061257e8b6137d7565b5042600281905550505050505050505050505050565b60006125b5600b604051806020016040529081600082015481525050614267565b905090565b60006125c4612af4565b612636576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6126586003600201604051806020016040529081600082015481525050614267565b8414158061268a57506126866003600001600101604051806020016040529081600082015481525050614267565b8214155b806126b957506126b56003600001600001604051806020016040529081600082015481525050614267565b8314155b61270e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615a5a6021913960400191505060405180910390fd5b6040518060400160405280604051806040016040528061272d876148ff565b815260200161273b866148ff565b815250815260200161274c866148ff565b815250600360008201518160000160008201518160000160008201518160000155505060208201518160010160008201518160000155505050506020820151816002016000820151816000015550509050507f191445ee0115396c9725b9c642b985d63820ca57d54e42e5eb38faec4022f05d84848460405180848152602001838152602001828152602001935050505060405180910390a1600190509392505050565b60006060600060f973ffffffffffffffffffffffffffffffffffffffff1643604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b60208310612861578051825260208201915060208101905060208303925061283e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146128c1576040519150601f19603f3d011682016040523d82523d6000602084013e6128c6565b606091505b50809350819250505080612925576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180615c1e6035913960400191505060405180910390fd5b612930826000614275565b9250505090565b60006060600060f773ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b6020831061298c5780518252602082019150602081019050602083039250612969565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106129f357805182526020820191506020810190506020830392506129d0565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114612a53576040519150601f19603f3d011682016040523d82523d6000602084013e612a58565b606091505b50809350819250505080612ab7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180615d576031913960400191505060405180910390fd5b612ac2826000614275565b92505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612b36614db4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612bf4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000081525060200191505060405180910390fd5b612bfc614dbc565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612c7857600080fd5b505afa158015612c8c573d6000803e3d6000fd5b505050506040513d6020811015612ca257600080fd5b810190808051906020019092919050505015612d09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615b676022913960400191505060405180910390fd5b612d11614eb7565b565b6000612d1d612af4565b612d8f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612dae6009604051806020016040529081600082015481525050614267565b821415612e06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180615a7b6025913960400191505060405180910390fd5b612e16612e116148d9565b614267565b8210612e6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180615ac66033913960400191505060405180910390fd5b612e76826148ff565b6009600082015181600001559050507fbae2f33c70949fbc7325c98655f3039e5e1c7f774874c99fd4f31ec5f432b159826040518082815260200191505060405180910390a160019050919050565b6000612ecf612af4565b612f41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600d54821415612f9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180615a046028913960400191505060405180910390fd5b81600d819055507fa21d141963bb2c1064b5376f762d22d3e9c4c51617edcf105bcec0f14e36800c826040518082815260200191505060405180910390a160019050919050565b6000613004600a604051806020016040529081600082015481525050614267565b905090565b6000613014436114d2565b905090565b60006130236159a1565b61304061303b60025442614b8990919063ffffffff16565b614387565b905061304a6159a1565b613057632efe0780614387565b90506130616159a1565b61306b6002614387565b90506130756159a1565b61308883856152ab90919063ffffffff16565b1561309c576130956148d9565b90506130c4565b6130c16130b284866152c190919063ffffffff16565b8361540a90919063ffffffff16565b90505b6130cc6159a1565b61315c6130d76154b1565b73ffffffffffffffffffffffffffffffffffffffff166356b6d0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561311c57600080fd5b505afa158015613130573d6000803e3d6000fd5b505050506040513d602081101561314657600080fd5b81019080805190602001909291905050506148ff565b905061317182826155ac90919063ffffffff16565b9550505050505090565b60006060600060f973ffffffffffffffffffffffffffffffffffffffff1684604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106131ec57805182526020820191506020810190506020830392506131c9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461324c576040519150601f19603f3d011682016040523d82523d6000602084013e613251565b606091505b508093508192505050806132b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180615a2c602e913960400191505060405180910390fd5b6132bb826000614275565b92505050919050565b6000806133e86132d26154b1565b73ffffffffffffffffffffffffffffffffffffffff16638d9a5e6f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561331757600080fd5b505afa15801561332b573d6000803e3d6000fd5b505050506040513d602081101561334157600080fd5b810190808051906020019092919050505061335a6155c2565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561339f57600080fd5b505afa1580156133b3573d6000803e3d6000fd5b505050506040513d60208110156133c957600080fd5b8101908080519060200190929190505050614b8990919063ffffffff16565b905060006133f461428c565b73ffffffffffffffffffffffffffffffffffffffff16639a0e7d666040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b505afa15801561344d573d6000803e3d6000fd5b505050506040513d602081101561346357600080fd5b810190808051906020019092919050505090506134a161349c61348584614387565b61348e84614387565b6152c190919063ffffffff16565b614267565b9250505090565b6134b0612af4565b613522576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156135c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b600061366d6009604051806020016040529081600082015481525050614267565b905090565b600061367c612af4565b6136ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61370d600a604051806020016040529081600082015481525050614267565b821415801561372a57506137276137226148d9565b614267565b82105b61377f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604f8152602001806159b5604f913960600191505060405180910390fd5b613788826148ff565b600a600082015181600001559050507fe6c1b64ad7e601924731051286b7b408b1a6f3ae96dcd6d2d9cd82578372ef9e826040518082815260200191505060405180910390a160019050919050565b60006137e1612af4565b613853576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61385b6159a1565b613864836148ff565b90506138926006600201604051806020016040529081600082015481525050826155ac90919063ffffffff16565b6138e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180615c536035913960400191505060405180910390fd5b806006600001600082015181600001559050507f152c3fc1e1cd415804bc9ae15876b37e62d8909358b940e6f4847ca927f46637836040518082815260200191505060405180910390a16001915050919050565b60006060600060f873ffffffffffffffffffffffffffffffffffffffff166040516020016040516020818303038152906040526040518082805190602001908083835b602083106139a1578051825260208201915060208101905060208303925061397e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613a01576040519150601f19603f3d011682016040523d82523d6000602084013e613a06565b606091505b50809350819250505080613a65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180615d066025913960400191505060405180910390fd5b613a70826000614275565b9250505090565b600d5481565b6000613ac16003613ab36002613aa56002613a978861317b565b614a1890919063ffffffff16565b614bd390919063ffffffff16565b614a9e90919063ffffffff16565b9050919050565b60008060008714158015613add575060008514155b613b4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f612064656e6f6d696e61746f72206973207a65726f000000000000000000000081525060200191505060405180910390fd5b6000806000606060fc73ffffffffffffffffffffffffffffffffffffffff168c8c8c8c8c8c6040516020018087815260200186815260200185815260200184815260200183815260200182815260200196505050505050506040516020818303038152906040526040518082805190602001908083835b60208310613be95780518252602082019150602081019050602083039250613bc6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613c49576040519150601f19603f3d011682016040523d82523d6000602084013e613c4e565b606091505b50809250819350505081613cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180615cdf6027913960400191505060405180910390fd5b613cb8816000614275565b9350613cc5816020614275565b925083839550955050505050965096945050505050565b613ce4612af4565b613d56576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613d5f81614c70565b50565b60006060600060f573ffffffffffffffffffffffffffffffffffffffff1684604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b60208310613dd35780518252602082019150602081019050602083039250613db0565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613e33576040519150601f19603f3d011682016040523d82523d6000602084013e613e38565b606091505b50809350819250505080613e97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180615d2b602c913960400191505060405180910390fd5b613ea2826000614ae8565b92505050919050565b600080613eb6611408565b90506000613ec261176d565b90506000613ed98284614bd390919063ffffffff16565b9050613f57613f52613f3b600b604051806020016040529081600082015481525050613f2d600a604051806020016040529081600082015481525050613f1f6001614387565b61540a90919063ffffffff16565b61540a90919063ffffffff16565b613f4484614387565b6152c190919063ffffffff16565b614870565b905080935050505090565b613f6a6159a1565b6000613f74611b11565b90506000613f806155c2565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015613fc557600080fd5b505afa158015613fd9573d6000803e3d6000fd5b505050506040513d6020811015613fef57600080fd5b81019080805190602001909291905050509050600061403561401a8684614bd390919063ffffffff16565b6b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b90506000614058846b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b90506140626159a1565b61408561406e83614387565b61407785614387565b6152c190919063ffffffff16565b90506140a16140926148d9565b826156bd90919063ffffffff16565b15614184576140ae6159a1565b6140f660036000016000016040518060200160405290816000820154815250506140e86140d96148d9565b8561540a90919063ffffffff16565b61441190919063ffffffff16565b90506141006159a1565b61411a8261410c6148d9565b6156d290919063ffffffff16565b9050614148600360020160405180602001604052908160008201548152505082614c5b90919063ffffffff16565b1561415c5780975050505050505050614262565b6003600201604051806020016040529081600082015481525050975050505050505050614262565b61419e61418f6148d9565b82614c5b90919063ffffffff16565b15614252576141ab6159a1565b6141f360036000016001016040518060200160405290816000820154815250506141e5846141d76148d9565b61540a90919063ffffffff16565b61441190919063ffffffff16565b905061420f6142006148d9565b82614c5b90919063ffffffff16565b1561423b5761422e816142206148d9565b61540a90919063ffffffff16565b9650505050505050614262565b61424560006148ff565b9650505050505050614262565b61425a6148d9565b955050505050505b919050565b600081600001519050919050565b60006142818383614ae8565b60001c905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f456c656374696f6e0000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561434757600080fd5b505afa15801561435b573d6000803e3d6000fd5b505050506040513d602081101561437157600080fd5b8101908080519060200190929190505050905090565b61438f6159a1565b61439761577b565b8211156143ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615b896036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b6144196159a1565b600083600001511480614430575060008260000151145b1561444c5760405180602001604052806000815250905061486a565b69d3c21bcecceda10000008260000151141561446a5782905061486a565b69d3c21bcecceda1000000836000015114156144885781905061486a565b600069d3c21bcecceda100000061449e8561579a565b60000151816144a957fe5b04905060006144b7856157d1565b600001519050600069d3c21bcecceda10000006144d38661579a565b60000151816144de57fe5b04905060006144ec866157d1565b6000015190506000828502905060008514614580578285828161450b57fe5b041461457f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda100000082029050600082146146225769d3c21bcecceda10000008282816145ad57fe5b0414614621576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b80915060008486029050600086146146b3578486828161463e57fe5b04146146b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600084880290506000881461474157848882816146cc57fe5b0414614740576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b61474961580e565b878161475157fe5b04965061475c61580e565b858161476457fe5b04945060008588029050600088146147f5578588828161478057fe5b04146147f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6147fd6159a1565b6040518060200160405280878152509050614826816040518060200160405280878152506156d2565b9050614840816040518060200160405280868152506156d2565b905061485a816040518060200160405280858152506156d2565b9050809a50505050505050505050505b92915050565b600069d3c21bcecceda100000082600001518161488957fe5b049050919050565b60008082848161489d57fe5b04905060008385816148ab57fe5b0614156148bb57809150506148d3565b6148cf600182614bd390919063ffffffff16565b9150505b92915050565b6148e16159a1565b604051806020016040528069d3c21bcecceda1000000815250905090565b6149076159a1565b6040518060200160405280838152509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156149d857600080fd5b505afa1580156149ec573d6000803e3d6000fd5b505050506040513d6020811015614a0257600080fd5b8101908080519060200190929190505050905090565b600080831415614a2b5760009050614a98565b6000828402905082848281614a3c57fe5b0414614a93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615cbe6021913960400191505060405180910390fd5b809150505b92915050565b6000614ae083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061581b565b905092915050565b6000614afe602083614bd390919063ffffffff16565b83511015614b74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f736c6963696e67206f7574206f662072616e676500000000000000000000000081525060200191505060405180910390fd5b60006020830184015190508091505092915050565b6000614bcb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506158e1565b905092915050565b600080828401905083811015614c51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008160000151836000015110905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614cf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615aa06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f467265657a6572000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015614e7757600080fd5b505afa158015614e8b573d6000803e3d6000fd5b505050506040513d6020811015614ea157600080fd5b8101908080519060200190929190505050905090565b614ebf614dbc565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015614f3b57600080fd5b505afa158015614f4f573d6000803e3d6000fd5b505050506040513d6020811015614f6557600080fd5b810190808051906020019092919050505015614fcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615b676022913960400191505060405180910390fd5b614fd46159a1565b614fe4614fdf6132c4565b6148ff565b905061500f6009604051806020016040529081600082015481525050826156bd90919063ffffffff16565b156151155761501c6159a1565b61504560096040518060200160405290816000820154815250508361540a90919063ffffffff16565b905061504f6159a1565b61507b60066001016040518060200160405290816000820154815250508361441190919063ffffffff16565b90506150a96006600001604051806020016040529081600082015481525050826152ab90919063ffffffff16565b156150cf576150b86000614387565b60066000016000820151816000015590505061510e565b6150fb81600660000160405180602001604052908160008201548152505061540a90919063ffffffff16565b6006600001600082015181600001559050505b5050615250565b61513e600960405180602001604052908160008201548152505082614c5b90919063ffffffff16565b1561524f5761514b6159a1565b61517482600960405180602001604052908160008201548152505061540a90919063ffffffff16565b905061517e6159a1565b6151aa60066001016040518060200160405290816000820154815250508361441190919063ffffffff16565b90506151d88160066000016040518060200160405290816000820154815250506156d290919063ffffffff16565b60066000016000820151816000015590505061522f600660020160405180602001604052908160008201548152505060066000016040518060200160405290816000820154815250506156bd90919063ffffffff16565b1561524c5760066002016006600001600082015481600001559050505b50505b5b7f49d8cdfe05bae61517c234f65f4088454013bafe561115126a8fe0074dc7700e6152936006600001604051806020016040529081600082015481525050614267565b6040518082815260200191505060405180910390a150565b6000816000015183600001511015905092915050565b6152c96159a1565b600082600001511415615344576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f63616e277420646976696465206279203000000000000000000000000000000081525060200191505060405180910390fd5b600069d3c21bcecceda10000008460000151029050836000015169d3c21bcecceda1000000828161537157fe5b04146153e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6f766572666c6f7720617420646976696465000000000000000000000000000081525060200191505060405180910390fd5b6040518060200160405280846000015183816153fd57fe5b0481525091505092915050565b6154126159a1565b816000015183600001511015615490576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561556c57600080fd5b505afa158015615580573d6000803e3d6000fd5b505050506040513d602081101561559657600080fd5b8101908080519060200190929190505050905090565b6000816000015183600001511115905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561567d57600080fd5b505afa158015615691573d6000803e3d6000fd5b505050506040513d60208110156156a757600080fd5b8101908080519060200190929190505050905090565b60008160000151836000015111905092915050565b6156da6159a1565b6000826000015184600001510190508360000151811015615763576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b6157a26159a1565b604051806020016040528069d3c21bcecceda1000000808560000151816157c557fe5b04028152509050919050565b6157d96159a1565b604051806020016040528069d3c21bcecceda1000000808560000151816157fc57fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b600080831182906158c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561588c578082015181840152602081019050615871565b50505050905090810190601f1680156158b95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816158d357fe5b049050809150509392505050565b600083831115829061598e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615953578082015181840152602081019050615938565b50505050905090810190601f1680156159805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b604051806020016040528060008152509056fe56616c7565206d75737420626520646966666572656e742066726f6d206578697374696e6720636f6d6d756e69747920726577617264206672616374696f6e20616e64206c657373207468616e20315461726765742076616c696461746f722065706f6368207061796d656e7420756e6368616e6765646572726f722063616c6c696e67206e756d62657256616c696461746f7273496e53657420707265636f6d70696c654261642072657761726473206d756c7469706c69657220706172616d657465727354617267657420766f74696e6720676f6c64206672616374696f6e20756e6368616e6765644f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737354617267657420766f74696e6720676f6c64206672616374696f6e2063616e6e6f74206265206c6172676572207468616e2031426c6f636b207265776172642063616c63756c6174696f6e20666f722079656172732031352d333020756e696d706c656d656e7465646572726f722063616c6c696e672067657456657269666965645365616c4269746d617046726f6d48656164657220707265636f6d70696c6563616e27742063616c6c207768656e20636f6e74726163742069732066726f7a656e63616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e6577466978656428294261642074617267657420766f74696e67207969656c6420706172616d65746572736572726f722063616c6c696e672076616c696461746f725369676e65724164647265737346726f6d43757272656e7453657420707265636f6d70696c656572726f722063616c6c696e67206e756d62657256616c696461746f7273496e43757272656e7453657420707265636f6d70696c6554617267657420766f74696e67207969656c64206d757374206265206c657373207468616e206f7220657175616c20746f206d61786572726f722063616c6c696e672076616c696461746f725369676e65724164647265737346726f6d53657420707265636f6d70696c65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776572726f722063616c6c696e67206672616374696f6e4d756c45787020707265636f6d70696c656572726f722063616c6c696e672067657445706f636853697a6520707265636f6d70696c656572726f722063616c6c696e6720676574506172656e745365616c4269746d617020707265636f6d70696c656572726f722063616c6c696e6720676574426c6f636b4e756d62657246726f6d48656164657220707265636f6d70696c654d61782074617267657420766f74696e67207969656c64206d757374206265206c6f776572207468616e2031303025506172746e657220616e642076616c7565206d75737420626520646966666572656e742066726f6d206578697374696e6720636172626f6e206f666673657474696e672066756e646572726f722063616c6c696e67206861736848656164657220707265636f6d70696c65a265627a7a723158201fea1af16bfadbd5742a53730358ec2197851b9c9dfcf4e9384c0acad6175cc564736f6c634300050d0032

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102955760003560e01c80637d164125116101675780639b2b592f116100ce578063df4da46111610087578063df4da46114610eae578063e185aaa814610ecc578063e50e652d14610eea578063ec68307214610f2c578063f2fde38b14610fa7578063fae8db0a14610feb57610295565b80639b2b592f14610d60578063a1b9596214610da2578063a91ee0dc14610dc0578063ae098de214610e04578063b63b4a2314610e22578063cd52782e14610e6857610295565b806392ecd7451161012057806392ecd74514610c6c5780639402838414610c7657806396c3d2fd14610cbc5780639917907f14610d025780639a7b3be714610d205780639ad0cce714610d3e57610295565b80637d16412514610a9b5780638331c1d714610ab957806387ee8a0f14610b135780638a88362614610b315780638da5cb5b14610c005780638f32d59b14610c4a57610295565b80635049890f1161020b57806367960e91116101c457806367960e9114610873578063715018a6146109425780637385e5da1461094c57806378e979251461096a5780637b103999146109885780637cca2a3c146109d257610295565b80635049890f146106fb57806354255be0146107195780635918bb581461074c5780635d180adb1461079c5780635f396e4814610814578063643470431461084057610295565b806323f0ab651161025d57806323f0ab65146103be5780632848f9e3146105485780633b1eb4bf14610566578063434c99c4146105a85780634901c7251461060e5780634b2c2f441461062c57610295565b80630203ab241461029a578063123633ea146102b8578063158ef93e14610326578063171af90f1461034857806322dae21f14610374575b600080fd5b6102a261102d565b6040518082815260200191505060405180910390f35b6102e4600480360360208110156102ce57600080fd5b810190808035906020019092919050505061104c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032e61119d565b604051808215151515815260200191505060405180910390f35b6103506111b0565b60405180848152602001838152602001828152602001935050505060405180910390f35b61037c611229565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052e600480360360608110156103d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561041157600080fd5b82018360208201111561042357600080fd5b8035906020019184600183028401116401000000008311171561044557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156104a857600080fd5b8201836020820111156104ba57600080fd5b803590602001918460018302840111640100000000831117156104dc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061124f565b604051808215151515815260200191505060405180910390f35b610550611408565b6040518082815260200191505060405180910390f35b6105926004803603602081101561057c57600080fd5b81019080803590602001909291905050506114d2565b6040518082815260200191505060405180910390f35b6105f4600480360360408110156105be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114ec565b604051808215151515815260200191505060405180910390f35b61061661176d565b6040518082815260200191505060405180910390f35b6106e56004803603602081101561064257600080fd5b810190808035906020019064010000000081111561065f57600080fd5b82018360208201111561067157600080fd5b8035906020019184600183028401116401000000008311171561069357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061197d565b6040518082815260200191505060405180910390f35b610703611b11565b6040518082815260200191505060405180910390f35b610721611c3b565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6107826004803603604081101561076257600080fd5b810190808035906020019092919080359060200190929190505050611c62565b604051808215151515815260200191505060405180910390f35b6107d2600480360360408110156107b257600080fd5b810190808035906020019092919080359060200190929190505050611e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61081c611fdd565b60405180848152602001838152602001828152602001935050505060405180910390f35b61084861205c565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61092c6004803603602081101561088957600080fd5b81019080803590602001906401000000008111156108a657600080fd5b8201836020820111156108b857600080fd5b803590602001918460018302840111640100000000831117156108da57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061217c565b6040518082815260200191505060405180910390f35b61094a612310565b005b610954612449565b6040518082815260200191505060405180910390f35b610972612459565b6040518082815260200191505060405180910390f35b61099061245f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a9960048036036101808110156109e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612485565b005b610aa3612594565b6040518082815260200191505060405180910390f35b610af960048036036060811015610acf57600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506125ba565b604051808215151515815260200191505060405180910390f35b610b1b6127f0565b6040518082815260200191505060405180910390f35b610bea60048036036020811015610b4757600080fd5b8101908080359060200190640100000000811115610b6457600080fd5b820183602082011115610b7657600080fd5b80359060200191846001830284011164010000000083111715610b9857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612937565b6040518082815260200191505060405180910390f35b610c08612acb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610c52612af4565b604051808215151515815260200191505060405180910390f35b610c74612b52565b005b610ca260048036036020811015610c8c57600080fd5b8101908080359060200190929190505050612d13565b604051808215151515815260200191505060405180910390f35b610ce860048036036020811015610cd257600080fd5b8101908080359060200190929190505050612ec5565b604051808215151515815260200191505060405180910390f35b610d0a612fe3565b6040518082815260200191505060405180910390f35b610d28613009565b6040518082815260200191505060405180910390f35b610d46613019565b604051808215151515815260200191505060405180910390f35b610d8c60048036036020811015610d7657600080fd5b810190808035906020019092919050505061317b565b6040518082815260200191505060405180910390f35b610daa6132c4565b6040518082815260200191505060405180910390f35b610e0260048036036020811015610dd657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506134a8565b005b610e0c61364c565b6040518082815260200191505060405180910390f35b610e4e60048036036020811015610e3857600080fd5b8101908080359060200190929190505050613672565b604051808215151515815260200191505060405180910390f35b610e9460048036036020811015610e7e57600080fd5b81019080803590602001909291905050506137d7565b604051808215151515815260200191505060405180910390f35b610eb661393b565b6040518082815260200191505060405180910390f35b610ed4613a77565b6040518082815260200191505060405180910390f35b610f1660048036036020811015610f0057600080fd5b8101908080359060200190929190505050613a7d565b6040518082815260200191505060405180910390f35b610f8a600480360360c0811015610f4257600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050613ac8565b604051808381526020018281526020019250505060405180910390f35b610fe960048036036020811015610fbd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613cdc565b005b6110176004803603602081101561100157600080fd5b8101908080359060200190929190505050613d62565b6040518082815260200191505060405180910390f35b600061104761104261103d613eab565b613f62565b614267565b905090565b60006060600060fa73ffffffffffffffffffffffffffffffffffffffff16844360405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106110c557805182526020820191506020810190506020830392506110a2565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611125576040519150601f19603f3d011682016040523d82523d6000602084013e61112a565b606091505b50809350819250505080611189576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180615be1603d913960400191505060405180910390fd5b611194826000614275565b92505050919050565b600060149054906101000a900460ff1681565b600080600080600690506111db81600001604051806020016040529081600082015481525050614267565b6111fc82600201604051806020016040529081600082015481525050614267565b61121d83600101604051806020016040529081600082015481525050614267565b93509350935050909192565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060fb73ffffffffffffffffffffffffffffffffffffffff16858585604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140183805190602001908083835b602083106112d857805182526020820191506020810190506020830392506112b5565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106113295780518252602082019150602081019050602083039250611306565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040526040518082805190602001908083835b60208310611392578051825260208201915060208101905060208303925061136f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113f2576040519150601f19603f3d011682016040523d82523d6000602084013e6113f7565b606091505b505080915050809150509392505050565b60006114cd6114c860066000016040518060200160405290816000820154815250506114ba61143561428c565b73ffffffffffffffffffffffffffffffffffffffff16631f6042436040518163ffffffff1660e01b815260040160206040518083038186803b15801561147a57600080fd5b505afa15801561148e573d6000803e3d6000fd5b505050506040513d60208110156114a457600080fd5b8101908080519060200190929190505050614387565b61441190919063ffffffff16565b614870565b905090565b60006114e5826114e061393b565b614891565b9050919050565b60006114f6612af4565b611568576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806115e357506115df600b604051806020016040529081600082015481525050614267565b8214155b611638576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526048815260200180615db76048913960600191505060405180910390fd5b6116486116436148d9565b614267565b82106116bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f56616c7565206d757374206265206c657373207468616e20310000000000000081525060200191505060405180910390fd5b82600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611706826148ff565b600b600082015181600001559050508273ffffffffffffffffffffffffffffffffffffffff167fe296227209b47bb8f4a76768ebd564dcde1c44be325a5d262f27c1fd4fd4538b836040518082815260200191505060405180910390a26001905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f537461626c65546f6b656e000000000000000000000000000000000000000000815250600b019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561182957600080fd5b505afa15801561183d573d6000803e3d6000fd5b505050506040513d602081101561185357600080fd5b8101908080519060200190929190505050905060008061187161491d565b73ffffffffffffffffffffffffffffffffffffffff1663ef90e1b0846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b1580156118ec57600080fd5b505afa158015611900573d6000803e3d6000fd5b505050506040513d604081101561191657600080fd5b810190808051906020019092919080519060200190929190505050915091506119758261196783611959600d5461194b6127f0565b614a1890919063ffffffff16565b614a1890919063ffffffff16565b614a9e90919063ffffffff16565b935050505090565b60006060600060f473ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b602083106119d257805182526020820191506020810190506020830392506119af565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310611a395780518252602082019150602081019050602083039250611a16565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611a99576040519150601f19603f3d011682016040523d82523d6000602084013e611a9e565b606091505b50809350819250505080611afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180615b2f6038913960400191505060405180910390fd5b611b08826000614ae8565b92505050919050565b600080611b2960025442614b8990919063ffffffff16565b90506201518061016d600f0202811015611bdb576000611b7d6002611b6f6b01f04ef12cb04cf1580000006b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b614a9e90919063ffffffff16565b90506000611bb06201518061016d600f0202611ba28585614a1890919063ffffffff16565b614a9e90919063ffffffff16565b9050611bd16b01f04ef12cb04cf15800000082614bd390919063ffffffff16565b9350505050611c38565b6000611c32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615af96036913960400191505060405180910390fd5b60009150505b90565b60008060008060018060016000839350829250819150809050935093509350935090919293565b6000611c6c612af4565b611cde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611d006006600201604051806020016040529081600082015481525050614267565b83141580611d2f5750611d2b6006600101604051806020016040529081600082015481525050614267565b8214155b611d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615bbf6022913960400191505060405180910390fd5b611d8d836148ff565b600660020160008201518160000155905050611da8826148ff565b600660010160008201518160000155905050611ded611dc56148d9565b6006600201604051806020016040529081600082015481525050614c5b90919063ffffffff16565b611e42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180615d88602f913960400191505060405180910390fd5b7f1b76e38f3fdd1f284ed4d47c9d50ff407748c516ff9761616ff638c2331076258383604051808381526020018281526020019250505060405180910390a16001905092915050565b60006060600060fa73ffffffffffffffffffffffffffffffffffffffff16858560405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310611f045780518252602082019150602081019050602083039250611ee1565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611f64576040519150601f19603f3d011682016040523d82523d6000602084013e611f69565b606091505b50809350819250505080611fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615c886036913960400191505060405180910390fd5b611fd3826000614275565b9250505092915050565b6000806000806003905061200881600201604051806020016040529081600082015481525050614267565b61202c82600001600001604051806020016040529081600082015481525050614267565b61205083600001600101604051806020016040529081600082015481525050614267565b93509350935050909192565b600080600080600061206c611408565b90506000612078613eab565b90506120826159a1565b61208b82613f62565b90506120b26120ad8261209f600d54614387565b61441190919063ffffffff16565b614870565b6120d56120d0836120c287614387565b61441190919063ffffffff16565b614870565b61212061211b8461210d600a6040518060200160405290816000820154815250506120ff89614387565b61441190919063ffffffff16565b61441190919063ffffffff16565b614870565b61216b61216685612158600b60405180602001604052908160008201548152505061214a8a614387565b61441190919063ffffffff16565b61441190919063ffffffff16565b614870565b965096509650965050505090919293565b60006060600060f673ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b602083106121d157805182526020820191506020810190506020830392506121ae565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106122385780518252602082019150602081019050602083039250612215565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114612298576040519150601f19603f3d011682016040523d82523d6000602084013e61229d565b606091505b508093508192505050806122fc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180615dff6023913960400191505060405180910390fd5b612307826000614ae8565b92505050919050565b612318612af4565b61238a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061245443613a7d565b905090565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1615612508576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff02191690831515021790555061252c33614c70565b6125358c6134a8565b61253f8a8a611c62565b5061254b8888886125ba565b5061255585612d13565b5061255f84612ec5565b5061256983613672565b5061257482826114ec565b5061257e8b6137d7565b5042600281905550505050505050505050505050565b60006125b5600b604051806020016040529081600082015481525050614267565b905090565b60006125c4612af4565b612636576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6126586003600201604051806020016040529081600082015481525050614267565b8414158061268a57506126866003600001600101604051806020016040529081600082015481525050614267565b8214155b806126b957506126b56003600001600001604051806020016040529081600082015481525050614267565b8314155b61270e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615a5a6021913960400191505060405180910390fd5b6040518060400160405280604051806040016040528061272d876148ff565b815260200161273b866148ff565b815250815260200161274c866148ff565b815250600360008201518160000160008201518160000160008201518160000155505060208201518160010160008201518160000155505050506020820151816002016000820151816000015550509050507f191445ee0115396c9725b9c642b985d63820ca57d54e42e5eb38faec4022f05d84848460405180848152602001838152602001828152602001935050505060405180910390a1600190509392505050565b60006060600060f973ffffffffffffffffffffffffffffffffffffffff1643604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b60208310612861578051825260208201915060208101905060208303925061283e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146128c1576040519150601f19603f3d011682016040523d82523d6000602084013e6128c6565b606091505b50809350819250505080612925576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180615c1e6035913960400191505060405180910390fd5b612930826000614275565b9250505090565b60006060600060f773ffffffffffffffffffffffffffffffffffffffff16846040516020018082805190602001908083835b6020831061298c5780518252602082019150602081019050602083039250612969565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106129f357805182526020820191506020810190506020830392506129d0565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114612a53576040519150601f19603f3d011682016040523d82523d6000602084013e612a58565b606091505b50809350819250505080612ab7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180615d576031913960400191505060405180910390fd5b612ac2826000614275565b92505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612b36614db4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612bf4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000081525060200191505060405180910390fd5b612bfc614dbc565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612c7857600080fd5b505afa158015612c8c573d6000803e3d6000fd5b505050506040513d6020811015612ca257600080fd5b810190808051906020019092919050505015612d09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615b676022913960400191505060405180910390fd5b612d11614eb7565b565b6000612d1d612af4565b612d8f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612dae6009604051806020016040529081600082015481525050614267565b821415612e06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180615a7b6025913960400191505060405180910390fd5b612e16612e116148d9565b614267565b8210612e6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180615ac66033913960400191505060405180910390fd5b612e76826148ff565b6009600082015181600001559050507fbae2f33c70949fbc7325c98655f3039e5e1c7f774874c99fd4f31ec5f432b159826040518082815260200191505060405180910390a160019050919050565b6000612ecf612af4565b612f41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600d54821415612f9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180615a046028913960400191505060405180910390fd5b81600d819055507fa21d141963bb2c1064b5376f762d22d3e9c4c51617edcf105bcec0f14e36800c826040518082815260200191505060405180910390a160019050919050565b6000613004600a604051806020016040529081600082015481525050614267565b905090565b6000613014436114d2565b905090565b60006130236159a1565b61304061303b60025442614b8990919063ffffffff16565b614387565b905061304a6159a1565b613057632efe0780614387565b90506130616159a1565b61306b6002614387565b90506130756159a1565b61308883856152ab90919063ffffffff16565b1561309c576130956148d9565b90506130c4565b6130c16130b284866152c190919063ffffffff16565b8361540a90919063ffffffff16565b90505b6130cc6159a1565b61315c6130d76154b1565b73ffffffffffffffffffffffffffffffffffffffff166356b6d0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561311c57600080fd5b505afa158015613130573d6000803e3d6000fd5b505050506040513d602081101561314657600080fd5b81019080805190602001909291905050506148ff565b905061317182826155ac90919063ffffffff16565b9550505050505090565b60006060600060f973ffffffffffffffffffffffffffffffffffffffff1684604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106131ec57805182526020820191506020810190506020830392506131c9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461324c576040519150601f19603f3d011682016040523d82523d6000602084013e613251565b606091505b508093508192505050806132b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180615a2c602e913960400191505060405180910390fd5b6132bb826000614275565b92505050919050565b6000806133e86132d26154b1565b73ffffffffffffffffffffffffffffffffffffffff16638d9a5e6f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561331757600080fd5b505afa15801561332b573d6000803e3d6000fd5b505050506040513d602081101561334157600080fd5b810190808051906020019092919050505061335a6155c2565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561339f57600080fd5b505afa1580156133b3573d6000803e3d6000fd5b505050506040513d60208110156133c957600080fd5b8101908080519060200190929190505050614b8990919063ffffffff16565b905060006133f461428c565b73ffffffffffffffffffffffffffffffffffffffff16639a0e7d666040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b505afa15801561344d573d6000803e3d6000fd5b505050506040513d602081101561346357600080fd5b810190808051906020019092919050505090506134a161349c61348584614387565b61348e84614387565b6152c190919063ffffffff16565b614267565b9250505090565b6134b0612af4565b613522576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156135c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b600061366d6009604051806020016040529081600082015481525050614267565b905090565b600061367c612af4565b6136ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61370d600a604051806020016040529081600082015481525050614267565b821415801561372a57506137276137226148d9565b614267565b82105b61377f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604f8152602001806159b5604f913960600191505060405180910390fd5b613788826148ff565b600a600082015181600001559050507fe6c1b64ad7e601924731051286b7b408b1a6f3ae96dcd6d2d9cd82578372ef9e826040518082815260200191505060405180910390a160019050919050565b60006137e1612af4565b613853576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61385b6159a1565b613864836148ff565b90506138926006600201604051806020016040529081600082015481525050826155ac90919063ffffffff16565b6138e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180615c536035913960400191505060405180910390fd5b806006600001600082015181600001559050507f152c3fc1e1cd415804bc9ae15876b37e62d8909358b940e6f4847ca927f46637836040518082815260200191505060405180910390a16001915050919050565b60006060600060f873ffffffffffffffffffffffffffffffffffffffff166040516020016040516020818303038152906040526040518082805190602001908083835b602083106139a1578051825260208201915060208101905060208303925061397e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613a01576040519150601f19603f3d011682016040523d82523d6000602084013e613a06565b606091505b50809350819250505080613a65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180615d066025913960400191505060405180910390fd5b613a70826000614275565b9250505090565b600d5481565b6000613ac16003613ab36002613aa56002613a978861317b565b614a1890919063ffffffff16565b614bd390919063ffffffff16565b614a9e90919063ffffffff16565b9050919050565b60008060008714158015613add575060008514155b613b4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f612064656e6f6d696e61746f72206973207a65726f000000000000000000000081525060200191505060405180910390fd5b6000806000606060fc73ffffffffffffffffffffffffffffffffffffffff168c8c8c8c8c8c6040516020018087815260200186815260200185815260200184815260200183815260200182815260200196505050505050506040516020818303038152906040526040518082805190602001908083835b60208310613be95780518252602082019150602081019050602083039250613bc6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613c49576040519150601f19603f3d011682016040523d82523d6000602084013e613c4e565b606091505b50809250819350505081613cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180615cdf6027913960400191505060405180910390fd5b613cb8816000614275565b9350613cc5816020614275565b925083839550955050505050965096945050505050565b613ce4612af4565b613d56576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613d5f81614c70565b50565b60006060600060f573ffffffffffffffffffffffffffffffffffffffff1684604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b60208310613dd35780518252602082019150602081019050602083039250613db0565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613e33576040519150601f19603f3d011682016040523d82523d6000602084013e613e38565b606091505b50809350819250505080613e97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180615d2b602c913960400191505060405180910390fd5b613ea2826000614ae8565b92505050919050565b600080613eb6611408565b90506000613ec261176d565b90506000613ed98284614bd390919063ffffffff16565b9050613f57613f52613f3b600b604051806020016040529081600082015481525050613f2d600a604051806020016040529081600082015481525050613f1f6001614387565b61540a90919063ffffffff16565b61540a90919063ffffffff16565b613f4484614387565b6152c190919063ffffffff16565b614870565b905080935050505090565b613f6a6159a1565b6000613f74611b11565b90506000613f806155c2565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015613fc557600080fd5b505afa158015613fd9573d6000803e3d6000fd5b505050506040513d6020811015613fef57600080fd5b81019080805190602001909291905050509050600061403561401a8684614bd390919063ffffffff16565b6b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b90506000614058846b033b2e3c9fd0803ce8000000614b8990919063ffffffff16565b90506140626159a1565b61408561406e83614387565b61407785614387565b6152c190919063ffffffff16565b90506140a16140926148d9565b826156bd90919063ffffffff16565b15614184576140ae6159a1565b6140f660036000016000016040518060200160405290816000820154815250506140e86140d96148d9565b8561540a90919063ffffffff16565b61441190919063ffffffff16565b90506141006159a1565b61411a8261410c6148d9565b6156d290919063ffffffff16565b9050614148600360020160405180602001604052908160008201548152505082614c5b90919063ffffffff16565b1561415c5780975050505050505050614262565b6003600201604051806020016040529081600082015481525050975050505050505050614262565b61419e61418f6148d9565b82614c5b90919063ffffffff16565b15614252576141ab6159a1565b6141f360036000016001016040518060200160405290816000820154815250506141e5846141d76148d9565b61540a90919063ffffffff16565b61441190919063ffffffff16565b905061420f6142006148d9565b82614c5b90919063ffffffff16565b1561423b5761422e816142206148d9565b61540a90919063ffffffff16565b9650505050505050614262565b61424560006148ff565b9650505050505050614262565b61425a6148d9565b955050505050505b919050565b600081600001519050919050565b60006142818383614ae8565b60001c905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f456c656374696f6e0000000000000000000000000000000000000000000000008152506008019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561434757600080fd5b505afa15801561435b573d6000803e3d6000fd5b505050506040513d602081101561437157600080fd5b8101908080519060200190929190505050905090565b61438f6159a1565b61439761577b565b8211156143ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180615b896036913960400191505060405180910390fd5b604051806020016040528069d3c21bcecceda100000084028152509050919050565b6144196159a1565b600083600001511480614430575060008260000151145b1561444c5760405180602001604052806000815250905061486a565b69d3c21bcecceda10000008260000151141561446a5782905061486a565b69d3c21bcecceda1000000836000015114156144885781905061486a565b600069d3c21bcecceda100000061449e8561579a565b60000151816144a957fe5b04905060006144b7856157d1565b600001519050600069d3c21bcecceda10000006144d38661579a565b60000151816144de57fe5b04905060006144ec866157d1565b6000015190506000828502905060008514614580578285828161450b57fe5b041461457f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600069d3c21bcecceda100000082029050600082146146225769d3c21bcecceda10000008282816145ad57fe5b0414614621576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f766572666c6f772078317931202a206669786564312064657465637465640081525060200191505060405180910390fd5b5b80915060008486029050600086146146b3578486828161463e57fe5b04146146b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279312064657465637465640000000000000000000081525060200191505060405180910390fd5b5b600084880290506000881461474157848882816146cc57fe5b0414614740576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783179322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b61474961580e565b878161475157fe5b04965061475c61580e565b858161476457fe5b04945060008588029050600088146147f5578588828161478057fe5b04146147f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f766572666c6f7720783279322064657465637465640000000000000000000081525060200191505060405180910390fd5b5b6147fd6159a1565b6040518060200160405280878152509050614826816040518060200160405280878152506156d2565b9050614840816040518060200160405280868152506156d2565b905061485a816040518060200160405280858152506156d2565b9050809a50505050505050505050505b92915050565b600069d3c21bcecceda100000082600001518161488957fe5b049050919050565b60008082848161489d57fe5b04905060008385816148ab57fe5b0614156148bb57809150506148d3565b6148cf600182614bd390919063ffffffff16565b9150505b92915050565b6148e16159a1565b604051806020016040528069d3c21bcecceda1000000815250905090565b6149076159a1565b6040518060200160405280838152509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f536f727465644f7261636c657300000000000000000000000000000000000000815250600d019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156149d857600080fd5b505afa1580156149ec573d6000803e3d6000fd5b505050506040513d6020811015614a0257600080fd5b8101908080519060200190929190505050905090565b600080831415614a2b5760009050614a98565b6000828402905082848281614a3c57fe5b0414614a93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615cbe6021913960400191505060405180910390fd5b809150505b92915050565b6000614ae083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061581b565b905092915050565b6000614afe602083614bd390919063ffffffff16565b83511015614b74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f736c6963696e67206f7574206f662072616e676500000000000000000000000081525060200191505060405180910390fd5b60006020830184015190508091505092915050565b6000614bcb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506158e1565b905092915050565b600080828401905083811015614c51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008160000151836000015110905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614cf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615aa06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f467265657a6572000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015614e7757600080fd5b505afa158015614e8b573d6000803e3d6000fd5b505050506040513d6020811015614ea157600080fd5b8101908080519060200190929190505050905090565b614ebf614dbc565b73ffffffffffffffffffffffffffffffffffffffff1663e5839836306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015614f3b57600080fd5b505afa158015614f4f573d6000803e3d6000fd5b505050506040513d6020811015614f6557600080fd5b810190808051906020019092919050505015614fcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615b676022913960400191505060405180910390fd5b614fd46159a1565b614fe4614fdf6132c4565b6148ff565b905061500f6009604051806020016040529081600082015481525050826156bd90919063ffffffff16565b156151155761501c6159a1565b61504560096040518060200160405290816000820154815250508361540a90919063ffffffff16565b905061504f6159a1565b61507b60066001016040518060200160405290816000820154815250508361441190919063ffffffff16565b90506150a96006600001604051806020016040529081600082015481525050826152ab90919063ffffffff16565b156150cf576150b86000614387565b60066000016000820151816000015590505061510e565b6150fb81600660000160405180602001604052908160008201548152505061540a90919063ffffffff16565b6006600001600082015181600001559050505b5050615250565b61513e600960405180602001604052908160008201548152505082614c5b90919063ffffffff16565b1561524f5761514b6159a1565b61517482600960405180602001604052908160008201548152505061540a90919063ffffffff16565b905061517e6159a1565b6151aa60066001016040518060200160405290816000820154815250508361441190919063ffffffff16565b90506151d88160066000016040518060200160405290816000820154815250506156d290919063ffffffff16565b60066000016000820151816000015590505061522f600660020160405180602001604052908160008201548152505060066000016040518060200160405290816000820154815250506156bd90919063ffffffff16565b1561524c5760066002016006600001600082015481600001559050505b50505b5b7f49d8cdfe05bae61517c234f65f4088454013bafe561115126a8fe0074dc7700e6152936006600001604051806020016040529081600082015481525050614267565b6040518082815260200191505060405180910390a150565b6000816000015183600001511015905092915050565b6152c96159a1565b600082600001511415615344576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f63616e277420646976696465206279203000000000000000000000000000000081525060200191505060405180910390fd5b600069d3c21bcecceda10000008460000151029050836000015169d3c21bcecceda1000000828161537157fe5b04146153e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f6f766572666c6f7720617420646976696465000000000000000000000000000081525060200191505060405180910390fd5b6040518060200160405280846000015183816153fd57fe5b0481525091505092915050565b6154126159a1565b816000015183600001511015615490576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f737562737472616374696f6e20756e646572666c6f772064657465637465640081525060200191505060405180910390fd5b60405180602001604052808360000151856000015103815250905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f52657365727665000000000000000000000000000000000000000000000000008152506007019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561556c57600080fd5b505afa158015615580573d6000803e3d6000fd5b505050506040513d602081101561559657600080fd5b8101908080519060200190929190505050905090565b6000816000015183600001511115905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f476f6c64546f6b656e00000000000000000000000000000000000000000000008152506009019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561567d57600080fd5b505afa158015615691573d6000803e3d6000fd5b505050506040513d60208110156156a757600080fd5b8101908080519060200190929190505050905090565b60008160000151836000015111905092915050565b6156da6159a1565b6000826000015184600001510190508360000151811015615763576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f616464206f766572666c6f77206465746563746564000000000000000000000081525060200191505060405180910390fd5b60405180602001604052808281525091505092915050565b60007601357c299a88ea76a58924d52ce4f26a85af186c2b9e74905090565b6157a26159a1565b604051806020016040528069d3c21bcecceda1000000808560000151816157c557fe5b04028152509050919050565b6157d96159a1565b604051806020016040528069d3c21bcecceda1000000808560000151816157fc57fe5b04028460000151038152509050919050565b600064e8d4a51000905090565b600080831182906158c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561588c578082015181840152602081019050615871565b50505050905090810190601f1680156158b95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816158d357fe5b049050809150509392505050565b600083831115829061598e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615953578082015181840152602081019050615938565b50505050905090810190601f1680156159805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b604051806020016040528060008152509056fe56616c7565206d75737420626520646966666572656e742066726f6d206578697374696e6720636f6d6d756e69747920726577617264206672616374696f6e20616e64206c657373207468616e20315461726765742076616c696461746f722065706f6368207061796d656e7420756e6368616e6765646572726f722063616c6c696e67206e756d62657256616c696461746f7273496e53657420707265636f6d70696c654261642072657761726473206d756c7469706c69657220706172616d657465727354617267657420766f74696e6720676f6c64206672616374696f6e20756e6368616e6765644f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737354617267657420766f74696e6720676f6c64206672616374696f6e2063616e6e6f74206265206c6172676572207468616e2031426c6f636b207265776172642063616c63756c6174696f6e20666f722079656172732031352d333020756e696d706c656d656e7465646572726f722063616c6c696e672067657456657269666965645365616c4269746d617046726f6d48656164657220707265636f6d70696c6563616e27742063616c6c207768656e20636f6e74726163742069732066726f7a656e63616e277420637265617465206669786964697479206e756d626572206c6172676572207468616e206d61784e6577466978656428294261642074617267657420766f74696e67207969656c6420706172616d65746572736572726f722063616c6c696e672076616c696461746f725369676e65724164647265737346726f6d43757272656e7453657420707265636f6d70696c656572726f722063616c6c696e67206e756d62657256616c696461746f7273496e43757272656e7453657420707265636f6d70696c6554617267657420766f74696e67207969656c64206d757374206265206c657373207468616e206f7220657175616c20746f206d61786572726f722063616c6c696e672076616c696461746f725369676e65724164647265737346726f6d53657420707265636f6d70696c65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776572726f722063616c6c696e67206672616374696f6e4d756c45787020707265636f6d70696c656572726f722063616c6c696e672067657445706f636853697a6520707265636f6d70696c656572726f722063616c6c696e6720676574506172656e745365616c4269746d617020707265636f6d70696c656572726f722063616c6c696e6720676574426c6f636b4e756d62657246726f6d48656164657220707265636f6d70696c654d61782074617267657420766f74696e67207969656c64206d757374206265206c6f776572207468616e2031303025506172746e657220616e642076616c7565206d75737420626520646966666572656e742066726f6d206578697374696e6720636172626f6e206f666673657474696e672066756e646572726f722063616c6c696e67206861736848656164657220707265636f6d70696c65a265627a7a723158201fea1af16bfadbd5742a53730358ec2197851b9c9dfcf4e9384c0acad6175cc564736f6c634300050d0032