Celo Epoch Data is now available on Celo Explorer! READ MORE

Contract Address Details

0xc72cf67B173c3d92564EB653d9bF73392825ADCE

Contract Name
Accounts
Creator
0xf3eb91–a79239 at 0x311d8c–e1b236
Balance
0 CELO ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
16567319
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
Accounts




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




EVM Version
istanbul




Verified at
2022-09-21T08:53:37.903810Z

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/Accounts.sol

pragma solidity ^0.5.13;

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

import "./interfaces/IAccounts.sol";

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

contract Accounts is
  IAccounts,
  ICeloVersionedContract,
  Ownable,
  ReentrancyGuard,
  Initializable,
  UsingRegistry
{
  using FixidityLib for FixidityLib.Fraction;
  using SafeMath for uint256;

  struct Signers {
    // The address that is authorized to vote in governance and validator elections on behalf of the
    // account. The account can vote as well, whether or not a vote signing key has been specified.
    address vote;
    // The address that is authorized to manage a validator or validator group and sign consensus
    // messages on behalf of the account. The account can manage the validator, whether or not a
    // validator signing key has been specified. However, if a validator signing key has been
    // specified, only that key may actually participate in consensus.
    address validator;
    // The address of the key with which this account wants to sign attestations on the Attestations
    // contract
    address attestation;
  }

  struct SignerAuthorization {
    bool started;
    bool completed;
  }

  struct Account {
    bool exists;
    // [Deprecated] Each account may authorize signing keys to use for voting,
    // validating or attestation. These keys may not be keys of other accounts,
    // and may not be authorized by any other account for any purpose.
    Signers signers;
    // The address at which the account expects to receive transfers. If it's empty/0x0, the
    // account indicates that an address exchange should be initiated with the dataEncryptionKey
    address walletAddress;
    // An optional human readable identifier for the account
    string name;
    // The ECDSA public key used to encrypt and decrypt data for this account
    bytes dataEncryptionKey;
    // The URL under which an account adds metadata and claims
    string metadataURL;
  }

  struct PaymentDelegation {
    // Address that should receive a fraction of validator payments.
    address beneficiary;
    // Fraction of payment to delegate to `beneficiary`.
    FixidityLib.Fraction fraction;
  }

  mapping(address => Account) internal accounts;
  // Maps authorized signers to the account that provided the authorization.
  mapping(address => address) public authorizedBy;
  // Default signers by account (replaces the legacy Signers struct on Account)
  mapping(address => mapping(bytes32 => address)) defaultSigners;
  // All signers and their roles for a given account
  // solhint-disable-next-line max-line-length
  mapping(address => mapping(bytes32 => mapping(address => SignerAuthorization))) signerAuthorizations;

  bytes32 public constant EIP712_AUTHORIZE_SIGNER_TYPEHASH = keccak256(
    "AuthorizeSigner(address account,address signer,bytes32 role)"
  );
  bytes32 public eip712DomainSeparator;

  // A per-account list of CIP8 storage roots, bypassing CIP3.
  mapping(address => bytes[]) public offchainStorageRoots;

  // Optional per-account validator payment delegation information.
  mapping(address => PaymentDelegation) internal paymentDelegations;

  bytes32 constant ValidatorSigner = keccak256(abi.encodePacked("celo.org/core/validator"));
  bytes32 constant AttestationSigner = keccak256(abi.encodePacked("celo.org/core/attestation"));
  bytes32 constant VoteSigner = keccak256(abi.encodePacked("celo.org/core/vote"));

  event AttestationSignerAuthorized(address indexed account, address signer);
  event VoteSignerAuthorized(address indexed account, address signer);
  event ValidatorSignerAuthorized(address indexed account, address signer);
  event SignerAuthorized(address indexed account, address signer, bytes32 indexed role);
  event SignerAuthorizationStarted(address indexed account, address signer, bytes32 indexed role);
  event SignerAuthorizationCompleted(address indexed account, address signer, bytes32 indexed role);
  event AttestationSignerRemoved(address indexed account, address oldSigner);
  event VoteSignerRemoved(address indexed account, address oldSigner);
  event ValidatorSignerRemoved(address indexed account, address oldSigner);
  event IndexedSignerSet(address indexed account, address signer, bytes32 role);
  event IndexedSignerRemoved(address indexed account, address oldSigner, bytes32 role);
  event DefaultSignerSet(address indexed account, address signer, bytes32 role);
  event DefaultSignerRemoved(address indexed account, address oldSigner, bytes32 role);
  event LegacySignerSet(address indexed account, address signer, bytes32 role);
  event LegacySignerRemoved(address indexed account, address oldSigner, bytes32 role);
  event SignerRemoved(address indexed account, address oldSigner, bytes32 indexed role);
  event AccountDataEncryptionKeySet(address indexed account, bytes dataEncryptionKey);
  event AccountNameSet(address indexed account, string name);
  event AccountMetadataURLSet(address indexed account, string metadataURL);
  event AccountWalletAddressSet(address indexed account, address walletAddress);
  event AccountCreated(address indexed account);
  event OffchainStorageRootAdded(address indexed account, bytes url);
  event OffchainStorageRootRemoved(address indexed account, bytes url, uint256 index);
  event PaymentDelegationSet(address indexed beneficiary, uint256 fraction);

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

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

  /**
   * @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
   * @param registryAddress The address of the registry core smart contract.
   */
  function initialize(address registryAddress) external initializer {
    _transferOwnership(msg.sender);
    setRegistry(registryAddress);
    setEip712DomainSeparator();
  }

  /**
   * @notice Sets the EIP712 domain separator for the Celo Accounts abstraction.
   */
  function setEip712DomainSeparator() public {
    uint256 chainId;
    assembly {
      chainId := chainid
    }

    eip712DomainSeparator = keccak256(
      abi.encode(
        keccak256(
          "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        ),
        keccak256(bytes("Celo Core Contracts")),
        keccak256("1.0"),
        chainId,
        address(this)
      )
    );
  }

  /**
   * @notice Convenience Setter for the dataEncryptionKey and wallet address for an account
   * @param name A string to set as the name of the account
   * @param dataEncryptionKey secp256k1 public key for data encryption. Preferably compressed.
   * @param walletAddress The wallet address to set for the account
   * @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.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender` (unless the wallet address
   *      is 0x0 or msg.sender).
   */
  function setAccount(
    string calldata name,
    bytes calldata dataEncryptionKey,
    address walletAddress,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external {
    if (!isAccount(msg.sender)) {
      createAccount();
    }
    setName(name);
    setAccountDataEncryptionKey(dataEncryptionKey);
    setWalletAddress(walletAddress, v, r, s);
  }

  /**
   * @notice Creates an account.
   * @return True if account creation succeeded.
   */
  function createAccount() public returns (bool) {
    require(isNotAccount(msg.sender) && isNotAuthorizedSigner(msg.sender), "Account exists");
    Account storage account = accounts[msg.sender];
    account.exists = true;
    emit AccountCreated(msg.sender);
    return true;
  }

  /**
   * @notice Setter for the name of an account.
   * @param name The name to set.
   */
  function setName(string memory name) public {
    require(isAccount(msg.sender), "Unknown account");
    Account storage account = accounts[msg.sender];
    account.name = name;
    emit AccountNameSet(msg.sender, name);
  }

  /**
   * @notice Setter for the wallet address for an account
   * @param walletAddress The wallet address to set for the account
   * @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.
   * @dev Wallet address can be zero. This means that the owner of the wallet
   *  does not want to be paid directly without interaction, and instead wants users to
   * contact them, using the data encryption key, and arrange a payment.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender` (unless the wallet address
   *      is 0x0 or msg.sender).
   */
  function setWalletAddress(address walletAddress, uint8 v, bytes32 r, bytes32 s) public {
    require(isAccount(msg.sender), "Unknown account");
    if (!(walletAddress == msg.sender || walletAddress == address(0x0))) {
      address signer = Signatures.getSignerOfAddress(msg.sender, v, r, s);
      require(signer == walletAddress, "Invalid signature");
    }
    Account storage account = accounts[msg.sender];
    account.walletAddress = walletAddress;
    emit AccountWalletAddressSet(msg.sender, walletAddress);
  }

  /**
   * @notice Setter for the data encryption key and version.
   * @param dataEncryptionKey secp256k1 public key for data encryption. Preferably compressed.
   */
  function setAccountDataEncryptionKey(bytes memory dataEncryptionKey) public {
    require(dataEncryptionKey.length >= 33, "data encryption key length <= 32");
    Account storage account = accounts[msg.sender];
    account.dataEncryptionKey = dataEncryptionKey;
    emit AccountDataEncryptionKeySet(msg.sender, dataEncryptionKey);
  }

  /**
   * @notice Setter for the metadata of an account.
   * @param metadataURL The URL to access the metadata.
   */
  function setMetadataURL(string calldata metadataURL) external {
    require(isAccount(msg.sender), "Unknown account");
    Account storage account = accounts[msg.sender];
    account.metadataURL = metadataURL;
    emit AccountMetadataURLSet(msg.sender, metadataURL);
  }

  /**
   * @notice Adds a new CIP8 storage root.
   * @param url The URL pointing to the offchain storage root.
   */
  function addStorageRoot(bytes calldata url) external {
    require(isAccount(msg.sender), "Unknown account");
    offchainStorageRoots[msg.sender].push(url);
    emit OffchainStorageRootAdded(msg.sender, url);
  }

  /**
   * @notice Removes a CIP8 storage root.
   * @param index The index of the storage root to be removed in the account's
   * list of storage roots.
   * @dev The order of storage roots may change after this operation (the last
   * storage root will be moved to `index`), be aware of this if removing
   * multiple storage roots at a time.
   */
  function removeStorageRoot(uint256 index) external {
    require(isAccount(msg.sender), "Unknown account");
    require(index < offchainStorageRoots[msg.sender].length, "Invalid storage root index");
    uint256 lastIndex = offchainStorageRoots[msg.sender].length - 1;
    bytes memory url = offchainStorageRoots[msg.sender][index];
    offchainStorageRoots[msg.sender][index] = offchainStorageRoots[msg.sender][lastIndex];
    offchainStorageRoots[msg.sender].length--;
    emit OffchainStorageRootRemoved(msg.sender, url, index);
  }

  /**
   * @notice Returns the full list of offchain storage roots for an account.
   * @param account The account whose storage roots to return.
   * @return List of storage root URLs.
   */
  function getOffchainStorageRoots(address account)
    external
    view
    returns (bytes memory, uint256[] memory)
  {
    require(isAccount(account), "Unknown account");
    uint256 numberRoots = offchainStorageRoots[account].length;
    uint256 totalLength = 0;
    for (uint256 i = 0; i < numberRoots; i++) {
      totalLength = totalLength.add(offchainStorageRoots[account][i].length);
    }

    bytes memory concatenated = new bytes(totalLength);
    uint256 lastIndex = 0;
    uint256[] memory lengths = new uint256[](numberRoots);
    for (uint256 i = 0; i < numberRoots; i++) {
      bytes storage root = offchainStorageRoots[account][i];
      lengths[i] = root.length;
      for (uint256 j = 0; j < lengths[i]; j++) {
        concatenated[lastIndex] = root[j];
        lastIndex++;
      }
    }

    return (concatenated, lengths);
  }

  /**
   * @notice Sets validator payment delegation settings.
   * @param beneficiary The address that should receive a portion of validator
   * payments.
   * @param fraction The fraction of the validator's payment that should be
   * diverted to `beneficiary` every epoch, given as FixidityLib value. Must not
   * be greater than 1.
   * @dev Use `deletePaymentDelegation` to unset the payment delegation.
   */
  function setPaymentDelegation(address beneficiary, uint256 fraction) public {
    require(isAccount(msg.sender), "Not an account");
    require(beneficiary != address(0), "Beneficiary cannot be address 0x0");
    FixidityLib.Fraction memory f = FixidityLib.wrap(fraction);
    require(f.lte(FixidityLib.fixed1()), "Fraction must not be greater than 1");
    paymentDelegations[msg.sender] = PaymentDelegation(beneficiary, f);
    emit PaymentDelegationSet(beneficiary, fraction);
  }

  /**
   * @notice Removes a validator's payment delegation by setting benficiary and
   * fraction to 0.
   */
  function deletePaymentDelegation() public {
    require(isAccount(msg.sender), "Not an account");
    paymentDelegations[msg.sender] = PaymentDelegation(address(0x0), FixidityLib.wrap(0));
    emit PaymentDelegationSet(address(0x0), 0);
  }

  /**
   * @notice Gets validator payment delegation settings.
   * @param account Account of the validator.
   * @return Beneficiary address and fraction of payment delegated.
   */
  function getPaymentDelegation(address account) external view returns (address, uint256) {
    PaymentDelegation storage delegation = paymentDelegations[account];
    return (delegation.beneficiary, delegation.fraction.unwrap());
  }

  /**
   * @notice Set the indexed signer for a specific role
   * @param signer the address to set as default
   * @param role the role to register a default signer for
   */
  function setIndexedSigner(address signer, bytes32 role) public {
    require(isAccount(msg.sender), "Not an account");
    require(isNotAccount(signer), "Cannot authorize account as signer");
    require(
      isNotAuthorizedSignerForAnotherAccount(msg.sender, signer),
      "Not a signer for this account"
    );
    require(isSigner(msg.sender, signer, role), "Must authorize signer before setting as default");

    Account storage account = accounts[msg.sender];
    if (isLegacyRole(role)) {
      if (role == VoteSigner) {
        account.signers.vote = signer;
      } else if (role == AttestationSigner) {
        account.signers.attestation = signer;
      } else if (role == ValidatorSigner) {
        account.signers.validator = signer;
      }
      emit LegacySignerSet(msg.sender, signer, role);
    } else {
      defaultSigners[msg.sender][role] = signer;
      emit DefaultSignerSet(msg.sender, signer, role);
    }

    emit IndexedSignerSet(msg.sender, signer, role);
  }

  /**
   * @notice Authorizes an address to act as a signer, for `role`, on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @param role The role to authorize signing for.
   * @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.
   * @dev v, r, s constitute `signer`'s EIP712 signature over `role`, `msg.sender`  
   *      and `signer`.
   */
  function authorizeSignerWithSignature(address signer, bytes32 role, uint8 v, bytes32 r, bytes32 s)
    public
  {
    authorizeAddressWithRole(signer, role, v, r, s);
    signerAuthorizations[msg.sender][role][signer] = SignerAuthorization({
      started: true,
      completed: true
    });

    emit SignerAuthorized(msg.sender, signer, role);
  }

  function legacyAuthorizeSignerWithSignature(
    address signer,
    bytes32 role,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) private {
    authorizeAddress(signer, v, r, s);
    signerAuthorizations[msg.sender][role][signer] = SignerAuthorization({
      started: true,
      completed: true
    });

    emit SignerAuthorized(msg.sender, signer, role);
  }

  /**
   * @notice Authorizes an address to sign votes on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @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.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeVoteSigner(address signer, uint8 v, bytes32 r, bytes32 s)
    external
    nonReentrant
  {
    legacyAuthorizeSignerWithSignature(signer, VoteSigner, v, r, s);
    setIndexedSigner(signer, VoteSigner);

    emit VoteSignerAuthorized(msg.sender, signer);
  }

  /**
   * @notice Authorizes an address to sign consensus messages on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @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.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeValidatorSigner(address signer, uint8 v, bytes32 r, bytes32 s)
    external
    nonReentrant
  {
    legacyAuthorizeSignerWithSignature(signer, ValidatorSigner, v, r, s);
    setIndexedSigner(signer, ValidatorSigner);

    require(!getValidators().isValidator(msg.sender), "Cannot authorize validator signer");
    emit ValidatorSignerAuthorized(msg.sender, signer);
  }

  /**
   * @notice Authorizes an address to sign consensus messages on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @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.
   * @param ecdsaPublicKey The ECDSA public key corresponding to `signer`.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeValidatorSignerWithPublicKey(
    address signer,
    uint8 v,
    bytes32 r,
    bytes32 s,
    bytes calldata ecdsaPublicKey
  ) external nonReentrant {
    legacyAuthorizeSignerWithSignature(signer, ValidatorSigner, v, r, s);
    setIndexedSigner(signer, ValidatorSigner);

    require(
      getValidators().updateEcdsaPublicKey(msg.sender, signer, ecdsaPublicKey),
      "Failed to update ECDSA public key"
    );
    emit ValidatorSignerAuthorized(msg.sender, signer);
  }

  /**
   * @notice Authorizes an address to sign consensus messages on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @param ecdsaPublicKey The ECDSA public key corresponding to `signer`.
   * @param blsPublicKey The BLS public key that the validator is using for consensus, should pass
   *   proof of possession. 96 bytes.
   * @param blsPop The BLS public key proof-of-possession, which consists of a signature on the
   *   account address. 48 bytes.
   * @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.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeValidatorSignerWithKeys(
    address signer,
    uint8 v,
    bytes32 r,
    bytes32 s,
    bytes calldata ecdsaPublicKey,
    bytes calldata blsPublicKey,
    bytes calldata blsPop
  ) external nonReentrant {
    legacyAuthorizeSignerWithSignature(signer, ValidatorSigner, v, r, s);
    setIndexedSigner(signer, ValidatorSigner);

    require(
      getValidators().updatePublicKeys(msg.sender, signer, ecdsaPublicKey, blsPublicKey, blsPop),
      "Failed to update validator keys"
    );
    emit ValidatorSignerAuthorized(msg.sender, signer);
  }

  /**
   * @notice Authorizes an address to sign attestations on behalf of the account.
   * @param signer The address of the signing key to authorize.
   * @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.
   * @dev v, r, s constitute `signer`'s signature on `msg.sender`.
   */
  function authorizeAttestationSigner(address signer, uint8 v, bytes32 r, bytes32 s) public {
    legacyAuthorizeSignerWithSignature(signer, AttestationSigner, v, r, s);
    setIndexedSigner(signer, AttestationSigner);

    emit AttestationSignerAuthorized(msg.sender, signer);
  }

  /**
   * @notice Begin the process of authorizing an address to sign on behalf of the account
   * @param signer The address of the signing key to authorize.
   * @param role The role to authorize signing for.
   */
  function authorizeSigner(address signer, bytes32 role) public {
    require(isAccount(msg.sender), "Unknown account");
    require(
      isNotAccount(signer) && isNotAuthorizedSignerForAnotherAccount(msg.sender, signer),
      "Cannot re-authorize address signer"
    );

    signerAuthorizations[msg.sender][role][signer] = SignerAuthorization({
      started: true,
      completed: false
    });
    emit SignerAuthorizationStarted(msg.sender, signer, role);
  }

  /**
   * @notice Finish the process of authorizing an address to sign on behalf of the account. 
   * @param account The address of account that authorized signing.
   * @param role The role to finish authorizing for.
   */
  function completeSignerAuthorization(address account, bytes32 role) public {
    require(isAccount(account), "Unknown account");
    require(
      isNotAccount(msg.sender) && isNotAuthorizedSignerForAnotherAccount(account, msg.sender),
      "Cannot re-authorize address signer"
    );
    require(
      signerAuthorizations[account][role][msg.sender].started == true,
      "Signer authorization not started"
    );

    authorizedBy[msg.sender] = account;
    signerAuthorizations[account][role][msg.sender].completed = true;
    emit SignerAuthorizationCompleted(account, msg.sender, role);
  }

  /**
   * @notice Whether or not the signer has been registered as the legacy signer for role
   * @param _account The address of account that authorized signing.
   * @param signer The address of the signer.
   * @param role The role that has been authorized.
   */
  function isLegacySigner(address _account, address signer, bytes32 role)
    public
    view
    returns (bool)
  {
    Account storage account = accounts[_account];
    if (role == ValidatorSigner && account.signers.validator == signer) {
      return true;
    } else if (role == AttestationSigner && account.signers.attestation == signer) {
      return true;
    } else if (role == VoteSigner && account.signers.vote == signer) {
      return true;
    } else {
      return false;
    }
  }

  /**
   * @notice Whether or not the signer has been registered as the default signer for role
   * @param account The address of account that authorized signing.
   * @param signer The address of the signer.
   * @param role The role that has been authorized.
   */
  function isDefaultSigner(address account, address signer, bytes32 role)
    public
    view
    returns (bool)
  {
    return defaultSigners[account][role] == signer;
  }

  /**
   * @notice Whether or not the signer has been registered as an indexed signer for role
   * @param account The address of account that authorized signing.
   * @param signer The address of the signer.
   * @param role The role that has been authorized.
   */
  function isIndexedSigner(address account, address signer, bytes32 role)
    public
    view
    returns (bool)
  {
    return
      isLegacyRole(role)
        ? isLegacySigner(account, signer, role)
        : isDefaultSigner(account, signer, role);
  }

  /**
   * @notice Whether or not the signer has been registered as a signer for role
   * @param account The address of account that authorized signing.
   * @param signer The address of the signer.
   * @param role The role that has been authorized.
   */
  function isSigner(address account, address signer, bytes32 role) public view returns (bool) {
    return
      isLegacySigner(account, signer, role) ||
      (signerAuthorizations[account][role][signer].completed && authorizedBy[signer] == account);
  }

  /**
   * @notice Removes the signer for a default role.
   * @param role The role that has been authorized.
   */
  function removeDefaultSigner(bytes32 role) public {
    address signer = defaultSigners[msg.sender][role];
    defaultSigners[msg.sender][role] = address(0);
    emit DefaultSignerRemoved(msg.sender, signer, role);
  }

  /**
   * @notice Remove one of the Validator, Attestation or 
   * Vote signers from an account. Should only be called from
   * methods that check the role is a legacy signer.
   * @param role The role that has been authorized.
   */
  function removeLegacySigner(bytes32 role) private {
    Account storage account = accounts[msg.sender];

    address signer;
    if (role == ValidatorSigner) {
      signer = account.signers.validator;
      account.signers.validator = address(0);
    } else if (role == AttestationSigner) {
      signer = account.signers.attestation;
      account.signers.attestation = address(0);
    } else if (role == VoteSigner) {
      signer = account.signers.vote;
      account.signers.vote = address(0);
    }
    emit LegacySignerRemoved(msg.sender, signer, role);
  }

  /**
   * @notice Removes the currently authorized and indexed signer 
   * for a specific role
   * @param role The role of the signer.
   */
  function removeIndexedSigner(bytes32 role) public {
    address oldSigner = getIndexedSigner(msg.sender, role);
    isLegacyRole(role) ? removeLegacySigner(role) : removeDefaultSigner(role);

    emit IndexedSignerRemoved(msg.sender, oldSigner, role);
  }

  /**
   * @notice Removes the currently authorized signer for a specific role and 
   * if the signer is indexed, remove that as well.
   * @param signer The address of the signer.
   * @param role The role that has been authorized.
   */
  function removeSigner(address signer, bytes32 role) public {
    if (isIndexedSigner(msg.sender, signer, role)) {
      removeIndexedSigner(role);
    }

    delete signerAuthorizations[msg.sender][role][signer];
    emit SignerRemoved(msg.sender, signer, role);
  }

  /**
   * @notice Removes the currently authorized vote signer for the account.
   * Note that the signers cannot be reauthorized after they have been removed.
   */
  function removeVoteSigner() public {
    address signer = getLegacySigner(msg.sender, VoteSigner);
    removeSigner(signer, VoteSigner);
    emit VoteSignerRemoved(msg.sender, signer);
  }

  /**
   * @notice Removes the currently authorized validator signer for the account
   * Note that the signers cannot be reauthorized after they have been removed.
   */
  function removeValidatorSigner() public {
    address signer = getLegacySigner(msg.sender, ValidatorSigner);
    removeSigner(signer, ValidatorSigner);
    emit ValidatorSignerRemoved(msg.sender, signer);
  }

  /**
   * @notice Removes the currently authorized attestation signer for the account
   * Note that the signers cannot be reauthorized after they have been removed.
   */
  function removeAttestationSigner() public {
    address signer = getLegacySigner(msg.sender, AttestationSigner);
    removeSigner(signer, AttestationSigner);
    emit AttestationSignerRemoved(msg.sender, signer);
  }

  function signerToAccountWithRole(address signer, bytes32 role) internal view returns (address) {
    address account = authorizedBy[signer];
    if (account != address(0)) {
      require(isSigner(account, signer, role), "not active authorized signer for role");
      return account;
    }

    require(isAccount(signer), "not an account");
    return signer;
  }

  /**
   * @notice Returns the account associated with `signer`.
   * @param signer The address of the account or currently authorized attestation signer.
   * @dev Fails if the `signer` is not an account or currently authorized attestation signer.
   * @return The associated account.
   */
  function attestationSignerToAccount(address signer) external view returns (address) {
    return signerToAccountWithRole(signer, AttestationSigner);
  }

  /**
   * @notice Returns the account associated with `signer`.
   * @param signer The address of an account or currently authorized validator signer.
   * @dev Fails if the `signer` is not an account or currently authorized validator.
   * @return The associated account.
   */
  function validatorSignerToAccount(address signer) public view returns (address) {
    return signerToAccountWithRole(signer, ValidatorSigner);
  }

  /**
   * @notice Returns the account associated with `signer`.
   * @param signer The address of the account or currently authorized vote signer.
   * @dev Fails if the `signer` is not an account or currently authorized vote signer.
   * @return The associated account.
   */
  function voteSignerToAccount(address signer) external view returns (address) {
    return signerToAccountWithRole(signer, VoteSigner);
  }

  /**
   * @notice Returns the account associated with `signer`.
   * @param signer The address of the account or previously authorized signer.
   * @dev Fails if the `signer` is not an account or previously authorized signer.
   * @return The associated account.
   */
  function signerToAccount(address signer) external view returns (address) {
    address authorizingAccount = authorizedBy[signer];
    if (authorizingAccount != address(0)) {
      return authorizingAccount;
    } else {
      require(isAccount(signer), "Not an account");
      return signer;
    }
  }

  /**
   * @notice Checks whether the role is one of Vote, Validator or Attestation
   * @param role The role to check
   */
  function isLegacyRole(bytes32 role) public pure returns (bool) {
    return role == VoteSigner || role == ValidatorSigner || role == AttestationSigner;
  }

  /**
   * @notice Returns the legacy signer for the specified account and 
   * role. If no signer has been specified it will return the account itself.
   * @param _account The address of the account.
   * @param role The role of the signer.
   */
  function getLegacySigner(address _account, bytes32 role) public view returns (address) {
    require(isLegacyRole(role), "Role is not a legacy signer");

    Account storage account = accounts[_account];
    address signer;
    if (role == ValidatorSigner) {
      signer = account.signers.validator;
    } else if (role == AttestationSigner) {
      signer = account.signers.attestation;
    } else if (role == VoteSigner) {
      signer = account.signers.vote;
    }

    return signer == address(0) ? _account : signer;
  }

  /**
   * @notice Returns the default signer for the specified account and 
   * role. If no signer has been specified it will return the account itself.
   * @param account The address of the account.
   * @param role The role of the signer.
   */
  function getDefaultSigner(address account, bytes32 role) public view returns (address) {
    address defaultSigner = defaultSigners[account][role];
    return defaultSigner == address(0) ? account : defaultSigner;
  }

  /**
   * @notice Returns the indexed signer for the specified account and role. 
   * If no signer has been specified it will return the account itself.
   * @param account The address of the account.
   * @param role The role of the signer.
   */
  function getIndexedSigner(address account, bytes32 role) public view returns (address) {
    return isLegacyRole(role) ? getLegacySigner(account, role) : getDefaultSigner(account, role);
  }

  /**
   * @notice Returns the vote signer for the specified account.
   * @param account The address of the account.
   * @return The address with which the account can sign votes.
   */
  function getVoteSigner(address account) public view returns (address) {
    return getLegacySigner(account, VoteSigner);
  }

  /**
   * @notice Returns the validator signer for the specified account.
   * @param account The address of the account.
   * @return The address with which the account can register a validator or group.
   */
  function getValidatorSigner(address account) public view returns (address) {
    return getLegacySigner(account, ValidatorSigner);
  }

  /**
   * @notice Returns the attestation signer for the specified account.
   * @param account The address of the account.
   * @return The address with which the account can sign attestations.
   */
  function getAttestationSigner(address account) public view returns (address) {
    return getLegacySigner(account, AttestationSigner);
  }

  /**
   * @notice Checks whether or not the account has an indexed signer
   * registered for one of the legacy roles
   */
  function hasLegacySigner(address account, bytes32 role) public view returns (bool) {
    return getLegacySigner(account, role) != account;
  }

  /**
   * @notice Checks whether or not the account has an indexed signer
   * registered for a role
   */
  function hasDefaultSigner(address account, bytes32 role) public view returns (bool) {
    return getDefaultSigner(account, role) != account;
  }

  /**
   * @notice Checks whether or not the account has an indexed signer
   * registered for the role
   */
  function hasIndexedSigner(address account, bytes32 role) public view returns (bool) {
    return isLegacyRole(role) ? hasLegacySigner(account, role) : hasDefaultSigner(account, role);
  }

  /**
   * @notice Checks whether or not the account has a signer
   * registered for the plaintext role.
   * @dev See `hasIndexedSigner` for more gas efficient call.
   */
  function hasAuthorizedSigner(address account, string calldata role) external view returns (bool) {
    return hasIndexedSigner(account, keccak256(abi.encodePacked(role)));
  }

  /**
   * @notice Returns if account has specified a dedicated vote signer.
   * @param account The address of the account.
   * @return Whether the account has specified a dedicated vote signer.
   */
  function hasAuthorizedVoteSigner(address account) external view returns (bool) {
    return hasLegacySigner(account, VoteSigner);
  }

  /**
   * @notice Returns if account has specified a dedicated validator signer.
   * @param account The address of the account.
   * @return Whether the account has specified a dedicated validator signer.
   */
  function hasAuthorizedValidatorSigner(address account) external view returns (bool) {
    return hasLegacySigner(account, ValidatorSigner);
  }

  /**
   * @notice Returns if account has specified a dedicated attestation signer.
   * @param account The address of the account.
   * @return Whether the account has specified a dedicated attestation signer.
   */
  function hasAuthorizedAttestationSigner(address account) external view returns (bool) {
    return hasLegacySigner(account, AttestationSigner);
  }

  /**
   * @notice Getter for the name of an account.
   * @param account The address of the account to get the name for.
   * @return name The name of the account.
   */
  function getName(address account) external view returns (string memory) {
    return accounts[account].name;
  }

  /**
   * @notice Getter for the metadata of an account.
   * @param account The address of the account to get the metadata for.
   * @return metadataURL The URL to access the metadata.
   */
  function getMetadataURL(address account) external view returns (string memory) {
    return accounts[account].metadataURL;
  }

  /**
   * @notice Getter for the metadata of multiple accounts.
   * @param accountsToQuery The addresses of the accounts to get the metadata for.
   * @return (stringLengths[] - the length of each string in bytes
   *          data - all strings concatenated
   *         )
   */
  function batchGetMetadataURL(address[] calldata accountsToQuery)
    external
    view
    returns (uint256[] memory, bytes memory)
  {
    uint256 totalSize = 0;
    uint256[] memory sizes = new uint256[](accountsToQuery.length);
    for (uint256 i = 0; i < accountsToQuery.length; i = i.add(1)) {
      sizes[i] = bytes(accounts[accountsToQuery[i]].metadataURL).length;
      totalSize = totalSize.add(sizes[i]);
    }

    bytes memory data = new bytes(totalSize);
    uint256 pointer = 0;
    for (uint256 i = 0; i < accountsToQuery.length; i = i.add(1)) {
      for (uint256 j = 0; j < sizes[i]; j = j.add(1)) {
        data[pointer] = bytes(accounts[accountsToQuery[i]].metadataURL)[j];
        pointer = pointer.add(1);
      }
    }
    return (sizes, data);
  }

  /**
   * @notice Getter for the data encryption key and version.
   * @param account The address of the account to get the key for
   * @return dataEncryptionKey secp256k1 public key for data encryption. Preferably compressed.
   */
  function getDataEncryptionKey(address account) external view returns (bytes memory) {
    return accounts[account].dataEncryptionKey;
  }

  /**
   * @notice Getter for the wallet address for an account
   * @param account The address of the account to get the wallet address for
   * @return Wallet address
   */
  function getWalletAddress(address account) external view returns (address) {
    return accounts[account].walletAddress;
  }

  /**
   * @notice Check if an account already exists.
   * @param account The address of the account
   * @return Returns `true` if account exists. Returns `false` otherwise.
   */
  function isAccount(address account) public view returns (bool) {
    return (accounts[account].exists);
  }

  /**
   * @notice Check if an account already exists.
   * @param account The address of the account
   * @return Returns `false` if account exists. Returns `true` otherwise.
   */
  function isNotAccount(address account) internal view returns (bool) {
    return (!accounts[account].exists);
  }

  /**
   * @notice Check if an address has been an authorized signer for an account.
   * @param signer The possibly authorized address.
   * @return Returns `true` if authorized. Returns `false` otherwise.
   */
  function isAuthorizedSigner(address signer) external view returns (bool) {
    return (authorizedBy[signer] != address(0));
  }

  /**
   * @notice Check if an address has not been an authorized signer for an account.
   * @param signer The possibly authorized address.
   * @return Returns `false` if authorized. Returns `true` otherwise.
   */
  function isNotAuthorizedSigner(address signer) internal view returns (bool) {
    return (authorizedBy[signer] == address(0));
  }

  /**
   * @notice Check if `signer` has not been authorized, and if it has been previously
   *         authorized that it was authorized by `account`.
   * @param account The authorizing account address.
   * @param signer The possibly authorized address.
   * @return Returns `false` if authorized. Returns `true` otherwise.
   */
  function isNotAuthorizedSignerForAnotherAccount(address account, address signer)
    internal
    view
    returns (bool)
  {
    return (authorizedBy[signer] == address(0) || authorizedBy[signer] == account);
  }

  /**
   * @notice Authorizes some role of `msg.sender`'s account to another address.
   * @param authorized The address to authorize.
   * @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.
   * @dev Fails if the address is already authorized to another account or is an account itself.
   * @dev Note that once an address is authorized, it may never be authorized again.
   * @dev v, r, s constitute `authorized`'s signature on `msg.sender`.
   */
  function authorizeAddress(address authorized, uint8 v, bytes32 r, bytes32 s) private {
    address signer = Signatures.getSignerOfAddress(msg.sender, v, r, s);
    require(signer == authorized, "Invalid signature");

    authorize(authorized);
  }

  /**
   * @notice Returns the address that signed the provided role authorization.
   * @param account The `account` property signed over in the EIP712 signature
   * @param signer The `signer` property signed over in the EIP712 signature
   * @param role The `role` property signed over in the EIP712 signature
   * @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 The address that signed the provided role authorization.
   */
  function getRoleAuthorizationSigner(
    address account,
    address signer,
    bytes32 role,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) public view returns (address) {
    bytes32 structHash = keccak256(
      abi.encode(EIP712_AUTHORIZE_SIGNER_TYPEHASH, account, signer, role)
    );
    return Signatures.getSignerOfTypedDataHash(eip712DomainSeparator, structHash, v, r, s);
  }

  /**
   * @notice Authorizes a role of `msg.sender`'s account to another address (`authorized`).
   * @param authorized The address to authorize.
   * @param role The role to authorize.
   * @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.
   * @dev Fails if the address is already authorized to another account or is an account itself.
   * @dev Note that this signature is EIP712 compliant over the authorizing `account` 
   * (`msg.sender`), `signer` (`authorized`) and `role`.
   */
  function authorizeAddressWithRole(address authorized, bytes32 role, uint8 v, bytes32 r, bytes32 s)
    private
  {
    address signer = getRoleAuthorizationSigner(msg.sender, authorized, role, v, r, s);
    require(signer == authorized, "Invalid signature");

    authorize(authorized);
  }

  /**
   * @notice Authorizes an address to `msg.sender`'s account
   * @param authorized The address to authorize.
   * @dev Fails if the address is already authorized for another account or is an account itself.
   */
  function authorize(address authorized) private {
    require(isAccount(msg.sender), "Unknown account");
    require(
      isNotAccount(authorized) && isNotAuthorizedSignerForAnotherAccount(msg.sender, authorized),
      "Cannot re-authorize address or locked gold account for another account"
    );

    authorizedBy[authorized] = msg.sender;
  }
}
        

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/FixidityLib.sol

pragma solidity ^0.5.13;

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

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

  uint256 private constant FIXED1_UINT = 1000000000000000000000000;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/Initializable.sol

pragma solidity ^0.5.13;

contract Initializable {
  bool public initialized;

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

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

/Users/mchrzan/celo/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/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/UsingRegistry.sol

pragma solidity ^0.5.13;

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

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

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

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

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

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

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

  IRegistry public registry;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IAccounts.sol

pragma solidity ^0.5.13;

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

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

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

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

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/ICeloVersionedContract.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IFeeCurrencyWhitelist.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IFreezer.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/interfaces/IRegistry.sol

pragma solidity ^0.5.13;

interface IRegistry {
  function setAddressFor(string calldata, address) external;
  function getAddressForOrDie(bytes32) external view returns (address);
  function getAddressFor(bytes32) external view returns (address);
  function getAddressForStringOrDie(string calldata identifier) external view returns (address);
  function getAddressForString(string calldata identifier) external view returns (address);
  function isOneOf(bytes32[] calldata, address) external view returns (bool);
}
          

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/common/libraries/ReentrancyGuard.sol

pragma solidity ^0.5.13;

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <[email protected]π.com>, Eenae <[email protected]>
 * @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/mchrzan/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/IElection.sol

pragma solidity ^0.5.13;

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

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

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

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/IGovernance.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/ILockedGold.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/governance/interfaces/IValidators.sol

pragma solidity ^0.5.13;

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

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

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

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

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

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

}
          

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/identity/interfaces/IAttestations.sol

pragma solidity ^0.5.13;

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

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

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/identity/interfaces/IRandom.sol

pragma solidity ^0.5.13;

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

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/IExchange.sol

pragma solidity ^0.5.13;

interface IExchange {
  function buy(uint256, uint256, bool) external returns (uint256);
  function sell(uint256, uint256, bool) external returns (uint256);
  function exchange(uint256, uint256, bool) external returns (uint256);
  function setUpdateFrequency(uint256) external;
  function getBuyTokenAmount(uint256, bool) external view returns (uint256);
  function getSellTokenAmount(uint256, bool) external view returns (uint256);
  function getBuyAndSellBuckets(bool) external view returns (uint256, uint256);
}
          

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/IReserve.sol

pragma solidity ^0.5.13;

interface IReserve {
  function setTobinTaxStalenessThreshold(uint256) external;
  function addToken(address) external returns (bool);
  function removeToken(address, uint256) external returns (bool);
  function transferGold(address payable, uint256) external returns (bool);
  function transferExchangeGold(address payable, uint256) external returns (bool);
  function getReserveGoldBalance() external view returns (uint256);
  function getUnfrozenReserveGoldBalance() external view returns (uint256);
  function getOrComputeTobinTax() external returns (uint256, uint256);
  function getTokens() external view returns (address[] memory);
  function getReserveRatio() external view returns (uint256);
  function addExchangeSpender(address) external;
  function removeExchangeSpender(address, uint256) external;
  function addSpender(address) external;
  function removeSpender(address) external;
}
          

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/ISortedOracles.sol

pragma solidity ^0.5.13;

interface ISortedOracles {
  function addOracle(address, address) external;
  function removeOracle(address, address, uint256) external;
  function report(address, uint256, address, address) external;
  function removeExpiredReports(address, uint256) external;
  function isOldestReportExpired(address token) external view returns (bool, address);
  function numRates(address) external view returns (uint256);
  function medianRate(address) external view returns (uint256, uint256);
  function numTimestamps(address) external view returns (uint256);
  function medianTimestamp(address) external view returns (uint256);
}
          

/Users/mchrzan/celo/celo-monorepo/packages/protocol/contracts/stability/interfaces/IStableToken.sol

pragma solidity ^0.5.13;

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

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

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

pragma solidity ^0.5.0;

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

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

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

/openzeppelin-solidity/contracts/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/IERC20.sol

pragma solidity ^0.5.0;

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

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

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

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

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

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

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

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"AccountCreated","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"AccountDataEncryptionKeySet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bytes","name":"dataEncryptionKey","internalType":"bytes","indexed":false}],"anonymous":false},{"type":"event","name":"AccountMetadataURLSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"string","name":"metadataURL","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"AccountNameSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"string","name":"name","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"AccountWalletAddressSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"walletAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AttestationSignerAuthorized","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"AttestationSignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"DefaultSignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"DefaultSignerSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"IndexedSignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"IndexedSignerSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"LegacySignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"LegacySignerSet","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"OffchainStorageRootAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bytes","name":"url","internalType":"bytes","indexed":false}],"anonymous":false},{"type":"event","name":"OffchainStorageRootRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bytes","name":"url","internalType":"bytes","indexed":false},{"type":"uint256","name":"index","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PaymentDelegationSet","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"uint256","name":"fraction","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RegistrySet","inputs":[{"type":"address","name":"registryAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SignerAuthorizationCompleted","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"SignerAuthorizationStarted","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"SignerAuthorized","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"SignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"ValidatorSignerAuthorized","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ValidatorSignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"VoteSignerAuthorized","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"VoteSignerRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"oldSigner","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"EIP712_AUTHORIZE_SIGNER_TYPEHASH","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addStorageRoot","inputs":[{"type":"bytes","name":"url","internalType":"bytes"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"attestationSignerToAccount","inputs":[{"type":"address","name":"signer","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeAttestationSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeSignerWithSignature","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeValidatorSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeValidatorSignerWithKeys","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"},{"type":"bytes","name":"ecdsaPublicKey","internalType":"bytes"},{"type":"bytes","name":"blsPublicKey","internalType":"bytes"},{"type":"bytes","name":"blsPop","internalType":"bytes"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeValidatorSignerWithPublicKey","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"},{"type":"bytes","name":"ecdsaPublicKey","internalType":"bytes"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authorizeVoteSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"authorizedBy","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"bytes","name":"","internalType":"bytes"}],"name":"batchGetMetadataURL","inputs":[{"type":"address[]","name":"accountsToQuery","internalType":"address[]"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"completeSignerAuthorization","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"createAccount","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"deletePaymentDelegation","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"eip712DomainSeparator","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getAttestationSigner","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"getDataEncryptionKey","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getDefaultSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getIndexedSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getLegacySigner","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getMetadataURL","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getName","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes","name":"","internalType":"bytes"},{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getOffchainStorageRoots","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPaymentDelegation","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleAuthorizationSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getValidatorSigner","inputs":[{"type":"address","name":"account","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":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getVoteSigner","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getWalletAddress","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasAuthorizedAttestationSigner","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasAuthorizedSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"string","name":"role","internalType":"string"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasAuthorizedValidatorSigner","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasAuthorizedVoteSigner","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasDefaultSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasIndexedSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasLegacySigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"address","name":"registryAddress","internalType":"address"}],"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":"isAccount","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAuthorizedSigner","inputs":[{"type":"address","name":"signer","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isDefaultSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isIndexedSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isLegacyRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isLegacySigner","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSigner","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"offchainStorageRoots","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeAttestationSigner","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeDefaultSigner","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeIndexedSigner","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeStorageRoot","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeValidatorSigner","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeVoteSigner","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAccount","inputs":[{"type":"string","name":"name","internalType":"string"},{"type":"bytes","name":"dataEncryptionKey","internalType":"bytes"},{"type":"address","name":"walletAddress","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAccountDataEncryptionKey","inputs":[{"type":"bytes","name":"dataEncryptionKey","internalType":"bytes"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setEip712DomainSeparator","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setIndexedSigner","inputs":[{"type":"address","name":"signer","internalType":"address"},{"type":"bytes32","name":"role","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMetadataURL","inputs":[{"type":"string","name":"metadataURL","internalType":"string"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setName","inputs":[{"type":"string","name":"name","internalType":"string"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setPaymentDelegation","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"fraction","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setRegistry","inputs":[{"type":"address","name":"registryAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setWalletAddress","inputs":[{"type":"address","name":"walletAddress","internalType":"address"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"signerToAccount","inputs":[{"type":"address","name":"signer","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorSignerToAccount","inputs":[{"type":"address","name":"signer","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"voteSignerToAccount","inputs":[{"type":"address","name":"signer","internalType":"address"}],"constant":true}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061041d5760003560e01c80637b2434cb1161022b578063ae32fa0e11610130578063c48830d9116100b8578063f0c5658411610087578063f0c56584146121d1578063f2fde38b146121ef578063f333d83614612233578063fbe3c37314612279578063ff836d93146122c75761041d565b8063c48830d9146120ab578063c4d66de814612131578063e7a16e6b14612175578063e8d787cb146121a35761041d565b8063ba40e4f6116100ff578063ba40e4f614611e74578063baf7ef0f14611f25578063bce2b8d614611f8a578063c2e0ee2014611f94578063c47f002714611ff05761041d565b8063ae32fa0e14611beb578063b062c84314611ca8578063b5a664c214611d21578063b6c6662514611da55761041d565b806392f90fbf116101b35780639f024f4b116101825780639f024f4b14611a075780639f68297614611a92578063a5ec94f914611ae0578063a8ae1a3d14611aea578063a91ee0dc14611ba75761041d565b806392f90fbf1461188d57806393c5c487146118fc5780639cafb2a1146119805780639dca362f146119e55761041d565b80638da5cb5b116101fa5780638da5cb5b1461163e5780638f32d59b146116885780638f9ae6dc146116aa57806390b12b47146116f857806391cd074b146118075761041d565b80637b2434cb1461136457806387affe68146113e85780638adaf96f146114765780638bceca58146115b05761041d565b806349045e161161033157806364439b43116102b9578063747daec511610288578063747daec51461116b57806376082c1f146111e4578063760fbbb2146112ab57806376afa04c146112b55780637b1039991461131a5761041d565b806364439b431461100b5780636642d5941461108f578063715018a614611113578063727d079c1461111d5761041d565b80635b07fdd8116103005780635b07fdd814610dc25780635b6d900414610de05780635fd4b08a14610e6e578063614ed49314610f2b57806361bab1ae14610f875761041d565b806349045e1614610c615780634ce38b5f14610cbd57806354255be014610d4157806358b81ea814610d745761041d565b80631465b923116103b4578063289a131811610383578063289a1318146109e35780633184b3c514610ae857806341ddd88014610af25780634282ee6d14610b76578063485a46d114610bdb5761041d565b80631465b9231461077d578063158ef93e146108e15780631fd9afa51461090357806325ca4c9c146109875761041d565b80630fa750d2116103f05780630fa750d2146105985780630fe7abab1461065257806310c504b51461070d5780631441ece7146107175761041d565b80630127dbed146104225780630185a2321461047e57806305be6229146104ac5780630b8e056214610512575b600080fd5b6104646004803603602081101561043857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061232d565b604051808215151515815260200191505060405180910390f35b6104aa6004803603602081101561049457600080fd5b8101908080359060200190929190505050612386565b005b6104f8600480360360408110156104c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061243f565b604051808215151515815260200191505060405180910390f35b61057e6004803603606081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612482565b604051808215151515815260200191505060405180910390f35b610650600480360360a08110156105ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190803590602001909291908035906020019064010000000081111561060c57600080fd5b82018360208201111561061e57600080fd5b8035906020019184600183028401116401000000008311171561064057600080fd5b909192939192939050505061252c565b005b61070b6004803603602081101561066857600080fd5b810190808035906020019064010000000081111561068557600080fd5b82018360208201111561069757600080fd5b803590602001918460018302840111640100000000831117156106b957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061285e565b005b6107156129e9565b005b6107636004803603604081101561072d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612b0a565b604051808215151515815260200191505060405180910390f35b6108df600480360360e081101561079357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190803590602001906401000000008111156107f157600080fd5b82018360208201111561080357600080fd5b8035906020019184600183028401116401000000008311171561082557600080fd5b90919293919293908035906020019064010000000081111561084657600080fd5b82018360208201111561085857600080fd5b8035906020019184600183028401116401000000008311171561087a57600080fd5b90919293919293908035906020019064010000000081111561089b57600080fd5b8201836020820111156108ad57600080fd5b803590602001918460018302840111640100000000831117156108cf57600080fd5b9091929391929390505050612b4d565b005b6108e9612f08565b604051808215151515815260200191505060405180910390f35b6109456004803603602081101561091957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f1b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6109c96004803603602081101561099d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f87565b604051808215151515815260200191505060405180910390f35b610a25600480360360208110156109f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fe0565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015610a69578082015181840152602081019050610a4e565b50505050905090810190601f168015610a965780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019060200280838360005b83811015610ad2578082015181840152602081019050610ab7565b5050505090500194505050505060405180910390f35b610af061333b565b005b610b3460048036036020811015610b0857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613445565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610bd960048036036080811015610b8c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291908035906020019092919050505061349e565b005b610c4760048036036060811015610bf157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613650565b604051808215151515815260200191505060405180910390f35b610ca360048036036020811015610c7757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506137a1565b604051808215151515815260200191505060405180910390f35b610cff60048036036020811015610cd357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613839565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610d49613892565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b610dc060048036036040811015610d8a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506138b9565b005b610dca613b0e565b6040518082815260200191505060405180910390f35b610e2c60048036036040811015610df657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613b14565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610eb060048036036020811015610e8457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613bcf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ef0578082015181840152602081019050610ed5565b50505050905090810190601f168015610f1d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610f6d60048036036020811015610f4157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613cb3565b604051808215151515815260200191505060405180910390f35b610fc960048036036020811015610f9d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613d0c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61104d6004803603602081101561102157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613d65565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6110d1600480360360208110156110a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613dbe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61111b613e17565b005b6111696004803603604081101561113357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613f50565b005b6111e26004803603602081101561118157600080fd5b810190808035906020019064010000000081111561119e57600080fd5b8201836020820111156111b057600080fd5b803590602001918460018302840111640100000000831117156111d257600080fd5b909192939192939050505061453f565b005b611230600480360360408110156111fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050614690565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015611270578082015181840152602081019050611255565b50505050905090810190601f16801561129d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6112b3614756565b005b611318600480360360808110156112cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050614877565b005b61132261499a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6113a66004803603602081101561137a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506149c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b611434600480360360408110156113fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050614a19565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6114ed6004803603602081101561148c57600080fd5b81019080803590602001906401000000008111156114a957600080fd5b8201836020820111156114bb57600080fd5b803590602001918460208302840111640100000000831117156114dd57600080fd5b9091929391929390505050614a4a565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015611534578082015181840152602081019050611519565b50505050905001838103825284818151815260200191508051906020019080838360005b83811015611573578082015181840152602081019050611558565b50505050905090810190601f1680156115a05780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b6115fc600480360360408110156115c657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050614d49565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b611646614fc6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b611690614fef565b604051808215151515815260200191505060405180910390f35b6116f6600480360360408110156116c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061504d565b005b611805600480360360c081101561170e57600080fd5b810190808035906020019064010000000081111561172b57600080fd5b82018360208201111561173d57600080fd5b8035906020019184600183028401116401000000008311171561175f57600080fd5b90919293919293908035906020019064010000000081111561178057600080fd5b82018360208201111561179257600080fd5b803590602001918460018302840111640100000000831117156117b457600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506152ec565b005b6118736004803603606081101561181d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506153b3565b604051808215151515815260200191505060405180910390f35b6118fa600480360360a08110156118a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050615626565b005b61193e6004803603602081101561191257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506157a0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6119e36004803603608081101561199657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506158c7565b005b6119ed615c2e565b604051808215151515815260200191505060405180910390f35b611a4960048036036020811015611a1d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050615d67565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b611ade60048036036040811015611aa857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050615dfd565b005b611ae86161a5565b005b611b2c60048036036020811015611b0057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506162c6565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015611b6c578082015181840152602081019050611b51565b50505050905090810190601f168015611b995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b611be960048036036020811015611bbd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506163aa565b005b611c2d60048036036020811015611c0157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061654e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015611c6d578082015181840152602081019050611c52565b50505050905090810190601f168015611c9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b611d1f60048036036020811015611cbe57600080fd5b8101908080359060200190640100000000811115611cdb57600080fd5b820183602082011115611ced57600080fd5b80359060200191846001830284011164010000000083111715611d0f57600080fd5b9091929391929390505050616632565b005b611d6360048036036020811015611d3757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506167aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b611e32600480360360c0811015611dbb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506167dd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b611f0b60048036036040811015611e8a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115611ec757600080fd5b820183602082011115611ed957600080fd5b80359060200191846001830284011164010000000083111715611efb57600080fd5b9091929391929390505050616950565b604051808215151515815260200191505060405180910390f35b611f8860048036036080811015611f3b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050616994565b005b611f92616c5b565b005b611fd660048036036020811015611faa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050616dfb565b604051808215151515815260200191505060405180910390f35b6120a96004803603602081101561200657600080fd5b810190808035906020019064010000000081111561202357600080fd5b82018360208201111561203557600080fd5b8035906020019184600183028401116401000000008311171561205757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050616e54565b005b612117600480360360608110156120c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050616fe2565b604051808215151515815260200191505060405180910390f35b6121736004803603602081101561214757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050617016565b005b6121a16004803603602081101561218b57600080fd5b81019080803590602001909291905050506170d1565b005b6121cf600480360360208110156121b957600080fd5b810190808035906020019092919050505061725c565b005b6121d96176a4565b6040518082815260200191505060405180910390f35b6122316004803603602081101561220557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506176c0565b005b61225f6004803603602081101561224957600080fd5b8101908080359060200190929190505050617746565b604051808215151515815260200191505060405180910390f35b6122c56004803603604081101561228f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050617838565b005b612313600480360360408110156122dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050617989565b604051808215151515815260200191505060405180910390f35b600061237f8260405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120612b0a565b9050919050565b60006123923383614a19565b905061239d82617746565b6123af576123aa826170d1565b6123b9565b6123b8826179ba565b5b3373ffffffffffffffffffffffffffffffffffffffff167fccc97b55d227538f487c521e1218ba74768b73d088310238027c2ae3b43e9c918284604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a25050565b60008273ffffffffffffffffffffffffffffffffffffffff166124628484613b14565b73ffffffffffffffffffffffffffffffffffffffff161415905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff16600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161490509392505050565b60018060008282540192505081905550600060015490506125968760405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120888888617cd0565b6125e68760405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120613f50565b6125ee617e49565b73ffffffffffffffffffffffffffffffffffffffff16634e06fd8a338986866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050602060405180830381600087803b1580156126d457600080fd5b505af11580156126e8573d6000803e3d6000fd5b505050506040513d60208110156126fe57600080fd5b8101908080519060200190929190505050612764576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180618e366021913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f16e382723fb40543364faf68863212ba253a099607bf6d3a5b47e50a8bf9494388604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a26001548114612855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b50505050505050565b6021815110156128d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6461746120656e6372797074696f6e206b6579206c656e677468203c3d20333281525060200191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160060190805190602001906129319291906188df565b503373ffffffffffffffffffffffffffffffffffffffff167f43fdefe0a824cb0e3bbaf9c4bc97669187996136fe9282382baf10787f0d808d836040518080602001828103825283818151815260200191508051906020019080838360005b838110156129ab578082015181840152602081019050612990565b50505050905090810190601f1680156129d85780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b6000612a3b3360405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120614d49565b9050612a8d8160405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120617838565b3373ffffffffffffffffffffffffffffffffffffffff167fa197481f404d8a8082368ad7445380f01e75f27dea6b7aef234a4ce071127fae82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a250565b60008273ffffffffffffffffffffffffffffffffffffffff16612b2d8484614d49565b73ffffffffffffffffffffffffffffffffffffffff161415905092915050565b6001806000828254019250508190555060006001549050612bb78b60405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f720000000000000000008152506017019050604051602081830303815290604052805190602001208c8c8c617cd0565b612c078b60405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120613f50565b612c0f617e49565b73ffffffffffffffffffffffffffffffffffffffff1663713ea0f3338d8a8a8a8a8a8a6040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018060200184810384528a8a82818152602001925080828437600081840152601f19601f8201169050808301925050508481038352888882818152602001925080828437600081840152601f19601f8201169050808301925050508481038252868682818152602001925080828437600081840152601f19601f8201169050808301925050509b505050505050505050505050602060405180830381600087803b158015612d5d57600080fd5b505af1158015612d71573d6000803e3d6000fd5b505050506040513d6020811015612d8757600080fd5b8101908080519060200190929190505050612e0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4661696c656420746f207570646174652076616c696461746f72206b6579730081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f16e382723fb40543364faf68863212ba253a099607bf6d3a5b47e50a8bf949438c604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a26001548114612efb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050505050505050505050565b600260009054906101000a900460ff1681565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b606080612fec83612f87565b61305e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b6000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050600080905060008090505b8281101561314257613133600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061310557fe5b9060005260206000200180546001816001161561010002031660029004905083617f4490919063ffffffff16565b915080806001019150506130b0565b506060816040519080825280601f01601f1916602001820160405280156131785781602001600182028038833980820191505090505b50905060008090506060846040519080825280602002602001820160405280156131b15781602001602082028038833980820191505090505b50905060008090505b8581101561332a576000600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061320e57fe5b9060005260206000200190508080546001816001161561010002031660029004905083838151811061323c57fe5b60200260200101818152505060008090505b83838151811061325a57fe5b602002602001015181101561331b57818181546001816001161561010002031660029004811061328657fe5b8154600116156132a55790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000028686815181106132d757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508480600101955050808060010191505061324e565b505080806001019150506131ba565b508281965096505050505050915091565b60004690506040518080618d4b60529139605201905060405180910390206040518060400160405280601381526020017f43656c6f20436f726520436f6e747261637473000000000000000000000000008152508051906020012060405180807f312e300000000000000000000000000000000000000000000000000000000000815250600301905060405180910390208330604051602001808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012060078190555050565b60006134978260405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120614d49565b9050919050565b60018060008282540192505081905550600060015490506135088560405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120868686617cd0565b6135588560405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120613f50565b3373ffffffffffffffffffffffffffffffffffffffff167faab5f8a189373aaa290f42ae65ea5d7971b732366ca5bf66556e76263944af2886604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a26001548114613649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050505050565b600061365d8484846153b3565b806137985750600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a900460ff16801561379757508373ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff16600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600061388b8260405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120614d49565b9050919050565b60008060008060018060046000839350829250819150809050935093509350935090919293565b6138c233612f87565b613934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b61393d82617fcc565b801561394f575061394e3383618026565b5b6139a4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180618def6022913960400191505060405180910390fd5b604051806040016040528060011515815260200160001515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908315150217905550905050803373ffffffffffffffffffffffffffffffffffffffff167f7a162218a1b7bec7fb15b4bb95220fbf423fa3a49718133f5c50361ff1c8537684604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a35050565b60075481565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614613bc45780613bc6565b835b91505092915050565b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613ca75780601f10613c7c57610100808354040283529160200191613ca7565b820191906000526020600020905b815481529060010190602001808311613c8a57829003601f168201915b50505050509050919050565b6000613d058260405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120612b0a565b9050919050565b6000613d5e8260405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120614d49565b9050919050565b6000613db78260405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120618153565b9050919050565b6000613e108260405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120618153565b9050919050565b613e1f614fef565b613e91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b613f5933612f87565b613fcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420616e206163636f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b613fd482617fcc565b614029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180618ca16022913960400191505060405180910390fd5b6140333383618026565b6140a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f742061207369676e657220666f722074686973206163636f756e7400000081525060200191505060405180910390fd5b6140b0338383613650565b614105576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180618dc0602f913960400191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905061415182617746565b156143a65760405160200180807f63656c6f2e6f72672f636f72652f766f746500000000000000000000000000008152506012019050604051602081830303815290604052805190602001208214156141ef57828160010160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061431f565b60405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e0000000000000081525060190190506040516020818303038152906040528051906020012082141561428857828160010160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061431e565b60405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f7200000000000000000081525060170190506040516020818303038152906040528051906020012082141561431d57828160010160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b3373ffffffffffffffffffffffffffffffffffffffff167fc5cd67202a8095484f559b338b2b6fee0dd81af9f70c4814c6517fcf9a09564c8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a26144b8565b82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167f2613ed414d18d8152e86c896c04ccce344b75a2f06141f04d39ad069a38725238484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a25b3373ffffffffffffffffffffffffffffffffffffffff167f8a00ae3e0722558391733230bfc96d425df2dd7b44f7ce506580785adcf171a28484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a2505050565b61454833612f87565b6145ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050828282600701919061461092919061895f565b503373ffffffffffffffffffffffffffffffffffffffff167f0b5629fec5b6b5a1c2cfe0de7495111627a8cf297dced72e0669527425d3f01b848460405180806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050935050505060405180910390a2505050565b600860205281600052604060002081815481106146a957fe5b90600052602060002001600091509150508054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561474e5780601f106147235761010080835404028352916020019161474e565b820191906000526020600020905b81548152906001019060200180831161473157829003601f168201915b505050505081565b60006147a83360405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120614d49565b90506147fa8160405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120617838565b3373ffffffffffffffffffffffffffffffffffffffff167f14670729407debb6ed03d885f8ba57155de89ce39bf17127ae4900ec7c2ad10382604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a250565b6148ca8460405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120858585617cd0565b61491a8460405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120613f50565b3373ffffffffffffffffffffffffffffffffffffffff167f9dfbc5a621c3e2d0d83beee687a17dfc796bbce2118793e5e254409bb265ca0b85604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a250505050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000614a128260405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120618153565b9050919050565b6000614a2482617746565b614a3757614a328383613b14565b614a42565b614a418383614d49565b5b905092915050565b6060806000809050606085859050604051908082528060200260200182016040528015614a865781602001602082028038833980820191505090505b50905060008090505b86869050811015614b745760036000888884818110614aaa57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600701805460018160011615610100020316600290049050828281518110614b2557fe5b602002602001018181525050614b57828281518110614b4057fe5b602002602001015184617f4490919063ffffffff16565b9250614b6d600182617f4490919063ffffffff16565b9050614a8f565b506060826040519080825280601f01601f191660200182016040528015614baa5781602001600182028038833980820191505090505b509050600080905060008090505b88889050811015614d375760008090505b848281518110614bd557fe5b6020026020010151811015614d1b57600360008b8b85818110614bf457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060070181815460018160011615610100020316600290048110614c6a57fe5b815460011615614c895790600052602060002090602091828204019190065b9054901a7f010000000000000000000000000000000000000000000000000000000000000002848481518110614cbb57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350614cfe600184617f4490919063ffffffff16565b9250614d14600182617f4490919063ffffffff16565b9050614bc9565b50614d30600182617f4490919063ffffffff16565b9050614bb8565b50828295509550505050509250929050565b6000614d5482617746565b614dc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f526f6c65206973206e6f742061206c6567616379207369676e6572000000000081525060200191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600060405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120841415614e88578160010160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050614f80565b60405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120841415614f05578160010160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050614f7f565b60405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120841415614f7e578160010160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b5b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614614fba5780614fbc565b845b9250505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166150316182db565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b61505633612f87565b6150c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420616e206163636f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561514e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180618cc36021913960400191505060405180910390fd5b6151566189df565b61515f826182e3565b905061517b61516c618301565b8261832790919063ffffffff16565b6151d0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180618d9d6023913960400191505060405180910390fd5b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200182815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001016000820151816000015550509050508273ffffffffffffffffffffffffffffffffffffffff167f3bff8b126c8f283f709ae37dc0d3fc03cae85ca4772cfb25b601f4b0b49ca6df836040518082815260200191505060405180910390a2505050565b6152f533612f87565b61530357615301615c2e565b505b61535088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050616e54565b61539d86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061285e565b6153a9848484846158c7565b5050505050505050565b600080600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f720000000000000000008152506017019050604051602081830303815290604052805190602001208314801561549e57508373ffffffffffffffffffffffffffffffffffffffff168160010160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156154ad57600191505061561f565b60405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e000000000000008152506019019050604051602081830303815290604052805190602001208314801561555457508373ffffffffffffffffffffffffffffffffffffffff168160010160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561556357600191505061561f565b60405160200180807f63656c6f2e6f72672f636f72652f766f746500000000000000000000000000008152506012019050604051602081830303815290604052805190602001208314801561560a57508373ffffffffffffffffffffffffffffffffffffffff168160010160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561561957600191505061561f565b60009150505b9392505050565b615633858585858561833d565b604051806040016040528060011515815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908315150217905550905050833373ffffffffffffffffffffffffffffffffffffffff167f6cc56bd06daacce5b10fdf5ad1dc781941e14d7a71d29d33e7001e2956d14e0787604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a35050505050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461584257809150506158c2565b61584b83612f87565b6158bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420616e206163636f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b829150505b919050565b6158d033612f87565b615942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806159a85750600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b615b275760007369baecd458e7c08b13a18e11887dbb078fb3cbb46396ef41a1338686866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff16815260200183815260200182815260200194505050505060206040518083038186803b158015615a4757600080fd5b505af4158015615a5b573d6000803e3d6000fd5b505050506040513d6020811015615a7157600080fd5b810190808051906020019092919050505090508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614615b25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f496e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b505b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050848160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167ff81d74398fd47e35c36b714019df15f200f623dde569b5b531d6a0b4da5c5f2686604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a25050505050565b6000615c3933617fcc565b8015615c4a5750615c4933618401565b5b615cbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4163636f756e742065786973747300000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060018160000160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f805996f252884581e2f74cf3d2b03564d5ec26ccc90850ae12653dc1b72d1fa260405160405180910390a2600191505090565b6000806000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16615df382600101604051806020016040529081600082015481525050618498565b9250925050915091565b615e0682612f87565b615e78576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b615e8133617fcc565b8015615e935750615e928233618026565b5b615ee8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180618def6022913960400191505060405180910390fd5b60011515600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16151514615fff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5369676e657220617574686f72697a6174696f6e206e6f74207374617274656481525060200191505060405180910390fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a81548160ff021916908315150217905550808273ffffffffffffffffffffffffffffffffffffffff167f9eeca140dda0bdb74fc9acfda0f1c0324e188a732bd48e078a96b16d97eb54e533604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a35050565b60006161f73360405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120614d49565b90506162498160405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120617838565b3373ffffffffffffffffffffffffffffffffffffffff167fa54764c62865ff0cd3f271fb1d4635662bff10f0878694f1654fb7fbdecb830d82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a250565b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206007018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561639e5780601f106163735761010080835404028352916020019161639e565b820191906000526020600020905b81548152906001019060200180831161638157829003601f168201915b50505050509050919050565b6163b2614fef565b616424576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156164c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616e6e6f7420726567697374657220746865206e756c6c206164647265737381525060200191505060405180910390fd5b80600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b60405160405180910390a250565b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206006018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156166265780601f106165fb57610100808354040283529160200191616626565b820191906000526020600020905b81548152906001019060200180831161660957829003601f168201915b50505050509050919050565b61663b33612f87565b6166ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082829091806001815401808255809150509060018203906000526020600020016000909192939091929390919290919250919061672a9291906189f2565b50503373ffffffffffffffffffffffffffffffffffffffff167f15dfb3066a1bbbdaf9a7f62c47db990114058ae1739fd70a90361ea715bbf3c8838360405180806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050935050505060405180910390a25050565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806040518080618c65603c9139603c0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019450505050506040516020818303038152906040528051906020012090507369baecd458e7c08b13a18e11887dbb078fb3cbb46334d1a233600754838888886040518663ffffffff1660e01b8152600401808681526020018581526020018460ff1660ff1681526020018381526020018281526020019550505050505060206040518083038186803b15801561690857600080fd5b505af415801561691c573d6000803e3d6000fd5b505050506040513d602081101561693257600080fd5b81019080805190602001909291905050509150509695505050505050565b600061698b84848460405160200180838380828437808301925050509250505060405160208183030381529060405280519060200120617989565b90509392505050565b60018060008282540192505081905550600060015490506169fe8560405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120868686617cd0565b616a4e8560405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120613f50565b616a56617e49565b73ffffffffffffffffffffffffffffffffffffffff1663facd743b336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015616ad257600080fd5b505afa158015616ae6573d6000803e3d6000fd5b505050506040513d6020811015616afc57600080fd5b810190808051906020019092919050505015616b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180618d2a6021913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f16e382723fb40543364faf68863212ba253a099607bf6d3a5b47e50a8bf9494386604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a26001548114616c54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f7265656e7472616e742063616c6c00000000000000000000000000000000000081525060200191505060405180910390fd5b5050505050565b616c6433612f87565b616cd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420616e206163636f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001616d0860006182e3565b815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101600082015181600001555050905050600073ffffffffffffffffffffffffffffffffffffffff167f3bff8b126c8f283f709ae37dc0d3fc03cae85ca4772cfb25b601f4b0b49ca6df60006040518082815260200191505060405180910390a2565b6000616e4d8260405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120612b0a565b9050919050565b616e5d33612f87565b616ecf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905081816005019080519060200190616f2a929190618a72565b503373ffffffffffffffffffffffffffffffffffffffff167fa6e2c5a23bb917ba0a584c4b250257ddad698685829b66a8813c004b39934fe4836040518080602001828103825283818151815260200191508051906020019080838360005b83811015616fa4578082015181840152602081019050616f89565b50505050905090810190601f168015616fd15780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b6000616fed82617746565b61700157616ffc848484612482565b61700d565b61700c8484846153b3565b5b90509392505050565b600260009054906101000a900460ff1615617099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600260006101000a81548160ff0219169083151502179055506170bd336184a6565b6170c6816163aa565b6170ce61333b565b50565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167fe553a3065d5a77d4ec2a0e0c31d49be4bf4d9f4c45883b2d67f61ba9c1b89c5d8284604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a25050565b61726533612f87565b6172d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811061738e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c69642073746f7261676520726f6f7420696e64657800000000000081525060200191505060405180910390fd5b60006001600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490500390506060600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061742457fe5b906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156174c25780601f10617497576101008083540402835291602001916174c2565b820191906000526020600020905b8154815290600101906020018083116174a557829003601f168201915b50505050509050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061751357fe5b90600052602060002001600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061756757fe5b906000526020600020019080546001816001161561010002031660029004617590929190618af2565b50600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054809190600190036175e39190618b79565b503373ffffffffffffffffffffffffffffffffffffffff167fae0f2fa495a3eb65d46fe97b0baea8b6fd7edb243175c70f2455e6e83bc6fbaf82856040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015617664578082015181840152602081019050617649565b50505050905090810190601f1680156176915780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2505050565b6040518080618c65603c9139603c019050604051809103902081565b6176c8614fef565b61773a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b617743816184a6565b50565b600060405160200180807f63656c6f2e6f72672f636f72652f766f746500000000000000000000000000008152506012019050604051602081830303815290604052805190602001208214806177e1575060405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f7200000000000000000081525060170190506040516020818303038152906040528051906020012082145b80617831575060405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e0000000000000081525060190190506040516020818303038152906040528051906020012082145b9050919050565b617843338383616fe2565b156178525761785181612386565b5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549060ff02191690556000820160016101000a81549060ff02191690555050803373ffffffffffffffffffffffffffffffffffffffff167fde9ce22cf1f8631ae2b668300f0493971114f40edd305173bd099ce7100fbe0b84604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a35050565b600061799482617746565b6179a7576179a2838361243f565b6179b2565b6179b18383612b0a565b5b905092915050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600060405160200180807f63656c6f2e6f72672f636f72652f76616c696461746f72000000000000000000815250601701905060405160208183030381529060405280519060200120831415617ac3578160010160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008260010160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550617c49565b60405160200180807f63656c6f2e6f72672f636f72652f6174746573746174696f6e00000000000000815250601901905060405160208183030381529060405280519060200120831415617b87578160010160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008260010160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550617c48565b60405160200180807f63656c6f2e6f72672f636f72652f766f74650000000000000000000000000000815250601201905060405160208183030381529060405280519060200120831415617c47578160010160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008260010160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b3373ffffffffffffffffffffffffffffffffffffffff167fdd0b0d959c29750e7bfabbb7543a56957699d07edc512d2523ffe7502901ac198285604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a2505050565b617cdc858484846185ea565b604051806040016040528060011515815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908315150217905550905050833373ffffffffffffffffffffffffffffffffffffffff167f6cc56bd06daacce5b10fdf5ad1dc781941e14d7a71d29d33e7001e2956d14e0787604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a35050505050565b6000600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200180807f56616c696461746f727300000000000000000000000000000000000000000000815250600a019050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015617f0457600080fd5b505afa158015617f18573d6000803e3d6000fd5b505050506040513d6020811015617f2e57600080fd5b8101908080519060200190929190505050905090565b600080828401905083811015617fc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16159050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061814b57508273ffffffffffffffffffffffffffffffffffffffff16600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b905092915050565b600080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614618255576181f7818585613650565b61824c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180618e116025913960400191505060405180910390fd5b809150506182d5565b61825e84612f87565b6182d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f6e6f7420616e206163636f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b839150505b92915050565b600033905090565b6182eb6189df565b6040518060200160405280838152509050919050565b6183096189df565b604051806020016040528069d3c21bcecceda1000000815250905090565b6000816000015183600001511115905092915050565b600061834d3387878787876167dd565b90508573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146183f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f496e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b6183f986618773565b505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff16600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050919050565b600081600001519050919050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561852c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180618c3f6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60007369baecd458e7c08b13a18e11887dbb078fb3cbb46396ef41a1338686866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff16815260200183815260200182815260200194505050505060206040518083038186803b15801561868557600080fd5b505af4158015618699573d6000803e3d6000fd5b505050506040513d60208110156186af57600080fd5b810190808051906020019092919050505090508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614618763576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f496e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b61876c85618773565b5050505050565b61877c33612f87565b6187ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f556e6b6e6f776e206163636f756e74000000000000000000000000000000000081525060200191505060405180910390fd5b6187f781617fcc565b801561880957506188083382618026565b5b61885e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526046815260200180618ce46046913960600191505060405180910390fd5b33600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061892057805160ff191683800117855561894e565b8280016001018555821561894e579182015b8281111561894d578251825591602001919060010190618932565b5b50905061895b9190618ba5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106189a057803560ff19168380011785556189ce565b828001600101855582156189ce579182015b828111156189cd5782358255916020019190600101906189b2565b5b5090506189db9190618ba5565b5090565b6040518060200160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10618a3357803560ff1916838001178555618a61565b82800160010185558215618a61579182015b82811115618a60578235825591602001919060010190618a45565b5b509050618a6e9190618ba5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10618ab357805160ff1916838001178555618ae1565b82800160010185558215618ae1579182015b82811115618ae0578251825591602001919060010190618ac5565b5b509050618aee9190618ba5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10618b2b5780548555618b68565b82800160010185558215618b6857600052602060002091601f016020900482015b82811115618b67578254825591600101919060010190618b4c565b5b509050618b759190618ba5565b5090565b815481835581811115618ba057818360005260206000209182019101618b9f9190618bca565b5b505050565b618bc791905b80821115618bc3576000816000905550600101618bab565b5090565b90565b618bf391905b80821115618bef5760008181618be69190618bf6565b50600101618bd0565b5090565b90565b50805460018160011615610100020316600290046000825580601f10618c1c5750618c3b565b601f016020900490600052602060002090810190618c3a9190618ba5565b5b5056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373417574686f72697a655369676e65722861646472657373206163636f756e742c61646472657373207369676e65722c6279746573333220726f6c652943616e6e6f7420617574686f72697a65206163636f756e74206173207369676e657242656e65666963696172792063616e6e6f7420626520616464726573732030783043616e6e6f742072652d617574686f72697a652061646472657373206f72206c6f636b656420676f6c64206163636f756e7420666f7220616e6f74686572206163636f756e7443616e6e6f7420617574686f72697a652076616c696461746f72207369676e6572454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374294672616374696f6e206d757374206e6f742062652067726561746572207468616e20314d75737420617574686f72697a65207369676e6572206265666f72652073657474696e672061732064656661756c7443616e6e6f742072652d617574686f72697a652061646472657373207369676e65726e6f742061637469766520617574686f72697a6564207369676e657220666f7220726f6c654661696c656420746f20757064617465204543445341207075626c6963206b6579a265627a7a72315820914683724a147429662f70c38e2d650fa08a010c8fae822b4ac3f986967dd7c964736f6c634300050d0032