S Price: $0.855969 (+0.65%)

Token

21.02 (21.02)

Overview

Max Total Supply

21,000,000 21.02

Holders

2

Market

Price

$0.00 @ 0.000000 S

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
10,500,000 21.02

Value
$0.00
0x85ffa7860dba54466ad4559b7b8fa7f6252e9f2d
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
UTSTokenPure

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1 runs

Other Settings:
paris EvmVersion
File 1 of 20 : UTSTokenPure.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "@openzeppelin/[email protected]/access/AccessControl.sol";

import "./ERC20Modified.sol";
import "../extensions/UTSBaseIndexed.sol";

/**
 * @notice An ERC20 compliant token contract with integrated functionality to use UTS protocol V1 crosschain messaging
 * for bridging this token itself.    
 *
 * @dev A lock/unlock mechanism is used to send and receive {UTSTokenPure} tokens crosschain bridges. 
 * A UTSTokenPure contract stores and releases {UTSTokenPure} tokens itself.
 * This token has a fixed total supply, {UTSTokenPure} tokens cannot be minted or burned once the contract is initialized.
 */
contract UTSTokenPure is UTSBaseIndexed, ERC20Modified, AccessControl {
    using AddressConverter for bytes;

    /**
     * @notice Initializes basic settings with provided parameters.
     *
     * @param params {DeployTokenData} struct containing {UTSTokenPure} initialization parameters: 
     *        owner: the address of the initial {AccessControl.DEFAULT_ADMIN_ROLE}
     *        name: the {ERC20.name} of the {UTSTokenPure} token
     *        symbol: the {ERC20.symbol} of the {UTSTokenPure} token
     *        decimals: the {ERC20.decimals} of the {UTSTokenPure} token
     *        initialSupply: total initial {UTSTokenPure} supply to mint
     *        mintedAmountToOwner: initial {UTSTokenPure} supply to mint to {owner} balance
     *        pureToken: flag indicating whether the {UTSToken} is use lock/unlock or mint/burn mechanism for bridging
     *        mintable: flag indicating whether {owner} can mint an unlimited amount of {UTSTokenPure} tokens
     *        globalBurnable: flag indicating whether the {UTSTokenPure} is globally burnable by anyone
     *        onlyRoleBurnable: flag indicating whether only addresses with the {AccessControl.BURNER_ROLE} can burn tokens
     *        feeModule: flag indicating whether the {UTSTokenPure} is supports the fee deducting for bridging
     *        router: the address of the authorized {UTSRouter}
     *        allowedChainIds: chains Ids available for bridging in both directions
     *        chainConfigs: {ChainConfig} settings for provided {allowedChainIds}
     *        salt: value used for precalculation of {UTSTokenPure} contract address
     *
     * @dev {pureToken}, {mintable}, {globalBurnable}, {onlyRoleBurnable}, {feeModule}, and {salt} parameters DO NOT 
     * impact on the executable code here and {UTSTokenPure} settings in this function. 
     * It defines the creation bytecode before deployment and initialization.
     *
     * The difference in the amount between the {initialSupply} and the {mintedAmountToOwner} is minted to the 
     * balance of the {UTSTokenPure} contract itself, to provide liquidity for receiving bridges from other chains.
     *
     * Can and MUST be called only once. Reinitialization is prevented by {UTSBase.__UTSBase_init} function.
     */
    function initializeToken(DeployTokenData calldata params) external { 
        __ERC20_init(params.name, params.symbol);
        __UTSBase_init(address(this), params.decimals);

        _setRouter(params.router.toAddress());
        _setChainConfig(params.allowedChainIds, params.chainConfigs);

        if (params.initialSupply > 0) {
            _update(address(0), params.owner.toAddress(), params.mintedAmountToOwner);
            _update(address(0), address(this), params.initialSupply - params.mintedAmountToOwner);
        }

        _grantRole(DEFAULT_ADMIN_ROLE, params.owner.toAddress());
    }

    /**
     * @notice Returns decimals value of the {UTSTokenPure}.
     * @return {_decimals} of the {UTSTokenPure}.
     */
    function decimals() public view override returns(uint8) {
        return _decimals;
    }

    /**
     * @notice 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
     * to learn more about how these ids are created.
     */
    function supportsInterface(bytes4 interfaceId) public view override(UTSBase, AccessControl) returns(bool) {
        return interfaceId == type(IERC20).interfaceId || super.supportsInterface(interfaceId);
    }

    function _burnFrom(
        address spender,
        address from, 
        bytes memory /* to */, 
        uint256 amount, 
        uint256 /* dstChainId */, 
        bytes memory /* customPayload */
    ) internal override returns(uint256) {
        if (from != spender) _spendAllowance(from, spender, amount);

        _transfer(from, address(this), amount);

        return amount;
    }

    function _mintTo(
        address to,
        uint256 amount,
        bytes memory /* customPayload */,
        Origin memory /* origin */
    ) internal override returns(uint256) {
        if (to != address(this)) _transfer(address(this), to, amount);
        
        return amount;
    }

    function _authorizeCall() internal virtual override onlyRole(DEFAULT_ADMIN_ROLE) {
        
    }

}

File 2 of 20 : UTSBaseIndexed.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "./UTSBaseExtended.sol";

interface IUTSFactory {

    function REGISTRY() external view returns(address);

}

interface IUTSRegistry {

    function updateChainConfigs(uint256[] calldata allowedChainIds, ChainConfig[] calldata chainConfigs) external;

    function updateRouter(address newRouter) external;

}

/**
 * @notice Extension of {UTSBase} that adds an external calls to emit events in the {UTSRegistry} to log crucial data
 * off-chain.
 *
 * @dev Сan only be used by contracts deployed by {UTSFactory} or contracts manually registered in the {UTSRegistry}.
 */
abstract contract UTSBaseIndexed is UTSBaseExtended {

    /// @notice The {UTSRegistry} contract address.
    address private immutable REGISTRY;

    /// @notice Initializes immutable {REGISTRY} variable.
    constructor() {
        REGISTRY = IUTSFactory(msg.sender).REGISTRY();
    }

    function _setChainConfig(uint256[] memory allowedChainIds, ChainConfig[] memory chainConfigs) internal virtual override {

        IUTSRegistry(REGISTRY).updateChainConfigs(allowedChainIds, chainConfigs);

        super._setChainConfig(allowedChainIds, chainConfigs);
    }

    function _setRouter(address newRouter) internal virtual override {

        IUTSRegistry(REGISTRY).updateRouter(newRouter);

        super._setRouter(newRouter);
    }

}

File 3 of 20 : ERC20Modified.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

// ERC20 Modified contract
// {constructor} replaced by {__ERC20_init} function

pragma solidity ^0.8.20;

import "@openzeppelin/[email protected]/token/ERC20/IERC20.sol";
import "@openzeppelin/[email protected]/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/[email protected]/utils/Context.sol";
import "@openzeppelin/[email protected]/interfaces/draft-IERC6093.sol";

/**
 * @dev Primary imports
 *
 * import {IERC20} from "./IERC20.sol";
 * import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
 * import {Context} from "../../utils/Context.sol";
 * import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
 *
 */

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20Modified is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * initialization.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 4 of 20 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../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 account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    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 returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @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 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 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 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 `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

File 5 of 20 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 6 of 20 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 7 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 8 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 9 of 20 : UTSBaseExtended.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../UTSBase.sol";

import "../interfaces/IUTSBaseExtended.sol";

/**
 * @notice Extension of {UTSBase} that allows {UTSBase} contract owner to change {ChainConfig} settings on different 
 * destination chains with a single crosschain transaction.
 */
abstract contract UTSBaseExtended is IUTSBaseExtended, UTSBase {
    using AddressConverter for address;
    using BytesLib for bytes;

    /**
     * @notice Send crosschain message that will change destination {ChainConfig}.
     * @param dstChainIds destination chains Ids to which a message will be sent to change their {ChainConfig}.
     * @param newConfigs new {ChainConfig} settings for provided {allowedChainIds} to be setted on the destination chains.
     * @return success call result.
     */
    function setChainConfigToDestination(
        uint256[] calldata dstChainIds,
        ChainConfigUpdate[] calldata newConfigs
    ) external payable returns(bool success) {
        _authorizeCall();

        if (dstChainIds.length != newConfigs.length) revert UTSBase__E4();

        bytes[] memory _dstPeers = new bytes[](dstChainIds.length);

        for (uint256 i; dstChainIds.length > i; ++i) _dstPeers[i] = _chainConfig[dstChainIds[i]].peerAddress;

        return IUTSRouter(router()).requestToUpdateConfig{value: msg.value}( 
            msg.sender.toBytes(),
            dstChainIds,
            _dstPeers,
            newConfigs
        );
    }

    /**
     * @notice Sets the destination chains settings by crosschain message.
     * @param allowedChainIds chains Ids available for bridging in both directions.
     * @param chainConfigs array of new {ChainConfig} settings for provided {allowedChainIds}.
     * @param origin source chain data.
     * @dev Only the {_router} can execute this function.
     */
    function setChainConfigByRouter(
        uint256[] calldata allowedChainIds,
        ChainConfig[] calldata chainConfigs,
        Origin calldata origin
    ) external {
        _onlyRouter();

        if (!_chainConfig[origin.chainId].peerAddress.equalStorage(origin.peerAddress)) revert UTSBase__E7();

        _setChainConfig(allowedChainIds, chainConfigs);
    }

    /**
     * @notice Returns estimated minimal amount to pay for {setChainConfigToDestination} call.
     * @param dstChainIds destination chains Ids to which a message will be sent.
     * @param configsLength {ChainConfigUpdate.allowedChainIds} length.
     * @return paymentAmount source chain native currency amount to pay for {setChainConfigToDestination} call.
     */
    function estimateUpdateFee(
        uint256[] calldata dstChainIds, 
        uint256[] calldata configsLength
    ) external view returns(uint256 paymentAmount) {
        return IUTSRouter(router()).getUpdateFee(dstChainIds, configsLength);
    }

}

File 10 of 20 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 11 of 20 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @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.
     */
    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 `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

File 12 of 20 : IUTSBaseExtended.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "./IUTSBase.sol";

interface IUTSBaseExtended {

    function setChainConfigToDestination(
        uint256[] calldata dstChainIds,
        ChainConfigUpdate[] calldata newConfigs
    ) external payable returns(bool success);

    function setChainConfigByRouter(
        uint256[] calldata allowedChainIds,
        ChainConfig[] calldata chainConfigs,
        Origin calldata origin
    ) external;

    function estimateUpdateFee(
        uint256[] calldata dstChainIds, 
        uint256[] calldata configsLength
    ) external view returns(uint256 paymentAmount);

}

File 13 of 20 : UTSBase.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
 
import "@openzeppelin/[email protected]/utils/introspection/ERC165.sol";

import "../libraries/BytesLib.sol";
import "../libraries/AddressConverter.sol";
import "../libraries/DecimalsConverter.sol"; 
import "../libraries/UTSERC20DataTypes.sol";

import "./interfaces/IUTSBase.sol";
import "./interfaces/IUTSRouter.sol";

/**
 * @notice Abstract contract implementing minimal and basic functionality for sending and receiving crosschain bridges 
 * of ERC20 tokens via UTS protocol V1. 
 *
 * @dev 
 * The {__UTSBase_init} function MUST be called before using other functions of the {UTSBase} contract.
 * The {_authorizeCall} function MUST be overridden to include access restriction to the {setRouter} and 
 * {setChainConfig} functions.
 * The {_mintTo} function MUST be overridden to implement {mint}/{transfer} underlying tokens to receiver {to} address 
 * by {_router}.
 * The {_burnFrom} function MUST be overridden to implement {burn}/{transferFrom} underlying tokens from {spender}/{from}
 * address for bridging.
 */
