FRAX Price: $0.91 (-0.39%)

Contract

0x2Db3B92918eCE265C7d5D9D975c69d89b8b1136C

Overview

FRAX Balance | FXTL Balance

0 FRAX | 2,804 FXTL

FRAX Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

1 address found via
Transaction Hash
Block
From
To
Portal156820572025-01-29 18:20:25363 days ago1738174825IN
0x2Db3B929...9b8b1136C
0 FRAX0.000001540.00110025
Portal136476702024-12-13 16:07:31410 days ago1734106051IN
0x2Db3B929...9b8b1136C
0.002 FRAX0.000006690.00010025
Portal132155712024-12-03 16:04:13420 days ago1733241853IN
0x2Db3B929...9b8b1136C
0.00028066 FRAX0.000031570.00110025
Portal132150052024-12-03 15:45:21420 days ago1733240721IN
0x2Db3B929...9b8b1136C
0.00028033 FRAX0.00003350.00110025
Portal132147682024-12-03 15:37:27420 days ago1733240247IN
0x2Db3B929...9b8b1136C
0 FRAX0.000064010.00110025
Portal132146952024-12-03 15:35:01420 days ago1733240101IN
0x2Db3B929...9b8b1136C
0.00028033 FRAX0.000027560.00110025
Portal132126452024-12-03 14:26:41420 days ago1733236001IN
0x2Db3B929...9b8b1136C
0.00056214 FRAX0.000075990.00110025
Transfer Ownersh...121185412024-11-08 6:36:33445 days ago1731047793IN
0x2Db3B929...9b8b1136C
0 FRAX0.000000840.00110025
Portal110948452024-10-15 13:53:21469 days ago1729000401IN
0x2Db3B929...9b8b1136C
0 FRAX0.000024630.00010025
Portal110850872024-10-15 8:28:05469 days ago1728980885IN
0x2Db3B929...9b8b1136C
0.001 FRAX0.000013510.00010025

Latest 6 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
136476702024-12-13 16:07:31410 days ago1734106051
0x2Db3B929...9b8b1136C
0.002 FRAX
132155712024-12-03 16:04:13420 days ago1733241853
0x2Db3B929...9b8b1136C
0.00028066 FRAX
132150052024-12-03 15:45:21420 days ago1733240721
0x2Db3B929...9b8b1136C
0.00028033 FRAX
132146952024-12-03 15:35:01420 days ago1733240101
0x2Db3B929...9b8b1136C
0.00028033 FRAX
132126452024-12-03 14:26:41420 days ago1733236001
0x2Db3B929...9b8b1136C
0.00056214 FRAX
110850872024-10-15 8:28:05469 days ago1728980885
0x2Db3B929...9b8b1136C
0.001 FRAX

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PortalsRouter

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
paris EvmVersion
/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice This contract routes ERC20 and native tokens to the Portals Multicall contract to
/// transform an input token into a minimum quantity of an output token.

pragma solidity 0.8.19;

import { IPortalsRouter } from "./interface/IPortalsRouter.sol";
import { IPortalsMulticall } from
    "../multicall/interface/IPortalsMulticall.sol";
import { RouterBase } from "./RouterBase.sol";

contract PortalsRouter is RouterBase {
    constructor(address _admin, IPortalsMulticall _multicall)
        RouterBase(_admin, _multicall)
    { }

    /// @notice This function is the simplest entry point for the Portals Router. It is intended
    /// to be called by the sender of the order (i.e. msg.sender).
    /// @param orderPayload The order payload containing the details of the trade
    /// @param partner The front end operator address
    /// @return outputAmount The quantity of outputToken received after validation of the order
    function portal(
        IPortalsRouter.OrderPayload calldata orderPayload,
        address partner
    ) public payable whenNotPaused returns (uint256 outputAmount) {
        return _execute(
            msg.sender,
            orderPayload.order,
            orderPayload.calls,
            _transferFromSender(
                msg.sender,
                orderPayload.order.inputToken,
                orderPayload.order.inputAmount
            ),
            partner
        );
    }

    /// @notice This function calls permit prior to the portal function for gasless approvals. It is intended
    /// to be called by the sender of the order (i.e. msg.sender).
    /// @param orderPayload The order payload containing the details of the trade
    /// @param permitPayload The permit payload struct containing the details of the permit
    /// @param partner The front end operator address
    /// @return outputAmount The quantity of outputToken received after validation of the order
    function portalWithPermit(
        IPortalsRouter.OrderPayload calldata orderPayload,
        IPortalsRouter.PermitPayload calldata permitPayload,
        address partner
    ) external whenNotPaused returns (uint256 outputAmount) {
        _permit(
            msg.sender, orderPayload.order.inputToken, permitPayload
        );
        return portal(orderPayload, partner);
    }

    /// This function uses Portals signed orders to facilitate gasless portals. It is intended
    /// to be called by a broadcaster (i.e. msg.sender != order.sender).
    /// @param signedOrderPayload The signed order payload containing the details of the signed order
    /// @param partner The front end operator address
    /// @return outputAmount The quantity of outputToken received after validation of the order
    function portalWithSignature(
        IPortalsRouter.SignedOrderPayload calldata signedOrderPayload,
        address partner
    ) public whenNotPaused returns (uint256 outputAmount) {
        _verify(signedOrderPayload);
        return _execute(
            signedOrderPayload.signedOrder.sender,
            signedOrderPayload.signedOrder.order,
            signedOrderPayload.calls,
            _transferFromSender(
                signedOrderPayload.signedOrder.sender,
                signedOrderPayload.signedOrder.order.inputToken,
                signedOrderPayload.signedOrder.order.inputAmount
            ),
            partner
        );
    }

    /// @notice This function calls permit prior to the portalWithSignature function for gasless approvals,
    /// in addition to gassless Portals. It is intended to be called by a broadcaster (i.e. msg.sender != order.sender).
    /// @param signedOrderPayload The signed order payload containing the details of the signed order
    /// @param permitPayload The permit payload struct containing the details of the permit
    /// @param partner The front end operator address
    /// @return outputAmount The quantity of outputToken received after validation of the order
    function portalWithSignatureAndPermit(
        IPortalsRouter.SignedOrderPayload calldata signedOrderPayload,
        IPortalsRouter.PermitPayload calldata permitPayload,
        address partner
    ) external whenNotPaused returns (uint256 outputAmount) {
        _permit(
            signedOrderPayload.signedOrder.sender,
            signedOrderPayload.signedOrder.order.inputToken,
            permitPayload
        );

        return portalWithSignature(signedOrderPayload, partner);
    }

    /// @notice This function executes calls to transform a sell token into a buy token.
    /// The outputAmount of the outputToken specified in the order is validated against the minOutputAmount following the
    /// aggregate call of Portals Multicall.
    /// @param sender The sender(signer) of the order
    /// @param order The order struct containing the details of the trade
    /// @param calls The array of calls to be executed by the Portals Multicall
    /// @param value The value of native tokens to be sent to the Portals Multicall
    /// @param partner The front end operator address
    /// @return outputAmount The quantity of outputToken received after validation of the order
    function _execute(
        address sender,
        IPortalsRouter.Order calldata order,
        IPortalsMulticall.Call[] calldata calls,
        uint256 value,
        address partner
    ) private returns (uint256 outputAmount) {
        outputAmount = _getBalance(order.recipient, order.outputToken);

        PORTALS_MULTICALL.aggregate{ value: value }(calls);

        outputAmount = _getBalance(order.recipient, order.outputToken)
            - outputAmount;

        if (outputAmount < order.minOutputAmount) {
            revert InsufficientBuy(
                outputAmount, order.minOutputAmount
            );
        }

        emit Portal(
            order.inputToken,
            order.inputAmount,
            order.outputToken,
            outputAmount,
            sender,
            msg.sender,
            order.recipient,
            partner
        );
    }
}

