Address Details
contract

0xa34117B48313dE0093d599720998415bAb5FD61d

Contract Name
Escrow
Creator
0x456f41–3584da at 0x3c6440–eea49f
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
19520937
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
Escrow




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




EVM Version
istanbul




Verified at
2023-01-16T22:37:29.876922Z

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/identity/Escrow.sol

pragma solidity ^0.5.13;

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

import "./interfaces/IAttestations.sol";
import "./interfaces/IFederatedAttestations.sol";
import "./interfaces/IEscrow.sol";
import "../common/Initializable.sol";
import "../common/interfaces/ICeloVersionedContract.sol";
import "../common/UsingRegistryV2BackwardsCompatible.sol";
import "../common/Signatures.sol";
import "../common/libraries/ReentrancyGuard.sol";

contract Escrow is
  IEscrow,
  ICeloVersionedContract,
  ReentrancyGuard,
  Ownable,
  Initializable,
  // Maintain storage alignment since Escrow was initially deployed with UsingRegistry.sol
  UsingRegistryV2BackwardsCompatible
{
  using SafeMath for uint256;
  using SafeERC20 for ERC20;

  event DefaultTrustedIssuerAdded(address indexed trustedIssuer);
  event DefaultTrustedIssuerRemoved(address indexed trustedIssuer);

  event Transfer(
    address indexed from,
    bytes32 indexed identifier,
    address indexed token,
    uint256 value,
    address paymentId,
    uint256 minAttestations
  );

  event TrustedIssuersSet(address indexed paymentId, address[] trustedIssuers);
  event TrustedIssuersUnset(address indexed paymentId);

  event Withdrawal(
    bytes32 indexed identifier,
    // Note that in previous versions of Escrow.sol, `to` referenced
    // the original sender of the payment
    address indexed to,
    address indexed token,
    uint256 value,
    address paymentId
  );

  event Revocation(
    bytes32 indexed identifier,
    address indexed by,
    address indexed token,
    uint256 value,
    address paymentId
  );

  struct EscrowedPayment {
    bytes32 recipientIdentifier;
    address sender;
    address token;
    uint256 value;
    uint256 sentIndex; // Location of this payment in sender's list of sent payments.
    uint256 receivedIndex; // Location of this payment in receivers's list of received payments.
    uint256 timestamp;
    uint256 expirySeconds;
    uint256 minAttestations;
  }

  // Maps unique payment IDs to escrowed payments.
  // These payment IDs are the temporary wallet addresses created with the escrowed payments.
  mapping(address => EscrowedPayment) public escrowedPayments;

  // Maps receivers' identifiers to a list of received escrowed payment IDs.
  mapping(bytes32 => address[]) public receivedPaymentIds;

  // Maps senders' addresses to a list of sent escrowed payment IDs.
  mapping(address => address[]) public sentPaymentIds;

  // Maps payment ID to a list of issuers whose attestations will be accepted.
  mapping(address => address[]) public trustedIssuersPerPayment;

  // Governable list of trustedIssuers to set for payments by default.
  address[] public defaultTrustedIssuers;

  // Based on benchmarking of FederatedAttestations lookup gas consumption
  // in the worst case (with a significant amount of buffer).
  uint256 public constant MAX_TRUSTED_ISSUERS_PER_PAYMENT = 100;

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

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

  /**
   * @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
   */
  function initialize() external initializer {
    _transferOwnership(msg.sender);
  }

  /**
   * @notice Add an address to the defaultTrustedIssuers list.
   * @param trustedIssuer Address of the trustedIssuer to add.
   * @dev Throws if trustedIssuer is null or already in defaultTrustedIssuers.
   * @dev Throws if defaultTrustedIssuers is already at max allowed length.
   */
  function addDefaultTrustedIssuer(address trustedIssuer) external onlyOwner {
    require(address(0) != trustedIssuer, "trustedIssuer can't be null");
    require(
      defaultTrustedIssuers.length.add(1) <= MAX_TRUSTED_ISSUERS_PER_PAYMENT,
      "defaultTrustedIssuers.length can't exceed allowed number of trustedIssuers"
    );

    // Ensure list of trusted issuers is unique
    for (uint256 i = 0; i < defaultTrustedIssuers.length; i = i.add(1)) {
      require(
        defaultTrustedIssuers[i] != trustedIssuer,
        "trustedIssuer already in defaultTrustedIssuers"
      );
    }
    defaultTrustedIssuers.push(trustedIssuer);
    emit DefaultTrustedIssuerAdded(trustedIssuer);
  }

  /**
   * @notice Remove an address from the defaultTrustedIssuers list.
   * @param trustedIssuer Address of the trustedIssuer to remove.
   * @param index Index of trustedIssuer in defaultTrustedIssuers.
   * @dev Throws if trustedIssuer is not in defaultTrustedIssuers at index.
   */
  function removeDefaultTrustedIssuer(address trustedIssuer, uint256 index) external onlyOwner {
    uint256 numDefaultTrustedIssuers = defaultTrustedIssuers.length;
    require(index < numDefaultTrustedIssuers, "index is invalid");
    require(
      defaultTrustedIssuers[index] == trustedIssuer,
      "trustedIssuer does not match address found at defaultTrustedIssuers[index]"
    );
    if (index != numDefaultTrustedIssuers - 1) {
      // Swap last index with index-to-remove
      defaultTrustedIssuers[index] = defaultTrustedIssuers[numDefaultTrustedIssuers - 1];
    }
    defaultTrustedIssuers.pop();
    emit DefaultTrustedIssuerRemoved(trustedIssuer);
  }

  /**
  * @notice Transfer tokens to a specific user. Supports both identity with privacy (an empty
  *         identifier and 0 minAttestations) and without (with identifier and minAttestations).
  *         Sets trustedIssuers to the issuers listed in `defaultTrustedIssuers`.
  *         (To override this and set custom trusted issuers, use `transferWithTrustedIssuers`.)
  * @param identifier The hashed identifier of a user to transfer to.
  * @param token The token to be transferred.
  * @param value The amount to be transferred.
  * @param expirySeconds The number of seconds before the sender can revoke the payment.
  * @param paymentId The address of the temporary wallet associated with this payment. Users must
  *        prove ownership of the corresponding private key to withdraw from escrow.
  * @param minAttestations The min number of attestations required to withdraw the payment.
  * @return True if transfer succeeded.
  * @dev Throws if 'token' or 'value' is 0.
  * @dev Throws if identifier is null and minAttestations > 0.
  * @dev If minAttestations is 0, trustedIssuers will be set to empty list.
  * @dev msg.sender needs to have already approved this contract to transfer
  */
  // solhint-disable-next-line no-simple-event-func-name
  function transfer(
    bytes32 identifier,
    address token,
    uint256 value,
    uint256 expirySeconds,
    address paymentId,
    uint256 minAttestations
  ) external nonReentrant returns (bool) {
    address[] memory trustedIssuers;
    // If minAttestations == 0, trustedIssuers should remain empty
    if (minAttestations > 0) {
      trustedIssuers = defaultTrustedIssuers;
    }
    return
      _transfer(
        identifier,
        token,
        value,
        expirySeconds,
        paymentId,
        minAttestations,
        trustedIssuers
      );
  }

  /**
  * @notice Transfer tokens to a specific user. Supports both identity with privacy (an empty
  *         identifier and 0 minAttestations) and without (with identifier
  *         and attestations completed by trustedIssuers).
  * @param identifier The hashed identifier of a user to transfer to.
  * @param token The token to be transferred.
  * @param value The amount to be transferred.
  * @param expirySeconds The number of seconds before the sender can revoke the payment.
  * @param paymentId The address of the temporary wallet associated with this payment. Users must
  *        prove ownership of the corresponding private key to withdraw from escrow.
  * @param minAttestations The min number of attestations required to withdraw the payment.
  * @param trustedIssuers Array of issuers whose attestations in FederatedAttestations.sol
  *        will be accepted to prove ownership over an identifier.
  * @return True if transfer succeeded.
  * @dev Throws if 'token' or 'value' is 0.
  * @dev Throws if identifier is null and minAttestations > 0.
  * @dev Throws if minAttestations == 0 but trustedIssuers are provided.
  * @dev msg.sender needs to have already approved this contract to transfer.
  */
  function transferWithTrustedIssuers(
    bytes32 identifier,
    address token,
    uint256 value,
    uint256 expirySeconds,
    address paymentId,
    uint256 minAttestations,
    address[] calldata trustedIssuers
  ) external nonReentrant returns (bool) {
    return
      _transfer(
        identifier,
        token,
        value,
        expirySeconds,
        paymentId,
        minAttestations,
        trustedIssuers
      );
  }

  /**
  * @notice Withdraws tokens for a verified user.
  * @param paymentId The ID for the EscrowedPayment struct that contains all relevant information.
  * @param v The recovery id of the incoming ECDSA signature.
  * @param r Output value r of the ECDSA signature.
  * @param s Output value s of the ECDSA signature.
  * @return True if withdraw succeeded.
  * @dev Throws if 'token' or 'value' is 0.
  * @dev Throws if msg.sender does not prove ownership of the withdraw key.
  */
  function withdraw(address paymentId, uint8 v, bytes32 r, bytes32 s)
    external
    nonReentrant
    returns (bool)
  {
    address signer = Signatures.getSignerOfAddress(msg.sender, v, r, s);
    require(signer == paymentId, "Failed to prove ownership of the withdraw key");
    EscrowedPayment memory payment = escrowedPayments[paymentId];
    require(payment.token != address(0) && payment.value > 0, "Invalid withdraw value.");

    // Due to an old bug, there may exist payments with no identifier and minAttestations > 0
    // So ensure that these fail the attestations check, as they previously would have
    if (payment.minAttestations > 0) {
      bool passedCheck = false;
      address[] memory trustedIssuers = trustedIssuersPerPayment[paymentId];
      address attestationsAddress = registryContract.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID);

      if (trustedIssuers.length > 0) {
        passedCheck =
          hasCompletedV1AttestationsAsTrustedIssuer(
            attestationsAddress,
            payment.recipientIdentifier,
            msg.sender,
            payment.minAttestations,
            trustedIssuers
          ) ||
          hasCompletedV2Attestations(payment.recipientIdentifier, msg.sender, trustedIssuers);
      } else {
        // This is for backwards compatibility, not default/fallback behavior
        passedCheck = hasCompletedV1Attestations(
          attestationsAddress,
          payment.recipientIdentifier,
          msg.sender,
          payment.minAttestations
        );
      }
      require(
        passedCheck,
        "This account does not have the required attestations to withdraw this payment."
      );
    }

    deletePayment(paymentId);

    ERC20(payment.token).safeTransfer(msg.sender, payment.value);

    emit Withdrawal(
      payment.recipientIdentifier,
      msg.sender,
      payment.token,
      payment.value,
      paymentId
    );

    return true;
  }

  /**
  * @notice Revokes tokens for a sender who is redeeming a payment after it has expired.
  * @param paymentId The ID for the EscrowedPayment struct that contains all relevant information.
  * @dev Throws if 'token' or 'value' is 0.
  * @dev Throws if msg.sender is not the sender of payment.
  * @dev Throws if redeem time hasn't been reached yet.
  */
  function revoke(address paymentId) external nonReentrant returns (bool) {
    EscrowedPayment memory payment = escrowedPayments[paymentId];
    require(payment.sender == msg.sender, "Only sender of payment can attempt to revoke payment.");
    require(
      now >= (payment.timestamp.add(payment.expirySeconds)),
      "Transaction not redeemable for sender yet."
    );

    deletePayment(paymentId);

    ERC20(payment.token).safeTransfer(msg.sender, payment.value);

    emit Revocation(
      payment.recipientIdentifier,
      payment.sender,
      payment.token,
      payment.value,
      paymentId
    );

    return true;

  }

  /**
  * @notice Gets array of all Escrowed Payments received by identifier.
  * @param identifier The hash of an identifier of the receiver of the escrowed payment.
  * @return An array containing all the IDs of the Escrowed Payments that were received
  * by the specified receiver.
  */
  function getReceivedPaymentIds(bytes32 identifier) external view returns (address[] memory) {
    return receivedPaymentIds[identifier];
  }

  /**
  * @notice Gets array of all Escrowed Payment IDs sent by sender.
  * @param sender The address of the sender of the escrowed payments.
  * @return An array containing all the IDs of the Escrowed Payments that were sent by the
  * specified sender.
  */
  function getSentPaymentIds(address sender) external view returns (address[] memory) {
    return sentPaymentIds[sender];
  }

  /**
  * @notice Gets array of all trusted issuers set per paymentId.
  * @param paymentId The ID of the payment to get.
  * @return An array of addresses of trusted issuers set for an escrowed payment.
  */
  function getTrustedIssuersPerPayment(address paymentId) external view returns (address[] memory) {
    return trustedIssuersPerPayment[paymentId];
  }

  /**
  * @notice Gets trusted issuers set as default for payments by `transfer` function.
  * @return An array of addresses of trusted issuers.
  */
  function getDefaultTrustedIssuers() public view returns (address[] memory) {
    return defaultTrustedIssuers;
  }

  /**
  * @notice Checks if account has completed minAttestations for identifier in Attestations.sol.
  * @param attestationsAddress The address of Attestations.sol.
  * @param identifier The hash of an identifier for which to look up attestations.
  * @param account The account for which to look up attestations.
  * @param minAttestations The minimum number of attestations to have completed.
  * @return Whether or not attestations in Attestations.sol
  *         exceeds minAttestations for (identifier, account).
  */
  function hasCompletedV1Attestations(
    address attestationsAddress,
    bytes32 identifier,
    address account,
    uint256 minAttestations
  ) internal view returns (bool) {
    IAttestations attestations = IAttestations(attestationsAddress);
    (uint64 completedAttestations, ) = attestations.getAttestationStats(identifier, account);
    return (uint256(completedAttestations) >= minAttestations);
  }

  /**
  * @notice Helper function that checks if one of the trustedIssuers is the old Attestations.sol
  *         contract and applies the escrow V1 check against minAttestations.
  * @param attestationsAddress The address of Attestations.sol.
  * @param identifier The hash of an identifier for which to look up attestations.
  * @param account The account for which to look up attestations.
  * @param minAttestations The minimum number of attestations to have completed.
  * @param trustedIssuers The trustedIssuer addresses to search through.
  * @return Whether or not a trustedIssuer is Attestations.sol & attestations
  *         exceed minAttestations for (identifier, account).
  */
  function hasCompletedV1AttestationsAsTrustedIssuer(
    address attestationsAddress,
    bytes32 identifier,
    address account,
    uint256 minAttestations,
    address[] memory trustedIssuers
  ) internal view returns (bool) {
    for (uint256 i = 0; i < trustedIssuers.length; i = i.add(1)) {
      if (trustedIssuers[i] != attestationsAddress) {
        continue;
      }
      // This can be false; one of the several trustedIssuers listed needs to prove attestations
      return hasCompletedV1Attestations(attestationsAddress, identifier, account, minAttestations);
    }
    return false;
  }

  /**
  * @notice Checks if there are attestations for account <-> identifier from
  *         any of trustedIssuers in FederatedAttestations.sol.
  * @param identifier The hash of an identifier for which to look up attestations.
  * @param account The account for which to look up attestations.
  * @param trustedIssuers Issuer addresses whose attestations to trust.
  * @return Whether or not attestations exist in FederatedAttestations.sol
  *         for (identifier, account).
  */
  function hasCompletedV2Attestations(
    bytes32 identifier,
    address account,
    address[] memory trustedIssuers
  ) internal view returns (bool) {
    // Check for an attestation from a trusted issuer
    IFederatedAttestations federatedAttestations = getFederatedAttestations();
    (, address[] memory accounts, , , ) = federatedAttestations.lookupAttestations(
      identifier,
      trustedIssuers
    );
    // Check if an attestation was found for recipientIdentifier -> account
    for (uint256 i = 0; i < accounts.length; i = i.add(1)) {
      if (accounts[i] == account) {
        return true;
      }
    }
    return false;
  }

  /**
  * @notice Helper function for `transferWithTrustedIssuers` and `transfer`, to
  *         enable backwards-compatible function signature for `transfer`,
  *         and since `transfer` cannot directly call `transferWithTrustedIssuers`
  *         due to reentrancy guard.
  * @param identifier The hashed identifier of a user to transfer to.
  * @param token The token to be transferred.
  * @param value The amount to be transferred.
  * @param expirySeconds The number of seconds before the sender can revoke the payment.
  * @param paymentId The address of the temporary wallet associated with this payment. Users must
  *        prove ownership of the corresponding private key to withdraw from escrow.
  * @param minAttestations The min number of attestations required to withdraw the payment.
  * @param trustedIssuers Array of issuers whose attestations in FederatedAttestations.sol
  *        will be accepted to prove ownership over an identifier.
  * @return True if transfer succeeded.
  * @dev Throws if 'token' or 'value' is 0.
  * @dev Throws if identifier is null and minAttestations > 0.
  * @dev Throws if minAttestations == 0 but trustedIssuers are provided.
  * @dev msg.sender needs to have already approved this contract to transfer.
   */
  function _transfer(
    bytes32 identifier,
    address token,
    uint256 value,
    uint256 expirySeconds,
    address paymentId,
    uint256 minAttestations,
    address[] memory trustedIssuers
  ) private returns (bool) {
    require(token != address(0) && value > 0 && expirySeconds > 0, "Invalid transfer inputs.");
    require(
      !(identifier == 0 && minAttestations > 0),
      "Invalid privacy inputs: Can't require attestations if no identifier"
    );
    // Withdraw logic with trustedIssuers in FederatedAttestations disregards
    // minAttestations, so ensure that this is not set to 0 to prevent confusing behavior
    // This also implies: if identifier == 0 => trustedIssuers.length == 0
    require(
      !(minAttestations == 0 && trustedIssuers.length > 0),
      "trustedIssuers may only be set when attestations are required"
    );

    // Ensure that withdrawal will not fail due to exceeding trustedIssuer limit
    // in FederatedAttestations.lookupAttestations
    require(
      trustedIssuers.length <= MAX_TRUSTED_ISSUERS_PER_PAYMENT,
      "Too many trustedIssuers provided"
    );

    IAttestations attestations = getAttestations();
    require(
      minAttestations <= attestations.getMaxAttestations(),
      "minAttestations larger than limit"
    );

    uint256 sentIndex = sentPaymentIds[msg.sender].push(paymentId).sub(1);
    uint256 receivedIndex = receivedPaymentIds[identifier].push(paymentId).sub(1);

    EscrowedPayment storage newPayment = escrowedPayments[paymentId];
    require(newPayment.timestamp == 0, "paymentId already used");
    newPayment.recipientIdentifier = identifier;
    newPayment.sender = msg.sender;
    newPayment.token = token;
    newPayment.value = value;
    newPayment.sentIndex = sentIndex;
    newPayment.receivedIndex = receivedIndex;
    newPayment.timestamp = block.timestamp;
    newPayment.expirySeconds = expirySeconds;
    newPayment.minAttestations = minAttestations;

    // Avoid unnecessary storage write
    if (trustedIssuers.length > 0) {
      trustedIssuersPerPayment[paymentId] = trustedIssuers;
    }

    ERC20(token).safeTransferFrom(msg.sender, address(this), value);
    emit Transfer(msg.sender, identifier, token, value, paymentId, minAttestations);
    // Split into a second event for ABI backwards compatibility
    emit TrustedIssuersSet(paymentId, trustedIssuers);
    return true;
  }

  /**
  * @notice Deletes the payment from its receiver's and sender's lists of payments,
  * and zeroes out all the data in the struct.
  * @param paymentId The ID of the payment to be deleted.
  */
  function deletePayment(address paymentId) private {
    EscrowedPayment storage payment = escrowedPayments[paymentId];
    address[] storage received = receivedPaymentIds[payment.recipientIdentifier];
    address[] storage sent = sentPaymentIds[payment.sender];

    escrowedPayments[received[received.length - 1]].receivedIndex = payment.receivedIndex;
    received[payment.receivedIndex] = received[received.length - 1];
    received.length = received.length.sub(1);

    escrowedPayments[sent[sent.length - 1]].sentIndex = payment.sentIndex;
    sent[payment.sentIndex] = sent[sent.length - 1];
    sent.length = sent.length.sub(1);

    delete escrowedPayments[paymentId];
    delete trustedIssuersPerPayment[paymentId];
    emit TrustedIssuersUnset(paymentId);
  }
}
        