abstract contract UTSBase is IUTSBase, ERC165 {
    using AddressConverter for address;
    using DecimalsConverter for uint256;
    using BytesLib for bytes;

    /// @notice Nonce used for {storeFailedExecution} executions to guarantee uniqueness.
    uint256 private _retryNonce;

    /**
     * @notice Address that can execute {redeem} and {storeFailedExecution} functions.
     * @dev Should be an authorized {UTSRouter} contract address or a zero address in case of disconnection from UTS protocol.
     */
    address private _router;

    /// @notice Address of the underlying ERC20 token.
    address internal _underlyingToken;

    /// @notice Decimals of the underlying ERC20 token.
    uint8 internal _decimals;

    /// @notice {ChainConfig} settings for the corresponding destination chain Id.
    /// @dev See the {UTSERC20DataTypes.ChainConfig} for details.
    mapping(uint256 chainId => ChainConfig dstChainConfig) internal _chainConfig;

    /**
     * @notice Receiver address for the corresponding {redeem} message hash.
     * @dev Mapping is filled only by {storeFailedExecution} function if the {redeem} call is unsuccessful.
     * IMPORTANT: Execution of the {_redeem} function with a {to} zero address MUST be forbidden.
     */
    mapping(bytes32 msgHash => address receiverAddress) private _failedExecution;

    /// @notice Indicates an error that the {UTSBase} contract initialized already.
    error UTSBase__E0();

    /// @notice Indicates an error that the function caller is not the {_router}.
    error UTSBase__E1();

    /// @notice Indicates an error that the {to} is zero address.
    error UTSBase__E2();

    /// @notice Indicates an error that the {amount} to bridge is zero.
    error UTSBase__E3();

    /// @notice Indicates an error that lengths of {allowedChainIds} and {chainConfigs} do not match in the {_setChainConfig} function.
    error UTSBase__E4();

    /// @notice Indicates an error that the destination {peerAddress} is paused for sending and receiving crosschain messages.
    error UTSBase__E5();

    /// @notice Indicates an error that the provided {dstGasLimit} is less than the minimum required amount.
    error UTSBase__E6();

    /// @notice Indicates an error that the source {Origin.peerAddress} is unauthorized in the {ChainConfig} for corresponding {Origin.chainId}.
    error UTSBase__E7();

    /**
     * @notice Emitted when the {_router} address is updated.
     * @param caller the caller address who set the new {_router} address.
     * @param newRouter the address of the new {_router}.
     */
    event RouterSet(address indexed caller, address newRouter);

    /**
     * @notice Emitted when {ChainConfig} settings are updated.
     * @param caller the caller address who set the new destination {ChainConfig} settings.
     * @param allowedChainIds new chains Ids available for bridging in both directions.
     * @param chainConfigs array of new {ChainConfig} settings for corresponding {allowedChainIds}.
     */
    event ChainConfigUpdated(address indexed caller, uint256[] allowedChainIds, ChainConfig[] chainConfigs);

    /**
     * @notice Emitted when tokens are successfully redeemed from the source chain.
     * @param to tokens receiver on the current chain.
     * @param amount received amount.
     * @param srcPeerAddressIndexed indexed source {peerAddress}.
     * @param srcPeerAddress source {peerAddress}.
     * @param srcChainId source chain Id.
     * @param sender source chain sender's address.
     */
    event Redeemed(
        address indexed to, 
        uint256 amount, 
        bytes indexed srcPeerAddressIndexed, 
        bytes srcPeerAddress,
        uint256 indexed srcChainId,
        bytes sender
    );

    /**
     * @notice Emitted when crosschain bridge message is successfully sent to a destination chain.
     * @param spender the caller address who initiate the bridge.
     * @param from tokens holder on the current chain.
     * @param dstPeerAddressIndexed indexed destination {peerAddress}.
     * @param dstPeerAddress destination {peerAddress}.
     * @param to bridged tokens receiver on the destination chain.
     * @param amount bridged tokens amount.
     * @param dstChainId destination chain Id.
     */
    event Bridged(
        address indexed spender, 
        address from, 
        bytes indexed dstPeerAddressIndexed, 
        bytes dstPeerAddress,
        bytes to, 
        uint256 amount,
        uint256 indexed dstChainId
    );

    /**
     * @notice Emitted when a {storeFailedExecution} executed in case of failed {redeem} call.
     * @param to tokens receiver on the current chain.
     * @param amount amount to receive.
     * @param customPayload user's additional data.
     * @param originIndexed indexed source chain data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @param result handled error message.
     * @param nonce unique failed execution's counter.
     */
    event ExecutionFailed(
        address indexed to, 
        uint256 amount, 
        bytes customPayload, 
        Origin indexed originIndexed, 
        Origin origin,
        bytes indexed result, 
        uint256 nonce
    );

    /**
     * @notice Initializes basic settings.
     * @param underlyingToken_ underlying ERC20 token address.
     * @dev In case this contract and ERC20 are the same contract, {underlyingToken_} should be address(this).
     *
     * @param decimals_ underlying token decimals.
     * @dev Can and MUST be called only once.
     */
    function __UTSBase_init(address underlyingToken_, uint8 decimals_) internal {
        if (_retryNonce > 0) revert UTSBase__E0();

        _underlyingToken = underlyingToken_;
        _decimals = decimals_;
        // {_retryNonce} counter increases here for two reasons: 
        // 1. to block repeated {__UTSBase_init} call
        // 2. initialize the {_retryNonce} variable to unify the gas limit calculation of the {storeFailedExecution} call
        _retryNonce = 1;
    }

    /**
     * @notice Initiates the tokens bridging.
     * @param from tokens holder on the current chain.
     * @param to bridged tokens receiver on the destination chain.
     * @param amount tokens amount to bridge to the destination chain.
     * @param dstChainId destination chain Id.
     * @param dstGasLimit {redeem} call gas limit on the destination chain.
     * @param customPayload user's additional data.
     * @param protocolPayload UTS protocol's additional data.
     * @return success call result.
     * @return bridgedAmount bridged tokens amount.
     */
    function bridge(
        address from,
        bytes calldata to, 
        uint256 amount, 
        uint256 dstChainId,
        uint64 dstGasLimit,
        bytes calldata customPayload,
        bytes calldata protocolPayload
    ) external payable virtual returns(bool success, uint256 bridgedAmount) {

        return _bridge(
            msg.sender, 
            from, 
            to, 
            amount, 
            dstChainId, 
            dstGasLimit, 
            customPayload, 
            protocolPayload
        );
    }

    /**
     * @notice Executes the tokens delivery from the source chain.
     * @param to tokens receiver on the current chain.
     * @param amount amount to receive.
     * @param customPayload user's additional data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @return success call result.
     * @dev Only the {_router} can execute this function.
     */
    function redeem(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin
    ) external payable virtual returns(bool success) {
        _onlyRouter();

        return _redeem(to, amount, customPayload, origin);
    }

    /**
     * @notice Stores failed execution's data.
     * @param to tokens receiver on the current chain.
     * @param amount tokens amount to receive.
     * @param customPayload user's additional data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @param result handled error message.
     * @dev Only the {_router} can execute this function.
     */
    function storeFailedExecution(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin,
        bytes calldata result
    ) external virtual {
        _onlyRouter();

        _failedExecution[keccak256(abi.encode(to, amount, customPayload, origin, _retryNonce))] = to;

        emit ExecutionFailed(to, amount, customPayload, origin, origin, result, _retryNonce);

        _retryNonce++;
    }

    /**
     * @notice Executes the tokens delivery after failed execution.
     * @param to tokens receiver on the current chain.
     * @param amount amount to receive.
     * @param customPayload user's additional data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @param nonce unique failed execution's counter.
     * @return success call result.
     */
    function retryRedeem(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin,
        uint256 nonce
    ) external virtual returns(bool success) {
        if (to == address(0)) return false;
        bytes32 _hash = keccak256(abi.encode(to, amount, customPayload, origin, nonce));
        if (_failedExecution[_hash] != to) return false;
        delete _failedExecution[_hash];

        return _redeem(to, amount, customPayload, origin);
    }

    /**
     * @notice Sets the destination chains settings.
     * @param allowedChainIds chains Ids available for bridging in both directions.
     * @param chainConfigs array of {ChainConfig} settings for provided {allowedChainIds}, containing:
     *        peerAddress: connected {UTSToken} or {UTSConnector} contract address on the destination chain
     *        minGasLimit: the amount of gas required to execute {redeem} function on the destination chain
     *        decimals: connected {peerAddress} decimals on the destination chain
     *        paused: flag indicating whether current contract is paused for sending/receiving messages from the connected {peerAddress}
     *
     * @return success call result.
     */
    function setChainConfig(
        uint256[] calldata allowedChainIds,
        ChainConfig[] calldata chainConfigs
    ) external virtual returns(bool success) {
        _authorizeCall();
        _setChainConfig(allowedChainIds, chainConfigs);

        return true;
    }

    /**
     * @notice Sets the UTSRouter address.
     * @param newRouter new {_router} address.
     * @return success call result.
     * @dev {_router} address has access rights to execute {redeem} and {storeFailedExecution} functions.
     */
    function setRouter(address newRouter) external virtual returns(bool success) {
        _authorizeCall();
        _setRouter(newRouter);

        return true;
    }

    /**
     * @notice Returns the UTSRouter {_router} address.
     * @return routerAddress the {UTSRouter} address.
     */
    function router() public view returns(address routerAddress) {
        return _router;
    }

    /**
     * @notice Returns the UTSBase protocol version.
     * @return UTS protocol version.
     */
    function protocolVersion() public pure virtual returns(bytes2) {
        return 0x0101;
    }

    /**
     * @notice Returns the underlying ERC20 token address.
     * @return ERC20 {_underlyingToken} address.
     */
    function underlyingToken() public view virtual returns(address) {
        return _underlyingToken;
    }

    /**
     * @notice Returns whether failed execution's data is stored. 
     * @param to tokens receiver on the current chain.
     * @param amount amount to receive.
     * @param customPayload user's additional data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @param nonce unique failed execution's counter.
     * @return isFailed result.
     */
    function isExecutionFailed(
        address to, 
        uint256 amount, 
        bytes calldata customPayload, 
        Origin calldata origin,
        uint256 nonce
    ) external view virtual returns(bool isFailed) {
        if (to == address(0)) return false;
        return _failedExecution[keccak256(abi.encode(to, amount, customPayload, origin, nonce))] == to;
    }

    /**
     * @notice Returns estimated minimal amount to pay for bridging and minimal gas limit.
     * @param dstChainId destination chain Id.
     * @param dstGasLimit {redeem} call gas limit on the destination chain.
     * @param customPayloadLength user's additional data length.
     * @param protocolPayload UTS protocol's additional data.
     * @return paymentAmount source chain native currency amount to pay for bridging.
     * @return dstMinGasLimit destination chain minimal {redeem} call gas limit.
     */
    function estimateBridgeFee(
        uint256 dstChainId, 
        uint64 dstGasLimit, 
        uint16 customPayloadLength,
        bytes calldata protocolPayload
    ) public view virtual returns(uint256 paymentAmount, uint64 dstMinGasLimit) {
        dstMinGasLimit = IUTSRouter(_router).dstMinGasLimit(dstChainId);
        uint64 _configMinGasLimit = _chainConfig[dstChainId].minGasLimit;

        return (
            IUTSRouter(_router).getBridgeFee(dstChainId, dstGasLimit, customPayloadLength, protocolPayload), 
            dstMinGasLimit >= _configMinGasLimit ? dstMinGasLimit : _configMinGasLimit
        );
    }

    /**
     * @notice Returns destination chain configs for sending and receiving crosschain messages.
     * @param chainIds destination chain Ids.
     * @return configs array of {ChainConfig} settings for provided {chainIds}.
     * @dev See the {UTSERC20DataTypes.ChainConfig} for details.
     */
    function getChainConfigs(uint256[] calldata chainIds) external view returns(ChainConfig[] memory configs) {
        configs = new ChainConfig[](chainIds.length);
        for (uint256 i; chainIds.length > i; ++i) configs[i] = _chainConfig[chainIds[i]];
    }

    /**
     * @notice 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
     * to learn more about how these ids are created.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns(bool) {
        return interfaceId == type(IUTSBase).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @notice Internal function that initiates the tokens bridging.
     * @param spender transaction sender, must be {msg.sender}.
     * @param from tokens holder on the current chain.
     * @param to bridged tokens receiver on the destination chain.
     * @param amount tokens amount to bridge to the destination chain.
     * @param dstChainId destination chain Id.
     * @param dstGasLimit {redeem} call gas limit on the destination chain.
     * @param customPayload user's additional data.
     * @param protocolPayload UTS protocol's additional data.
     *
     * @return success call result.
     * @return bridgedAmount bridged tokens amount.
     *
     * @dev Implements all basic checks and calculations, containing:
     *      1. required destination gas limit check
     *      2. destination peer is not paused check
     *      3. amount conversion in accordance with destination token decimals
     *      4. bridged tokens amount is not zero check
     */
    function _bridge(
        address spender,
        address from,
        bytes memory to, 
        uint256 amount, 
        uint256 dstChainId, 
        uint64 dstGasLimit,
        bytes memory customPayload,
        bytes memory protocolPayload
    ) internal virtual returns(bool success, uint256 bridgedAmount) {
        if (from == address(0)) from = spender;

        ChainConfig memory config = _chainConfig[dstChainId];

        if (config.minGasLimit > dstGasLimit) revert UTSBase__E6();
        if (config.paused) revert UTSBase__E5();

        uint8 _srcDecimals = _decimals;
        amount = amount.convert(_srcDecimals, config.decimals).convert(config.decimals, _srcDecimals);

        amount = _burnFrom(
            spender,
            from,
            to, 
            amount, 
            dstChainId, 
            customPayload
        );

        if (amount == 0) revert UTSBase__E3();

        emit Bridged(spender, from, config.peerAddress, config.peerAddress, to, amount, dstChainId);

        return (
            _sendRequest(
                msg.value,
                config.peerAddress, 
                to, 
                amount,
                _srcDecimals, 
                dstChainId,
                dstGasLimit,
                customPayload,
                protocolPayload
            ), 
            amount
        );
    }

    /**
     * @notice Internal function that call {_router} contract to send crosschain bridge message.
     * @param payment the native currency amount that will be transfer to the {_router} as payment for sending this message.
     * @param dstToken the contract address on the {dstChainId} that will receive this message.
     * @param to bridged tokens receiver on the destination chain.
     * @param amount amount that {to} address will receive (before decimals conversion on the destination chain).
     * @param srcDecimals source ERC20 underlying token decimals.
     * @param dstChainId destination chain Id.
     * @param dstGasLimit {redeem} call gas limit on the destination chain.
     * @param customPayload user's additional data.
     * @param protocolPayload UTS protocol's additional data.
     *
     * @return success call result.
     *
     * @dev {customPayload} can be used to send an additional data, it will be sent to the {dstToken} contract on the 
     * destination chain in accordance with {redeem} function.
     */
    function _sendRequest(
        uint256 payment,
        bytes memory dstToken,
        bytes memory to,
        uint256 amount,
        uint8 srcDecimals,
        uint256 dstChainId,
        uint64 dstGasLimit,
        bytes memory customPayload,
        bytes memory protocolPayload
    ) internal virtual returns(bool success) {
        return IUTSRouter(_router).bridge{value: payment}( 
            dstToken,
            msg.sender.toBytes(),
            to,
            amount,
            srcDecimals,
            dstChainId,
            dstGasLimit,
            customPayload,
            protocolPayload
        );
    }

    /**
     * @notice Internal function that releases tokens to receiver by crosschain message from the source chain.
     * @param to bridged tokens receiver on the current chain.
     * @param amount amount that {to} address will receive (before decimals conversion on the current chain).
     * @param customPayload user's additional data.
     * @param origin source chain data.
     * @dev See the {UTSERC20DataTypes.Origin} for details.
     * @return success call result.
     *
     * @dev Implements all basic checks and calculations, containing:
     *      1. receiver address is not zero address check
     *      2. source peer address is allowed to send messages to this contract check
     *      3. source peer address is not paused check
     *      4. amount conversion in accordance with source token decimals
     */
    function _redeem(
        address to,
        uint256 amount,
        bytes memory customPayload,
        Origin memory origin
    ) internal virtual returns(bool success) {
        if (to == address(0)) revert UTSBase__E2();

        ChainConfig memory config = _chainConfig[origin.chainId];

        if (!config.peerAddress.equal(origin.peerAddress)) revert UTSBase__E7();
        if (config.paused) revert UTSBase__E5();
        
        amount = _mintTo(to, amount.convert(origin.decimals, _decimals), customPayload, origin);

        emit Redeemed(to, amount, origin.peerAddress, origin.peerAddress, origin.chainId, origin.sender);

        return true;
    }

    /**
     * @notice Internal function that sets the destination chains settings and emits corresponding event.
     * @param allowedChainIds chains Ids available for bridging in both directions.
     * @param chainConfigs array of {ChainConfig} settings for provided {allowedChainIds}.
     * @dev See the {UTSERC20DataTypes.ChainConfig} for details.
     */
    function _setChainConfig(uint256[] memory allowedChainIds, ChainConfig[] memory chainConfigs) internal virtual {
        if (allowedChainIds.length != chainConfigs.length) revert UTSBase__E4();
        for (uint256 i; allowedChainIds.length > i; ++i) _chainConfig[allowedChainIds[i]] = chainConfigs[i];

        emit ChainConfigUpdated(msg.sender, allowedChainIds, chainConfigs);
    }

    /**
     * @notice Internal function that sets the UTSRouter address and emits corresponding event.
     * @param newRouter new {_router} address.
     */
    function _setRouter(address newRouter) internal virtual {
        _router = newRouter;

        emit RouterSet(msg.sender, newRouter);
    }

    /**
     * @notice Internal view function that implement basic access check for {redeem} and {storeFailedExecution} functions.
     */
    function _onlyRouter() internal view {
        if (msg.sender != _router) revert UTSBase__E1();
    }

    /**
     * @dev The function MUST be overridden to include access restriction to the {setRouter} and {setChainConfig} functions.
     */
    function _authorizeCall() internal virtual;

    /**
     * @dev The function MUST be overridden to implement {mint}/{transfer} underlying tokens to receiver {to} address by {_router}.
     */
    function _mintTo(
        address to,
        uint256 amount,
        bytes memory customPayload,
        Origin memory origin
    ) internal virtual returns(uint256 receivedAmount);

    /**
     * @dev The function MUST be overridden to implement {burn}/{transferFrom} underlying tokens from {spender}/{from} 
     * address for bridging.
     *
     * IMPORTANT: If this contract IS a token itself, and the {spender} and {from} addresses are different, an {ERC20.allowance} 
     * check MUST be added.
     *
     * IMPORTANT: If this contract IS NOT a token itself, the {spender} and {from} addresses MUST be the same to prevent tokens
     * stealing via third-party allowances.
     *
     * IMPORTANT: Returned {bridgedAmount} value will be actually used for crosschain message, as it may be different from {amount}, 
     * if custom logic inside {_burnFrom} function modifies it.
     */
    function _burnFrom(
        address spender,
        address from,
        bytes memory to, 
        uint256 amount, 
        uint256 dstChainId, 
        bytes memory customPayload
    ) internal virtual returns(uint256 bridgedAmount);
}