File 2 of 21 : IPortalsRouter.sol
/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice Interface for the Portals Router contract

pragma solidity 0.8.19;

import { IPortalsMulticall } from
    "../..//multicall/interface/IPortalsMulticall.sol";

interface IPortalsRouter {
    /// @param inputToken The ERC20 token address to spend (address(0) if network token)
    /// @param inputAmount The quantity of inputToken to Portal
    /// @param outputToken The ERC20 token address to buy (address(0) if network token)
    /// @param minOutputAmount The minimum acceptable quantity of outputToken to receive. Reverts otherwise.
    /// @param recipient The recipient of the outputToken
    struct Order {
        address inputToken;
        uint256 inputAmount;
        address outputToken;
        uint256 minOutputAmount;
        address recipient;
    }

    /// @param order The order containing the details of the trade
    /// @param calls The calls to be executed in the aggregate function of PortalsMulticall.sol to transform
    /// inputToken to outputToken
    struct OrderPayload {
        Order order;
        IPortalsMulticall.Call[] calls;
    }

    /// @param order The order containing the details of the trade
    /// @param routeHash The hash of the abi encoded calls array
    /// @param sender The signer of the order and the sender of the inputToken
    /// @param deadline The deadline after which the order is no longer valid
    /// @param nonce The nonce of the sender(signer)
    struct SignedOrder {
        Order order;
        bytes32 routeHash;
        address sender;
        uint64 deadline;
        uint64 nonce;
    }

    /// @param signedOrder The signed order containing the details of the trade
    /// @param signature The signature of the signed order
    /// @param calls The calls to be executed in the aggregate function of PortalsMulticall.sol to transform
    /// inputToken to outputToken
    struct SignedOrderPayload {
        SignedOrder signedOrder;
        bytes signature;
        IPortalsMulticall.Call[] calls;
    }

    /// @dev The signer of the permit message must be the msg.sender of the Order or signer of the SignedOrder
    /// @param amount The quantity of tokens to be spent
    /// @param deadline The timestamp after which the Permit is no longer valid
    /// @param signature The signature of the Permit
    /// @param splitSignature Whether the signature is split into r, s, and v
    /// @param daiPermit Whether the Permit is a DAI Permit (i.e not  EIP-2612)
    struct PermitPayload {
        uint256 amount;
        uint256 deadline;
        bytes signature;
        bool splitSignature;
        bool daiPermit;
    }
}

/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice Interface for the Portals Multicall contract

pragma solidity 0.8.19;

interface IPortalsMulticall {
    /// @dev Describes a call to be executed in the aggregate function of PortalsMulticall.sol
    /// @param inputToken The token to sell
    /// @param target The target contract to call
    /// @param data The data to call the target contract with
    /// @param amountIndex The index of the quantity of inputToken in the data
    struct Call {
        address inputToken;
        address target;
        bytes data;
        uint256 amountIndex;
    }

    /// @dev Executes a series of calls in a single transaction
    /// @param calls An array of Call to execute
    function aggregate(Call[] calldata calls) external payable;
}

/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice Base contract inherited by the Portals Router

pragma solidity 0.8.19;

import { IRouterBase } from "./interface/IRouterBase.sol";
import { IPortalsRouter } from "./interface/IPortalsRouter.sol";
import { IPortalsMulticall } from
    "../multicall/interface/IPortalsMulticall.sol";
import { IPermit } from "./interface/IPermit.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import { Owned } from "solmate/auth/Owned.sol";
import { SignatureChecker } from
    "openzeppelin-contracts/utils/cryptography/SignatureChecker.sol";
import { Pausable } from
    "openzeppelin-contracts/security/Pausable.sol";
import { EIP712 } from
    "openzeppelin-contracts/utils/cryptography/EIP712.sol";