/Users/carter/git/clabs/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;
    _;
  }
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/common/Signatures.sol

pragma solidity ^0.5.13;

import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";

library Signatures {
  /**
  * @notice Given a signed address, returns the signer of the address.
  * @param message The address that was signed.
  * @param v The recovery id of the incoming ECDSA signature.
  * @param r Output value r of the ECDSA signature.
  * @param s Output value s of the ECDSA signature.
  */
  function getSignerOfAddress(address message, uint8 v, bytes32 r, bytes32 s)
    public
    pure
    returns (address)
  {
    bytes32 hash = keccak256(abi.encodePacked(message));
    return getSignerOfMessageHash(hash, v, r, s);
  }

  /**
  * @notice Given a message hash, returns the signer of the address.
  * @param messageHash The hash of a message.
  * @param v The recovery id of the incoming ECDSA signature.
  * @param r Output value r of the ECDSA signature.
  * @param s Output value s of the ECDSA signature.
  */
  function getSignerOfMessageHash(bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
    public
    pure
    returns (address)
  {
    bytes memory signature = new bytes(65);
    // Concatenate (r, s, v) into signature.
    assembly {
      mstore(add(signature, 32), r)
      mstore(add(signature, 64), s)
      mstore8(add(signature, 96), v)
    }
    bytes32 prefixedHash = ECDSA.toEthSignedMessageHash(messageHash);
    return ECDSA.recover(prefixedHash, signature);
  }

  /**
  * @notice Given a domain separator and a structHash, construct the typed data hash
  * @param eip712DomainSeparator Context specific domain separator
  * @param structHash hash of the typed data struct
  * @return The EIP712 typed data hash
  */
  function toEthSignedTypedDataHash(bytes32 eip712DomainSeparator, bytes32 structHash)
    public
    pure
    returns (bytes32)
  {
    return keccak256(abi.encodePacked("\x19\x01", eip712DomainSeparator, structHash));
  }

  /**
  * @notice Given a domain separator and a structHash and a signature return the signer
  * @param eip712DomainSeparator Context specific domain separator
  * @param structHash hash of the typed data struct
  * @param v The recovery id of the incoming ECDSA signature.
  * @param r Output value r of the ECDSA signature.
  * @param s Output value s of the ECDSA signature.
  */
  function getSignerOfTypedDataHash(
    bytes32 eip712DomainSeparator,
    bytes32 structHash,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) public pure returns (address) {
    bytes memory signature = new bytes(65);
    // Concatenate (r, s, v) into signature.
    assembly {
      mstore(add(signature, 32), r)
      mstore(add(signature, 64), s)
      mstore8(add(signature, 96), v)
    }
    bytes32 prefixedHash = toEthSignedTypedDataHash(eip712DomainSeparator, structHash);
    return ECDSA.recover(prefixedHash, signature);
  }
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/common/UsingRegistryV2.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 "../identity/interfaces/IFederatedAttestations.sol";

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

contract UsingRegistryV2 {
  address internal constant registryAddress = 0x000000000000000000000000000000000000ce10;
  IRegistry public constant registryContract = IRegistry(registryAddress);

  bytes32 internal constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));
  bytes32 internal constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations"));
  bytes32 internal constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(
    abi.encodePacked("DowntimeSlasher")
  );
  bytes32 internal constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256(
    abi.encodePacked("DoubleSigningSlasher")
  );
  bytes32 internal constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));
  bytes32 internal constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange"));
  bytes32 internal constant EXCHANGE_EURO_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeEUR"));
  bytes32 internal constant EXCHANGE_REAL_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeBRL"));

  bytes32 internal constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256(
    abi.encodePacked("FeeCurrencyWhitelist")
  );
  bytes32 internal constant FEDERATED_ATTESTATIONS_REGISTRY_ID = keccak256(
    abi.encodePacked("FederatedAttestations")
  );
  bytes32 internal constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer"));
  bytes32 internal constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));
  bytes32 internal constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));
  bytes32 internal constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256(
    abi.encodePacked("GovernanceSlasher")
  );
  bytes32 internal constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
  bytes32 internal constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve"));
  bytes32 internal constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random"));
  bytes32 internal constant SORTED_ORACLES_REGISTRY_ID = keccak256(
    abi.encodePacked("SortedOracles")
  );
  bytes32 internal constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken"));
  bytes32 internal constant STABLE_EURO_TOKEN_REGISTRY_ID = keccak256(
    abi.encodePacked("StableTokenEUR")
  );
  bytes32 internal constant STABLE_REAL_TOKEN_REGISTRY_ID = keccak256(
    abi.encodePacked("StableTokenBRL")
  );
  bytes32 internal constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators"));

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

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

  function getAccounts() internal view returns (IAccounts) {
    return IAccounts(registryContract.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
  }

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

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

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

  function getExchangeDollar() internal view returns (IExchange) {
    return getExchange();
  }

  function getExchangeEuro() internal view returns (IExchange) {
    return IExchange(registryContract.getAddressForOrDie(EXCHANGE_EURO_REGISTRY_ID));
  }

  function getExchangeREAL() internal view returns (IExchange) {
    return IExchange(registryContract.getAddressForOrDie(EXCHANGE_REAL_REGISTRY_ID));
  }

  function getFeeCurrencyWhitelistRegistry() internal view returns (IFeeCurrencyWhitelist) {
    return
      IFeeCurrencyWhitelist(
        registryContract.getAddressForOrDie(FEE_CURRENCY_WHITELIST_REGISTRY_ID)
      );
  }

  function getFederatedAttestations() internal view returns (IFederatedAttestations) {
    return
      IFederatedAttestations(
        registryContract.getAddressForOrDie(FEDERATED_ATTESTATIONS_REGISTRY_ID)
      );
  }

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

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

  function getGovernance() internal view returns (IGovernance) {
    return IGovernance(registryContract.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
  }

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

  function getRandom() internal view returns (IRandom) {
    return IRandom(registryContract.getAddressForOrDie(RANDOM_REGISTRY_ID));
  }

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

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

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

  function getStableDollarToken() internal view returns (IStableToken) {
    return getStableToken();
  }

  function getStableEuroToken() internal view returns (IStableToken) {
    return IStableToken(registryContract.getAddressForOrDie(STABLE_EURO_TOKEN_REGISTRY_ID));
  }

  function getStableRealToken() internal view returns (IStableToken) {
    return IStableToken(registryContract.getAddressForOrDie(STABLE_REAL_TOKEN_REGISTRY_ID));
  }

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

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/common/UsingRegistryV2BackwardsCompatible.sol

pragma solidity ^0.5.13;

import "./UsingRegistryV2.sol";

contract UsingRegistryV2BackwardsCompatible is UsingRegistryV2 {
  // Placeholder for registry storage var in UsingRegistry and cannot be renamed
  // without breaking release tooling.
  // Use `registryContract` (in UsingRegistryV2) for the actual registry address.
  IRegistry public registry;
}
          

/Users/carter/git/clabs/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);

  function setPaymentDelegation(address, uint256) external;
  function getPaymentDelegation(address) external view returns (address, uint256);
  function isSigner(address, address, bytes32) external view returns (bool);
}
          