File 14 of 20 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @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 15 of 20 : IUTSBase.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../../libraries/UTSERC20DataTypes.sol";

interface IUTSBase {

    function protocolVersion() external view returns(bytes2);

    function underlyingToken() external view returns(address underlyingTokenAddress);

    function router() external view returns(address routerAddress);

    function getChainConfigs(uint256[] calldata chainIds) external view returns(ChainConfig[] memory configs);

    function isExecutionFailed(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin,
        uint256 nonce
    ) external view returns(bool isFailed);

    function estimateBridgeFee(
        uint256 dstChainId, 
        uint64 dstGasLimit, 
        uint16 customPayloadLength,
        bytes calldata protocolPayload
    ) external view returns(uint256 paymentAmount, uint64 dstMinGasLimit);

    function setRouter(address newRouter) external returns(bool success);

    function setChainConfig(
        uint256[] calldata allowedChainIds,
        ChainConfig[] calldata chainConfigs
    ) external returns(bool success);

    function bridge(
        address from,
        bytes calldata to,
        uint256 amount,
        uint256 dstChainId,
        uint64 dstGasLimit,
        bytes calldata customPayload,
        bytes calldata protocolPayload
    ) external payable returns(bool success, uint256 bridgedAmount);

    function redeem(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin
    ) external payable returns(bool success);

    function storeFailedExecution(
        address to,
        uint256 amount,
        bytes calldata customPayload,
        Origin calldata origin,
        bytes calldata result
    ) external;

    function retryRedeem(
        address to, 
        uint256 amount, 
        bytes calldata customPayload, 
        Origin calldata origin,
        uint256 nonce
    ) external returns(bool success);

}

File 16 of 20 : IUTSRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../../libraries/UTSERC20DataTypes.sol";

interface IUTSRouter {

    function MASTER_ROUTER() external view returns(address);

    function PRICE_FEED() external view returns(address);

    function protocolVersion() external view returns(bytes2);

    function getBridgeFee(
        uint256 dstChainId, 
        uint64 dstGasLimit,
        uint256 payloadLength,
        bytes calldata protocolPayload
    ) external view returns(uint256 bridgeFeeAmount);

    function getUpdateFee(
        uint256[] calldata dstChainIds, 
        uint256[] calldata configsLength
    ) external view returns(uint256 updateFeeAmount);

    function dstMinGasLimit(uint256 dstChainId) external view returns(uint64 dstMinGasLimitAmount);

    function dstProtocolFee(uint256 dstChainId) external view returns(uint16 dstProtocolFeeRate);

    function dstUpdateGas(uint256 dstChainId) external view returns(uint64 dstUpdateGasAmount);

    function setDstMinGasLimit(uint256[] calldata dstChainIds, uint64[] calldata newDstMinGasLimits) external;

    function setDstProtocolFee(uint256[] calldata dstChainIds, uint16[] calldata newDstProtocolFees) external;

    function setDstUpdateGas(uint256[] calldata dstChainIds, uint64[] calldata newDstUpdateGas) external;

    function bridge(
        bytes calldata dstToken,
        bytes calldata sender,
        bytes calldata to,
        uint256 amount,
        uint8 srcDecimals,
        uint256 dstChainId,
        uint64 dstGasLimit,
        bytes calldata customPayload,
        bytes calldata protocolPayload
    ) external payable returns(bool success);

    function requestToUpdateConfig(
        bytes calldata sender,
        uint256[] calldata dstChainIds,
        bytes[] calldata dstPeers,
        ChainConfigUpdate[] calldata newConfigs
    ) external payable returns(bool success);

    function execute(
        address peerAddress, 
        bytes1 messageType, 
        bytes calldata localParams
    ) external payable returns(uint8 opResult);

    function pause() external;

    function unpause() external;

}

File 17 of 20 : UTSERC20DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

