ETH Price: $2,934.45 (+4.06%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040184168482023-10-24 1:28:35381 days ago1698110915IN
 Create: RefactorCoinageSnapshot
0 ETH0.0754525530

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RefactorCoinageSnapshot

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 625 runs

Other Settings:
paris EvmVersion, MIT license
File 1 of 18 : RefactorCoinageSnapshot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import { IRefactor } from "../interfaces/IRefactor.sol";
import { AutoRefactorCoinageI } from "../interfaces/AutoRefactorCoinageI.sol";
import { DSMath } from "../../libraries/DSMath.sol";
import "../../libraries/SArrays.sol";

import "../../proxy/ProxyStorage.sol";
import { AuthControlCoinage } from "../../common/AuthControlCoinage.sol";
import { RefactorCoinageSnapshotStorage } from "./RefactorCoinageSnapshotStorage.sol";


interface IIISeigManager {
  function progressSnapshotId() external view returns (uint256);
}
/**
 * @dev Implementation of coin age token based on ERC20 of openzeppelin/-solidity
 *
 * AutoRefactorCoinage stores `_totalSupply` and `_balances` as RAY BASED value,
 * `_allowances` as RAY FACTORED value.
 *
 * This takes public function (including _approve) parameters as RAY FACTORED value
 * and internal function (including approve) parameters as RAY BASED value, and emits event in RAY FACTORED value.
 *
 * `RAY BASED` = `RAY FACTORED`  / factor
 *
 *  factor increases exponentially for each block mined.
 */
contract RefactorCoinageSnapshot is ProxyStorage, AuthControlCoinage, RefactorCoinageSnapshotStorage, DSMath {
    using SArrays for uint256[];

    event FactorSet(uint256 previous, uint256 current, uint256 shiftCount);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event ChangedBalance(address indexed account, IRefactor.Balance oldBalance, IRefactor.Balance newBalance, IRefactor.Balance oldTotalBalance, IRefactor.Balance newTotalBalance);
    event ChangedFactor(IRefactor.Factor previous, IRefactor.Factor next);
    // event Snapshotted(uint256 id);

    function initialize (
      string memory name_,
      string memory symbol_,
      uint256 factor_,
      address seigManager_
    ) external {

      require(factorSnapshots[0].factor == 0, "already initialized");

      name = name_;
      symbol = symbol_;
      factorSnapshots[0] = IRefactor.Factor(factor_, 0);
      seigManager = seigManager_;
    }


    /**
     *  onlyOwner
     **/

    function setFactor(uint256 factor_) external onlyOwner returns (bool) {
      IRefactor.Factor memory previous = _valueAtFactorLast();
      // uint256 previous = _factor;

      uint256 count = 0;
      uint256 f = factor_;

      for (; f >= REFACTOR_BOUNDARY; f = f / REFACTOR_DIVIDER) {
        count++;
      }

      IRefactor.Factor memory nextFactor = IRefactor.Factor(f, count);
      _updateFactor(nextFactor);


      emit ChangedFactor(previous, nextFactor);
      return true;
    }

    function setSeigManager(address _seigManager) external onlyOwner {
      seigManager = _seigManager;
    }

    /**
     *  onlyMinter
     **/

    function mint(address account, uint256 amount) public onlyMinter returns (bool) {
          _mint(account, amount);
          return true;
    }

    function burnFrom(address account, uint256 amount) public onlyMinter {
        _burn(account, amount);
    }

    // -------- external

    function burn(uint256 amount) external {
        _burn(msg.sender, amount);
    }

    function decimals() external pure returns (uint8) {
        return 27;
    }

    // -------- public

    function factor() public view returns (uint256) {
      IRefactor.Factor memory _factor = _valueAtFactorLast();
      return _factor.factor * REFACTOR_DIVIDER ** _factor.refactorCount;
    }

    // -------- internal

    function _mint(address account, uint256 amount) internal {
      require(account != address(0), "AutoRefactorCoinage: mint to the zero address");

      IRefactor.Factor memory f = _valueAtFactorLast();
      IRefactor.Balance memory _totalBalance = _valueAtTotalSupplyLast();
      IRefactor.Balance memory _accountBalance = _valueAtAccountBalanceLast(account);

      uint256 currentAccountBalance = applyFactor(_accountBalance);
      uint256 currentTotalBalance = applyFactor(_totalBalance);

      uint256 rbAmountAccount = _toRAYBased(currentAccountBalance + amount);
      uint256 rbAmountTotal = _toRAYBased(currentTotalBalance + amount);

      IRefactor.Balance memory newAccountBalance = IRefactor.Balance(rbAmountAccount, f.refactorCount);
      IRefactor.Balance memory newTotalBalance = IRefactor.Balance(rbAmountTotal, f.refactorCount);

      _update(newAccountBalance, newTotalBalance, account, true, true);

      emit ChangedBalance(account, _accountBalance, newAccountBalance, _totalBalance, newTotalBalance);

      emit Transfer(address(0), account, amount);
    }

    function _burn(address account, uint256 amount) internal {
      require(account != address(0), "AutoRefactorCoinage: burn from the zero address");
      IRefactor.Factor memory f = _valueAtFactorLast();
      IRefactor.Balance memory _totalBalance = _valueAtTotalSupplyLast();
      IRefactor.Balance memory _accountBalance = _valueAtAccountBalanceLast(account);

      uint256 currentTotalBalance = applyFactor(_totalBalance);
      uint256 currentAccountBalance = applyFactor(_accountBalance);

      require(currentAccountBalance >= amount
        && currentTotalBalance >= amount, "insufficient balance");

      uint256 rbAmountTotal = _toRAYBased(currentTotalBalance - amount);
      uint256 rbAmountAccount = _toRAYBased(currentAccountBalance - amount);

      IRefactor.Balance memory newTotalBalance = IRefactor.Balance(rbAmountTotal, f.refactorCount);
      IRefactor.Balance memory newAccountBalance = IRefactor.Balance(rbAmountAccount, f.refactorCount);

      _update(newAccountBalance, newTotalBalance, account, true, true);

      emit ChangedBalance(account, _accountBalance, newAccountBalance, _totalBalance, newTotalBalance);

      emit Transfer(account, address(0), amount);
    }

    /**
     * @param v the value to be factored
     */
    function _applyFactor(uint256 v, uint256 refactoredCount) internal view returns (uint256) {

      if (v == 0) {
        return 0;
      }

      IRefactor.Factor memory _factor = _valueAtFactorLast();

      v = rmul2(v, _factor.factor);

      if (_factor.refactorCount > refactoredCount) {
        v = v * REFACTOR_DIVIDER ** (_factor.refactorCount - refactoredCount);
      }
      return v;
    }

    function _applyFactorAt(IRefactor.Balance memory _balance, IRefactor.Factor memory _factor) internal pure returns (uint256) {
      if (_balance.balance == 0) {
        return 0;
      }
      _balance.balance = rmul2(_balance.balance, _factor.factor);
      if(_factor.refactorCount > _balance.refactoredCount) {
        _balance.balance = _balance.balance * REFACTOR_DIVIDER ** (_factor.refactorCount - _balance.refactoredCount);
      }
      return _balance.balance;
    }

    /**
     * @dev Calculate RAY BASED from RAY FACTORED
     */
    function _toRAYBased(uint256 rf) internal view returns (uint256 rb) {
      return rdiv2(rf, (_valueAtFactorLast()).factor);
    }

    /**
     * @dev Calculate RAY FACTORED from RAY BASED
     */
    function _toRAYFactored(uint256 rb) internal view returns (uint256 rf) {
      return rmul2(rb, (_valueAtFactorLast()).factor);
    }

    function _lastSnapshotId(uint256[] storage ids) internal view returns (uint256) {
        return (ids.length == 0? 0: ids[ids.length - 1]);
    }

    function _updateFactor(IRefactor.Factor memory _factor) internal {

      uint256 currentId = progressSnapshotId();
      uint256 factorIndex = _lastSnapshotId(factorSnapshotIds);

      if (factorIndex < currentId) factorSnapshotIds.push(currentId);
      factorSnapshots[currentId] = _factor;

    }

    function _update(
      IRefactor.Balance memory _accountBalance,
      IRefactor.Balance memory _totalBalance,
      address account,
      bool accountBool,
      bool totalBool
    ) internal  {

      uint256 currentId = progressSnapshotId();
      uint256 balanceIndex = _lastSnapshotId(accountBalanceIds[account]);
      uint256 totalIndex = _lastSnapshotId(totalSupplySnapshotIds);

      if (accountBool) {
        require(account != address(0), "zero account");
        if (balanceIndex < currentId) accountBalanceIds[account].push(currentId);
        accountBalanceSnapshots[account][currentId] = _accountBalance;
      }

      if (totalBool) {
        if (totalIndex < currentId) totalSupplySnapshotIds.push(currentId);
        totalSupplySnapshots[currentId] = _totalBalance;
      }

    }

    function progressSnapshotId() public view returns (uint256) {
        return IIISeigManager(seigManager).progressSnapshotId();
    }

    function applyFactor(IRefactor.Balance memory _balance) public view returns (uint256 amount) {

      return _applyFactor(_balance.balance, _balance.refactoredCount);
    }

    function totalSupply() external view returns (uint256 amount)
    {
      amount = applyFactor(_valueAtTotalSupplyLast());
    }

    function balanceOf(address account) external view returns (uint256 amount)
    {
      amount = applyFactor(_valueAtAccountBalanceLast(account));
    }

    function totalSupplyAt(uint256 snapshotId) external view returns (uint256 amount)
    {
      (IRefactor.Balance memory _balance,  IRefactor.Factor memory _factor) = getTotalAndFactorAt(snapshotId);
      amount = _applyFactorAt(_balance, _factor);
    }

    function balanceOfAt(address account, uint256 snapshotId) external view
      returns (uint256 amount)
    {
      (IRefactor.Balance memory _balance,  IRefactor.Factor memory _factor) = getBalanceAndFactorAt(account, snapshotId);
      amount = _applyFactorAt(_balance, _factor);
    }

    function getTotalAndFactor() public view returns (IRefactor.Balance memory, IRefactor.Factor memory)
    {
      return (_valueAtTotalSupplyLast(), _valueAtFactorLast());
    }

    function getBalanceAndFactor(address account) public view returns (IRefactor.Balance memory, IRefactor.Factor memory)
    {
      return (_valueAtAccountBalanceLast(account), _valueAtFactorLast());
    }

    function getTotalAndFactorAt(uint256 snapshotId) public view returns (IRefactor.Balance memory, IRefactor.Factor memory)
    {
      return (_valueAtTotalSupply(snapshotId), _valueAtFactor(snapshotId));
    }

    function getBalanceAndFactorAt(address account, uint256 snapshotId) public view returns (IRefactor.Balance memory, IRefactor.Factor memory)
    {
      return (_valueAtAccount(snapshotId, account), _valueAtFactor(snapshotId));
    }

    function _valueAtTotalSupplyLast() internal view
      returns (IRefactor.Balance memory)
    {
      uint256 index = 0;
      uint256 length = totalSupplySnapshotIds.length;
      if(length != 0) index = totalSupplySnapshotIds[length - 1];
      return totalSupplySnapshots[index];
    }

    function _valueAtFactorLast() internal view
      returns (IRefactor.Factor memory)
    {
      uint256 index = 0;
      uint256 length = factorSnapshotIds.length;
      if(length != 0) index = factorSnapshotIds[length - 1];
      return factorSnapshots[index];
    }

    function _valueAtAccountBalanceLast(address account) internal view
      returns (IRefactor.Balance memory)
    {
      uint256 index = 0;
      uint256 length = accountBalanceIds[account].length;
      if(length != 0) index = accountBalanceIds[account][length - 1];
      return accountBalanceSnapshots[account][index];
    }

    function _valueAtTotalSupply(uint256 snapshotId) internal view
      returns (IRefactor.Balance memory balance)
    {
      require(snapshotId <= progressSnapshotId(), "snapshotId > progressSnapshotId");
      uint256 index = totalSupplySnapshotIds.findValue(snapshotId);
      return totalSupplySnapshots[index];
    }

    function _valueAtFactor(uint256 snapshotId) internal view
      returns (IRefactor.Factor memory factor_)
    {
      require(snapshotId <= progressSnapshotId(), "snapshotId > progressSnapshotId");
      uint256 index = factorSnapshotIds.findValue(snapshotId);
      return factorSnapshots[index];
    }

    function _valueAtAccount(uint256 snapshotId, address account) internal view
        returns (IRefactor.Balance memory balance)
    {
      require(snapshotId <= progressSnapshotId(), "snapshotId > progressSnapshotId");
      uint256 index = accountBalanceIds[account].findValue(snapshotId);
      return accountBalanceSnapshots[account][index];
    }
}

File 2 of 18 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 18 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 18 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.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 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.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 5 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 6 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 7 of 18 : ERC165Storage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)