/Users/carter/git/clabs/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 Storage version of the contract.
    * @return Major version of the contract.
    * @return Minor version of the contract.
    * @return Patch version of the contract.
   */
  function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256);
}
          

/Users/carter/git/clabs/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);
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/common/interfaces/IFreezer.sol

pragma solidity ^0.5.13;

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

/Users/carter/git/clabs/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);
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/common/libraries/ReentrancyGuard.sol

pragma solidity ^0.5.13;

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

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

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

/Users/carter/git/clabs/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;
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/governance/interfaces/IGovernance.sol

pragma solidity ^0.5.13;

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

/Users/carter/git/clabs/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);
}
          

/Users/carter/git/clabs/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;

}
          

/Users/carter/git/clabs/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;
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/identity/interfaces/IEscrow.sol

pragma solidity ^0.5.13;

interface IEscrow {
  function transfer(
    bytes32 identifier,
    address token,
    uint256 value,
    uint256 expirySeconds,
    address paymentId,
    uint256 minAttestations
  ) external returns (bool);
  function transferWithTrustedIssuers(
    bytes32 identifier,
    address token,
    uint256 value,
    uint256 expirySeconds,
    address paymentId,
    uint256 minAttestations,
    address[] calldata trustedIssuers
  ) external returns (bool);
  function withdraw(address paymentID, uint8 v, bytes32 r, bytes32 s) external returns (bool);
  function revoke(address paymentID) external returns (bool);