abstract contract RouterBase is
    IRouterBase,
    Owned,
    Pausable,
    EIP712
{
    using SafeTransferLib for address;
    using SafeTransferLib for ERC20;

    IPortalsMulticall immutable PORTALS_MULTICALL;

    bytes32 private constant EIP712_DOMAIN_TYPEHASH = keccak256(
        abi.encodePacked(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        )
    );

    bytes32 private constant ORDER_TYPEHASH = keccak256(
        abi.encodePacked(
            "Order(address inputToken,uint256 inputAmount,address outputToken,uint256 minOutputAmount,address recipient)"
        )
    );

    bytes32 private constant SIGNED_ORDER_TYPEHASH = keccak256(
        abi.encodePacked(
            "SignedOrder(Order order,bytes32 routeHash,address sender,uint64 deadline,uint64 nonce)Order(address inputToken,uint256 inputAmount,address outputToken,uint256 minOutputAmount,address recipient)"
        )
    );

    //Order nonces
    mapping(address => uint64) public nonces;

    constructor(address _admin, IPortalsMulticall _multicall)
        Owned(_admin)
        EIP712("PortalsRouter", "1")
    {
        PORTALS_MULTICALL = _multicall;
    }

    /// @notice Transfers tokens or the network token from the sender to the Portals multicall contract
    /// @param sender The address of the owner of the tokens
    /// @param token The address of the token to transfer (address(0) if network token)
    /// @param quantity The quantity of tokens to transfer from the caller
    /// @return value The quantity of network tokens to be transferred to the Portals Multicall contract
    function _transferFromSender(
        address sender,
        address token,
        uint256 quantity
    ) internal returns (uint256) {
        if (token == address(0)) {
            require(
                msg.value != 0, "PortalsRouter: Invalid msg.value"
            );
            return msg.value;
        }

        require(
            msg.value == 0 && quantity != 0,
            "PortalsRouter: Invalid quantity or msg.value"
        );
        ERC20(token).safeTransferFrom(
            sender, address(PORTALS_MULTICALL), quantity
        );
        return 0;
    }

    /// @notice Get the ERC20 or network token balance of an account
    /// @param account The owner of the tokens or network tokens whose balance is being queried
    /// @param token The address of the token (address(0) if network token)
    /// @return The accounts's token or network token balance
    function _getBalance(address account, address token)
        internal
        view
        returns (uint256)
    {
        if (token == address(0)) {
            return account.balance;
        } else {
            return ERC20(token).balanceOf(account);
        }
    }

    /// @notice Signature verification function to verify Portals signed orders. Supports both ECDSA
    /// signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets
    /// @dev Returns nothing if the order is valid but reverts if the signature is invalid
    /// @param signedOrderPayload The signed order payload to verify
    function _verify(
        IPortalsRouter.SignedOrderPayload calldata signedOrderPayload
    ) internal {
        require(
            signedOrderPayload.signedOrder.deadline >= block.timestamp,
            "PortalsRouter: Order expired"
        );

        bytes32 orderHash = keccak256(
            abi.encode(
                ORDER_TYPEHASH,
                signedOrderPayload.signedOrder.order.inputToken,
                signedOrderPayload.signedOrder.order.inputAmount,
                signedOrderPayload.signedOrder.order.outputToken,
                signedOrderPayload.signedOrder.order.minOutputAmount,
                signedOrderPayload.signedOrder.order.recipient
            )
        );
        bytes32 signedOrderHash = keccak256(
            abi.encode(
                SIGNED_ORDER_TYPEHASH,
                orderHash,
                keccak256(abi.encode(signedOrderPayload.calls)),
                signedOrderPayload.signedOrder.sender,
                signedOrderPayload.signedOrder.deadline,
                nonces[signedOrderPayload.signedOrder.sender]++
            )
        );

        bytes32 digest = _hashTypedDataV4(signedOrderHash);

        require(
            SignatureChecker.isValidSignatureNow(
                signedOrderPayload.signedOrder.sender,
                digest,
                signedOrderPayload.signature
            ),
            "PortalsRouter: Invalid signature"
        );
    }

    /// @notice Permit function for gasless approvals. Supports both EIP-2612 and DAI style permits with
    /// split signatures, as well as Yearn like permits with combined signatures
    /// @param owner The address which is a source of funds and has signed the Permit
    /// @param token The address of the token to permit
    /// @param permitPayload The permit payload containing the permit parameters
    /// @dev See IPermit.sol for more details
    function _permit(
        address owner,
        address token,
        IPortalsRouter.PermitPayload calldata permitPayload
    ) internal {
        if (permitPayload.splitSignature) {
            bytes memory signature = permitPayload.signature;
            bytes32 r;
            bytes32 s;
            uint8 v;
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            if (permitPayload.daiPermit) {
                IPermit(token).permit(
                    owner,
                    address(this),
                    ERC20(token).nonces(owner),
                    permitPayload.deadline,
                    true,
                    v,
                    r,
                    s
                );
            } else {
                IPermit(token).permit(
                    owner,
                    address(this),
                    permitPayload.amount,
                    permitPayload.deadline,
                    v,
                    r,
                    s
                );
            }
        } else {
            IPermit(token).permit(
                owner,
                address(this),
                permitPayload.amount,
                permitPayload.deadline,
                permitPayload.signature
            );
        }
    }

    /// @notice The EIP712 domain separator of this contract
    function domainSeparator() external view returns (bytes32) {
        return _domainSeparatorV4();
    }

    /// @notice Invalidates the next order of msg.sender
    /// @notice Orders that have already been confirmed are not invalidated
    function invalidateNextOrder() external {
        ++nonces[msg.sender];
    }

    /// @dev Pause the contract
    function pause() external onlyOwner {
        _pause();
    }

    /// @dev Unpause the contract
    function unpause() external onlyOwner {
        _unpause();
    }

    /// @notice Recovers stuck tokens
    /// @param tokenAddress The address of the token to recover (address(0) if ETH)
    /// @param tokenAmount The quantity of tokens to recover
    /// @param to The address to send the recovered tokens to
    function recoverToken(
        address tokenAddress,
        uint256 tokenAmount,
        address to
    ) external onlyOwner {
        if (tokenAddress == address(0)) {
            to.safeTransferETH(tokenAmount);
        } else {
            ERC20(tokenAddress).safeTransfer(to, tokenAmount);
        }
    }
}

File 5 of 21 : IRouterBase.sol
/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice Interface for the Base contract inherited by the Portals Router

pragma solidity 0.8.19;

interface IRouterBase {
    /// @notice Emitted when Portalling
    /// @param inputToken The ERC20 token address to spend (address(0) if network token)
    /// @param inputAmount The quantity of inputToken to send
    /// @param outputToken The ERC20 token address to buy (address(0) if network token)
    /// @param outputAmount The quantity of outputToken received
    /// @param sender The sender(signer) of the order
    /// @param broadcaster The msg.sender of the broadcasted transaction
    /// @param recipient The recipient of the outputToken
    /// @param partner The front end operator address
    event Portal(
        address inputToken,
        uint256 inputAmount,
        address outputToken,
        uint256 outputAmount,
        address indexed sender,
        address indexed broadcaster,
        address recipient,
        address indexed partner
    );

    /// Thrown when insufficient liquidity is received after deposit or withdrawal
    /// @param outputAmount The amount of liquidity received
    /// @param minOutputAmount The minimum acceptable quantity of liquidity received
    error InsufficientBuy(
        uint256 outputAmount, uint256 minOutputAmount
    );
}

/// SPDX-License-Identifier: unlicensed

/// @author Portals.fi
/// @notice Various Permit functions for ERC20 tokens

pragma solidity 0.8.19;