/// @notice Various structs used in the UTS protocol V1 ERC20-module contracts.

    /// @notice Destination chain {ChainConfig} settings for {UTSBase}.
    struct ChainConfig {
        bytes   peerAddress; // connected {UTSToken} or {UTSConnector} contract address on the destination chain
        uint64  minGasLimit; // the amount of gas required to execute {UTSBase.redeem} function on the destination chain
        uint8   decimals;    // connected {peerAddress} decimals on the destination chain
        bool    paused;      // flag indicating whether current contract is paused for sending/receiving messages from the connected {peerAddress}
    }

    /// @notice Destination {peerAddress} contract {ChainConfig} settings for {UTSBaseExtended.setChainConfigToDestination} function.
    struct ChainConfigUpdate {
        uint256[] allowedChainIds;  // chains Ids available for bridging in both directions
        ChainConfig[] chainConfigs; // {ChainConfig} settings
    }

    /// @notice Crosschain message source peer data.
    struct Origin {
        bytes   sender;      // source message {msg.sender} sender
        uint256 chainId;     // source chain Id
        bytes   peerAddress; // source {UTSToken} or {UTSConnector} contract address
        uint8   decimals;    // source {peerAddress} decimals
    }

    /// @notice {UTSToken} initial settings, configuration, and metadata for deployment and initialization.
    struct DeployTokenData {
        bytes     owner;               // the address of the initial {AccessControl.DEFAULT_ADMIN_ROLE}
        string    name;                // the {ERC20.name} of the {UTSToken} token
        string    symbol;              // the {ERC20.symbol} of the {UTSToken} token
        uint8     decimals;            // the {ERC20.decimals} of the {UTSToken} token
        uint256   initialSupply;       // total initial {UTSToken} supply to mint
        uint256   mintedAmountToOwner; // initial {UTSToken} supply to mint to {owner} balance
        bool      pureToken;           // flag indicating whether the {UTSToken} is use lock/unlock or mint/burn mechanism for bridging
        bool      mintable;            // flag indicating whether {owner} can mint an unlimited amount of {UTSToken} tokens
        bool      globalBurnable;      // flag indicating whether the {UTSToken} is globally burnable by anyone
        bool      onlyRoleBurnable;    // flag indicating whether only addresses with the {AccessControl.BURNER_ROLE} can burn tokens
        bool      feeModule;           // flag indicating whether the {UTSToken} is supports the fee deducting for bridging
        bytes     router;              // the address of the authorized {UTSRouter}
        uint256[] allowedChainIds;     // chains Ids available for bridging in both directions
        ChainConfig[] chainConfigs;    // {ChainConfig} settings for the corresponding {allowedChainIds}
        bytes32   salt;                // value used for precalculation of {UTSToken} contract address
    }

    /// @notice {UTSConnector} initial settings and configuration for deployment and initialization.
    struct DeployConnectorData {
        bytes     owner;            // the address of the initial {AccessControl.DEFAULT_ADMIN_ROLE}
        bytes     underlyingToken;  // underlying ERC20 token address
        bool      feeModule;        // flag indicating whether the {UTSConnector} is supports the fee deducting for bridging
        bytes     router;           // the address of the authorized {UTSRouter}
        uint256[] allowedChainIds;  // chains Ids available for bridging in both directions
        ChainConfig[] chainConfigs; // {ChainConfig} settings for the corresponding {allowedChainIds}
        bytes32   salt;             // value used for precalculation of {UTSConnector} contract address
    }

    /// @notice Metadata for the crosschain deployment request for {UTSDeploymentRouter.sendDeployRequest}.
    struct DeployMetadata {
        uint256 dstChainId;  // destination chain Id
        bool    isConnector; // flag indicating whether is {UTSConnector}(true) or {UTSToken}(false) deployment
        bytes   params;      // abi.encoded {DeployTokenData} struct or abi.encoded {DeployConnectorData} struct
    }

    /// @notice Destination chain settings for sending a crosschain deployment request in the {UTSDeploymentRouter}.
    struct DstDeployConfig {
        bytes   factory;            // destination {UTSFactory} address
        uint64  tokenDeployGas;     // the amount of gas required to deploy the {UTSToken} on the destination chain
        uint64  connectorDeployGas; // the amount of gas required to deploy the {UTSConnector} on the destination chain
        uint16  protocolFee;        // protocol fee (basis points) for crosschain deployment on the destination chain
    }

File 18 of 20 : DecimalsConverter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

/**
 * @notice The library contains utility function for converting amounts with different decimals values for the UTS protocol V1.
 */
library DecimalsConverter {

    function convert(uint256 amount, uint256 decimalsIn, uint256 decimalsOut) internal pure returns(uint256) {
        if (decimalsOut > decimalsIn) {
            return amount * (10 ** (decimalsOut - decimalsIn));
        } else {
            if (decimalsOut < decimalsIn) {
                return amount / (10 ** (decimalsIn - decimalsOut));
            }
        }

        return amount;
    }

}

File 19 of 20 : AddressConverter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

/**
 * @notice A library contains utility functions for converting address type for the UTS protocol V1.
 */
library AddressConverter {

    function toBytes(address _address) internal pure returns(bytes memory) {
        return abi.encodePacked(_address);
    }

    function toAddress(bytes memory _params) internal pure returns(address) {
        return address(uint160(bytes20(_params)));
    }

    function toAddressPadded(bytes memory _params) internal pure returns(address addressPadded) {
        if (32 > _params.length) return address(0);

        assembly {
            addressPadded := div(mload(add(add(_params, 0x20), 12)), 0x1000000000000000000000000)
        }
    }

}

File 20 of 20 : BytesLib.sol
// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;

library BytesLib {

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                    // the next line is the loop condition:
                    // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint256(mc < end) + cb == 2)
                        for {

                        } eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

}