  // view functions
  function getReceivedPaymentIds(bytes32 identifier) external view returns (address[] memory);
  function getSentPaymentIds(address sender) external view returns (address[] memory);
  function getTrustedIssuersPerPayment(address paymentId) external view returns (address[] memory);
  function getDefaultTrustedIssuers() external view returns (address[] memory);
  function MAX_TRUSTED_ISSUERS_PER_PAYMENT() external view returns (uint256);

  // onlyOwner functions
  function addDefaultTrustedIssuer(address trustedIssuer) external;
  function removeDefaultTrustedIssuer(address trustedIssuer, uint256 index) external;
}
          

/Users/carter/git/clabs/celo-monorepo/packages/protocol/contracts/identity/interfaces/IFederatedAttestations.sol

pragma solidity ^0.5.13;

interface IFederatedAttestations {
  function registerAttestationAsIssuer(bytes32 identifier, address account, uint64 issuedOn)
    external;
  function registerAttestation(
    bytes32 identifier,
    address issuer,
    address account,
    address signer,
    uint64 issuedOn,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external;
  function revokeAttestation(bytes32 identifier, address issuer, address account) external;
  function batchRevokeAttestations(
    address issuer,
    bytes32[] calldata identifiers,
    address[] calldata accounts
  ) external;

  // view functions
  function lookupAttestations(bytes32 identifier, address[] calldata trustedIssuers)
    external
    view
    returns (
      uint256[] memory,
      address[] memory,
      address[] memory,
      uint64[] memory,
      uint64[] memory
    );
  function lookupIdentifiers(address account, address[] calldata trustedIssuers)
    external
    view
    returns (uint256[] memory, bytes32[] memory);
  function validateAttestationSig(
    bytes32 identifier,
    address issuer,
    address account,
    address signer,
    uint64 issuedOn,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external view;
  function getUniqueAttestationHash(
    bytes32 identifier,
    address issuer,
    address account,
    address signer,
    uint64 issuedOn
  ) external pure returns (bytes32);
}
          

/Users/carter/git/clabs/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);
}
          

/Users/carter/git/clabs/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);
  function getStableBucketCap() external view returns (uint256);
}
          

/Users/carter/git/clabs/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;
}
          

/Users/carter/git/clabs/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);
}
          

/Users/carter/git/clabs/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/cryptography/ECDSA.sol

pragma solidity ^0.5.0;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * NOTE: This call _does not revert_ if the signature is invalid, or
     * if the signer is otherwise unable to be retrieved. In those scenarios,
     * the zero address is returned.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        // Check the signature length
        if (signature.length != 65) {
            return (address(0));
        }

        // Divide the signature in r, s and v variables
        bytes32 r;
        bytes32 s;
        uint8 v;

        // ecrecover takes the signature parameters, and the only way to get them
        // currently is to use assembly.
        // solhint-disable-next-line no-inline-assembly
        assembly {
            r := mload(add(signature, 0x20))
            s := mload(add(signature, 0x40))
            v := byte(0, mload(add(signature, 0x60)))
        }

        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return address(0);
        }

        if (v != 27 && v != 28) {
            return address(0);
        }

        // If the signature is valid (and not malleable), return the signer address
        return ecrecover(hash, v, r, s);
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * replicates the behavior of the
     * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]
     * JSON-RPC method.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }
}
          

/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/ERC20.sol

pragma solidity ^0.5.0;

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

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Destroys `amount` tokens from `account`.`amount` is then deducted
     * from the caller's allowance.
     *
     * See {_burn} and {_approve}.
     */
    function _burnFrom(address account, uint256 amount) internal {
        _burn(account, amount);
        _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
    }
}
          

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

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

pragma solidity ^0.5.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/openzeppelin-solidity/contracts/utils/Address.sol

