false
true
0

Contract Address Details

0x742d48639F44701Bff5A0A441600AD6DA4A3b080

Contract Name
Orchestrator
Creator
0xc3c7e0–8a5d11 at 0xfacc76–355093
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
1 Transactions
Transfers
0 Transfers
Gas Used
0
Last Balance Update
25958198
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
Orchestrator




Optimization enabled
true
Compiler version
v0.8.18+commit.87f61d96




Optimization runs
200
EVM Version
default




Verified at
2026-01-12T22:08:24.304698Z

Constructor Arguments

0x000000000000000000000000c3c7e05d1ba19563693d891e5c38f0fc988a5d1100000000000000000000000000000000000000000000000000000000000001710000000000000000000000007238d0b6a28a3a6e3dfcd281d7cb9b3250b30ea60000000000000000000000006a4ff1950be05995dee75920cf27cd8febb6597a00000000000000000000000094f510fa245843ff5eda2d18479fe63ac51f8fe6000000000000000000000000689f82b4078aa07f443af9ae308534bd2ff545d300000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000948eb6d3a08beb29dc1d08d09753862573a94122

Arg [0] (address) : 0xc3c7e05d1ba19563693d891e5c38f0fc988a5d11
Arg [1] (uint256) : 369
Arg [2] (address) : 0x7238d0b6a28a3a6e3dfcd281d7cb9b3250b30ea6
Arg [3] (address) : 0x6a4ff1950be05995dee75920cf27cd8febb6597a
Arg [4] (address) : 0x94f510fa245843ff5eda2d18479fe63ac51f8fe6
Arg [5] (address) : 0x689f82b4078aa07f443af9ae308534bd2ff545d3
Arg [6] (uint256) : 20000000000000000
Arg [7] (address) : 0x948eb6d3a08beb29dc1d08d09753862573a94122

              

contracts/Orchestrator.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol";
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { AddressArrayUtils } from "./external/AddressArrayUtils.sol";
import { Bytes32ArrayUtils } from "./external/Bytes32ArrayUtils.sol";
import { IOrchestrator } from "./interfaces/IOrchestrator.sol";
import { IEscrow } from "./interfaces/IEscrow.sol";
import { IEscrowRegistry } from "./interfaces/IEscrowRegistry.sol";
import { IPostIntentHook } from "./interfaces/IPostIntentHook.sol";
import { IPaymentVerifier } from "./interfaces/IPaymentVerifier.sol";
import { IPaymentVerifierRegistry } from "./interfaces/IPaymentVerifierRegistry.sol";
import { IPostIntentHookRegistry } from "./interfaces/IPostIntentHookRegistry.sol";
import { IRelayerRegistry } from "./interfaces/IRelayerRegistry.sol";

/**
 * @title Orchestrator
 * @notice Orchestrator contract for the ZKP2P protocol. This contract is responsible for managing the intent (order) 
 * lifecycle and orchestrating the P2P trading of fiat currency and onchain assets.
 */
contract Orchestrator is Ownable, Pausable, ReentrancyGuard, IOrchestrator {

    using AddressArrayUtils for address[];
    using Bytes32ArrayUtils for bytes32[];
    using ECDSA for bytes32;
    using SafeERC20 for IERC20;
    using SignatureChecker for address;


    /* ============ Constants ============ */
    uint256 internal constant PRECISE_UNIT = 1e18;
    uint256 constant CIRCOM_PRIME_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
    uint256 constant MAX_REFERRER_FEE = 5e16;      // 5% max referrer fee
    uint256 constant MAX_PROTOCOL_FEE = 5e16;      // 5% max protocol fee

    /* ============ State Variables ============ */

    uint256 immutable public chainId;              // chainId of the chain the orchestrator is deployed on

    mapping(bytes32 => Intent) internal intents;                       // Mapping of intentHashes to intent structs
    mapping(address => bytes32[]) internal accountIntents;             // Mapping of address to array of intentHashes

    // Snapshot of the minimum per-intent amount at the time of lock (signal)
    // Used to prevent fulfillments that pay out less than the deposit's min intent amount.
    mapping(bytes32 => uint256) internal intentMinAtSignal;

    // Contract references
    IEscrowRegistry public escrowRegistry;                              // Registry of escrow contracts
    IPaymentVerifierRegistry public  paymentVerifierRegistry;          // Registry of payment verifiers
    IPostIntentHookRegistry public postIntentHookRegistry;             // Registry of post intent hooks
    IRelayerRegistry public relayerRegistry;                           // Registry of relayers

    // Protocol fee configuration
    uint256 public protocolFee;                                     // Protocol fee taken from taker (in preciseUnits, 1e16 = 1%)
    address public protocolFeeRecipient;                            // Address that receives protocol fees

    bool public allowMultipleIntents;                               // Whether to allow multiple intents per account

    uint256 public intentCounter;                                 // Counter for number of intents created; nonce for unique intent hashes

    /* ============ Constructor ============ */
    constructor(
        address _owner,
        uint256 _chainId,
        address _escrowRegistry,
        address _paymentVerifierRegistry,
        address _postIntentHookRegistry,
        address _relayerRegistry,
        uint256 _protocolFee,
        address _protocolFeeRecipient
    )
        Ownable()
    {
        chainId = _chainId;
        escrowRegistry = IEscrowRegistry(_escrowRegistry);
        paymentVerifierRegistry = IPaymentVerifierRegistry(_paymentVerifierRegistry);
        postIntentHookRegistry = IPostIntentHookRegistry(_postIntentHookRegistry);
        relayerRegistry = IRelayerRegistry(_relayerRegistry);
        protocolFee = _protocolFee;
        protocolFeeRecipient = _protocolFeeRecipient;

        transferOwnership(_owner);
    }

    /* ============ External Functions ============ */

    /**
     * @notice Signals intent to pay the depositor defined in the _depositId the _amount * deposit conversionRate off-chain at 
     * their given _payeeId in order to unlock _amount of funds on-chain. Caller must provide a signature from the deposit's gating
     * service to prove their eligibility to take liquidity. This function captures and stores all values required for fullfilling
     * the intent to give strong guarantees to the buyer. Locks liquidity for the corresponding deposit on the escrow contract.
     *
     * @param _params                   Struct containing all the intent parameters
     */
    function signalIntent(SignalIntentParams calldata _params)
        external
        whenNotPaused
    {
        // Checks
        _validateSignalIntent(_params);

        // Effects
        bytes32 intentHash = _calculateIntentHash();
        IEscrow.Deposit memory dep = IEscrow(_params.escrow).getDeposit(_params.depositId);
        IEscrow.DepositPaymentMethodData memory depData = IEscrow(_params.escrow).getDepositPaymentMethodData(
            _params.depositId,
            _params.paymentMethod
        );
        
        intentMinAtSignal[intentHash] = dep.intentAmountRange.min;
        intents[intentHash] = Intent({
            owner: msg.sender,
            to: _params.to,
            escrow: _params.escrow,
            depositId: _params.depositId,
            amount: _params.amount,
            paymentMethod: _params.paymentMethod,
            fiatCurrency: _params.fiatCurrency,
            conversionRate: _params.conversionRate,
            payeeId: depData.payeeDetails, 
            timestamp: block.timestamp,
            referrer: _params.referrer,
            referrerFee: _params.referrerFee,
            postIntentHook: _params.postIntentHook,
            data: _params.data
        });

        accountIntents[msg.sender].push(intentHash);
        intentCounter++;

        emit IntentSignaled(
            intentHash, 
            _params.escrow,
            _params.depositId, 
            _params.paymentMethod, 
            msg.sender, 
            _params.to, 
            _params.amount, 
            _params.fiatCurrency, 
            _params.conversionRate, 
            block.timestamp
        );

        // Interactions
        IEscrow(_params.escrow).lockFunds(_params.depositId, intentHash, _params.amount);
    }

    /**
     * @notice Only callable by the originator of the intent. Cancels an outstanding intent. Unlocks liquidity
     * for the corresponding deposit on the escrow contract.
     *
     * @param _intentHash    Hash of intent being cancelled
     */
    function cancelIntent(bytes32 _intentHash) external {
        // Checks
        Intent memory intent = intents[_intentHash];
        
        if (intent.timestamp == 0) revert IntentNotFound(_intentHash);
        if (intent.owner != msg.sender) revert UnauthorizedCaller(msg.sender, intent.owner);

        // Effects
        _pruneIntent(_intentHash);

        // Interactions
        IEscrow(intent.escrow).unlockFunds(intent.depositId, _intentHash);
    }

    /**
     * @notice Anyone can submit a fulfill intent transaction, even if caller isn't the intent owner. Upon submission the
     * offchain payment proof is verified, payment details are validated, intent is removed, and escrow state is updated. 
     * Deposit token is transferred to the intent.to address.
     * @dev This function adds a reentrancy guard as it's calling the post intent hook contract which itself might call 
     * malicious contracts.
     *
     * @param _params               Struct containing all the fulfill intent parameters
     */
    function fulfillIntent(FulfillIntentParams calldata _params) external nonReentrant whenNotPaused {
        // Checks
        Intent memory intent = intents[_params.intentHash];
        if (intent.paymentMethod == bytes32(0)) revert IntentNotFound(_params.intentHash);
        
        IEscrow.Deposit memory deposit = IEscrow(intent.escrow).getDeposit(intent.depositId);
        
        address verifier = paymentVerifierRegistry.getVerifier(intent.paymentMethod);
        if (verifier == address(0)) revert PaymentMethodDoesNotExist(intent.paymentMethod);
        
        IPaymentVerifier.PaymentVerificationResult memory verificationResult = IPaymentVerifier(verifier).verifyPayment(
            IPaymentVerifier.VerifyPaymentData({
                intentHash: _params.intentHash,
                paymentProof: _params.paymentProof,
                data: _params.verificationData
            })
        );
        if (!verificationResult.success) revert PaymentVerificationFailed();
        if (verificationResult.intentHash != _params.intentHash) revert HashMismatch(_params.intentHash, verificationResult.intentHash);

        // Enforce snapshot min-at-signal to prevent sub-min partial fulfillments
        uint256 minAtSignal = intentMinAtSignal[_params.intentHash];
        if (minAtSignal > 0 && verificationResult.releaseAmount < minAtSignal) {
            revert AmountBelowMin(verificationResult.releaseAmount, minAtSignal);
        }

        // Effects
        _pruneIntent(_params.intentHash);

        // Interactions
        IEscrow(intent.escrow).unlockAndTransferFunds(intent.depositId, _params.intentHash, verificationResult.releaseAmount, address(this));

        _collectFeesTransferFundsAndExecuteAction(
            deposit.token, 
            _params.intentHash, 
            intent, 
            verificationResult.releaseAmount,
            _params.postIntentHookData
        );
    }

    /**
     * @notice Allows depositor to release funds to the payer in case of a failed fulfill intent or because of some other arrangement
     * between the two parties. Upon submission we check to make sure the msg.sender is the depositor, the intent is removed, and 
     * escrow state is updated. Deposit token is transferred to the payer.
     *
     * @param _intentHash        Hash of intent to resolve by releasing the funds
     */
    function releaseFundsToPayer(bytes32 _intentHash) external nonReentrant {
        // Checks
        Intent memory intent = intents[_intentHash];
        if (intent.owner == address(0)) revert IntentNotFound(_intentHash);

        IEscrow.Deposit memory deposit = IEscrow(intent.escrow).getDeposit(intent.depositId);
        if (deposit.depositor != msg.sender) revert UnauthorizedCaller(msg.sender, deposit.depositor);
        
        // Effects
        _pruneIntent(_intentHash);

        // Interactions
        IEscrow(intent.escrow).unlockAndTransferFunds(intent.depositId, _intentHash, intent.amount, address(this));

        _collectFeesAndTransferFunds(deposit.token, _intentHash, intent, intent.amount);
    }

    /* ============ Escrow Functions ============ */

    /**
     * @notice Only the escrow contract owns the intent can call this function. Called by escrow to prune specific
     * expired intents. Escrow leads the cleanup process.
     * 
     * @param _intents   Array of intent hashes to prune
     */
    function pruneIntents(bytes32[] calldata _intents) external {
        for (uint256 i = 0; i < _intents.length; i++) {
            bytes32 intentHash = _intents[i];
            if (intentHash != bytes32(0)) {
                Intent memory intent = intents[intentHash];
                if (
                    intent.timestamp != 0 && // Only prune if intent exists on this contract; otherwise skip
                    intent.escrow == msg.sender // Ensure only the escrow that owns the intent can prune it; otherwise skip
                ) {
                    _pruneIntent(intentHash);
                }
            }
        }
    }

    /* ============ Governance Functions ============ */

    /**
     * @notice GOVERNANCE ONLY: Updates the escrow registry address.
     *
     * @param _escrowRegistry   New escrow registry address
     */
    function setEscrowRegistry(address _escrowRegistry) external onlyOwner {
        if (_escrowRegistry == address(0)) revert ZeroAddress();
        
        escrowRegistry = IEscrowRegistry(_escrowRegistry);
        emit EscrowRegistryUpdated(_escrowRegistry);
    }

    /**
     * @notice GOVERNANCE ONLY: Updates the protocol fee. This fee is charged to takers upon a successful
     * fulfillment of an intent.
     *
     * @param _protocolFee   New protocol fee in preciseUnits (1e16 = 1%)
     */
    function setProtocolFee(uint256 _protocolFee) external onlyOwner {
        if (_protocolFee > MAX_PROTOCOL_FEE) revert FeeExceedsMaximum(_protocolFee, MAX_PROTOCOL_FEE);
        
        protocolFee = _protocolFee;
        emit ProtocolFeeUpdated(_protocolFee);
    }

    /**
     * @notice GOVERNANCE ONLY: Updates the protocol fee recipient address.
     *
     * @param _protocolFeeRecipient   New protocol fee recipient address
     */
    function setProtocolFeeRecipient(address _protocolFeeRecipient) external onlyOwner {
        if (_protocolFeeRecipient == address(0)) revert ZeroAddress();
        
        protocolFeeRecipient = _protocolFeeRecipient;
        emit ProtocolFeeRecipientUpdated(_protocolFeeRecipient);
    }

    /**
     * @notice GOVERNANCE ONLY: Sets whether all accounts can signal multiple intents.
     *
     * @param _allowMultiple   True to allow all accounts to signal multiple intents, false to restrict to whitelisted relayers only
     */
    function setAllowMultipleIntents(bool _allowMultiple) external onlyOwner {
        allowMultipleIntents = _allowMultiple;
        
        emit AllowMultipleIntentsUpdated(_allowMultiple);
    }

    /**
     * @notice GOVERNANCE ONLY: Updates the post intent hook registry address.
     *
     * @param _postIntentHookRegistry   New post intent hook registry address
     */
    function setPostIntentHookRegistry(address _postIntentHookRegistry) external onlyOwner {
        if (_postIntentHookRegistry == address(0)) revert ZeroAddress();
        
        postIntentHookRegistry = IPostIntentHookRegistry(_postIntentHookRegistry);
        emit PostIntentHookRegistryUpdated(_postIntentHookRegistry);
    }

    /**
     * @notice GOVERNANCE ONLY: Updates the relayer registry address.
     *
     * @param _relayerRegistry   New relayer registry address
     */
    function setRelayerRegistry(address _relayerRegistry) external onlyOwner {
        if (_relayerRegistry == address(0)) revert ZeroAddress();
        
        relayerRegistry = IRelayerRegistry(_relayerRegistry);
        emit RelayerRegistryUpdated(_relayerRegistry);
    }

    /**
     * @notice GOVERNANCE ONLY: Pauses intent creation and fulfillment functionality.
     * 
     * Functionalities that are paused:
     * - Intent creation (signalIntent)
     * - Intent fulfillment (fulfillIntent)
     *
     * Functionalities that remain unpaused to allow users to recover funds:
     * - Intent cancellation (cancelIntent)
     * - Manual fund release by depositor (releaseFundsToPayer)
     * - Intent pruning by escrow (pruneIntents)
     * - All governance functions
     * - All view functions
     */
    function pauseOrchestrator() external onlyOwner {
        _pause();
    }

    /**
     * @notice GOVERNANCE ONLY: Restarts paused functionality for the orchestrator.
     */
    function unpauseOrchestrator() external onlyOwner {
        _unpause();
    }

    /* ============ External View Functions ============ */

    function getIntent(bytes32 _intentHash) external view returns (Intent memory) {
        return intents[_intentHash];
    }

    function getAccountIntents(address _account) external view returns (bytes32[] memory) {
        return accountIntents[_account];
    }

    function getIntentMinAtSignal(bytes32 _intentHash) external view returns (uint256) {
        return intentMinAtSignal[_intentHash];
    }

    /* ============ Internal Functions ============ */

    /**
     * @notice Validates an intent before it is signaled.
     */
    function _validateSignalIntent(SignalIntentParams memory _intent) internal view {
        // Check if account can have multiple intents
        bool canHaveMultipleIntents = relayerRegistry.isWhitelistedRelayer(msg.sender) || allowMultipleIntents;
        if (!canHaveMultipleIntents && accountIntents[msg.sender].length > 0) {
            revert AccountHasActiveIntent(msg.sender, accountIntents[msg.sender][0]);
        }

        if (_intent.to == address(0)) revert ZeroAddress();
        
        if (_intent.referrerFee > MAX_REFERRER_FEE) revert FeeExceedsMaximum(_intent.referrerFee, MAX_REFERRER_FEE);
        if (_intent.referrer == address(0)) {
            if (_intent.referrerFee != 0) revert InvalidReferrerFeeConfiguration();
        }

        if (address(_intent.postIntentHook) != address(0)) {
            if (!postIntentHookRegistry.isWhitelistedHook(address(_intent.postIntentHook))) {
                revert PostIntentHookNotWhitelisted(address(_intent.postIntentHook));
            }
        }

        // Validate escrow is whitelisted
        if (!escrowRegistry.isWhitelistedEscrow(_intent.escrow) && !escrowRegistry.isAcceptingAllEscrows()) {
            revert EscrowNotWhitelisted(_intent.escrow);
        }

        // Verify payment method is still valid in registry
        address verifier = paymentVerifierRegistry.getVerifier(_intent.paymentMethod);
        if (verifier == address(0)) revert PaymentMethodDoesNotExist(_intent.paymentMethod);
        
        bool isPaymentMethodActive = IEscrow(_intent.escrow).getDepositPaymentMethodActive(_intent.depositId, _intent.paymentMethod);
        if (!isPaymentMethodActive) revert PaymentMethodNotSupported(_intent.paymentMethod);
        
        uint256 minConversionRate = IEscrow(_intent.escrow).getDepositCurrencyMinRate(
            _intent.depositId, _intent.paymentMethod, _intent.fiatCurrency
        );
        if (minConversionRate == 0) revert CurrencyNotSupported(_intent.paymentMethod, _intent.fiatCurrency);
        if (_intent.conversionRate < minConversionRate) revert RateBelowMinimum(_intent.conversionRate, minConversionRate);

        address intentGatingService = IEscrow(_intent.escrow).getDepositGatingService(_intent.depositId, _intent.paymentMethod);
        if (intentGatingService != address(0)) {
            // Check if signature has expired
            if (block.timestamp > _intent.signatureExpiration) {
                revert SignatureExpired(_intent.signatureExpiration, block.timestamp);
            }

            if (!_isValidIntentGatingSignature(_intent, intentGatingService)) {
                revert InvalidSignature();
            }
        }
    }

    /**
     * @notice Calculates a unique hash for an intent using the orchestrator address and counter.
     */
    function _calculateIntentHash() internal view returns (bytes32 intentHash) {
        // Use orchestrator address + counter for global uniqueness
        // Mod with circom prime field to make sure it fits in a 254-bit field
        uint256 intermediateHash = uint256(
            keccak256(
                abi.encodePacked(
                    address(this),    // Include orchestrator address for avoiding collisions when migrating to a new orchestrator
                    // or when multiple orchestrators are deployed
                    intentCounter     // unique counter within this orchestrator
                )
            ));
        intentHash = bytes32(intermediateHash % CIRCOM_PRIME_FIELD);
    }


    /**
     * @notice Deletes an intent from storage mappings.
     */
    function _pruneIntent(bytes32 _intentHash) internal {
        Intent memory intent = intents[_intentHash];

        accountIntents[intent.owner].removeStorage(_intentHash);
        delete intents[_intentHash];
        delete intentMinAtSignal[_intentHash];

        emit IntentPruned(_intentHash);
    }

    /**
     * @notice Calculates and transfers fees to the protocol fee recipient and referrer.
     */
    function _calculateAndTransferFees(
        IERC20 _token,
        Intent memory _intent, 
        uint256 _releaseAmount
    ) internal returns (uint256 netFees) {
        uint256 protocolFeeAmount;
        uint256 referrerFeeAmount; 

        // Calculate protocol fee (taken from taker) - based on release amount
        if (protocolFeeRecipient != address(0) && protocolFee > 0) {
            protocolFeeAmount = (_releaseAmount * protocolFee) / PRECISE_UNIT;
            _token.safeTransfer(protocolFeeRecipient, protocolFeeAmount);
        }
        
        // Calculate referrer fee (taken from taker) - based on release amount
        if (_intent.referrer != address(0) && _intent.referrerFee > 0) {
            referrerFeeAmount = (_releaseAmount * _intent.referrerFee) / PRECISE_UNIT;
            _token.safeTransfer(_intent.referrer, referrerFeeAmount);
        }

        netFees = protocolFeeAmount + referrerFeeAmount;
    }

    /**
     * @notice Transfers funds to the intent recipient. Called by manual release.
     */
    function _collectFeesAndTransferFunds(
        IERC20 _token, 
        bytes32 _intentHash, 
        Intent memory _intent,
        uint256 _releaseAmount
    ) internal {
        uint256 netFees = _calculateAndTransferFees(_token, _intent, _releaseAmount);
        uint256 netAmount = _releaseAmount - netFees;

        _token.safeTransfer(_intent.to, netAmount);

        emit IntentFulfilled(
            _intentHash, 
            _intent.to, 
            netAmount, 
            true
        );
    }

    /**
     * @notice Handles fee calculations and transfers, then executes any post-intent hooks if present. Called by fulfillIntent.
     */
    function _collectFeesTransferFundsAndExecuteAction(
        IERC20 _token, 
        bytes32 _intentHash, 
        Intent memory _intent, 
        uint256 _releaseAmount,
        bytes memory _postIntentHookData
    ) internal {
        uint256 netFees = _calculateAndTransferFees(_token, _intent, _releaseAmount);
        uint256 netAmount = _releaseAmount - netFees;

        address fundsTransferredTo = _intent.to;
        if (address(_intent.postIntentHook) != address(0)) {
            // Snapshot balance to enforce exact consumption by the hook
            uint256 preBalance = _token.balanceOf(address(this));

            // Grant exact allowance to the post-intent hook using SafeERC20 with zero-before-set
            _token.safeApprove(address(_intent.postIntentHook), 0);
            _token.safeApprove(address(_intent.postIntentHook), netAmount);
            _intent.postIntentHook.execute(_intent, netAmount, _postIntentHookData);
            
            // Enforce that the hook pulled exactly netAmount to prevent stranded funds
            uint256 postBalance = _token.balanceOf(address(this));
            require(postBalance <= preBalance, "PostIntentHook: unexpected balance increase");
            uint256 spent = preBalance - postBalance;
            require(spent == netAmount, "PostIntentHook: must pull exact netAmount");

            // Reset allowance to prevent residual balance drainage (and fail closed on non-standard ERC20s)
            _token.safeApprove(address(_intent.postIntentHook), 0);

            fundsTransferredTo = address(_intent.postIntentHook);
        } else {
            // Otherwise transfer directly to the intent recipient
            _token.safeTransfer(_intent.to, netAmount);
        }

        emit IntentFulfilled(
            _intentHash, 
            fundsTransferredTo, 
            netAmount, 
            false
        );
    }


    /**
     * @notice Checks if a intent gating service signature is valid.
     */
    function _isValidIntentGatingSignature(
        SignalIntentParams memory _intent, 
        address _intentGatingService
    ) 
        internal 
        view 
        returns(bool) 
    {
        bytes memory message = abi.encodePacked(
            address(this),
            _intent.escrow, 
            _intent.depositId, 
            _intent.amount, 
            _intent.to, 
            _intent.paymentMethod, 
            _intent.fiatCurrency, 
            _intent.conversionRate, 
            _intent.signatureExpiration,
            chainId
        );

        bytes32 verifierPayload = keccak256(message).toEthSignedMessageHash();
        return _intentGatingService.isValidSignatureNow(verifierPayload, _intent.gatingServiceSignature);
    }
}
        