interface IPermit {
    /// @notice EIP-2612 Permit
    /// @param owner The address which is a source of funds and has signed the Permit.
    /// @param spender The address which is allowed to spend the funds.
    /// @param value The quantity of tokens to be spent.
    /// @param deadline The timestamp after which the Permit is no longer valid.
    /// @param v A valid secp256k1 signature of Permit by owner
    /// @param r A valid secp256k1 signature of Permit by owner
    /// @param s A valid secp256k1 signature of Permit by owner
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /// @notice Yearn style permit
    /// @param owner The address which is a source of funds and has signed the Permit.
    /// @param spender The address which is allowed to spend the funds.
    /// @param amount The amount of tokens to be spent.
    /// @param expiry The timestamp after which the Permit is no longer valid.
    /// @param signature A valid secp256k1 signature of Permit by owner encoded as
    /// r, s, v.
    /// @return True, if transaction completes successfully
    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 expiry,
        bytes calldata signature
    ) external returns (bool);

    /// @notice DAI style permit
    /// @param holder The address which is a source of funds and has signed the Permit.
    /// @param spender The address which is allowed to spend the funds.
    /// @param nonce The nonce of the spender
    /// @param expiry The timestamp after which the Permit is no longer valid.
    /// @param allowed Determines if the spender is allowed to spend the funds.
    /// @param v A valid secp256k1 signature of Permit by owner
    /// @param r A valid secp256k1 signature of Permit by owner
    /// @param s A valid secp256k1 signature of Permit by owner
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

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

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

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

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

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

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Simple single owner authorization mixin.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
abstract contract Owned {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

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

    /*//////////////////////////////////////////////////////////////
                            OWNERSHIP STORAGE
    //////////////////////////////////////////////////////////////*/

    address public owner;

    modifier onlyOwner() virtual {
        require(msg.sender == owner, "UNAUTHORIZED");

        _;
    }

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(address _owner) {
        owner = _owner;

        emit OwnershipTransferred(address(0), _owner);
    }

    /*//////////////////////////////////////////////////////////////
                             OWNERSHIP LOGIC
    //////////////////////////////////////////////////////////////*/

    function transferOwnership(address newOwner) public virtual onlyOwner {
        owner = newOwner;

        emit OwnershipTransferred(msg.sender, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";
import "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Gnosis Safe.
 *
 * _Available since v4.1._
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 *
 * _Available since v4.1._
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

File 17 of 21 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "solmate/=lib/solmate/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "surl/=lib/surl/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solidity-stringutils/=lib/surl/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"contract IPortalsMulticall","name":"_multicall","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"}],"name":"InsufficientBuy","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"broadcaster","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"address","name":"partner","type":"address"}],"name":"Portal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"invalidateNextOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IPortalsRouter.Order","name":"order","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct IPortalsMulticall.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct IPortalsRouter.OrderPayload","name":"orderPayload","type":"tuple"},{"internalType":"address","name":"partner","type":"address"}],"name":"portal","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IPortalsRouter.Order","name":"order","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct IPortalsMulticall.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct IPortalsRouter.OrderPayload","name":"orderPayload","type":"tuple"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"splitSignature","type":"bool"},{"internalType":"bool","name":"daiPermit","type":"bool"}],"internalType":"struct IPortalsRouter.PermitPayload","name":"permitPayload","type":"tuple"},{"internalType":"address","name":"partner","type":"address"}],"name":"portalWithPermit","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IPortalsRouter.Order","name":"order","type":"tuple"},{"internalType":"bytes32","name":"routeHash","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct IPortalsRouter.SignedOrder","name":"signedOrder","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct IPortalsMulticall.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct IPortalsRouter.SignedOrderPayload","name":"signedOrderPayload","type":"tuple"},{"internalType":"address","name":"partner","type":"address"}],"name":"portalWithSignature","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IPortalsRouter.Order","name":"order","type":"tuple"},{"internalType":"bytes32","name":"routeHash","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct IPortalsRouter.SignedOrder","name":"signedOrder","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct IPortalsMulticall.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct IPortalsRouter.SignedOrderPayload","name":"signedOrderPayload","type":"tuple"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"splitSignature","type":"bool"},{"internalType":"bool","name":"daiPermit","type":"bool"}],"internalType":"struct IPortalsRouter.PermitPayload","name":"permitPayload","type":"tuple"},{"internalType":"address","name":"partner","type":"address"}],"name":"portalWithSignatureAndPermit","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101806040523480156200001257600080fd5b50604051620028cf380380620028cf833981016040819052620000359162000237565b604080518082018252600d81526c2837b93a30b639a937baba32b960991b6020808301919091528251808401845260018152603160f81b91810191909152600080546001600160a01b0319166001600160a01b0387169081178255935186948694939286927f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506000805460ff60a01b19169055620000da82600162000199565b61012052620000eb81600262000199565b61014052815160208084019190912060e052815190820120610100524660a0526200017960e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b031661016052506200045c915050565b6000602083511015620001b957620001b183620001d2565b9050620001cc565b81620001c684826200031b565b5060ff90505b92915050565b600080829050601f8151111562000209578260405163305a27a960e01b8152600401620002009190620003e7565b60405180910390fd5b8051620002168262000437565b179392505050565b6001600160a01b03811681146200023457600080fd5b50565b600080604083850312156200024b57600080fd5b825162000258816200021e565b60208401519092506200026b816200021e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002a157607f821691505b602082108103620002c257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200031657600081815260208120601f850160051c81016020861015620002f15750805b601f850160051c820191505b818110156200031257828155600101620002fd565b5050505b505050565b81516001600160401b0381111562000337576200033762000276565b6200034f816200034884546200028c565b84620002c8565b602080601f8311600181146200038757600084156200036e5750858301515b600019600386901b1c1916600185901b17855562000312565b600085815260208120601f198616915b82811015620003b85788860151825594840194600190910190840162000397565b5085821015620003d75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b818110156200041657858101830151858201604001528201620003f8565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620002c25760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051612406620004c960003960008181610e740152610ed10152600061048f01526000610464015260006116c70152600061169f015260006115fa015260006116240152600061164e01526124066000f3fe6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063d04323c511610059578063d04323c514610299578063de4d0cba146102b9578063f2fde38b146102ce578063f698da25146102ee57600080fd5b80638da5cb5b146102145780639d02210114610266578063a2e42c651461028657600080fd5b80637ecebe00116100bb5780637ecebe00146101675780638456cb59146101b757806384b0196e146101cc578063864a1b32146101f457600080fd5b80633f4ba83a146100e25780635c975abb146100f95780637274ffd814610139575b600080fd5b3480156100ee57600080fd5b506100f7610303565b005b34801561010557600080fd5b5060005474010000000000000000000000000000000000000000900460ff1660405190151581526020015b60405180910390f35b34801561014557600080fd5b50610159610154366004611cd3565b610379565b604051908152602001610130565b34801561017357600080fd5b5061019e610182366004611d21565b60036020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610130565b3480156101c357600080fd5b506100f76103e7565b3480156101d857600080fd5b506101e1610456565b6040516101309796959493929190611d8c565b34801561020057600080fd5b5061015961020f366004611e6f565b6104fb565b34801561022057600080fd5b506000546102419073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610130565b34801561027257600080fd5b50610159610281366004611ee3565b610530565b610159610294366004611f1c565b610564565b3480156102a557600080fd5b506100f76102b4366004611f52565b610591565b3480156102c557600080fd5b506100f7610659565b3480156102da57600080fd5b506100f76102e9366004611d21565b6106a8565b3480156102fa57600080fd5b5061015961077f565b60005473ffffffffffffffffffffffffffffffffffffffff16331461036f5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b61037761078e565b565b600061038361080b565b61038c83610876565b6103de61039f60e0850160c08601611d21565b846103ae610140820182611f85565b6103d86103c160e08a0160c08b01611d21565b6103ce60208b018b611d21565b60208b0135610d64565b87610ea3565b90505b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044e5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b6103776110a1565b60006060808280808361048a7f00000000000000000000000000000000000000000000000000000000000000006001611110565b6104b57f00000000000000000000000000000000000000000000000000000000000000006002611110565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600061050561080b565b61051c336105166020870187611d21565b856111bb565b6105268483610564565b90505b9392505050565b600061053a61080b565b61055a61054d60e0860160c08701611d21565b6105166020870187611d21565b6105268483610379565b600061056e61080b565b6103de338461058060a0820182611f85565b6103d8336103ce60208b018b611d21565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105f85760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b73ffffffffffffffffffffffffffffffffffffffff83166106385761063373ffffffffffffffffffffffffffffffffffffffff8216836114e6565b505050565b61063373ffffffffffffffffffffffffffffffffffffffff84168284611541565b33600090815260036020526040812080549091906106809067ffffffffffffffff1661201c565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550565b60005473ffffffffffffffffffffffffffffffffffffffff16331461070f5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60006107896115e0565b905090565b610796611718565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60005474010000000000000000000000000000000000000000900460ff16156103775760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610366565b42610888610100830160e08401612043565b67ffffffffffffffff1610156108e05760405162461bcd60e51b815260206004820152601c60248201527f506f7274616c73526f757465723a204f726465722065787069726564000000006044820152606401610366565b6000604051602001610987907f4f72646572286164647265737320696e707574546f6b656e2c75696e7432353681527f20696e707574416d6f756e742c61646472657373206f7574707574546f6b656e60208201527f2c75696e74323536206d696e4f7574707574416d6f756e742c6164647265737360408201527f20726563697069656e74290000000000000000000000000000000000000000006060820152606b0190565b60408051601f198184030181529190528051602091820120906109ac90840184611d21565b60208401356109c16060860160408701611d21565b60608601356109d660a0880160808901611d21565b60408051602081019790975273ffffffffffffffffffffffffffffffffffffffff958616908701526060860193909352908316608085015260a08401521660c082015260e0016040516020818303038152906040528051906020012090506000604051602001610b4d907f5369676e65644f72646572284f72646572206f726465722c627974657333322081527f726f757465486173682c616464726573732073656e6465722c75696e7436342060208201527f646561646c696e652c75696e743634206e6f6e6365294f72646572286164647260408201527f65737320696e707574546f6b656e2c75696e7432353620696e707574416d6f7560608201527f6e742c61646472657373206f7574707574546f6b656e2c75696e74323536206d60808201527f696e4f7574707574416d6f756e742c6164647265737320726563697069656e7460a08201527f290000000000000000000000000000000000000000000000000000000000000060c082015260c10190565b60408051601f19818403018152919052805160209091012082610b74610140860186611f85565b604051602001610b85929190612098565b60408051601f198184030181529190528051602090910120610bad60e0870160c08801611d21565b610bbe610100880160e08901612043565b60036000610bd260e08b0160c08c01611d21565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000908120805467ffffffffffffffff1691610c108361201c565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550604051602001610c91969594939291909586526020860194909452604085019290925273ffffffffffffffffffffffffffffffffffffffff16606084015267ffffffffffffffff90811660808401521660a082015260c00190565b6040516020818303038152906040528051906020012090506000610cb482611782565b9050610d12610cc960e0860160c08701611d21565b82610cd86101208801886121f1565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506117ca92505050565b610d5e5760405162461bcd60e51b815260206004820181905260248201527f506f7274616c73526f757465723a20496e76616c6964207369676e61747572656044820152606401610366565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff8316610dd85734600003610dd15760405162461bcd60e51b815260206004820181905260248201527f506f7274616c73526f757465723a20496e76616c6964206d73672e76616c75656044820152606401610366565b5034610529565b34158015610de557508115155b610e575760405162461bcd60e51b815260206004820152602c60248201527f506f7274616c73526f757465723a20496e76616c6964207175616e746974792060448201527f6f72206d73672e76616c756500000000000000000000000000000000000000006064820152608401610366565b610e9973ffffffffffffffffffffffffffffffffffffffff8416857f000000000000000000000000000000000000000000000000000000000000000085611845565b5060009392505050565b6000610ecd610eb860a0880160808901611d21565b610ec86060890160408a01611d21565b6118f1565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663614eb6e58487876040518463ffffffff1660e01b8152600401610f2b929190612098565b6000604051808303818588803b158015610f4457600080fd5b505af1158015610f58573d6000803e3d6000fd5b505050505080610f84876080016020810190610f749190611d21565b610ec860608a0160408b01611d21565b610f8e9190612256565b90508560600135811015610fdb576040517fc634b0060000000000000000000000000000000000000000000000000000000081526004810182905260608701356024820152604401610366565b73ffffffffffffffffffffffffffffffffffffffff80831690339089167f5915121ae705c6baa1bd6698f437ff30eb4b7dbd20e1f7d83c2f1a8be09a1f0361102660208b018b611d21565b60208b013561103b60608d0160408e01611d21565b878d608001602081019061104f9190611d21565b6040805173ffffffffffffffffffffffffffffffffffffffff96871681526020810195909552928516928401929092526060830152909116608082015260a00160405180910390a49695505050505050565b6110a961080b565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586107e13390565b606060ff831461112a57611123836119bc565b90506103e1565b81805461113690612269565b80601f016020809104026020016040519081016040528092919081815260200182805461116290612269565b80156111af5780601f10611184576101008083540402835291602001916111af565b820191906000526020600020905b81548152906001019060200180831161119257829003601f168201915b505050505090506103e1565b6111cb60808201606083016122c7565b156114505760006111df60408301836121f1565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506020850151604086015160608701519697509095909450901a915061123c905060a08601608087016122c7565b15611397576040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152871690638fcbaf0c90899030908490637ecebe0090602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd91906122e4565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152602088013560648201526001608482015260ff841660a482015260c4810186905260e4810185905261010401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b50505050611447565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152306024830152863560448301526020870135606483015260ff8316608483015260a4820185905260c4820184905287169063d505accf9060e401600060405180830381600087803b15801561142e57600080fd5b505af1158015611442573d6000803e3d6000fd5b505050505b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff8216639fd5a6cf84308435602086013561148260408801886121f1565b6040518763ffffffff1660e01b81526004016114a3969594939291906122fd565b6020604051808303816000875af11580156114c2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5e919061234f565b600080600080600085875af19050806106335760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610366565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610d5e5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610366565b60003073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614801561164657507f000000000000000000000000000000000000000000000000000000000000000046145b1561167057507f000000000000000000000000000000000000000000000000000000000000000090565b610789604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60005474010000000000000000000000000000000000000000900460ff166103775760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610366565b60006103e161178f6115e0565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008060006117d985856119fb565b909250905060008160048111156117f2576117f261236c565b14801561182a57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b8061183b575061183b868686611a40565b9695505050505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806118ea5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610366565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff821661192c575073ffffffffffffffffffffffffffffffffffffffff8216316103e1565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528316906370a0823190602401602060405180830381865afa158015611998573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112391906122e4565b606060006119c983611b7f565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000808251604103611a315760208301516040840151606085015160001a611a2587828585611bc0565b94509450505050611a39565b506000905060025b9250929050565b60008060008573ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8686604051602401611a7792919061239b565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611ae291906123b4565b600060405180830381855afa9150503d8060008114611b1d576040519150601f19603f3d011682016040523d82523d6000602084013e611b22565b606091505b5091509150818015611b3657506020815110155b801561183b575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090611b7490830160209081019084016122e4565b149695505050505050565b600060ff8216601f8111156103e1576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611bf75750600090506003611c88565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611c4b573d6000803e3d6000fd5b5050604051601f19015191505073ffffffffffffffffffffffffffffffffffffffff8116611c8157600060019250925050611c88565b9150600090505b94509492505050565b60006101608284031215611ca457600080fd5b50919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611cce57600080fd5b919050565b60008060408385031215611ce657600080fd5b823567ffffffffffffffff811115611cfd57600080fd5b611d0985828601611c91565b925050611d1860208401611caa565b90509250929050565b600060208284031215611d3357600080fd5b6103de82611caa565b60005b83811015611d57578181015183820152602001611d3f565b50506000910152565b60008151808452611d78816020860160208601611d3c565b601f01601f19169290920160200192915050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e081840152611dc860e084018a611d60565b8381036040850152611dda818a611d60565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c0860152855180825283870192509083019060005b81811015611e3957835183529284019291840191600101611e1d565b50909c9b505050505050505050505050565b600060c08284031215611ca457600080fd5b600060a08284031215611ca457600080fd5b600080600060608486031215611e8457600080fd5b833567ffffffffffffffff80821115611e9c57600080fd5b611ea887838801611e4b565b94506020860135915080821115611ebe57600080fd5b50611ecb86828701611e5d565b925050611eda60408501611caa565b90509250925092565b600080600060608486031215611ef857600080fd5b833567ffffffffffffffff80821115611f1057600080fd5b611ea887838801611c91565b60008060408385031215611f2f57600080fd5b823567ffffffffffffffff811115611f4657600080fd5b611d0985828601611e4b565b600080600060608486031215611f6757600080fd5b611f7084611caa565b925060208401359150611eda60408501611caa565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611fba57600080fd5b83018035915067ffffffffffffffff821115611fd557600080fd5b6020019150600581901b3603821315611a3957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600067ffffffffffffffff80831681810361203957612039611fed565b6001019392505050565b60006020828403121561205557600080fd5b813567ffffffffffffffff8116811461052957600080fd5b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60208082528181018390526000906040808401600586901b8501820187855b888110156121e3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088840301845281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff818b360301811261211857600080fd5b8a01608073ffffffffffffffffffffffffffffffffffffffff8061213b84611caa565b1686528061214a8a8501611caa565b168987015250868201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe183360301811261218457600080fd5b8201888101903567ffffffffffffffff8111156121a057600080fd5b8036038213156121af57600080fd5b82898801526121c1838801828461206d565b60609485013597909401969096525050938601939250908501906001016120b7565b509098975050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261222657600080fd5b83018035915067ffffffffffffffff82111561224157600080fd5b602001915036819003821315611a3957600080fd5b818103818111156103e1576103e1611fed565b600181811c9082168061227d57607f821691505b602082108103611ca4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b80151581146122c457600080fd5b50565b6000602082840312156122d957600080fd5b8135610529816122b6565b6000602082840312156122f657600080fd5b5051919050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015284606083015260a0608083015261234360a08301848661206d565b98975050505050505050565b60006020828403121561236157600080fd5b8151610529816122b6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006105266040830184611d60565b600082516123c6818460208701611d3c565b919091019291505056fea264697066735822122074eaff194cc0737edae2f8253c4434027f70b67e27757640bb933c4f39443aa564736f6c6343000813003300000000000000000000000068f80fd72eae6b37d1f70e5cdd8a8e7ba12e3af7000000000000000000000000b0324286b3ef7dddc93fb2ff7c8b7b8a3524803c

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063d04323c511610059578063d04323c514610299578063de4d0cba146102b9578063f2fde38b146102ce578063f698da25146102ee57600080fd5b80638da5cb5b146102145780639d02210114610266578063a2e42c651461028657600080fd5b80637ecebe00116100bb5780637ecebe00146101675780638456cb59146101b757806384b0196e146101cc578063864a1b32146101f457600080fd5b80633f4ba83a146100e25780635c975abb146100f95780637274ffd814610139575b600080fd5b3480156100ee57600080fd5b506100f7610303565b005b34801561010557600080fd5b5060005474010000000000000000000000000000000000000000900460ff1660405190151581526020015b60405180910390f35b34801561014557600080fd5b50610159610154366004611cd3565b610379565b604051908152602001610130565b34801561017357600080fd5b5061019e610182366004611d21565b60036020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610130565b3480156101c357600080fd5b506100f76103e7565b3480156101d857600080fd5b506101e1610456565b6040516101309796959493929190611d8c565b34801561020057600080fd5b5061015961020f366004611e6f565b6104fb565b34801561022057600080fd5b506000546102419073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610130565b34801561027257600080fd5b50610159610281366004611ee3565b610530565b610159610294366004611f1c565b610564565b3480156102a557600080fd5b506100f76102b4366004611f52565b610591565b3480156102c557600080fd5b506100f7610659565b3480156102da57600080fd5b506100f76102e9366004611d21565b6106a8565b3480156102fa57600080fd5b5061015961077f565b60005473ffffffffffffffffffffffffffffffffffffffff16331461036f5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b61037761078e565b565b600061038361080b565b61038c83610876565b6103de61039f60e0850160c08601611d21565b846103ae610140820182611f85565b6103d86103c160e08a0160c08b01611d21565b6103ce60208b018b611d21565b60208b0135610d64565b87610ea3565b90505b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044e5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b6103776110a1565b60006060808280808361048a7f506f7274616c73526f757465720000000000000000000000000000000000000d6001611110565b6104b57f31000000000000000000000000000000000000000000000000000000000000016002611110565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b600061050561080b565b61051c336105166020870187611d21565b856111bb565b6105268483610564565b90505b9392505050565b600061053a61080b565b61055a61054d60e0860160c08701611d21565b6105166020870187611d21565b6105268483610379565b600061056e61080b565b6103de338461058060a0820182611f85565b6103d8336103ce60208b018b611d21565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105f85760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b73ffffffffffffffffffffffffffffffffffffffff83166106385761063373ffffffffffffffffffffffffffffffffffffffff8216836114e6565b505050565b61063373ffffffffffffffffffffffffffffffffffffffff84168284611541565b33600090815260036020526040812080549091906106809067ffffffffffffffff1661201c565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550565b60005473ffffffffffffffffffffffffffffffffffffffff16331461070f5760405162461bcd60e51b815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610366565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60006107896115e0565b905090565b610796611718565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60005474010000000000000000000000000000000000000000900460ff16156103775760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610366565b42610888610100830160e08401612043565b67ffffffffffffffff1610156108e05760405162461bcd60e51b815260206004820152601c60248201527f506f7274616c73526f757465723a204f726465722065787069726564000000006044820152606401610366565b6000604051602001610987907f4f72646572286164647265737320696e707574546f6b656e2c75696e7432353681527f20696e707574416d6f756e742c61646472657373206f7574707574546f6b656e60208201527f2c75696e74323536206d696e4f7574707574416d6f756e742c6164647265737360408201527f20726563697069656e74290000000000000000000000000000000000000000006060820152606b0190565b60408051601f198184030181529190528051602091820120906109ac90840184611d21565b60208401356109c16060860160408701611d21565b60608601356109d660a0880160808901611d21565b60408051602081019790975273ffffffffffffffffffffffffffffffffffffffff958616908701526060860193909352908316608085015260a08401521660c082015260e0016040516020818303038152906040528051906020012090506000604051602001610b4d907f5369676e65644f72646572284f72646572206f726465722c627974657333322081527f726f757465486173682c616464726573732073656e6465722c75696e7436342060208201527f646561646c696e652c75696e743634206e6f6e6365294f72646572286164647260408201527f65737320696e707574546f6b656e2c75696e7432353620696e707574416d6f7560608201527f6e742c61646472657373206f7574707574546f6b656e2c75696e74323536206d60808201527f696e4f7574707574416d6f756e742c6164647265737320726563697069656e7460a08201527f290000000000000000000000000000000000000000000000000000000000000060c082015260c10190565b60408051601f19818403018152919052805160209091012082610b74610140860186611f85565b604051602001610b85929190612098565b60408051601f198184030181529190528051602090910120610bad60e0870160c08801611d21565b610bbe610100880160e08901612043565b60036000610bd260e08b0160c08c01611d21565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000908120805467ffffffffffffffff1691610c108361201c565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550604051602001610c91969594939291909586526020860194909452604085019290925273ffffffffffffffffffffffffffffffffffffffff16606084015267ffffffffffffffff90811660808401521660a082015260c00190565b6040516020818303038152906040528051906020012090506000610cb482611782565b9050610d12610cc960e0860160c08701611d21565b82610cd86101208801886121f1565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506117ca92505050565b610d5e5760405162461bcd60e51b815260206004820181905260248201527f506f7274616c73526f757465723a20496e76616c6964207369676e61747572656044820152606401610366565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff8316610dd85734600003610dd15760405162461bcd60e51b815260206004820181905260248201527f506f7274616c73526f757465723a20496e76616c6964206d73672e76616c75656044820152606401610366565b5034610529565b34158015610de557508115155b610e575760405162461bcd60e51b815260206004820152602c60248201527f506f7274616c73526f757465723a20496e76616c6964207175616e746974792060448201527f6f72206d73672e76616c756500000000000000000000000000000000000000006064820152608401610366565b610e9973ffffffffffffffffffffffffffffffffffffffff8416857f000000000000000000000000b0324286b3ef7dddc93fb2ff7c8b7b8a3524803c85611845565b5060009392505050565b6000610ecd610eb860a0880160808901611d21565b610ec86060890160408a01611d21565b6118f1565b90507f000000000000000000000000b0324286b3ef7dddc93fb2ff7c8b7b8a3524803c73ffffffffffffffffffffffffffffffffffffffff1663614eb6e58487876040518463ffffffff1660e01b8152600401610f2b929190612098565b6000604051808303818588803b158015610f4457600080fd5b505af1158015610f58573d6000803e3d6000fd5b505050505080610f84876080016020810190610f749190611d21565b610ec860608a0160408b01611d21565b610f8e9190612256565b90508560600135811015610fdb576040517fc634b0060000000000000000000000000000000000000000000000000000000081526004810182905260608701356024820152604401610366565b73ffffffffffffffffffffffffffffffffffffffff80831690339089167f5915121ae705c6baa1bd6698f437ff30eb4b7dbd20e1f7d83c2f1a8be09a1f0361102660208b018b611d21565b60208b013561103b60608d0160408e01611d21565b878d608001602081019061104f9190611d21565b6040805173ffffffffffffffffffffffffffffffffffffffff96871681526020810195909552928516928401929092526060830152909116608082015260a00160405180910390a49695505050505050565b6110a961080b565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586107e13390565b606060ff831461112a57611123836119bc565b90506103e1565b81805461113690612269565b80601f016020809104026020016040519081016040528092919081815260200182805461116290612269565b80156111af5780601f10611184576101008083540402835291602001916111af565b820191906000526020600020905b81548152906001019060200180831161119257829003601f168201915b505050505090506103e1565b6111cb60808201606083016122c7565b156114505760006111df60408301836121f1565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506020850151604086015160608701519697509095909450901a915061123c905060a08601608087016122c7565b15611397576040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152871690638fcbaf0c90899030908490637ecebe0090602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd91906122e4565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152602088013560648201526001608482015260ff841660a482015260c4810186905260e4810185905261010401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b50505050611447565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152306024830152863560448301526020870135606483015260ff8316608483015260a4820185905260c4820184905287169063d505accf9060e401600060405180830381600087803b15801561142e57600080fd5b505af1158015611442573d6000803e3d6000fd5b505050505b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff8216639fd5a6cf84308435602086013561148260408801886121f1565b6040518763ffffffff1660e01b81526004016114a3969594939291906122fd565b6020604051808303816000875af11580156114c2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5e919061234f565b600080600080600085875af19050806106335760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610366565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610d5e5760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610366565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002db3b92918ece265c7d5d9d975c69d89b8b1136c1614801561164657507f00000000000000000000000000000000000000000000000000000000000000fc46145b1561167057507f38ca22755c0df9deac35d50f89f08404ed3f3d763f5ff94b5b827a2ff113eb2b90565b610789604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f53a97a65bf6e4ab4d76a38188215228e7631538a77e1d002740983a426302800918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60005474010000000000000000000000000000000000000000900460ff166103775760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610366565b60006103e161178f6115e0565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b60008060006117d985856119fb565b909250905060008160048111156117f2576117f261236c565b14801561182a57508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b8061183b575061183b868686611a40565b9695505050505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806118ea5760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610366565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff821661192c575073ffffffffffffffffffffffffffffffffffffffff8216316103e1565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528316906370a0823190602401602060405180830381865afa158015611998573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112391906122e4565b606060006119c983611b7f565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000808251604103611a315760208301516040840151606085015160001a611a2587828585611bc0565b94509450505050611a39565b506000905060025b9250929050565b60008060008573ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8686604051602401611a7792919061239b565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611ae291906123b4565b600060405180830381855afa9150503d8060008114611b1d576040519150601f19603f3d011682016040523d82523d6000602084013e611b22565b606091505b5091509150818015611b3657506020815110155b801561183b575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090611b7490830160209081019084016122e4565b149695505050505050565b600060ff8216601f8111156103e1576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611bf75750600090506003611c88565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611c4b573d6000803e3d6000fd5b5050604051601f19015191505073ffffffffffffffffffffffffffffffffffffffff8116611c8157600060019250925050611c88565b9150600090505b94509492505050565b60006101608284031215611ca457600080fd5b50919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611cce57600080fd5b919050565b60008060408385031215611ce657600080fd5b823567ffffffffffffffff811115611cfd57600080fd5b611d0985828601611c91565b925050611d1860208401611caa565b90509250929050565b600060208284031215611d3357600080fd5b6103de82611caa565b60005b83811015611d57578181015183820152602001611d3f565b50506000910152565b60008151808452611d78816020860160208601611d3c565b601f01601f19169290920160200192915050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e081840152611dc860e084018a611d60565b8381036040850152611dda818a611d60565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c0860152855180825283870192509083019060005b81811015611e3957835183529284019291840191600101611e1d565b50909c9b505050505050505050505050565b600060c08284031215611ca457600080fd5b600060a08284031215611ca457600080fd5b600080600060608486031215611e8457600080fd5b833567ffffffffffffffff80821115611e9c57600080fd5b611ea887838801611e4b565b94506020860135915080821115611ebe57600080fd5b50611ecb86828701611e5d565b925050611eda60408501611caa565b90509250925092565b600080600060608486031215611ef857600080fd5b833567ffffffffffffffff80821115611f1057600080fd5b611ea887838801611c91565b60008060408385031215611f2f57600080fd5b823567ffffffffffffffff811115611f4657600080fd5b611d0985828601611e4b565b600080600060608486031215611f6757600080fd5b611f7084611caa565b925060208401359150611eda60408501611caa565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611fba57600080fd5b83018035915067ffffffffffffffff821115611fd557600080fd5b6020019150600581901b3603821315611a3957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600067ffffffffffffffff80831681810361203957612039611fed565b6001019392505050565b60006020828403121561205557600080fd5b813567ffffffffffffffff8116811461052957600080fd5b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60208082528181018390526000906040808401600586901b8501820187855b888110156121e3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088840301845281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff818b360301811261211857600080fd5b8a01608073ffffffffffffffffffffffffffffffffffffffff8061213b84611caa565b1686528061214a8a8501611caa565b168987015250868201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe183360301811261218457600080fd5b8201888101903567ffffffffffffffff8111156121a057600080fd5b8036038213156121af57600080fd5b82898801526121c1838801828461206d565b60609485013597909401969096525050938601939250908501906001016120b7565b509098975050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261222657600080fd5b83018035915067ffffffffffffffff82111561224157600080fd5b602001915036819003821315611a3957600080fd5b818103818111156103e1576103e1611fed565b600181811c9082168061227d57607f821691505b602082108103611ca4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b80151581146122c457600080fd5b50565b6000602082840312156122d957600080fd5b8135610529816122b6565b6000602082840312156122f657600080fd5b5051919050565b600073ffffffffffffffffffffffffffffffffffffffff808916835280881660208401525085604083015284606083015260a0608083015261234360a08301848661206d565b98975050505050505050565b60006020828403121561236157600080fd5b8151610529816122b6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8281526040602082015260006105266040830184611d60565b600082516123c6818460208701611d3c565b919091019291505056fea264697066735822122074eaff194cc0737edae2f8253c4434027f70b67e27757640bb933c4f39443aa564736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000068f80fd72eae6b37d1f70e5cdd8a8e7ba12e3af7000000000000000000000000b0324286b3ef7dddc93fb2ff7c8b7b8a3524803c

-----Decoded View---------------
Arg [0] : _admin (address): 0x68F80Fd72eae6b37d1F70e5cDD8A8E7bA12E3af7
Arg [1] : _multicall (address): 0xb0324286B3ef7dDdC93Fb2fF7c8B7B8a3524803c

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000068f80fd72eae6b37d1f70e5cdd8a8e7ba12e3af7
Arg [1] : 000000000000000000000000b0324286b3ef7dddc93fb2ff7c8b7b8a3524803c


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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