pragma solidity ^0.8.0;

import "./ERC165.sol";

/**
 * @dev Storage based implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165Storage is ERC165 {
    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 8 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 9 of 18 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 10 of 18 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 11 of 18 : AuthControlCoinage.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import { ERC165Storage } from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./AuthRoleCoinage.sol";

contract AuthControlCoinage is AuthRoleCoinage, ERC165Storage, AccessControl {
    modifier onlyOwner() {
        require(isAdmin(msg.sender), "AuthControl: Caller is not an admin");
        _;
    }

    modifier onlyMinter() {
        require(hasRole(MINTER_ROLE, msg.sender), "AuthControl: Caller is not a minter");
        _;
    }

    modifier onlyOperator() {
        require(hasRole(OPERATOR_ROLE, msg.sender), "AuthControl: Caller is not an operator");
        _;
    }


    /// @dev add admin
    /// @param account  address to add
    function addAdmin(address account) public virtual onlyOwner {
        grantRole(DEFAULT_ADMIN_ROLE, account);
    }

    function addMinter(address account) public virtual onlyOwner {
        grantRole(MINTER_ROLE, account);
    }

    function addOperator(address account) public virtual onlyOwner {
        grantRole(OPERATOR_ROLE, account);
    }

    /// @dev remove admin
    /// @param account  address to remove
    function removeAdmin(address account) public virtual onlyOwner {
        renounceRole(DEFAULT_ADMIN_ROLE, account);
    }

    function removeMinter(address account) public virtual onlyOwner {
        renounceRole(MINTER_ROLE, account);
    }

    function removeOperator(address account) public virtual onlyOwner {
        renounceRole(OPERATOR_ROLE, account);
    }

    /// @dev transfer admin
    /// @param newAdmin new admin address
    function transferAdmin(address newAdmin) public virtual onlyOwner {
        require(newAdmin != address(0), "Accessible: zero address");
        require(msg.sender != newAdmin, "Accessible: same admin");

        grantRole(DEFAULT_ADMIN_ROLE, newAdmin);
        renounceRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function transferOwnership(address newAdmin) public virtual onlyOwner {
        transferAdmin(newAdmin);
    }

    function renounceOwnership() public onlyOwner {
        renounceRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function renounceMinter() public {
        renounceRole(MINTER_ROLE, msg.sender);
    }

    function renounceOperator() public {
        renounceRole(OPERATOR_ROLE, msg.sender);
    }

    function revokeMinter(address account) public onlyOwner {
        revokeRole(MINTER_ROLE, account);
    }

    function revokeOperator(address account) public onlyOwner {
        revokeRole(OPERATOR_ROLE, account);
    }

    /// @dev whether admin
    /// @param account  address to check
    function isAdmin(address account) public view virtual returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, account);
    }

    function isOwner() public view virtual returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function isMinter(address account) public view virtual returns (bool) {
        return hasRole(MINTER_ROLE, account);
    }

    function isOperator(address account) public view virtual returns (bool) {
        return hasRole(OPERATOR_ROLE, account);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, AccessControl) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

File 12 of 18 : AuthRoleCoinage.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

contract AuthRoleCoinage {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER");
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");
}

File 13 of 18 : DSMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

contract DSMath {
  function add(uint x, uint y) internal pure returns (uint z) {
    require((z = x + y) >= x, "ds-math-add-overflow");
  }
  function sub(uint x, uint y) internal pure returns (uint z) {
    require((z = x - y) <= x, "ds-math-sub-underflow");
  }
  function mul(uint x, uint y) internal pure returns (uint z) {
    require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
  }

  function min(uint x, uint y) internal pure returns (uint z) {
    return x <= y ? x : y;
  }
  function max(uint x, uint y) internal pure returns (uint z) {
    return x >= y ? x : y;
  }
  function imin(int x, int y) internal pure returns (int z) {
    return x <= y ? x : y;
  }
  function imax(int x, int y) internal pure returns (int z) {
    return x >= y ? x : y;
  }

  uint constant WAD_ = 10 ** 18;
  uint constant RAY_ = 10 ** 27;

  function wmul(uint x, uint y) internal pure returns (uint z) {
    z = add(mul(x, y), WAD_ / 2) / WAD_;
  }
  function rmul(uint x, uint y) internal pure returns (uint z) {
    z = add(mul(x, y), RAY_ / 2) / RAY_;
  }
  function wdiv(uint x, uint y) internal pure returns (uint z) {
    z = add(mul(x, WAD_), y / 2) / y;
  }
  function rdiv(uint x, uint y) internal pure returns (uint z) {
    z = add(mul(x, RAY_), y / 2) / y;
  }

  function wmul2(uint x, uint y) internal pure returns (uint z) {
    z = mul(x, y) / WAD_;
  }
  function rmul2(uint x, uint y) internal pure returns (uint z) {
    z = mul(x, y) / RAY_;
  }
  function wdiv2(uint x, uint y) internal pure returns (uint z) {
    z = mul(x, WAD_) / y;
  }
  function rdiv2(uint x, uint y) internal pure returns (uint z) {
    z = mul(x, RAY_) / y;
  }

  // This famous algorithm is called "exponentiation by squaring"
  // and calculates x^n with x as fixed-point and n as regular unsigned.
  //
  // It's O(log n), instead of O(n) for naive repeated multiplication.
  //
  // These facts are why it works:
  //
  //  If n is even, then x^n = (x^2)^(n/2).
  //  If n is odd,  then x^n = x * x^(n-1),
  //   and applying the equation for even x gives
  //  x^n = x * (x^2)^((n-1) / 2).
  //
  //  Also, EVM division is flooring and
  //  floor[(n-1) / 2] = floor[n / 2].
  //
  function wpow(uint x, uint n) internal pure returns (uint z) {
    z = n % 2 != 0 ? x : WAD_;

    for (n /= 2; n != 0; n /= 2) {
      x = wmul(x, x);

      if (n % 2 != 0) {
        z = wmul(z, x);
      }
    }
  }

  function rpow(uint x, uint n) internal pure returns (uint z) {
    z = n % 2 != 0 ? x : RAY_;

    for (n /= 2; n != 0; n /= 2) {
      x = rmul(x, x);

      if (n % 2 != 0) {
        z = rmul(z, x);
      }
    }
  }
}

File 14 of 18 : SArrays.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library SArrays {
    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds down (it does integer division with truncation).
            if (array[mid] > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && array[low - 1] == element) {
            return low - 1;
        } else {
            return low;
        }
    }

    function findIndex(uint256[] storage array, uint256 element
    ) internal view returns (uint256) {
        if (array.length == 0) return 0;

        // Shortcut for the actual value
        if (element >= array[array.length-1])
            return (array.length-1);
        if (element < array[0]) return 0;

        // Binary search of the value in the array
        uint min = 0;
        uint max = array.length-1;
        while (max > min) {
            uint mid = (max + min + 1)/ 2;

            if (array[mid] <= element) {
                min = mid;
            } else {
                max = mid-1;
            }
        }

        return min;
    }

    function findValue(uint256[] storage array, uint256 element
    ) internal view returns (uint256) {
        if (array.length == 0) return 0;

        // Shortcut for the actual value
        if (element >= array[array.length-1])
            return (array[array.length-1]);
        if (element < array[0]) return 0;

        // Binary search of the value in the array
        uint min = 0;
        uint max = array.length-1;
        while (max > min) {
            uint mid = (max + min + 1)/ 2;

            if (array[mid] <= element) {
                min = mid;
            } else {
                max = mid-1;
            }
        }

        return array[min];
    }


}

File 15 of 18 : ProxyStorage.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

contract ProxyStorage  {

    bool public pauseProxy;

    mapping(uint256 => address) public proxyImplementation;
    mapping(address => bool) public aliveImplementation;
    mapping(bytes4 => address) public selectorImplementation;

}

File 16 of 18 : AutoRefactorCoinageI.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface AutoRefactorCoinageI {
  function factor() external view returns (uint256);
  function setFactor(uint256 factor) external returns (bool);
  function burn(uint256 amount) external;
  function burnFrom(address account, uint256 amount) external;
  function mint(address account, uint256 amount) external returns (bool);
  function totalSupply() external view returns (uint256);
  function balanceOf(address account) external view returns (uint256);
  function addMinter(address account) external;
  function renounceMinter() external;
  function transferOwnership(address newOwner) external;
}

File 17 of 18 : IRefactor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IRefactor {
  struct Balance {
        uint256 balance;
        uint256 refactoredCount;
    }

    struct Factor {
        uint256 factor;
        uint256 refactorCount;
    }
}

File 18 of 18 : RefactorCoinageSnapshotStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { IRefactor } from "../interfaces/IRefactor.sol";

/// @title
/// @notice
contract RefactorCoinageSnapshotStorage   {

    uint256 public constant REFACTOR_BOUNDARY = 10 ** 28;
    uint256 public constant REFACTOR_DIVIDER = 2;

    address public seigManager;

    //=== ERC20
    string public name;
    string public symbol;

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

    //---------------
    uint256[] public totalSupplySnapshotIds;
    mapping (uint256 => IRefactor.Balance) public totalSupplySnapshots;

    uint256[] public factorSnapshotIds;
    mapping (uint256 => IRefactor.Factor) public factorSnapshots;

    mapping (address => uint256[]) public accountBalanceIds;
    mapping (address => mapping (uint256 => IRefactor.Balance)) public accountBalanceSnapshots;

    uint256 public lastSnapshotId;
}

Settings
{
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 625
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Balance","name":"oldBalance","type":"tuple"},{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Balance","name":"newBalance","type":"tuple"},{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Balance","name":"oldTotalBalance","type":"tuple"},{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Balance","name":"newTotalBalance","type":"tuple"}],"name":"ChangedBalance","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Factor","name":"previous","type":"tuple"},{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"indexed":false,"internalType":"struct IRefactor.Factor","name":"next","type":"tuple"}],"name":"ChangedFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previous","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"current","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shiftCount","type":"uint256"}],"name":"FactorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFACTOR_BOUNDARY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFACTOR_DIVIDER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"_allowances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountBalanceIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountBalanceSnapshots","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"aliveImplementation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"internalType":"struct IRefactor.Balance","name":"_balance","type":"tuple"}],"name":"applyFactor","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"factor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"factorSnapshotIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"factorSnapshots","outputs":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBalanceAndFactor","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"internalType":"struct IRefactor.Balance","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"internalType":"struct IRefactor.Factor","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"getBalanceAndFactorAt","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"internalType":"struct IRefactor.Balance","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"internalType":"struct IRefactor.Factor","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalAndFactor","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"internalType":"struct IRefactor.Balance","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"internalType":"struct IRefactor.Factor","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"getTotalAndFactorAt","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"internalType":"struct IRefactor.Balance","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"factor","type":"uint256"},{"internalType":"uint256","name":"refactorCount","type":"uint256"}],"internalType":"struct IRefactor.Factor","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint256","name":"factor_","type":"uint256"},{"internalType":"address","name":"seigManager_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSnapshotId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseProxy","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"progressSnapshotId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"revokeMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"revokeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seigManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"selectorImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"factor_","type":"uint256"}],"name":"setFactor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_seigManager","type":"address"}],"name":"setSeigManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupplySnapshotIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupplySnapshots","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"refactoredCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612c8e806100206000396000f3fe608060405234801561001057600080fd5b50600436106103ae5760003560e01c80636d70f7ae116101f4578063983b2d561161011a578063b911135f116100ad578063d547741f1161007c578063d547741f146108d7578063f2fde38b146108ea578063f5b541a6146108fd578063fad8b32a1461092457600080fd5b8063b911135f14610861578063bd3a13f61461088a578063cfbd48851461089d578063d5391393146108b057600080fd5b8063aa271e1a116100e9578063aa271e1a14610801578063ac8a584a14610814578063b7c246d714610827578063b7d78b1a1461083a57600080fd5b8063983b2d56146107cb57806398650275146107de5780639870d7fe146107e6578063a217fddf146107f957600080fd5b806379cc6790116101925780638f32d59b116101615780638f32d59b1461074057806391d148541461077757806395d89b41146107b0578063981b24d0146107b857600080fd5b806379cc6790146106fe578063817e9d3114610711578063837afbc0146107245780638639583f1461072d57600080fd5b806370a08231116101ce57806370a08231146106bd578063715018a6146106d057806375829def146106d85780637657f20a146106eb57600080fd5b80636d70f7ae146106845780636fb7f5581461069757806370480275146106aa57600080fd5b80633092afd5116102d957806354f703f811610277578063614db8b211610246578063614db8b21461063e57806363a8fd89146106515780636957f38b1461065e57806369f499b11461067157600080fd5b806354f703f8146105d9578063550d01a3146105e157806356fabf68146106045780635deaecec1461061757600080fd5b806340c10f19116102b357806340c10f191461055f57806342966c68146105725780634ee2cd7e1461058557806350d2a2761461059857600080fd5b80633092afd51461052a578063313ce5671461053d57806336568abe1461054c57600080fd5b80631397704211610351578063248a9ca311610320578063248a9ca3146104d957806324d7806c146104fc5780632ab6f8db1461050f5780632f2ff15d1461051757600080fd5b806313977042146104a15780631785f53c146104a957806318160ddd146104be57806319d5dce9146104c657600080fd5b8063024c2ddd1161038d578063024c2ddd146104045780630461fdc51461042f57806306fdde031461047657806308eef06d1461048b57600080fd5b8062d87a9c146103b357806301f6a80a146103ce57806301ffc9a7146103e1575b600080fd5b6103bb600281565b6040519081526020015b60405180910390f35b6103bb6103dc36600461259e565b610937565b6103f46103ef3660046125ed565b610951565b60405190151581526020016103c5565b6103bb61041236600461262e565b600960209081526000928352604080842090915290825290205481565b61046161043d366004612661565b600f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016103c5565b61047e61095c565b6040516103c591906126af565b6104936109ea565b6040516103c59291906126e2565b6103bb610a2a565b6104bc6104b7366004612708565b610a9d565b005b6103bb610ad9565b6104936104d4366004612708565b610ae6565b6103bb6104e7366004612723565b60009081526005602052604090206001015490565b6103f461050a366004612708565b610b28565b6104bc610b68565b6104bc61052536600461273c565b610b94565b6104bc610538366004612708565b610bbe565b604051601b81526020016103c5565b6104bc61055a36600461273c565b610c09565b6103f461056d366004612661565b610c95565b6104bc610580366004612723565b610d32565b6103bb610593366004612661565b610d3c565b6105c16105a63660046125ed565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016103c5565b6103bb610d62565b6103f46105ef366004612708565b60026020526000908152604090205460ff1681565b6103bb610612366004612723565b610d92565b610461610625366004612723565b600d602052600090815260409020805460019091015482565b6103bb61064c366004612723565b610db3565b6000546103f49060ff1681565b61049361066c366004612723565b610dc3565b6103bb61067f366004612661565b610dfd565b6103f4610692366004612708565b610e2e565b6006546105c1906001600160a01b031681565b6104bc6106b8366004612708565b610e6e565b6103bb6106cb366004612708565b610e9e565b6104bc610eac565b6104bc6106e6366004612708565b610edc565b6104bc6106f9366004612708565b610fc5565b6104bc61070c366004612661565b611019565b6103f461071f366004612723565b6110ad565b6103bb60105481565b61049361073b366004612661565b61117b565b3360009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc602052604090205460ff166103f4565b6103f461078536600461273c565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61047e6111c1565b6103bb6107c6366004612723565b6111ce565b6104bc6107d9366004612708565b6111f2565b6104bc611241565b6104bc6107f4366004612708565b61126b565b6103bb600081565b6103f461080f366004612708565b6112ba565b6104bc610822366004612708565b6112fa565b6103bb6b204fce5e3e2502611000000081565b610461610848366004612723565b600b602052600090815260409020805460019091015482565b6105c161086f366004612723565b6001602052600090815260409020546001600160a01b031681565b6104bc6108983660046127ec565b611349565b6104bc6108ab366004612708565b611471565b6103bb7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6104bc6108e536600461273c565b6114bc565b6104bc6108f8366004612708565b6114e1565b6103bb7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b6104bc610932366004612708565b61150f565b600061094b8260000151836020015161155e565b92915050565b600061094b826115c8565b600780546109699061286a565b80601f01602080910402602001604051908101604052809291908181526020018280546109959061286a565b80156109e25780601f106109b7576101008083540402835291602001916109e2565b820191906000526020600020905b8154815290600101906020018083116109c557829003601f168201915b505050505081565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610a1a6115ed565b610a22611664565b915091509091565b600654604080516309cbb82160e11b815290516000926001600160a01b03169163139770429160048083019260209291908290030181865afa158015610a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9891906128a4565b905090565b610aa633610b28565b610acb5760405162461bcd60e51b8152600401610ac2906128bd565b60405180910390fd5b610ad6600082610c09565b50565b6000610a986103dc6115ed565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610b17836116db565b610b1f611664565b91509150915091565b6001600160a01b03811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc602052604081205460ff1661094b565b610b927f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c33610c09565b565b600082815260056020526040902060010154610baf8161178e565b610bb98383611798565b505050565b610bc733610b28565b610be35760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9825b6001600160a01b0381163314610c875760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610ac2565b610c91828261183a565b5050565b3360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604081205460ff16610d1f5760405162461bcd60e51b815260206004820152602360248201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f742061206d696e6044820152623a32b960e91b6064820152608401610ac2565b610d2983836118bd565b50600192915050565b610ad63382611a6b565b6000806000610d4b858561117b565b91509150610d598282611c5f565b95945050505050565b600080610d6d611664565b905080602001516002610d8091906129fa565b8151610d8c9190612a06565b91505090565b600c8181548110610da257600080fd5b600091825260209091200154905081565b600a8181548110610da257600080fd5b60408051808201909152600080825260208201526040805180820190915260008082526020820152610df483611cc6565b610b1f84611d6b565b600e6020528160005260406000208181548110610e1957600080fd5b90600052602060002001600091509150505481565b6001600160a01b03811660009081527f02634a7c777b8129955fe1824eee49ef19dfa96f2f4cb63212492c3d84eb58e6602052604081205460ff1661094b565b610e7733610b28565b610e935760405162461bcd60e51b8152600401610ac2906128bd565b610ad6600082610b94565b600061094b6103dc836116db565b610eb533610b28565b610ed15760405162461bcd60e51b8152600401610ac2906128bd565b610b92600033610c09565b610ee533610b28565b610f015760405162461bcd60e51b8152600401610ac2906128bd565b6001600160a01b038116610f575760405162461bcd60e51b815260206004820152601860248201527f41636365737369626c653a207a65726f206164647265737300000000000000006044820152606401610ac2565b6001600160a01b0381163303610faf5760405162461bcd60e51b815260206004820152601660248201527f41636365737369626c653a2073616d652061646d696e000000000000000000006044820152606401610ac2565b610fba600082610b94565b610ad6600033610c09565b610fce33610b28565b610fea5760405162461bcd60e51b8152600401610ac2906128bd565b6006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b3360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604090205460ff166110a35760405162461bcd60e51b815260206004820152602360248201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f742061206d696e6044820152623a32b960e91b6064820152608401610ac2565b610c918282611a6b565b60006110b833610b28565b6110d45760405162461bcd60e51b8152600401610ac2906128bd565b60006110de611664565b90506000835b6b204fce5e3e250261100000008110611117578161110181612a1d565b92506111109050600282612a36565b90506110e4565b604080518082019091528181526020810183905261113481611e10565b7f29ca2230155ed7b305631c2160bcce185fe471567c0e99ae17de3b6a909a838d84826040516111659291906126e2565b60405180910390a160019450505050505b919050565b604080518082019091526000808252602082015260408051808201909152600080825260208201526111ad8385611e89565b6111b684611d6b565b915091509250929050565b600880546109699061286a565b60008060006111dc84610dc3565b915091506111ea8282611c5f565b949350505050565b6111fb33610b28565b6112175760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc982610b94565b610b927ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933610c09565b61127433610b28565b6112905760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82610b94565b6001600160a01b03811660009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604081205460ff1661094b565b61130333610b28565b61131f5760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82610c09565b60008052600d6020527f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee54156113c15760405162461bcd60e51b815260206004820152601360248201527f616c726561647920696e697469616c697a6564000000000000000000000000006044820152606401610ac2565b60076113cd8582612aa6565b5060086113da8482612aa6565b506040805180820190915291825260006020808401828152918052600d905291517f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee5590517f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ef556006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555050565b61147a33610b28565b6114965760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9825b6000828152600560205260409020600101546114d78161178e565b610bb9838361183a565b6114ea33610b28565b6115065760405162461bcd60e51b8152600401610ac2906128bd565b610ad681610edc565b61151833610b28565b6115345760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c826114bc565b6000826000036115705750600061094b565b600061157a611664565b905061158a848260000151611f58565b935082816020015111156115c0578281602001516115a89190612b66565b6115b39060026129fa565b6115bd9085612a06565b93505b509192915050565b60006001600160e01b03198216637965db0b60e01b148061094b575061094b82611f82565b6040805180820190915260008082526020820152600a54600090801561163857600a61161a600183612b66565b8154811061162a5761162a612b79565b906000526020600020015491505b506000908152600b60209081526040918290208251808401909352805483526001015490820152919050565b6040805180820190915260008082526020820152600c5460009080156116af57600c611691600183612b66565b815481106116a1576116a1612b79565b906000526020600020015491505b506000908152600d60209081526040918290208251808401909352805483526001015490820152919050565b60408051808201909152600080825260208201526001600160a01b0382166000908152600e6020526040812054801561174f576001600160a01b0384166000908152600e60205260409020611731600183612b66565b8154811061174157611741612b79565b906000526020600020015491505b506001600160a01b039092166000908152600f602090815260408083209483529381529083902083518085019094528054845260010154908301525090565b610ad68133611fbe565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16610c915760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556117f63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff1615610c915760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166119395760405162461bcd60e51b815260206004820152602d60248201527f4175746f5265666163746f72436f696e6167653a206d696e7420746f2074686560448201527f207a65726f2061646472657373000000000000000000000000000000000000006064820152608401610ac2565b6000611943611664565b9050600061194f6115ed565b9050600061195c856116db565b9050600061196982610937565b9050600061197684610937565b9050600061198c6119878885612b8f565b612033565b9050600061199d6119878985612b8f565b60408051808201825284815260208a8101805182840152835180850190945284845251908301529192506119d582828d600180612047565b8a6001600160a01b03167f452b30c947ea249a4a1a2c0410f1780e479e022d06691644108f38c3b3e17c4788848b85604051611a149493929190612ba2565b60405180910390a26040518a81526001600160a01b038c16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050505050505050505050565b6001600160a01b038216611ae75760405162461bcd60e51b815260206004820152602f60248201527f4175746f5265666163746f72436f696e6167653a206275726e2066726f6d207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152608401610ac2565b6000611af1611664565b90506000611afd6115ed565b90506000611b0a856116db565b90506000611b1783610937565b90506000611b2483610937565b9050858110158015611b365750858210155b611b825760405162461bcd60e51b815260206004820152601460248201527f696e73756666696369656e742062616c616e63650000000000000000000000006044820152606401610ac2565b6000611b916119878885612b66565b90506000611ba26119878985612b66565b60408051808201825284815260208a810180518284015283518085019094528484525190830152919250611bda81838d600180612047565b8a6001600160a01b03167f452b30c947ea249a4a1a2c0410f1780e479e022d06691644108f38c3b3e17c4788838b86604051611c199493929190612ba2565b60405180910390a26040518a81526000906001600160a01b038d16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611a56565b81516000908103611c725750600061094b565b82518251611c809190611f58565b8352602080840151908301511115611cc05782602001518260200151611ca69190612b66565b611cb19060026129fa565b8351611cbd9190612a06565b83525b50505190565b6040805180820190915260008082526020820152611ce2610a2a565b821115611d315760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6000611d3e600a846121b6565b6000908152600b602090815260409182902082518084019093528054835260010154908201529392505050565b6040805180820190915260008082526020820152611d87610a2a565b821115611dd65760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6000611de3600c846121b6565b6000908152600d602090815260409182902082518084019093528054835260010154908201529392505050565b6000611e1a610a2a565b90506000611e28600c612302565b905081811015611e6857600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018290555b506000908152600d6020908152604090912082518155910151600190910155565b6040805180820190915260008082526020820152611ea5610a2a565b831115611ef45760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6001600160a01b0382166000908152600e60205260408120611f1690856121b6565b6001600160a01b0384166000908152600f6020908152604080832093835292815290829020825180840190935280548352600101549082015291505092915050565b60006b033b2e3c9fd0803ce8000000611f718484612344565b611f7b9190612a36565b9392505050565b60006301ffc9a760e01b6001600160e01b03198316148061094b5750506001600160e01b03191660009081526004602052604090205460ff1690565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16610c9157611ff1816123b4565b611ffc8360206123c6565b60405160200161200d929190612be9565b60408051601f198184030181529082905262461bcd60e51b8252610ac2916004016126af565b600061094b82612041611664565b5161256f565b6000612051610a2a565b6001600160a01b0385166000908152600e602052604081209192509061207690612302565b90506000612084600a612302565b90508415612148576001600160a01b0386166120e25760405162461bcd60e51b815260206004820152600c60248201527f7a65726f206163636f756e7400000000000000000000000000000000000000006044820152606401610ac2565b82821015612116576001600160a01b0386166000908152600e60209081526040822080546001810182559083529120018390555b6001600160a01b0386166000908152600f60209081526040808320868452825290912089518155908901516001909101555b83156121ac578281101561218c57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8018390555b6000838152600b6020908152604090912088518155908801516001909101555b5050505050505050565b815460009081036121c95750600061094b565b825483906121d990600190612b66565b815481106121e9576121e9612b79565b9060005260206000200154821061222c578254839061220a90600190612b66565b8154811061221a5761221a612b79565b9060005260206000200154905061094b565b8260008154811061223f5761223f612b79565b90600052602060002001548210156122595750600061094b565b8254600090819061226c90600190612b66565b90505b818111156122db57600060026122858484612b8f565b612290906001612b8f565b61229a9190612a36565b9050848682815481106122af576122af612b79565b9060005260206000200154116122c7578092506122d5565b6122d2600182612b66565b91505b5061226f565b8482815481106122ed576122ed612b79565b90600052602060002001549250505092915050565b80546000901561233c578154829061231c90600190612b66565b8154811061232c5761232c612b79565b906000526020600020015461094b565b600092915050565b60008115806123685750828261235a8183612a06565b92506123669083612a36565b145b61094b5760405162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f770000000000000000000000006044820152606401610ac2565b606061094b6001600160a01b03831660145b606060006123d5836002612a06565b6123e0906002612b8f565b67ffffffffffffffff8111156123f8576123f8612588565b6040519080825280601f01601f191660200182016040528015612422576020820181803683370190505b509050600360fc1b8160008151811061243d5761243d612b79565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061246c5761246c612b79565b60200101906001600160f81b031916908160001a9053506000612490846002612a06565b61249b906001612b8f565b90505b6001811115612520577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124dc576124dc612b79565b1a60f81b8282815181106124f2576124f2612b79565b60200101906001600160f81b031916908160001a90535060049490941c9361251981612c6a565b905061249e565b508315611f7b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ac2565b600081611f71846b033b2e3c9fd0803ce8000000612344565b634e487b7160e01b600052604160045260246000fd5b6000604082840312156125b057600080fd5b6040516040810181811067ffffffffffffffff821117156125d3576125d3612588565b604052823581526020928301359281019290925250919050565b6000602082840312156125ff57600080fd5b81356001600160e01b031981168114611f7b57600080fd5b80356001600160a01b038116811461117657600080fd5b6000806040838503121561264157600080fd5b61264a83612617565b915061265860208401612617565b90509250929050565b6000806040838503121561267457600080fd5b61267d83612617565b946020939093013593505050565b60005b838110156126a657818101518382015260200161268e565b50506000910152565b60208152600082518060208401526126ce81604085016020870161268b565b601f01601f19169190910160400192915050565b825181526020808401518183015282516040830152820151606082015260808101611f7b565b60006020828403121561271a57600080fd5b611f7b82612617565b60006020828403121561273557600080fd5b5035919050565b6000806040838503121561274f57600080fd5b8235915061265860208401612617565b600082601f83011261277057600080fd5b813567ffffffffffffffff8082111561278b5761278b612588565b604051601f8301601f19908116603f011681019082821181831017156127b3576127b3612588565b816040528381528660208588010111156127cc57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561280257600080fd5b843567ffffffffffffffff8082111561281a57600080fd5b6128268883890161275f565b9550602087013591508082111561283c57600080fd5b506128498782880161275f565b9350506040850135915061285f60608601612617565b905092959194509250565b600181811c9082168061287e57607f821691505b60208210810361289e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156128b657600080fd5b5051919050565b60208082526023908201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f7420616e20616460408201526236b4b760e91b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561295157816000190482111561293757612937612900565b8085161561294457918102915b93841c939080029061291b565b509250929050565b6000826129685750600161094b565b816129755750600061094b565b816001811461298b5760028114612995576129b1565b600191505061094b565b60ff8411156129a6576129a6612900565b50506001821b61094b565b5060208310610133831016604e8410600b84101617156129d4575081810a61094b565b6129de8383612916565b80600019048211156129f2576129f2612900565b029392505050565b6000611f7b8383612959565b808202811582820484141761094b5761094b612900565b600060018201612a2f57612a2f612900565b5060010190565b600082612a5357634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610bb957600081815260208120601f850160051c81016020861015612a7f5750805b601f850160051c820191505b81811015612a9e57828155600101612a8b565b505050505050565b815167ffffffffffffffff811115612ac057612ac0612588565b612ad481612ace845461286a565b84612a58565b602080601f831160018114612b095760008415612af15750858301515b600019600386901b1c1916600185901b178555612a9e565b600085815260208120601f198616915b82811015612b3857888601518255948401946001909101908401612b19565b5085821015612b565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561094b5761094b612900565b634e487b7160e01b600052603260045260246000fd5b8082018082111561094b5761094b612900565b845181526020808601518183015284516040830152848101516060830152835160808301528381015160a0830152825160c083015282015160e08201526101008101610d59565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c2181601785016020880161268b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c5e81602884016020880161268b565b01602801949350505050565b600081612c7957612c79612900565b50600019019056fea164736f6c6343000813000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103ae5760003560e01c80636d70f7ae116101f4578063983b2d561161011a578063b911135f116100ad578063d547741f1161007c578063d547741f146108d7578063f2fde38b146108ea578063f5b541a6146108fd578063fad8b32a1461092457600080fd5b8063b911135f14610861578063bd3a13f61461088a578063cfbd48851461089d578063d5391393146108b057600080fd5b8063aa271e1a116100e9578063aa271e1a14610801578063ac8a584a14610814578063b7c246d714610827578063b7d78b1a1461083a57600080fd5b8063983b2d56146107cb57806398650275146107de5780639870d7fe146107e6578063a217fddf146107f957600080fd5b806379cc6790116101925780638f32d59b116101615780638f32d59b1461074057806391d148541461077757806395d89b41146107b0578063981b24d0146107b857600080fd5b806379cc6790146106fe578063817e9d3114610711578063837afbc0146107245780638639583f1461072d57600080fd5b806370a08231116101ce57806370a08231146106bd578063715018a6146106d057806375829def146106d85780637657f20a146106eb57600080fd5b80636d70f7ae146106845780636fb7f5581461069757806370480275146106aa57600080fd5b80633092afd5116102d957806354f703f811610277578063614db8b211610246578063614db8b21461063e57806363a8fd89146106515780636957f38b1461065e57806369f499b11461067157600080fd5b806354f703f8146105d9578063550d01a3146105e157806356fabf68146106045780635deaecec1461061757600080fd5b806340c10f19116102b357806340c10f191461055f57806342966c68146105725780634ee2cd7e1461058557806350d2a2761461059857600080fd5b80633092afd51461052a578063313ce5671461053d57806336568abe1461054c57600080fd5b80631397704211610351578063248a9ca311610320578063248a9ca3146104d957806324d7806c146104fc5780632ab6f8db1461050f5780632f2ff15d1461051757600080fd5b806313977042146104a15780631785f53c146104a957806318160ddd146104be57806319d5dce9146104c657600080fd5b8063024c2ddd1161038d578063024c2ddd146104045780630461fdc51461042f57806306fdde031461047657806308eef06d1461048b57600080fd5b8062d87a9c146103b357806301f6a80a146103ce57806301ffc9a7146103e1575b600080fd5b6103bb600281565b6040519081526020015b60405180910390f35b6103bb6103dc36600461259e565b610937565b6103f46103ef3660046125ed565b610951565b60405190151581526020016103c5565b6103bb61041236600461262e565b600960209081526000928352604080842090915290825290205481565b61046161043d366004612661565b600f6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016103c5565b61047e61095c565b6040516103c591906126af565b6104936109ea565b6040516103c59291906126e2565b6103bb610a2a565b6104bc6104b7366004612708565b610a9d565b005b6103bb610ad9565b6104936104d4366004612708565b610ae6565b6103bb6104e7366004612723565b60009081526005602052604090206001015490565b6103f461050a366004612708565b610b28565b6104bc610b68565b6104bc61052536600461273c565b610b94565b6104bc610538366004612708565b610bbe565b604051601b81526020016103c5565b6104bc61055a36600461273c565b610c09565b6103f461056d366004612661565b610c95565b6104bc610580366004612723565b610d32565b6103bb610593366004612661565b610d3c565b6105c16105a63660046125ed565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016103c5565b6103bb610d62565b6103f46105ef366004612708565b60026020526000908152604090205460ff1681565b6103bb610612366004612723565b610d92565b610461610625366004612723565b600d602052600090815260409020805460019091015482565b6103bb61064c366004612723565b610db3565b6000546103f49060ff1681565b61049361066c366004612723565b610dc3565b6103bb61067f366004612661565b610dfd565b6103f4610692366004612708565b610e2e565b6006546105c1906001600160a01b031681565b6104bc6106b8366004612708565b610e6e565b6103bb6106cb366004612708565b610e9e565b6104bc610eac565b6104bc6106e6366004612708565b610edc565b6104bc6106f9366004612708565b610fc5565b6104bc61070c366004612661565b611019565b6103f461071f366004612723565b6110ad565b6103bb60105481565b61049361073b366004612661565b61117b565b3360009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc602052604090205460ff166103f4565b6103f461078536600461273c565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61047e6111c1565b6103bb6107c6366004612723565b6111ce565b6104bc6107d9366004612708565b6111f2565b6104bc611241565b6104bc6107f4366004612708565b61126b565b6103bb600081565b6103f461080f366004612708565b6112ba565b6104bc610822366004612708565b6112fa565b6103bb6b204fce5e3e2502611000000081565b610461610848366004612723565b600b602052600090815260409020805460019091015482565b6105c161086f366004612723565b6001602052600090815260409020546001600160a01b031681565b6104bc6108983660046127ec565b611349565b6104bc6108ab366004612708565b611471565b6103bb7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6104bc6108e536600461273c565b6114bc565b6104bc6108f8366004612708565b6114e1565b6103bb7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b6104bc610932366004612708565b61150f565b600061094b8260000151836020015161155e565b92915050565b600061094b826115c8565b600780546109699061286a565b80601f01602080910402602001604051908101604052809291908181526020018280546109959061286a565b80156109e25780601f106109b7576101008083540402835291602001916109e2565b820191906000526020600020905b8154815290600101906020018083116109c557829003601f168201915b505050505081565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610a1a6115ed565b610a22611664565b915091509091565b600654604080516309cbb82160e11b815290516000926001600160a01b03169163139770429160048083019260209291908290030181865afa158015610a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9891906128a4565b905090565b610aa633610b28565b610acb5760405162461bcd60e51b8152600401610ac2906128bd565b60405180910390fd5b610ad6600082610c09565b50565b6000610a986103dc6115ed565b60408051808201909152600080825260208201526040805180820190915260008082526020820152610b17836116db565b610b1f611664565b91509150915091565b6001600160a01b03811660009081527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc602052604081205460ff1661094b565b610b927f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c33610c09565b565b600082815260056020526040902060010154610baf8161178e565b610bb98383611798565b505050565b610bc733610b28565b610be35760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9825b6001600160a01b0381163314610c875760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610ac2565b610c91828261183a565b5050565b3360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604081205460ff16610d1f5760405162461bcd60e51b815260206004820152602360248201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f742061206d696e6044820152623a32b960e91b6064820152608401610ac2565b610d2983836118bd565b50600192915050565b610ad63382611a6b565b6000806000610d4b858561117b565b91509150610d598282611c5f565b95945050505050565b600080610d6d611664565b905080602001516002610d8091906129fa565b8151610d8c9190612a06565b91505090565b600c8181548110610da257600080fd5b600091825260209091200154905081565b600a8181548110610da257600080fd5b60408051808201909152600080825260208201526040805180820190915260008082526020820152610df483611cc6565b610b1f84611d6b565b600e6020528160005260406000208181548110610e1957600080fd5b90600052602060002001600091509150505481565b6001600160a01b03811660009081527f02634a7c777b8129955fe1824eee49ef19dfa96f2f4cb63212492c3d84eb58e6602052604081205460ff1661094b565b610e7733610b28565b610e935760405162461bcd60e51b8152600401610ac2906128bd565b610ad6600082610b94565b600061094b6103dc836116db565b610eb533610b28565b610ed15760405162461bcd60e51b8152600401610ac2906128bd565b610b92600033610c09565b610ee533610b28565b610f015760405162461bcd60e51b8152600401610ac2906128bd565b6001600160a01b038116610f575760405162461bcd60e51b815260206004820152601860248201527f41636365737369626c653a207a65726f206164647265737300000000000000006044820152606401610ac2565b6001600160a01b0381163303610faf5760405162461bcd60e51b815260206004820152601660248201527f41636365737369626c653a2073616d652061646d696e000000000000000000006044820152606401610ac2565b610fba600082610b94565b610ad6600033610c09565b610fce33610b28565b610fea5760405162461bcd60e51b8152600401610ac2906128bd565b6006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b3360009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604090205460ff166110a35760405162461bcd60e51b815260206004820152602360248201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f742061206d696e6044820152623a32b960e91b6064820152608401610ac2565b610c918282611a6b565b60006110b833610b28565b6110d45760405162461bcd60e51b8152600401610ac2906128bd565b60006110de611664565b90506000835b6b204fce5e3e250261100000008110611117578161110181612a1d565b92506111109050600282612a36565b90506110e4565b604080518082019091528181526020810183905261113481611e10565b7f29ca2230155ed7b305631c2160bcce185fe471567c0e99ae17de3b6a909a838d84826040516111659291906126e2565b60405180910390a160019450505050505b919050565b604080518082019091526000808252602082015260408051808201909152600080825260208201526111ad8385611e89565b6111b684611d6b565b915091509250929050565b600880546109699061286a565b60008060006111dc84610dc3565b915091506111ea8282611c5f565b949350505050565b6111fb33610b28565b6112175760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc982610b94565b610b927ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933610c09565b61127433610b28565b6112905760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82610b94565b6001600160a01b03811660009081527fca0a2f641ec05ca23127d994cf03ffc453db616acae0b86cb56bb95304d06854602052604081205460ff1661094b565b61130333610b28565b61131f5760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82610c09565b60008052600d6020527f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee54156113c15760405162461bcd60e51b815260206004820152601360248201527f616c726561647920696e697469616c697a6564000000000000000000000000006044820152606401610ac2565b60076113cd8582612aa6565b5060086113da8482612aa6565b506040805180820190915291825260006020808401828152918052600d905291517f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee5590517f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ef556006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555050565b61147a33610b28565b6114965760405162461bcd60e51b8152600401610ac2906128bd565b610ad67ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9825b6000828152600560205260409020600101546114d78161178e565b610bb9838361183a565b6114ea33610b28565b6115065760405162461bcd60e51b8152600401610ac2906128bd565b610ad681610edc565b61151833610b28565b6115345760405162461bcd60e51b8152600401610ac2906128bd565b610ad67f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c826114bc565b6000826000036115705750600061094b565b600061157a611664565b905061158a848260000151611f58565b935082816020015111156115c0578281602001516115a89190612b66565b6115b39060026129fa565b6115bd9085612a06565b93505b509192915050565b60006001600160e01b03198216637965db0b60e01b148061094b575061094b82611f82565b6040805180820190915260008082526020820152600a54600090801561163857600a61161a600183612b66565b8154811061162a5761162a612b79565b906000526020600020015491505b506000908152600b60209081526040918290208251808401909352805483526001015490820152919050565b6040805180820190915260008082526020820152600c5460009080156116af57600c611691600183612b66565b815481106116a1576116a1612b79565b906000526020600020015491505b506000908152600d60209081526040918290208251808401909352805483526001015490820152919050565b60408051808201909152600080825260208201526001600160a01b0382166000908152600e6020526040812054801561174f576001600160a01b0384166000908152600e60205260409020611731600183612b66565b8154811061174157611741612b79565b906000526020600020015491505b506001600160a01b039092166000908152600f602090815260408083209483529381529083902083518085019094528054845260010154908301525090565b610ad68133611fbe565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16610c915760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556117f63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff1615610c915760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166119395760405162461bcd60e51b815260206004820152602d60248201527f4175746f5265666163746f72436f696e6167653a206d696e7420746f2074686560448201527f207a65726f2061646472657373000000000000000000000000000000000000006064820152608401610ac2565b6000611943611664565b9050600061194f6115ed565b9050600061195c856116db565b9050600061196982610937565b9050600061197684610937565b9050600061198c6119878885612b8f565b612033565b9050600061199d6119878985612b8f565b60408051808201825284815260208a8101805182840152835180850190945284845251908301529192506119d582828d600180612047565b8a6001600160a01b03167f452b30c947ea249a4a1a2c0410f1780e479e022d06691644108f38c3b3e17c4788848b85604051611a149493929190612ba2565b60405180910390a26040518a81526001600160a01b038c16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050505050505050505050565b6001600160a01b038216611ae75760405162461bcd60e51b815260206004820152602f60248201527f4175746f5265666163746f72436f696e6167653a206275726e2066726f6d207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152608401610ac2565b6000611af1611664565b90506000611afd6115ed565b90506000611b0a856116db565b90506000611b1783610937565b90506000611b2483610937565b9050858110158015611b365750858210155b611b825760405162461bcd60e51b815260206004820152601460248201527f696e73756666696369656e742062616c616e63650000000000000000000000006044820152606401610ac2565b6000611b916119878885612b66565b90506000611ba26119878985612b66565b60408051808201825284815260208a810180518284015283518085019094528484525190830152919250611bda81838d600180612047565b8a6001600160a01b03167f452b30c947ea249a4a1a2c0410f1780e479e022d06691644108f38c3b3e17c4788838b86604051611c199493929190612ba2565b60405180910390a26040518a81526000906001600160a01b038d16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611a56565b81516000908103611c725750600061094b565b82518251611c809190611f58565b8352602080840151908301511115611cc05782602001518260200151611ca69190612b66565b611cb19060026129fa565b8351611cbd9190612a06565b83525b50505190565b6040805180820190915260008082526020820152611ce2610a2a565b821115611d315760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6000611d3e600a846121b6565b6000908152600b602090815260409182902082518084019093528054835260010154908201529392505050565b6040805180820190915260008082526020820152611d87610a2a565b821115611dd65760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6000611de3600c846121b6565b6000908152600d602090815260409182902082518084019093528054835260010154908201529392505050565b6000611e1a610a2a565b90506000611e28600c612302565b905081811015611e6857600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018290555b506000908152600d6020908152604090912082518155910151600190910155565b6040805180820190915260008082526020820152611ea5610a2a565b831115611ef45760405162461bcd60e51b815260206004820152601f60248201527f736e617073686f744964203e2070726f6772657373536e617073686f744964006044820152606401610ac2565b6001600160a01b0382166000908152600e60205260408120611f1690856121b6565b6001600160a01b0384166000908152600f6020908152604080832093835292815290829020825180840190935280548352600101549082015291505092915050565b60006b033b2e3c9fd0803ce8000000611f718484612344565b611f7b9190612a36565b9392505050565b60006301ffc9a760e01b6001600160e01b03198316148061094b5750506001600160e01b03191660009081526004602052604090205460ff1690565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16610c9157611ff1816123b4565b611ffc8360206123c6565b60405160200161200d929190612be9565b60408051601f198184030181529082905262461bcd60e51b8252610ac2916004016126af565b600061094b82612041611664565b5161256f565b6000612051610a2a565b6001600160a01b0385166000908152600e602052604081209192509061207690612302565b90506000612084600a612302565b90508415612148576001600160a01b0386166120e25760405162461bcd60e51b815260206004820152600c60248201527f7a65726f206163636f756e7400000000000000000000000000000000000000006044820152606401610ac2565b82821015612116576001600160a01b0386166000908152600e60209081526040822080546001810182559083529120018390555b6001600160a01b0386166000908152600f60209081526040808320868452825290912089518155908901516001909101555b83156121ac578281101561218c57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8018390555b6000838152600b6020908152604090912088518155908801516001909101555b5050505050505050565b815460009081036121c95750600061094b565b825483906121d990600190612b66565b815481106121e9576121e9612b79565b9060005260206000200154821061222c578254839061220a90600190612b66565b8154811061221a5761221a612b79565b9060005260206000200154905061094b565b8260008154811061223f5761223f612b79565b90600052602060002001548210156122595750600061094b565b8254600090819061226c90600190612b66565b90505b818111156122db57600060026122858484612b8f565b612290906001612b8f565b61229a9190612a36565b9050848682815481106122af576122af612b79565b9060005260206000200154116122c7578092506122d5565b6122d2600182612b66565b91505b5061226f565b8482815481106122ed576122ed612b79565b90600052602060002001549250505092915050565b80546000901561233c578154829061231c90600190612b66565b8154811061232c5761232c612b79565b906000526020600020015461094b565b600092915050565b60008115806123685750828261235a8183612a06565b92506123669083612a36565b145b61094b5760405162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f770000000000000000000000006044820152606401610ac2565b606061094b6001600160a01b03831660145b606060006123d5836002612a06565b6123e0906002612b8f565b67ffffffffffffffff8111156123f8576123f8612588565b6040519080825280601f01601f191660200182016040528015612422576020820181803683370190505b509050600360fc1b8160008151811061243d5761243d612b79565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061246c5761246c612b79565b60200101906001600160f81b031916908160001a9053506000612490846002612a06565b61249b906001612b8f565b90505b6001811115612520577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124dc576124dc612b79565b1a60f81b8282815181106124f2576124f2612b79565b60200101906001600160f81b031916908160001a90535060049490941c9361251981612c6a565b905061249e565b508315611f7b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ac2565b600081611f71846b033b2e3c9fd0803ce8000000612344565b634e487b7160e01b600052604160045260246000fd5b6000604082840312156125b057600080fd5b6040516040810181811067ffffffffffffffff821117156125d3576125d3612588565b604052823581526020928301359281019290925250919050565b6000602082840312156125ff57600080fd5b81356001600160e01b031981168114611f7b57600080fd5b80356001600160a01b038116811461117657600080fd5b6000806040838503121561264157600080fd5b61264a83612617565b915061265860208401612617565b90509250929050565b6000806040838503121561267457600080fd5b61267d83612617565b946020939093013593505050565b60005b838110156126a657818101518382015260200161268e565b50506000910152565b60208152600082518060208401526126ce81604085016020870161268b565b601f01601f19169190910160400192915050565b825181526020808401518183015282516040830152820151606082015260808101611f7b565b60006020828403121561271a57600080fd5b611f7b82612617565b60006020828403121561273557600080fd5b5035919050565b6000806040838503121561274f57600080fd5b8235915061265860208401612617565b600082601f83011261277057600080fd5b813567ffffffffffffffff8082111561278b5761278b612588565b604051601f8301601f19908116603f011681019082821181831017156127b3576127b3612588565b816040528381528660208588010111156127cc57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561280257600080fd5b843567ffffffffffffffff8082111561281a57600080fd5b6128268883890161275f565b9550602087013591508082111561283c57600080fd5b506128498782880161275f565b9350506040850135915061285f60608601612617565b905092959194509250565b600181811c9082168061287e57607f821691505b60208210810361289e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156128b657600080fd5b5051919050565b60208082526023908201527f41757468436f6e74726f6c3a2043616c6c6572206973206e6f7420616e20616460408201526236b4b760e91b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561295157816000190482111561293757612937612900565b8085161561294457918102915b93841c939080029061291b565b509250929050565b6000826129685750600161094b565b816129755750600061094b565b816001811461298b5760028114612995576129b1565b600191505061094b565b60ff8411156129a6576129a6612900565b50506001821b61094b565b5060208310610133831016604e8410600b84101617156129d4575081810a61094b565b6129de8383612916565b80600019048211156129f2576129f2612900565b029392505050565b6000611f7b8383612959565b808202811582820484141761094b5761094b612900565b600060018201612a2f57612a2f612900565b5060010190565b600082612a5357634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610bb957600081815260208120601f850160051c81016020861015612a7f5750805b601f850160051c820191505b81811015612a9e57828155600101612a8b565b505050505050565b815167ffffffffffffffff811115612ac057612ac0612588565b612ad481612ace845461286a565b84612a58565b602080601f831160018114612b095760008415612af15750858301515b600019600386901b1c1916600185901b178555612a9e565b600085815260208120601f198616915b82811015612b3857888601518255948401946001909101908401612b19565b5085821015612b565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561094b5761094b612900565b634e487b7160e01b600052603260045260246000fd5b8082018082111561094b5761094b612900565b845181526020808601518183015284516040830152848101516060830152835160808301528381015160a0830152825160c083015282015160e08201526101008101610d59565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c2181601785016020880161268b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612c5e81602884016020880161268b565b01602801949350505050565b600081612c7957612c79612900565b50600019019056fea164736f6c6343000813000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.