contracts/interfaces/IPostIntentHookRegistry.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

interface IPostIntentHookRegistry {
    function isWhitelistedHook(address _hook) external view returns (bool);
    function getWhitelistedHooks() external view returns (address[] memory);
}
          

contracts/interfaces/IRelayerRegistry.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

interface IRelayerRegistry {
    function isWhitelistedRelayer(address _relayer) external view returns (bool);
    function getWhitelistedRelayers() external view returns (address[] memory);
}
          

@openzeppelin/contracts/access/Ownable.sol

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

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

@openzeppelin/contracts/interfaces/IERC1271.sol

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

@openzeppelin/contracts/security/Pausable.sol

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

@openzeppelin/contracts/security/ReentrancyGuard.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
          

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}
          

@openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
          

@openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

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

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

@openzeppelin/contracts/utils/Strings.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/cryptography/ECDSA.sol

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

@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol

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

@openzeppelin/contracts/utils/math/Math.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/math/SignedMath.sol

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

pragma solidity ^0.8.0;

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

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

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

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

contracts/external/AddressArrayUtils.sol

/*
    Copyright 2020 Set Labs Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

    SPDX-License-Identifier: MIT
*/

pragma solidity ^0.8.17;

/**
 * @title AddressArrayUtils
 * @author Set Protocol
 *
 * Utility functions to handle Address Arrays
 *
 * CHANGELOG:
 * - 4/21/21: Added validatePairsWithArray methods
 */
library AddressArrayUtils {

    uint256 constant internal MAX_INT = 2**256 - 1;

    /**
     * Finds the index of the first occurrence of the given element.
     * @param A The input array to search
     * @param a The value to find
     * @return Returns (index and isIn) for the first occurrence starting from index 0
     */
    function indexOf(address[] memory A, address a) internal pure returns (uint256, bool) {
        uint256 length = A.length;
        for (uint256 i = 0; i < length; i++) {
            if (A[i] == a) {
                return (i, true);
            }
        }
        return (MAX_INT, false);
    }

    /**
    * Returns true if the value is present in the list. Uses indexOf internally.
    * @param A The input array to search
    * @param a The value to find
    * @return Returns isIn for the first occurrence starting from index 0
    */
    function contains(address[] memory A, address a) internal pure returns (bool) {
        (, bool isIn) = indexOf(A, a);
        return isIn;
    }

    /**
    * Returns true if there are 2 elements that are the same in an array
    * @param A The input array to search
    * @return Returns boolean for the first occurrence of a duplicate
    */
    function hasDuplicate(address[] memory A) internal pure returns(bool) {
        require(A.length > 0, "A is empty");

        for (uint256 i = 0; i < A.length - 1; i++) {
            address current = A[i];
            for (uint256 j = i + 1; j < A.length; j++) {
                if (current == A[j]) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * @param A The input array to search
     * @param a The address to remove
     * @return Returns the array with the object removed.
     */
    function remove(address[] memory A, address a)
        internal
        pure
        returns (address[] memory)
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("Address not in array.");
        } else {
            (address[] memory _A,) = pop(A, index);
            return _A;
        }
    }

    /**
     * @param A The input array to search
     * @param a The address to remove
     */
    function removeStorage(address[] storage A, address a)
        internal
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("Address not in array.");
        } else {
            uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here
            if (index != lastIndex) { A[index] = A[lastIndex]; }
            A.pop();
        }
    }

    /**
    * Removes specified index from array
    * @param A The input array to search
    * @param index The index to remove
    * @return Returns the new array and the removed entry
    */
    function pop(address[] memory A, uint256 index)
        internal
        pure
        returns (address[] memory, address)
    {
        uint256 length = A.length;
        require(index < A.length, "Index must be < A length");
        address[] memory newAddresses = new address[](length - 1);
        for (uint256 i = 0; i < index; i++) {
            newAddresses[i] = A[i];
        }
        for (uint256 j = index + 1; j < length; j++) {
            newAddresses[j - 1] = A[j];
        }
        return (newAddresses, A[index]);
    }
}
          