pragma solidity ^0.5.5;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following 
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

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

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"DefaultTrustedIssuerAdded","inputs":[{"type":"address","name":"trustedIssuer","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"DefaultTrustedIssuerRemoved","inputs":[{"type":"address","name":"trustedIssuer","internalType":"address","indexed":true}],"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":"Revocation","inputs":[{"type":"bytes32","name":"identifier","internalType":"bytes32","indexed":true},{"type":"address","name":"by","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"address","name":"paymentId","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"bytes32","name":"identifier","internalType":"bytes32","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"address","name":"paymentId","internalType":"address","indexed":false},{"type":"uint256","name":"minAttestations","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TrustedIssuersSet","inputs":[{"type":"address","name":"paymentId","internalType":"address","indexed":true},{"type":"address[]","name":"trustedIssuers","internalType":"address[]","indexed":false}],"anonymous":false},{"type":"event","name":"TrustedIssuersUnset","inputs":[{"type":"address","name":"paymentId","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Withdrawal","inputs":[{"type":"bytes32","name":"identifier","internalType":"bytes32","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"address","name":"paymentId","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_TRUSTED_ISSUERS_PER_PAYMENT","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addDefaultTrustedIssuer","inputs":[{"type":"address","name":"trustedIssuer","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"defaultTrustedIssuers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"recipientIdentifier","internalType":"bytes32"},{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"sentIndex","internalType":"uint256"},{"type":"uint256","name":"receivedIndex","internalType":"uint256"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"uint256","name":"expirySeconds","internalType":"uint256"},{"type":"uint256","name":"minAttestations","internalType":"uint256"}],"name":"escrowedPayments","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getDefaultTrustedIssuers","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getReceivedPaymentIds","inputs":[{"type":"bytes32","name":"identifier","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getSentPaymentIds","inputs":[{"type":"address","name":"sender","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getTrustedIssuersPerPayment","inputs":[{"type":"address","name":"paymentId","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[],"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":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"receivedPaymentIds","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"},{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registryContract","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeDefaultTrustedIssuer","inputs":[{"type":"address","name":"trustedIssuer","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"revoke","inputs":[{"type":"address","name":"paymentId","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"sentPaymentIds","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"bytes32","name":"identifier","internalType":"bytes32"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"expirySeconds","internalType":"uint256"},{"type":"address","name":"paymentId","internalType":"address"},{"type":"uint256","name":"minAttestations","internalType":"uint256"}],"constant":false},{"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":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferWithTrustedIssuers","inputs":[{"type":"bytes32","name":"identifier","internalType":"bytes32"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"expirySeconds","internalType":"uint256"},{"type":"address","name":"paymentId","internalType":"address"},{"type":"uint256","name":"minAttestations","internalType":"uint256"},{"type":"address[]","name":"trustedIssuers","internalType":"address[]"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"trustedIssuersPerPayment","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"withdraw","inputs":[{"type":"address","name":"paymentId","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false}]
              

Contract Creation Code

Verify & Publish
0x60806040523480156200001157600080fd5b506040516200471738038062004717833981810160405260208110156200003757600080fd5b81019080805190602001909291905050508060016000819055506000620000636200012b60201b60201c565b905080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35080620001235760018060146101000a81548160ff0219169083151502179055505b505062000133565b600033905090565b6145d480620001436000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063696e3fb1116100de5780638129fc1c116100975780638f80c33e116100715780638f80c33e146109b1578063e1d9a08014610a29578063f2fde38b14610ab7578063f782878914610afb57610173565b80638129fc1c1461093b5780638da5cb5b146109455780638f32d59b1461098f57610173565b8063696e3fb114610735578063702cb75d14610779578063715018a61461081d57806371f7f6d41461082757806374a8f103146108955780637b103999146108f157610173565b806354255be01161013057806354255be0146104525780635b57b65b146104855780635cb516e9146105085780635fb2076f1461059657806360a2a152146105b4578063680d782c1461064d57610173565b8063158ef93e1461017857806318d465321461019a5780631ea153dd1461023357806328c1f99b1461032c5780632c21c7f6146103765780633e68d5d7146103d5575b600080fd5b610180610b49565b604051808215151515815260200191505060405180910390f35b6101dc600480360360208110156101b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b5c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561021f578082015181840152602081019050610204565b505050509050019250505060405180910390f35b610312600480360360e081101561024957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156102ce57600080fd5b8201836020820111156102e057600080fd5b8035906020019184602083028401116401000000008311171561030257600080fd5b9091929391929390505050610c29565b604051808215151515815260200191505060405180910390f35b610334610d17565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61037e610d1d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103c15780820151818401526020810190506103a6565b505050509050019250505060405180910390f35b610438600480360360808110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050610dab565b604051808215151515815260200191505060405180910390f35b61045a6114e7565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6104b16004803603602081101561049b57600080fd5b810190808035906020019092919050505061150e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104f45780820151818401526020810190506104d9565b505050509050019250505060405180910390f35b6105546004803603604081101561051e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059e6115fa565b6040518082815260200191505060405180910390f35b6105f6600480360360208110156105ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ff565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561063957808201518184015260208101905061061e565b505050509050019250505060405180910390f35b61068f6004803603602081101561066357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116cc565b604051808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001878152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390f35b6107776004803603602081101561074b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061175a565b005b610803600480360360c081101561078f57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a80565b604051808215151515815260200191505060405180910390f35b610825611bc1565b005b6108536004803603602081101561083d57600080fd5b8101908080359060200190929190505050611cfc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108d7600480360360208110156108ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d38565b604051808215151515815260200191505060405180910390f35b6108f96120fa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610943612120565b005b61094d6121c8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6109976121f2565b604051808215151515815260200191505060405180910390f35b6109e7600480360360408110156109c757600080fd5b810190808035906020019092919080359060200190929190505050612251565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a7560048036036040811015610a3f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061229c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610af960048036036020811015610acd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122e7565b005b610b4760048036036040811015610b1157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061236d565b005b600160149054906101000a900460ff1681565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610c1d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610bd3575b50505050509050919050565b600060016000808282540192505081905550600080549050610c918a8a8a8a8a8a8a8a80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050612644565b91506000548114610d0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5098975050505050505050565b61ce1081565b60606007805480602002602001604051908101604052809291908181526020018280548015610da157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610d57575b5050505050905090565b6000600160008082825401925050819055506000805490506000731578b071de10e587f49db5934a24ca830fddde196396ef41a1338888886040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff16815260200183815260200182815260200194505050505060206040518083038186803b158015610e5e57600080fd5b505af4158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b810190808051906020019092919050505090508673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180614468602d913960400191505060405180910390fd5b610f27614158565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180610120016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050600073ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16141580156110ab575060008160600151115b61111d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f496e76616c69642077697468647261772076616c75652e00000000000000000081525060200191505060405180910390fd5b6000816101000151111561137f5760008090506060600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156111f157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111a7575b50505050509050600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4174746573746174696f6e730000000000000000000000000000000000000000815250600c019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561129357600080fd5b505afa1580156112a7573d6000803e3d6000fd5b505050506040513d60208110156112bd57600080fd5b8101908080519060200190929190505050905060008251111561130d576112f08185600001513387610100015186612dc4565b80611306575061130584600001513384612e5e565b5b9250611325565b611322818560000151338761010001516132ba565b92505b8261137b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604e81526020018061451d604e913960600191505060405180910390fd5b5050505b611388886133ae565b6113bb338260600151836040015173ffffffffffffffffffffffffffffffffffffffff166138559092919063ffffffff16565b806040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1682600001517fab4f92d461fdbd1af5db2375223d65edb43bcb99129b19ab4954004883e5202584606001518c604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a460019350505060005481146114de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50949350505050565b60008060008060016002600080839350829250819150809050935093509350935090919293565b6060600460008381526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156115a357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611559575b50505050509050919050565b600660205281600052604060002081815481106115c857fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606481565b6060600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156116c057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611676575b50505050509050919050565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040154908060050154908060060154908060070154908060080154905089565b6117626121f2565b6117d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff161415611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f747275737465644973737565722063616e2774206265206e756c6c000000000081525060200191505060405180910390fd5b6064611892600160078054905061392690919063ffffffff16565b11156118e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a8152602001806143ad604a913960600191505060405180910390fd5b60008090505b6007805490508110156119d3578173ffffffffffffffffffffffffffffffffffffffff166007828154811061192057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e81526020018061443a602e913960400191505060405180910390fd5b6119cc60018261392690919063ffffffff16565b90506118ef565b5060078190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff167fad14c01336ff6a84f45f0edc75306d67694dbe035d43d40805d363bf42a1fcf960405160405180910390a250565b60006001600080828254019250508190555060008054905060606000841115611b2d576007805480602002602001604051908101604052809291908181526020018280548015611b2557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611adb575b505050505090505b611b3c89898989898987612644565b9250506000548114611bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509695505050505050565b611bc96121f2565b611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60078181548110611d0957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060016000808282540192505081905550600080549050611d58614158565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180610120016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382015481526020016004820154815260200160058201548152602001600682015481526020016007820154815260200160088201548152505090503373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1614611f1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061456b6035913960400191505060405180910390fd5b611f3a8160e001518260c0015161392690919063ffffffff16565b421015611f92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614383602a913960400191505060405180910390fd5b611f9b846133ae565b611fce338260600151836040015173ffffffffffffffffffffffffffffffffffffffff166138559092919063ffffffff16565b806040015173ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1682600001517f6c464fad8039e6f09ec3a57a29f132cf2573d166833256960e2407eefff8f592846060015188604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a4600192505060005481146120f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff16156121a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b60018060146101000a81548160ff0219169083151502179055506121c6336139ae565b565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612235613af4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6004602052816000526040600020818154811061226a57fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560205281600052604060002081815481106122b557fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6122ef6121f2565b612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61236a816139ae565b50565b6123756121f2565b6123e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006007805490509050808210612466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f696e64657820697320696e76616c69640000000000000000000000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166007838154811061248a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612521576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180614339604a913960600191505060405180910390fd5b6001810382146125bc576007600182038154811061253b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007838154811061257357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60078054806125c757fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558273ffffffffffffffffffffffffffffffffffffffff167f73b0b5acdae4b4df2c8d85a2b1c23acc9e729494c0a1dab7f81e3d73f0c84c0860405160405180910390a2505050565b60008073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141580156126825750600086115b801561268e5750600085115b612700576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c6964207472616e7366657220696e707574732e000000000000000081525060200191505060405180910390fd5b6000801b881480156127125750600083115b15612768576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260438152602001806143f76043913960600191505060405180910390fd5b600083148015612779575060008251115b156127cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806144b6603d913960400191505060405180910390fd5b606482511115612847576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f546f6f206d616e792074727573746564497373756572732070726f766964656481525060200191505060405180910390fd5b6000612851613afc565b90508073ffffffffffffffffffffffffffffffffffffffff16637796a6846040518163ffffffff1660e01b815260040160206040518083038186803b15801561289957600080fd5b505afa1580156128ad573d6000803e3d6000fd5b505050506040513d60208110156128c357600080fd5b810190808051906020019092919050505084111561292c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806144956021913960400191505060405180910390fd5b60006129e36001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208890806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613bd790919063ffffffff16565b90506000612a706001600460008e81526020019081526020016000208990806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613bd790919063ffffffff16565b90506000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816006015414612b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f7061796d656e74496420616c726561647920757365640000000000000000000081525060200191505060405180910390fd5b8b8160000181905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508a8160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550898160030181905550828160040181905550818160050181905550428160060181905550888160070181905550868160080181905550600086511115612c535785600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190612c519291906141d3565b505b612c8033308c8e73ffffffffffffffffffffffffffffffffffffffff16613c21909392919063ffffffff16565b8a73ffffffffffffffffffffffffffffffffffffffff168c3373ffffffffffffffffffffffffffffffffffffffff167f0fc2463e82c3b8a7868e75b68a76a144816d772687e5b09f45c02db37eedf4f68d8c8c604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a48773ffffffffffffffffffffffffffffffffffffffff167fcab1568169bf0442f60fe89e06961cd74fbb1630c0ef54cd00562ff0ded2c2c0876040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015612d9e578082015181840152602081019050612d83565b505050509050019250505060405180910390a26001945050505050979650505050505050565b600080600090505b8251811015612e4f578673ffffffffffffffffffffffffffffffffffffffff16838281518110612df857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614612e2057612e34565b612e2c878787876132ba565b915050612e55565b612e4860018261392690919063ffffffff16565b9050612dcc565b50600090505b95945050505050565b600080612e69613d27565b905060608173ffffffffffffffffffffffffffffffffffffffff1663a862e12e87866040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015612ee3578082015181840152602081019050612ec8565b50505050905001935050505060006040518083038186803b158015612f0757600080fd5b505afa158015612f1b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060a0811015612f4557600080fd5b8101908080516040519392919084640100000000821115612f6557600080fd5b83820191506020820185811115612f7b57600080fd5b8251866020820283011164010000000082111715612f9857600080fd5b8083526020830192505050908051906020019060200280838360005b83811015612fcf578082015181840152602081019050612fb4565b5050505090500160405260200180516040519392919084640100000000821115612ff857600080fd5b8382019150602082018581111561300e57600080fd5b825186602082028301116401000000008211171561302b57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015613062578082015181840152602081019050613047565b505050509050016040526020018051604051939291908464010000000082111561308b57600080fd5b838201915060208201858111156130a157600080fd5b82518660208202830111640100000000821117156130be57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156130f55780820151818401526020810190506130da565b505050509050016040526020018051604051939291908464010000000082111561311e57600080fd5b8382019150602082018581111561313457600080fd5b825186602082028301116401000000008211171561315157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561318857808201518184015260208101905061316d565b50505050905001604052602001805160405193929190846401000000008211156131b157600080fd5b838201915060208201858111156131c757600080fd5b82518660208202830111640100000000821117156131e457600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561321b578082015181840152602081019050613200565b5050505090500160405250505050505091505060008090505b81518110156132ab578573ffffffffffffffffffffffffffffffffffffffff1682828151811061326057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141561329057600193505050506132b3565b6132a460018261392690919063ffffffff16565b9050613234565b506000925050505b9392505050565b60008085905060008173ffffffffffffffffffffffffffffffffffffffff1663596abea587876040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050604080518083038186803b15801561334657600080fd5b505afa15801561335a573d6000803e3d6000fd5b505050506040513d604081101561337057600080fd5b8101908080519060200190929190805190602001909291905050505063ffffffff169050838167ffffffffffffffff16101592505050949350505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000600460008360000154815260200190815260200160002090506000600560008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508260050154600360008460018680549050038154811061348f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819055508160018380549050038154811061350e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168284600501548154811061354957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506135a960018380549050613bd790919063ffffffff16565b82816135b5919061425d565b50826004015460036000836001858054905003815481106135d257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055508060018280549050038154811061365157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168184600401548154811061368c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506136ec60018280549050613bd790919063ffffffff16565b81816136f8919061425d565b50600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556003820160009055600482016000905560058201600090556006820160009055600782016000905560088201600090555050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061380c9190614289565b8373ffffffffffffffffffffffffffffffffffffffff167fbe92782e8f0fc2eaba574c74ef88e93ee08abda36dd1889acb0065d4af631d8860405160405180910390a250505050565b613921838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613e02565b505050565b6000808284019050838110156139a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613a34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806143136026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4174746573746174696f6e730000000000000000000000000000000000000000815250600c019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613b9757600080fd5b505afa158015613bab573d6000803e3d6000fd5b505050506040513d6020811015613bc157600080fd5b8101908080519060200190929190505050905090565b6000613c1983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061404d565b905092915050565b613d21848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613e02565b50505050565b600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4665646572617465644174746573746174696f6e7300000000000000000000008152506015019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613dc257600080fd5b505afa158015613dd6573d6000803e3d6000fd5b505050506040513d6020811015613dec57600080fd5b8101908080519060200190929190505050905090565b613e218273ffffffffffffffffffffffffffffffffffffffff1661410d565b613e93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310613ee25780518252602082019150602081019050602083039250613ebf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613f44576040519150601f19603f3d011682016040523d82523d6000602084013e613f49565b606091505b509150915081613fc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b60008151111561404757808060200190516020811015613fe057600080fd5b8101908080519060200190929190505050614046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806144f3602a913960400191505060405180910390fd5b5b50505050565b60008383111582906140fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156140bf5780820151818401526020810190506140a4565b50505050905090810190601f1680156140ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561414f57506000801b8214155b92505050919050565b60405180610120016040528060008019168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b82805482825590600052602060002090810192821561424c579160200282015b8281111561424b5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906141f3565b5b50905061425991906142aa565b5090565b8154818355818111156142845781836000526020600020918201910161428391906142ed565b5b505050565b50805460008255906000526020600020908101906142a791906142ed565b50565b6142ea91905b808211156142e657600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016142b0565b5090565b90565b61430f91905b8082111561430b5760008160009055506001016142f3565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573737472757374656449737375657220646f6573206e6f74206d61746368206164647265737320666f756e642061742064656661756c7454727573746564497373756572735b696e6465785d5472616e73616374696f6e206e6f742072656465656d61626c6520666f722073656e646572207965742e64656661756c7454727573746564497373756572732e6c656e6774682063616e27742065786365656420616c6c6f776564206e756d626572206f66207472757374656449737375657273496e76616c6964207072697661637920696e707574733a2043616e27742072657175697265206174746573746174696f6e73206966206e6f206964656e7469666965727472757374656449737375657220616c726561647920696e2064656661756c7454727573746564497373756572734661696c656420746f2070726f7665206f776e657273686970206f6620746865207769746864726177206b65796d696e4174746573746174696f6e73206c6172676572207468616e206c696d69747472757374656449737375657273206d6179206f6e6c7920626520736574207768656e206174746573746174696f6e73206172652072657175697265645361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656454686973206163636f756e7420646f6573206e6f74206861766520746865207265717569726564206174746573746174696f6e7320746f2077697468647261772074686973207061796d656e742e4f6e6c792073656e646572206f66207061796d656e742063616e20617474656d707420746f207265766f6b65207061796d656e742ea265627a7a723158202a975a4d757766cd3d5f27211612bc153f3f67c6ed6511374f669c026abbb9b864736f6c634300050d00320000000000000000000000000000000000000000000000000000000000000000

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063696e3fb1116100de5780638129fc1c116100975780638f80c33e116100715780638f80c33e146109b1578063e1d9a08014610a29578063f2fde38b14610ab7578063f782878914610afb57610173565b80638129fc1c1461093b5780638da5cb5b146109455780638f32d59b1461098f57610173565b8063696e3fb114610735578063702cb75d14610779578063715018a61461081d57806371f7f6d41461082757806374a8f103146108955780637b103999146108f157610173565b806354255be01161013057806354255be0146104525780635b57b65b146104855780635cb516e9146105085780635fb2076f1461059657806360a2a152146105b4578063680d782c1461064d57610173565b8063158ef93e1461017857806318d465321461019a5780631ea153dd1461023357806328c1f99b1461032c5780632c21c7f6146103765780633e68d5d7146103d5575b600080fd5b610180610b49565b604051808215151515815260200191505060405180910390f35b6101dc600480360360208110156101b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b5c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561021f578082015181840152602081019050610204565b505050509050019250505060405180910390f35b610312600480360360e081101561024957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156102ce57600080fd5b8201836020820111156102e057600080fd5b8035906020019184602083028401116401000000008311171561030257600080fd5b9091929391929390505050610c29565b604051808215151515815260200191505060405180910390f35b610334610d17565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61037e610d1d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103c15780820151818401526020810190506103a6565b505050509050019250505060405180910390f35b610438600480360360808110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050610dab565b604051808215151515815260200191505060405180910390f35b61045a6114e7565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6104b16004803603602081101561049b57600080fd5b810190808035906020019092919050505061150e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104f45780820151818401526020810190506104d9565b505050509050019250505060405180910390f35b6105546004803603604081101561051e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059e6115fa565b6040518082815260200191505060405180910390f35b6105f6600480360360208110156105ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ff565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561063957808201518184015260208101905061061e565b505050509050019250505060405180910390f35b61068f6004803603602081101561066357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116cc565b604051808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001878152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390f35b6107776004803603602081101561074b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061175a565b005b610803600480360360c081101561078f57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a80565b604051808215151515815260200191505060405180910390f35b610825611bc1565b005b6108536004803603602081101561083d57600080fd5b8101908080359060200190929190505050611cfc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108d7600480360360208110156108ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d38565b604051808215151515815260200191505060405180910390f35b6108f96120fa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610943612120565b005b61094d6121c8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6109976121f2565b604051808215151515815260200191505060405180910390f35b6109e7600480360360408110156109c757600080fd5b810190808035906020019092919080359060200190929190505050612251565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a7560048036036040811015610a3f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061229c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610af960048036036020811015610acd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122e7565b005b610b4760048036036040811015610b1157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061236d565b005b600160149054906101000a900460ff1681565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610c1d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610bd3575b50505050509050919050565b600060016000808282540192505081905550600080549050610c918a8a8a8a8a8a8a8a80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050612644565b91506000548114610d0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5098975050505050505050565b61ce1081565b60606007805480602002602001604051908101604052809291908181526020018280548015610da157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610d57575b5050505050905090565b6000600160008082825401925050819055506000805490506000731578b071de10e587f49db5934a24ca830fddde196396ef41a1338888886040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff16815260200183815260200182815260200194505050505060206040518083038186803b158015610e5e57600080fd5b505af4158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b810190808051906020019092919050505090508673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180614468602d913960400191505060405180910390fd5b610f27614158565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180610120016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820154815250509050600073ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16141580156110ab575060008160600151115b61111d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f496e76616c69642077697468647261772076616c75652e00000000000000000081525060200191505060405180910390fd5b6000816101000151111561137f5760008090506060600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156111f157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111a7575b50505050509050600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4174746573746174696f6e730000000000000000000000000000000000000000815250600c019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561129357600080fd5b505afa1580156112a7573d6000803e3d6000fd5b505050506040513d60208110156112bd57600080fd5b8101908080519060200190929190505050905060008251111561130d576112f08185600001513387610100015186612dc4565b80611306575061130584600001513384612e5e565b5b9250611325565b611322818560000151338761010001516132ba565b92505b8261137b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604e81526020018061451d604e913960600191505060405180910390fd5b5050505b611388886133ae565b6113bb338260600151836040015173ffffffffffffffffffffffffffffffffffffffff166138559092919063ffffffff16565b806040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1682600001517fab4f92d461fdbd1af5db2375223d65edb43bcb99129b19ab4954004883e5202584606001518c604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a460019350505060005481146114de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50949350505050565b60008060008060016002600080839350829250819150809050935093509350935090919293565b6060600460008381526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156115a357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611559575b50505050509050919050565b600660205281600052604060002081815481106115c857fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606481565b6060600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156116c057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611676575b50505050509050919050565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040154908060050154908060060154908060070154908060080154905089565b6117626121f2565b6117d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff161415611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f747275737465644973737565722063616e2774206265206e756c6c000000000081525060200191505060405180910390fd5b6064611892600160078054905061392690919063ffffffff16565b11156118e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a8152602001806143ad604a913960600191505060405180910390fd5b60008090505b6007805490508110156119d3578173ffffffffffffffffffffffffffffffffffffffff166007828154811061192057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e81526020018061443a602e913960400191505060405180910390fd5b6119cc60018261392690919063ffffffff16565b90506118ef565b5060078190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff167fad14c01336ff6a84f45f0edc75306d67694dbe035d43d40805d363bf42a1fcf960405160405180910390a250565b60006001600080828254019250508190555060008054905060606000841115611b2d576007805480602002602001604051908101604052809291908181526020018280548015611b2557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611adb575b505050505090505b611b3c89898989898987612644565b9250506000548114611bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b509695505050505050565b611bc96121f2565b611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60078181548110611d0957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060016000808282540192505081905550600080549050611d58614158565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180610120016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382015481526020016004820154815260200160058201548152602001600682015481526020016007820154815260200160088201548152505090503373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1614611f1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061456b6035913960400191505060405180910390fd5b611f3a8160e001518260c0015161392690919063ffffffff16565b421015611f92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614383602a913960400191505060405180910390fd5b611f9b846133ae565b611fce338260600151836040015173ffffffffffffffffffffffffffffffffffffffff166138559092919063ffffffff16565b806040015173ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1682600001517f6c464fad8039e6f09ec3a57a29f132cf2573d166833256960e2407eefff8f592846060015188604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a4600192505060005481146120f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff16156121a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b60018060146101000a81548160ff0219169083151502179055506121c6336139ae565b565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612235613af4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6004602052816000526040600020818154811061226a57fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560205281600052604060002081815481106122b557fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6122ef6121f2565b612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61236a816139ae565b50565b6123756121f2565b6123e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006007805490509050808210612466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f696e64657820697320696e76616c69640000000000000000000000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166007838154811061248a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612521576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180614339604a913960600191505060405180910390fd5b6001810382146125bc576007600182038154811061253b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007838154811061257357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60078054806125c757fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558273ffffffffffffffffffffffffffffffffffffffff167f73b0b5acdae4b4df2c8d85a2b1c23acc9e729494c0a1dab7f81e3d73f0c84c0860405160405180910390a2505050565b60008073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141580156126825750600086115b801561268e5750600085115b612700576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c6964207472616e7366657220696e707574732e000000000000000081525060200191505060405180910390fd5b6000801b881480156127125750600083115b15612768576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260438152602001806143f76043913960600191505060405180910390fd5b600083148015612779575060008251115b156127cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806144b6603d913960400191505060405180910390fd5b606482511115612847576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f546f6f206d616e792074727573746564497373756572732070726f766964656481525060200191505060405180910390fd5b6000612851613afc565b90508073ffffffffffffffffffffffffffffffffffffffff16637796a6846040518163ffffffff1660e01b815260040160206040518083038186803b15801561289957600080fd5b505afa1580156128ad573d6000803e3d6000fd5b505050506040513d60208110156128c357600080fd5b810190808051906020019092919050505084111561292c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806144956021913960400191505060405180910390fd5b60006129e36001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208890806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613bd790919063ffffffff16565b90506000612a706001600460008e81526020019081526020016000208990806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613bd790919063ffffffff16565b90506000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816006015414612b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f7061796d656e74496420616c726561647920757365640000000000000000000081525060200191505060405180910390fd5b8b8160000181905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508a8160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550898160030181905550828160040181905550818160050181905550428160060181905550888160070181905550868160080181905550600086511115612c535785600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190612c519291906141d3565b505b612c8033308c8e73ffffffffffffffffffffffffffffffffffffffff16613c21909392919063ffffffff16565b8a73ffffffffffffffffffffffffffffffffffffffff168c3373ffffffffffffffffffffffffffffffffffffffff167f0fc2463e82c3b8a7868e75b68a76a144816d772687e5b09f45c02db37eedf4f68d8c8c604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a48773ffffffffffffffffffffffffffffffffffffffff167fcab1568169bf0442f60fe89e06961cd74fbb1630c0ef54cd00562ff0ded2c2c0876040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015612d9e578082015181840152602081019050612d83565b505050509050019250505060405180910390a26001945050505050979650505050505050565b600080600090505b8251811015612e4f578673ffffffffffffffffffffffffffffffffffffffff16838281518110612df857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614612e2057612e34565b612e2c878787876132ba565b915050612e55565b612e4860018261392690919063ffffffff16565b9050612dcc565b50600090505b95945050505050565b600080612e69613d27565b905060608173ffffffffffffffffffffffffffffffffffffffff1663a862e12e87866040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015612ee3578082015181840152602081019050612ec8565b50505050905001935050505060006040518083038186803b158015612f0757600080fd5b505afa158015612f1b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060a0811015612f4557600080fd5b8101908080516040519392919084640100000000821115612f6557600080fd5b83820191506020820185811115612f7b57600080fd5b8251866020820283011164010000000082111715612f9857600080fd5b8083526020830192505050908051906020019060200280838360005b83811015612fcf578082015181840152602081019050612fb4565b5050505090500160405260200180516040519392919084640100000000821115612ff857600080fd5b8382019150602082018581111561300e57600080fd5b825186602082028301116401000000008211171561302b57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015613062578082015181840152602081019050613047565b505050509050016040526020018051604051939291908464010000000082111561308b57600080fd5b838201915060208201858111156130a157600080fd5b82518660208202830111640100000000821117156130be57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156130f55780820151818401526020810190506130da565b505050509050016040526020018051604051939291908464010000000082111561311e57600080fd5b8382019150602082018581111561313457600080fd5b825186602082028301116401000000008211171561315157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561318857808201518184015260208101905061316d565b50505050905001604052602001805160405193929190846401000000008211156131b157600080fd5b838201915060208201858111156131c757600080fd5b82518660208202830111640100000000821117156131e457600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561321b578082015181840152602081019050613200565b5050505090500160405250505050505091505060008090505b81518110156132ab578573ffffffffffffffffffffffffffffffffffffffff1682828151811061326057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141561329057600193505050506132b3565b6132a460018261392690919063ffffffff16565b9050613234565b506000925050505b9392505050565b60008085905060008173ffffffffffffffffffffffffffffffffffffffff1663596abea587876040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050604080518083038186803b15801561334657600080fd5b505afa15801561335a573d6000803e3d6000fd5b505050506040513d604081101561337057600080fd5b8101908080519060200190929190805190602001909291905050505063ffffffff169050838167ffffffffffffffff16101592505050949350505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000600460008360000154815260200190815260200160002090506000600560008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508260050154600360008460018680549050038154811061348f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819055508160018380549050038154811061350e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168284600501548154811061354957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506135a960018380549050613bd790919063ffffffff16565b82816135b5919061425d565b50826004015460036000836001858054905003815481106135d257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055508060018280549050038154811061365157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168184600401548154811061368c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506136ec60018280549050613bd790919063ffffffff16565b81816136f8919061425d565b50600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556003820160009055600482016000905560058201600090556006820160009055600782016000905560088201600090555050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061380c9190614289565b8373ffffffffffffffffffffffffffffffffffffffff167fbe92782e8f0fc2eaba574c74ef88e93ee08abda36dd1889acb0065d4af631d8860405160405180910390a250505050565b613921838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613e02565b505050565b6000808284019050838110156139a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613a34576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806143136026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4174746573746174696f6e730000000000000000000000000000000000000000815250600c019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613b9757600080fd5b505afa158015613bab573d6000803e3d6000fd5b505050506040513d6020811015613bc157600080fd5b8101908080519060200190929190505050905090565b6000613c1983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061404d565b905092915050565b613d21848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613e02565b50505050565b600061ce1073ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f4665646572617465644174746573746174696f6e7300000000000000000000008152506015019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613dc257600080fd5b505afa158015613dd6573d6000803e3d6000fd5b505050506040513d6020811015613dec57600080fd5b8101908080519060200190929190505050905090565b613e218273ffffffffffffffffffffffffffffffffffffffff1661410d565b613e93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310613ee25780518252602082019150602081019050602083039250613ebf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613f44576040519150601f19603f3d011682016040523d82523d6000602084013e613f49565b606091505b509150915081613fc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b60008151111561404757808060200190516020811015613fe057600080fd5b8101908080519060200190929190505050614046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806144f3602a913960400191505060405180910390fd5b5b50505050565b60008383111582906140fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156140bf5780820151818401526020810190506140a4565b50505050905090810190601f1680156140ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561414f57506000801b8214155b92505050919050565b60405180610120016040528060008019168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b82805482825590600052602060002090810192821561424c579160200282015b8281111561424b5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906141f3565b5b50905061425991906142aa565b5090565b8154818355818111156142845781836000526020600020918201910161428391906142ed565b5b505050565b50805460008255906000526020600020908101906142a791906142ed565b50565b6142ea91905b808211156142e657600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016142b0565b5090565b90565b61430f91905b8082111561430b5760008160009055506001016142f3565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573737472757374656449737375657220646f6573206e6f74206d61746368206164647265737320666f756e642061742064656661756c7454727573746564497373756572735b696e6465785d5472616e73616374696f6e206e6f742072656465656d61626c6520666f722073656e646572207965742e64656661756c7454727573746564497373756572732e6c656e6774682063616e27742065786365656420616c6c6f776564206e756d626572206f66207472757374656449737375657273496e76616c6964207072697661637920696e707574733a2043616e27742072657175697265206174746573746174696f6e73206966206e6f206964656e7469666965727472757374656449737375657220616c726561647920696e2064656661756c7454727573746564497373756572734661696c656420746f2070726f7665206f776e657273686970206f6620746865207769746864726177206b65796d696e4174746573746174696f6e73206c6172676572207468616e206c696d69747472757374656449737375657273206d6179206f6e6c7920626520736574207768656e206174746573746174696f6e73206172652072657175697265645361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656454686973206163636f756e7420646f6573206e6f74206861766520746865207265717569726564206174746573746174696f6e7320746f2077697468647261772074686973207061796d656e742e4f6e6c792073656e646572206f66207061796d656e742063616e20617474656d707420746f207265766f6b65207061796d656e742ea265627a7a723158202a975a4d757766cd3d5f27211612bc153f3f67c6ed6511374f669c026abbb9b864736f6c634300050d0032