Settings
{
  "viaIR": true,
  "evmVersion": "paris",
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "remappings": []
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"UTSBase__E0","type":"error"},{"inputs":[],"name":"UTSBase__E1","type":"error"},{"inputs":[],"name":"UTSBase__E2","type":"error"},{"inputs":[],"name":"UTSBase__E3","type":"error"},{"inputs":[],"name":"UTSBase__E4","type":"error"},{"inputs":[],"name":"UTSBase__E5","type":"error"},{"inputs":[],"name":"UTSBase__E6","type":"error"},{"inputs":[],"name":"UTSBase__E7","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"bytes","name":"dstPeerAddressIndexed","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"dstPeerAddress","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"to","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"dstChainId","type":"uint256"}],"name":"Bridged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"allowedChainIds","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"indexed":false,"internalType":"struct ChainConfig[]","name":"chainConfigs","type":"tuple[]"}],"name":"ChainConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"customPayload","type":"bytes"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"indexed":true,"internalType":"struct Origin","name":"originIndexed","type":"tuple"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"indexed":false,"internalType":"struct Origin","name":"origin","type":"tuple"},{"indexed":true,"internalType":"bytes","name":"result","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"ExecutionFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"srcPeerAddressIndexed","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"srcPeerAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"srcChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"sender","type":"bytes"}],"name":"Redeemed","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":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"newRouter","type":"address"}],"name":"RouterSet","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":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes","name":"to","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"uint64","name":"dstGasLimit","type":"uint64"},{"internalType":"bytes","name":"customPayload","type":"bytes"},{"internalType":"bytes","name":"protocolPayload","type":"bytes"}],"name":"bridge","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"bridgedAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"uint64","name":"dstGasLimit","type":"uint64"},{"internalType":"uint16","name":"customPayloadLength","type":"uint16"},{"internalType":"bytes","name":"protocolPayload","type":"bytes"}],"name":"estimateBridgeFee","outputs":[{"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"internalType":"uint64","name":"dstMinGasLimit","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"dstChainIds","type":"uint256[]"},{"internalType":"uint256[]","name":"configsLength","type":"uint256[]"}],"name":"estimateUpdateFee","outputs":[{"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"chainIds","type":"uint256[]"}],"name":"getChainConfigs","outputs":[{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct ChainConfig[]","name":"configs","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":[{"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":[{"components":[{"internalType":"bytes","name":"owner","type":"bytes"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"mintedAmountToOwner","type":"uint256"},{"internalType":"bool","name":"pureToken","type":"bool"},{"internalType":"bool","name":"mintable","type":"bool"},{"internalType":"bool","name":"globalBurnable","type":"bool"},{"internalType":"bool","name":"onlyRoleBurnable","type":"bool"},{"internalType":"bool","name":"feeModule","type":"bool"},{"internalType":"bytes","name":"router","type":"bytes"},{"internalType":"uint256[]","name":"allowedChainIds","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct ChainConfig[]","name":"chainConfigs","type":"tuple[]"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"internalType":"struct DeployTokenData","name":"params","type":"tuple"}],"name":"initializeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"customPayload","type":"bytes"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Origin","name":"origin","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"isExecutionFailed","outputs":[{"internalType":"bool","name":"isFailed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolVersion","outputs":[{"internalType":"bytes2","name":"","type":"bytes2"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"customPayload","type":"bytes"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"redeem","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"customPayload","type":"bytes"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Origin","name":"origin","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"retryRedeem","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"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":"router","outputs":[{"internalType":"address","name":"routerAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"allowedChainIds","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct ChainConfig[]","name":"chainConfigs","type":"tuple[]"}],"name":"setChainConfig","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"allowedChainIds","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct ChainConfig[]","name":"chainConfigs","type":"tuple[]"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"setChainConfigByRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"dstChainIds","type":"uint256[]"},{"components":[{"internalType":"uint256[]","name":"allowedChainIds","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint64","name":"minGasLimit","type":"uint64"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct ChainConfig[]","name":"chainConfigs","type":"tuple[]"}],"internalType":"struct ChainConfigUpdate[]","name":"newConfigs","type":"tuple[]"}],"name":"setChainConfigToDestination","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newRouter","type":"address"}],"name":"setRouter","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"customPayload","type":"bytes"},{"components":[{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"bytes","name":"peerAddress","type":"bytes"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Origin","name":"origin","type":"tuple"},{"internalType":"bytes","name":"result","type":"bytes"}],"name":"storeFailedExecution","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":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a08060405234620000d7576306433b1b60e01b8152602081600481335afa908115620000cb5760009162000053575b50608052604051612f0f9081620000dd823960805181818161218701526126770152f35b60203d602011620000c3575b601f8101601f191682016001600160401b03811183821017620000af57602091839160405281010312620000ab5751906001600160a01b0382168203620000a85750386200002f565b80fd5b5080fd5b634e487b7160e01b84526041600452602484fd5b503d6200005f565b6040513d6000823e3d90fd5b600080fdfe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461021757806304e7aae91461021257806306fdde031461020d578063081fafa014610208578063095ea7b31461020357806318160ddd146101fe5780631d34dbc3146101f957806323b872dd146101f4578063248a9ca3146101ef5780632495a599146101ea5780632ae9c600146101e55780632da04cba146101e05780632f2ff15d146101db578063313ce567146101d657806336568abe146101d157806370a08231146101cc57806375506718146101c75780638ec58bb5146101c257806391d14854146101bd57806395d89b41146101b8578063a217fddf146101b3578063a9059cbb146101ae578063c0d78655146101a9578063c9af28b3146101a4578063cb05ac031461019f578063d3a2ba761461019a578063d547741f14610195578063dd62ed3e14610190578063dde63fed1461018b578063e8f6e9e214610186578063f887ea40146101815763f96e52ca1461017c57600080fd5b611407565b61133d565b611218565b6111f9565b6111ad565b61116e565b610fe8565b610e70565b610d3c565b610d13565b610ced565b610cd1565b610c45565b610c05565b610bdc565b610a1c565b6109e2565b61099b565b610977565b610936565b61087e565b61085d565b610834565b610805565b6107cd565b610730565b610701565b610651565b6104e9565b6103c0565b610320565b346102a15760203660031901126102a15760043563ffffffff60e01b81168091036102a1576020906336372b0760e01b811490811561025c575b506040519015158152f35b637965db0b60e01b811491508115610276575b5038610251565b63950a21e160e01b811491508115610290575b503861026f565b6301ffc9a760e01b14905038610289565b600080fd5b9181601f840112156102a1578235916001600160401b0383116102a1576020808501948460051b0101116102a157565b60406003198201126102a1576001600160401b03916004358381116102a15782610302916004016102a6565b939093926024359182116102a15761031c916004016102a6565b9091565b346102a15761035961034b610353610337366102d6565b9491610344939193612493565b3691611567565b92369161162b565b90612184565b602060405160018152f35b60005b8381106103775750506000910152565b8181015183820152602001610367565b906020916103a081518092818552858086019101610364565b601f01601f1916010190565b9060206103bd928181520190610387565b90565b346102a15760008060031936011261047f57604051816008546103e2816116f7565b9081845260209260019160018116908160001461045d5750600114610422575b61041e856104128189038261152d565b604051918291826103ac565b0390f35b929450600883528483205b82841061044a575050508161041e93610412928201019338610402565b805485850187015292850192810161042d565b60ff191686860152505050151560051b82010191506104128161041e38610402565b80fd5b600435906001600160a01b03821682036102a157565b602435906001600160a01b03821682036102a157565b9181601f840112156102a1578235916001600160401b0383116102a157602083818601950101116102a157565b908160809103126102a15790565b60803660031901126102a1576104fd610482565b6001600160401b036044358181116102a15761051d9036906004016104ae565b90916064359081116102a1576105569261053e61054e9236906004016104db565b92610547612285565b36916115b5565b5036906117c7565b906001600160a01b038116801561063f57602083019161057e610579845161198e565b6120de565b928351936105996105956040880196875190612c32565b1590565b61062d576060015161061b576105ed600080516020612eba833981519152926105e76105c9606089015160ff1690565b60ff806105dc60025460ff9060a01c1690565b169116602435612ca0565b90612d10565b9351905194519361060d610600836122ab565b95604051938493846122cb565b0390a4602060405160018152f35b60405163188e252560e11b8152600490fd5b604051637cb3947160e11b8152600490fd5b6040516351c7b3e160e01b8152600490fd5b346102a15760403660031901126102a15761066a610482565b60243533156106e8576001600160a01b0382169182156106cf576106978291610692336119f7565b611a11565b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b604051634a1406b160e11b815260006004820152602490fd5b60405163e602df0560e01b815260006004820152602490fd5b346102a15760003660031901126102a1576020600754604051908152f35b6001600160401b038116036102a157565b60e03660031901126102a157610744610482565b6001600160401b03906024358281116102a1576107659036906004016104ae565b90608435906107738261071f565b60a4358581116102a15761078b9036906004016104ae565b92909160c4359687116102a1576107a96107b99736906004016104ae565b9690956064359260443592611841565b604080519215158352602083019190915290f35b346102a15760603660031901126102a1576103596107e9610482565b6107f1610498565b6044359161080083338361234a565b6123d0565b346102a15760203660031901126102a157600435600052600a6020526020600160406000200154604051908152f35b346102a15760003660031901126102a1576002546040516001600160a01b039091168152602090f35b346102a15760003660031901126102a15760405161010160f01b8152602090f35b346102a1576108c96020610891366102d6565b949290916108db60018060a01b03600154169360405197889687958695632d79c1e160e01b87526040600488015260448701916119ad565b848103600319016024860152916119ad565b03915afa80156109315761041e91600091610902575b506040519081529081906020820190565b610924915060203d60201161092a575b61091c818361152d565b81019061199e565b386108f1565b503d610912565b6119d1565b346102a15760403660031901126102a157610975600435610955610498565b9080600052600a6020526109706001604060002001546124de565b612591565b005b346102a15760003660031901126102a157602060ff60025460a01c16604051908152f35b346102a15760403660031901126102a1576109b4610498565b336001600160a01b038216036109d057610975906004356125fa565b60405163334bd91960e11b8152600490fd5b346102a15760203660031901126102a1576001600160a01b03610a03610482565b1660005260056020526020604060002054604051908152f35b346102a15760603660031901126102a1576001600160401b036004358181116102a157610a4d9036906004016102a6565b906024358381116102a157610a669036906004016102a6565b9190936044359081116102a157610a819036906004016104db565b93610a8a612285565b60209460009580820135875260038152610aaf61054760408920936040810190611a28565b8254815160019490918086161560081b600019018116861c8381148714610af35750505050505050845b1561062d5761034b61035392610af0953691611567565b80f35b80610b04575b505050505050610ad9565b8511600114610b5e575089528289209082018301918301906001905b6002828585100114610b3d5750505050505b388080808080610af9565b8251815403610b53575b91840191600101610b20565b8a9550859150610b47565b939291505001519060ff19160315610b32575084610b32565b60a06003198201126102a1576004356001600160a01b03811681036102a15791602435916001600160401b03916044358381116102a15782610bbb916004016104ae565b939093926064359182116102a157610bd5916004016104db565b9060843590565b346102a1576020610bfb610bef36610b77565b94939093929192611b4c565b6040519015158152f35b346102a15760403660031901126102a157602060ff610c39610c25610498565b600435600052600a84526040600020611a11565b54166040519015158152f35b346102a15760008060031936011261047f5760405181600954610c67816116f7565b9081845260209260019160018116908160001461045d5750600114610c965761041e856104128189038261152d565b929450600983528483205b828410610cbe575050508161041e93610412928201019338610402565b8054858501870152928501928101610ca1565b346102a15760003660031901126102a157602060405160008152f35b346102a15760403660031901126102a157610359610d09610482565b60243590336123d0565b346102a15760203660031901126102a157610359610d2f610482565b610d37612493565b61266d565b346102a1576003196020368201126102a1576004356001600160401b0381116102a1576101e0816004019282360301126102a157610de86105476109759383610dbc610db6610d916024610e32980185611a28565b610dae610da46044879594950188611a28565b94909236916115b5565b9236916115b5565b906128e3565b610dd1610dcb60648301611c97565b306129c5565b610ded610d37610de8610547610164850186611a28565b612a12565b610e1f610353610e01610184840185611ca1565b61034b610e156101a4879594950188611ca1565b9490923691611567565b608481013580610e37575b505080611a28565b61251f565b610e6991610e6391610e5e60a4610e54610de86105478980611a28565b9301358093612a51565b611cec565b30612a51565b3880610e2a565b346102a15760803660031901126102a157602435600435610e908261071f565b60443561ffff811681036102a1576001600160401b036064358181116102a157610ebe9036906004016104ae565b600154909390610ee490610ed8906001600160a01b031681565b6001600160a01b031690565b6040516329d2f02160e21b815260048101879052602097909291908884602481855afa978815610931578994600099610fb9575b50610f55610f386001610f2a8461198e565b01546001600160401b031690565b986040519788968795869562092e8760e71b875260048701611d13565b03915afa94851561093157600095610f9a575b505081811690831610610f925750905b604080519182526001600160401b03929092166020820152f35b905090610f78565b610fb1929550803d1061092a5761091c818361152d565b923880610f68565b610fda919950853d8711610fe1575b610fd2818361152d565b810190611cfe565b9738610f18565b503d610fc8565b346102a15760a03660031901126102a157611001610482565b6001600160401b0390602435906044358381116102a1576110269036906004016104ae565b90926064358581116102a1576110409036906004016104db565b906084359586116102a1577f89fecad7e82e777b95efd8da30d0290c555adcd7d5fd59c2bbd44752bc09ccab6111699561114b9561116161108760409a36906004016104ae565b9096611091612285565b6110ee8460009d8e8a8d6110c48b6110b685548a885195869460208601988c8a611b09565b03601f19810183528261152d565b519020815260046020522080546001600160a01b0319166001600160a01b03909216919091179055565b8b54998a9260405160208161112e6111108261110a8980611a7b565b90611d46565b8388013581528361112460408a018a611a7b565b9190920191611d46565b60ff606088013561113e81611616565b1681520301902099611d5b565b9860405195869560018060a01b03169886611d70565b0390a4611da0565b815580f35b346102a15760403660031901126102a15761097560043561118d610498565b9080600052600a6020526111a86001604060002001546124de565b6125fa565b346102a15760403660031901126102a15760206111f06111cb610482565b6111d3610498565b6001600160a01b0390911660009081526006845260409020611a11565b54604051908152f35b346102a1576020610bfb61120c36610b77565b94939093929192611daf565b611221366102d6565b61122c929192612493565b80820361132b5761123c82611df3565b9260005b8084116112eb5750600154939460209490919061129190611269906001600160a01b0316610ed8565b9361127333612ab1565b604051633bde546760e11b8152988997889687969360048801612045565b039134905af180156109315761041e916000916112bc575b5060405190151581529081906020820190565b6112de915060203d6020116112e4575b6112d6818361152d565b810190611e99565b386112a9565b503d6112cc565b8061130b61130661130061132694888b611e53565b3561198e565b611e7c565b6113158288611e68565b526113208187611e68565b50611da0565b611240565b60405163743be11560e11b8152600490fd5b346102a15760003660031901126102a1576001546040516001600160a01b039091168152602090f35b908082519081815260208091019281808460051b8301019501936000915b8483106113945750505050505090565b9091929394958480600192601f198582030186528951906113be6080835190808452830190610387565b91858060401b03848201511684830152604060ff81830151169083015260608091015115159101529801930193019194939290611384565b9060206103bd928181520190611366565b346102a1576020806003193601126102a1576004356001600160401b0381116102a1576114389036906004016102a6565b61144181611550565b926040611451604051958661152d565b828552601f1961146084611550565b019060005b8281106114b7575050505060005b808211611488576040518061041e86826113f6565b8061149d6105796113006114b2948688611e53565b6114a78287611e68565b526113208186611e68565b611473565b839082516114c4816114fa565b600060608083528185840152818684015282015282828a01015201611465565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761151557604052565b6114e4565b6001600160401b03811161151557604052565b601f909101601f19168101906001600160401b0382119082101761151557604052565b6001600160401b0381116115155760051b60200190565b929161157282611550565b91611580604051938461152d565b829481845260208094019160051b81019283116102a157905b8282106115a65750505050565b81358152908301908301611599565b9192916001600160401b03821161151557604051916115de601f8201601f19166020018461152d565b8294818452818301116102a1578281602093846000960137010152565b9080601f830112156102a1578160206103bd933591016115b5565b60ff8116036102a157565b801515036102a157565b92919061163781611550565b91604091611648604051948561152d565b839581855260208095019160051b8101938385116102a15781925b8584106116735750505050505050565b6001600160401b0384358181116102a1578401916080838803126102a157835161169c816114fa565b83359283116102a157836116b5898c96958796016115fb565b8252838101356116c48161071f565b84830152858101356116d581611616565b86830152606080910135906116e982611621565b820152815201930192611663565b90600182811c92168015611727575b602083101461171157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611706565b805460009392611740826116f7565b918282526020936001916001811690816000146117a85750600114611767575b5050505050565b90939495506000929192528360002092846000945b83861061179457505050500101903880808080611760565b80548587018301529401938590820161177c565b60ff19168685015250505090151560051b010191503880808080611760565b9190916080818403126102a157604051906117e1826114fa565b909283916001600160401b03919080358381116102a157826118049183016115fb565b84526020810135602085015260408101359283116102a15761182c60609392849383016115fb565b604085015201359161183d83611616565b0152565b97919561185a6118629261186a95999c9b9836916115b5565b9a36916115b5565b9436916115b5565b936001600160a01b03861615611986575b6118876105798361198e565b60208101519096906001600160401b0385811691161161197457606087015161061b576119056118fe60ff89946118f86118f26118ea60406118cf60025460ff9060a01c1690565b9901936118dd855160ff1690565b868b169687911691612ca0565b925160ff1690565b60ff1690565b90612ca0565b8233612d30565b9889156119625787848b9361195e9a51907f4ba393f2ef2da70e2b9689da0c6a653dad20a8811c0564cacfe3dc04b6a7d6eb85611941846122ab565b93611954896040519384933397856122f6565b0390a45134612d65565b9190565b604051636efa655f60e01b8152600490fd5b604051633527309d60e11b8152600490fd5b33955061187b565b6000526003602052604060002090565b908160209103126102a1575190565b81835290916001600160fb1b0383116102a15760209260051b809284830137010190565b6040513d6000823e3d90fd5b6001600160a01b0316600090815260056020526040902090565b6001600160a01b0316600090815260066020526040902090565b9060018060a01b0316600052602052604060002090565b903590601e19813603018212156102a157018035906001600160401b0382116102a1576020019181360383136102a157565b908060209392818452848401376000828201840152601f01601f1916010190565b9035601e19823603018112156102a1570160208101919035906001600160401b0382116102a15781360383136102a157565b90606060ff81611af6611ad1611ac38780611a7b565b608088526080880191611a5a565b60208701356020870152611ae86040880188611a7b565b908783036040890152611a5a565b940135611b0281611616565b1691015290565b9695949192608094611b4794611b399360018060a01b03168a5260208a015260a060408a015260a0890191611a5a565b908682036060880152611aad565b930152565b909492936001600160a01b038083169492938515611c8a578481611b838a6110b68b988860409d8e5196879560208701998a611b09565b5190206000526004602052866000209386855493841603611c7c576001600160a01b0319909216909355611bbc9261054e9136916115b5565b936020850191611bcf610579845161198e565b91825192611be5610595888a0195865190612c32565b611c6b5760600151611c5a57611c38600080516020612eba8339815191529493926105e7611c5293611c1b60608c015160ff1690565b9060ff80611c2f60025460ff9060a01c1690565b16921690612ca0565b915192519651611c47846122ab565b9651938493846122cb565b0390a4600190565b855163188e252560e11b8152600490fd5b8651637cb3947160e11b8152600490fd5b505050505050505050600090565b5050505050505050600090565b356103bd81611616565b903590601e19813603018212156102a157018035906001600160401b0382116102a157602001918160051b360383136102a157565b634e487b7160e01b600052601160045260246000fd5b91908203918211611cf957565b611cd6565b908160209103126102a157516103bd8161071f565b9081526001600160401b03909116602082015261ffff90911660408201526080606082018190526103bd93910191611a5a565b81908337600082820152601f01601f19160190565b81604051928392833781016000815203902090565b95949390611b4792606094611d92928952608060208a01526080890191611a5a565b908682036040880152611aad565b6000198114611cf95760010190565b92939060018060a01b0394858516968715611c8a57611ddd936110b69260405196879560208701998a611b09565b5190206000526004602052604060002054161490565b90611dfd82611550565b611e0a604051918261152d565b8281528092611e1b601f1991611550565b019060005b828110611e2c57505050565b806060602080938501015201611e20565b634e487b7160e01b600052603260045260246000fd5b9190811015611e635760051b0190565b611e3d565b8051821015611e635760209160051b010190565b90611e97611e909260405193848092611731565b038361152d565b565b908160209103126102a157516103bd81611621565b9035601e19823603018112156102a1570160208101919035906001600160401b0382116102a1578160051b360383136102a157565b90918092808252602080920191600593818360051b8701019581956000925b858410611f1457505050505050505090565b9091929394959697601f19808583030189528935603e19843603018112156102a157918388929301604091611f65611f5b611f4f8480611eae565b868552868501916119ad565b9285810190611eae565b9091858185039101528083528483019285828a1b8201019683956000915b848310611fa8575050505050505050806001929a019801940192919095949395611f02565b809294969850838a929496989a03018852883590607e19883603018212156102a1578e8091896001940190611fef6080611fe28480611a7b565b9091808552840191611a5a565b9183810135611ffd8161071f565b868060401b03168483015260ff8882013561201781611616565b168883015260608091013561202b81611621565b15159101529a019801930190918d97969492959395611f83565b91969593949261206061207092608085526080850190610387565b906020988483038a8601526119ad565b95818703604083015284518088528188019180808360051b8b01019701926000905b8382106120b15750505050506103bd9495506060818503910152611ee3565b909192939783806120cf6001938e601f199082030186528c51610387565b9a019201920190939291612092565b906040516120eb816114fa565b606060ff6001839560405161210b816121048185611731565b038261152d565b855201546001600160401b0381166020850152604081811c83169085015260481c161515910152565b9092916040820191604081528451809352606081019260208096019060005b818110612170575050506103bd9394506020818403910152611366565b825186529487019491870191600101612153565b907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690813b156102a1576040916040518091631cfa86f360e31b825260009283918183816121df898c60048401612134565b03925af1801561093157612276575b5090835181510361132b57815b808551111561223a57806122306122156122359385611e68565b516122208389611e68565b5186526003602052868620612ae8565b611da0565b6121fb565b507f25bb14184ed47336f0e8c5b9b58e65ca31a0cfd0cf8eb80cd59b5005339b4db692506122719150604051918291339583612134565b0390a2565b61227f9061151a565b386121ee565b6001546001600160a01b0316330361229957565b6040516347b3ba4760e01b8152600490fd5b6122c390602060405192828480945193849201610364565b810103902090565b916122e8906103bd94928452606060208501526060840190610387565b916040818403910152610387565b94939261231e606093611b479360018060a01b03168852608060208901526080880190610387565b908682036040880152610387565b604091949392606082019560018060a01b0316825260208201520152565b919060018060a01b038084169081600052600660205261236e836040600020611a11565b549160018301612381575b505050505050565b8483106123af57156106e8578216156106cf576123a3926106929103936119f7565b55388080808080612379565b604051637dc7a0d960e11b8152806123cc8786886004850161232c565b0390fd5b916001600160a01b038084169290831561247a578116938415612461576123f6816119dd565b548381106124435761243e928492612422600080516020612e7a833981519152966124289403916119dd565b556119dd565b8054820190556040519081529081906020820190565b0390a3565b906123cc8460405193849363391434e360e21b85526004850161232c565b60405163ec442f0560e01b815260006004820152602490fd5b604051634b637e8f60e11b815260006004820152602490fd5b60008052600a60205260ff6124b633600080516020612e9a833981519152611a11565b5416156124bf57565b60405163e2517d3f60e01b815233600482015260006024820152604490fd5b80600052600a60205260ff6124f7336040600020611a11565b5416156125015750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b6000808052600a60205260ff61254383600080516020612e9a833981519152611a11565b541661258c57808052600a60205261255e8260408320611a11565b805460ff1916600117905533916001600160a01b031690600080516020612e5a8339815191528180a4600190565b905090565b600090808252600a60205260ff6125ab8460408520611a11565b54166125f457808252600a6020526125c68360408420611a11565b805460ff1916600117905533926001600160a01b031691600080516020612e5a8339815191529080a4600190565b50905090565b600090808252600a60205260ff6126148460408520611a11565b5416156125f457808252600a6020526126308360408420611a11565b805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691823b156102a157600091602483926040519485938492636428e61960e11b845216968760048401525af1801561093157612711575b50600180546001600160a01b0319168217905560405190815233907f8ab4cea230ab04f96aaa9a71fbc4bfa98097c7b9f07e06be33868b500f81002890602090a2565b61271a9061151a565b386126ce565b81811061272b575050565b60008155600101612720565b90601f8211612744575050565b611e979160086000526020600020906020601f840160051c83019310612772575b601f0160051c0190612720565b9091508190612765565b90601f8211612789575050565b611e979160096000526020600020906020601f840160051c8301931061277257601f0160051c0190612720565b9190601f81116127c557505050565b611e97926000526020600020906020601f840160051c8301931061277257601f0160051c0190612720565b8160011b916000199060031b1c19161790565b80519091906001600160401b0381116115155761282a816128256009546116f7565b61277c565b602080601f831160011461285f5750819061284f9394600092612854575b50506127f0565b600955565b015190503880612848565b6009600052601f198316949091907f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af926000905b8782106128cb5750508360019596106128b2575b505050811b01600955565b015160001960f88460031b161c191690553880806128a7565b80600185968294968601518155019501930190612893565b8051906001600160401b03821161151557612908826129036008546116f7565b612737565b602090816001601f8511146129395750918061293192611e9795946000926128545750506127f0565b600855612803565b60086000529190601f1984167ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3936000905b8282106129ad575050916001939185611e9797969410612994575b505050811b01600855612803565b015160001960f88460031b161c19169055388080612986565b8060018697829497870151815501960194019061296b565b90600054612a0057600280546001600160a81b0319166001600160a01b039093169290921760a09190911b60ff60a01b161790556001600055565b60405163180cbc2160e21b8152600490fd5b80516020909101516001600160601b031991828216919060148110612a3c575b5050905060601c90565b8391925060140360031b1b1616803880612a32565b9060075490808201809211611cf9576020600080516020612e7a8339815191529160009360075560018060a01b0385169485158514612a9d575080600754036007555b604051908152a3565b612aa6906119dd565b818154019055612a94565b6040805160609290921b6001600160601b03191660208301526014825281016001600160401b038111828210176115155760405290565b8151805190939291906001600160401b03811161151557612b1381612b0d84546116f7565b846127b6565b602080601f8311600114612bb75750612b9d92612b4383606094600194611e97999a6000926128545750506127f0565b81555b6020850151910180546001600160401b0319166001600160401b0390921691909117815592612b96612b7c604083015160ff1690565b855460ff60401b191660409190911b60ff60401b16178555565b0151151590565b815460ff60481b191690151560481b60ff60481b16179055565b90601f19831696612bcd85600052602060002090565b926000905b898210612c1a57505083600193612b9d96938593606097611e979b9c10612c01575b505050811b018155612b46565b015160001960f88460031b161c19169055388080612bf4565b80600185968294968601518155019501930190612bd2565b60019181519181518314600114612c4c5750505050600090565b600160208080958185019401019301915b6002828583100114612c7157505050505090565b8251815103612c86575b918401918401612c5d565b60009550859150612c7b565b604d8111611cf957600a0a90565b919080821115612cd0578103908111611cf957612cbc90612c92565b90818102918183041490151715611cf95790565b90818110612cdd57505090565b8103908111611cf957612cef90612c92565b908115612cfa570490565b634e487b7160e01b600052601260045260246000fd5b81306001600160a01b03831603612d2657505090565b6103bd91306123d0565b6103bd918391826001600160a01b0380831690841603612d54575b505030906123d0565b612d5e918361234a565b3882612d4b565b9497919395909296600160a01b60019003600154169733612d8590612ab1565b926040519a8b998a9889986332a68c8d60e01b8a5260048a0161012090526101248a01612db191610387565b9660031997888b82030160248c0152612dc991610387565b878a82030160448b0152612ddc91610387565b606489019490945260ff16608488015260a48701526001600160401b031660c4860152848103830160e4860152612e1291610387565b9083820301610104840152612e2691610387565b03915a94602095f190811561093157600091612e40575090565b6103bd915060203d6020116112e4576112d6818361152d56fe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0dddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e357349f3521319d500766c25bbf2260c005d16a7164533a3596bd7a2790679911a2646970667358221220eeaf18bf07f94975fd6636d111e10915f7a6797cedf4499595a33c2036f497e064736f6c63430008180033

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461021757806304e7aae91461021257806306fdde031461020d578063081fafa014610208578063095ea7b31461020357806318160ddd146101fe5780631d34dbc3146101f957806323b872dd146101f4578063248a9ca3146101ef5780632495a599146101ea5780632ae9c600146101e55780632da04cba146101e05780632f2ff15d146101db578063313ce567146101d657806336568abe146101d157806370a08231146101cc57806375506718146101c75780638ec58bb5146101c257806391d14854146101bd57806395d89b41146101b8578063a217fddf146101b3578063a9059cbb146101ae578063c0d78655146101a9578063c9af28b3146101a4578063cb05ac031461019f578063d3a2ba761461019a578063d547741f14610195578063dd62ed3e14610190578063dde63fed1461018b578063e8f6e9e214610186578063f887ea40146101815763f96e52ca1461017c57600080fd5b611407565b61133d565b611218565b6111f9565b6111ad565b61116e565b610fe8565b610e70565b610d3c565b610d13565b610ced565b610cd1565b610c45565b610c05565b610bdc565b610a1c565b6109e2565b61099b565b610977565b610936565b61087e565b61085d565b610834565b610805565b6107cd565b610730565b610701565b610651565b6104e9565b6103c0565b610320565b346102a15760203660031901126102a15760043563ffffffff60e01b81168091036102a1576020906336372b0760e01b811490811561025c575b506040519015158152f35b637965db0b60e01b811491508115610276575b5038610251565b63950a21e160e01b811491508115610290575b503861026f565b6301ffc9a760e01b14905038610289565b600080fd5b9181601f840112156102a1578235916001600160401b0383116102a1576020808501948460051b0101116102a157565b60406003198201126102a1576001600160401b03916004358381116102a15782610302916004016102a6565b939093926024359182116102a15761031c916004016102a6565b9091565b346102a15761035961034b610353610337366102d6565b9491610344939193612493565b3691611567565b92369161162b565b90612184565b602060405160018152f35b60005b8381106103775750506000910152565b8181015183820152602001610367565b906020916103a081518092818552858086019101610364565b601f01601f1916010190565b9060206103bd928181520190610387565b90565b346102a15760008060031936011261047f57604051816008546103e2816116f7565b9081845260209260019160018116908160001461045d5750600114610422575b61041e856104128189038261152d565b604051918291826103ac565b0390f35b929450600883528483205b82841061044a575050508161041e93610412928201019338610402565b805485850187015292850192810161042d565b60ff191686860152505050151560051b82010191506104128161041e38610402565b80fd5b600435906001600160a01b03821682036102a157565b602435906001600160a01b03821682036102a157565b9181601f840112156102a1578235916001600160401b0383116102a157602083818601950101116102a157565b908160809103126102a15790565b60803660031901126102a1576104fd610482565b6001600160401b036044358181116102a15761051d9036906004016104ae565b90916064359081116102a1576105569261053e61054e9236906004016104db565b92610547612285565b36916115b5565b5036906117c7565b906001600160a01b038116801561063f57602083019161057e610579845161198e565b6120de565b928351936105996105956040880196875190612c32565b1590565b61062d576060015161061b576105ed600080516020612eba833981519152926105e76105c9606089015160ff1690565b60ff806105dc60025460ff9060a01c1690565b169116602435612ca0565b90612d10565b9351905194519361060d610600836122ab565b95604051938493846122cb565b0390a4602060405160018152f35b60405163188e252560e11b8152600490fd5b604051637cb3947160e11b8152600490fd5b6040516351c7b3e160e01b8152600490fd5b346102a15760403660031901126102a15761066a610482565b60243533156106e8576001600160a01b0382169182156106cf576106978291610692336119f7565b611a11565b556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b604051634a1406b160e11b815260006004820152602490fd5b60405163e602df0560e01b815260006004820152602490fd5b346102a15760003660031901126102a1576020600754604051908152f35b6001600160401b038116036102a157565b60e03660031901126102a157610744610482565b6001600160401b03906024358281116102a1576107659036906004016104ae565b90608435906107738261071f565b60a4358581116102a15761078b9036906004016104ae565b92909160c4359687116102a1576107a96107b99736906004016104ae565b9690956064359260443592611841565b604080519215158352602083019190915290f35b346102a15760603660031901126102a1576103596107e9610482565b6107f1610498565b6044359161080083338361234a565b6123d0565b346102a15760203660031901126102a157600435600052600a6020526020600160406000200154604051908152f35b346102a15760003660031901126102a1576002546040516001600160a01b039091168152602090f35b346102a15760003660031901126102a15760405161010160f01b8152602090f35b346102a1576108c96020610891366102d6565b949290916108db60018060a01b03600154169360405197889687958695632d79c1e160e01b87526040600488015260448701916119ad565b848103600319016024860152916119ad565b03915afa80156109315761041e91600091610902575b506040519081529081906020820190565b610924915060203d60201161092a575b61091c818361152d565b81019061199e565b386108f1565b503d610912565b6119d1565b346102a15760403660031901126102a157610975600435610955610498565b9080600052600a6020526109706001604060002001546124de565b612591565b005b346102a15760003660031901126102a157602060ff60025460a01c16604051908152f35b346102a15760403660031901126102a1576109b4610498565b336001600160a01b038216036109d057610975906004356125fa565b60405163334bd91960e11b8152600490fd5b346102a15760203660031901126102a1576001600160a01b03610a03610482565b1660005260056020526020604060002054604051908152f35b346102a15760603660031901126102a1576001600160401b036004358181116102a157610a4d9036906004016102a6565b906024358381116102a157610a669036906004016102a6565b9190936044359081116102a157610a819036906004016104db565b93610a8a612285565b60209460009580820135875260038152610aaf61054760408920936040810190611a28565b8254815160019490918086161560081b600019018116861c8381148714610af35750505050505050845b1561062d5761034b61035392610af0953691611567565b80f35b80610b04575b505050505050610ad9565b8511600114610b5e575089528289209082018301918301906001905b6002828585100114610b3d5750505050505b388080808080610af9565b8251815403610b53575b91840191600101610b20565b8a9550859150610b47565b939291505001519060ff19160315610b32575084610b32565b60a06003198201126102a1576004356001600160a01b03811681036102a15791602435916001600160401b03916044358381116102a15782610bbb916004016104ae565b939093926064359182116102a157610bd5916004016104db565b9060843590565b346102a1576020610bfb610bef36610b77565b94939093929192611b4c565b6040519015158152f35b346102a15760403660031901126102a157602060ff610c39610c25610498565b600435600052600a84526040600020611a11565b54166040519015158152f35b346102a15760008060031936011261047f5760405181600954610c67816116f7565b9081845260209260019160018116908160001461045d5750600114610c965761041e856104128189038261152d565b929450600983528483205b828410610cbe575050508161041e93610412928201019338610402565b8054858501870152928501928101610ca1565b346102a15760003660031901126102a157602060405160008152f35b346102a15760403660031901126102a157610359610d09610482565b60243590336123d0565b346102a15760203660031901126102a157610359610d2f610482565b610d37612493565b61266d565b346102a1576003196020368201126102a1576004356001600160401b0381116102a1576101e0816004019282360301126102a157610de86105476109759383610dbc610db6610d916024610e32980185611a28565b610dae610da46044879594950188611a28565b94909236916115b5565b9236916115b5565b906128e3565b610dd1610dcb60648301611c97565b306129c5565b610ded610d37610de8610547610164850186611a28565b612a12565b610e1f610353610e01610184840185611ca1565b61034b610e156101a4879594950188611ca1565b9490923691611567565b608481013580610e37575b505080611a28565b61251f565b610e6991610e6391610e5e60a4610e54610de86105478980611a28565b9301358093612a51565b611cec565b30612a51565b3880610e2a565b346102a15760803660031901126102a157602435600435610e908261071f565b60443561ffff811681036102a1576001600160401b036064358181116102a157610ebe9036906004016104ae565b600154909390610ee490610ed8906001600160a01b031681565b6001600160a01b031690565b6040516329d2f02160e21b815260048101879052602097909291908884602481855afa978815610931578994600099610fb9575b50610f55610f386001610f2a8461198e565b01546001600160401b031690565b986040519788968795869562092e8760e71b875260048701611d13565b03915afa94851561093157600095610f9a575b505081811690831610610f925750905b604080519182526001600160401b03929092166020820152f35b905090610f78565b610fb1929550803d1061092a5761091c818361152d565b923880610f68565b610fda919950853d8711610fe1575b610fd2818361152d565b810190611cfe565b9738610f18565b503d610fc8565b346102a15760a03660031901126102a157611001610482565b6001600160401b0390602435906044358381116102a1576110269036906004016104ae565b90926064358581116102a1576110409036906004016104db565b906084359586116102a1577f89fecad7e82e777b95efd8da30d0290c555adcd7d5fd59c2bbd44752bc09ccab6111699561114b9561116161108760409a36906004016104ae565b9096611091612285565b6110ee8460009d8e8a8d6110c48b6110b685548a885195869460208601988c8a611b09565b03601f19810183528261152d565b519020815260046020522080546001600160a01b0319166001600160a01b03909216919091179055565b8b54998a9260405160208161112e6111108261110a8980611a7b565b90611d46565b8388013581528361112460408a018a611a7b565b9190920191611d46565b60ff606088013561113e81611616565b1681520301902099611d5b565b9860405195869560018060a01b03169886611d70565b0390a4611da0565b815580f35b346102a15760403660031901126102a15761097560043561118d610498565b9080600052600a6020526111a86001604060002001546124de565b6125fa565b346102a15760403660031901126102a15760206111f06111cb610482565b6111d3610498565b6001600160a01b0390911660009081526006845260409020611a11565b54604051908152f35b346102a1576020610bfb61120c36610b77565b94939093929192611daf565b611221366102d6565b61122c929192612493565b80820361132b5761123c82611df3565b9260005b8084116112eb5750600154939460209490919061129190611269906001600160a01b0316610ed8565b9361127333612ab1565b604051633bde546760e11b8152988997889687969360048801612045565b039134905af180156109315761041e916000916112bc575b5060405190151581529081906020820190565b6112de915060203d6020116112e4575b6112d6818361152d565b810190611e99565b386112a9565b503d6112cc565b8061130b61130661130061132694888b611e53565b3561198e565b611e7c565b6113158288611e68565b526113208187611e68565b50611da0565b611240565b60405163743be11560e11b8152600490fd5b346102a15760003660031901126102a1576001546040516001600160a01b039091168152602090f35b908082519081815260208091019281808460051b8301019501936000915b8483106113945750505050505090565b9091929394958480600192601f198582030186528951906113be6080835190808452830190610387565b91858060401b03848201511684830152604060ff81830151169083015260608091015115159101529801930193019194939290611384565b9060206103bd928181520190611366565b346102a1576020806003193601126102a1576004356001600160401b0381116102a1576114389036906004016102a6565b61144181611550565b926040611451604051958661152d565b828552601f1961146084611550565b019060005b8281106114b7575050505060005b808211611488576040518061041e86826113f6565b8061149d6105796113006114b2948688611e53565b6114a78287611e68565b526113208186611e68565b611473565b839082516114c4816114fa565b600060608083528185840152818684015282015282828a01015201611465565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761151557604052565b6114e4565b6001600160401b03811161151557604052565b601f909101601f19168101906001600160401b0382119082101761151557604052565b6001600160401b0381116115155760051b60200190565b929161157282611550565b91611580604051938461152d565b829481845260208094019160051b81019283116102a157905b8282106115a65750505050565b81358152908301908301611599565b9192916001600160401b03821161151557604051916115de601f8201601f19166020018461152d565b8294818452818301116102a1578281602093846000960137010152565b9080601f830112156102a1578160206103bd933591016115b5565b60ff8116036102a157565b801515036102a157565b92919061163781611550565b91604091611648604051948561152d565b839581855260208095019160051b8101938385116102a15781925b8584106116735750505050505050565b6001600160401b0384358181116102a1578401916080838803126102a157835161169c816114fa565b83359283116102a157836116b5898c96958796016115fb565b8252838101356116c48161071f565b84830152858101356116d581611616565b86830152606080910135906116e982611621565b820152815201930192611663565b90600182811c92168015611727575b602083101461171157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611706565b805460009392611740826116f7565b918282526020936001916001811690816000146117a85750600114611767575b5050505050565b90939495506000929192528360002092846000945b83861061179457505050500101903880808080611760565b80548587018301529401938590820161177c565b60ff19168685015250505090151560051b010191503880808080611760565b9190916080818403126102a157604051906117e1826114fa565b909283916001600160401b03919080358381116102a157826118049183016115fb565b84526020810135602085015260408101359283116102a15761182c60609392849383016115fb565b604085015201359161183d83611616565b0152565b97919561185a6118629261186a95999c9b9836916115b5565b9a36916115b5565b9436916115b5565b936001600160a01b03861615611986575b6118876105798361198e565b60208101519096906001600160401b0385811691161161197457606087015161061b576119056118fe60ff89946118f86118f26118ea60406118cf60025460ff9060a01c1690565b9901936118dd855160ff1690565b868b169687911691612ca0565b925160ff1690565b60ff1690565b90612ca0565b8233612d30565b9889156119625787848b9361195e9a51907f4ba393f2ef2da70e2b9689da0c6a653dad20a8811c0564cacfe3dc04b6a7d6eb85611941846122ab565b93611954896040519384933397856122f6565b0390a45134612d65565b9190565b604051636efa655f60e01b8152600490fd5b604051633527309d60e11b8152600490fd5b33955061187b565b6000526003602052604060002090565b908160209103126102a1575190565b81835290916001600160fb1b0383116102a15760209260051b809284830137010190565b6040513d6000823e3d90fd5b6001600160a01b0316600090815260056020526040902090565b6001600160a01b0316600090815260066020526040902090565b9060018060a01b0316600052602052604060002090565b903590601e19813603018212156102a157018035906001600160401b0382116102a1576020019181360383136102a157565b908060209392818452848401376000828201840152601f01601f1916010190565b9035601e19823603018112156102a1570160208101919035906001600160401b0382116102a15781360383136102a157565b90606060ff81611af6611ad1611ac38780611a7b565b608088526080880191611a5a565b60208701356020870152611ae86040880188611a7b565b908783036040890152611a5a565b940135611b0281611616565b1691015290565b9695949192608094611b4794611b399360018060a01b03168a5260208a015260a060408a015260a0890191611a5a565b908682036060880152611aad565b930152565b909492936001600160a01b038083169492938515611c8a578481611b838a6110b68b988860409d8e5196879560208701998a611b09565b5190206000526004602052866000209386855493841603611c7c576001600160a01b0319909216909355611bbc9261054e9136916115b5565b936020850191611bcf610579845161198e565b91825192611be5610595888a0195865190612c32565b611c6b5760600151611c5a57611c38600080516020612eba8339815191529493926105e7611c5293611c1b60608c015160ff1690565b9060ff80611c2f60025460ff9060a01c1690565b16921690612ca0565b915192519651611c47846122ab565b9651938493846122cb565b0390a4600190565b855163188e252560e11b8152600490fd5b8651637cb3947160e11b8152600490fd5b505050505050505050600090565b5050505050505050600090565b356103bd81611616565b903590601e19813603018212156102a157018035906001600160401b0382116102a157602001918160051b360383136102a157565b634e487b7160e01b600052601160045260246000fd5b91908203918211611cf957565b611cd6565b908160209103126102a157516103bd8161071f565b9081526001600160401b03909116602082015261ffff90911660408201526080606082018190526103bd93910191611a5a565b81908337600082820152601f01601f19160190565b81604051928392833781016000815203902090565b95949390611b4792606094611d92928952608060208a01526080890191611a5a565b908682036040880152611aad565b6000198114611cf95760010190565b92939060018060a01b0394858516968715611c8a57611ddd936110b69260405196879560208701998a611b09565b5190206000526004602052604060002054161490565b90611dfd82611550565b611e0a604051918261152d565b8281528092611e1b601f1991611550565b019060005b828110611e2c57505050565b806060602080938501015201611e20565b634e487b7160e01b600052603260045260246000fd5b9190811015611e635760051b0190565b611e3d565b8051821015611e635760209160051b010190565b90611e97611e909260405193848092611731565b038361152d565b565b908160209103126102a157516103bd81611621565b9035601e19823603018112156102a1570160208101919035906001600160401b0382116102a1578160051b360383136102a157565b90918092808252602080920191600593818360051b8701019581956000925b858410611f1457505050505050505090565b9091929394959697601f19808583030189528935603e19843603018112156102a157918388929301604091611f65611f5b611f4f8480611eae565b868552868501916119ad565b9285810190611eae565b9091858185039101528083528483019285828a1b8201019683956000915b848310611fa8575050505050505050806001929a019801940192919095949395611f02565b809294969850838a929496989a03018852883590607e19883603018212156102a1578e8091896001940190611fef6080611fe28480611a7b565b9091808552840191611a5a565b9183810135611ffd8161071f565b868060401b03168483015260ff8882013561201781611616565b168883015260608091013561202b81611621565b15159101529a019801930190918d97969492959395611f83565b91969593949261206061207092608085526080850190610387565b906020988483038a8601526119ad565b95818703604083015284518088528188019180808360051b8b01019701926000905b8382106120b15750505050506103bd9495506060818503910152611ee3565b909192939783806120cf6001938e601f199082030186528c51610387565b9a019201920190939291612092565b906040516120eb816114fa565b606060ff6001839560405161210b816121048185611731565b038261152d565b855201546001600160401b0381166020850152604081811c83169085015260481c161515910152565b9092916040820191604081528451809352606081019260208096019060005b818110612170575050506103bd9394506020818403910152611366565b825186529487019491870191600101612153565b907f000000000000000000000000481d89337abcb336bdfa422e85af8aa88919b3426001600160a01b031690813b156102a1576040916040518091631cfa86f360e31b825260009283918183816121df898c60048401612134565b03925af1801561093157612276575b5090835181510361132b57815b808551111561223a57806122306122156122359385611e68565b516122208389611e68565b5186526003602052868620612ae8565b611da0565b6121fb565b507f25bb14184ed47336f0e8c5b9b58e65ca31a0cfd0cf8eb80cd59b5005339b4db692506122719150604051918291339583612134565b0390a2565b61227f9061151a565b386121ee565b6001546001600160a01b0316330361229957565b6040516347b3ba4760e01b8152600490fd5b6122c390602060405192828480945193849201610364565b810103902090565b916122e8906103bd94928452606060208501526060840190610387565b916040818403910152610387565b94939261231e606093611b479360018060a01b03168852608060208901526080880190610387565b908682036040880152610387565b604091949392606082019560018060a01b0316825260208201520152565b919060018060a01b038084169081600052600660205261236e836040600020611a11565b549160018301612381575b505050505050565b8483106123af57156106e8578216156106cf576123a3926106929103936119f7565b55388080808080612379565b604051637dc7a0d960e11b8152806123cc8786886004850161232c565b0390fd5b916001600160a01b038084169290831561247a578116938415612461576123f6816119dd565b548381106124435761243e928492612422600080516020612e7a833981519152966124289403916119dd565b556119dd565b8054820190556040519081529081906020820190565b0390a3565b906123cc8460405193849363391434e360e21b85526004850161232c565b60405163ec442f0560e01b815260006004820152602490fd5b604051634b637e8f60e11b815260006004820152602490fd5b60008052600a60205260ff6124b633600080516020612e9a833981519152611a11565b5416156124bf57565b60405163e2517d3f60e01b815233600482015260006024820152604490fd5b80600052600a60205260ff6124f7336040600020611a11565b5416156125015750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b6000808052600a60205260ff61254383600080516020612e9a833981519152611a11565b541661258c57808052600a60205261255e8260408320611a11565b805460ff1916600117905533916001600160a01b031690600080516020612e5a8339815191528180a4600190565b905090565b600090808252600a60205260ff6125ab8460408520611a11565b54166125f457808252600a6020526125c68360408420611a11565b805460ff1916600117905533926001600160a01b031691600080516020612e5a8339815191529080a4600190565b50905090565b600090808252600a60205260ff6126148460408520611a11565b5416156125f457808252600a6020526126308360408420611a11565b805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b6001600160a01b037f000000000000000000000000481d89337abcb336bdfa422e85af8aa88919b342811691823b156102a157600091602483926040519485938492636428e61960e11b845216968760048401525af1801561093157612711575b50600180546001600160a01b0319168217905560405190815233907f8ab4cea230ab04f96aaa9a71fbc4bfa98097c7b9f07e06be33868b500f81002890602090a2565b61271a9061151a565b386126ce565b81811061272b575050565b60008155600101612720565b90601f8211612744575050565b611e979160086000526020600020906020601f840160051c83019310612772575b601f0160051c0190612720565b9091508190612765565b90601f8211612789575050565b611e979160096000526020600020906020601f840160051c8301931061277257601f0160051c0190612720565b9190601f81116127c557505050565b611e97926000526020600020906020601f840160051c8301931061277257601f0160051c0190612720565b8160011b916000199060031b1c19161790565b80519091906001600160401b0381116115155761282a816128256009546116f7565b61277c565b602080601f831160011461285f5750819061284f9394600092612854575b50506127f0565b600955565b015190503880612848565b6009600052601f198316949091907f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af926000905b8782106128cb5750508360019596106128b2575b505050811b01600955565b015160001960f88460031b161c191690553880806128a7565b80600185968294968601518155019501930190612893565b8051906001600160401b03821161151557612908826129036008546116f7565b612737565b602090816001601f8511146129395750918061293192611e9795946000926128545750506127f0565b600855612803565b60086000529190601f1984167ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3936000905b8282106129ad575050916001939185611e9797969410612994575b505050811b01600855612803565b015160001960f88460031b161c19169055388080612986565b8060018697829497870151815501960194019061296b565b90600054612a0057600280546001600160a81b0319166001600160a01b039093169290921760a09190911b60ff60a01b161790556001600055565b60405163180cbc2160e21b8152600490fd5b80516020909101516001600160601b031991828216919060148110612a3c575b5050905060601c90565b8391925060140360031b1b1616803880612a32565b9060075490808201809211611cf9576020600080516020612e7a8339815191529160009360075560018060a01b0385169485158514612a9d575080600754036007555b604051908152a3565b612aa6906119dd565b818154019055612a94565b6040805160609290921b6001600160601b03191660208301526014825281016001600160401b038111828210176115155760405290565b8151805190939291906001600160401b03811161151557612b1381612b0d84546116f7565b846127b6565b602080601f8311600114612bb75750612b9d92612b4383606094600194611e97999a6000926128545750506127f0565b81555b6020850151910180546001600160401b0319166001600160401b0390921691909117815592612b96612b7c604083015160ff1690565b855460ff60401b191660409190911b60ff60401b16178555565b0151151590565b815460ff60481b191690151560481b60ff60481b16179055565b90601f19831696612bcd85600052602060002090565b926000905b898210612c1a57505083600193612b9d96938593606097611e979b9c10612c01575b505050811b018155612b46565b015160001960f88460031b161c19169055388080612bf4565b80600185968294968601518155019501930190612bd2565b60019181519181518314600114612c4c5750505050600090565b600160208080958185019401019301915b6002828583100114612c7157505050505090565b8251815103612c86575b918401918401612c5d565b60009550859150612c7b565b604d8111611cf957600a0a90565b919080821115612cd0578103908111611cf957612cbc90612c92565b90818102918183041490151715611cf95790565b90818110612cdd57505090565b8103908111611cf957612cef90612c92565b908115612cfa570490565b634e487b7160e01b600052601260045260246000fd5b81306001600160a01b03831603612d2657505090565b6103bd91306123d0565b6103bd918391826001600160a01b0380831690841603612d54575b505030906123d0565b612d5e918361234a565b3882612d4b565b9497919395909296600160a01b60019003600154169733612d8590612ab1565b926040519a8b998a9889986332a68c8d60e01b8a5260048a0161012090526101248a01612db191610387565b9660031997888b82030160248c0152612dc991610387565b878a82030160448b0152612ddc91610387565b606489019490945260ff16608488015260a48701526001600160401b031660c4860152848103830160e4860152612e1291610387565b9083820301610104840152612e2691610387565b03915a94602095f190811561093157600091612e40575090565b6103bd915060203d6020116112e4576112d6818361152d56fe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0dddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e357349f3521319d500766c25bbf2260c005d16a7164533a3596bd7a2790679911a2646970667358221220eeaf18bf07f94975fd6636d111e10915f7a6797cedf4499595a33c2036f497e064736f6c63430008180033

[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.