contracts/external/Bytes32ArrayUtils.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;

/**
 * @title Bytes32ArrayUtils
 * @author ZKP2P
 *
 * Fork of Set Protocol's AddressArrayUtils library adapted for usage with bytes32 arrays.
 */
library Bytes32ArrayUtils {

    uint256 constant internal MAX_INT = 2**256 - 1;

    /**
     * Finds the index of the first occurrence of the given element.
     * @param A The input array to search
     * @param a The value to find
     * @return Returns (index and isIn) for the first occurrence starting from index 0
     */
    function indexOf(bytes32[] memory A, bytes32 a) internal pure returns (uint256, bool) {
        uint256 length = A.length;
        for (uint256 i = 0; i < length; i++) {
            if (A[i] == a) {
                return (i, true);
            }
        }
        return (MAX_INT, false);
    }

    /**
    * Returns true if the value is present in the list. Uses indexOf internally.
    * @param A The input array to search
    * @param a The value to find
    * @return Returns isIn for the first occurrence starting from index 0
    */
    function contains(bytes32[] memory A, bytes32 a) internal pure returns (bool) {
        (, bool isIn) = indexOf(A, a);
        return isIn;
    }

    /**
    * Returns true if there are 2 elements that are the same in an array
    * @param A The input array to search
    * @return Returns boolean for the first occurrence of a duplicate
    */
    function hasDuplicate(bytes32[] memory A) internal pure returns(bool) {
        require(A.length > 0, "A is empty");

        for (uint256 i = 0; i < A.length - 1; i++) {
            bytes32 current = A[i];
            for (uint256 j = i + 1; j < A.length; j++) {
                if (current == A[j]) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * @param A The input array to search
     * @param a The bytes32 to remove
     * @return Returns the array with the object removed.
     */
    function remove(bytes32[] memory A, bytes32 a)
        internal
        pure
        returns (bytes32[] memory)
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("bytes32 not in array.");
        } else {
            (bytes32[] memory _A,) = pop(A, index);
            return _A;
        }
    }

    /**
     * @param A The input array to search
     * @param a The bytes32 to remove
     */
    function removeStorage(bytes32[] storage A, bytes32 a)
        internal
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("bytes32 not in array.");
        } else {
            uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here
            if (index != lastIndex) { A[index] = A[lastIndex]; }
            A.pop();
        }
    }

    /**
    * Removes specified index from array
    * @param A The input array to search
    * @param index The index to remove
    * @return Returns the new array and the removed entry
    */
    function pop(bytes32[] memory A, uint256 index)
        internal
        pure
        returns (bytes32[] memory, bytes32)
    {
        uint256 length = A.length;
        require(index < A.length, "Index must be < A length");
        bytes32[] memory newBytes = new bytes32[](length - 1);
        for (uint256 i = 0; i < index; i++) {
            newBytes[i] = A[i];
        }
        for (uint256 j = index + 1; j < length; j++) {
            newBytes[j - 1] = A[j];
        }
        return (newBytes, A[index]);
    }
}
          

contracts/interfaces/IEscrow.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IPostIntentHook } from "./IPostIntentHook.sol";

interface IEscrow {
    
    /* ============ Structs ============ */

    struct Intent {
        bytes32 intentHash;                        // Unique identifier for the intent
        uint256 amount;                            // Amount locked
        uint256 timestamp;                         // When this intent was created
        uint256 expiryTime;                        // When this intent expires
    }

    struct Range {
        uint256 min;                                // Minimum value
        uint256 max;                                // Maximum value
    }

    struct Deposit {
        address depositor;                          // Address of depositor
        address delegate;                           // Address that can manage this deposit (address(0) if no delegate)
        IERC20 token;                               // Address of deposit token
        Range intentAmountRange;                    // Range of take amount per intent
        // Deposit state
        bool acceptingIntents;                      // State: True if the deposit is accepting intents, False otherwise
        uint256 remainingDeposits;                  // State: Amount of liquidity immediately available to lock
        uint256 outstandingIntentAmount;            // State: Amount of outstanding intents (may include expired intents)
        // Intent guardian
        address intentGuardian;                     // Address that can extend intent expiry times (address(0) if no guardian)
        // Retention behavior
        bool retainOnEmpty;                         // If true, do not auto-close/sweep when empty; keep config for reuse
    }

    struct Currency {
        bytes32 code;                               // Currency code (keccak256 hash of the currency code)
        uint256 minConversionRate;                  // Minimum rate of deposit token to fiat currency (in preciseUnits)
    }

    struct DepositPaymentMethodData {
        address intentGatingService;                // Public key of gating service that will be used to verify intents
        bytes32 payeeDetails;                       // Payee details, has to be hash of payee details
        bytes data;                                 // Verification Data: Additional data used for payment verification; Can hold attester address
                                                    // in case of TLS proofs, domain key hash in case of zkEmail proofs, currency code etc.
    }

    struct CreateDepositParams {
        IERC20 token;                                // The token to be deposited
        uint256 amount;                              // The amount of token to deposit
        Range intentAmountRange;                     // The max and min take amount for each intent
        bytes32[] paymentMethods;                    // The payment methods that deposit supports
        DepositPaymentMethodData[] paymentMethodData;// The payment verification data for each payment method that deposit supports
        Currency[][] currencies;                     // The currencies for each payment method that deposit supports
        address delegate;                            // Optional delegate address that can manage this deposit (address(0) for no delegate)
        address intentGuardian;                      // Optional intent guardian address that can extend intent expiry times (address(0) for no guardian)
        bool retainOnEmpty;                          // Opt-in: keep deposit and config when empty
    }

    /* ============ Events ============ */

    event DepositReceived(uint256 indexed depositId, address indexed depositor, IERC20 indexed token, uint256 amount, Range intentAmountRange, address delegate, address intentGuardian);

    event DepositPaymentMethodAdded(uint256 indexed depositId, bytes32 indexed paymentMethod, bytes32 indexed payeeDetails, address intentGatingService);
    event DepositPaymentMethodActiveUpdated(uint256 indexed depositId, bytes32 indexed paymentMethod, bool active);

    event DepositCurrencyAdded(uint256 indexed depositId, bytes32 indexed paymentMethod, bytes32 indexed currency, uint256 minConversionRate);
    event DepositMinConversionRateUpdated(uint256 indexed depositId, bytes32 indexed paymentMethod, bytes32 indexed currency, uint256 newMinConversionRate);
    
    event DepositFundsAdded(uint256 indexed depositId, address indexed depositor, uint256 amount);
    event DepositWithdrawn(uint256 indexed depositId, address indexed depositor, uint256 amount);
    event DepositClosed(uint256 depositId, address depositor);
    event DepositAcceptingIntentsUpdated(uint256 indexed depositId, bool acceptingIntents);

    event DepositIntentAmountRangeUpdated(uint256 indexed depositId, Range intentAmountRange);
    event DepositRetainOnEmptyUpdated(uint256 indexed depositId, bool retainOnEmpty);

    event DepositDelegateSet(uint256 indexed depositId, address indexed depositor, address indexed delegate);
    event DepositDelegateRemoved(uint256 indexed depositId, address indexed depositor);

    event MinDepositAmountSet(uint256 minDepositAmount);

    event OrchestratorUpdated(address indexed orchestrator);
    event PaymentVerifierRegistryUpdated(address indexed paymentVerifierRegistry);

    event FundsLocked(uint256 indexed depositId, bytes32 indexed intentHash, uint256 amount, uint256 expiryTime);
    event FundsUnlocked(uint256 indexed depositId, bytes32 indexed intentHash, uint256 amount);
    event FundsUnlockedAndTransferred(
        uint256 indexed depositId, 
        bytes32 indexed intentHash, 
        uint256 unlockedAmount, 
        uint256 transferredAmount, 
        address to
    );
    event IntentExpiryExtended(uint256 indexed depositId, bytes32 indexed intentHash, uint256 newExpiryTime);

    event DustRecipientUpdated(address indexed dustRecipient);
    event DustCollected(uint256 indexed depositId, uint256 dustAmount, address indexed dustRecipient);
    event DustThresholdUpdated(uint256 dustThreshold);
    event MaxIntentsPerDepositUpdated(uint256 maxIntentsPerDeposit);
    event IntentExpirationPeriodUpdated(uint256 intentExpirationPeriod);

    /* ============ Standardized Custom Errors ============ */
    
    // Zero value errors
    error ZeroAddress();
    error ZeroValue();
    error ZeroMinValue();
    error ZeroConversionRate();

    // Authorization errors
    error UnauthorizedCaller(address caller, address authorized);
    error UnauthorizedCallerOrDelegate(address caller, address owner, address delegate);

    // Range and amount errors
    error InvalidRange(uint256 min, uint256 max);
    error AmountBelowMin(uint256 amount, uint256 min);
    error AmountAboveMax(uint256 amount, uint256 max);
    error AmountExceedsAvailable(uint256 requested, uint256 available);

    // Not found errors
    error DepositNotFound(uint256 depositId);
    error IntentNotFound(bytes32 intentHash);
    error PaymentMethodNotActive(uint256 depositId, bytes32 paymentMethod);
    error PaymentMethodNotListed(uint256 depositId, bytes32 paymentMethod);
    error CurrencyNotFound(bytes32 paymentMethod, bytes32 currency);
    error DelegateNotFound(uint256 depositId);

    // Already exists errors
    error PaymentMethodAlreadyExists(uint256 depositId, bytes32 paymentMethod);
    error CurrencyAlreadyExists(bytes32 paymentMethod, bytes32 currency);
    error IntentAlreadyExists(uint256 depositId, bytes32 intentHash);

    // State errors
    error DepositNotAcceptingIntents(uint256 depositId);
    error DepositAlreadyInState(uint256 depositId, bool currentState);
    error InsufficientDepositLiquidity(uint256 depositId, uint256 available, uint256 required);
    error MaxIntentsExceeded(uint256 depositId, uint256 current, uint256 max);

    // Validation errors
    error EmptyPayeeDetails();
    error ArrayLengthMismatch(uint256 length1, uint256 length2);

    // Payment method errors
    error PaymentMethodNotWhitelisted(bytes32 paymentMethod);
    error CurrencyNotSupported(bytes32 paymentMethod, bytes32 currency);

    
    /* ============ External Functions for Orchestrator ============ */

    function lockFunds(uint256 _depositId, bytes32 _intentHash, uint256 _amount) external;
    function unlockFunds(uint256 _depositId, bytes32 _intentHash) external;
    function unlockAndTransferFunds(uint256 _depositId, bytes32 _intentHash, uint256 _transferAmount, address _to) external;
    function extendIntentExpiry(uint256 _depositId, bytes32 _intentHash, uint256 _newExpiryTime) external;

    /* ============ View Functions ============ */

    function getDeposit(uint256 _depositId) external view returns (Deposit memory);
    function getDepositIntent(uint256 _depositId, bytes32 _intentHash) external view returns (Intent memory);
    function getDepositPaymentMethods(uint256 _depositId) external view returns (bytes32[] memory);
    function getDepositCurrencies(uint256 _depositId, bytes32 _paymentMethod) external view returns (bytes32[] memory);
    function getDepositCurrencyMinRate(uint256 _depositId, bytes32 _paymentMethod, bytes32 _currencyCode) external view returns (uint256);
    function getDepositPaymentMethodData(uint256 _depositId, bytes32 _paymentMethod) external view returns (DepositPaymentMethodData memory);
    function getDepositPaymentMethodActive(uint256 _depositId, bytes32 _paymentMethod) external view returns (bool);
    function getDepositGatingService(uint256 _depositId, bytes32 _paymentMethod) external view returns (address);
    function getAccountDeposits(address _account) external view returns (uint256[] memory);
    function getDepositIntentHashes(uint256 _depositId) external view returns (bytes32[] memory);
    function getExpiredIntents(uint256 _depositId) external view returns (bytes32[] memory expiredIntents, uint256 reclaimableAmount);
}
          

contracts/interfaces/IEscrowRegistry.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

interface IEscrowRegistry {
    function isWhitelistedEscrow(address _escrow) external view returns (bool);
    function isAcceptingAllEscrows() external view returns (bool);
    function getWhitelistedEscrows() external view returns (address[] memory);
}
          

contracts/interfaces/IOrchestrator.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IPostIntentHook } from "./IPostIntentHook.sol";

interface IOrchestrator {
    
    /* ============ Structs ============ */

    struct Intent {
        address owner;                              // Address of the intent owner  
        address to;                                 // Address to forward funds to (can be same as owner)
        address escrow;                             // Address of the escrow contract holding the deposit
        uint256 depositId;                          // ID of the deposit the intent is associated with
        uint256 amount;                             // Amount of the deposit.token the owner wants to take
        uint256 timestamp;                          // Timestamp of the intent
        bytes32 paymentMethod;                      // The payment method to be used for the offchain payment
        bytes32 fiatCurrency;                       // Currency code that the owner is paying in offchain (keccak256 hash of the currency code)
        uint256 conversionRate;                     // Conversion rate of deposit token to fiat currency at the time of intent
        bytes32 payeeId;                            // Hashed payee identifier to whom the owner will pay offchain
        address referrer;                           // Address of the referrer who brought this intent (if any)
        uint256 referrerFee;                        // Fee to be paid to the referrer in preciseUnits (1e16 = 1%)
        IPostIntentHook postIntentHook;             // Address of the post-intent hook that will execute any post-intent actions
        bytes data;                                 // Additional data to be passed to the post-intent hook contract
    }

