ETH Price: $3,038.09 (+4.37%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update Remote Ch...196860562024-04-19 0:56:23204 days ago1713488183IN
0xaDcA2c82...4B34066d9
0 ETH0.000348728.26021664
Update Remote Ch...196565682024-04-14 21:51:35208 days ago1713131495IN
0xaDcA2c82...4B34066d9
0 ETH0.000396669.39560663
Update Remote Ch...196426792024-04-12 23:04:47210 days ago1712963087IN
0xaDcA2c82...4B34066d9
0 ETH0.0007682318.19679239
Update Remote Ch...196408972024-04-12 17:04:23210 days ago1712941463IN
0xaDcA2c82...4B34066d9
0 ETH0.0010652125.2312117
Update Remote Ch...196406012024-04-12 16:04:11210 days ago1712937851IN
0xaDcA2c82...4B34066d9
0 ETH0.0011195326.5178751
Update Remote Ch...196403022024-04-12 15:04:11210 days ago1712934251IN
0xaDcA2c82...4B34066d9
0 ETH0.0016570339.24960677
Update Remote Ch...196400052024-04-12 14:04:23210 days ago1712930663IN
0xaDcA2c82...4B34066d9
0 ETH0.0019713446.69440591
Update Remote Ch...196394582024-04-12 12:14:47210 days ago1712924087IN
0xaDcA2c82...4B34066d9
0 ETH0.000753717.85271923
Update Remote Ch...196391642024-04-12 11:14:59210 days ago1712920499IN
0xaDcA2c82...4B34066d9
0 ETH0.0005964514.1279977
Update Remote Ch...196391632024-04-12 11:14:47210 days ago1712920487IN
0xaDcA2c82...4B34066d9
0 ETH0.0006065314.36666
Update Remote Ch...196385652024-04-12 9:14:47210 days ago1712913287IN
0xaDcA2c82...4B34066d9
0 ETH0.0009768723.13876368
Update Remote Ch...196379872024-04-12 7:18:47210 days ago1712906327IN
0xaDcA2c82...4B34066d9
0 ETH0.0007891318.69192005
Update Remote Ch...196378282024-04-12 6:46:47210 days ago1712904407IN
0xaDcA2c82...4B34066d9
0 ETH0.0005947914.09275323
Update Remote Ch...196376792024-04-12 6:16:59211 days ago1712902619IN
0xaDcA2c82...4B34066d9
0 ETH0.0005121212.13059285
Update Remote Ch...196375282024-04-12 5:46:47211 days ago1712900807IN
0xaDcA2c82...4B34066d9
0 ETH0.000550413.03722287
Update Remote Ch...196369392024-04-12 3:47:11211 days ago1712893631IN
0xaDcA2c82...4B34066d9
0 ETH0.0005580913.21939911
Update Remote Ch...196369382024-04-12 3:46:59211 days ago1712893619IN
0xaDcA2c82...4B34066d9
0 ETH0.0005613113.29569224
Update Remote Ch...196363412024-04-12 1:46:47211 days ago1712886407IN
0xaDcA2c82...4B34066d9
0 ETH0.0005124212.13769859
Update Remote Ch...196360432024-04-12 0:46:59211 days ago1712882819IN
0xaDcA2c82...4B34066d9
0 ETH0.0005215712.35435134
Update Remote Ch...196358922024-04-12 0:16:47211 days ago1712881007IN
0xaDcA2c82...4B34066d9
0 ETH0.0005037111.93116688
Update Remote Ch...196357442024-04-11 23:46:59211 days ago1712879219IN
0xaDcA2c82...4B34066d9
0 ETH0.0004522610.71266403
Update Remote Ch...196357432024-04-11 23:46:47211 days ago1712879207IN
0xaDcA2c82...4B34066d9
0 ETH0.0004755311.26373639
Update Remote Ch...196355962024-04-11 23:16:59211 days ago1712877419IN
0xaDcA2c82...4B34066d9
0 ETH0.0005206212.33192388
Update Remote Ch...196352992024-04-11 22:16:59211 days ago1712873819IN
0xaDcA2c82...4B34066d9
0 ETH0.0006001314.21522139
Update Remote Ch...196351482024-04-11 21:46:47211 days ago1712872007IN
0xaDcA2c82...4B34066d9
0 ETH0.0007925318.77233756
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198162532024-05-07 5:58:35186 days ago1715061515
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198128112024-05-06 18:24:59186 days ago1715019899
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
198121282024-05-06 16:07:23186 days ago1715011643
0xaDcA2c82...4B34066d9
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PaymentHelper

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 14 : PaymentHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { IPaymentHelper } from "src/interfaces/IPaymentHelper.sol";
import { ISuperRBAC } from "src/interfaces/ISuperRBAC.sol";
import { ISuperRegistry } from "src/interfaces/ISuperRegistry.sol";
import { ISuperformFactory } from "src/interfaces/ISuperformFactory.sol";
import { IBaseStateRegistry } from "src/interfaces/IBaseStateRegistry.sol";
import { IAmbImplementation } from "src/interfaces/IAmbImplementation.sol";
import { Error } from "src/libraries/Error.sol";
import { DataLib } from "src/libraries/DataLib.sol";
import { ProofLib } from "src/libraries/ProofLib.sol";
import { ArrayCastLib } from "src/libraries/ArrayCastLib.sol";
import {
    SingleDirectSingleVaultStateReq,
    SingleXChainSingleVaultStateReq,
    SingleDirectMultiVaultStateReq,
    SingleXChainMultiVaultStateReq,
    MultiDstSingleVaultStateReq,
    MultiDstMultiVaultStateReq,
    LiqRequest,
    AMBMessage,
    MultiVaultSFData,
    SingleVaultSFData,
    AMBExtraData,
    InitMultiVaultData,
    InitSingleVaultData,
    ReturnMultiData,
    ReturnSingleData
} from "src/types/DataTypes.sol";
import { AggregatorV3Interface } from "src/vendor/chainlink/AggregatorV3Interface.sol";

/// @dev interface to read public variable from state registry
interface ReadOnlyBaseRegistry is IBaseStateRegistry {
    function payloadsCount() external view returns (uint256);
}

/// @title PaymentHelper
/// @dev Helps estimate the cost for the entire transaction lifecycle
/// @author ZeroPoint Labs
contract PaymentHelper is IPaymentHelper {
    using DataLib for uint256;
    using ArrayCastLib for LiqRequest;
    using ArrayCastLib for bool;
    using ProofLib for bytes;
    using ProofLib for AMBMessage;

    //////////////////////////////////////////////////////////////
    //                         CONSTANTS                        //
    //////////////////////////////////////////////////////////////

    uint256 private constant PROOF_LENGTH = 160;
    uint8 private constant SUPPORTED_FEED_PRECISION = 8;
    uint32 private constant TIMELOCK_FORM_ID = 2;
    uint256 private constant MAX_UINT256 = type(uint256).max;

    ISuperRegistry public immutable superRegistry;
    uint64 public immutable CHAIN_ID;

    //////////////////////////////////////////////////////////////
    //                     STATE VARIABLES                      //
    //////////////////////////////////////////////////////////////

    /// @dev xchain params
    mapping(uint64 chainId => AggregatorV3Interface) public nativeFeedOracle;
    mapping(uint64 chainId => AggregatorV3Interface) public gasPriceOracle;
    mapping(uint64 chainId => uint256 gasForSwap) public swapGasUsed;
    mapping(uint64 chainId => uint256 gasForUpdate) public updateGasUsed;
    mapping(uint64 chainId => uint256 gasForDeposit) public depositGasUsed;
    mapping(uint64 chainId => uint256 gasForWithdraw) public withdrawGasUsed;
    mapping(uint64 chainId => uint256 defaultNativePrice) public nativePrice;
    mapping(uint64 chainId => uint256 defaultGasPrice) public gasPrice;
    mapping(uint64 chainId => uint256 gasPerByte) public gasPerByte;
    mapping(uint64 chainId => uint256 gasForAck) public ackGasCost;
    mapping(uint64 chainId => uint256 gasForTimelock) public timelockCost;
    mapping(uint64 chainId => uint256 gasForEmergency) public emergencyCost;

    /// @dev register transmuter params
    bytes public extraDataForTransmuter;

    //////////////////////////////////////////////////////////////
    //                           STRUCTS                        //
    //////////////////////////////////////////////////////////////

    struct EstimateAckCostVars {
        uint256 currPayloadId;
        uint256 payloadHeader;
        uint8 callbackType;
        bytes payloadBody;
        uint8[] ackAmbIds;
        uint8 isMulti;
        uint64 srcChainId;
        bytes message;
    }

    struct LocalEstimateVars {
        uint256 len;
        uint256 superformIdsLen;
        uint256 totalDstGas;
        uint256 ambFees;
        bool paused;
    }

    //////////////////////////////////////////////////////////////
    //                       MODIFIERS                          //
    //////////////////////////////////////////////////////////////

    modifier onlyProtocolAdmin() {
        if (!ISuperRBAC(_getAddress(keccak256("SUPER_RBAC"))).hasProtocolAdminRole(msg.sender)) {
            revert Error.NOT_PROTOCOL_ADMIN();
        }
        _;
    }

    modifier onlyEmergencyAdmin() {
        if (!ISuperRBAC(_getAddress(keccak256("SUPER_RBAC"))).hasEmergencyAdminRole(msg.sender)) {
            revert Error.NOT_EMERGENCY_ADMIN();
        }
        _;
    }

    //////////////////////////////////////////////////////////////
    //                      CONSTRUCTOR                         //
    //////////////////////////////////////////////////////////////

    constructor(address superRegistry_) {
        if (superRegistry_ == address(0)) {
            revert Error.ZERO_ADDRESS();
        }

        if (block.chainid > type(uint64).max) {
            revert Error.BLOCK_CHAIN_ID_OUT_OF_BOUNDS();
        }

        CHAIN_ID = uint64(block.chainid);
        superRegistry = ISuperRegistry(superRegistry_);
    }

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @inheritdoc IPaymentHelper
    function calculateAMBData(
        uint64 dstChainId_,
        uint8[] calldata ambIds_,
        bytes memory message_
    )
        external
        view
        override
        returns (uint256 totalFees, bytes memory extraData)
    {
        (uint256[] memory gasPerAMB, bytes[] memory extraDataPerAMB, uint256 fees) =
            _estimateAMBFeesReturnExtraData(dstChainId_, ambIds_, message_);

        extraData = abi.encode(AMBExtraData(gasPerAMB, extraDataPerAMB));
        totalFees = fees;
    }

    /// @inheritdoc IPaymentHelper
    function getRegisterTransmuterAMBData() external view override returns (bytes memory) {
        return extraDataForTransmuter;
    }

    /// @inheritdoc IPaymentHelper
    function estimateMultiDstMultiVault(
        MultiDstMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount)
    {
        LocalEstimateVars memory v;
        v.len = req_.dstChainIds.length;

        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));
        for (uint256 i; i < v.len; ++i) {
            bool xChain = req_.dstChainIds[i] != CHAIN_ID;

            v.totalDstGas = 0;

            /// @dev step 1: estimate amb costs
            v.ambFees = xChain
                ? _estimateAMBFees(req_.ambIds[i], req_.dstChainIds[i], _generateMultiVaultMessage(req_.superformsData[i]))
                : 0;

            v.superformIdsLen = req_.superformsData[i].superformIds.length;

            srcAmount += v.ambFees;

            if (isDeposit_) {
                /// @dev step 2: estimate liq amount
                liqAmount += _estimateLiqAmount(req_.superformsData[i].liqRequests);

                if (xChain) {
                    /// @dev step 3: estimate update cost (only for deposit)
                    v.totalDstGas += _estimateUpdateCost(req_.dstChainIds[i], v.superformIdsLen);

                    uint256 ackLen;
                    for (uint256 j; j < v.superformIdsLen; ++j) {
                        if (!req_.superformsData[i].retain4626s[j]) ++ackLen;
                    }
                    /// @dev step 4: estimation processing cost of acknowledgement on source
                    srcAmount += _estimateAckProcessingCost(v.superformIdsLen);

                    /// @dev step 5: estimate dst swap cost if it exists
                    v.totalDstGas += _estimateSwapFees(req_.dstChainIds[i], req_.superformsData[i].hasDstSwaps);
                }
            } else {
                /// @dev step 6: estimate if timelock form processing costs are involved
                for (uint256 j; j < v.superformIdsLen; ++j) {
                    (, uint32 formId,) = req_.superformsData[i].superformIds[j].getSuperform();
                    v.paused = factory.isFormImplementationPaused(formId);

                    if (!v.paused && formId == TIMELOCK_FORM_ID) {
                        v.totalDstGas += timelockCost[req_.dstChainIds[i]];
                    } else if (v.paused) {
                        v.totalDstGas += emergencyCost[req_.dstChainIds[i]];
                    }
                }
            }

            /// @dev step 7: estimate execution costs in destination including sending acknowledgement to source
            /// @dev ensure that acknowledgement costs from dst to src are not double counted
            v.totalDstGas += xChain ? _estimateDstExecutionCost(isDeposit_, req_.dstChainIds[i], v.superformIdsLen) : 0;

            /// @dev step 8: convert all dst gas estimates to src chain estimate  (withdraw / deposit)
            dstAmount += _convertToNativeFee(req_.dstChainIds[i], v.totalDstGas);
        }

        totalAmount = srcAmount + dstAmount + liqAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateMultiDstSingleVault(
        MultiDstSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount)
    {
        uint256 len = req_.dstChainIds.length;
        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));

        for (uint256 i; i < len; ++i) {
            bool xChain = req_.dstChainIds[i] != CHAIN_ID;
            uint256 totalDstGas;

            /// @dev step 1: estimate amb costs
            uint256 ambFees = xChain
                ? _estimateAMBFees(req_.ambIds[i], req_.dstChainIds[i], _generateSingleVaultMessage(req_.superformsData[i]))
                : 0;

            srcAmount += ambFees;

            if (isDeposit_) {
                /// @dev step 2: estimate the liqAmount
                liqAmount += _estimateLiqAmount(req_.superformsData[i].liqRequest.castLiqRequestToArray());

                if (xChain) {
                    /// @dev step 3: estimate update cost (only for deposit)
                    totalDstGas += _estimateUpdateCost(req_.dstChainIds[i], 1);

                    /// @dev step 4: estimation execution cost of acknowledgement on source
                    if (!req_.superformsData[i].retain4626) {
                        srcAmount += _estimateAckProcessingCost(1);
                    }

                    /// @dev step 5: estimate if swap costs are involved
                    totalDstGas +=
                        _estimateSwapFees(req_.dstChainIds[i], req_.superformsData[i].hasDstSwap.castBoolToArray());
                }
            } else {
                /// @dev step 6: estimate if timelock form processing costs are involved
                (, uint32 formId,) = req_.superformsData[i].superformId.getSuperform();

                bool paused = factory.isFormImplementationPaused(formId);

                if (!paused && formId == TIMELOCK_FORM_ID) {
                    totalDstGas += timelockCost[req_.dstChainIds[i]];
                } else if (paused) {
                    totalDstGas += emergencyCost[req_.dstChainIds[i]];
                }
            }

            /// @dev step 7: estimate execution costs in destination including sending acknowledgement to source
            totalDstGas += xChain ? _estimateDstExecutionCost(isDeposit_, req_.dstChainIds[i], 1) : 0;

            /// @dev step 8: convert all dst gas estimates to src chain estimate
            dstAmount += _convertToNativeFee(req_.dstChainIds[i], totalDstGas);
        }

        totalAmount = srcAmount + dstAmount + liqAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateSingleXChainMultiVault(
        SingleXChainMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount)
    {
        uint256 totalDstGas;
        uint256 superformIdsLen = req_.superformsData.superformIds.length;

        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));

        /// @dev step 1: estimate AMB costs
        uint256 ambFees =
            _estimateAMBFees(req_.ambIds, req_.dstChainId, _generateMultiVaultMessage(req_.superformsData));
        srcAmount += ambFees;

        if (isDeposit_) {
            /// @dev step 2: estimate the liqAmount
            liqAmount += _estimateLiqAmount(req_.superformsData.liqRequests);

            /// @dev step 3: estimate update cost (only for deposit)
            totalDstGas += _estimateUpdateCost(req_.dstChainId, superformIdsLen);

            uint256 ackLen;
            for (uint256 i; i < superformIdsLen; ++i) {
                if (!req_.superformsData.retain4626s[i]) ++ackLen;
            }

            /// @dev step 4: estimation execution cost of acknowledgement on source
            srcAmount += _estimateAckProcessingCost(ackLen);

            /// @dev step 5: estimate if swap costs are involved
            totalDstGas += _estimateSwapFees(req_.dstChainId, req_.superformsData.hasDstSwaps);
        } else {
            /// @dev step 6: process non-deposit logic for timelock form processing costs
            for (uint256 i; i < superformIdsLen; ++i) {
                (, uint32 formId,) = req_.superformsData.superformIds[i].getSuperform();

                bool paused = factory.isFormImplementationPaused(formId);

                if (!paused && formId == TIMELOCK_FORM_ID) {
                    totalDstGas += timelockCost[req_.dstChainId];
                } else if (paused) {
                    totalDstGas += emergencyCost[req_.dstChainId];
                }
            }
        }

        /// @dev step 7: estimate execution costs in destination including sending acknowledgement to source
        /// @dev ensure that acknowledgement costs from dst to src are not double counted
        totalDstGas += _estimateDstExecutionCost(isDeposit_, req_.dstChainId, superformIdsLen);

        /// @dev step 8: convert all destination gas estimates to source chain estimate
        dstAmount += _convertToNativeFee(req_.dstChainId, totalDstGas);

        totalAmount = srcAmount + dstAmount + liqAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateSingleXChainSingleVault(
        SingleXChainSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount)
    {
        uint256 totalDstGas;
        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));

        /// @dev step 1: estimate AMB costs
        uint256 ambFees =
            _estimateAMBFees(req_.ambIds, req_.dstChainId, _generateSingleVaultMessage(req_.superformData));
        srcAmount += ambFees;

        if (isDeposit_) {
            /// @dev step 2: estimate the liqAmount
            liqAmount += _estimateLiqAmount(req_.superformData.liqRequest.castLiqRequestToArray());

            /// @dev step 3: estimate update cost (only for deposit)
            totalDstGas += _estimateUpdateCost(req_.dstChainId, 1);

            /// @dev step 4: estimation execution cost of acknowledgement on source
            if (!req_.superformData.retain4626) {
                srcAmount += _estimateAckProcessingCost(1);
            }

            /// @dev step 5: estimate if swap costs are involved
            totalDstGas += _estimateSwapFees(req_.dstChainId, req_.superformData.hasDstSwap.castBoolToArray());
        } else {
            /// @dev step 6: process non-deposit logic for timelock form processing costs
            (, uint32 formId,) = req_.superformData.superformId.getSuperform();

            bool paused = factory.isFormImplementationPaused(formId);

            if (!paused && formId == TIMELOCK_FORM_ID) {
                totalDstGas += timelockCost[req_.dstChainId];
            } else if (paused) {
                totalDstGas += emergencyCost[req_.dstChainId];
            }
        }

        /// @dev step 7: estimate execution costs in destination including sending acknowledgement to source
        totalDstGas += _estimateDstExecutionCost(isDeposit_, req_.dstChainId, 1);

        /// @dev step 8: convert all destination gas estimates to source chain estimate
        dstAmount += _convertToNativeFee(req_.dstChainId, totalDstGas);

        totalAmount = srcAmount + dstAmount + liqAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateSingleDirectSingleVault(
        SingleDirectSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount)
    {
        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));

        if (!isDeposit_) {
            /// @dev only if timelock form withdrawal is involved
            (, uint32 formId,) = req_.superformData.superformId.getSuperform();

            bool paused = factory.isFormImplementationPaused(formId);

            if (!paused && formId == TIMELOCK_FORM_ID) {
                srcAmount += timelockCost[CHAIN_ID] * _getGasPrice(CHAIN_ID);
            } else if (paused) {
                srcAmount += emergencyCost[CHAIN_ID] * _getGasPrice(CHAIN_ID);
            }
        } else {
            liqAmount = _estimateLiqAmount(req_.superformData.liqRequest.castLiqRequestToArray());
        }

        /// @dev not adding dstAmount to save some GAS
        totalAmount = liqAmount + srcAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateSingleDirectMultiVault(
        SingleDirectMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        override
        returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount)
    {
        ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY")));

        if (!isDeposit_) {
            uint256 len = req_.superformData.superformIds.length;
            uint256 timelockPrice = timelockCost[CHAIN_ID] * _getGasPrice(CHAIN_ID);
            uint256 emergencyPrice = emergencyCost[CHAIN_ID] * _getGasPrice(CHAIN_ID);
            for (uint256 i; i < len; ++i) {
                (, uint32 formId,) = req_.superformData.superformIds[i].getSuperform();
                bool paused = factory.isFormImplementationPaused(formId);

                if (!paused && formId == TIMELOCK_FORM_ID) {
                    srcAmount += timelockPrice;
                } else if (paused) {
                    srcAmount += emergencyPrice;
                }
            }
        } else {
            liqAmount += _estimateLiqAmount(req_.superformData.liqRequests);
        }

        /// @dev not adding dstAmount to save some GAS
        totalAmount = liqAmount + srcAmount;
    }

    /// @inheritdoc IPaymentHelper
    function estimateAMBFees(
        uint8[] memory ambIds_,
        uint64 dstChainId_,
        bytes memory message_,
        bytes[] memory extraData_
    )
        public
        view
        override
        returns (uint256 totalFees, uint256[] memory)
    {
        uint256 len = ambIds_.length;
        uint256[] memory fees = new uint256[](len);

        /// @dev just checks the estimate for sending message from src -> dst
        if (CHAIN_ID != dstChainId_) {
            for (uint256 i; i < len; ++i) {
                fees[i] = IAmbImplementation(superRegistry.getAmbAddress(ambIds_[i])).estimateFees(
                    dstChainId_, message_, extraData_[i]
                );

                totalFees += fees[i];
            }
        }

        return (totalFees, fees);
    }

    /// @inheritdoc IPaymentHelper
    function estimateAckCost(uint256 payloadId_) external view override returns (uint256 totalFees) {
        EstimateAckCostVars memory v;
        IBaseStateRegistry coreStateRegistry = IBaseStateRegistry(_getAddress(keccak256("CORE_STATE_REGISTRY")));
        v.currPayloadId = coreStateRegistry.payloadsCount();

        if (payloadId_ > v.currPayloadId) revert Error.INVALID_PAYLOAD_ID();

        v.payloadHeader = coreStateRegistry.payloadHeader(payloadId_);
        v.payloadBody = coreStateRegistry.payloadBody(payloadId_);

        (, v.callbackType, v.isMulti,,, v.srcChainId) = DataLib.decodeTxInfo(v.payloadHeader);

        /// if callback type is return then return 0
        if (v.callbackType != 0) return 0;

        if (v.isMulti == 1) {
            InitMultiVaultData memory data = abi.decode(v.payloadBody, (InitMultiVaultData));
            v.payloadBody = abi.encode(ReturnMultiData(v.currPayloadId, data.superformIds, data.amounts));
        } else {
            InitSingleVaultData memory data = abi.decode(v.payloadBody, (InitSingleVaultData));
            v.payloadBody = abi.encode(ReturnSingleData(v.currPayloadId, data.superformId, data.amount));
        }

        v.ackAmbIds = coreStateRegistry.getMessageAMB(payloadId_);

        v.message = abi.encode(AMBMessage(coreStateRegistry.payloadHeader(payloadId_), v.payloadBody));

        return _estimateAMBFees(v.ackAmbIds, v.srcChainId, v.message);
    }

    /// @inheritdoc IPaymentHelper
    function estimateAckCostDefault(
        bool multi,
        uint8[] memory ackAmbIds,
        uint64 srcChainId
    )
        public
        view
        override
        returns (uint256 totalFees)
    {
        bytes memory payloadBody;
        if (multi) {
            uint256 vaultLimitPerDst = superRegistry.getVaultLimitPerDestination(srcChainId);
            uint256[] memory maxUints = new uint256[](vaultLimitPerDst);

            for (uint256 i; i < vaultLimitPerDst; ++i) {
                maxUints[i] = type(uint256).max;
            }
            payloadBody = abi.encode(ReturnMultiData(type(uint256).max, maxUints, maxUints));
        } else {
            payloadBody = abi.encode(ReturnSingleData(type(uint256).max, type(uint256).max, type(uint256).max));
        }

        return _estimateAMBFees(ackAmbIds, srcChainId, abi.encode(AMBMessage(type(uint256).max, payloadBody)));
    }

    /// @inheritdoc IPaymentHelper
    function estimateAckCostDefaultNativeSource(
        bool multi,
        uint8[] memory ackAmbIds,
        uint64 srcChainId
    )
        external
        view
        override
        returns (uint256)
    {
        return _convertToSrcNativeAmount(srcChainId, estimateAckCostDefault(multi, ackAmbIds, srcChainId));
    }

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @inheritdoc IPaymentHelper
    function addRemoteChain(
        uint64 chainId_,
        PaymentHelperConfig calldata config_
    )
        external
        override
        onlyProtocolAdmin
    {
        if (config_.nativeFeedOracle != address(0)) {
            AggregatorV3Interface nativeFeedOracleContract = AggregatorV3Interface(config_.nativeFeedOracle);
            if (nativeFeedOracleContract.decimals() != SUPPORTED_FEED_PRECISION) {
                revert Error.CHAINLINK_UNSUPPORTED_DECIMAL();
            }

            nativeFeedOracle[chainId_] = nativeFeedOracleContract;
        }

        if (config_.gasPriceOracle != address(0)) {
            AggregatorV3Interface gasPriceOracleContract = AggregatorV3Interface(config_.gasPriceOracle);
            if (gasPriceOracleContract.decimals() != SUPPORTED_FEED_PRECISION) {
                revert Error.CHAINLINK_UNSUPPORTED_DECIMAL();
            }

            gasPriceOracle[chainId_] = gasPriceOracleContract;
        }

        swapGasUsed[chainId_] = config_.swapGasUsed;
        updateGasUsed[chainId_] = config_.updateGasUsed;
        depositGasUsed[chainId_] = config_.depositGasUsed;
        withdrawGasUsed[chainId_] = config_.withdrawGasUsed;
        nativePrice[chainId_] = config_.defaultNativePrice;
        gasPrice[chainId_] = config_.defaultGasPrice;
        gasPerByte[chainId_] = config_.dstGasPerByte;
        ackGasCost[chainId_] = config_.ackGasCost;
        timelockCost[chainId_] = config_.timelockCost;
        emergencyCost[chainId_] = config_.emergencyCost;

        emit ChainConfigAdded(chainId_, config_);
    }

    /// @inheritdoc IPaymentHelper
    function updateRemoteChain(
        uint64 chainId_,
        uint256 configType_,
        bytes memory config_
    )
        external
        override
        onlyEmergencyAdmin
    {
        /// @dev Type 1: DST TOKEN PRICE FEED ORACLE
        if (configType_ == 1) {
            AggregatorV3Interface nativeFeedOracleContract = AggregatorV3Interface(abi.decode(config_, (address)));

            /// @dev allows setting price feed to address(0), equivalent for resetting native price
            if (
                address(nativeFeedOracleContract) != address(0)
                    && nativeFeedOracleContract.decimals() != SUPPORTED_FEED_PRECISION
            ) {
                revert Error.CHAINLINK_UNSUPPORTED_DECIMAL();
            }

            nativeFeedOracle[chainId_] = nativeFeedOracleContract;
        }

        /// @dev Type 2: DST GAS PRICE ORACLE
        if (configType_ == 2) {
            AggregatorV3Interface gasPriceOracleContract = AggregatorV3Interface(abi.decode(config_, (address)));

            /// @dev allows setting gas price to address(0), equivalent for resetting gas price
            if (
                address(gasPriceOracleContract) != address(0)
                    && gasPriceOracleContract.decimals() != SUPPORTED_FEED_PRECISION
            ) {
                revert Error.CHAINLINK_UNSUPPORTED_DECIMAL();
            }

            gasPriceOracle[chainId_] = gasPriceOracleContract;
        }

        /// @dev Type 3: SWAP GAS USED
        if (configType_ == 3) {
            swapGasUsed[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 4: PAYLOAD UPDATE GAS COST PER TX FOR DEPOSIT
        if (configType_ == 4) {
            updateGasUsed[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 5: DEPOSIT GAS COST PER TX
        if (configType_ == 5) {
            depositGasUsed[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 6: WITHDRAW GAS COST PER TX
        if (configType_ == 6) {
            withdrawGasUsed[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 7: DEFAULT NATIVE PRICE
        if (configType_ == 7) {
            nativePrice[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 8: DEFAULT GAS PRICE
        if (configType_ == 8) {
            gasPrice[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 9: GAS PRICE PER Byte of Message
        if (configType_ == 9) {
            gasPerByte[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 10: ACK GAS COST
        if (configType_ == 10) {
            ackGasCost[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 11: TIMELOCK PROCESSING COST
        if (configType_ == 11) {
            timelockCost[chainId_] = abi.decode(config_, (uint256));
        }

        /// @dev Type 12: EMERGENCY PROCESSING COST
        if (configType_ == 12) {
            emergencyCost[chainId_] = abi.decode(config_, (uint256));
        }

        emit ChainConfigUpdated(chainId_, configType_, config_);
    }

    /// @inheritdoc IPaymentHelper
    function updateRegisterAERC20Params(bytes memory extraDataForTransmuter_) external onlyEmergencyAdmin {
        extraDataForTransmuter = extraDataForTransmuter_;
    }

    //////////////////////////////////////////////////////////////
    //                  INTERNAL FUNCTIONS                      //
    //////////////////////////////////////////////////////////////

    /// @dev helps generate extra data per amb
    function _generateExtraData(
        uint64 dstChainId_,
        uint8[] memory ambIds_,
        bytes memory message_
    )
        internal
        view
        returns (bytes[] memory extraDataPerAMB)
    {
        AMBMessage memory ambIdEncodedMessage = abi.decode(message_, (AMBMessage));
        ambIdEncodedMessage.params = abi.encode(ambIds_, ambIdEncodedMessage.params);

        uint256 len = ambIds_.length;
        uint256 gasReqPerByte = gasPerByte[dstChainId_];
        uint256 totalDstGasReqInWei = abi.encode(ambIdEncodedMessage).length * gasReqPerByte;

        /// @dev proof length is always of fixed length
        uint256 totalDstGasReqInWeiForProof = PROOF_LENGTH * gasReqPerByte;

        extraDataPerAMB = new bytes[](len);

        for (uint256 i; i < len; ++i) {
            uint256 gasReq = i != 0 ? totalDstGasReqInWeiForProof : totalDstGasReqInWei;
            extraDataPerAMB[i] = IAmbImplementation(superRegistry.getAmbAddress(ambIds_[i])).generateExtraData(gasReq);
        }
    }

    /// @dev helps estimate the cross-chain message costs
    function _estimateAMBFees(
        uint8[] memory ambIds_,
        uint64 dstChainId_,
        bytes memory message_
    )
        internal
        view
        returns (uint256 totalFees)
    {
        uint256 len = ambIds_.length;

        bytes[] memory extraDataPerAMB = _generateExtraData(dstChainId_, ambIds_, message_);

        AMBMessage memory ambIdEncodedMessage = abi.decode(message_, (AMBMessage));
        ambIdEncodedMessage.params = abi.encode(ambIds_, ambIdEncodedMessage.params);

        bytes memory proof_ = abi.encode(AMBMessage(MAX_UINT256, abi.encode(keccak256(message_))));

        /// @dev just checks the estimate for sending message from src -> dst
        /// @dev only ambIds_[0] = primary amb (rest of the ambs send only the proof)
        if (CHAIN_ID != dstChainId_) {
            for (uint256 i; i < len; ++i) {
                uint256 tempFee = IAmbImplementation(superRegistry.getAmbAddress(ambIds_[i])).estimateFees(
                    dstChainId_, i != 0 ? proof_ : abi.encode(ambIdEncodedMessage), extraDataPerAMB[i]
                );

                totalFees += tempFee;
            }
        }
    }

    /// @dev helps estimate the cross-chain message costs
    function _estimateAMBFeesReturnExtraData(
        uint64 dstChainId_,
        uint8[] calldata ambIds_,
        bytes memory message_
    )
        internal
        view
        returns (uint256[] memory feeSplitUp, bytes[] memory extraDataPerAMB, uint256 totalFees)
    {
        AMBMessage memory ambIdEncodedMessage = abi.decode(message_, (AMBMessage));
        ambIdEncodedMessage.params = abi.encode(ambIds_, ambIdEncodedMessage.params);

        uint256 len = ambIds_.length;

        extraDataPerAMB = _generateExtraData(dstChainId_, ambIds_, message_);

        feeSplitUp = new uint256[](len);

        bytes memory proof_ = abi.encode(AMBMessage(MAX_UINT256, abi.encode(keccak256(message_))));

        /// @dev just checks the estimate for sending message from src -> dst
        if (CHAIN_ID != dstChainId_) {
            for (uint256 i; i < len; ++i) {
                uint256 tempFee = IAmbImplementation(superRegistry.getAmbAddress(ambIds_[i])).estimateFees(
                    dstChainId_, i != 0 ? proof_ : abi.encode(ambIdEncodedMessage), extraDataPerAMB[i]
                );

                totalFees += tempFee;
                feeSplitUp[i] = tempFee;
            }
        }
    }

    /// @dev helps estimate the liq amount involved in the tx
    function _estimateLiqAmount(LiqRequest[] memory req_) internal pure returns (uint256 liqAmount) {
        uint256 len = req_.length;
        for (uint256 i; i < len; ++i) {
            liqAmount += req_[i].nativeAmount;
        }
    }

    /// @dev helps estimate the dst chain swap gas limit (if multi-tx is involved)
    function _estimateSwapFees(
        uint64 dstChainId_,
        bool[] memory hasDstSwaps_
    )
        internal
        view
        returns (uint256 gasUsed)
    {
        uint256 totalSwaps;

        if (CHAIN_ID == dstChainId_) {
            return 0;
        }

        uint256 len = hasDstSwaps_.length;
        for (uint256 i; i < len; ++i) {
            /// @dev checks if hasDstSwap is true
            if (hasDstSwaps_[i]) {
                ++totalSwaps;
            }
        }

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

        return totalSwaps * swapGasUsed[dstChainId_];
    }

    /// @dev helps estimate the dst chain update payload gas limit
    function _estimateUpdateCost(uint64 dstChainId_, uint256 vaultsCount_) internal view returns (uint256 gasUsed) {
        return vaultsCount_ * updateGasUsed[dstChainId_];
    }

    /// @dev helps estimate the dst chain processing cost including the dst->src message cost
    /// @dev assumes that withdrawals optimisically succeed
    function _estimateDstExecutionCost(
        bool isDeposit_,
        uint64 dstChainId_,
        uint256 vaultsCount_
    )
        internal
        view
        returns (uint256 gasUsed)
    {
        uint256 executionGasPerVault = isDeposit_ ? depositGasUsed[dstChainId_] : withdrawGasUsed[dstChainId_];
        gasUsed = executionGasPerVault * vaultsCount_;
    }

    /// @dev helps estimate the src chain processing fee
    function _estimateAckProcessingCost(uint256 vaultsCount_) internal view returns (uint256 nativeFee) {
        uint256 gasCost = vaultsCount_ * ackGasCost[CHAIN_ID];

        return gasCost * _getGasPrice(CHAIN_ID);
    }

    /// @dev generates the amb message for single vault data
    function _generateSingleVaultMessage(SingleVaultSFData memory sfData_)
        internal
        view
        returns (bytes memory message_)
    {
        bytes memory ambData = abi.encode(
            InitSingleVaultData(
                _getNextPayloadId(),
                sfData_.superformId,
                sfData_.amount,
                sfData_.outputAmount,
                sfData_.maxSlippage,
                sfData_.liqRequest,
                sfData_.hasDstSwap,
                sfData_.retain4626,
                sfData_.receiverAddress,
                sfData_.extraFormData
            )
        );
        message_ = abi.encode(AMBMessage(MAX_UINT256, ambData));
    }

    /// @dev generates the amb message for multi vault data
    function _generateMultiVaultMessage(MultiVaultSFData memory sfData_)
        internal
        view
        returns (bytes memory message_)
    {
        bytes memory ambData = abi.encode(
            InitMultiVaultData(
                _getNextPayloadId(),
                sfData_.superformIds,
                sfData_.amounts,
                sfData_.outputAmounts,
                sfData_.maxSlippages,
                sfData_.liqRequests,
                sfData_.hasDstSwaps,
                sfData_.retain4626s,
                sfData_.receiverAddress,
                sfData_.extraFormData
            )
        );
        message_ = abi.encode(AMBMessage(MAX_UINT256, ambData));
    }

    /// @dev helps convert the dst gas fee into src chain native fee
    /// @dev https://docs.soliditylang.org/en/v0.8.4/units-and-global-variables.html#ether-units
    /// @dev all native tokens should be 18 decimals across all EVMs
    function _convertToNativeFee(uint64 dstChainId_, uint256 dstGas_) internal view returns (uint256 nativeFee) {
        /// @dev gas fee * gas price (to get the gas amounts in dst chain's native token)
        /// @dev gas price is 9 decimal (in gwei)
        /// @dev assumption: all evm native tokens are 18 decimals
        uint256 dstNativeFee = dstGas_ * _getGasPrice(dstChainId_);

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

        /// @dev converts the gas to pay in terms of native token to usd value
        /// @dev native token price is 8 decimal
        uint256 dstUsdValue = dstNativeFee * _getNativeTokenPrice(dstChainId_); // native token price - 8 decimal

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

        /// @dev converts the usd value to source chain's native token
        /// @dev native token price is 8 decimal which cancels the 8 decimal multiplied in previous step
        uint256 nativeTokenPrice = _getNativeTokenPrice(CHAIN_ID); // native token price - 8 decimal
        if (nativeTokenPrice == 0) revert Error.INVALID_NATIVE_TOKEN_PRICE();
        nativeFee = (dstUsdValue) / _getNativeTokenPrice(CHAIN_ID);
    }

    /// @dev helps convert a native token of one chain to another
    /// @dev https://docs.soliditylang.org/en/v0.8.4/units-and-global-variables.html#ether-units
    /// @dev all native tokens should be 18 decimals across all EVMs
    function _convertToSrcNativeAmount(
        uint64 srcChainId_,
        uint256 dstAmount_
    )
        internal
        view
        returns (uint256 nativeFee)
    {
        if (dstAmount_ == 0) {
            return 0;
        }

        /// @dev converts the native token value to usd value
        /// @dev dstAmount_ is 18 decimal
        /// @dev native token price is 8 decimal
        uint256 dstUsdValue = dstAmount_ * _getNativeTokenPrice(CHAIN_ID);

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

        /// @dev converts the usd value to source chain's native token
        /// @dev native token price is 8 decimal which cancels the 8 decimal multiplied in previous step
        uint256 nativeTokenPrice = _getNativeTokenPrice(srcChainId_);
        if (nativeTokenPrice == 0) revert Error.INVALID_NATIVE_TOKEN_PRICE();

        nativeFee = dstUsdValue / nativeTokenPrice;
    }

    /// @dev helps generate the new payload id
    /// @dev next payload id = current payload id + 1
    function _getNextPayloadId() internal view returns (uint256 nextPayloadId) {
        nextPayloadId = ReadOnlyBaseRegistry(_getAddress(keccak256("CORE_STATE_REGISTRY"))).payloadsCount();
        ++nextPayloadId;
    }

    /// @dev helps return the current gas price of different networks
    /// @return native token price
    function _getGasPrice(uint64 chainId_) internal view returns (uint256) {
        address oracleAddr = address(gasPriceOracle[chainId_]);
        if (oracleAddr != address(0)) {
            try AggregatorV3Interface(oracleAddr).latestRoundData() returns (
                uint80, int256 value, uint256, uint256 updatedAt, uint80
            ) {
                if (value <= 0) revert Error.CHAINLINK_MALFUNCTION();
                if (updatedAt == 0) revert Error.CHAINLINK_INCOMPLETE_ROUND();
                return uint256(value);
            } catch {
                /// @dev do nothing and return the default price at the end of the function
            }
        }

        return gasPrice[chainId_];
    }

    /// @dev helps return the dst chain token price of different networks
    /// @return native token price
    function _getNativeTokenPrice(uint64 chainId_) internal view returns (uint256) {
        address oracleAddr = address(nativeFeedOracle[chainId_]);
        if (oracleAddr != address(0)) {
            try AggregatorV3Interface(oracleAddr).latestRoundData() returns (
                uint80, int256 dstTokenPrice, uint256, uint256 updatedAt, uint80
            ) {
                if (dstTokenPrice <= 0) revert Error.CHAINLINK_MALFUNCTION();
                if (updatedAt == 0) revert Error.CHAINLINK_INCOMPLETE_ROUND();
                return uint256(dstTokenPrice);
            } catch {
                /// @dev do nothing and return the default price at the end of the function
            }
        }

        return nativePrice[chainId_];
    }

    /// @dev returns the address from super registry
    function _getAddress(bytes32 id_) internal view returns (address) {
        return superRegistry.getAddress(id_);
    }
}

File 2 of 14 : IPaymentHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import {
    MultiDstMultiVaultStateReq,
    MultiDstSingleVaultStateReq,
    SingleXChainMultiVaultStateReq,
    SingleXChainSingleVaultStateReq,
    SingleDirectSingleVaultStateReq,
    SingleDirectMultiVaultStateReq
} from "src/types/DataTypes.sol";

/// @title IPaymentHelper
/// @dev Interface for PaymentHelper
/// @author ZeroPoint Labs
interface IPaymentHelper {
    //////////////////////////////////////////////////////////////
    //                           STRUCTS                         //
    //////////////////////////////////////////////////////////////

    /// @param nativeFeedOracle is the native price feed oracle
    /// @param gasPriceOracle is the gas price oracle
    /// @param swapGasUsed is the swap gas params
    /// @param updateGasUsed is the update gas params
    /// @param depositGasUsed is the deposit per vault gas on the chain
    /// @param withdrawGasUsed is the withdraw per vault gas on the chain
    /// @param defaultNativePrice is the native price on the specified chain
    /// @param defaultGasPrice is the gas price on the specified chain
    /// @param dstGasPerByte is the gas per size of data on the specified chain
    /// @param ackGasCost is the gas cost for sending and processing from dst->src
    /// @param timelockCost is the extra cost for processing timelocked payloads
    /// @param emergencyCost is the extra cost for processing emergency payloads
    struct PaymentHelperConfig {
        address nativeFeedOracle;
        address gasPriceOracle;
        uint256 swapGasUsed;
        uint256 updateGasUsed;
        uint256 depositGasUsed;
        uint256 withdrawGasUsed;
        uint256 defaultNativePrice;
        uint256 defaultGasPrice;
        uint256 dstGasPerByte;
        uint256 ackGasCost;
        uint256 timelockCost;
        uint256 emergencyCost;
    }

    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    event ChainConfigUpdated(uint64 indexed chainId_, uint256 indexed configType_, bytes config_);
    event ChainConfigAdded(uint64 chainId_, PaymentHelperConfig config_);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev returns the amb overrides & gas to be used
    /// @param dstChainId_ is the unique dst chain identifier
    /// @param ambIds_ is the identifiers of arbitrary message bridges to be used
    /// @param message_ is the encoded cross-chain payload
    function calculateAMBData(
        uint64 dstChainId_,
        uint8[] calldata ambIds_,
        bytes memory message_
    )
        external
        view
        returns (uint256 totalFees, bytes memory extraData);

    /// @dev returns the amb overrides & gas to be used
    /// @return extraData the amb specific override information
    function getRegisterTransmuterAMBData() external view returns (bytes memory extraData);

    /// @dev estimates the gas fees for multiple destination and multi vault operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateMultiDstMultiVault(
        MultiDstMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount);

    /// @dev estimates the gas fees for multiple destination and single vault operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateMultiDstSingleVault(
        MultiDstSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount);

    /// @dev estimates the gas fees for single destination and multi vault operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateSingleXChainMultiVault(
        SingleXChainMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount);

    /// @dev estimates the gas fees for single destination and single vault operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateSingleXChainSingleVault(
        SingleXChainSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount);

    /// @dev estimates the gas fees for same chain operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateSingleDirectSingleVault(
        SingleDirectSingleVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount);

    /// @dev estimates the gas fees for multiple same chain operation
    /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter
    /// @param isDeposit_ indicated if the datatype will be used for a deposit
    /// @return liqAmount is the amount of liquidity to be provided in native tokens
    /// @return srcAmount is the gas expense on source chain in native tokens
    /// @return totalAmount is the native_tokens to be sent along the transaction
    function estimateSingleDirectMultiVault(
        SingleDirectMultiVaultStateReq calldata req_,
        bool isDeposit_
    )
        external
        view
        returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount);

    /// @dev returns the gas fees estimation in native tokens if we send message through a combination of AMBs
    /// @param ambIds_ is the identifier of different AMBs
    /// @param dstChainId_ is the identifier of the destination chain
    /// @param message_ is the cross-chain message
    /// @param extraData_ is any amb-specific information
    /// @return ambFees is the native_tokens to be sent along the transaction for all the ambIds_ included
    function estimateAMBFees(
        uint8[] memory ambIds_,
        uint64 dstChainId_,
        bytes memory message_,
        bytes[] memory extraData_
    )
        external
        view
        returns (uint256 ambFees, uint256[] memory);

    /// @dev helps estimate the acknowledgement costs for amb processing
    /// @param payloadId_ is the payload identifier
    /// @return totalFees is the total fees to be paid in native tokens
    function estimateAckCost(uint256 payloadId_) external view returns (uint256 totalFees);

    /// @dev helps estimate the acknowledgement costs for amb processing without relying on payloadId (using max values)
    /// @param multi is the flag indicating if the payload is multi or single
    /// @param ackAmbIds is the list of ambIds to be used for acknowledgement
    /// @param srcChainId is the source chain identifier
    /// @return totalFees is the total fees to be paid in native tokens
    function estimateAckCostDefault(
        bool multi,
        uint8[] memory ackAmbIds,
        uint64 srcChainId
    )
        external
        view
        returns (uint256 totalFees);

    /// @dev helps estimate the acknowledgement costs for amb processing without relying on payloadId (using max values)
    /// with source native amounts
    /// @param multi is the flag indicating if the payload is multi or single
    /// @param ackAmbIds is the list of ambIds to be used for acknowledgement
    /// @param srcChainId is the source chain identifier
    /// @return totalFees is the total fees to be paid in native tokens
    function estimateAckCostDefaultNativeSource(
        bool multi,
        uint8[] memory ackAmbIds,
        uint64 srcChainId
    )
        external
        view
        returns (uint256 totalFees);
    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev admin can configure a remote chain for first time
    /// @param chainId_ is the identifier of new chain id
    /// @param config_ is the chain config
    function addRemoteChain(uint64 chainId_, PaymentHelperConfig calldata config_) external;

    /// @dev admin can specifically configure/update certain configuration of a remote chain
    /// @param chainId_ is the remote chain's identifier
    /// @param configType_ is the type of config from 1 -> 6
    /// @param config_ is the encoded new configuration
    function updateRemoteChain(uint64 chainId_, uint256 configType_, bytes memory config_) external;

    /// @dev admin updates config for register transmuter amb params
    /// @param extraDataForTransmuter_ is the broadcast extra data
    function updateRegisterAERC20Params(bytes memory extraDataForTransmuter_) external;
}

File 3 of 14 : ISuperRBAC.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { IAccessControl } from "openzeppelin-contracts/contracts/access/IAccessControl.sol";

/// @title ISuperRBAC
/// @dev Interface for SuperRBAC
/// @author Zeropoint Labs
interface ISuperRBAC is IAccessControl {

    //////////////////////////////////////////////////////////////
    //                           STRUCTS                         //
    //////////////////////////////////////////////////////////////

    struct InitialRoleSetup {
        address admin;
        address emergencyAdmin;
        address paymentAdmin;
        address csrProcessor;
        address tlProcessor;
        address brProcessor;
        address csrUpdater;
        address srcVaaRelayer;
        address dstSwapper;
        address csrRescuer;
        address csrDisputer;
    }

    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    /// @dev is emitted when superRegistry is set
    event SuperRegistrySet(address indexed superRegistry);

    /// @dev is emitted when an admin is set for a role
    event RoleAdminSet(bytes32 role, bytes32 adminRole);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev returns the id of the protocol admin role
    function PROTOCOL_ADMIN_ROLE() external view returns (bytes32);

    /// @dev returns the id of the emergency admin role
    function EMERGENCY_ADMIN_ROLE() external view returns (bytes32);

    /// @dev returns the id of the payment admin role
    function PAYMENT_ADMIN_ROLE() external view returns (bytes32);

    /// @dev returns the id of the broadcaster role
    function BROADCASTER_ROLE() external view returns (bytes32);

    /// @dev returns the id of the core state registry processor role
    function CORE_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);

    /// @dev returns the id of the timelock state registry processor role
    function TIMELOCK_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);

    /// @dev returns the id of the broadcast state registry processor role
    function BROADCAST_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);

    /// @dev returns the id of the core state registry updater role
    function CORE_STATE_REGISTRY_UPDATER_ROLE() external view returns (bytes32);

    /// @dev returns the id of the dst swapper role
    function DST_SWAPPER_ROLE() external view returns (bytes32);

    /// @dev returns the id of the core state registry rescuer role
    function CORE_STATE_REGISTRY_RESCUER_ROLE() external view returns (bytes32);

    /// @dev returns the id of the core state registry rescue disputer role
    function CORE_STATE_REGISTRY_DISPUTER_ROLE() external view returns (bytes32);

    /// @dev returns the id of wormhole vaa relayer role
    function WORMHOLE_VAA_RELAYER_ROLE() external view returns (bytes32);

    /// @dev returns whether the given address has the protocol admin role
    /// @param admin_ the address to check
    function hasProtocolAdminRole(address admin_) external view returns (bool);

    /// @dev returns whether the given address has the emergency admin role
    /// @param admin_ the address to check
    function hasEmergencyAdminRole(address admin_) external view returns (bool);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev updates the super registry address
    function setSuperRegistry(address superRegistry_) external;

    /// @dev configures a new role in superForm
    /// @param role_ the role to set
    /// @param adminRole_ the admin role to set as admin
    function setRoleAdmin(bytes32 role_, bytes32 adminRole_) external;

    /// @dev revokes the role_ from superRegistryAddressId_ on all chains
    /// @param role_ the role to revoke
    /// @param extraData_ amb config if broadcasting is required
    /// @param superRegistryAddressId_ the super registry address id
    function revokeRoleSuperBroadcast(
        bytes32 role_,
        bytes memory extraData_,
        bytes32 superRegistryAddressId_
    )
        external
        payable;

    /// @dev allows sync of global roles from different chains using broadcast registry
    /// @notice may not work for all roles
    function stateSyncBroadcast(bytes memory data_) external;
}

File 4 of 14 : ISuperRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

/// @title ISuperRegistry
/// @dev Interface for SuperRegistry
/// @author Zeropoint Labs
interface ISuperRegistry {
    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    /// @dev emitted when permit2 is set.
    event SetPermit2(address indexed permit2);

    /// @dev is emitted when an address is set.
    event AddressUpdated(
        bytes32 indexed protocolAddressId, uint64 indexed chainId, address indexed oldAddress, address newAddress
    );

    /// @dev is emitted when a new token bridge is configured.
    event SetBridgeAddress(uint256 indexed bridgeId, address indexed bridgeAddress);

    /// @dev is emitted when a new bridge validator is configured.
    event SetBridgeValidator(uint256 indexed bridgeId, address indexed bridgeValidator);

    /// @dev is emitted when a new amb is configured.
    event SetAmbAddress(uint8 indexed ambId_, address indexed ambAddress_, bool indexed isBroadcastAMB_);

    /// @dev is emitted when a new state registry is configured.
    event SetStateRegistryAddress(uint8 indexed registryId_, address indexed registryAddress_);

    /// @dev is emitted when a new delay is configured.
    event SetDelay(uint256 indexed oldDelay_, uint256 indexed newDelay_);

    /// @dev is emitted when a new vault limit is configured
    event SetVaultLimitPerDestination(uint64 indexed chainId_, uint256 indexed vaultLimit_);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev gets the deposit rescue delay
    function delay() external view returns (uint256);

    /// @dev returns the permit2 address
    function PERMIT2() external view returns (address);

    /// @dev returns the id of the superform router module
    function SUPERFORM_ROUTER() external view returns (bytes32);

    /// @dev returns the id of the superform factory module
    function SUPERFORM_FACTORY() external view returns (bytes32);

    /// @dev returns the id of the superform paymaster contract
    function PAYMASTER() external view returns (bytes32);

    /// @dev returns the id of the superform payload helper contract
    function PAYMENT_HELPER() external view returns (bytes32);

    /// @dev returns the id of the core state registry module
    function CORE_STATE_REGISTRY() external view returns (bytes32);

    /// @dev returns the id of the timelock form state registry module
    function TIMELOCK_STATE_REGISTRY() external view returns (bytes32);

    /// @dev returns the id of the broadcast state registry module
    function BROADCAST_REGISTRY() external view returns (bytes32);

    /// @dev returns the id of the super positions module
    function SUPER_POSITIONS() external view returns (bytes32);

    /// @dev returns the id of the super rbac module
    function SUPER_RBAC() external view returns (bytes32);

    /// @dev returns the id of the payload helper module
    function PAYLOAD_HELPER() external view returns (bytes32);

    /// @dev returns the id of the dst swapper keeper
    function DST_SWAPPER() external view returns (bytes32);

    /// @dev returns the id of the emergency queue
    function EMERGENCY_QUEUE() external view returns (bytes32);

    /// @dev returns the id of the superform receiver
    function SUPERFORM_RECEIVER() external view returns (bytes32);

    /// @dev returns the id of the payment admin keeper
    function PAYMENT_ADMIN() external view returns (bytes32);

    /// @dev returns the id of the core state registry processor keeper
    function CORE_REGISTRY_PROCESSOR() external view returns (bytes32);

    /// @dev returns the id of the broadcast registry processor keeper
    function BROADCAST_REGISTRY_PROCESSOR() external view returns (bytes32);

    /// @dev returns the id of the timelock form state registry processor keeper
    function TIMELOCK_REGISTRY_PROCESSOR() external view returns (bytes32);

    /// @dev returns the id of the core state registry updater keeper
    function CORE_REGISTRY_UPDATER() external view returns (bytes32);

    /// @dev returns the id of the core state registry updater keeper
    function CORE_REGISTRY_RESCUER() external view returns (bytes32);

    /// @dev returns the id of the core state registry updater keeper
    function CORE_REGISTRY_DISPUTER() external view returns (bytes32);

    /// @dev returns the id of the core state registry updater keeper
    function DST_SWAPPER_PROCESSOR() external view returns (bytes32);

    /// @dev gets the address of a contract on current chain
    /// @param id_ is the id of the contract
    function getAddress(bytes32 id_) external view returns (address);

    /// @dev gets the address of a contract on a target chain
    /// @param id_ is the id of the contract
    /// @param chainId_ is the chain id of that chain
    function getAddressByChainId(bytes32 id_, uint64 chainId_) external view returns (address);

    /// @dev gets the address of a bridge
    /// @param bridgeId_ is the id of a bridge
    /// @return bridgeAddress_ is the address of the form
    function getBridgeAddress(uint8 bridgeId_) external view returns (address bridgeAddress_);

    /// @dev gets the address of a bridge validator
    /// @param bridgeId_ is the id of a bridge
    /// @return bridgeValidator_ is the address of the form
    function getBridgeValidator(uint8 bridgeId_) external view returns (address bridgeValidator_);

    /// @dev gets the address of a amb
    /// @param ambId_ is the id of a bridge
    /// @return ambAddress_ is the address of the form
    function getAmbAddress(uint8 ambId_) external view returns (address ambAddress_);

    /// @dev gets the id of the amb
    /// @param ambAddress_ is the address of an amb
    /// @return ambId_ is the identifier of an amb
    function getAmbId(address ambAddress_) external view returns (uint8 ambId_);

    /// @dev gets the address of the registry
    /// @param registryId_ is the id of the state registry
    /// @return registryAddress_ is the address of the state registry
    function getStateRegistry(uint8 registryId_) external view returns (address registryAddress_);

    /// @dev gets the id of the registry
    /// @notice reverts if the id is not found
    /// @param registryAddress_ is the address of the state registry
    /// @return registryId_ is the id of the state registry
    function getStateRegistryId(address registryAddress_) external view returns (uint8 registryId_);

    /// @dev gets the safe vault limit
    /// @param chainId_ is the id of the remote chain
    /// @return vaultLimitPerDestination_ is the safe number of vaults to deposit
    /// without hitting out of gas error
    function getVaultLimitPerDestination(uint64 chainId_) external view returns (uint256 vaultLimitPerDestination_);

    /// @dev helps validate if an address is a valid state registry
    /// @param registryAddress_ is the address of the state registry
    /// @return valid_ a flag indicating if its valid.
    function isValidStateRegistry(address registryAddress_) external view returns (bool valid_);

    /// @dev helps validate if an address is a valid amb implementation
    /// @param ambAddress_ is the address of the amb implementation
    /// @return valid_ a flag indicating if its valid.
    function isValidAmbImpl(address ambAddress_) external view returns (bool valid_);

    /// @dev helps validate if an address is a valid broadcast amb implementation
    /// @param ambAddress_ is the address of the broadcast amb implementation
    /// @return valid_ a flag indicating if its valid.
    function isValidBroadcastAmbImpl(address ambAddress_) external view returns (bool valid_);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev sets the deposit rescue delay
    /// @param delay_ the delay in seconds before the deposit rescue can be finalized
    function setDelay(uint256 delay_) external;

    /// @dev sets the permit2 address
    /// @param permit2_ the address of the permit2 contract
    function setPermit2(address permit2_) external;

    /// @dev sets the safe vault limit
    /// @param chainId_ is the remote chain identifier
    /// @param vaultLimit_ is the max limit of vaults per transaction
    function setVaultLimitPerDestination(uint64 chainId_, uint256 vaultLimit_) external;

    /// @dev sets new addresses on specific chains.
    /// @param ids_ are the identifiers of the address on that chain
    /// @param newAddresses_  are the new addresses on that chain
    /// @param chainIds_ are the chain ids of that chain
    function batchSetAddress(
        bytes32[] calldata ids_,
        address[] calldata newAddresses_,
        uint64[] calldata chainIds_
    )
        external;

    /// @dev sets a new address on a specific chain.
    /// @param id_ the identifier of the address on that chain
    /// @param newAddress_ the new address on that chain
    /// @param chainId_ the chain id of that chain
    function setAddress(bytes32 id_, address newAddress_, uint64 chainId_) external;

    /// @dev allows admin to set the bridge address for an bridge id.
    /// @notice this function operates in an APPEND-ONLY fashion.
    /// @param bridgeId_         represents the bridge unique identifier.
    /// @param bridgeAddress_    represents the bridge address.
    /// @param bridgeValidator_  represents the bridge validator address.
    function setBridgeAddresses(
        uint8[] memory bridgeId_,
        address[] memory bridgeAddress_,
        address[] memory bridgeValidator_
    )
        external;

    /// @dev allows admin to set the amb address for an amb id.
    /// @notice this function operates in an APPEND-ONLY fashion.
    /// @param ambId_         represents the bridge unique identifier.
    /// @param ambAddress_    represents the bridge address.
    /// @param isBroadcastAMB_ represents whether the amb implementation supports broadcasting
    function setAmbAddress(
        uint8[] memory ambId_,
        address[] memory ambAddress_,
        bool[] memory isBroadcastAMB_
    )
        external;

    /// @dev allows admin to set the state registry address for an state registry id.
    /// @notice this function operates in an APPEND-ONLY fashion.
    /// @param registryId_    represents the state registry's unique identifier.
    /// @param registryAddress_    represents the state registry's address.
    function setStateRegistryAddress(uint8[] memory registryId_, address[] memory registryAddress_) external;
}

File 5 of 14 : ISuperformFactory.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

/// @title ISuperformFactory
/// @dev Interface for SuperformFactory
/// @author ZeroPoint Labs
interface ISuperformFactory {
    
    //////////////////////////////////////////////////////////////
    //                         CONSTANTS                        //
    //////////////////////////////////////////////////////////////

    enum PauseStatus {
        NON_PAUSED,
        PAUSED
    }

    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    /// @dev emitted when a new formImplementation is entered into the factory
    /// @param formImplementation is the address of the new form implementation
    /// @param formImplementationId is the id of the formImplementation
    /// @param formStateRegistryId is any additional state registry id of the formImplementation
    event FormImplementationAdded(
        address indexed formImplementation, uint256 indexed formImplementationId, uint8 indexed formStateRegistryId
    );

    /// @dev emitted when a new Superform is created
    /// @param formImplementationId is the id of the form implementation
    /// @param vault is the address of the vault
    /// @param superformId is the id of the superform
    /// @param superform is the address of the superform
    event SuperformCreated(
        uint256 indexed formImplementationId, address indexed vault, uint256 indexed superformId, address superform
    );

    /// @dev emitted when a new SuperRegistry is set
    /// @param superRegistry is the address of the super registry
    event SuperRegistrySet(address indexed superRegistry);

    /// @dev emitted when a form implementation is paused
    /// @param formImplementationId is the id of the form implementation
    /// @param paused is the new paused status
    event FormImplementationPaused(uint256 indexed formImplementationId, PauseStatus indexed paused);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev returns the number of forms
    /// @return forms_ is the number of forms
    function getFormCount() external view returns (uint256 forms_);

    /// @dev returns the number of superforms
    /// @return superforms_ is the number of superforms
    function getSuperformCount() external view returns (uint256 superforms_);

    /// @dev returns the address of a form implementation
    /// @param formImplementationId_ is the id of the form implementation
    /// @return formImplementation_ is the address of the form implementation
    function getFormImplementation(uint32 formImplementationId_) external view returns (address formImplementation_);

    /// @dev returns the form state registry id of a form implementation
    /// @param formImplementationId_ is the id of the form implementation
    /// @return stateRegistryId_ is the additional state registry id of the form
    function getFormStateRegistryId(uint32 formImplementationId_) external view returns (uint8 stateRegistryId_);

    /// @dev returns the paused status of form implementation
    /// @param formImplementationId_ is the id of the form implementation
    /// @return paused_ is the current paused status of the form formImplementationId_
    function isFormImplementationPaused(uint32 formImplementationId_) external view returns (bool paused_);

    /// @dev returns the address of a superform
    /// @param superformId_ is the id of the superform
    /// @return superform_ is the address of the superform
    /// @return formImplementationId_ is the id of the form implementation
    /// @return chainId_ is the chain id
    function getSuperform(uint256 superformId_)
        external
        pure
        returns (address superform_, uint32 formImplementationId_, uint64 chainId_);

    /// @dev returns if an address has been added to a Form
    /// @param superformId_ is the id of the superform
    /// @return isSuperform_ bool if it exists
    function isSuperform(uint256 superformId_) external view returns (bool isSuperform_);

    /// @dev Reverse query of getSuperform, returns all superforms for a given vault
    /// @param vault_ is the address of a vault
    /// @return superformIds_ is the id of the superform
    /// @return superforms_ is the address of the superform
    function getAllSuperformsFromVault(address vault_)
        external
        view
        returns (uint256[] memory superformIds_, address[] memory superforms_);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev allows an admin to add a Form implementation to the factory
    /// @param formImplementation_ is the address of a form implementation
    /// @param formImplementationId_ is the id of the form implementation (generated off-chain and equal in all chains)
    /// @param formStateRegistryId_ is the id of any additional state registry for that form
    /// @dev formStateRegistryId_ 1 is default for all form implementations, pass in formStateRegistryId_ only if an
    /// additional state registry is required
    function addFormImplementation(
        address formImplementation_,
        uint32 formImplementationId_,
        uint8 formStateRegistryId_
    )
        external;

    /// @dev To add new vaults to Form implementations, fusing them together into Superforms
    /// @param formImplementationId_ is the form implementation we want to attach the vault to
    /// @param vault_ is the address of the vault
    /// @return superformId_ is the id of the created superform
    /// @return superform_ is the address of the created superform
    function createSuperform(
        uint32 formImplementationId_,
        address vault_
    )
        external
        returns (uint256 superformId_, address superform_);

    /// @dev to synchronize superforms added to different chains using broadcast registry
    /// @param data_ is the cross-chain superform id
    function stateSyncBroadcast(bytes memory data_) external payable;

    /// @dev allows an admin to change the status of a form
    /// @param formImplementationId_ is the id of the form implementation
    /// @param status_ is the new status
    /// @param extraData_ is optional & passed when broadcasting of status is needed
    function changeFormImplementationPauseStatus(
        uint32 formImplementationId_,
        PauseStatus status_,
        bytes memory extraData_
    )
        external
        payable;
}

File 6 of 14 : IBaseStateRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { PayloadState } from "src/types/DataTypes.sol";

/// @title IBaseStateRegistry
/// @dev Interface for BaseStateRegistry
/// @author ZeroPoint Labs
interface IBaseStateRegistry {
    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    /// @dev is emitted when a cross-chain payload is received in the state registry
    event PayloadReceived(uint64 indexed srcChainId, uint64 indexed dstChainId, uint256 indexed payloadId);

    /// @dev is emitted when a cross-chain proof is received in the state registry
    /// NOTE: comes handy if quorum required is more than 0
    event ProofReceived(bytes32 indexed proof);

    /// @dev is emitted when a payload id gets updated
    event PayloadUpdated(uint256 indexed payloadId);

    /// @dev is emitted when a payload id gets processed
    event PayloadProcessed(uint256 indexed payloadId);

    /// @dev is emitted when the super registry address is updated
    event SuperRegistryUpdated(address indexed superRegistry);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev allows users to read the total payloads received by the registry
    function payloadsCount() external view returns (uint256);

    /// @dev allows user to read the payload state
    /// uint256 payloadId_ is the unique payload identifier allocated on the destination chain
    function payloadTracking(uint256 payloadId_) external view returns (PayloadState payloadState_);

    /// @dev allows users to read the bytes payload_ stored per payloadId_
    /// @param payloadId_ is the unique payload identifier allocated on the destination chain
    /// @return payloadBody_ the crosschain data received
    function payloadBody(uint256 payloadId_) external view returns (bytes memory payloadBody_);

    /// @dev allows users to read the uint256 payloadHeader stored per payloadId_
    /// @param payloadId_ is the unique payload identifier allocated on the destination chain
    /// @return payloadHeader_ the crosschain header received
    function payloadHeader(uint256 payloadId_) external view returns (uint256 payloadHeader_);

    /// @dev allows users to read the ambs that delivered the payload id
    /// @param payloadId_ is the unique payload identifier allocated on the destination chain
    /// @return ambIds_ is the identifier of ambs that delivered the message and proof
    function getMessageAMB(uint256 payloadId_) external view returns (uint8[] memory ambIds_);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev allows core contracts to send payload to a destination chain.
    /// @param srcSender_ is the caller of the function (used for gas refunds).
    /// @param ambIds_ is the identifier of the arbitrary message bridge to be used
    /// @param dstChainId_ is the internal chainId used throughout the protocol
    /// @param message_ is the crosschain payload to be sent
    /// @param extraData_ defines all the message bridge related overrides
    /// NOTE: dstChainId_ is mapped to message bridge's destination id inside it's implementation contract
    /// NOTE: ambIds_ are superform assigned unique identifier for arbitrary message bridges
    function dispatchPayload(
        address srcSender_,
        uint8[] memory ambIds_,
        uint64 dstChainId_,
        bytes memory message_,
        bytes memory extraData_
    )
        external
        payable;

    /// @dev allows state registry to receive messages from message bridge implementations
    /// @param srcChainId_ is the superform chainId from which the payload is dispatched/sent
    /// @param message_ is the crosschain payload received
    /// NOTE: Only {IMPLEMENTATION_CONTRACT} role can call this function.
    function receivePayload(uint64 srcChainId_, bytes memory message_) external;

    /// @dev allows privileged actors to process cross-chain payloads
    /// @param payloadId_ is the identifier of the cross-chain payload
    /// NOTE: Only {CORE_STATE_REGISTRY_PROCESSOR_ROLE} role can call this function
    /// NOTE: this should handle reverting the state on source chain in-case of failure
    /// (or) can implement scenario based reverting like in coreStateRegistry
    function processPayload(uint256 payloadId_) external payable;
}

File 7 of 14 : IAmbImplementation.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

/// @title IAmbImplementation
/// @dev Interface for arbitrary message bridge (AMB) implementations
/// @author ZeroPoint Labs
interface IAmbImplementation {
    //////////////////////////////////////////////////////////////
    //                          EVENTS                          //
    //////////////////////////////////////////////////////////////

    event ChainAdded(uint64 indexed superChainId);
    event AuthorizedImplAdded(uint64 indexed superChainId, address indexed authImpl);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL VIEW FUNCTIONS                     //
    //////////////////////////////////////////////////////////////

    /// @dev returns the gas fees estimation in native tokens
    /// @notice not all AMBs will have on-chain estimation for which this function will return 0
    /// @param dstChainId_ is the identifier of the destination chain
    /// @param message_ is the cross-chain message
    /// @param extraData_ is any amb-specific information
    /// @return fees is the native_tokens to be sent along the transaction
    function estimateFees(
        uint64 dstChainId_,
        bytes memory message_,
        bytes memory extraData_
    )
        external
        view
        returns (uint256 fees);

    /// @dev returns the extra data for the given gas request
    /// @param gasLimit is the amount of gas limit in wei to override
    /// @return extraData is the bytes encoded extra data
    /// NOTE: this process is unique to the message bridge
    function generateExtraData(uint256 gasLimit) external pure returns (bytes memory extraData);

    //////////////////////////////////////////////////////////////
    //              EXTERNAL WRITE FUNCTIONS                    //
    //////////////////////////////////////////////////////////////

    /// @dev allows state registry to send message via implementation.
    /// @param srcSender_ is the caller (used for gas refunds)
    /// @param dstChainId_ is the identifier of the destination chain
    /// @param message_ is the cross-chain message to be sent
    /// @param extraData_ is message amb specific override information
    function dispatchPayload(
        address srcSender_,
        uint64 dstChainId_,
        bytes memory message_,
        bytes memory extraData_
    )
        external
        payable;

    /// @dev allows for the permissionless calling of the retry mechanism for encoded data
    /// @param data_ is the encoded retry data (different per AMB implementation)
    function retryPayload(bytes memory data_) external payable;
}

File 8 of 14 : Error.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

library Error {
    //////////////////////////////////////////////////////////////
    //                  CONFIGURATION ERRORS                    //
    //////////////////////////////////////////////////////////////
    ///@notice errors thrown in protocol setup

    /// @dev thrown if chain id exceeds max(uint64)
    error BLOCK_CHAIN_ID_OUT_OF_BOUNDS();

    /// @dev thrown if not possible to revoke a role in broadcasting
    error CANNOT_REVOKE_NON_BROADCASTABLE_ROLES();

    /// @dev thrown if not possible to revoke last admin
    error CANNOT_REVOKE_LAST_ADMIN();

    /// @dev thrown if trying to set again pseudo immutables in super registry
    error DISABLED();

    /// @dev thrown if rescue delay is not yet set for a chain
    error DELAY_NOT_SET();

    /// @dev thrown if get native token price estimate in paymentHelper is 0
    error INVALID_NATIVE_TOKEN_PRICE();

    /// @dev thrown if wormhole refund chain id is not set
    error REFUND_CHAIN_ID_NOT_SET();

    /// @dev thrown if wormhole relayer is not set
    error RELAYER_NOT_SET();

    /// @dev thrown if a role to be revoked is not assigned
    error ROLE_NOT_ASSIGNED();

    //////////////////////////////////////////////////////////////
    //                  AUTHORIZATION ERRORS                    //
    //////////////////////////////////////////////////////////////
    ///@notice errors thrown if functions cannot be called

    /// COMMON AUTHORIZATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if caller is not address(this), internal call
    error INVALID_INTERNAL_CALL();

    /// @dev thrown if msg.sender is not a valid amb implementation
    error NOT_AMB_IMPLEMENTATION();

    /// @dev thrown if msg.sender is not an allowed broadcaster
    error NOT_ALLOWED_BROADCASTER();

    /// @dev thrown if msg.sender is not broadcast amb implementation
    error NOT_BROADCAST_AMB_IMPLEMENTATION();

    /// @dev thrown if msg.sender is not broadcast state registry
    error NOT_BROADCAST_REGISTRY();

    /// @dev thrown if msg.sender is not core state registry
    error NOT_CORE_STATE_REGISTRY();

    /// @dev thrown if msg.sender is not emergency admin
    error NOT_EMERGENCY_ADMIN();

    /// @dev thrown if msg.sender is not emergency queue
    error NOT_EMERGENCY_QUEUE();

    /// @dev thrown if msg.sender is not minter
    error NOT_MINTER();

    /// @dev thrown if msg.sender is not minter state registry
    error NOT_MINTER_STATE_REGISTRY_ROLE();

    /// @dev thrown if msg.sender is not paymaster
    error NOT_PAYMASTER();

    /// @dev thrown if msg.sender is not payment admin
    error NOT_PAYMENT_ADMIN();

    /// @dev thrown if msg.sender is not protocol admin
    error NOT_PROTOCOL_ADMIN();

    /// @dev thrown if msg.sender is not state registry
    error NOT_STATE_REGISTRY();

    /// @dev thrown if msg.sender is not super registry
    error NOT_SUPER_REGISTRY();

    /// @dev thrown if msg.sender is not superform router
    error NOT_SUPERFORM_ROUTER();

    /// @dev thrown if msg.sender is not a superform
    error NOT_SUPERFORM();

    /// @dev thrown if msg.sender is not superform factory
    error NOT_SUPERFORM_FACTORY();

    /// @dev thrown if msg.sender is not timelock form
    error NOT_TIMELOCK_SUPERFORM();

    /// @dev thrown if msg.sender is not timelock state registry
    error NOT_TIMELOCK_STATE_REGISTRY();

    /// @dev thrown if msg.sender is not user or disputer
    error NOT_VALID_DISPUTER();

    /// @dev thrown if the msg.sender is not privileged caller
    error NOT_PRIVILEGED_CALLER(bytes32 role);

    /// STATE REGISTRY AUTHORIZATION ERRORS
    /// ---------------------------------------------------------

    /// @dev layerzero adapter specific error, thrown if caller not layerzero endpoint
    error CALLER_NOT_ENDPOINT();

    /// @dev hyperlane adapter specific error, thrown if caller not hyperlane mailbox
    error CALLER_NOT_MAILBOX();

    /// @dev wormhole relayer specific error, thrown if caller not wormhole relayer
    error CALLER_NOT_RELAYER();

    /// @dev thrown if src chain sender is not valid
    error INVALID_SRC_SENDER();

    //////////////////////////////////////////////////////////////
    //                  INPUT VALIDATION ERRORS                 //
    //////////////////////////////////////////////////////////////
    ///@notice errors thrown if input variables are not valid

    /// COMMON INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if there is an array length mismatch
    error ARRAY_LENGTH_MISMATCH();

    /// @dev thrown if payload id does not exist
    error INVALID_PAYLOAD_ID();

    /// @dev error thrown when msg value should be zero in certain payable functions
    error MSG_VALUE_NOT_ZERO();

    /// @dev thrown if amb ids length is 0
    error ZERO_AMB_ID_LENGTH();

    /// @dev thrown if address input is address 0
    error ZERO_ADDRESS();

    /// @dev thrown if amount input is 0
    error ZERO_AMOUNT();

    /// @dev thrown if final token is address 0
    error ZERO_FINAL_TOKEN();

    /// @dev thrown if value input is 0
    error ZERO_INPUT_VALUE();

    /// SUPERFORM ROUTER INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if the vaults data is invalid
    error INVALID_SUPERFORMS_DATA();

    /// @dev thrown if receiver address is not set
    error RECEIVER_ADDRESS_NOT_SET();

    /// SUPERFORM FACTORY INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if a form is not ERC165 compatible
    error ERC165_UNSUPPORTED();

    /// @dev thrown if a form is not form interface compatible
    error FORM_INTERFACE_UNSUPPORTED();

    /// @dev error thrown if form implementation address already exists
    error FORM_IMPLEMENTATION_ALREADY_EXISTS();

    /// @dev error thrown if form implementation id already exists
    error FORM_IMPLEMENTATION_ID_ALREADY_EXISTS();

    /// @dev thrown if a form does not exist
    error FORM_DOES_NOT_EXIST();

    /// @dev thrown if form id is larger than max uint16
    error INVALID_FORM_ID();

    /// @dev thrown if superform not on factory
    error SUPERFORM_ID_NONEXISTENT();

    /// @dev thrown if same vault and form implementation is used to create new superform
    error VAULT_FORM_IMPLEMENTATION_COMBINATION_EXISTS();

    /// FORM INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if in case of no txData, if liqData.token != vault.asset()
    /// in case of txData, if token output of swap != vault.asset()
    error DIFFERENT_TOKENS();

    /// @dev thrown if the amount in direct withdraw is not correct
    error DIRECT_WITHDRAW_INVALID_LIQ_REQUEST();

    /// @dev thrown if the amount in xchain withdraw is not correct
    error XCHAIN_WITHDRAW_INVALID_LIQ_REQUEST();

    /// LIQUIDITY BRIDGE INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if route id is blacklisted in socket
    error BLACKLISTED_ROUTE_ID();

    /// @dev thrown if route id is not blacklisted in socket
    error NOT_BLACKLISTED_ROUTE_ID();

    /// @dev error thrown when txData selector of lifi bridge is a blacklisted selector
    error BLACKLISTED_SELECTOR();

    /// @dev error thrown when txData selector of lifi bridge is not a blacklisted selector
    error NOT_BLACKLISTED_SELECTOR();

    /// @dev thrown if a certain action of the user is not allowed given the txData provided
    error INVALID_ACTION();

    /// @dev thrown if in deposits, the liqDstChainId doesn't match the stateReq dstChainId
    error INVALID_DEPOSIT_LIQ_DST_CHAIN_ID();

    /// @dev thrown if index is invalid
    error INVALID_INDEX();

    /// @dev thrown if the chain id in the txdata is invalid
    error INVALID_TXDATA_CHAIN_ID();

    /// @dev thrown if the validation of bridge txData fails due to a destination call present
    error INVALID_TXDATA_NO_DESTINATIONCALL_ALLOWED();

    /// @dev thrown if the validation of bridge txData fails due to wrong receiver
    error INVALID_TXDATA_RECEIVER();

    /// @dev thrown if the validation of bridge txData fails due to wrong token
    error INVALID_TXDATA_TOKEN();

    /// @dev thrown if txData is not present (in case of xChain actions)
    error NO_TXDATA_PRESENT();

    /// STATE REGISTRY INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if payload is being updated with final amounts length different than amounts length
    error DIFFERENT_PAYLOAD_UPDATE_AMOUNTS_LENGTH();

    /// @dev thrown if payload is being updated with tx data length different than liq data length
    error DIFFERENT_PAYLOAD_UPDATE_TX_DATA_LENGTH();

    /// @dev thrown if keeper update final token is different than the vault underlying
    error INVALID_UPDATE_FINAL_TOKEN();

    /// @dev thrown if broadcast finality for wormhole is invalid
    error INVALID_BROADCAST_FINALITY();

    /// @dev thrown if amb id is not valid leading to an address 0 of the implementation
    error INVALID_BRIDGE_ID();

    /// @dev thrown if chain id involved in xchain message is invalid
    error INVALID_CHAIN_ID();

    /// @dev thrown if payload update amount isn't equal to dst swapper amount
    error INVALID_DST_SWAP_AMOUNT();

    /// @dev thrown if message amb and proof amb are the same
    error INVALID_PROOF_BRIDGE_ID();

    /// @dev thrown if order of proof AMBs is incorrect, either duplicated or not incrementing
    error INVALID_PROOF_BRIDGE_IDS();

    /// @dev thrown if rescue data lengths are invalid
    error INVALID_RESCUE_DATA();

    /// @dev thrown if delay is invalid
    error INVALID_TIMELOCK_DELAY();

    /// @dev thrown if amounts being sent in update payload mean a negative slippage
    error NEGATIVE_SLIPPAGE();

    /// @dev thrown if slippage is outside of bounds
    error SLIPPAGE_OUT_OF_BOUNDS();

    /// SUPERPOSITION INPUT VALIDATION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if src senders mismatch in state sync
    error SRC_SENDER_MISMATCH();

    /// @dev thrown if src tx types mismatch in state sync
    error SRC_TX_TYPE_MISMATCH();

    //////////////////////////////////////////////////////////////
    //                  EXECUTION ERRORS                        //
    //////////////////////////////////////////////////////////////
    ///@notice errors thrown due to function execution logic

    /// COMMON EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if the swap in a direct deposit resulted in insufficient tokens
    error DIRECT_DEPOSIT_SWAP_FAILED();

    /// @dev thrown if payload is not unique
    error DUPLICATE_PAYLOAD();

    /// @dev thrown if native tokens fail to be sent to superform contracts
    error FAILED_TO_SEND_NATIVE();

    /// @dev thrown if allowance is not correct to deposit
    error INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT();

    /// @dev thrown if contract has insufficient balance for operations
    error INSUFFICIENT_BALANCE();

    /// @dev thrown if native amount is not at least equal to the amount in the request
    error INSUFFICIENT_NATIVE_AMOUNT();

    /// @dev thrown if payload cannot be decoded
    error INVALID_PAYLOAD();

    /// @dev thrown if payload status is invalid
    error INVALID_PAYLOAD_STATUS();

    /// @dev thrown if payload type is invalid
    error INVALID_PAYLOAD_TYPE();

    /// LIQUIDITY BRIDGE EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if we try to decode the final swap output token in a xChain liquidity bridging action
    error CANNOT_DECODE_FINAL_SWAP_OUTPUT_TOKEN();

    /// @dev thrown if liquidity bridge fails for erc20 or native tokens
    error FAILED_TO_EXECUTE_TXDATA(address token);

    /// @dev thrown if asset being used for deposit mismatches in multivault deposits
    error INVALID_DEPOSIT_TOKEN();

    /// STATE REGISTRY EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if bridge tokens haven't arrived to destination
    error BRIDGE_TOKENS_PENDING();

    /// @dev thrown if withdrawal tx data cannot be updated
    error CANNOT_UPDATE_WITHDRAW_TX_DATA();

    /// @dev thrown if rescue passed dispute deadline
    error DISPUTE_TIME_ELAPSED();

    /// @dev thrown if message failed to reach the specified level of quorum needed
    error INSUFFICIENT_QUORUM();

    /// @dev thrown if broadcast payload is invalid
    error INVALID_BROADCAST_PAYLOAD();

    /// @dev thrown if broadcast fee is invalid
    error INVALID_BROADCAST_FEE();

    /// @dev thrown if retry fees is less than required
    error INVALID_RETRY_FEE();

    /// @dev thrown if broadcast message type is wrong
    error INVALID_MESSAGE_TYPE();

    /// @dev thrown if payload hash is invalid during `retryMessage` on Layezero implementation
    error INVALID_PAYLOAD_HASH();

    /// @dev thrown if update payload function was called on a wrong payload
    error INVALID_PAYLOAD_UPDATE_REQUEST();

    /// @dev thrown if a state registry id is 0
    error INVALID_REGISTRY_ID();

    /// @dev thrown if a form state registry id is 0
    error INVALID_FORM_REGISTRY_ID();

    /// @dev thrown if trying to finalize the payload but the withdraw is still locked
    error LOCKED();

    /// @dev thrown if payload is already updated (during xChain deposits)
    error PAYLOAD_ALREADY_UPDATED();

    /// @dev thrown if payload is already processed
    error PAYLOAD_ALREADY_PROCESSED();

    /// @dev thrown if payload is not in UPDATED state
    error PAYLOAD_NOT_UPDATED();

    /// @dev thrown if rescue is still in timelocked state
    error RESCUE_LOCKED();

    /// @dev thrown if rescue is already proposed
    error RESCUE_ALREADY_PROPOSED();

    /// @dev thrown if payload hash is zero during `retryMessage` on Layezero implementation
    error ZERO_PAYLOAD_HASH();

    /// DST SWAPPER EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if process dst swap is tried for processed payload id
    error DST_SWAP_ALREADY_PROCESSED();

    /// @dev thrown if indices have duplicates
    error DUPLICATE_INDEX();

    /// @dev thrown if failed dst swap is already updated
    error FAILED_DST_SWAP_ALREADY_UPDATED();

    /// @dev thrown if indices are out of bounds
    error INDEX_OUT_OF_BOUNDS();

    /// @dev thrown if failed swap token amount is 0
    error INVALID_DST_SWAPPER_FAILED_SWAP();

    /// @dev thrown if failed swap token amount is not 0 and if token balance is less than amount (non zero)
    error INVALID_DST_SWAPPER_FAILED_SWAP_NO_TOKEN_BALANCE();

    /// @dev thrown if failed swap token amount is not 0 and if native amount is less than amount (non zero)
    error INVALID_DST_SWAPPER_FAILED_SWAP_NO_NATIVE_BALANCE();

    /// @dev forbid xChain deposits with destination swaps without interim token set (for user protection)
    error INVALID_INTERIM_TOKEN();

    /// @dev thrown if dst swap output is less than minimum expected
    error INVALID_SWAP_OUTPUT();

    /// FORM EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if try to forward 4626 share from the superform
    error CANNOT_FORWARD_4646_TOKEN();

    /// @dev thrown in KYCDAO form if no KYC token is present
    error NO_VALID_KYC_TOKEN();

    /// @dev thrown in forms where a certain functionality is not allowed or implemented
    error NOT_IMPLEMENTED();

    /// @dev thrown if form implementation is PAUSED, users cannot perform any action
    error PAUSED();

    /// @dev thrown if shares != deposit output or assets != redeem output when minting SuperPositions
    error VAULT_IMPLEMENTATION_FAILED();

    /// @dev thrown if withdrawal tx data is not updated
    error WITHDRAW_TOKEN_NOT_UPDATED();

    /// @dev thrown if withdrawal tx data is not updated
    error WITHDRAW_TX_DATA_NOT_UPDATED();

    /// @dev thrown when redeeming from vault yields zero collateral
    error WITHDRAW_ZERO_COLLATERAL();

    /// PAYMENT HELPER EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if chainlink is reporting an improper price
    error CHAINLINK_MALFUNCTION();

    /// @dev thrown if chainlink is reporting an incomplete round
    error CHAINLINK_INCOMPLETE_ROUND();

    /// @dev thrown if feed decimals is not 8
    error CHAINLINK_UNSUPPORTED_DECIMAL();

    /// EMERGENCY QUEUE EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if emergency withdraw is not queued
    error EMERGENCY_WITHDRAW_NOT_QUEUED();

    /// @dev thrown if emergency withdraw is already processed
    error EMERGENCY_WITHDRAW_PROCESSED_ALREADY();

    /// SUPERPOSITION EXECUTION ERRORS
    /// ---------------------------------------------------------

    /// @dev thrown if uri cannot be updated
    error DYNAMIC_URI_FROZEN();

    /// @dev thrown if tx history is not found while state sync
    error TX_HISTORY_NOT_FOUND();
}

File 9 of 14 : DataLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { Error } from "src/libraries/Error.sol";

library DataLib {
    function packTxInfo(
        uint8 txType_,
        uint8 callbackType_,
        uint8 multi_,
        uint8 registryId_,
        address srcSender_,
        uint64 srcChainId_
    )
        internal
        pure
        returns (uint256 txInfo)
    {
        txInfo = uint256(txType_);
        txInfo |= uint256(callbackType_) << 8;
        txInfo |= uint256(multi_) << 16;
        txInfo |= uint256(registryId_) << 24;
        txInfo |= uint256(uint160(srcSender_)) << 32;
        txInfo |= uint256(srcChainId_) << 192;
    }

    function decodeTxInfo(uint256 txInfo_)
        internal
        pure
        returns (uint8 txType, uint8 callbackType, uint8 multi, uint8 registryId, address srcSender, uint64 srcChainId)
    {
        txType = uint8(txInfo_);
        callbackType = uint8(txInfo_ >> 8);
        multi = uint8(txInfo_ >> 16);
        registryId = uint8(txInfo_ >> 24);
        srcSender = address(uint160(txInfo_ >> 32));
        srcChainId = uint64(txInfo_ >> 192);
    }

    /// @dev returns the vault-form-chain pair of a superform
    /// @param superformId_ is the id of the superform
    /// @return superform_ is the address of the superform
    /// @return formImplementationId_ is the form id
    /// @return chainId_ is the chain id
    function getSuperform(uint256 superformId_)
        internal
        pure
        returns (address superform_, uint32 formImplementationId_, uint64 chainId_)
    {
        superform_ = address(uint160(superformId_));
        formImplementationId_ = uint32(superformId_ >> 160);
        chainId_ = uint64(superformId_ >> 192);

        if (chainId_ == 0) {
            revert Error.INVALID_CHAIN_ID();
        }
    }

    /// @dev returns the vault-form-chain pair of an array of superforms
    /// @param superformIds_  array of superforms
    /// @return superforms_ are the address of the vaults
    function getSuperforms(uint256[] memory superformIds_) internal pure returns (address[] memory superforms_) {
        uint256 len = superformIds_.length;
        superforms_ = new address[](len);

        for (uint256 i; i < len; ++i) {
            (superforms_[i],,) = getSuperform(superformIds_[i]);
        }
    }

    /// @dev returns the destination chain of a given superform
    /// @param superformId_ is the id of the superform
    /// @return chainId_ is the chain id
    function getDestinationChain(uint256 superformId_) internal pure returns (uint64 chainId_) {
        chainId_ = uint64(superformId_ >> 192);

        if (chainId_ == 0) {
            revert Error.INVALID_CHAIN_ID();
        }
    }

    /// @dev generates the superformId
    /// @param superform_ is the address of the superform
    /// @param formImplementationId_ is the type of the form
    /// @param chainId_ is the chain id on which the superform is deployed
    function packSuperform(
        address superform_,
        uint32 formImplementationId_,
        uint64 chainId_
    )
        internal
        pure
        returns (uint256 superformId_)
    {
        superformId_ = uint256(uint160(superform_));
        superformId_ |= uint256(formImplementationId_) << 160;
        superformId_ |= uint256(chainId_) << 192;
    }
}

File 10 of 14 : ProofLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { AMBMessage } from "src/types/DataTypes.sol";

/// @dev generates proof for amb message and bytes encoded message
library ProofLib {
    function computeProof(AMBMessage memory message_) internal pure returns (bytes32) {
        return keccak256(abi.encode(message_));
    }

    function computeProofBytes(AMBMessage memory message_) internal pure returns (bytes memory) {
        return abi.encode(keccak256(abi.encode(message_)));
    }

    function computeProof(bytes memory message_) internal pure returns (bytes32) {
        return keccak256(message_);
    }

    function computeProofBytes(bytes memory message_) internal pure returns (bytes memory) {
        return abi.encode(keccak256(message_));
    }
}

File 11 of 14 : ArrayCastLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

import { InitSingleVaultData, InitMultiVaultData, LiqRequest } from "src/types/DataTypes.sol";

/// @dev library to cast single values into array for streamlining helper functions
/// @notice not gas optimized, suggested for usage only in view/pure functions
library ArrayCastLib {
    function castLiqRequestToArray(LiqRequest memory value_) internal pure returns (LiqRequest[] memory values) {
        values = new LiqRequest[](1);

        values[0] = value_;
    }

    function castBoolToArray(bool value_) internal pure returns (bool[] memory values) {
        values = new bool[](1);

        values[0] = value_;
    }

    function castToMultiVaultData(InitSingleVaultData memory data_)
        internal
        pure
        returns (InitMultiVaultData memory castedData_)
    {
        uint256[] memory superformIds = new uint256[](1);
        superformIds[0] = data_.superformId;

        uint256[] memory amounts = new uint256[](1);
        amounts[0] = data_.amount;

        uint256[] memory outputAmounts = new uint256[](1);
        outputAmounts[0] = data_.outputAmount;

        uint256[] memory maxSlippage = new uint256[](1);
        maxSlippage[0] = data_.maxSlippage;

        LiqRequest[] memory liqData = new LiqRequest[](1);
        liqData[0] = data_.liqData;

        castedData_ = InitMultiVaultData(
            data_.payloadId,
            superformIds,
            amounts,
            outputAmounts,
            maxSlippage,
            liqData,
            castBoolToArray(data_.hasDstSwap),
            castBoolToArray(data_.retain4626),
            data_.receiverAddress,
            data_.extraFormData
        );
    }
}

File 12 of 14 : DataTypes.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.23;

/// @dev contains all the common struct and enums used for data communication between chains.

/// @dev There are two transaction types in Superform Protocol
enum TransactionType {
    DEPOSIT,
    WITHDRAW
}

/// @dev Message types can be INIT, RETURN (for successful Deposits) and FAIL (for failed withdraws)
enum CallbackType {
    INIT,
    RETURN,
    FAIL
}

/// @dev Payloads are stored, updated (deposits) or processed (finalized)
enum PayloadState {
    STORED,
    UPDATED,
    PROCESSED
}

/// @dev contains all the common struct used for interchain token transfers.
struct LiqRequest {
    /// @dev generated data
    bytes txData;
    /// @dev input token for deposits, desired output token on target liqDstChainId for withdraws. Must be set for
    /// txData to be updated on destination for withdraws
    address token;
    /// @dev intermediary token on destination. Relevant for xChain deposits where a destination swap is needed for
    /// validation purposes
    address interimToken;
    /// @dev what bridge to use to move tokens
    uint8 bridgeId;
    /// @dev dstChainId = liqDstchainId for deposits. For withdraws it is the target chain id for where the underlying
    /// is to be delivered
    uint64 liqDstChainId;
    /// @dev currently this amount is used as msg.value in the txData call.
    uint256 nativeAmount;
}

/// @dev main struct that holds required multi vault data for an action
struct MultiVaultSFData {
    // superformids must have same destination. Can have different underlyings
    uint256[] superformIds;
    uint256[] amounts; // on deposits, amount of token to deposit on dst, on withdrawals, superpositions to burn
    uint256[] outputAmounts; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive
    uint256[] maxSlippages;
    LiqRequest[] liqRequests; // if length = 1; amount = sum(amounts) | else  amounts must match the amounts being sent
    bytes permit2data;
    bool[] hasDstSwaps;
    bool[] retain4626s; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead
    address receiverAddress;
    /// this address must always be an EOA otherwise funds may be lost
    address receiverAddressSP;
    /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits
    bytes extraFormData; // extraFormData
}

/// @dev main struct that holds required single vault data for an action
struct SingleVaultSFData {
    // superformids must have same destination. Can have different underlyings
    uint256 superformId;
    uint256 amount;
    uint256 outputAmount; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive
    uint256 maxSlippage;
    LiqRequest liqRequest; // if length = 1; amount = sum(amounts)| else  amounts must match the amounts being sent
    bytes permit2data;
    bool hasDstSwap;
    bool retain4626; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead
    address receiverAddress;
    /// this address must always be an EOA otherwise funds may be lost
    address receiverAddressSP;
    /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits
    bytes extraFormData; // extraFormData
}

/// @dev overarching struct for multiDst requests with multi vaults
struct MultiDstMultiVaultStateReq {
    uint8[][] ambIds;
    uint64[] dstChainIds;
    MultiVaultSFData[] superformsData;
}

/// @dev overarching struct for single cross chain requests with multi vaults
struct SingleXChainMultiVaultStateReq {
    uint8[] ambIds;
    uint64 dstChainId;
    MultiVaultSFData superformsData;
}

/// @dev overarching struct for multiDst requests with single vaults
struct MultiDstSingleVaultStateReq {
    uint8[][] ambIds;
    uint64[] dstChainIds;
    SingleVaultSFData[] superformsData;
}

/// @dev overarching struct for single cross chain requests with single vaults
struct SingleXChainSingleVaultStateReq {
    uint8[] ambIds;
    uint64 dstChainId;
    SingleVaultSFData superformData;
}

/// @dev overarching struct for single direct chain requests with single vaults
struct SingleDirectSingleVaultStateReq {
    SingleVaultSFData superformData;
}

/// @dev overarching struct for single direct chain requests with multi vaults
struct SingleDirectMultiVaultStateReq {
    MultiVaultSFData superformData;
}

/// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId)
/// @dev realize that receiverAddressSP is not passed, only needed on source chain to mint
struct InitMultiVaultData {
    uint256 payloadId;
    uint256[] superformIds;
    uint256[] amounts;
    uint256[] outputAmounts;
    uint256[] maxSlippages;
    LiqRequest[] liqData;
    bool[] hasDstSwaps;
    bool[] retain4626s;
    address receiverAddress;
    bytes extraFormData;
}

/// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId)
struct InitSingleVaultData {
    uint256 payloadId;
    uint256 superformId;
    uint256 amount;
    uint256 outputAmount;
    uint256 maxSlippage;
    LiqRequest liqData;
    bool hasDstSwap;
    bool retain4626;
    address receiverAddress;
    bytes extraFormData;
}

/// @dev struct for Emergency Queue
struct QueuedWithdrawal {
    address receiverAddress;
    uint256 superformId;
    uint256 amount;
    uint256 srcPayloadId;
    bool isProcessed;
}

/// @dev all statuses of the timelock payload
enum TimelockStatus {
    UNAVAILABLE,
    PENDING,
    PROCESSED
}

/// @dev holds information about the timelock payload
struct TimelockPayload {
    uint8 isXChain;
    uint64 srcChainId;
    uint256 lockedTill;
    InitSingleVaultData data;
    TimelockStatus status;
}

/// @dev struct that contains the type of transaction, callback flags and other identification, as well as the vaults
/// data in params
struct AMBMessage {
    uint256 txInfo; // tight packing of  TransactionType txType,  CallbackType flag  if multi/single vault, registry id,
        // srcSender and srcChainId
    bytes params; // decoding txInfo will point to the right datatype of params. Refer PayloadHelper.sol
}

/// @dev struct that contains the information required for broadcasting changes
struct BroadcastMessage {
    bytes target;
    bytes32 messageType;
    bytes message;
}

/// @dev struct that contains info on returned data from destination
struct ReturnMultiData {
    uint256 payloadId;
    uint256[] superformIds;
    uint256[] amounts;
}

/// @dev struct that contains info on returned data from destination
struct ReturnSingleData {
    uint256 payloadId;
    uint256 superformId;
    uint256 amount;
}

/// @dev struct that contains the data on the fees to pay to the AMBs
struct AMBExtraData {
    uint256[] gasPerAMB;
    bytes[] extraDataPerAMB;
}

/// @dev struct that contains the data on the fees to pay to the AMBs on broadcasts
struct BroadCastAMBExtraData {
    uint256[] gasPerDst;
    bytes[] extraDataPerDst;
}

File 13 of 14 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
    function decimals() external view returns (uint8);

    function description() external view returns (string memory);

    function version() external view returns (uint256);

    function getRoundData(uint80 _roundId)
        external
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

    function latestRoundData()
        external
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

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

pragma solidity ^0.8.20;

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

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

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

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

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

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

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

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

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

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

Settings
{
  "remappings": [
    "solmate/=lib/ERC1155A/lib/solmate/src/",
    "ERC1155A/=lib/ERC1155A/src/",
    "@openzeppelin/contracts/=lib/ERC1155A/lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/ds-test/src/",
    "erc4626-tests/=lib/ERC1155A/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/ERC1155A/lib/openzeppelin-contracts/",
    "pigeon/=lib/pigeon/src/",
    "solady/=lib/pigeon/lib/solady/",
    "super-vaults/=lib/super-vaults/src/",
    "v2-core/=lib/super-vaults/lib/v2-core/contracts/",
    "v2-periphery/=lib/super-vaults/lib/v2-periphery/contracts/",
    "v3-core/=lib/super-vaults/lib/v3-core/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"superRegistry_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BLOCK_CHAIN_ID_OUT_OF_BOUNDS","type":"error"},{"inputs":[],"name":"CHAINLINK_INCOMPLETE_ROUND","type":"error"},{"inputs":[],"name":"CHAINLINK_MALFUNCTION","type":"error"},{"inputs":[],"name":"CHAINLINK_UNSUPPORTED_DECIMAL","type":"error"},{"inputs":[],"name":"INVALID_CHAIN_ID","type":"error"},{"inputs":[],"name":"INVALID_NATIVE_TOKEN_PRICE","type":"error"},{"inputs":[],"name":"INVALID_PAYLOAD_ID","type":"error"},{"inputs":[],"name":"NOT_EMERGENCY_ADMIN","type":"error"},{"inputs":[],"name":"NOT_PROTOCOL_ADMIN","type":"error"},{"inputs":[],"name":"ZERO_ADDRESS","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"chainId_","type":"uint64"},{"components":[{"internalType":"address","name":"nativeFeedOracle","type":"address"},{"internalType":"address","name":"gasPriceOracle","type":"address"},{"internalType":"uint256","name":"swapGasUsed","type":"uint256"},{"internalType":"uint256","name":"updateGasUsed","type":"uint256"},{"internalType":"uint256","name":"depositGasUsed","type":"uint256"},{"internalType":"uint256","name":"withdrawGasUsed","type":"uint256"},{"internalType":"uint256","name":"defaultNativePrice","type":"uint256"},{"internalType":"uint256","name":"defaultGasPrice","type":"uint256"},{"internalType":"uint256","name":"dstGasPerByte","type":"uint256"},{"internalType":"uint256","name":"ackGasCost","type":"uint256"},{"internalType":"uint256","name":"timelockCost","type":"uint256"},{"internalType":"uint256","name":"emergencyCost","type":"uint256"}],"indexed":false,"internalType":"struct IPaymentHelper.PaymentHelperConfig","name":"config_","type":"tuple"}],"name":"ChainConfigAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainId_","type":"uint64"},{"indexed":true,"internalType":"uint256","name":"configType_","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"config_","type":"bytes"}],"name":"ChainConfigUpdated","type":"event"},{"inputs":[],"name":"CHAIN_ID","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"ackGasCost","outputs":[{"internalType":"uint256","name":"gasForAck","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId_","type":"uint64"},{"components":[{"internalType":"address","name":"nativeFeedOracle","type":"address"},{"internalType":"address","name":"gasPriceOracle","type":"address"},{"internalType":"uint256","name":"swapGasUsed","type":"uint256"},{"internalType":"uint256","name":"updateGasUsed","type":"uint256"},{"internalType":"uint256","name":"depositGasUsed","type":"uint256"},{"internalType":"uint256","name":"withdrawGasUsed","type":"uint256"},{"internalType":"uint256","name":"defaultNativePrice","type":"uint256"},{"internalType":"uint256","name":"defaultGasPrice","type":"uint256"},{"internalType":"uint256","name":"dstGasPerByte","type":"uint256"},{"internalType":"uint256","name":"ackGasCost","type":"uint256"},{"internalType":"uint256","name":"timelockCost","type":"uint256"},{"internalType":"uint256","name":"emergencyCost","type":"uint256"}],"internalType":"struct IPaymentHelper.PaymentHelperConfig","name":"config_","type":"tuple"}],"name":"addRemoteChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"dstChainId_","type":"uint64"},{"internalType":"uint8[]","name":"ambIds_","type":"uint8[]"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"calculateAMBData","outputs":[{"internalType":"uint256","name":"totalFees","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"depositGasUsed","outputs":[{"internalType":"uint256","name":"gasForDeposit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"emergencyCost","outputs":[{"internalType":"uint256","name":"gasForEmergency","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"ambIds_","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId_","type":"uint64"},{"internalType":"bytes","name":"message_","type":"bytes"},{"internalType":"bytes[]","name":"extraData_","type":"bytes[]"}],"name":"estimateAMBFees","outputs":[{"internalType":"uint256","name":"totalFees","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"payloadId_","type":"uint256"}],"name":"estimateAckCost","outputs":[{"internalType":"uint256","name":"totalFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"multi","type":"bool"},{"internalType":"uint8[]","name":"ackAmbIds","type":"uint8[]"},{"internalType":"uint64","name":"srcChainId","type":"uint64"}],"name":"estimateAckCostDefault","outputs":[{"internalType":"uint256","name":"totalFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"multi","type":"bool"},{"internalType":"uint8[]","name":"ackAmbIds","type":"uint8[]"},{"internalType":"uint64","name":"srcChainId","type":"uint64"}],"name":"estimateAckCostDefaultNativeSource","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstMultiVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateMultiDstMultiVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstSingleVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateMultiDstSingleVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectMultiVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateSingleDirectMultiVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectSingleVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateSingleDirectSingleVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformsData","type":"tuple"}],"internalType":"struct SingleXChainMultiVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateSingleXChainMultiVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleXChainSingleVaultStateReq","name":"req_","type":"tuple"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"estimateSingleXChainSingleVault","outputs":[{"internalType":"uint256","name":"liqAmount","type":"uint256"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extraDataForTransmuter","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"gasPerByte","outputs":[{"internalType":"uint256","name":"gasPerByte","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"gasPrice","outputs":[{"internalType":"uint256","name":"defaultGasPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"gasPriceOracle","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegisterTransmuterAMBData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"nativeFeedOracle","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"nativePrice","outputs":[{"internalType":"uint256","name":"defaultNativePrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"superRegistry","outputs":[{"internalType":"contract ISuperRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"swapGasUsed","outputs":[{"internalType":"uint256","name":"gasForSwap","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"timelockCost","outputs":[{"internalType":"uint256","name":"gasForTimelock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"updateGasUsed","outputs":[{"internalType":"uint256","name":"gasForUpdate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"extraDataForTransmuter_","type":"bytes"}],"name":"updateRegisterAERC20Params","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId_","type":"uint64"},{"internalType":"uint256","name":"configType_","type":"uint256"},{"internalType":"bytes","name":"config_","type":"bytes"}],"name":"updateRemoteChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"chainId","type":"uint64"}],"name":"withdrawGasUsed","outputs":[{"internalType":"uint256","name":"gasForWithdraw","type":"uint256"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162005be238038062005be28339810160408190526200003491620000a4565b6001600160a01b0381166200005c5760405163538ba4f960e01b815260040160405180910390fd5b6001600160401b034611156200008557604051637ecdf93360e01b815260040160405180910390fd5b6001600160401b03461660a0526001600160a01b0316608052620000d6565b600060208284031215620000b757600080fd5b81516001600160a01b0381168114620000cf57600080fd5b9392505050565b60805160a051615a37620001ab6000396000818161044e015281816105db0152818161158d015281816115bb015281816115fd0152818161162b015281816121700152818161278e01528181612e1d01528181612e4b01528181612ea001528181612ece015281816130680152818161331a0152818161374701528181613789015281816138110152818161399a015281816139e60152613b290152600081816102990152818161061501528181610830015281816130a401528181613356015281816134f70152613d440152615a376000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80637504988b11610104578063b9694b52116100a2578063da16363711610071578063da16363714610534578063ee4bc1c71461053c578063f3afdd881461055c578063f3d808461461056f57600080fd5b8063b9694b52146104db578063c97c55b0146104ee578063d701397414610501578063d8bb4f4e1461051457600080fd5b806385e1f4d0116100de57806385e1f4d014610449578063904b1a2814610488578063a9ce4648146104a8578063b1752d59146104c857600080fd5b80637504988b146103e85780637abae251146104165780637f7aecb51461042957600080fd5b80634545fc311161017c5780634c75c0d81161014b5780634c75c0d81461036d57806353d69edc1461038d578063596703e7146103a257806361d26cae146103b557600080fd5b80634545fc31146102ef5780634786b4241461030f57806349c3af451461032f57806349c4144c1461035857600080fd5b80631f864be3116101b85780631f864be31461027357806324c73dda146102945780633283166a146102bb57806336c7fe1d146102dc57600080fd5b80630292540b146101df57806312c4da86146102125780631f5ae58f14610253575b600080fd5b6101ff6101ed36600461400f565b600b6020526000908152604090205481565b6040519081526020015b60405180910390f35b61023b61022036600461400f565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610209565b6101ff61026136600461400f565b600a6020526000908152604090205481565b610286610281366004614202565b610582565b60405161020992919061430a565b61023b7f000000000000000000000000000000000000000000000000000000000000000081565b6102ce6102c936600461435a565b6107a6565b604051610209929190614456565b6101ff6102ea36600461448d565b610805565b6101ff6102fd36600461400f565b60066020526000908152604090205481565b6101ff61031d36600461400f565b60076020526000908152604090205481565b61023b61033d36600461400f565b6001602052600090815260409020546001600160a01b031681565b61036b6103663660046144f0565b6109f4565b005b6101ff61037b36600461400f565b60046020526000908152604090205481565b610395610d65565b6040516102099190614533565b6101ff6103b0366004614546565b610df7565b6103c86103c3366004614577565b611212565b604080519485526020850193909352918301526060820152608001610209565b6103fb6103f63660046145da565b611548565b60408051938452602084019290925290820152606001610209565b61036b61042436600461460f565b6117b3565b6101ff61043736600461400f565b60056020526000908152604090205481565b6104707f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160401b039091168152602001610209565b6101ff61049636600461400f565b60086020526000908152604090205481565b6101ff6104b636600461400f565b60026020526000908152604090205481565b6101ff6104d636600461448d565b611cb0565b61036b6104e936600461465d565b611cc6565b6103c86104fc366004614577565b611d86565b6103c861050f366004614577565b612127565b6101ff61052236600461400f565b60096020526000908152604090205481565b610395612683565b6101ff61054a36600461400f565b60036020526000908152604090205481565b6103c861056a366004614577565b612711565b6103fb61057d3660046145da565b612d54565b835160009060609082816001600160401b038111156105a3576105a361402c565b6040519080825280602002602001820160405280156105cc578160200160208202803683370190505b509050866001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b03161461079a5760005b82811015610798577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630eff125d8a838151811061065457610654614691565b60200260200101516040518263ffffffff1660e01b8152600401610681919060ff91909116815260200190565b602060405180830381865afa15801561069e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c291906146c7565b6001600160a01b031663ea98b14789898985815181106106e4576106e4614691565b60200260200101516040518463ffffffff1660e01b815260040161070a939291906146e4565b602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190614718565b82828151811061075d5761075d614691565b60200260200101818152505081818151811061077b5761077b614691565b60200260200101518561078e9190614747565b945060010161060b565b505b91505094509492505050565b6000606060008060006107bb89898989612f2b565b9250925092506040518060400160405280848152602001838152506040516020016107e69190614796565b60408051601f1981840301815291905290999098509650505050505050565b6000606084156109645760405163bffc1e1360e01b81526001600160401b03841660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bffc1e1390602401602060405180830381865afa15801561087f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a39190614718565b90506000816001600160401b038111156108bf576108bf61402c565b6040519080825280602002602001820160405280156108e8578160200160208202803683370190505b50905060005b8281101561091e5760001982828151811061090b5761090b614691565b60209081029190910101526001016108ee565b50604051806060016040528060001981526020018281526020018281525060405160200161094c9190614819565b604051602081830303815290604052925050506109ab565b506040805160608082018352600019808352602080840182815293850182815285519182019290925292518385015251828201528251808303909101815260809091019091525b6109eb848460405180604001604052806000198152602001858152506040516020016109d7919061485c565b604051602081830303815290604052613255565b95945050505050565b610a1d7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516369ac88f960e11b81523360048201526001600160a01b03919091169063d35911f290602401602060405180830381865afa158015610a63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a87919061488c565b610aa457604051633721555560e21b815260040160405180910390fd5b6000610ab360208301836148b4565b6001600160a01b031614610b91576000610ad060208301836148b4565b9050600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3991906148d1565b60ff1614610b5a576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038316600090815260208190526040902080546001600160a01b0319166001600160a01b03929092169190911790555b6000610ba360408301602084016148b4565b6001600160a01b031614610c84576000610bc360408301602084016148b4565b9050600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2c91906148d1565b60ff1614610c4d576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038316600090815260016020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b6001600160401b0382166000908152600260209081526040808320818501359055600382528083206060850135905560048252808320608085013590556005825280832060a085013590556006825280832060c085013590556007825280832060e08501359055600882528083206101008501359055600982528083206101208501359055600a82528083206101408501359055600b909152908190206101608301359055517f1398b222973e8ac251bde901bfdec29f22df65e1d77bd8e495e25e34d484a2ab90610d5990849084906148ee565b60405180910390a15050565b6060600c8054610d74906149ad565b80601f0160208091040260200160405190810160405280929190818152602001828054610da0906149ad565b8015610ded5780601f10610dc257610100808354040283529160200191610ded565b820191906000526020600020905b815481529060010190602001808311610dd057829003601f168201915b5050505050905090565b604080516101008101825260008082526020820181905291810182905260608082018190526080820181905260a0820183905260c0820183905260e08201526000610e617f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b6134de565b9050806001600160a01b03166313c02a596040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec59190614718565b808352841115610ee8576040516355da2ca360e11b815260040160405180910390fd5b6040516336445ffd60e01b8152600481018590526001600160a01b038216906336445ffd90602401602060405180830381865afa158015610f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f519190614718565b602083015260405163361ad42b60e01b8152600481018590526001600160a01b0382169063361ad42b90602401600060405180830381865afa158015610f9b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fc39190810190614a26565b6060830152602082015160c081811c9084015260ff601082901c811660a085015260089190911c166040830181905215611001575060009392505050565b8160a0015160ff16600103611076576000826060015180602001905181019061102a9190614c3f565b6040805160608101825285518152602080840151818301528284015182840152915192935061105b92909101614819565b60408051601f198184030181529190526060840152506110e1565b600082606001518060200190518101906110909190614dc8565b60408051606080820183528651808352602085810151818501908152958501519385019384528451908101919091529351848401529051838201528151808403820181526080909301909152840152505b604051636c181b2760e11b8152600481018590526001600160a01b0382169063d830364e90602401600060405180830381865afa158015611126573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261114e9190810190614e8e565b608083015260408051808201918290526336445ffd60e01b90915260448101859052806001600160a01b0383166336445ffd60648301602060405180830381865afa1580156111a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c59190614718565b815260608401516020918201526040516111e092910161485c565b60408051601f1981840301815291905260e08301819052608083015160c084015161120a92613255565b949350505050565b6000806000806000806112326000805160206159e28339815191526134de565b905060006112a86112438a80614f27565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506112859250505060408c0160208d0161400f565b6112a361129560408e018e614f77565b61129e90615037565b613570565b613255565b90506112b48187614747565b955087156113ad576112f06112eb6112cf60408c018c614f77565b6112dd906080810190615140565b6112e690615156565b61364a565b6136ca565b6112fa9088614747565b965061131661130f60408b0160208c0161400f565b6001613713565b6113209084614747565b925061132f60408a018a614f77565b6113419061010081019060e001615162565b61135c5761134f600161373d565b6113599087614747565b95505b61139c61136f60408b0160208c0161400f565b61139761137f60408d018d614f77565b6113909060e081019060c001615162565b15156137b7565b613802565b6113a69084614747565b92506114d9565b60006113c56113bf60408c018c614f77565b356138bf565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0385169063596db71790602401602060405180830381865afa158015611417573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143b919061488c565b905080158015611451575063ffffffff82166002145b1561149557600a600061146a60408e0160208f0161400f565b6001600160401b0316815260208101919091526040016000205461148e9086614747565b94506114d6565b80156114d657600b60006114af60408e0160208f0161400f565b6001600160401b031681526020810191909152604001600020546114d39086614747565b94505b50505b6114f4886114ed60408c0160208d0161400f565b60016138f3565b6114fe9084614747565b925061151961151360408b0160208c0161400f565b8461393f565b6115239086614747565b9450866115308688614747565b61153a9190614747565b935050505092959194509250565b6000806000806115656000805160206159e28339815191526134de565b90508461176e5760006115788780614f77565b6115829080614f27565b9050905060006115b17f0000000000000000000000000000000000000000000000000000000000000000613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600a60205260409020546115f4919061517f565b905060006116217f0000000000000000000000000000000000000000000000000000000000000000613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600b6020526040902054611664919061517f565b905060005b838110156117655760006116a66116808c80614f77565b61168a9080614f27565b8481811061169a5761169a614691565b905060200201356138bf565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0388169063596db71790602401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c919061488c565b905080158015611732575063ffffffff82166002145b1561174857611741858a614747565b985061175b565b801561175b57611758848a614747565b98505b5050600101611669565b5050505061179f565b61179261177b8780614f77565b611789906080810190614f27565b6112eb916151fe565b61179c9085614747565b93505b6117a98385614747565b9150509250925092565b6117dc7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516317a0e54b60e11b81523360048201526001600160a01b039190911690632f41ca9690602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611846919061488c565b6118635760405163222d861d60e11b815260040160405180910390fd5b816001036119585760008180602001905181019061188191906146c7565b90506001600160a01b038116158015906119035750600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fd91906148d1565b60ff1614155b15611921576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038416600090815260208190526040902080546001600160a01b0319166001600160a01b03929092169190911790555b81600203611a4d5760008180602001905181019061197691906146c7565b90506001600160a01b038116158015906119f85750600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f291906148d1565b60ff1614155b15611a16576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038416600090815260016020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b81600303611a835780806020019051810190611a699190614718565b6001600160401b0384166000908152600260205260409020555b81600403611ab95780806020019051810190611a9f9190614718565b6001600160401b0384166000908152600360205260409020555b81600503611aef5780806020019051810190611ad59190614718565b6001600160401b0384166000908152600460205260409020555b81600603611b255780806020019051810190611b0b9190614718565b6001600160401b0384166000908152600560205260409020555b81600703611b5b5780806020019051810190611b419190614718565b6001600160401b0384166000908152600660205260409020555b81600803611b915780806020019051810190611b779190614718565b6001600160401b0384166000908152600760205260409020555b81600903611bc75780806020019051810190611bad9190614718565b6001600160401b0384166000908152600860205260409020555b81600a03611bfd5780806020019051810190611be39190614718565b6001600160401b0384166000908152600960205260409020555b81600b03611c335780806020019051810190611c199190614718565b6001600160401b0384166000908152600a60205260409020555b81600c03611c695780806020019051810190611c4f9190614718565b6001600160401b0384166000908152600b60205260409020555b81836001600160401b03167fae3dadf141b0383d3b4db666b2fc32179836af27e11a3e8f07c3ef8da82e593083604051611ca39190614533565b60405180910390a3505050565b600061120a82611cc1868686610805565b613b10565b611cef7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516317a0e54b60e11b81523360048201526001600160a01b039190911690632f41ca9690602401602060405180830381865afa158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d59919061488c565b611d765760405163222d861d60e11b815260040160405180910390fd5b600c611d82828261525c565b5050565b60008080808080611d9a6040890189614f77565b611da49080614f27565b905090506000611dc16000805160206159e28339815191526134de565b90506000611e32611dd28b80614f27565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611e149250505060408d0160208e0161400f565b6112a3611e2460408f018f614f77565b611e2d90615402565b613ba3565b9050611e3e8188614747565b96508815611f7857611e5661177b60408c018c614f77565b611e609089614747565b9750611e7b611e7560408c0160208d0161400f565b84613713565b611e859085614747565b93506000805b84811015611eeb57611ea060408d018d614f77565b611eae9060e0810190614f27565b82818110611ebe57611ebe614691565b9050602002016020810190611ed39190615162565b611ee357611ee082615540565b91505b600101611e8b565b50611ef58161373d565b611eff9089614747565b9750611f66611f1460408d0160208e0161400f565b611f2160408e018e614f77565b611f2f9060c0810190614f27565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061380292505050565b611f709086614747565b9450506120b8565b60005b838110156120b6576000611f9561168060408e018e614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0386169063596db71790602401602060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b919061488c565b905080158015612021575063ffffffff82166002145b1561206857600a60008e602001602081019061203d919061400f565b6001600160401b031681526020810191909152604001600020546120619088614747565b96506120ac565b80156120ac57600b60008e6020016020810190612085919061400f565b6001600160401b031681526020810191909152604001600020546120a99088614747565b96505b5050600101611f7b565b505b6120d2896120cc60408d0160208e0161400f565b856138f3565b6120dc9085614747565b93506120f76120f160408c0160208d0161400f565b8561393f565b6121019087614747565b95508761210e8789614747565b6121189190614747565b94505050505092959194509250565b60008080808061213a6020880188614f27565b9050905060006121576000805160206159e28339815191526134de565b905060005b828110156126605760006001600160401b037f00000000000000000000000000000000000000000000000000000000000000001661219d60208c018c614f27565b848181106121ad576121ad614691565b90506020020160208101906121c2919061400f565b6001600160401b031614159050600080826121de5760006122b7565b6122b76121eb8d80614f27565b868181106121fb576121fb614691565b905060200281019061220d9190614f27565b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508d806020019061225d9190614f27565b8781811061226d5761226d614691565b9050602002016020810190612282919061400f565b6112a38f80604001906122959190614f27565b898181106122a5576122a5614691565b90506020028101906112959190614f77565b90506122c3818a614747565b98508a1561242b576123006112eb6122de60408f018f614f27565b878181106122ee576122ee614691565b90506020028101906112cf9190614f77565b61230a908b614747565b995082156124265761234761232260208e018e614f27565b8681811061233257612332614691565b905060200201602081019061130f919061400f565b6123519083614747565b915061236060408d018d614f27565b8581811061237057612370614691565b90506020028101906123829190614f77565b6123949061010081019060e001615162565b6123af576123a2600161373d565b6123ac908a614747565b98505b6124196123bf60208e018e614f27565b868181106123cf576123cf614691565b90506020020160208101906123e4919061400f565b6113978e80604001906123f79190614f27565b8881811061240757612407614691565b905060200281019061137f9190614f77565b6124239083614747565b91505b6125bd565b600061245f61243d60408f018f614f27565b8781811061244d5761244d614691565b90506020028101906113bf9190614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0388169063596db71790602401602060405180830381865afa1580156124b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d5919061488c565b9050801580156124eb575063ffffffff82166002145b1561255457600a60008f80602001906125049190614f27565b8981811061251457612514614691565b9050602002016020810190612529919061400f565b6001600160401b0316815260208101919091526040016000205461254d9085614747565b93506125ba565b80156125ba57600b60008f806020019061256e9190614f27565b8981811061257e5761257e614691565b9050602002016020810190612593919061400f565b6001600160401b031681526020810191909152604001600020546125b79085614747565b93505b50505b826125c95760006125ff565b6125ff8b6125da60208f018f614f27565b878181106125ea576125ea614691565b90506020020160208101906114ed919061400f565b6126099083614747565b915061264661261b60208e018e614f27565b8681811061262b5761262b614691565b9050602002016020810190612640919061400f565b8361393f565b6126509089614747565b975050505080600101905061215c565b508561266c8587614747565b6126769190614747565b9250505092959194509250565b600c8054612690906149ad565b80601f01602080910402602001604051908101604052809291908181526020018280546126bc906149ad565b80156127095780601f106126de57610100808354040283529160200191612709565b820191906000526020600020905b8154815290600101906020018083116126ec57829003601f168201915b505050505081565b60008060008061274b6040518060a00160405280600081526020016000815260200160008152602001600081526020016000151581525090565b6127586020880188614f27565b82525060006127746000805160206159e28339815191526134de565b905060005b82518110156126605760006001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166127bb60208c018c614f27565b848181106127cb576127cb614691565b90506020020160208101906127e0919061400f565b600060408701526001600160401b031614159050806128005760006128c5565b6128c561280d8b80614f27565b8481811061281d5761281d614691565b905060200281019061282f9190614f27565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061286e9250505060208d018d614f27565b8581811061287e5761287e614691565b9050602002016020810190612893919061400f565b6112a36128a360408f018f614f27565b878181106128b3576128b3614691565b9050602002810190611e249190614f77565b60608501526128d760408b018b614f27565b838181106128e7576128e7614691565b90506020028101906128f99190614f77565b6129039080614f27565b60208601525060608401516129189088614747565b96508815612ada5761295261293060408c018c614f27565b8481811061294057612940614691565b905060200281019061177b9190614f77565b61295c9089614747565b97508015612ad5576129a361297460208c018c614f27565b8481811061298457612984614691565b9050602002016020810190612999919061400f565b8560200151613713565b846040018181516129b49190614747565b9052506000805b8560200151811015612a41576129d460408d018d614f27565b858181106129e4576129e4614691565b90506020028101906129f69190614f77565b612a049060e0810190614f27565b82818110612a1457612a14614691565b9050602002016020810190612a299190615162565b612a3957612a3682615540565b91505b6001016129bb565b50612a4f856020015161373d565b612a599089614747565b9750612abf612a6b60208d018d614f27565b85818110612a7b57612a7b614691565b9050602002016020810190612a90919061400f565b612a9d60408e018e614f27565b86818110612aad57612aad614691565b9050602002810190611f219190614f77565b85604001818151612ad09190614747565b905250505b612ca0565b60005b8460200151811015612c9e576000612b1d612afb60408e018e614f27565b86818110612b0b57612b0b614691565b90506020028101906116809190614f77565b5060405163596db71760e01b815263ffffffff821660048201529092506001600160a01b038716915063596db71790602401602060405180830381865afa158015612b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b90919061488c565b15801560808801819052612baa575063ffffffff81166002145b15612c1f57600a6000612bc060208f018f614f27565b87818110612bd057612bd0614691565b9050602002016020810190612be5919061400f565b6001600160401b03166001600160401b031681526020019081526020016000205486604001818151612c179190614747565b905250612c95565b856080015115612c9557600b6000612c3a60208f018f614f27565b87818110612c4a57612c4a614691565b9050602002016020810190612c5f919061400f565b6001600160401b03166001600160401b031681526020019081526020016000205486604001818151612c919190614747565b9052505b50600101612add565b505b80612cac576000612cec565b612cec89612cbd60208d018d614f27565b85818110612ccd57612ccd614691565b9050602002016020810190612ce2919061400f565b86602001516138f3565b84604001818151612cfd9190614747565b905250612d3f612d1060208c018c614f27565b84818110612d2057612d20614691565b9050602002016020810190612d35919061400f565b856040015161393f565b612d499087614747565b955050600101612779565b600080600080612d716000805160206159e28339815191526134de565b905084612f1b576000612d876113bf8880614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0384169063596db71790602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd919061488c565b905080158015612e13575063ffffffff82166002145b15612e9557612e417f0000000000000000000000000000000000000000000000000000000000000000613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600a6020526040902054612e84919061517f565b612e8e9086614747565b9450612f14565b8015612f1457612ec47f0000000000000000000000000000000000000000000000000000000000000000613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600b6020526040902054612f07919061517f565b612f119086614747565b94505b505061179f565b61179c6112eb6112cf8880614f77565b60608060008084806020019051810190612f459190615559565b905086868260200151604051602001612f60939291906155e5565b60408051601f19818403018152918152602083810192909252805188830281810184019092528881528892612fb6928c92918c9186918291908501908490808284376000920191909152508b9250613c33915050565b9350806001600160401b03811115612fd057612fd061402c565b604051908082528060200260200182016040528015612ff9578160200160208202803683370190505b509450600060405180604001604052806000198152602001888051906020012060405160200161302b91815260200190565b60408051601f1981840301815291815291525161304b919060200161485c565b6040516020818303038152906040529050896001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b0316146132485760005b828110156132465760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630eff125d8c8c858181106130e3576130e3614691565b90506020020160208101906130f89190615635565b6040516001600160e01b031960e084901b16815260ff9091166004820152602401602060405180830381865afa158015613136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061315a91906146c7565b6001600160a01b031663ea98b1478d846000036131965787604051602001613182919061485c565b604051602081830303815290604052613198565b855b8a86815181106131aa576131aa614691565b60200260200101516040518463ffffffff1660e01b81526004016131d0939291906146e4565b602060405180830381865afa1580156131ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132119190614718565b905061321d8187614747565b95508088838151811061323257613232614691565b602090810291909101015250600101613098565b505b5050509450945094915050565b825160009081613266858786613c33565b905060008480602001905181019061327e9190615559565b9050868160200151604051602001613297929190615652565b604051602081830303815290604052816020018190525060006040518060400160405280600019815260200187805190602001206040516020016132dd91815260200190565b60408051601f198184030181529181529152516132fd919060200161485c565b6040516020818303038152906040529050866001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b0316146134d35760005b848110156134d15760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630eff125d8b848151811061339557613395614691565b60200260200101516040518263ffffffff1660e01b81526004016133c2919060ff91909116815260200190565b602060405180830381865afa1580156133df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340391906146c7565b6001600160a01b031663ea98b1478a8460000361343f578660405160200161342b919061485c565b604051602081830303815290604052613441565b855b88868151811061345357613453614691565b60200260200101516040518463ffffffff1660e01b8152600401613479939291906146e4565b602060405180830381865afa158015613496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134ba9190614718565b90506134c68188614747565b96505060010161334a565b505b505050509392505050565b6040516321f8a72160e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906321f8a72190602401602060405180830381865afa158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a91906146c7565b92915050565b60606000604051806101400160405280613588613e96565b815260200184600001518152602001846020015181526020018460400151815260200184606001518152602001846080015181526020018460c00151151581526020018460e00151151581526020018461010001516001600160a01b031681526020018461014001518152506040516020016136049190615710565b60408051601f19818403018152828201825260001983526020838101829052915190935061363392910161485c565b604051602081830303815290604052915050919050565b604080516001808252818301909252606091816020015b6040805160c0810182526060808252600060208084018290529383018190529082018190526080820181905260a0820152825260001990920191018161366157905050905081816000815181106136ba576136ba614691565b6020026020010181905250919050565b8051600090815b8181101561370c578381815181106136eb576136eb614691565b602002602001015160a00151836137029190614747565b92506001016136d1565b5050919050565b6001600160401b038216600090815260036020526040812054613736908361517f565b9392505050565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600960205260408120548190613782908461517f565b90506137ad7f0000000000000000000000000000000000000000000000000000000000000000613a1e565b613736908261517f565b6040805160018082528183019092526060916020808301908036833701905050905081816000815181106137ed576137ed614691565b91151560209283029190910190910152919050565b600080836001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b03160361384857600091505061356a565b825160005b818110156138885784818151811061386757613867614691565b6020026020010151156138805761387d83615540565b92505b60010161384d565b508160000361389c5760009250505061356a565b6001600160401b0385166000908152600260205260409020546109eb908361517f565b8060a081901c60c082901c60008190036138ec5760405163030042b760e01b815260040160405180910390fd5b9193909250565b60008084613919576001600160401b038416600090815260056020526040902054613933565b6001600160401b0384166000908152600460205260409020545b90506109eb838261517f565b60008061394b84613a1e565b613955908461517f565b90508060000361396957600091505061356a565b600061397485613f32565b61397e908361517f565b9050806000036139935760009250505061356a565b60006139be7f0000000000000000000000000000000000000000000000000000000000000000613f32565b9050806000036139e157604051634c8f99a760e11b815260040160405180910390fd5b613a0a7f0000000000000000000000000000000000000000000000000000000000000000613f32565b613a1490836157c2565b9695505050505050565b6001600160401b0381166000908152600160205260408120546001600160a01b03168015613af357806001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015613aa0575060408051601f3d908101601f19168201909252613a9d918101906157fe565b60015b15613af35760008413613ac65760405163119d4d6b60e11b815260040160405180910390fd5b81600003613ae7576040516376685d7f60e11b815260040160405180910390fd5b50919695505050505050565b50506001600160401b031660009081526007602052604090205490565b600081600003613b225750600061356a565b6000613b4d7f0000000000000000000000000000000000000000000000000000000000000000613f32565b613b57908461517f565b905080600003613b6b57600091505061356a565b6000613b7685613f32565b905080600003613b9957604051634c8f99a760e11b815260040160405180910390fd5b6109eb81836157c2565b60606000604051806101400160405280613bbb613e96565b815260200184600001518152602001846020015181526020018460400151815260200184606001518152602001846080015181526020018460c0015181526020018460e0015181526020018461010001516001600160a01b0316815260200184610140015181525060405160200161360491906158ce565b6060600082806020019051810190613c4b9190615559565b9050838160200151604051602001613c64929190615652565b60408051601f1981840301815291815260208381019290925285516001600160401b038816600090815260088452828120549251919390918391613caa9187910161485c565b60405160208183030381529060405251613cc4919061517f565b90506000613cd38360a061517f565b9050836001600160401b03811115613ced57613ced61402c565b604051908082528060200260200182016040528015613d2057816020015b6060815260200190600190039081613d0b5790505b50955060005b84811015613e8957600081600003613d3e5783613d40565b825b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630eff125d8b8481518110613d8357613d83614691565b60200260200101516040518263ffffffff1660e01b8152600401613db0919060ff91909116815260200190565b602060405180830381865afa158015613dcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613df191906146c7565b6001600160a01b03166325fc6dd0826040518263ffffffff1660e01b8152600401613e1e91815260200190565b600060405180830381865afa158015613e3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e639190810190614a26565b888381518110613e7557613e75614691565b602090810291909101015250600101613d26565b5050505050509392505050565b6000613ec17f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b6134de565b6001600160a01b03166313c02a596040518163ffffffff1660e01b8152600401602060405180830381865afa158015613efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f229190614718565b9050613f2d81615540565b905090565b6001600160401b0381166000908152602081905260408120546001600160a01b03168015613fda57806001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015613fb4575060408051601f3d908101601f19168201909252613fb1918101906157fe565b60015b15613fda5760008413613ac65760405163119d4d6b60e11b815260040160405180910390fd5b50506001600160401b031660009081526006602052604090205490565b6001600160401b038116811461400c57600080fd5b50565b60006020828403121561402157600080fd5b813561373681613ff7565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156140645761406461402c565b60405290565b60405161014081016001600160401b03811182821017156140645761406461402c565b60405161016081016001600160401b03811182821017156140645761406461402c565b604051601f8201601f191681016001600160401b03811182821017156140d8576140d861402c565b604052919050565b60006001600160401b038211156140f9576140f961402c565b5060051b60200190565b60ff8116811461400c57600080fd5b600082601f83011261412357600080fd5b81356020614138614133836140e0565b6140b0565b8083825260208201915060208460051b87010193508684111561415a57600080fd5b602086015b8481101561417f57803561417281614103565b835291830191830161415f565b509695505050505050565b60006001600160401b038211156141a3576141a361402c565b50601f01601f191660200190565b600082601f8301126141c257600080fd5b81356141d06141338261418a565b8181528460208386010111156141e557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561421857600080fd5b84356001600160401b038082111561422f57600080fd5b61423b88838901614112565b9550602091508187013561424e81613ff7565b945060408701358181111561426257600080fd5b61426e89828a016141b1565b94505060608701358181111561428357600080fd5b8701601f8101891361429457600080fd5b80356142a2614133826140e0565b81815260059190911b8201840190848101908b8311156142c157600080fd5b8584015b838110156142f9578035868111156142dd5760008081fd5b6142eb8e89838901016141b1565b8452509186019186016142c5565b50989b979a50959850505050505050565b60006040820184835260206040602085015281855180845260608601915060208701935060005b8181101561434d57845183529383019391830191600101614331565b5090979650505050505050565b6000806000806060858703121561437057600080fd5b843561437b81613ff7565b935060208501356001600160401b038082111561439757600080fd5b818701915087601f8301126143ab57600080fd5b8135818111156143ba57600080fd5b8860208260051b85010111156143cf57600080fd5b6020830195508094505060408701359150808211156143ed57600080fd5b506143fa878288016141b1565b91505092959194509250565b60005b83811015614421578181015183820152602001614409565b50506000910152565b60008151808452614442816020860160208601614406565b601f01601f19169290920160200192915050565b82815260406020820152600061120a604083018461442a565b801515811461400c57600080fd5b80356144888161446f565b919050565b6000806000606084860312156144a257600080fd5b83356144ad8161446f565b925060208401356001600160401b038111156144c857600080fd5b6144d486828701614112565b92505060408401356144e581613ff7565b809150509250925092565b6000808284036101a081121561450557600080fd5b833561451081613ff7565b9250610180601f198201121561452557600080fd5b506020830190509250929050565b602081526000613736602083018461442a565b60006020828403121561455857600080fd5b5035919050565b60006060828403121561457157600080fd5b50919050565b6000806040838503121561458a57600080fd5b82356001600160401b038111156145a057600080fd5b6145ac8582860161455f565b92505060208301356145bd8161446f565b809150509250929050565b60006020828403121561457157600080fd5b600080604083850312156145ed57600080fd5b82356001600160401b0381111561460357600080fd5b6145ac858286016145c8565b60008060006060848603121561462457600080fd5b833561462f81613ff7565b92506020840135915060408401356001600160401b0381111561465157600080fd5b6117a9868287016141b1565b60006020828403121561466f57600080fd5b81356001600160401b0381111561468557600080fd5b61120a848285016141b1565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461400c57600080fd5b8051614488816146a7565b6000602082840312156146d957600080fd5b8151613736816146a7565b6001600160401b0384168152606060208201526000614706606083018561442a565b8281036040840152613a14818561442a565b60006020828403121561472a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561356a5761356a614731565b60008151808452602080850194506020840160005b8381101561478b5781518752958201959082019060010161476f565b509495945050505050565b6000602080835283516040828501526147b2606085018261475a565b82860151601f198683038101604088015281518084529293509084019183850190600581901b8501860160005b8281101561480b57848783030184526147f982875161442a565b958801959388019391506001016147df565b509998505050505050505050565b6020815281516020820152600060208301516060604084015261483f608084018261475a565b90506040840151601f198483030160608501526109eb828261475a565b60208152815160208201526000602083015160408084015261120a606084018261442a565b80516144888161446f565b60006020828403121561489e57600080fd5b81516137368161446f565b8035614488816146a7565b6000602082840312156148c657600080fd5b8135613736816146a7565b6000602082840312156148e357600080fd5b815161373681614103565b6001600160401b03831681526101a0810161491c6020830161490f856148a9565b6001600160a01b03169052565b614928602084016148a9565b6001600160a01b0381166040840152506040830135606083015260608301356080830152608083013560a083015260a083013560c083015260c083013560e083015261010060e0840135818401526101208185013581850152610140915080850135828501525061016081850135818501528085013561018085015250509392505050565b600181811c908216806149c157607f821691505b60208210810361457157634e487b7160e01b600052602260045260246000fd5b600082601f8301126149f257600080fd5b8151614a006141338261418a565b818152846020838601011115614a1557600080fd5b61120a826020830160208701614406565b600060208284031215614a3857600080fd5b81516001600160401b03811115614a4e57600080fd5b61120a848285016149e1565b600082601f830112614a6b57600080fd5b81516020614a7b614133836140e0565b8083825260208201915060208460051b870101935086841115614a9d57600080fd5b602086015b8481101561417f5780518352918301918301614aa2565b600060c08284031215614acb57600080fd5b614ad3614042565b905081516001600160401b03811115614aeb57600080fd5b614af7848285016149e1565b8252506020820151614b08816146a7565b60208201526040820151614b1b816146a7565b60408201526060820151614b2e81614103565b60608201526080820151614b4181613ff7565b8060808301525060a082015160a082015292915050565b600082601f830112614b6957600080fd5b81516020614b79614133836140e0565b82815260059290921b84018101918181019086841115614b9857600080fd5b8286015b8481101561417f5780516001600160401b03811115614bbb5760008081fd5b614bc98986838b0101614ab9565b845250918301918301614b9c565b600082601f830112614be857600080fd5b81516020614bf8614133836140e0565b8083825260208201915060208460051b870101935086841115614c1a57600080fd5b602086015b8481101561417f578051614c328161446f565b8352918301918301614c1f565b600060208284031215614c5157600080fd5b81516001600160401b0380821115614c6857600080fd5b908301906101408286031215614c7d57600080fd5b614c8561406a565b82518152602083015182811115614c9b57600080fd5b614ca787828601614a5a565b602083015250604083015182811115614cbf57600080fd5b614ccb87828601614a5a565b604083015250606083015182811115614ce357600080fd5b614cef87828601614a5a565b606083015250608083015182811115614d0757600080fd5b614d1387828601614a5a565b60808301525060a083015182811115614d2b57600080fd5b614d3787828601614b58565b60a08301525060c083015182811115614d4f57600080fd5b614d5b87828601614bd7565b60c08301525060e083015182811115614d7357600080fd5b614d7f87828601614bd7565b60e083015250610100614d938185016146bc565b908201526101208381015183811115614dab57600080fd5b614db7888287016149e1565b918301919091525095945050505050565b600060208284031215614dda57600080fd5b81516001600160401b0380821115614df157600080fd5b908301906101408286031215614e0657600080fd5b614e0e61406a565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015182811115614e4c57600080fd5b614e5887828601614ab9565b60a083015250614e6a60c08401614881565b60c0820152614e7b60e08401614881565b60e0820152610100614d938185016146bc565b60006020808385031215614ea157600080fd5b82516001600160401b03811115614eb757600080fd5b8301601f81018513614ec857600080fd5b8051614ed6614133826140e0565b81815260059190911b82018301908381019087831115614ef557600080fd5b928401925b82841015614f1c578351614f0d81614103565b82529284019290840190614efa565b979650505050505050565b6000808335601e19843603018112614f3e57600080fd5b8301803591506001600160401b03821115614f5857600080fd5b6020019150600581901b3603821315614f7057600080fd5b9250929050565b6000823561015e19833603018112614f8e57600080fd5b9190910192915050565b600060c08284031215614faa57600080fd5b614fb2614042565b905081356001600160401b03811115614fca57600080fd5b614fd6848285016141b1565b8252506020820135614fe7816146a7565b60208201526040820135614ffa816146a7565b6040820152606082013561500d81614103565b6060820152608082013561502081613ff7565b8060808301525060a082013560a082015292915050565b6000610160823603121561504a57600080fd5b61505261408d565b8235815260208301356020820152604083013560408201526060830135606082015260808301356001600160401b038082111561508e57600080fd5b61509a36838701614f98565b608084015260a08501359150808211156150b357600080fd5b6150bf368387016141b1565b60a08401526150d060c0860161447d565b60c08401526150e160e0860161447d565b60e084015261010091506150f68286016148a9565b82840152610120915061510a8286016148a9565b828401526101409150818501358181111561512457600080fd5b615130368288016141b1565b8385015250505080915050919050565b6000823560be19833603018112614f8e57600080fd5b600061356a3683614f98565b60006020828403121561517457600080fd5b81356137368161446f565b808202811582820484141761356a5761356a614731565b60006151a4614133846140e0565b8381529050602080820190600585901b8401868111156151c357600080fd5b845b818110156134d35780356001600160401b038111156151e45760008081fd5b6151f089828901614f98565b8552509282019282016151c5565b6000613736368484615196565b601f821115615257576000816000526020600020601f850160051c810160208610156152345750805b601f850160051c820191505b8181101561525357828155600101615240565b5050505b505050565b81516001600160401b038111156152755761527561402c565b6152898161528384546149ad565b8461520b565b602080601f8311600181146152be57600084156152a65750858301515b600019600386901b1c1916600185901b178555615253565b600085815260208120601f198616915b828110156152ed578886015182559484019460019091019084016152ce565b508582101561530b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f83011261532c57600080fd5b8135602061533c614133836140e0565b8083825260208201915060208460051b87010193508684111561535e57600080fd5b602086015b8481101561417f5780358352918301918301615363565b600082601f83011261538b57600080fd5b61373683833560208501615196565b600082601f8301126153ab57600080fd5b813560206153bb614133836140e0565b8083825260208201915060208460051b8701019350868411156153dd57600080fd5b602086015b8481101561417f5780356153f58161446f565b83529183019183016153e2565b6000610160823603121561541557600080fd5b61541d61408d565b82356001600160401b038082111561543457600080fd5b6154403683870161531b565b8352602085013591508082111561545657600080fd5b6154623683870161531b565b6020840152604085013591508082111561547b57600080fd5b6154873683870161531b565b604084015260608501359150808211156154a057600080fd5b6154ac3683870161531b565b606084015260808501359150808211156154c557600080fd5b6154d13683870161537a565b608084015260a08501359150808211156154ea57600080fd5b6154f6368387016141b1565b60a084015260c085013591508082111561550f57600080fd5b61551b3683870161539a565b60c084015260e085013591508082111561553457600080fd5b6150e13683870161539a565b60006001820161555257615552614731565b5060010190565b60006020828403121561556b57600080fd5b81516001600160401b038082111561558257600080fd5b908301906040828603121561559657600080fd5b6040516040810181811083821117156155b1576155b161402c565b604052825181526020830151828111156155ca57600080fd5b6155d6878286016149e1565b60208301525095945050505050565b6040808252810183905260008460608301825b8681101561562257823561560b81614103565b60ff168252602092830192909101906001016155f8565b508381036020850152614f1c818661442a565b60006020828403121561564757600080fd5b813561373681614103565b604080825283519082018190526000906020906060840190828701845b8281101561568e57815160ff168452928401929084019060010161566f565b5050508381036020850152613a14818661442a565b6000815160c084526156b860c085018261442a565b9050602083015160018060a01b038082166020870152806040860151166040870152505060ff60608401511660608501526001600160401b03608084015116608085015260a083015160a08501528091505092915050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a08301516101408060c08501526157616101608501836156a3565b915060c085015161577660e086018215159052565b5060e085015161010061578c8187018315159052565b86015190506101206157a8868201836001600160a01b03169052565b860151858403601f1901838701529050613a14838261442a565b6000826157df57634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff8116811461448857600080fd5b600080600080600060a0868803121561581657600080fd5b61581f866157e4565b9450602086015193506040860151925060608601519150615842608087016157e4565b90509295509295909350565b60008282518085526020808601955060208260051b8401016020860160005b8481101561434d57601f198684030189526158898383516156a3565b9884019892509083019060010161586d565b60008151808452602080850194506020840160005b8381101561478b5781511515875295820195908201906001016158b0565b6020815281516020820152600060208301516101408060408501526158f761016085018361475a565b91506040850151601f1980868503016060870152615915848361475a565b93506060870151915080868503016080870152615932848361475a565b935060808701519150808685030160a087015261594f848361475a565b935060a08701519150808685030160c087015261596c848361584e565b935060c08701519150808685030160e0870152615989848361589b565b935060e087015191506101008187860301818801526159a8858461589b565b9450808801519250506101206159c8818801846001600160a01b03169052565b870151868503909101838701529050613a14838261442a56febcc180fb907e9ae431665de4bc74305c00b7b27442aadd477980ecc4bb14c011a2646970667358221220e0d3359aa9156db6b875d4d53b8cf0d016826547eb83155901095deda082992d64736f6c6343000817003300000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80637504988b11610104578063b9694b52116100a2578063da16363711610071578063da16363714610534578063ee4bc1c71461053c578063f3afdd881461055c578063f3d808461461056f57600080fd5b8063b9694b52146104db578063c97c55b0146104ee578063d701397414610501578063d8bb4f4e1461051457600080fd5b806385e1f4d0116100de57806385e1f4d014610449578063904b1a2814610488578063a9ce4648146104a8578063b1752d59146104c857600080fd5b80637504988b146103e85780637abae251146104165780637f7aecb51461042957600080fd5b80634545fc311161017c5780634c75c0d81161014b5780634c75c0d81461036d57806353d69edc1461038d578063596703e7146103a257806361d26cae146103b557600080fd5b80634545fc31146102ef5780634786b4241461030f57806349c3af451461032f57806349c4144c1461035857600080fd5b80631f864be3116101b85780631f864be31461027357806324c73dda146102945780633283166a146102bb57806336c7fe1d146102dc57600080fd5b80630292540b146101df57806312c4da86146102125780631f5ae58f14610253575b600080fd5b6101ff6101ed36600461400f565b600b6020526000908152604090205481565b6040519081526020015b60405180910390f35b61023b61022036600461400f565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610209565b6101ff61026136600461400f565b600a6020526000908152604090205481565b610286610281366004614202565b610582565b60405161020992919061430a565b61023b7f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a251481565b6102ce6102c936600461435a565b6107a6565b604051610209929190614456565b6101ff6102ea36600461448d565b610805565b6101ff6102fd36600461400f565b60066020526000908152604090205481565b6101ff61031d36600461400f565b60076020526000908152604090205481565b61023b61033d36600461400f565b6001602052600090815260409020546001600160a01b031681565b61036b6103663660046144f0565b6109f4565b005b6101ff61037b36600461400f565b60046020526000908152604090205481565b610395610d65565b6040516102099190614533565b6101ff6103b0366004614546565b610df7565b6103c86103c3366004614577565b611212565b604080519485526020850193909352918301526060820152608001610209565b6103fb6103f63660046145da565b611548565b60408051938452602084019290925290820152606001610209565b61036b61042436600461460f565b6117b3565b6101ff61043736600461400f565b60056020526000908152604090205481565b6104707f000000000000000000000000000000000000000000000000000000000000000181565b6040516001600160401b039091168152602001610209565b6101ff61049636600461400f565b60086020526000908152604090205481565b6101ff6104b636600461400f565b60026020526000908152604090205481565b6101ff6104d636600461448d565b611cb0565b61036b6104e936600461465d565b611cc6565b6103c86104fc366004614577565b611d86565b6103c861050f366004614577565b612127565b6101ff61052236600461400f565b60096020526000908152604090205481565b610395612683565b6101ff61054a36600461400f565b60036020526000908152604090205481565b6103c861056a366004614577565b612711565b6103fb61057d3660046145da565b612d54565b835160009060609082816001600160401b038111156105a3576105a361402c565b6040519080825280602002602001820160405280156105cc578160200160208202803683370190505b509050866001600160401b03167f00000000000000000000000000000000000000000000000000000000000000016001600160401b03161461079a5760005b82811015610798577f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316630eff125d8a838151811061065457610654614691565b60200260200101516040518263ffffffff1660e01b8152600401610681919060ff91909116815260200190565b602060405180830381865afa15801561069e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c291906146c7565b6001600160a01b031663ea98b14789898985815181106106e4576106e4614691565b60200260200101516040518463ffffffff1660e01b815260040161070a939291906146e4565b602060405180830381865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b9190614718565b82828151811061075d5761075d614691565b60200260200101818152505081818151811061077b5761077b614691565b60200260200101518561078e9190614747565b945060010161060b565b505b91505094509492505050565b6000606060008060006107bb89898989612f2b565b9250925092506040518060400160405280848152602001838152506040516020016107e69190614796565b60408051601f1981840301815291905290999098509650505050505050565b6000606084156109645760405163bffc1e1360e01b81526001600160401b03841660048201526000907f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b03169063bffc1e1390602401602060405180830381865afa15801561087f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a39190614718565b90506000816001600160401b038111156108bf576108bf61402c565b6040519080825280602002602001820160405280156108e8578160200160208202803683370190505b50905060005b8281101561091e5760001982828151811061090b5761090b614691565b60209081029190910101526001016108ee565b50604051806060016040528060001981526020018281526020018281525060405160200161094c9190614819565b604051602081830303815290604052925050506109ab565b506040805160608082018352600019808352602080840182815293850182815285519182019290925292518385015251828201528251808303909101815260809091019091525b6109eb848460405180604001604052806000198152602001858152506040516020016109d7919061485c565b604051602081830303815290604052613255565b95945050505050565b610a1d7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516369ac88f960e11b81523360048201526001600160a01b03919091169063d35911f290602401602060405180830381865afa158015610a63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a87919061488c565b610aa457604051633721555560e21b815260040160405180910390fd5b6000610ab360208301836148b4565b6001600160a01b031614610b91576000610ad060208301836148b4565b9050600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3991906148d1565b60ff1614610b5a576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038316600090815260208190526040902080546001600160a01b0319166001600160a01b03929092169190911790555b6000610ba360408301602084016148b4565b6001600160a01b031614610c84576000610bc360408301602084016148b4565b9050600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2c91906148d1565b60ff1614610c4d576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038316600090815260016020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b6001600160401b0382166000908152600260209081526040808320818501359055600382528083206060850135905560048252808320608085013590556005825280832060a085013590556006825280832060c085013590556007825280832060e08501359055600882528083206101008501359055600982528083206101208501359055600a82528083206101408501359055600b909152908190206101608301359055517f1398b222973e8ac251bde901bfdec29f22df65e1d77bd8e495e25e34d484a2ab90610d5990849084906148ee565b60405180910390a15050565b6060600c8054610d74906149ad565b80601f0160208091040260200160405190810160405280929190818152602001828054610da0906149ad565b8015610ded5780601f10610dc257610100808354040283529160200191610ded565b820191906000526020600020905b815481529060010190602001808311610dd057829003601f168201915b5050505050905090565b604080516101008101825260008082526020820181905291810182905260608082018190526080820181905260a0820183905260c0820183905260e08201526000610e617f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b6134de565b9050806001600160a01b03166313c02a596040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec59190614718565b808352841115610ee8576040516355da2ca360e11b815260040160405180910390fd5b6040516336445ffd60e01b8152600481018590526001600160a01b038216906336445ffd90602401602060405180830381865afa158015610f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f519190614718565b602083015260405163361ad42b60e01b8152600481018590526001600160a01b0382169063361ad42b90602401600060405180830381865afa158015610f9b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fc39190810190614a26565b6060830152602082015160c081811c9084015260ff601082901c811660a085015260089190911c166040830181905215611001575060009392505050565b8160a0015160ff16600103611076576000826060015180602001905181019061102a9190614c3f565b6040805160608101825285518152602080840151818301528284015182840152915192935061105b92909101614819565b60408051601f198184030181529190526060840152506110e1565b600082606001518060200190518101906110909190614dc8565b60408051606080820183528651808352602085810151818501908152958501519385019384528451908101919091529351848401529051838201528151808403820181526080909301909152840152505b604051636c181b2760e11b8152600481018590526001600160a01b0382169063d830364e90602401600060405180830381865afa158015611126573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261114e9190810190614e8e565b608083015260408051808201918290526336445ffd60e01b90915260448101859052806001600160a01b0383166336445ffd60648301602060405180830381865afa1580156111a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c59190614718565b815260608401516020918201526040516111e092910161485c565b60408051601f1981840301815291905260e08301819052608083015160c084015161120a92613255565b949350505050565b6000806000806000806112326000805160206159e28339815191526134de565b905060006112a86112438a80614f27565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506112859250505060408c0160208d0161400f565b6112a361129560408e018e614f77565b61129e90615037565b613570565b613255565b90506112b48187614747565b955087156113ad576112f06112eb6112cf60408c018c614f77565b6112dd906080810190615140565b6112e690615156565b61364a565b6136ca565b6112fa9088614747565b965061131661130f60408b0160208c0161400f565b6001613713565b6113209084614747565b925061132f60408a018a614f77565b6113419061010081019060e001615162565b61135c5761134f600161373d565b6113599087614747565b95505b61139c61136f60408b0160208c0161400f565b61139761137f60408d018d614f77565b6113909060e081019060c001615162565b15156137b7565b613802565b6113a69084614747565b92506114d9565b60006113c56113bf60408c018c614f77565b356138bf565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0385169063596db71790602401602060405180830381865afa158015611417573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143b919061488c565b905080158015611451575063ffffffff82166002145b1561149557600a600061146a60408e0160208f0161400f565b6001600160401b0316815260208101919091526040016000205461148e9086614747565b94506114d6565b80156114d657600b60006114af60408e0160208f0161400f565b6001600160401b031681526020810191909152604001600020546114d39086614747565b94505b50505b6114f4886114ed60408c0160208d0161400f565b60016138f3565b6114fe9084614747565b925061151961151360408b0160208c0161400f565b8461393f565b6115239086614747565b9450866115308688614747565b61153a9190614747565b935050505092959194509250565b6000806000806115656000805160206159e28339815191526134de565b90508461176e5760006115788780614f77565b6115829080614f27565b9050905060006115b17f0000000000000000000000000000000000000000000000000000000000000001613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166000908152600a60205260409020546115f4919061517f565b905060006116217f0000000000000000000000000000000000000000000000000000000000000001613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166000908152600b6020526040902054611664919061517f565b905060005b838110156117655760006116a66116808c80614f77565b61168a9080614f27565b8481811061169a5761169a614691565b905060200201356138bf565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0388169063596db71790602401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c919061488c565b905080158015611732575063ffffffff82166002145b1561174857611741858a614747565b985061175b565b801561175b57611758848a614747565b98505b5050600101611669565b5050505061179f565b61179261177b8780614f77565b611789906080810190614f27565b6112eb916151fe565b61179c9085614747565b93505b6117a98385614747565b9150509250925092565b6117dc7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516317a0e54b60e11b81523360048201526001600160a01b039190911690632f41ca9690602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611846919061488c565b6118635760405163222d861d60e11b815260040160405180910390fd5b816001036119585760008180602001905181019061188191906146c7565b90506001600160a01b038116158015906119035750600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fd91906148d1565b60ff1614155b15611921576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038416600090815260208190526040902080546001600160a01b0319166001600160a01b03929092169190911790555b81600203611a4d5760008180602001905181019061197691906146c7565b90506001600160a01b038116158015906119f85750600860ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f291906148d1565b60ff1614155b15611a16576040516333339aa360e11b815260040160405180910390fd5b6001600160401b038416600090815260016020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b81600303611a835780806020019051810190611a699190614718565b6001600160401b0384166000908152600260205260409020555b81600403611ab95780806020019051810190611a9f9190614718565b6001600160401b0384166000908152600360205260409020555b81600503611aef5780806020019051810190611ad59190614718565b6001600160401b0384166000908152600460205260409020555b81600603611b255780806020019051810190611b0b9190614718565b6001600160401b0384166000908152600560205260409020555b81600703611b5b5780806020019051810190611b419190614718565b6001600160401b0384166000908152600660205260409020555b81600803611b915780806020019051810190611b779190614718565b6001600160401b0384166000908152600760205260409020555b81600903611bc75780806020019051810190611bad9190614718565b6001600160401b0384166000908152600860205260409020555b81600a03611bfd5780806020019051810190611be39190614718565b6001600160401b0384166000908152600960205260409020555b81600b03611c335780806020019051810190611c199190614718565b6001600160401b0384166000908152600a60205260409020555b81600c03611c695780806020019051810190611c4f9190614718565b6001600160401b0384166000908152600b60205260409020555b81836001600160401b03167fae3dadf141b0383d3b4db666b2fc32179836af27e11a3e8f07c3ef8da82e593083604051611ca39190614533565b60405180910390a3505050565b600061120a82611cc1868686610805565b613b10565b611cef7f6b50fa17b77d24e42e27a04b69fe50cd6967cfb767d18de0bd5fe7e1a32aa8686134de565b6040516317a0e54b60e11b81523360048201526001600160a01b039190911690632f41ca9690602401602060405180830381865afa158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d59919061488c565b611d765760405163222d861d60e11b815260040160405180910390fd5b600c611d82828261525c565b5050565b60008080808080611d9a6040890189614f77565b611da49080614f27565b905090506000611dc16000805160206159e28339815191526134de565b90506000611e32611dd28b80614f27565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611e149250505060408d0160208e0161400f565b6112a3611e2460408f018f614f77565b611e2d90615402565b613ba3565b9050611e3e8188614747565b96508815611f7857611e5661177b60408c018c614f77565b611e609089614747565b9750611e7b611e7560408c0160208d0161400f565b84613713565b611e859085614747565b93506000805b84811015611eeb57611ea060408d018d614f77565b611eae9060e0810190614f27565b82818110611ebe57611ebe614691565b9050602002016020810190611ed39190615162565b611ee357611ee082615540565b91505b600101611e8b565b50611ef58161373d565b611eff9089614747565b9750611f66611f1460408d0160208e0161400f565b611f2160408e018e614f77565b611f2f9060c0810190614f27565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061380292505050565b611f709086614747565b9450506120b8565b60005b838110156120b6576000611f9561168060408e018e614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0386169063596db71790602401602060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b919061488c565b905080158015612021575063ffffffff82166002145b1561206857600a60008e602001602081019061203d919061400f565b6001600160401b031681526020810191909152604001600020546120619088614747565b96506120ac565b80156120ac57600b60008e6020016020810190612085919061400f565b6001600160401b031681526020810191909152604001600020546120a99088614747565b96505b5050600101611f7b565b505b6120d2896120cc60408d0160208e0161400f565b856138f3565b6120dc9085614747565b93506120f76120f160408c0160208d0161400f565b8561393f565b6121019087614747565b95508761210e8789614747565b6121189190614747565b94505050505092959194509250565b60008080808061213a6020880188614f27565b9050905060006121576000805160206159e28339815191526134de565b905060005b828110156126605760006001600160401b037f00000000000000000000000000000000000000000000000000000000000000011661219d60208c018c614f27565b848181106121ad576121ad614691565b90506020020160208101906121c2919061400f565b6001600160401b031614159050600080826121de5760006122b7565b6122b76121eb8d80614f27565b868181106121fb576121fb614691565b905060200281019061220d9190614f27565b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508d806020019061225d9190614f27565b8781811061226d5761226d614691565b9050602002016020810190612282919061400f565b6112a38f80604001906122959190614f27565b898181106122a5576122a5614691565b90506020028101906112959190614f77565b90506122c3818a614747565b98508a1561242b576123006112eb6122de60408f018f614f27565b878181106122ee576122ee614691565b90506020028101906112cf9190614f77565b61230a908b614747565b995082156124265761234761232260208e018e614f27565b8681811061233257612332614691565b905060200201602081019061130f919061400f565b6123519083614747565b915061236060408d018d614f27565b8581811061237057612370614691565b90506020028101906123829190614f77565b6123949061010081019060e001615162565b6123af576123a2600161373d565b6123ac908a614747565b98505b6124196123bf60208e018e614f27565b868181106123cf576123cf614691565b90506020020160208101906123e4919061400f565b6113978e80604001906123f79190614f27565b8881811061240757612407614691565b905060200281019061137f9190614f77565b6124239083614747565b91505b6125bd565b600061245f61243d60408f018f614f27565b8781811061244d5761244d614691565b90506020028101906113bf9190614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0388169063596db71790602401602060405180830381865afa1580156124b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d5919061488c565b9050801580156124eb575063ffffffff82166002145b1561255457600a60008f80602001906125049190614f27565b8981811061251457612514614691565b9050602002016020810190612529919061400f565b6001600160401b0316815260208101919091526040016000205461254d9085614747565b93506125ba565b80156125ba57600b60008f806020019061256e9190614f27565b8981811061257e5761257e614691565b9050602002016020810190612593919061400f565b6001600160401b031681526020810191909152604001600020546125b79085614747565b93505b50505b826125c95760006125ff565b6125ff8b6125da60208f018f614f27565b878181106125ea576125ea614691565b90506020020160208101906114ed919061400f565b6126099083614747565b915061264661261b60208e018e614f27565b8681811061262b5761262b614691565b9050602002016020810190612640919061400f565b8361393f565b6126509089614747565b975050505080600101905061215c565b508561266c8587614747565b6126769190614747565b9250505092959194509250565b600c8054612690906149ad565b80601f01602080910402602001604051908101604052809291908181526020018280546126bc906149ad565b80156127095780601f106126de57610100808354040283529160200191612709565b820191906000526020600020905b8154815290600101906020018083116126ec57829003601f168201915b505050505081565b60008060008061274b6040518060a00160405280600081526020016000815260200160008152602001600081526020016000151581525090565b6127586020880188614f27565b82525060006127746000805160206159e28339815191526134de565b905060005b82518110156126605760006001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166127bb60208c018c614f27565b848181106127cb576127cb614691565b90506020020160208101906127e0919061400f565b600060408701526001600160401b031614159050806128005760006128c5565b6128c561280d8b80614f27565b8481811061281d5761281d614691565b905060200281019061282f9190614f27565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061286e9250505060208d018d614f27565b8581811061287e5761287e614691565b9050602002016020810190612893919061400f565b6112a36128a360408f018f614f27565b878181106128b3576128b3614691565b9050602002810190611e249190614f77565b60608501526128d760408b018b614f27565b838181106128e7576128e7614691565b90506020028101906128f99190614f77565b6129039080614f27565b60208601525060608401516129189088614747565b96508815612ada5761295261293060408c018c614f27565b8481811061294057612940614691565b905060200281019061177b9190614f77565b61295c9089614747565b97508015612ad5576129a361297460208c018c614f27565b8481811061298457612984614691565b9050602002016020810190612999919061400f565b8560200151613713565b846040018181516129b49190614747565b9052506000805b8560200151811015612a41576129d460408d018d614f27565b858181106129e4576129e4614691565b90506020028101906129f69190614f77565b612a049060e0810190614f27565b82818110612a1457612a14614691565b9050602002016020810190612a299190615162565b612a3957612a3682615540565b91505b6001016129bb565b50612a4f856020015161373d565b612a599089614747565b9750612abf612a6b60208d018d614f27565b85818110612a7b57612a7b614691565b9050602002016020810190612a90919061400f565b612a9d60408e018e614f27565b86818110612aad57612aad614691565b9050602002810190611f219190614f77565b85604001818151612ad09190614747565b905250505b612ca0565b60005b8460200151811015612c9e576000612b1d612afb60408e018e614f27565b86818110612b0b57612b0b614691565b90506020028101906116809190614f77565b5060405163596db71760e01b815263ffffffff821660048201529092506001600160a01b038716915063596db71790602401602060405180830381865afa158015612b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b90919061488c565b15801560808801819052612baa575063ffffffff81166002145b15612c1f57600a6000612bc060208f018f614f27565b87818110612bd057612bd0614691565b9050602002016020810190612be5919061400f565b6001600160401b03166001600160401b031681526020019081526020016000205486604001818151612c179190614747565b905250612c95565b856080015115612c9557600b6000612c3a60208f018f614f27565b87818110612c4a57612c4a614691565b9050602002016020810190612c5f919061400f565b6001600160401b03166001600160401b031681526020019081526020016000205486604001818151612c919190614747565b9052505b50600101612add565b505b80612cac576000612cec565b612cec89612cbd60208d018d614f27565b85818110612ccd57612ccd614691565b9050602002016020810190612ce2919061400f565b86602001516138f3565b84604001818151612cfd9190614747565b905250612d3f612d1060208c018c614f27565b84818110612d2057612d20614691565b9050602002016020810190612d35919061400f565b856040015161393f565b612d499087614747565b955050600101612779565b600080600080612d716000805160206159e28339815191526134de565b905084612f1b576000612d876113bf8880614f77565b5060405163596db71760e01b815263ffffffff82166004820152909250600091506001600160a01b0384169063596db71790602401602060405180830381865afa158015612dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfd919061488c565b905080158015612e13575063ffffffff82166002145b15612e9557612e417f0000000000000000000000000000000000000000000000000000000000000001613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166000908152600a6020526040902054612e84919061517f565b612e8e9086614747565b9450612f14565b8015612f1457612ec47f0000000000000000000000000000000000000000000000000000000000000001613a1e565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166000908152600b6020526040902054612f07919061517f565b612f119086614747565b94505b505061179f565b61179c6112eb6112cf8880614f77565b60608060008084806020019051810190612f459190615559565b905086868260200151604051602001612f60939291906155e5565b60408051601f19818403018152918152602083810192909252805188830281810184019092528881528892612fb6928c92918c9186918291908501908490808284376000920191909152508b9250613c33915050565b9350806001600160401b03811115612fd057612fd061402c565b604051908082528060200260200182016040528015612ff9578160200160208202803683370190505b509450600060405180604001604052806000198152602001888051906020012060405160200161302b91815260200190565b60408051601f1981840301815291815291525161304b919060200161485c565b6040516020818303038152906040529050896001600160401b03167f00000000000000000000000000000000000000000000000000000000000000016001600160401b0316146132485760005b828110156132465760007f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316630eff125d8c8c858181106130e3576130e3614691565b90506020020160208101906130f89190615635565b6040516001600160e01b031960e084901b16815260ff9091166004820152602401602060405180830381865afa158015613136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061315a91906146c7565b6001600160a01b031663ea98b1478d846000036131965787604051602001613182919061485c565b604051602081830303815290604052613198565b855b8a86815181106131aa576131aa614691565b60200260200101516040518463ffffffff1660e01b81526004016131d0939291906146e4565b602060405180830381865afa1580156131ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132119190614718565b905061321d8187614747565b95508088838151811061323257613232614691565b602090810291909101015250600101613098565b505b5050509450945094915050565b825160009081613266858786613c33565b905060008480602001905181019061327e9190615559565b9050868160200151604051602001613297929190615652565b604051602081830303815290604052816020018190525060006040518060400160405280600019815260200187805190602001206040516020016132dd91815260200190565b60408051601f198184030181529181529152516132fd919060200161485c565b6040516020818303038152906040529050866001600160401b03167f00000000000000000000000000000000000000000000000000000000000000016001600160401b0316146134d35760005b848110156134d15760007f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316630eff125d8b848151811061339557613395614691565b60200260200101516040518263ffffffff1660e01b81526004016133c2919060ff91909116815260200190565b602060405180830381865afa1580156133df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340391906146c7565b6001600160a01b031663ea98b1478a8460000361343f578660405160200161342b919061485c565b604051602081830303815290604052613441565b855b88868151811061345357613453614691565b60200260200101516040518463ffffffff1660e01b8152600401613479939291906146e4565b602060405180830381865afa158015613496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134ba9190614718565b90506134c68188614747565b96505060010161334a565b505b505050509392505050565b6040516321f8a72160e01b8152600481018290526000907f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316906321f8a72190602401602060405180830381865afa158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a91906146c7565b92915050565b60606000604051806101400160405280613588613e96565b815260200184600001518152602001846020015181526020018460400151815260200184606001518152602001846080015181526020018460c00151151581526020018460e00151151581526020018461010001516001600160a01b031681526020018461014001518152506040516020016136049190615710565b60408051601f19818403018152828201825260001983526020838101829052915190935061363392910161485c565b604051602081830303815290604052915050919050565b604080516001808252818301909252606091816020015b6040805160c0810182526060808252600060208084018290529383018190529082018190526080820181905260a0820152825260001990920191018161366157905050905081816000815181106136ba576136ba614691565b6020026020010181905250919050565b8051600090815b8181101561370c578381815181106136eb576136eb614691565b602002602001015160a00151836137029190614747565b92506001016136d1565b5050919050565b6001600160401b038216600090815260036020526040812054613736908361517f565b9392505050565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000001166000908152600960205260408120548190613782908461517f565b90506137ad7f0000000000000000000000000000000000000000000000000000000000000001613a1e565b613736908261517f565b6040805160018082528183019092526060916020808301908036833701905050905081816000815181106137ed576137ed614691565b91151560209283029190910190910152919050565b600080836001600160401b03167f00000000000000000000000000000000000000000000000000000000000000016001600160401b03160361384857600091505061356a565b825160005b818110156138885784818151811061386757613867614691565b6020026020010151156138805761387d83615540565b92505b60010161384d565b508160000361389c5760009250505061356a565b6001600160401b0385166000908152600260205260409020546109eb908361517f565b8060a081901c60c082901c60008190036138ec5760405163030042b760e01b815260040160405180910390fd5b9193909250565b60008084613919576001600160401b038416600090815260056020526040902054613933565b6001600160401b0384166000908152600460205260409020545b90506109eb838261517f565b60008061394b84613a1e565b613955908461517f565b90508060000361396957600091505061356a565b600061397485613f32565b61397e908361517f565b9050806000036139935760009250505061356a565b60006139be7f0000000000000000000000000000000000000000000000000000000000000001613f32565b9050806000036139e157604051634c8f99a760e11b815260040160405180910390fd5b613a0a7f0000000000000000000000000000000000000000000000000000000000000001613f32565b613a1490836157c2565b9695505050505050565b6001600160401b0381166000908152600160205260408120546001600160a01b03168015613af357806001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015613aa0575060408051601f3d908101601f19168201909252613a9d918101906157fe565b60015b15613af35760008413613ac65760405163119d4d6b60e11b815260040160405180910390fd5b81600003613ae7576040516376685d7f60e11b815260040160405180910390fd5b50919695505050505050565b50506001600160401b031660009081526007602052604090205490565b600081600003613b225750600061356a565b6000613b4d7f0000000000000000000000000000000000000000000000000000000000000001613f32565b613b57908461517f565b905080600003613b6b57600091505061356a565b6000613b7685613f32565b905080600003613b9957604051634c8f99a760e11b815260040160405180910390fd5b6109eb81836157c2565b60606000604051806101400160405280613bbb613e96565b815260200184600001518152602001846020015181526020018460400151815260200184606001518152602001846080015181526020018460c0015181526020018460e0015181526020018461010001516001600160a01b0316815260200184610140015181525060405160200161360491906158ce565b6060600082806020019051810190613c4b9190615559565b9050838160200151604051602001613c64929190615652565b60408051601f1981840301815291815260208381019290925285516001600160401b038816600090815260088452828120549251919390918391613caa9187910161485c565b60405160208183030381529060405251613cc4919061517f565b90506000613cd38360a061517f565b9050836001600160401b03811115613ced57613ced61402c565b604051908082528060200260200182016040528015613d2057816020015b6060815260200190600190039081613d0b5790505b50955060005b84811015613e8957600081600003613d3e5783613d40565b825b90507f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316630eff125d8b8481518110613d8357613d83614691565b60200260200101516040518263ffffffff1660e01b8152600401613db0919060ff91909116815260200190565b602060405180830381865afa158015613dcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613df191906146c7565b6001600160a01b03166325fc6dd0826040518263ffffffff1660e01b8152600401613e1e91815260200190565b600060405180830381865afa158015613e3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e639190810190614a26565b888381518110613e7557613e75614691565b602090810291909101015250600101613d26565b5050505050509392505050565b6000613ec17f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b6134de565b6001600160a01b03166313c02a596040518163ffffffff1660e01b8152600401602060405180830381865afa158015613efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f229190614718565b9050613f2d81615540565b905090565b6001600160401b0381166000908152602081905260408120546001600160a01b03168015613fda57806001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015613fb4575060408051601f3d908101601f19168201909252613fb1918101906157fe565b60015b15613fda5760008413613ac65760405163119d4d6b60e11b815260040160405180910390fd5b50506001600160401b031660009081526006602052604090205490565b6001600160401b038116811461400c57600080fd5b50565b60006020828403121561402157600080fd5b813561373681613ff7565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156140645761406461402c565b60405290565b60405161014081016001600160401b03811182821017156140645761406461402c565b60405161016081016001600160401b03811182821017156140645761406461402c565b604051601f8201601f191681016001600160401b03811182821017156140d8576140d861402c565b604052919050565b60006001600160401b038211156140f9576140f961402c565b5060051b60200190565b60ff8116811461400c57600080fd5b600082601f83011261412357600080fd5b81356020614138614133836140e0565b6140b0565b8083825260208201915060208460051b87010193508684111561415a57600080fd5b602086015b8481101561417f57803561417281614103565b835291830191830161415f565b509695505050505050565b60006001600160401b038211156141a3576141a361402c565b50601f01601f191660200190565b600082601f8301126141c257600080fd5b81356141d06141338261418a565b8181528460208386010111156141e557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561421857600080fd5b84356001600160401b038082111561422f57600080fd5b61423b88838901614112565b9550602091508187013561424e81613ff7565b945060408701358181111561426257600080fd5b61426e89828a016141b1565b94505060608701358181111561428357600080fd5b8701601f8101891361429457600080fd5b80356142a2614133826140e0565b81815260059190911b8201840190848101908b8311156142c157600080fd5b8584015b838110156142f9578035868111156142dd5760008081fd5b6142eb8e89838901016141b1565b8452509186019186016142c5565b50989b979a50959850505050505050565b60006040820184835260206040602085015281855180845260608601915060208701935060005b8181101561434d57845183529383019391830191600101614331565b5090979650505050505050565b6000806000806060858703121561437057600080fd5b843561437b81613ff7565b935060208501356001600160401b038082111561439757600080fd5b818701915087601f8301126143ab57600080fd5b8135818111156143ba57600080fd5b8860208260051b85010111156143cf57600080fd5b6020830195508094505060408701359150808211156143ed57600080fd5b506143fa878288016141b1565b91505092959194509250565b60005b83811015614421578181015183820152602001614409565b50506000910152565b60008151808452614442816020860160208601614406565b601f01601f19169290920160200192915050565b82815260406020820152600061120a604083018461442a565b801515811461400c57600080fd5b80356144888161446f565b919050565b6000806000606084860312156144a257600080fd5b83356144ad8161446f565b925060208401356001600160401b038111156144c857600080fd5b6144d486828701614112565b92505060408401356144e581613ff7565b809150509250925092565b6000808284036101a081121561450557600080fd5b833561451081613ff7565b9250610180601f198201121561452557600080fd5b506020830190509250929050565b602081526000613736602083018461442a565b60006020828403121561455857600080fd5b5035919050565b60006060828403121561457157600080fd5b50919050565b6000806040838503121561458a57600080fd5b82356001600160401b038111156145a057600080fd5b6145ac8582860161455f565b92505060208301356145bd8161446f565b809150509250929050565b60006020828403121561457157600080fd5b600080604083850312156145ed57600080fd5b82356001600160401b0381111561460357600080fd5b6145ac858286016145c8565b60008060006060848603121561462457600080fd5b833561462f81613ff7565b92506020840135915060408401356001600160401b0381111561465157600080fd5b6117a9868287016141b1565b60006020828403121561466f57600080fd5b81356001600160401b0381111561468557600080fd5b61120a848285016141b1565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461400c57600080fd5b8051614488816146a7565b6000602082840312156146d957600080fd5b8151613736816146a7565b6001600160401b0384168152606060208201526000614706606083018561442a565b8281036040840152613a14818561442a565b60006020828403121561472a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561356a5761356a614731565b60008151808452602080850194506020840160005b8381101561478b5781518752958201959082019060010161476f565b509495945050505050565b6000602080835283516040828501526147b2606085018261475a565b82860151601f198683038101604088015281518084529293509084019183850190600581901b8501860160005b8281101561480b57848783030184526147f982875161442a565b958801959388019391506001016147df565b509998505050505050505050565b6020815281516020820152600060208301516060604084015261483f608084018261475a565b90506040840151601f198483030160608501526109eb828261475a565b60208152815160208201526000602083015160408084015261120a606084018261442a565b80516144888161446f565b60006020828403121561489e57600080fd5b81516137368161446f565b8035614488816146a7565b6000602082840312156148c657600080fd5b8135613736816146a7565b6000602082840312156148e357600080fd5b815161373681614103565b6001600160401b03831681526101a0810161491c6020830161490f856148a9565b6001600160a01b03169052565b614928602084016148a9565b6001600160a01b0381166040840152506040830135606083015260608301356080830152608083013560a083015260a083013560c083015260c083013560e083015261010060e0840135818401526101208185013581850152610140915080850135828501525061016081850135818501528085013561018085015250509392505050565b600181811c908216806149c157607f821691505b60208210810361457157634e487b7160e01b600052602260045260246000fd5b600082601f8301126149f257600080fd5b8151614a006141338261418a565b818152846020838601011115614a1557600080fd5b61120a826020830160208701614406565b600060208284031215614a3857600080fd5b81516001600160401b03811115614a4e57600080fd5b61120a848285016149e1565b600082601f830112614a6b57600080fd5b81516020614a7b614133836140e0565b8083825260208201915060208460051b870101935086841115614a9d57600080fd5b602086015b8481101561417f5780518352918301918301614aa2565b600060c08284031215614acb57600080fd5b614ad3614042565b905081516001600160401b03811115614aeb57600080fd5b614af7848285016149e1565b8252506020820151614b08816146a7565b60208201526040820151614b1b816146a7565b60408201526060820151614b2e81614103565b60608201526080820151614b4181613ff7565b8060808301525060a082015160a082015292915050565b600082601f830112614b6957600080fd5b81516020614b79614133836140e0565b82815260059290921b84018101918181019086841115614b9857600080fd5b8286015b8481101561417f5780516001600160401b03811115614bbb5760008081fd5b614bc98986838b0101614ab9565b845250918301918301614b9c565b600082601f830112614be857600080fd5b81516020614bf8614133836140e0565b8083825260208201915060208460051b870101935086841115614c1a57600080fd5b602086015b8481101561417f578051614c328161446f565b8352918301918301614c1f565b600060208284031215614c5157600080fd5b81516001600160401b0380821115614c6857600080fd5b908301906101408286031215614c7d57600080fd5b614c8561406a565b82518152602083015182811115614c9b57600080fd5b614ca787828601614a5a565b602083015250604083015182811115614cbf57600080fd5b614ccb87828601614a5a565b604083015250606083015182811115614ce357600080fd5b614cef87828601614a5a565b606083015250608083015182811115614d0757600080fd5b614d1387828601614a5a565b60808301525060a083015182811115614d2b57600080fd5b614d3787828601614b58565b60a08301525060c083015182811115614d4f57600080fd5b614d5b87828601614bd7565b60c08301525060e083015182811115614d7357600080fd5b614d7f87828601614bd7565b60e083015250610100614d938185016146bc565b908201526101208381015183811115614dab57600080fd5b614db7888287016149e1565b918301919091525095945050505050565b600060208284031215614dda57600080fd5b81516001600160401b0380821115614df157600080fd5b908301906101408286031215614e0657600080fd5b614e0e61406a565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015182811115614e4c57600080fd5b614e5887828601614ab9565b60a083015250614e6a60c08401614881565b60c0820152614e7b60e08401614881565b60e0820152610100614d938185016146bc565b60006020808385031215614ea157600080fd5b82516001600160401b03811115614eb757600080fd5b8301601f81018513614ec857600080fd5b8051614ed6614133826140e0565b81815260059190911b82018301908381019087831115614ef557600080fd5b928401925b82841015614f1c578351614f0d81614103565b82529284019290840190614efa565b979650505050505050565b6000808335601e19843603018112614f3e57600080fd5b8301803591506001600160401b03821115614f5857600080fd5b6020019150600581901b3603821315614f7057600080fd5b9250929050565b6000823561015e19833603018112614f8e57600080fd5b9190910192915050565b600060c08284031215614faa57600080fd5b614fb2614042565b905081356001600160401b03811115614fca57600080fd5b614fd6848285016141b1565b8252506020820135614fe7816146a7565b60208201526040820135614ffa816146a7565b6040820152606082013561500d81614103565b6060820152608082013561502081613ff7565b8060808301525060a082013560a082015292915050565b6000610160823603121561504a57600080fd5b61505261408d565b8235815260208301356020820152604083013560408201526060830135606082015260808301356001600160401b038082111561508e57600080fd5b61509a36838701614f98565b608084015260a08501359150808211156150b357600080fd5b6150bf368387016141b1565b60a08401526150d060c0860161447d565b60c08401526150e160e0860161447d565b60e084015261010091506150f68286016148a9565b82840152610120915061510a8286016148a9565b828401526101409150818501358181111561512457600080fd5b615130368288016141b1565b8385015250505080915050919050565b6000823560be19833603018112614f8e57600080fd5b600061356a3683614f98565b60006020828403121561517457600080fd5b81356137368161446f565b808202811582820484141761356a5761356a614731565b60006151a4614133846140e0565b8381529050602080820190600585901b8401868111156151c357600080fd5b845b818110156134d35780356001600160401b038111156151e45760008081fd5b6151f089828901614f98565b8552509282019282016151c5565b6000613736368484615196565b601f821115615257576000816000526020600020601f850160051c810160208610156152345750805b601f850160051c820191505b8181101561525357828155600101615240565b5050505b505050565b81516001600160401b038111156152755761527561402c565b6152898161528384546149ad565b8461520b565b602080601f8311600181146152be57600084156152a65750858301515b600019600386901b1c1916600185901b178555615253565b600085815260208120601f198616915b828110156152ed578886015182559484019460019091019084016152ce565b508582101561530b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f83011261532c57600080fd5b8135602061533c614133836140e0565b8083825260208201915060208460051b87010193508684111561535e57600080fd5b602086015b8481101561417f5780358352918301918301615363565b600082601f83011261538b57600080fd5b61373683833560208501615196565b600082601f8301126153ab57600080fd5b813560206153bb614133836140e0565b8083825260208201915060208460051b8701019350868411156153dd57600080fd5b602086015b8481101561417f5780356153f58161446f565b83529183019183016153e2565b6000610160823603121561541557600080fd5b61541d61408d565b82356001600160401b038082111561543457600080fd5b6154403683870161531b565b8352602085013591508082111561545657600080fd5b6154623683870161531b565b6020840152604085013591508082111561547b57600080fd5b6154873683870161531b565b604084015260608501359150808211156154a057600080fd5b6154ac3683870161531b565b606084015260808501359150808211156154c557600080fd5b6154d13683870161537a565b608084015260a08501359150808211156154ea57600080fd5b6154f6368387016141b1565b60a084015260c085013591508082111561550f57600080fd5b61551b3683870161539a565b60c084015260e085013591508082111561553457600080fd5b6150e13683870161539a565b60006001820161555257615552614731565b5060010190565b60006020828403121561556b57600080fd5b81516001600160401b038082111561558257600080fd5b908301906040828603121561559657600080fd5b6040516040810181811083821117156155b1576155b161402c565b604052825181526020830151828111156155ca57600080fd5b6155d6878286016149e1565b60208301525095945050505050565b6040808252810183905260008460608301825b8681101561562257823561560b81614103565b60ff168252602092830192909101906001016155f8565b508381036020850152614f1c818661442a565b60006020828403121561564757600080fd5b813561373681614103565b604080825283519082018190526000906020906060840190828701845b8281101561568e57815160ff168452928401929084019060010161566f565b5050508381036020850152613a14818661442a565b6000815160c084526156b860c085018261442a565b9050602083015160018060a01b038082166020870152806040860151166040870152505060ff60608401511660608501526001600160401b03608084015116608085015260a083015160a08501528091505092915050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a08301516101408060c08501526157616101608501836156a3565b915060c085015161577660e086018215159052565b5060e085015161010061578c8187018315159052565b86015190506101206157a8868201836001600160a01b03169052565b860151858403601f1901838701529050613a14838261442a565b6000826157df57634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff8116811461448857600080fd5b600080600080600060a0868803121561581657600080fd5b61581f866157e4565b9450602086015193506040860151925060608601519150615842608087016157e4565b90509295509295909350565b60008282518085526020808601955060208260051b8401016020860160005b8481101561434d57601f198684030189526158898383516156a3565b9884019892509083019060010161586d565b60008151808452602080850194506020840160005b8381101561478b5781511515875295820195908201906001016158b0565b6020815281516020820152600060208301516101408060408501526158f761016085018361475a565b91506040850151601f1980868503016060870152615915848361475a565b93506060870151915080868503016080870152615932848361475a565b935060808701519150808685030160a087015261594f848361475a565b935060a08701519150808685030160c087015261596c848361584e565b935060c08701519150808685030160e0870152615989848361589b565b935060e087015191506101008187860301818801526159a8858461589b565b9450808801519250506101206159c8818801846001600160a01b03169052565b870151868503909101838701529050613a14838261442a56febcc180fb907e9ae431665de4bc74305c00b7b27442aadd477980ecc4bb14c011a2646970667358221220e0d3359aa9156db6b875d4d53b8cf0d016826547eb83155901095deda082992d64736f6c63430008170033

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

00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514

-----Decoded View---------------
Arg [0] : superRegistry_ (address): 0x17A332dC7B40aE701485023b219E9D6f493a2514

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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