    struct SignalIntentParams {
        address escrow;                             // The escrow contract where the deposit is held
        uint256 depositId;                          // The ID of the deposit the taker intends to use
        uint256 amount;                             // The amount of deposit.token the user wants to take
        address to;                                 // Address to forward funds to
        bytes32 paymentMethod;                      // The payment method to be used for the offchain payment
        bytes32 fiatCurrency;                       // The currency code for offchain payment
        uint256 conversionRate;                     // The conversion rate agreed offchain
        address referrer;                           // Address of the referrer (address(0) if no referrer)
        uint256 referrerFee;                        // Fee to be paid to the referrer
        bytes gatingServiceSignature;               // Signature from the deposit's gating service
        uint256 signatureExpiration;                // Timestamp when the gating service signature expires
        IPostIntentHook postIntentHook;             // Optional post-intent hook (address(0) for no hook)
        bytes data;                                 // Additional data for the intent
    }

    struct FulfillIntentParams {
        bytes paymentProof;                         // Payment proof. Can be Groth16 Proof, TLSNotary proof, TLSProxy proof, attestation etc.
        bytes32 intentHash;                         // Identifier of intent being fulfilled
        bytes verificationData;                     // Additional data for payment verifier
        bytes postIntentHookData;                   // Additional data for post intent hook
    }

    /* ============ Events ============ */

    event IntentSignaled(
        bytes32 indexed intentHash, 
        address indexed escrow,
        uint256 indexed depositId, 
        bytes32 paymentMethod, 
        address owner, 
        address to, 
        uint256 amount, 
        bytes32 fiatCurrency, 
        uint256 conversionRate, 
        uint256 timestamp
    );

    event IntentPruned(
        bytes32 indexed intentHash
    );

    event IntentFulfilled(
        bytes32 indexed intentHash,
        address indexed fundsTransferredTo,   // Address that funds were transferred to; can be intent.to or postIntentHook address
        uint256 amount,
        bool isManualRelease
    );

    event AllowMultipleIntentsUpdated(bool allowMultiple);

    event PaymentVerifierRegistryUpdated(address indexed paymentVerifierRegistry);
    event PostIntentHookRegistryUpdated(address indexed postIntentHookRegistry);
    event RelayerRegistryUpdated(address indexed relayerRegistry);
    event EscrowRegistryUpdated(address indexed escrowRegistry);

    event ProtocolFeeUpdated(uint256 protocolFee);
    event ProtocolFeeRecipientUpdated(address indexed protocolFeeRecipient);
    event PartialManualReleaseDelayUpdated(uint256 partialManualReleaseDelay);

    /* ============ Standardized Custom Errors ============ */
    
    // Zero value errors
    error ZeroAddress();
    error ZeroValue();
    
    // Authorization errors
    error UnauthorizedEscrowCaller(address caller);
    error UnauthorizedCaller(address caller, address authorized);
    
    // Not found errors
    error IntentNotFound(bytes32 intentHash);
    error PaymentMethodDoesNotExist(bytes32 paymentMethod);
    error PaymentMethodNotSupported(bytes32 paymentMethod);
    error CurrencyNotSupported(bytes32 paymentMethod, bytes32 currency);
    
    // Whitelist errors
    error PaymentMethodNotWhitelisted(bytes32 paymentMethod);
    error PostIntentHookNotWhitelisted(address hook);
    error EscrowNotWhitelisted(address escrow);
    
    // Amount and fee errors
    error AmountBelowMin(uint256 amount, uint256 min);
    error AmountAboveMax(uint256 amount, uint256 max);
    error AmountExceedsLimit(uint256 amount, uint256 limit);
    error FeeExceedsMaximum(uint256 fee, uint256 maximum);
    error RateBelowMinimum(uint256 rate, uint256 minRate);
    
    // Validation errors
    error AccountHasActiveIntent(address account, bytes32 existingIntent);
    error InvalidReferrerFeeConfiguration();
    error InvalidSignature();
    error SignatureExpired(uint256 expiration, uint256 currentTime);
    error PartialReleaseNotAllowedYet(uint256 currentTime, uint256 allowedTime);

    // Verification errors
    error PaymentVerificationFailed();
    error HashMismatch(bytes32 expected, bytes32 actual);
     
    // Transfer errors
    error TransferFailed(address recipient, uint256 amount);
    error EscrowLockFailed();

    /* ============ View Functions ============ */

    function getIntent(bytes32 intentHash) external view returns (Intent memory);
    function getAccountIntents(address account) external view returns (bytes32[] memory);
    
    /* ============ External Functions for Users ============ */

    function signalIntent(SignalIntentParams calldata params) external;

    function cancelIntent(bytes32 intentHash) external;

    function fulfillIntent(FulfillIntentParams calldata params) external;

    function releaseFundsToPayer(bytes32 intentHash) external;

    /* ============ External Functions for Escrow ============ */

    function pruneIntents(bytes32[] calldata intentIds) external;
}
          

contracts/interfaces/IPaymentVerifier.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;


interface IPaymentVerifier {

    /* ============ Structs ============ */

    struct VerifyPaymentData {
        bytes32 intentHash;                     // The hash of the intent being fulfilled
        bytes paymentProof;                     // Payment proof
        bytes data;                             // Additional data provided by the taker
    }

    struct PaymentVerificationResult {
        bool success;                           // Whether the payment verification succeeded
        bytes32 intentHash;                     // The hash of the intent being fulfilled
        uint256 releaseAmount;                  // The amount of tokens to release
    }

    /* ============ External Functions ============ */

    function verifyPayment(
        VerifyPaymentData calldata _verifyPaymentData
    )   
        external
        returns(PaymentVerificationResult memory result);

}
          

contracts/interfaces/IPaymentVerifierRegistry.sol

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

interface IPaymentVerifierRegistry {
    function isPaymentMethod(bytes32 _paymentMethod) external view returns (bool);
    function getPaymentMethods() external view returns (bytes32[] memory);
    function getVerifier(bytes32 _paymentMethod) external view returns (address);
    function isCurrency(bytes32 _paymentMethod, bytes32 _currencyCode) external view returns (bool);
    function getCurrencies(bytes32 _paymentMethod) external view returns (bytes32[] memory);
}
          

contracts/interfaces/IPostIntentHook.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

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

/**
 * @title IPostIntentHook
 * @notice Interface for post-intent hooks
 */
interface IPostIntentHook {

    /**
     * @notice Post-intent hook
     * @param _intent The intent data structure containing all intent information
     * @param _fulfillIntentData The data passed to fulfillIntent
     */
    function execute(
        IOrchestrator.Intent memory _intent,
        uint256 _amountNetFees,
        bytes calldata _fulfillIntentData
    ) external;
}
          

Compiler Settings

{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","devdoc","userdoc","storageLayout","evm.gasEstimates"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":true},"libraries":{}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"uint256","name":"_chainId","internalType":"uint256"},{"type":"address","name":"_escrowRegistry","internalType":"address"},{"type":"address","name":"_paymentVerifierRegistry","internalType":"address"},{"type":"address","name":"_postIntentHookRegistry","internalType":"address"},{"type":"address","name":"_relayerRegistry","internalType":"address"},{"type":"uint256","name":"_protocolFee","internalType":"uint256"},{"type":"address","name":"_protocolFeeRecipient","internalType":"address"}]},{"type":"error","name":"AccountHasActiveIntent","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"existingIntent","internalType":"bytes32"}]},{"type":"error","name":"AmountAboveMax","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"max","internalType":"uint256"}]},{"type":"error","name":"AmountBelowMin","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"min","internalType":"uint256"}]},{"type":"error","name":"AmountExceedsLimit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"limit","internalType":"uint256"}]},{"type":"error","name":"CurrencyNotSupported","inputs":[{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"},{"type":"bytes32","name":"currency","internalType":"bytes32"}]},{"type":"error","name":"EscrowLockFailed","inputs":[]},{"type":"error","name":"EscrowNotWhitelisted","inputs":[{"type":"address","name":"escrow","internalType":"address"}]},{"type":"error","name":"FeeExceedsMaximum","inputs":[{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"uint256","name":"maximum","internalType":"uint256"}]},{"type":"error","name":"HashMismatch","inputs":[{"type":"bytes32","name":"expected","internalType":"bytes32"},{"type":"bytes32","name":"actual","internalType":"bytes32"}]},{"type":"error","name":"IntentNotFound","inputs":[{"type":"bytes32","name":"intentHash","internalType":"bytes32"}]},{"type":"error","name":"InvalidReferrerFeeConfiguration","inputs":[]},{"type":"error","name":"InvalidSignature","inputs":[]},{"type":"error","name":"PartialReleaseNotAllowedYet","inputs":[{"type":"uint256","name":"currentTime","internalType":"uint256"},{"type":"uint256","name":"allowedTime","internalType":"uint256"}]},{"type":"error","name":"PaymentMethodDoesNotExist","inputs":[{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"}]},{"type":"error","name":"PaymentMethodNotSupported","inputs":[{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"}]},{"type":"error","name":"PaymentMethodNotWhitelisted","inputs":[{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"}]},{"type":"error","name":"PaymentVerificationFailed","inputs":[]},{"type":"error","name":"PostIntentHookNotWhitelisted","inputs":[{"type":"address","name":"hook","internalType":"address"}]},{"type":"error","name":"RateBelowMinimum","inputs":[{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"minRate","internalType":"uint256"}]},{"type":"error","name":"SignatureExpired","inputs":[{"type":"uint256","name":"expiration","internalType":"uint256"},{"type":"uint256","name":"currentTime","internalType":"uint256"}]},{"type":"error","name":"TransferFailed","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"UnauthorizedCaller","inputs":[{"type":"address","name":"caller","internalType":"address"},{"type":"address","name":"authorized","internalType":"address"}]},{"type":"error","name":"UnauthorizedEscrowCaller","inputs":[{"type":"address","name":"caller","internalType":"address"}]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"error","name":"ZeroValue","inputs":[]},{"type":"event","name":"AllowMultipleIntentsUpdated","inputs":[{"type":"bool","name":"allowMultiple","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"EscrowRegistryUpdated","inputs":[{"type":"address","name":"escrowRegistry","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"IntentFulfilled","inputs":[{"type":"bytes32","name":"intentHash","internalType":"bytes32","indexed":true},{"type":"address","name":"fundsTransferredTo","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bool","name":"isManualRelease","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"IntentPruned","inputs":[{"type":"bytes32","name":"intentHash","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"IntentSignaled","inputs":[{"type":"bytes32","name":"intentHash","internalType":"bytes32","indexed":true},{"type":"address","name":"escrow","internalType":"address","indexed":true},{"type":"uint256","name":"depositId","internalType":"uint256","indexed":true},{"type":"bytes32","name":"paymentMethod","internalType":"bytes32","indexed":false},{"type":"address","name":"owner","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"fiatCurrency","internalType":"bytes32","indexed":false},{"type":"uint256","name":"conversionRate","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PartialManualReleaseDelayUpdated","inputs":[{"type":"uint256","name":"partialManualReleaseDelay","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PaymentVerifierRegistryUpdated","inputs":[{"type":"address","name":"paymentVerifierRegistry","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PostIntentHookRegistryUpdated","inputs":[{"type":"address","name":"postIntentHookRegistry","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ProtocolFeeRecipientUpdated","inputs":[{"type":"address","name":"protocolFeeRecipient","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ProtocolFeeUpdated","inputs":[{"type":"uint256","name":"protocolFee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RelayerRegistryUpdated","inputs":[{"type":"address","name":"relayerRegistry","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"allowMultipleIntents","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelIntent","inputs":[{"type":"bytes32","name":"_intentHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"chainId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IEscrowRegistry"}],"name":"escrowRegistry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"fulfillIntent","inputs":[{"type":"tuple","name":"_params","internalType":"struct IOrchestrator.FulfillIntentParams","components":[{"type":"bytes","name":"paymentProof","internalType":"bytes"},{"type":"bytes32","name":"intentHash","internalType":"bytes32"},{"type":"bytes","name":"verificationData","internalType":"bytes"},{"type":"bytes","name":"postIntentHookData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"}],"name":"getAccountIntents","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct IOrchestrator.Intent","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"address","name":"escrow","internalType":"address"},{"type":"uint256","name":"depositId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"},{"type":"bytes32","name":"fiatCurrency","internalType":"bytes32"},{"type":"uint256","name":"conversionRate","internalType":"uint256"},{"type":"bytes32","name":"payeeId","internalType":"bytes32"},{"type":"address","name":"referrer","internalType":"address"},{"type":"uint256","name":"referrerFee","internalType":"uint256"},{"type":"address","name":"postIntentHook","internalType":"contract IPostIntentHook"},{"type":"bytes","name":"data","internalType":"bytes"}]}],"name":"getIntent","inputs":[{"type":"bytes32","name":"_intentHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getIntentMinAtSignal","inputs":[{"type":"bytes32","name":"_intentHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"intentCounter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pauseOrchestrator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IPaymentVerifierRegistry"}],"name":"paymentVerifierRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IPostIntentHookRegistry"}],"name":"postIntentHookRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"protocolFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"protocolFeeRecipient","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pruneIntents","inputs":[{"type":"bytes32[]","name":"_intents","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRelayerRegistry"}],"name":"relayerRegistry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"releaseFundsToPayer","inputs":[{"type":"bytes32","name":"_intentHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAllowMultipleIntents","inputs":[{"type":"bool","name":"_allowMultiple","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEscrowRegistry","inputs":[{"type":"address","name":"_escrowRegistry","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPostIntentHookRegistry","inputs":[{"type":"address","name":"_postIntentHookRegistry","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProtocolFee","inputs":[{"type":"uint256","name":"_protocolFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProtocolFeeRecipient","inputs":[{"type":"address","name":"_protocolFeeRecipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRelayerRegistry","inputs":[{"type":"address","name":"_relayerRegistry","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalIntent","inputs":[{"type":"tuple","name":"_params","internalType":"struct IOrchestrator.SignalIntentParams","components":[{"type":"address","name":"escrow","internalType":"address"},{"type":"uint256","name":"depositId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"},{"type":"bytes32","name":"paymentMethod","internalType":"bytes32"},{"type":"bytes32","name":"fiatCurrency","internalType":"bytes32"},{"type":"uint256","name":"conversionRate","internalType":"uint256"},{"type":"address","name":"referrer","internalType":"address"},{"type":"uint256","name":"referrerFee","internalType":"uint256"},{"type":"bytes","name":"gatingServiceSignature","internalType":"bytes"},{"type":"uint256","name":"signatureExpiration","internalType":"uint256"},{"type":"address","name":"postIntentHook","internalType":"contract IPostIntentHook"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpauseOrchestrator","inputs":[]}]
              

Contract Creation Code

0x60a034620001e557601f62003af438819003918201601f19168301916001600160401b03831184841017620001ea5780849261010094604052833981010312620001e5576200004e8162000200565b906020810151620000626040830162000200565b620000706060840162000200565b6200007e6080850162000200565b906200008d60a0860162000200565b94620000a160e060c0830151920162000200565b91620000ad3362000215565b6000549560ff60a01b1987166000556001805560805260018060a01b03968780958180948160018060a01b03199a168a60055416176005551688600654161760065516866007541617600755168460085416176008556009551690600a541617600a558133911603620001a1578116156200014d576200012d9062000215565b60405161389790816200025d82396080518181816111db01526126930152f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001e557565b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6080604052600436101561001257600080fd5b6000803560e01c80630e63c83114611c0b5780632cc410dd146119dc578063392271a7146119b2578063406e1d181461198957806345a734b71461192857806347ff589d146118ff5780635095dd64146118d9578063565105101461182b5780635c975abb14611806578063648bdb321461176b57806364cb28111461170157806364df049e146116d8578063715018a61461167e578063787dce3d1461160157806381ceb735146115d857806382e2dfee146112935780638da5cb5b1461126c57806394ac05ad146111fe5780639a8a0592146111c3578063a8b000bd1461119a578063ac7a520c146107ce578063b0e21e8a146107b0578063cbcd99a314610746578063d55f960d1461051a578063e521cb92146104b0578063f13c46aa146102c3578063f2fde38b146101f8578063f5d46091146101da5763fc48395b1461015c57600080fd5b346101d75760203660031901126101d757610175612bbf565b61017d612ce2565b6001600160a01b031680156101c557600780546001600160a01b031916821790557f92060e1909279aefa624ed1bce0196f5683a70dfbdba1e2114de87d3e893277f8280a280f35b60405163d92e233d60e01b8152600490fd5b80fd5b50346101d757806003193601126101d7576020600b54604051908152f35b50346101d75760203660031901126101d757610212612bbf565b61021a612ce2565b6001600160a01b0390811690811561026f57600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346101d7576020806003193601126104ac57604051916102e383612d6b565b80835280828401528060408401528060608401528060808401528060a08401528060c08401528060e0840152610100928184820152610120938285830152600d61014095848785015261016090858286015261018090868287015260606101a0809701526004358752600288526040872092604051996103628b612d6b565b60018060a01b0392838654168c526001978c8c868b8a0154169101528c60408660028a0154169101528c606060038901549101528c608060048901549101528c60a060058901549101528c60c060068901549101528c60e060078901549101526008870154908d01526009860154908c015282600a86015416908b0152600b840154908a0152600c830154169088015201906040519384918184549461040786612f70565b9586865289848216918260001461048857505060011461044c575b50505061043192500383612d9a565b830152610448604051928284938452830190612c31565b0390f35b889350819291528282205b8583106104705750506104319350820101388080610422565b80548389018501528794508893909201918101610457565b93509450505061043194915060ff191682840152151560051b820101388080610422565b5080fd5b50346101d75760203660031901126101d7576104ca612bbf565b6104d2612ce2565b6001600160a01b031680156101c557600a80546001600160a01b031916821790557fc1b5345cce283376356748dc57f2dfa7120431d016fc7ca9ba641bc65f91411d8280a280f35b50346101d757602090816003193601126101d7576004359182825260028152604082209260405161054a81612d6b565b60018060a01b0390818654168152600195828782015416858301528260028201541696604083019788526003820154956060840196875260048301546080850152600d60058401549360a08601948552600681015460c0870152600781015460e08701526008810154610100870152600981015461012087015286600a82015416610140870152600b81015461016087015286600c82015416610180870152016040519283918a918154916105fe83612f70565b8086529282811690811561072457506001146106e7575b50505061062492500382612d9a565b6101a083015251156106ce57518116943386036106a357849550610647836130c4565b5116915190823b1561069e576044849283604051958694859363432e707b60e01b8552600485015260248401525af18015610693576106835750f35b61068c90612d87565b6101d75780f35b6040513d84823e3d90fd5b505050fd5b60405163536dd9ef60e01b81523360048201526001600160a01b0387166024820152604490fd5b0390fd5b604051639481f8b960e01b815260048101849052602490fd5b8c52848c209492508b91905b81831061070c5750506106249350820101388080610615565b855487840185015294850194869450918301916106f3565b9250505061062494925060ff191682840152151560051b820101388080610615565b50346101d75760203660031901126101d757610760612bbf565b610768612ce2565b6001600160a01b031680156101c557600580546001600160a01b031916821790557f873179742d8df742298832022224502b4c9b558e12342f5a48cf56cbb68a3acf8280a280f35b50346101d757806003193601126101d7576020600954604051908152f35b50346101d75760203660031901126101d7576001600160401b03600435116101d7576080600435360360031901126101d75761080861305b565b610810613014565b602460043501358152600260205260408120906040519161083083612d6b565b80546001600160a01b039081168452600182015481166020850152600282015481166040808601919091526003830154606086015260048301546080860152600583015460a0860152600683015460c0860152600783015460e086015260088301546101008601526009830154610120860152600a8301548216610140860152600b830154610160860152600c83015490911661018085015251600d8201549091829084906108de84612f70565b80845293600181169081156111785750600114611134575b5061090392500382612d9a565b6101a083015260c0820151156111185760018060a01b036040830151169161014060608201516024604051809681936313f3f72d60e31b835260048301525afa9283156106935782936110e5575b5060018060a01b036006541692602060c0830151602460405180978193631dd6f64960e31b835260048301525afa9384156110da57839461109e575b506001600160a01b03841615611082576060610a548495610a006109bb600435600401600435600401612f3e565b91906109f46109d4604460043501600435600401612f3e565b919092604051956109e487612d3a565b6024600435013587523691612dd6565b60208501523691612dd6565b60408201526040519687809481936305d103d160e11b835260206004840152805160248401526040610a4060208301518a60448701526084860190612c0c565b910151838203602319016064850152612c0c565b03926001600160a01b03165af192831561107757849361101a575b50825115611008576020830151602460043501358103610fe457506024600435013584526004602052604084205480151580610fd7575b610fb45750610aba602460043501356130c4565b8360018060a01b036040840151166060840151604086015190823b15610fb05760405163407c8d4360e01b8152600480820192909252903560249081013590820152604481019190915230606482015290829082908183816084810103925af1801561069357610f9c575b5050604090810151920151916001600160a01b0316610b6b610b59610b5260048035606481019101612f3e565b3691612dd6565b93610b65818585613637565b90613420565b60208301516101808401519194916001600160a01b039182169186911615610f895750506040516370a0823160e01b815230600482015290602082602481865afa918215610e4a578692610f55575b50610180840151610bd4906001600160a01b0316846136fd565b6101808401516001600160a01b03169085158015610ed5575b15610e715760405163095ea7b360e01b60208201526001600160a01b039092166024830152604482018690528691610c3c90610c3681606481015b03601f198101835282612d9a565b85613470565b6101808501516001600160a01b0316803b15610e6d57604051630e49803d60e41b8152606060048201529183918391829084908290610c9b908d90610c84606485018f612c31565b916024850152600319848303016044850152612c0c565b03925af1801561069357610e55575b50506040516370a0823160e01b815230600482015290602082602481865afa918215610e4a578692610e11575b50808211610db8578491610cea91613420565b03610d6157610180820151610d0a916001600160a01b03909116906136fd565b61018001516001600160a01b03165b60405191825282602083015260018060a01b0316907fd50b3b21bc45b85ddfaec58dbf56fe9b88754d08f47dcf5143b63258a57ad94460406024600435013592a36001805580f35b60405162461bcd60e51b815260206004820152602960248201527f506f7374496e74656e74486f6f6b3a206d7573742070756c6c206578616374206044820152681b995d105b5bdd5b9d60ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f506f7374496e74656e74486f6f6b3a20756e65787065637465642062616c616e60448201526a636520696e63726561736560a81b6064820152608490fd5b9091506020813d602011610e42575b81610e2d60209383612d9a565b81010312610e3d57519038610cd7565b600080fd5b3d9150610e20565b6040513d88823e3d90fd5b610e5e90612d87565b610e69578438610caa565b8480fd5b8280fd5b60405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608490fd5b50604051636eb1769f60e11b81523060048201526001600160a01b0383166024820152602081604481885afa908115610f4957600091610f17575b5015610bed565b906020823d602011610f41575b81610f3160209383612d9a565b810103126101d757505138610f10565b3d9150610f24565b6040513d6000823e3d90fd5b9091506020813d602011610f81575b81610f7160209383612d9a565b81010312610e3d57519038610bba565b3d9150610f64565b9150809350610f979261342d565b610d19565b610fa590612d87565b610fb0578338610b25565b8380fd5b604490604085015190604051916338fcec4360e01b835260048301526024820152fd5b5080604085015110610aa6565b604490604051906305846adf60e11b82526024600435013560048301526024820152fd5b604051636938802360e01b8152600490fd5b9092506060813d60601161106f575b8161103660609383612d9a565b81010312610fb057604080519161104c83612d3a565b61105581612e50565b835260208101516020840152015160408201529138610a6f565b3d9150611029565b6040513d86823e3d90fd5b602460c083015160405190630bd49acb60e31b82526004820152fd5b9093506020813d6020116110d2575b816110ba60209383612d9a565b81010312610e6d576110cb90612e3c565b923861098d565b3d91506110ad565b6040513d85823e3d90fd5b61110a9193506101403d61014011611111575b6111028183612d9a565b810190612e5d565b9138610951565b503d6110f8565b6024604051639481f8b960e01b81528160043501356004820152fd5b600d0185525060208420909184915b81831061115c57505090602061090392820101386108f6565b6020919350806001915483858801015201910190918392611143565b90506020925061090394915060ff191682840152151560051b820101386108f6565b50346101d757806003193601126101d7576007546040516001600160a01b039091168152602090f35b50346101d757806003193601126101d75760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101d75760203660031901126101d7576004358015158091036104ac5760207fdb1db9b43312d33850c773f181f11169bef701e90f3e3cfac979d27a31efc6f791611249612ce2565b600a805460ff60a01b191660a083901b60ff60a01b16179055604051908152a180f35b50346101d757806003193601126101d757546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d7576112ad61305b565b6004358152600260205260408120604051906112c882612d6b565b80546001600160a01b039081168352600182015481166020840152600282015481166040808501919091526003830154606085015260048301546080850152600583015460a0850152600683015460c0850152600783015460e085015260088301546101008501526009830154610120850152600a8301548216610140850152600b830154610160850152600c83015490911661018084015251600d82015490918290859061137684612f70565b80845293600181169081156115b65750600114611572575b5061139b92500382612d9a565b6101a082015280516001600160a01b0316156115595760018060a01b0360408201511661014060608301516024604051809481936313f3f72d60e31b835260048301525afa9081156110da578391611538575b5080516001600160a01b031633810361150f575061140d6004356130c4565b60408201516060830151608084015185926001600160a01b031691823b15610fb05760405163407c8d4360e01b81526004808201929092529035602482015260448101919091523060648201529082908290608490829084905af18015610693576114fb575b5050604060018060a01b0391015116906114b16114996080830151610b65818587613637565b6020830151909384916001600160a01b03169061342d565b602060018060a01b039101511690604051908152600160208201527fd50b3b21bc45b85ddfaec58dbf56fe9b88754d08f47dcf5143b63258a57ad944604060043592a36001805580f35b61150490612d87565b610e6d578238611473565b60405163536dd9ef60e01b81523360048201526001600160a01b03919091166024820152604490fd5b61155391506101403d61014011611111576111028183612d9a565b386113ee565b6024604051639481f8b960e01b81526004356004820152fd5b600d0186525060208520909185915b81831061159a57505090602061139b928201013861138e565b6020919350806001915483858801015201910190918392611581565b90506020925061139b94915060ff191682840152151560051b8201013861138e565b50346101d757806003193601126101d7576006546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75760043561161e612ce2565b66b1a2bc2ec5000080821161166057506020817fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de4092600955604051908152a180f35b604492506040519163037664ab60e21b835260048301526024820152fd5b50346101d757806003193601126101d757611697612ce2565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101d757806003193601126101d757600a546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75761171b612bbf565b611723612ce2565b6001600160a01b031680156101c557600880546001600160a01b031916821790557fd3c0577a88b56268da0350a01cb491fb15be69982729d9cb066a0603d1fc54b88280a280f35b50346101d757806003193601126101d757611784612ce2565b805460ff8160a01c16156117ca5760ff60a01b191681556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa90602090a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101d757806003193601126101d75760ff6020915460a01c166040519015158152f35b50346101d7576020806003193601126104ac576001600160a01b0361184e612bbf565b168252600381526040822060405192838383549182815201908193835284832090835b8181106118c55750505084611887910385612d9a565b60405193838594850191818652518092526040850193925b8281106118ae57505050500390f35b83518552869550938101939281019260010161189f565b825484529286019260019283019201611871565b50346101d757806003193601126101d757602060ff600a5460a01c166040519015158152f35b50346101d757806003193601126101d7576008546040516001600160a01b039091168152602090f35b50346101d757806003193601126101d757611941612ce2565b611949613014565b805460ff60a01b1916600160a01b1781556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a180f35b50346101d757806003193601126101d7576005546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75760406020916004358152600483522054604051908152f35b50346101d75760203660031901126101d7576001600160401b0380600435116104ac573660236004350112156104ac5760043560040135116101d7573660246004356004013560051b6004350101116101d757805b600435600401358110611a42575080f35b60248160051b600435010135611a61575b611a5c90612fef565b611a31565b60248160051b6004350101358252600280602052600d6040842060405192611a8884612d6b565b81546001600160a01b0390811685526001830154811660208601529082015481166040808601919091526003830154606086015260048301546080860152600583015460a0860152600683015460c0860152600783015460e086015260088301546101008601526009830154610120860152600a8301548216610140860152600b830154610160860152600c83015490911661018085015251910180548591611b3082612f70565b8085529160018116908115611be45750600114611bad575b505090611b5c81611a5c9594930382612d9a565b6101a082015260a081015115159081611b96575b50611b7d575b9050611a53565b611b9160248260051b6004350101356130c4565b611b76565b604001516001600160a01b03163314905038611b70565b8652602086208692505b818310611bce5750508101602001611b5c82611b48565b6001816020925483868801015201920191611bb7565b60ff191660208087019190915292151560051b85019092019250611b5c9150839050611b48565b50346101d7576003196020368201126104ac576001600160401b03600435116104ac576101a090600435360301126101d757611c45613014565b6040516101a081018181106001600160401b0382111761242357604052611c70600435600401612bd5565b81526004356024810135602083015260448101356040830152611c9590606401612bd5565b60608201526004356084810135608083015260a481013560a083015260c481013560c0830152611cc79060e401612bd5565b60e082015260043561010481013561010083015261012401356001600160401b038111610e6d57611cff906004369181350101612e0d565b61012082015260043561014481013561014083015261016401356001600160a01b03811690036104ac5760043561016481013561016083015261018401356001600160401b038111610e6d57611d5c906004369181350101612e0d565b610180820152600854604051631c98849b60e01b815233600482015290602090829060249082906001600160a01b03165afa9081156110da578391612b85575b508015612b76575b1580612b61575b612b145760608101516001600160a01b0316156101c55761010081015166b1a2bc2ec5000080821161166057505060e08101516001600160a01b031615612af8575b6101608101516001600160a01b031680612a50575b5060055481516040516363d8a2a760e11b81526001600160a01b039182166004820152911690602081602481855afa908115611077578491612a16575b501590816129ab575b506129885760018060a01b036006541660206080830151602460405180948193631dd6f64960e31b835260048301525afa9081156110da57839161294e575b506001600160a01b0316156129325780516020808301516080840151604051637414f90760e01b81526004810192909252602482015291829060449082906001600160a01b03165afa9081156110da5783916128f8575b50156128dc578051602080830151608084015160a085015160405163106c002d60e11b815260048101939093526024830191909152604482015291829060649082906001600160a01b03165afa9081156110da5783916128aa575b5080156128835760c0820151908082106128655750508051602080830151608084015160405163240c178160e01b8152600481019290925260248201529291839060449082906001600160a01b03165afa9182156110da578392612829575b506001600160a01b038216612607575b50507f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001600b5460405160208101913060601b8352603482015260348152611fee81612d3a565b519020069060246101406001600160a01b0361200d6004803501612e28565b16604051928380926313f3f72d60e31b825282600435013560048301525afa908115610693579060449183916125e6575b50826001600160a01b036120556004803501612e28565b16604051938480926317192c2960e01b82526024600435013560048301526084600435013560248301525afa9182156110da578392612501575b506060015151838352600460205260408320556121826120b3606460043501612e28565b9160206120c4600435600401612e28565b9101516120d560e460043501612e28565b6120ea61018460043501600435600401612f3e565b929093604051966120fa88612d6b565b3388526001600160a01b039081166020890152908116604088015260043560248101356060890152604481013560808901524260a0890152608481013560c089015260a481013560e089015260c48101356101008901526101208801929092529182166101408701526101048101356101608701526101640135166101808501523691612dd6565b6101a08201908152838352600260208181526040808620855181546001600160a01b03199081166001600160a01b03928316178355938701516001830180548616918316919091179055918601519381018054841694831694909417909355606085015160038401556080850151600484015560a0850151600584015560c0850151600684015560e0850151600784015561010085015160088401556101208501516009840155610140850151600a840180548416918316919091179055610160850151600b84015561018090940151600c83018054909216941693909317909255518051906001600160401b0382116124ed57612283600d840154612f70565b601f81116124af575b50602090601f831160011461244257600d9291859183612437575b50508160011b916000199060031b1c1916179101555b33815260036020526040812091825492680100000000000000008410156124235761230a6122f385849360018798018155612fc1565b819391549060031b91821b91600019901b19161790565b9055612317600b54612fef565b600b55612328600435600401612e28565b612336606460043501612e28565b60408051600435608481013582523360208301526001600160a01b03938416928201929092526044820135606082015260a4820135608082015260c482013560a08201524260c0820152602490910135929091169083907ff8c114f83581b2cf0b9f130782a93024aa8933e7d188901156bd68bdd558a20a9060e090a46001600160a01b036123c86004803501612e28565b16803b1561241f57606483926040519485938492630920752560e01b845260246004350135600485015260248401526044600435013560448401525af1801561069357612413575080f35b61241c90612d87565b80f35b5050fd5b634e487b7160e01b83526041600452602483fd5b0151905038806122a7565b90600d840185526020852091855b601f19851681106124975750918391600193600d95601f1981161061247e575b505050811b019101556122bd565b015160001960f88460031b161c19169055388080612470565b91926020600181928685015181550194019201612450565b6124dd90600d8501865260208620601f850160051c810191602086106124e3575b601f0160051c0190612faa565b3861228c565b90915081906124d0565b634e487b7160e01b84526041600452602484fd5b9091503d8084833e6125138183612d9a565b6020828281010312610fb05781516001600160401b038111610e695760608184018385010312610e69576040519261254a84612d3a565b612555828201612e3c565b845280820160208181015190860152604001516001600160401b0381116125e257838201601f82858501010112156125e2578083830101519261259784612dbb565b946125a56040519687612d9a565b848652830160208584848701010101116125de579160208594926125d29482606099980193010101612be9565b6040820152919061208f565b8780fd5b8680fd5b61260191506101403d61014011611111576111028183612d9a565b3861203e565b61014081015180421161280b57508051602082015190604083015190606084015190608085015160a08601519160c08701519361014088015195604051973060601b60208a01526bffffffffffffffffffffffff19809460601b1660348a01526048890152606888015260601b166088860152609c85015260bc84015260dc83015260fc82015261011c7f0000000000000000000000000000000000000000000000000000000000000000818301528152806101408101106001600160401b03610140830111176124ed576101408101604052602081519101207f19457468657265756d205369676e6564204d6573736167653a0a3332000000008452601c52610120603c84209101519161271c838361374e565b60058195929510156127f757908592911594856127e1575b50841561275e575b505050501561274c573880611fa8565b604051638baa579f60e01b8152600490fd5b8293945060405161279381610c286020820194630b135d3f60e11b998a87526024840152604060448401526064830190612c0c565b51915afa906127a061356e565b826127d3575b826127b7575b50503882818061273c565b909150602081805181010312610e6d57602001511438806127ac565b9150602082511015916127a6565b6001600160a01b03838116911614945038612734565b634e487b7160e01b86526021600452602486fd5b60449060405190630f88f04960e41b82526004820152426024820152fd5b9091506020813d60201161285d575b8161284560209383612d9a565b81010312610e6d5761285690612e3c565b9038611f98565b3d9150612838565b604492506040519163d8da863d60e01b835260048301526024820152fd5b60448260a0608082015191015160405191636bb6647d60e11b835260048301526024820152fd5b90506020813d6020116128d4575b816128c560209383612d9a565b81010312610e6d575138611f39565b3d91506128b8565b60806024910151604051906303531cc560e01b82526004820152fd5b90506020813d60201161292a575b8161291360209383612d9a565b81010312610e6d5761292490612e50565b38611ede565b3d9150612906565b6080602491015160405190630bd49acb60e31b82526004820152fd5b90506020813d602011612980575b8161296960209383612d9a565b81010312610e6d5761297a90612e3c565b38611e87565b3d915061295c565b5160405163f94cca3960e01b81526001600160a01b039091166004820152602490fd5b6040516375abeba960e11b81529150602090829060049082905afa9081156110da5783916129dc575b501538611e48565b90506020813d602011612a0e575b816129f760209383612d9a565b81010312610e6d57612a0890612e50565b386129d4565b3d91506129ea565b90506020813d602011612a48575b81612a3160209383612d9a565b81010312610fb057612a4290612e50565b38611e3f565b3d9150612a24565b600754604051633485a48d60e21b81526004810192909252602090829060249082906001600160a01b03165afa9081156110da578391612abe575b5015612a975738611e02565b61016001516040516364e219bd60e01b81526001600160a01b039091166004820152602490fd5b90506020813d602011612af0575b81612ad960209383612d9a565b81010312610e6d57612aea90612e50565b38612a8b565b3d9150612acc565b61010081015115611ded57604051625daeb360e91b8152600490fd5b50338152600360205260408120805415612b4d57816020916044935220546040519063675d034960e01b82523360048301526024820152fd5b634e487b7160e01b82526032600452602482fd5b50338252600360205260408220541515611dab565b5060ff600a5460a01c16611da4565b90506020813d602011612bb7575b81612ba060209383612d9a565b81010312610e6d57612bb190612e50565b38611d9c565b3d9150612b93565b600435906001600160a01b0382168203610e3d57565b35906001600160a01b0382168203610e3d57565b60005b838110612bfc5750506000910152565b8181015183820152602001612bec565b90602091612c2581518092818552858086019101612be9565b601f01601f1916010190565b90612cdf9160018060a01b03808251168352806020830151166020840152806040830151166040840152606082015160608401526080820151608084015260a082015160a084015260c082015160c084015260e082015160e084015261010080830151908401526101208083015190840152610140818184015116908401526101608083015190840152610180908183015116908301526101a080910151916101c080928201520190612c0c565b90565b6000546001600160a01b03163303612cf657565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b606081019081106001600160401b03821117612d5557604052565b634e487b7160e01b600052604160045260246000fd5b6101c081019081106001600160401b03821117612d5557604052565b6001600160401b038111612d5557604052565b90601f801991011681019081106001600160401b03821117612d5557604052565b6001600160401b038111612d5557601f01601f191660200190565b929192612de282612dbb565b91612df06040519384612d9a565b829481845281830111610e3d578281602093846000960137010152565b9080601f83011215610e3d57816020612cdf93359101612dd6565b356001600160a01b0381168103610e3d5790565b51906001600160a01b0382168203610e3d57565b51908115158203610e3d57565b809103906101408212610e3d576040805192610120906001600160401b039082860182811187821017612d55578452612e9585612e3c565b8652612ea360208601612e3c565b602087015284840151906001600160a01b0382168203610e3d57849182880152605f190112610e3d5782519081840190811182821017612d5557612f37935260608401518152608084015160208201526060850152612f0460a08401612e50565b608085015260c083015160a085015260e083015160c085015261010092612f2c848201612e3c565b60e086015201612e50565b9082015290565b903590601e1981360301821215610e3d57018035906001600160401b038211610e3d57602001918136038313610e3d57565b90600182811c92168015612fa0575b6020831014612f8a57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612f7f565b818110612fb5575050565b60008155600101612faa565b8054821015612fd95760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6000198114612ffe5760010190565b634e487b7160e01b600052601160045260246000fd5b60ff60005460a01c1661302357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60026001541461306c576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b81810292918115918404141715612ffe57565b90600090828252602090600282526040938484209385516130e481612d6b565b60018060a01b0380875416825260019181838901541687820152816002890154168982015260038801546060820152600d600498898101546080840152600581015460a0840152600681015460c0840152600781015460e08401526008810154610100840152600981015461012084015283600a82015416610140840152600b81015461016084015283600c8201541661018084015201895190818682549261318c84612f70565b938484528c89821691826000146134005750506001146133c2575b506131b492500382612d9a565b6101a0820152511682526003855286822087519081858883549485815201838752898720875b878c8883106133ad5750505050916131f7816131fc940382612d9a565b613815565b61323b57895162461bcd60e51b8152808a018990526015602482015274313cba32b99999103737ba1034b71030b93930bc9760591b6044820152606490fd5b600099959794969899199283810190811161339a57808203613373575b505080548015613360579282879695939287937f95eadd9e42ccacb548c6389441b53e6eebec39e11adaea9029a25fe1222483e09a9b9c96019161329c8383612fc1565b909182549160031b1b191690555588825260028352600d8583208381558383820155836002820155836003820155838682015583600582015583600682015583600782015583600882015583600982015583600a82015583600b82015583600c820155019061330b8254612f70565b9081613320575b5050508790525281205580a2565b8390601f831160011461333b57505050555b83388080613312565b61335990848394959352601f878520950160051c8501908501612faa565b5555613332565b634e487b7160e01b875260318a52602487fd5b6122f36133836133919285612fc1565b90549060031b1c9284612fc1565b90553880613258565b634e487b7160e01b885260118b52602488fd5b835485528b95509093019291820191016131da565b915050865281898088208789915b8583106133e75750506131b49350820101386131a7565b8091929450548385880101520191018a908785936133d0565b60ff1916858201526131b495151560051b85010192503891506131a79050565b91908203918211612ffe57565b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261346e91613469606483612d9a565b613470565b565b60408051908101916001600160a01b03166001600160401b03831182841017612d55576134df926040526000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16134d961356e565b9161359e565b805182811591821561354f575b50509050156134f85750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b8380929350010312610e3d57816135669101612e50565b8082386134ec565b3d15613599573d9061357f82612dbb565b9161358d6040519384612d9a565b82523d6000602084013e565b606090565b9192901561360057508151156135b2575090565b3b156135bb5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156136135750805190602001fd5b60405162461bcd60e51b8152602060048201529081906106ca906024830190612c0c565b600a5460009384936001600160a01b039390929091908416801515806136f2575b6136c9575b50610140830192848451161515806136bb575b613686575b50505050508101809111612ffe5790565b6136b1949550670de0b6b3a7640000916101606136a5920151906130b1565b0493849251169061342d565b3880808080613675565b506101608101511515613670565b95506136ec670de0b6b3a76400006136e3600954846130b1565b0480978461342d565b3861365d565b506009541515613658565b60405163095ea7b360e01b60208201526001600160a01b039092166024830152600060448084019190915282526080820191906001600160401b03831182841017612d555761346e92604052613470565b90604181511460001461377c57613778916020820151906060604084015193015160001a90613786565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116138095791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156137fc5781516001600160a01b038116156137f6579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b9081519160005b838110613830575050505060001990600090565b8151811015612fd9578260208260051b84010151146138575761385290612fef565b61381c565b925050509060019056fea2646970667358221220be72cfd4d07906661eba7929aefaad5514497965d40c19203f735e5602297a8264736f6c63430008120033000000000000000000000000c3c7e05d1ba19563693d891e5c38f0fc988a5d1100000000000000000000000000000000000000000000000000000000000001710000000000000000000000007238d0b6a28a3a6e3dfcd281d7cb9b3250b30ea60000000000000000000000006a4ff1950be05995dee75920cf27cd8febb6597a00000000000000000000000094f510fa245843ff5eda2d18479fe63ac51f8fe6000000000000000000000000689f82b4078aa07f443af9ae308534bd2ff545d300000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000948eb6d3a08beb29dc1d08d09753862573a94122

Deployed ByteCode

0x6080604052600436101561001257600080fd5b6000803560e01c80630e63c83114611c0b5780632cc410dd146119dc578063392271a7146119b2578063406e1d181461198957806345a734b71461192857806347ff589d146118ff5780635095dd64146118d9578063565105101461182b5780635c975abb14611806578063648bdb321461176b57806364cb28111461170157806364df049e146116d8578063715018a61461167e578063787dce3d1461160157806381ceb735146115d857806382e2dfee146112935780638da5cb5b1461126c57806394ac05ad146111fe5780639a8a0592146111c3578063a8b000bd1461119a578063ac7a520c146107ce578063b0e21e8a146107b0578063cbcd99a314610746578063d55f960d1461051a578063e521cb92146104b0578063f13c46aa146102c3578063f2fde38b146101f8578063f5d46091146101da5763fc48395b1461015c57600080fd5b346101d75760203660031901126101d757610175612bbf565b61017d612ce2565b6001600160a01b031680156101c557600780546001600160a01b031916821790557f92060e1909279aefa624ed1bce0196f5683a70dfbdba1e2114de87d3e893277f8280a280f35b60405163d92e233d60e01b8152600490fd5b80fd5b50346101d757806003193601126101d7576020600b54604051908152f35b50346101d75760203660031901126101d757610212612bbf565b61021a612ce2565b6001600160a01b0390811690811561026f57600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346101d7576020806003193601126104ac57604051916102e383612d6b565b80835280828401528060408401528060608401528060808401528060a08401528060c08401528060e0840152610100928184820152610120938285830152600d61014095848785015261016090858286015261018090868287015260606101a0809701526004358752600288526040872092604051996103628b612d6b565b60018060a01b0392838654168c526001978c8c868b8a0154169101528c60408660028a0154169101528c606060038901549101528c608060048901549101528c60a060058901549101528c60c060068901549101528c60e060078901549101526008870154908d01526009860154908c015282600a86015416908b0152600b840154908a0152600c830154169088015201906040519384918184549461040786612f70565b9586865289848216918260001461048857505060011461044c575b50505061043192500383612d9a565b830152610448604051928284938452830190612c31565b0390f35b889350819291528282205b8583106104705750506104319350820101388080610422565b80548389018501528794508893909201918101610457565b93509450505061043194915060ff191682840152151560051b820101388080610422565b5080fd5b50346101d75760203660031901126101d7576104ca612bbf565b6104d2612ce2565b6001600160a01b031680156101c557600a80546001600160a01b031916821790557fc1b5345cce283376356748dc57f2dfa7120431d016fc7ca9ba641bc65f91411d8280a280f35b50346101d757602090816003193601126101d7576004359182825260028152604082209260405161054a81612d6b565b60018060a01b0390818654168152600195828782015416858301528260028201541696604083019788526003820154956060840196875260048301546080850152600d60058401549360a08601948552600681015460c0870152600781015460e08701526008810154610100870152600981015461012087015286600a82015416610140870152600b81015461016087015286600c82015416610180870152016040519283918a918154916105fe83612f70565b8086529282811690811561072457506001146106e7575b50505061062492500382612d9a565b6101a083015251156106ce57518116943386036106a357849550610647836130c4565b5116915190823b1561069e576044849283604051958694859363432e707b60e01b8552600485015260248401525af18015610693576106835750f35b61068c90612d87565b6101d75780f35b6040513d84823e3d90fd5b505050fd5b60405163536dd9ef60e01b81523360048201526001600160a01b0387166024820152604490fd5b0390fd5b604051639481f8b960e01b815260048101849052602490fd5b8c52848c209492508b91905b81831061070c5750506106249350820101388080610615565b855487840185015294850194869450918301916106f3565b9250505061062494925060ff191682840152151560051b820101388080610615565b50346101d75760203660031901126101d757610760612bbf565b610768612ce2565b6001600160a01b031680156101c557600580546001600160a01b031916821790557f873179742d8df742298832022224502b4c9b558e12342f5a48cf56cbb68a3acf8280a280f35b50346101d757806003193601126101d7576020600954604051908152f35b50346101d75760203660031901126101d7576001600160401b03600435116101d7576080600435360360031901126101d75761080861305b565b610810613014565b602460043501358152600260205260408120906040519161083083612d6b565b80546001600160a01b039081168452600182015481166020850152600282015481166040808601919091526003830154606086015260048301546080860152600583015460a0860152600683015460c0860152600783015460e086015260088301546101008601526009830154610120860152600a8301548216610140860152600b830154610160860152600c83015490911661018085015251600d8201549091829084906108de84612f70565b80845293600181169081156111785750600114611134575b5061090392500382612d9a565b6101a083015260c0820151156111185760018060a01b036040830151169161014060608201516024604051809681936313f3f72d60e31b835260048301525afa9283156106935782936110e5575b5060018060a01b036006541692602060c0830151602460405180978193631dd6f64960e31b835260048301525afa9384156110da57839461109e575b506001600160a01b03841615611082576060610a548495610a006109bb600435600401600435600401612f3e565b91906109f46109d4604460043501600435600401612f3e565b919092604051956109e487612d3a565b6024600435013587523691612dd6565b60208501523691612dd6565b60408201526040519687809481936305d103d160e11b835260206004840152805160248401526040610a4060208301518a60448701526084860190612c0c565b910151838203602319016064850152612c0c565b03926001600160a01b03165af192831561107757849361101a575b50825115611008576020830151602460043501358103610fe457506024600435013584526004602052604084205480151580610fd7575b610fb45750610aba602460043501356130c4565b8360018060a01b036040840151166060840151604086015190823b15610fb05760405163407c8d4360e01b8152600480820192909252903560249081013590820152604481019190915230606482015290829082908183816084810103925af1801561069357610f9c575b5050604090810151920151916001600160a01b0316610b6b610b59610b5260048035606481019101612f3e565b3691612dd6565b93610b65818585613637565b90613420565b60208301516101808401519194916001600160a01b039182169186911615610f895750506040516370a0823160e01b815230600482015290602082602481865afa918215610e4a578692610f55575b50610180840151610bd4906001600160a01b0316846136fd565b6101808401516001600160a01b03169085158015610ed5575b15610e715760405163095ea7b360e01b60208201526001600160a01b039092166024830152604482018690528691610c3c90610c3681606481015b03601f198101835282612d9a565b85613470565b6101808501516001600160a01b0316803b15610e6d57604051630e49803d60e41b8152606060048201529183918391829084908290610c9b908d90610c84606485018f612c31565b916024850152600319848303016044850152612c0c565b03925af1801561069357610e55575b50506040516370a0823160e01b815230600482015290602082602481865afa918215610e4a578692610e11575b50808211610db8578491610cea91613420565b03610d6157610180820151610d0a916001600160a01b03909116906136fd565b61018001516001600160a01b03165b60405191825282602083015260018060a01b0316907fd50b3b21bc45b85ddfaec58dbf56fe9b88754d08f47dcf5143b63258a57ad94460406024600435013592a36001805580f35b60405162461bcd60e51b815260206004820152602960248201527f506f7374496e74656e74486f6f6b3a206d7573742070756c6c206578616374206044820152681b995d105b5bdd5b9d60ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f506f7374496e74656e74486f6f6b3a20756e65787065637465642062616c616e60448201526a636520696e63726561736560a81b6064820152608490fd5b9091506020813d602011610e42575b81610e2d60209383612d9a565b81010312610e3d57519038610cd7565b600080fd5b3d9150610e20565b6040513d88823e3d90fd5b610e5e90612d87565b610e69578438610caa565b8480fd5b8280fd5b60405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608490fd5b50604051636eb1769f60e11b81523060048201526001600160a01b0383166024820152602081604481885afa908115610f4957600091610f17575b5015610bed565b906020823d602011610f41575b81610f3160209383612d9a565b810103126101d757505138610f10565b3d9150610f24565b6040513d6000823e3d90fd5b9091506020813d602011610f81575b81610f7160209383612d9a565b81010312610e3d57519038610bba565b3d9150610f64565b9150809350610f979261342d565b610d19565b610fa590612d87565b610fb0578338610b25565b8380fd5b604490604085015190604051916338fcec4360e01b835260048301526024820152fd5b5080604085015110610aa6565b604490604051906305846adf60e11b82526024600435013560048301526024820152fd5b604051636938802360e01b8152600490fd5b9092506060813d60601161106f575b8161103660609383612d9a565b81010312610fb057604080519161104c83612d3a565b61105581612e50565b835260208101516020840152015160408201529138610a6f565b3d9150611029565b6040513d86823e3d90fd5b602460c083015160405190630bd49acb60e31b82526004820152fd5b9093506020813d6020116110d2575b816110ba60209383612d9a565b81010312610e6d576110cb90612e3c565b923861098d565b3d91506110ad565b6040513d85823e3d90fd5b61110a9193506101403d61014011611111575b6111028183612d9a565b810190612e5d565b9138610951565b503d6110f8565b6024604051639481f8b960e01b81528160043501356004820152fd5b600d0185525060208420909184915b81831061115c57505090602061090392820101386108f6565b6020919350806001915483858801015201910190918392611143565b90506020925061090394915060ff191682840152151560051b820101386108f6565b50346101d757806003193601126101d7576007546040516001600160a01b039091168152602090f35b50346101d757806003193601126101d75760206040517f00000000000000000000000000000000000000000000000000000000000001718152f35b50346101d75760203660031901126101d7576004358015158091036104ac5760207fdb1db9b43312d33850c773f181f11169bef701e90f3e3cfac979d27a31efc6f791611249612ce2565b600a805460ff60a01b191660a083901b60ff60a01b16179055604051908152a180f35b50346101d757806003193601126101d757546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d7576112ad61305b565b6004358152600260205260408120604051906112c882612d6b565b80546001600160a01b039081168352600182015481166020840152600282015481166040808501919091526003830154606085015260048301546080850152600583015460a0850152600683015460c0850152600783015460e085015260088301546101008501526009830154610120850152600a8301548216610140850152600b830154610160850152600c83015490911661018084015251600d82015490918290859061137684612f70565b80845293600181169081156115b65750600114611572575b5061139b92500382612d9a565b6101a082015280516001600160a01b0316156115595760018060a01b0360408201511661014060608301516024604051809481936313f3f72d60e31b835260048301525afa9081156110da578391611538575b5080516001600160a01b031633810361150f575061140d6004356130c4565b60408201516060830151608084015185926001600160a01b031691823b15610fb05760405163407c8d4360e01b81526004808201929092529035602482015260448101919091523060648201529082908290608490829084905af18015610693576114fb575b5050604060018060a01b0391015116906114b16114996080830151610b65818587613637565b6020830151909384916001600160a01b03169061342d565b602060018060a01b039101511690604051908152600160208201527fd50b3b21bc45b85ddfaec58dbf56fe9b88754d08f47dcf5143b63258a57ad944604060043592a36001805580f35b61150490612d87565b610e6d578238611473565b60405163536dd9ef60e01b81523360048201526001600160a01b03919091166024820152604490fd5b61155391506101403d61014011611111576111028183612d9a565b386113ee565b6024604051639481f8b960e01b81526004356004820152fd5b600d0186525060208520909185915b81831061159a57505090602061139b928201013861138e565b6020919350806001915483858801015201910190918392611581565b90506020925061139b94915060ff191682840152151560051b8201013861138e565b50346101d757806003193601126101d7576006546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75760043561161e612ce2565b66b1a2bc2ec5000080821161166057506020817fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de4092600955604051908152a180f35b604492506040519163037664ab60e21b835260048301526024820152fd5b50346101d757806003193601126101d757611697612ce2565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101d757806003193601126101d757600a546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75761171b612bbf565b611723612ce2565b6001600160a01b031680156101c557600880546001600160a01b031916821790557fd3c0577a88b56268da0350a01cb491fb15be69982729d9cb066a0603d1fc54b88280a280f35b50346101d757806003193601126101d757611784612ce2565b805460ff8160a01c16156117ca5760ff60a01b191681556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa90602090a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101d757806003193601126101d75760ff6020915460a01c166040519015158152f35b50346101d7576020806003193601126104ac576001600160a01b0361184e612bbf565b168252600381526040822060405192838383549182815201908193835284832090835b8181106118c55750505084611887910385612d9a565b60405193838594850191818652518092526040850193925b8281106118ae57505050500390f35b83518552869550938101939281019260010161189f565b825484529286019260019283019201611871565b50346101d757806003193601126101d757602060ff600a5460a01c166040519015158152f35b50346101d757806003193601126101d7576008546040516001600160a01b039091168152602090f35b50346101d757806003193601126101d757611941612ce2565b611949613014565b805460ff60a01b1916600160a01b1781556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a180f35b50346101d757806003193601126101d7576005546040516001600160a01b039091168152602090f35b50346101d75760203660031901126101d75760406020916004358152600483522054604051908152f35b50346101d75760203660031901126101d7576001600160401b0380600435116104ac573660236004350112156104ac5760043560040135116101d7573660246004356004013560051b6004350101116101d757805b600435600401358110611a42575080f35b60248160051b600435010135611a61575b611a5c90612fef565b611a31565b60248160051b6004350101358252600280602052600d6040842060405192611a8884612d6b565b81546001600160a01b0390811685526001830154811660208601529082015481166040808601919091526003830154606086015260048301546080860152600583015460a0860152600683015460c0860152600783015460e086015260088301546101008601526009830154610120860152600a8301548216610140860152600b830154610160860152600c83015490911661018085015251910180548591611b3082612f70565b8085529160018116908115611be45750600114611bad575b505090611b5c81611a5c9594930382612d9a565b6101a082015260a081015115159081611b96575b50611b7d575b9050611a53565b611b9160248260051b6004350101356130c4565b611b76565b604001516001600160a01b03163314905038611b70565b8652602086208692505b818310611bce5750508101602001611b5c82611b48565b6001816020925483868801015201920191611bb7565b60ff191660208087019190915292151560051b85019092019250611b5c9150839050611b48565b50346101d7576003196020368201126104ac576001600160401b03600435116104ac576101a090600435360301126101d757611c45613014565b6040516101a081018181106001600160401b0382111761242357604052611c70600435600401612bd5565b81526004356024810135602083015260448101356040830152611c9590606401612bd5565b60608201526004356084810135608083015260a481013560a083015260c481013560c0830152611cc79060e401612bd5565b60e082015260043561010481013561010083015261012401356001600160401b038111610e6d57611cff906004369181350101612e0d565b61012082015260043561014481013561014083015261016401356001600160a01b03811690036104ac5760043561016481013561016083015261018401356001600160401b038111610e6d57611d5c906004369181350101612e0d565b610180820152600854604051631c98849b60e01b815233600482015290602090829060249082906001600160a01b03165afa9081156110da578391612b85575b508015612b76575b1580612b61575b612b145760608101516001600160a01b0316156101c55761010081015166b1a2bc2ec5000080821161166057505060e08101516001600160a01b031615612af8575b6101608101516001600160a01b031680612a50575b5060055481516040516363d8a2a760e11b81526001600160a01b039182166004820152911690602081602481855afa908115611077578491612a16575b501590816129ab575b506129885760018060a01b036006541660206080830151602460405180948193631dd6f64960e31b835260048301525afa9081156110da57839161294e575b506001600160a01b0316156129325780516020808301516080840151604051637414f90760e01b81526004810192909252602482015291829060449082906001600160a01b03165afa9081156110da5783916128f8575b50156128dc578051602080830151608084015160a085015160405163106c002d60e11b815260048101939093526024830191909152604482015291829060649082906001600160a01b03165afa9081156110da5783916128aa575b5080156128835760c0820151908082106128655750508051602080830151608084015160405163240c178160e01b8152600481019290925260248201529291839060449082906001600160a01b03165afa9182156110da578392612829575b506001600160a01b038216612607575b50507f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001600b5460405160208101913060601b8352603482015260348152611fee81612d3a565b519020069060246101406001600160a01b0361200d6004803501612e28565b16604051928380926313f3f72d60e31b825282600435013560048301525afa908115610693579060449183916125e6575b50826001600160a01b036120556004803501612e28565b16604051938480926317192c2960e01b82526024600435013560048301526084600435013560248301525afa9182156110da578392612501575b506060015151838352600460205260408320556121826120b3606460043501612e28565b9160206120c4600435600401612e28565b9101516120d560e460043501612e28565b6120ea61018460043501600435600401612f3e565b929093604051966120fa88612d6b565b3388526001600160a01b039081166020890152908116604088015260043560248101356060890152604481013560808901524260a0890152608481013560c089015260a481013560e089015260c48101356101008901526101208801929092529182166101408701526101048101356101608701526101640135166101808501523691612dd6565b6101a08201908152838352600260208181526040808620855181546001600160a01b03199081166001600160a01b03928316178355938701516001830180548616918316919091179055918601519381018054841694831694909417909355606085015160038401556080850151600484015560a0850151600584015560c0850151600684015560e0850151600784015561010085015160088401556101208501516009840155610140850151600a840180548416918316919091179055610160850151600b84015561018090940151600c83018054909216941693909317909255518051906001600160401b0382116124ed57612283600d840154612f70565b601f81116124af575b50602090601f831160011461244257600d9291859183612437575b50508160011b916000199060031b1c1916179101555b33815260036020526040812091825492680100000000000000008410156124235761230a6122f385849360018798018155612fc1565b819391549060031b91821b91600019901b19161790565b9055612317600b54612fef565b600b55612328600435600401612e28565b612336606460043501612e28565b60408051600435608481013582523360208301526001600160a01b03938416928201929092526044820135606082015260a4820135608082015260c482013560a08201524260c0820152602490910135929091169083907ff8c114f83581b2cf0b9f130782a93024aa8933e7d188901156bd68bdd558a20a9060e090a46001600160a01b036123c86004803501612e28565b16803b1561241f57606483926040519485938492630920752560e01b845260246004350135600485015260248401526044600435013560448401525af1801561069357612413575080f35b61241c90612d87565b80f35b5050fd5b634e487b7160e01b83526041600452602483fd5b0151905038806122a7565b90600d840185526020852091855b601f19851681106124975750918391600193600d95601f1981161061247e575b505050811b019101556122bd565b015160001960f88460031b161c19169055388080612470565b91926020600181928685015181550194019201612450565b6124dd90600d8501865260208620601f850160051c810191602086106124e3575b601f0160051c0190612faa565b3861228c565b90915081906124d0565b634e487b7160e01b84526041600452602484fd5b9091503d8084833e6125138183612d9a565b6020828281010312610fb05781516001600160401b038111610e695760608184018385010312610e69576040519261254a84612d3a565b612555828201612e3c565b845280820160208181015190860152604001516001600160401b0381116125e257838201601f82858501010112156125e2578083830101519261259784612dbb565b946125a56040519687612d9a565b848652830160208584848701010101116125de579160208594926125d29482606099980193010101612be9565b6040820152919061208f565b8780fd5b8680fd5b61260191506101403d61014011611111576111028183612d9a565b3861203e565b61014081015180421161280b57508051602082015190604083015190606084015190608085015160a08601519160c08701519361014088015195604051973060601b60208a01526bffffffffffffffffffffffff19809460601b1660348a01526048890152606888015260601b166088860152609c85015260bc84015260dc83015260fc82015261011c7f0000000000000000000000000000000000000000000000000000000000000171818301528152806101408101106001600160401b03610140830111176124ed576101408101604052602081519101207f19457468657265756d205369676e6564204d6573736167653a0a3332000000008452601c52610120603c84209101519161271c838361374e565b60058195929510156127f757908592911594856127e1575b50841561275e575b505050501561274c573880611fa8565b604051638baa579f60e01b8152600490fd5b8293945060405161279381610c286020820194630b135d3f60e11b998a87526024840152604060448401526064830190612c0c565b51915afa906127a061356e565b826127d3575b826127b7575b50503882818061273c565b909150602081805181010312610e6d57602001511438806127ac565b9150602082511015916127a6565b6001600160a01b03838116911614945038612734565b634e487b7160e01b86526021600452602486fd5b60449060405190630f88f04960e41b82526004820152426024820152fd5b9091506020813d60201161285d575b8161284560209383612d9a565b81010312610e6d5761285690612e3c565b9038611f98565b3d9150612838565b604492506040519163d8da863d60e01b835260048301526024820152fd5b60448260a0608082015191015160405191636bb6647d60e11b835260048301526024820152fd5b90506020813d6020116128d4575b816128c560209383612d9a565b81010312610e6d575138611f39565b3d91506128b8565b60806024910151604051906303531cc560e01b82526004820152fd5b90506020813d60201161292a575b8161291360209383612d9a565b81010312610e6d5761292490612e50565b38611ede565b3d9150612906565b6080602491015160405190630bd49acb60e31b82526004820152fd5b90506020813d602011612980575b8161296960209383612d9a565b81010312610e6d5761297a90612e3c565b38611e87565b3d915061295c565b5160405163f94cca3960e01b81526001600160a01b039091166004820152602490fd5b6040516375abeba960e11b81529150602090829060049082905afa9081156110da5783916129dc575b501538611e48565b90506020813d602011612a0e575b816129f760209383612d9a565b81010312610e6d57612a0890612e50565b386129d4565b3d91506129ea565b90506020813d602011612a48575b81612a3160209383612d9a565b81010312610fb057612a4290612e50565b38611e3f565b3d9150612a24565b600754604051633485a48d60e21b81526004810192909252602090829060249082906001600160a01b03165afa9081156110da578391612abe575b5015612a975738611e02565b61016001516040516364e219bd60e01b81526001600160a01b039091166004820152602490fd5b90506020813d602011612af0575b81612ad960209383612d9a565b81010312610e6d57612aea90612e50565b38612a8b565b3d9150612acc565b61010081015115611ded57604051625daeb360e91b8152600490fd5b50338152600360205260408120805415612b4d57816020916044935220546040519063675d034960e01b82523360048301526024820152fd5b634e487b7160e01b82526032600452602482fd5b50338252600360205260408220541515611dab565b5060ff600a5460a01c16611da4565b90506020813d602011612bb7575b81612ba060209383612d9a565b81010312610e6d57612bb190612e50565b38611d9c565b3d9150612b93565b600435906001600160a01b0382168203610e3d57565b35906001600160a01b0382168203610e3d57565b60005b838110612bfc5750506000910152565b8181015183820152602001612bec565b90602091612c2581518092818552858086019101612be9565b601f01601f1916010190565b90612cdf9160018060a01b03808251168352806020830151166020840152806040830151166040840152606082015160608401526080820151608084015260a082015160a084015260c082015160c084015260e082015160e084015261010080830151908401526101208083015190840152610140818184015116908401526101608083015190840152610180908183015116908301526101a080910151916101c080928201520190612c0c565b90565b6000546001600160a01b03163303612cf657565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b606081019081106001600160401b03821117612d5557604052565b634e487b7160e01b600052604160045260246000fd5b6101c081019081106001600160401b03821117612d5557604052565b6001600160401b038111612d5557604052565b90601f801991011681019081106001600160401b03821117612d5557604052565b6001600160401b038111612d5557601f01601f191660200190565b929192612de282612dbb565b91612df06040519384612d9a565b829481845281830111610e3d578281602093846000960137010152565b9080601f83011215610e3d57816020612cdf93359101612dd6565b356001600160a01b0381168103610e3d5790565b51906001600160a01b0382168203610e3d57565b51908115158203610e3d57565b809103906101408212610e3d576040805192610120906001600160401b039082860182811187821017612d55578452612e9585612e3c565b8652612ea360208601612e3c565b602087015284840151906001600160a01b0382168203610e3d57849182880152605f190112610e3d5782519081840190811182821017612d5557612f37935260608401518152608084015160208201526060850152612f0460a08401612e50565b608085015260c083015160a085015260e083015160c085015261010092612f2c848201612e3c565b60e086015201612e50565b9082015290565b903590601e1981360301821215610e3d57018035906001600160401b038211610e3d57602001918136038313610e3d57565b90600182811c92168015612fa0575b6020831014612f8a57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612f7f565b818110612fb5575050565b60008155600101612faa565b8054821015612fd95760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6000198114612ffe5760010190565b634e487b7160e01b600052601160045260246000fd5b60ff60005460a01c1661302357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60026001541461306c576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b81810292918115918404141715612ffe57565b90600090828252602090600282526040938484209385516130e481612d6b565b60018060a01b0380875416825260019181838901541687820152816002890154168982015260038801546060820152600d600498898101546080840152600581015460a0840152600681015460c0840152600781015460e08401526008810154610100840152600981015461012084015283600a82015416610140840152600b81015461016084015283600c8201541661018084015201895190818682549261318c84612f70565b938484528c89821691826000146134005750506001146133c2575b506131b492500382612d9a565b6101a0820152511682526003855286822087519081858883549485815201838752898720875b878c8883106133ad5750505050916131f7816131fc940382612d9a565b613815565b61323b57895162461bcd60e51b8152808a018990526015602482015274313cba32b99999103737ba1034b71030b93930bc9760591b6044820152606490fd5b600099959794969899199283810190811161339a57808203613373575b505080548015613360579282879695939287937f95eadd9e42ccacb548c6389441b53e6eebec39e11adaea9029a25fe1222483e09a9b9c96019161329c8383612fc1565b909182549160031b1b191690555588825260028352600d8583208381558383820155836002820155836003820155838682015583600582015583600682015583600782015583600882015583600982015583600a82015583600b82015583600c820155019061330b8254612f70565b9081613320575b5050508790525281205580a2565b8390601f831160011461333b57505050555b83388080613312565b61335990848394959352601f878520950160051c8501908501612faa565b5555613332565b634e487b7160e01b875260318a52602487fd5b6122f36133836133919285612fc1565b90549060031b1c9284612fc1565b90553880613258565b634e487b7160e01b885260118b52602488fd5b835485528b95509093019291820191016131da565b915050865281898088208789915b8583106133e75750506131b49350820101386131a7565b8091929450548385880101520191018a908785936133d0565b60ff1916858201526131b495151560051b85010192503891506131a79050565b91908203918211612ffe57565b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261346e91613469606483612d9a565b613470565b565b60408051908101916001600160a01b03166001600160401b03831182841017612d55576134df926040526000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16134d961356e565b9161359e565b805182811591821561354f575b50509050156134f85750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b8380929350010312610e3d57816135669101612e50565b8082386134ec565b3d15613599573d9061357f82612dbb565b9161358d6040519384612d9a565b82523d6000602084013e565b606090565b9192901561360057508151156135b2575090565b3b156135bb5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156136135750805190602001fd5b60405162461bcd60e51b8152602060048201529081906106ca906024830190612c0c565b600a5460009384936001600160a01b039390929091908416801515806136f2575b6136c9575b50610140830192848451161515806136bb575b613686575b50505050508101809111612ffe5790565b6136b1949550670de0b6b3a7640000916101606136a5920151906130b1565b0493849251169061342d565b3880808080613675565b506101608101511515613670565b95506136ec670de0b6b3a76400006136e3600954846130b1565b0480978461342d565b3861365d565b506009541515613658565b60405163095ea7b360e01b60208201526001600160a01b039092166024830152600060448084019190915282526080820191906001600160401b03831182841017612d555761346e92604052613470565b90604181511460001461377c57613778916020820151906060604084015193015160001a90613786565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116138095791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156137fc5781516001600160a01b038116156137f6579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b9081519160005b838110613830575050505060001990600090565b8151811015612fd9578260208260051b84010151146138575761385290612fef565b61381c565b925050509060019056fea2646970667358221220be72cfd4d07906661eba7929aefaad5514497965d40c19203f735e5602297a8264736f6c63430008120033