FTM Price: $0.98 (-4.22%)
Gas: 355 GWei

Contract

0x7b2E3FC7510D1A51b3bef735F985446589219354
 

Multichain Info

Transaction Hash
Method
Block
From
To
Value
Execute784311602024-03-29 15:23:1316 mins ago1711725793IN
Interport: Action Executor
0.92547603 FTM0.27264299314.05924592
Execute784304442024-03-29 14:51:0048 mins ago1711723860IN
Interport: Action Executor
1.1226199 FTM0.04605474126.80549516
Execute784201092024-03-29 8:25:177 hrs ago1711700717IN
Interport: Action Executor
14.40175677 FTM0.0246508552.01019164
Execute784140862024-03-29 6:02:259 hrs ago1711692145IN
Interport: Action Executor
6.913351 FTM0.04899236110.95089832
Execute783888202024-03-28 21:02:3618 hrs ago1711659756IN
Interport: Action Executor
9.90387873 FTM0.0518065178.05829574
Execute783860262024-03-28 19:56:2519 hrs ago1711655785IN
Interport: Action Executor
15.29293665 FTM0.09816296102
Execute783816882024-03-28 18:27:4321 hrs ago1711650463IN
Interport: Action Executor
1.59823194 FTM0.03925128110.3556227
Execute783786152024-03-28 17:26:2422 hrs ago1711646784IN
Interport: Action Executor
16.03336161 FTM0.10003788120
Execute783750312024-03-28 16:15:2923 hrs ago1711642529IN
Interport: Action Executor
1.51976178 FTM0.04057173111.70878386
Execute783691662024-03-28 14:28:3025 hrs ago1711636110IN
Interport: Action Executor
5.96815471 FTM0.04327973118.16250039
Execute783655592024-03-28 13:21:4226 hrs ago1711632102IN
Interport: Action Executor
17.84137926 FTM0.05542667112
Execute783577232024-03-28 10:57:1728 hrs ago1711623437IN
Interport: Action Executor
1.34069843 FTM0.04133746113.90305078
Execute783533942024-03-28 9:27:5030 hrs ago1711618070IN
Interport: Action Executor
0.67217114 FTM0.03735558106.50383579
Execute783522032024-03-28 9:06:2630 hrs ago1711616786IN
Interport: Action Executor
63.84200662 FTM0.07430833109.27117594
Execute783473342024-03-28 7:26:2132 hrs ago1711610781IN
Interport: Action Executor
2.33356616 FTM0.0374793299
Execute783398332024-03-28 4:45:3934 hrs ago1711601139IN
Interport: Action Executor
1.73728329 FTM0.03960055112.10920034
Execute783388452024-03-28 4:23:0035 hrs ago1711599780IN
Interport: Action Executor
2.3849418 FTM0.04461687107.10611084
Execute783382962024-03-28 4:11:0135 hrs ago1711599061IN
Interport: Action Executor
2.60473242 FTM0.04345508112.6643272
Execute783243222024-03-27 23:45:3539 hrs ago1711583135IN
Interport: Action Executor
1.31099615 FTM0.04429792112.04708372
Execute783047842024-03-27 17:19:2046 hrs ago1711559960IN
Interport: Action Executor
2.56920579 FTM0.06106372126.62727374
Execute782924132024-03-27 13:44:252 days ago1711547065IN
Interport: Action Executor
0.7646165 FTM0.05324333146.96615436
Execute782845092024-03-27 11:14:112 days ago1711538051IN
Interport: Action Executor
101.4933 FTM0.08494044152.77470833
Execute782474382024-03-26 21:56:392 days ago1711490199IN
Interport: Action Executor
1.77348617 FTM0.0120650934.45280347
Execute782394292024-03-26 19:08:432 days ago1711480123IN
Interport: Action Executor
15.80321192 FTM0.0242868543.76696141
Execute782135472024-03-26 11:26:503 days ago1711452410IN
Interport: Action Executor
0.51615896 FTM0.019719449.92773339
View all transactions

Latest 25 internal transactions (View All)

Parent Txn Hash Block From To Value
784311602024-03-29 15:23:1316 mins ago1711725793
Interport: Action Executor
0.92547603 FTM
784304442024-03-29 14:51:0048 mins ago1711723860
Interport: Action Executor
1.1226199 FTM
784201092024-03-29 8:25:177 hrs ago1711700717
Interport: Action Executor
0.90175677 FTM
784201092024-03-29 8:25:177 hrs ago1711700717
Interport: Action Executor
13.5 FTM
784140862024-03-29 6:02:259 hrs ago1711692145
Interport: Action Executor
0.83848547 FTM
784140862024-03-29 6:02:259 hrs ago1711692145
Interport: Action Executor
6.07486553 FTM
783888202024-03-28 21:02:3618 hrs ago1711659756
Interport: Action Executor
0.90387873 FTM
783888202024-03-28 21:02:3618 hrs ago1711659756
Interport: Action Executor
9 FTM
783860262024-03-28 19:56:2519 hrs ago1711655785
Interport: Action Executor
2.29293665 FTM
783860262024-03-28 19:56:2519 hrs ago1711655785
Interport: Action Executor
13 FTM
783822502024-03-28 18:39:2421 hrs ago1711651164
Interport: Action Executor
4.27902356 FTM
783822502024-03-28 18:39:2421 hrs ago1711651164
Interport: Action Executor
4.27902356 FTM
783816882024-03-28 18:27:4321 hrs ago1711650463
Interport: Action Executor
1.59823194 FTM
783786152024-03-28 17:26:2422 hrs ago1711646784
Interport: Action Executor
1.03336161 FTM
783786152024-03-28 17:26:2422 hrs ago1711646784
Interport: Action Executor
15 FTM
783770062024-03-28 16:55:0322 hrs ago1711644903
Interport: Action Executor
4.22534125 FTM
783770062024-03-28 16:55:0322 hrs ago1711644903
Interport: Action Executor
4.22534125 FTM
783750312024-03-28 16:15:2923 hrs ago1711642529
Interport: Action Executor
1.51976178 FTM
783729652024-03-28 15:35:0324 hrs ago1711640103
Interport: Action Executor
4.23173437 FTM
783729652024-03-28 15:35:0324 hrs ago1711640103
Interport: Action Executor
4.23173437 FTM
783719802024-03-28 15:16:1824 hrs ago1711638978
Interport: Action Executor
108.80689363 FTM
783719802024-03-28 15:16:1824 hrs ago1711638978
Interport: Action Executor
108.80689363 FTM
783691662024-03-28 14:28:3025 hrs ago1711636110
Interport: Action Executor
5.96815471 FTM
783660002024-03-28 13:30:2326 hrs ago1711632623
Interport: Action Executor
11.09 FTM
783660002024-03-28 13:30:2326 hrs ago1711632623
Interport: Action Executor
11.09 FTM
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ActionExecutor

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 28 : ActionExecutor.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { ReentrancyGuard } from '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import { IActionDataStructures } from './interfaces/IActionDataStructures.sol';
import { IGateway } from './crosschain/interfaces/IGateway.sol';
import { IGatewayClient } from './crosschain/interfaces/IGatewayClient.sol';
import { IRegistry } from './interfaces/IRegistry.sol';
import { ISettings } from './interfaces/ISettings.sol';
import { ITokenMint } from './interfaces/ITokenMint.sol';
import { IVariableBalanceRecords } from './interfaces/IVariableBalanceRecords.sol';
import { IVault } from './interfaces/IVault.sol';
import { BalanceManagement } from './BalanceManagement.sol';
import { CallerGuard } from './CallerGuard.sol';
import { Pausable } from './Pausable.sol';
import { SystemVersionId } from './SystemVersionId.sol';
import { TokenMintError, ZeroAddressError } from './Errors.sol';
import './helpers/AddressHelper.sol' as AddressHelper;
import './helpers/DecimalsHelper.sol' as DecimalsHelper;
import './helpers/GasReserveHelper.sol' as GasReserveHelper;
import './helpers/RefundHelper.sol' as RefundHelper;
import './helpers/TransferHelper.sol' as TransferHelper;
import './Constants.sol' as Constants;

/**
 * @title ActionExecutor
 * @notice The main contract for cross-chain swaps
 */
contract ActionExecutor is
    SystemVersionId,
    Pausable,
    ReentrancyGuard,
    CallerGuard,
    BalanceManagement,
    IGatewayClient,
    ISettings,
    IActionDataStructures
{
    /**
     * @dev The contract for action settings
     */
    IRegistry public registry;

    /**
     * @dev The contract for variable balance storage
     */
    IVariableBalanceRecords public variableBalanceRecords;

    uint256 private lastActionId = block.chainid * 1e7 + 555 ** 2;

    /**
     * @notice Emitted when source chain action is performed
     * @param actionId The ID of the action
     * @param targetChainId The ID of the target chain
     * @param sourceSender The address of the user on the source chain
     * @param targetRecipient The address of the recipient on the target chain
     * @param gatewayType The type of cross-chain gateway
     * @param sourceToken The address of the input token on the source chain
     * @param targetToken The address of the output token on the target chain
     * @param amount The amount of the vault asset used for the action, with decimals set to 18
     * @param fee The fee amount, measured in vault asset with decimals set to 18
     * @param timestamp The timestamp of the action (in seconds)
     */
    event ActionSource(
        uint256 indexed actionId,
        uint256 indexed targetChainId,
        address indexed sourceSender,
        address targetRecipient,
        uint256 gatewayType,
        address sourceToken,
        address targetToken,
        uint256 amount,
        uint256 fee,
        uint256 timestamp
    );

    /**
     * @notice Emitted when target chain action is performed
     * @param actionId The ID of the action
     * @param sourceChainId The ID of the source chain
     * @param isSuccess The status of the action execution
     * @param timestamp The timestamp of the action (in seconds)
     */
    event ActionTarget(
        uint256 indexed actionId,
        uint256 indexed sourceChainId,
        bool indexed isSuccess,
        uint256 timestamp
    );

    /**
     * @notice Emitted when single-chain action is performed
     * @param actionId The ID of the action
     * @param sender The address of the user
     * @param recipient The address of the recipient
     * @param fromToken The address of the input token
     * @param toToken The address of the output token
     * @param fromAmount The input token amount
     * @param toAmount The output token amount
     * @param toTokenFee The fee amount, measured in the output token
     * @param timestamp The timestamp of the action (in seconds)
     */
    event ActionLocal(
        uint256 indexed actionId,
        address indexed sender,
        address recipient,
        address fromToken,
        address toToken,
        uint256 fromAmount,
        uint256 toAmount,
        uint256 toTokenFee,
        uint256 timestamp
    );

    /**
     * @notice Emitted for source chain and single-chain actions when user's funds processing is completed
     * @param actionId The ID of the action
     * @param isLocal The action type flag, is true for single-chain actions
     * @param sender The address of the user
     * @param routerType The type of the swap router
     * @param fromTokenAddress The address of the swap input token
     * @param toTokenAddress The address of the swap output token
     * @param fromAmount The input token amount
     * @param resultAmount The swap result token amount
     */
    event SourceProcessed(
        uint256 indexed actionId,
        bool indexed isLocal,
        address indexed sender,
        uint256 routerType,
        address fromTokenAddress,
        address toTokenAddress,
        uint256 fromAmount,
        uint256 resultAmount
    );

    /**
     * @notice Emitted for target chain actions when the user's funds processing is completed
     * @param actionId The ID of the action
     * @param recipient The address of the recipient
     * @param routerType The type of the swap router
     * @param fromTokenAddress The address of the swap input token
     * @param toTokenAddress The address of the swap output token
     * @param fromAmount The input token amount
     * @param resultAmount The swap result token amount
     */
    event TargetProcessed(
        uint256 indexed actionId,
        address indexed recipient,
        uint256 routerType,
        address fromTokenAddress,
        address toTokenAddress,
        uint256 fromAmount,
        uint256 resultAmount
    );

    /**
     * @notice Emitted when the variable balance is allocated on the target chain
     * @param actionId The ID of the action
     * @param recipient The address of the variable balance recipient
     * @param vaultType The type of the corresponding vault
     * @param amount The allocated variable balance amount
     */
    event VariableBalanceAllocated(
        uint256 indexed actionId,
        address indexed recipient,
        uint256 vaultType,
        uint256 amount
    );

    /**
     * @notice Emitted when the Registry contract address is updated
     * @param registryAddress The address of the Registry contract
     */
    event SetRegistry(address indexed registryAddress);

    /**
     * @notice Emitted when the VariableBalanceRecords contract address is updated
     * @param recordsAddress The address of the VariableBalanceRecords contract
     */
    event SetVariableBalanceRecords(address indexed recordsAddress);

    /**
     * @notice Emitted when the caller is not a registered cross-chain gateway
     */
    error OnlyGatewayError();

    /**
     * @notice Emitted when the call is not from the current contract
     */
    error OnlySelfError();

    /**
     * @notice Emitted when a cross-chain swap is attempted with the target chain ID matching the current chain
     */
    error SameChainIdError();

    /**
     * @notice Emitted when a single-chain swap is attempted with the same token as input and output
     */
    error SameTokenError();

    /**
     * @notice Emitted when the native token value of the transaction does not correspond to the swap amount
     */
    error NativeTokenValueError();

    /**
     * @notice Emitted when the requested cross-chain gateway type is not set
     */
    error GatewayNotSetError();

    /**
     * @notice Emitted when the requested swap router type is not set
     */
    error RouterNotSetError();

    /**
     * @notice Emitted when the requested vault type is not set
     */
    error VaultNotSetError();

    /**
     * @notice Emitted when the provided call value is not sufficient for the cross-chain message sending
     */
    error MessageFeeError();

    /**
     * @notice Emitted when the swap amount is greater than the allowed maximum
     */
    error SwapAmountMaxError();

    /**
     * @notice Emitted when the swap amount is less than the allowed minimum
     */
    error SwapAmountMinError();

    /**
     * @notice Emitted when the swap process results in an error
     */
    error SwapError();

    /**
     * @notice Emitted when there is no matching target swap info option
     */
    error TargetSwapInfoError();

    /**
     * @dev Modifier to check if the caller is a registered cross-chain gateway
     */
    modifier onlyGateway() {
        if (!registry.isGatewayAddress(msg.sender)) {
            revert OnlyGatewayError();
        }

        _;
    }

    /**
     * @dev Modifier to check if the caller is the current contract
     */
    modifier onlySelf() {
        if (msg.sender != address(this)) {
            revert OnlySelfError();
        }

        _;
    }

    /**
     * @notice Deploys the ActionExecutor contract
     * @param _registry The address of the action settings registry contract
     * @param _variableBalanceRecords The address of the variable balance records contract
     * @param _actionIdOffset The initial offset of the action ID value
     * @param _owner The address of the initial owner of the contract
     * @param _managers The addresses of initial managers of the contract
     * @param _addOwnerToManagers The flag to optionally add the owner to the list of managers
     */
    constructor(
        IRegistry _registry,
        IVariableBalanceRecords _variableBalanceRecords,
        uint256 _actionIdOffset,
        address _owner,
        address[] memory _managers,
        bool _addOwnerToManagers
    ) {
        _setRegistry(_registry);
        _setVariableBalanceRecords(_variableBalanceRecords);

        lastActionId += _actionIdOffset;

        _initRoles(_owner, _managers, _addOwnerToManagers);
    }

    /**
     * @notice The standard "receive" function
     * @dev Is payable to allow receiving native token funds from a target swap router
     */
    receive() external payable {}

    /**
     * @notice Sets the address of the action settings registry contract
     * @param _registry The address of the action settings registry contract
     */
    function setRegistry(IRegistry _registry) external onlyManager {
        _setRegistry(_registry);
    }

    /**
     * @notice Executes a single-chain action
     * @param _localAction The parameters of the action
     */
    function executeLocal(
        LocalAction calldata _localAction
    ) external payable whenNotPaused nonReentrant checkCaller returns (uint256 actionId) {
        if (_localAction.fromTokenAddress == _localAction.toTokenAddress) {
            revert SameTokenError();
        }

        // For single-chain swaps of the native token,
        // the value of the transaction should be equal to the swap amount
        if (
            _localAction.fromTokenAddress == Constants.NATIVE_TOKEN_ADDRESS &&
            msg.value != _localAction.swapInfo.fromAmount
        ) {
            revert NativeTokenValueError();
        }

        uint256 initialBalance = address(this).balance - msg.value;

        lastActionId++;
        actionId = lastActionId;

        LocalSettings memory settings = registry.localSettings(
            msg.sender,
            _localAction.swapInfo.routerType
        );

        (uint256 processedAmount, ) = _processSource(
            actionId,
            true,
            _localAction.fromTokenAddress,
            _localAction.toTokenAddress,
            _localAction.swapInfo,
            settings.router,
            settings.routerTransfer
        );

        address recipient = _localAction.recipient == address(0)
            ? msg.sender
            : _localAction.recipient;

        uint256 recipientAmount = _calculateLocalAmount(
            processedAmount,
            true,
            settings.systemFeeLocal,
            settings.isWhitelist
        );

        if (_localAction.toTokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
            TransferHelper.safeTransferNative(recipient, recipientAmount);
        } else {
            TransferHelper.safeTransfer(_localAction.toTokenAddress, recipient, recipientAmount);
        }

        // - - - System fee transfer - - -

        uint256 systemFeeAmount = processedAmount - recipientAmount;

        if (systemFeeAmount > 0) {
            address feeCollector = settings.feeCollectorLocal;

            if (feeCollector != address(0)) {
                if (_localAction.toTokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
                    TransferHelper.safeTransferNative(feeCollector, systemFeeAmount);
                } else {
                    TransferHelper.safeTransfer(
                        _localAction.toTokenAddress,
                        feeCollector,
                        systemFeeAmount
                    );
                }
            } else if (_localAction.toTokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
                initialBalance += systemFeeAmount; // Keep at the contract address
            }
        }

        // - - -

        // - - - Extra balance transfer - - -

        RefundHelper.refundExtraBalance(address(this), initialBalance, payable(msg.sender));

        // - - -

        emit ActionLocal(
            actionId,
            msg.sender,
            recipient,
            _localAction.fromTokenAddress,
            _localAction.toTokenAddress,
            _localAction.swapInfo.fromAmount,
            recipientAmount,
            systemFeeAmount,
            block.timestamp
        );
    }

    /**
     * @notice Executes a cross-chain action
     * @param _action The parameters of the action
     */
    function execute(
        Action calldata _action
    ) external payable whenNotPaused nonReentrant checkCaller returns (uint256 actionId) {
        if (_action.targetChainId == block.chainid) {
            revert SameChainIdError();
        }

        // For cross-chain swaps of the native token,
        // the value of the transaction should be greater or equal to the swap amount
        if (
            _action.sourceTokenAddress == Constants.NATIVE_TOKEN_ADDRESS &&
            msg.value < _action.sourceSwapInfo.fromAmount
        ) {
            revert NativeTokenValueError();
        }

        uint256 initialBalance = address(this).balance - msg.value;

        lastActionId++;
        actionId = lastActionId;

        SourceSettings memory settings = registry.sourceSettings(
            msg.sender,
            _action.targetChainId,
            _action.gatewayType,
            _action.sourceSwapInfo.routerType,
            _action.vaultType
        );

        if (settings.vault == address(0)) {
            revert VaultNotSetError();
        }

        address vaultAsset = IVault(settings.vault).asset();

        (uint256 processedAmount, uint256 nativeTokenSpent) = _processSource(
            actionId,
            false,
            _action.sourceTokenAddress,
            vaultAsset,
            _action.sourceSwapInfo,
            settings.router,
            settings.routerTransfer
        );

        uint256 targetVaultAmountMax = _calculateVaultAmount(
            settings.sourceVaultDecimals,
            settings.targetVaultDecimals,
            processedAmount,
            true,
            settings.systemFee,
            settings.isWhitelist
        );

        SwapInfo memory targetSwapInfo;

        uint256 targetOptionsLength = _action.targetSwapInfoOptions.length;

        if (targetOptionsLength == 0) {
            targetSwapInfo = SwapInfo({
                fromAmount: targetVaultAmountMax,
                routerType: uint256(0),
                routerData: new bytes(0)
            });
        } else {
            for (uint256 index; index < targetOptionsLength; index++) {
                SwapInfo memory targetSwapInfoOption = _action.targetSwapInfoOptions[index];

                if (targetSwapInfoOption.fromAmount <= targetVaultAmountMax) {
                    targetSwapInfo = targetSwapInfoOption;

                    break;
                }
            }

            if (targetSwapInfo.fromAmount == 0) {
                revert TargetSwapInfoError();
            }
        }

        uint256 sourceVaultAmount = DecimalsHelper.convertDecimals(
            settings.targetVaultDecimals,
            settings.sourceVaultDecimals,
            targetSwapInfo.fromAmount
        );

        uint256 normalizedAmount = DecimalsHelper.convertDecimals(
            settings.sourceVaultDecimals,
            Constants.DECIMALS_DEFAULT,
            sourceVaultAmount
        );

        if (!settings.isWhitelist) {
            _checkSwapAmountLimits(
                normalizedAmount,
                settings.swapAmountMin,
                settings.swapAmountMax
            );
        }

        // - - - Transfer to vault - - -

        TransferHelper.safeTransfer(vaultAsset, settings.vault, sourceVaultAmount);

        // - - -

        bytes memory targetMessageData = abi.encode(
            TargetMessage({
                actionId: actionId,
                sourceSender: msg.sender,
                vaultType: _action.vaultType,
                targetTokenAddress: _action.targetTokenAddress,
                targetSwapInfo: targetSwapInfo,
                targetRecipient: _action.targetRecipient == address(0)
                    ? msg.sender
                    : _action.targetRecipient
            })
        );

        _sendMessage(settings, _action, targetMessageData, msg.value - nativeTokenSpent);

        // - - - System fee transfer - - -

        uint256 systemFeeAmount = processedAmount - sourceVaultAmount;

        if (systemFeeAmount > 0 && settings.feeCollector != address(0)) {
            TransferHelper.safeTransfer(vaultAsset, settings.feeCollector, systemFeeAmount);
        }

        // - - -

        // - - - Extra balance transfer - - -

        RefundHelper.refundExtraBalance(address(this), initialBalance, payable(msg.sender));

        // - - -

        _emitActionSourceEvent(
            actionId,
            _action,
            normalizedAmount,
            DecimalsHelper.convertDecimals(
                settings.sourceVaultDecimals,
                Constants.DECIMALS_DEFAULT,
                systemFeeAmount
            )
        );
    }

    /**
     * @notice Variable token claim by user's variable balance
     * @param _vaultType The type of the variable balance vault
     */
    function claimVariableToken(
        uint256 _vaultType
    ) external whenNotPaused nonReentrant checkCaller {
        _processVariableBalanceRepayment(_vaultType, false);
    }

    /**
     * @notice Vault asset claim by user's variable balance
     * @param _vaultType The type of the variable balance vault
     */
    function convertVariableBalanceToVaultAsset(
        uint256 _vaultType
    ) external whenNotPaused nonReentrant checkCaller {
        _processVariableBalanceRepayment(_vaultType, true);
    }

    /**
     * @notice Cross-chain message fee estimation
     * @param _gatewayType The type of the cross-chain gateway
     * @param _targetChainId The ID of the target chain
     * @param _targetRouterDataOptions The array of transaction data options for the target chain
     * @param _gatewaySettings The settings specific to the selected cross-chain gateway
     */
    function messageFeeEstimate(
        uint256 _gatewayType,
        uint256 _targetChainId,
        bytes[] calldata _targetRouterDataOptions,
        bytes calldata _gatewaySettings
    ) external view returns (uint256) {
        if (_targetChainId == block.chainid) {
            return 0;
        }

        MessageFeeEstimateSettings memory settings = registry.messageFeeEstimateSettings(
            _gatewayType
        );

        if (settings.gateway == address(0)) {
            revert GatewayNotSetError();
        }

        uint256 result = 0;

        if (_targetRouterDataOptions.length == 0) {
            result = IGateway(settings.gateway).messageFee(
                _targetChainId,
                _blankMessage(new bytes(0)),
                _gatewaySettings
            );
        } else {
            for (uint256 index; index < _targetRouterDataOptions.length; index++) {
                bytes memory messageData = _blankMessage(_targetRouterDataOptions[index]);

                uint256 value = IGateway(settings.gateway).messageFee(
                    _targetChainId,
                    messageData,
                    _gatewaySettings
                );

                if (value > result) {
                    result = value;
                }
            }
        }

        return result;
    }

    /**
     * @notice Swap result amount for single-chain actions, taking the system fee into account
     * @param _fromAmount The amount before the calculation
     * @param _isForward The direction of the calculation
     */
    function calculateLocalAmount(
        uint256 _fromAmount,
        bool _isForward
    ) external view returns (uint256 result) {
        LocalAmountCalculationSettings memory settings = registry.localAmountCalculationSettings(
            msg.sender
        );

        return
            _calculateLocalAmount(
                _fromAmount,
                _isForward,
                settings.systemFeeLocal,
                settings.isWhitelist
            );
    }

    /**
     * @notice Swap result amount for cross-chain actions, taking the system fee into account
     * @param _vaultType The type of the vault
     * @param _fromChainId The ID of the source chain
     * @param _toChainId The ID of the target chain
     * @param _fromAmount The amount before the calculation
     * @param _isForward The direction of the calculation
     */
    function calculateVaultAmount(
        uint256 _vaultType,
        uint256 _fromChainId,
        uint256 _toChainId,
        uint256 _fromAmount,
        bool _isForward
    ) external view returns (uint256 result) {
        VaultAmountCalculationSettings memory settings = registry.vaultAmountCalculationSettings(
            msg.sender,
            _vaultType,
            _fromChainId,
            _toChainId
        );

        return
            _calculateVaultAmount(
                settings.fromDecimals,
                settings.toDecimals,
                _fromAmount,
                _isForward,
                settings.systemFee,
                settings.isWhitelist
            );
    }

    /**
     * @notice The variable balance of the account
     * @param _account The address of the variable balance owner
     * @param _vaultType The type of the vault
     */
    function variableBalance(address _account, uint256 _vaultType) external view returns (uint256) {
        return variableBalanceRecords.getAccountBalance(_account, _vaultType);
    }

    /**
     * @notice Cross-chain message handler on the target chain
     * @dev The function is called by cross-chain gateways
     * @param _messageSourceChainId The ID of the message source chain
     * @param _payloadData The content of the cross-chain message
     */
    function handleExecutionPayload(
        uint256 _messageSourceChainId,
        bytes calldata _payloadData
    ) external whenNotPaused onlyGateway {
        TargetMessage memory targetMessage = abi.decode(_payloadData, (TargetMessage));

        TargetSettings memory settings = registry.targetSettings(
            targetMessage.vaultType,
            targetMessage.targetSwapInfo.routerType
        );

        bool selfCallSuccess;

        (bool hasGasReserve, uint256 gasAllowed) = GasReserveHelper.checkGasReserve(
            settings.gasReserve
        );

        if (hasGasReserve) {
            try this.selfCallTarget{ gas: gasAllowed }(settings, targetMessage) {
                selfCallSuccess = true;
            } catch {}
        }

        if (!selfCallSuccess) {
            _targetAllocateVariableBalance(targetMessage);
        }

        emit ActionTarget(
            targetMessage.actionId,
            _messageSourceChainId,
            selfCallSuccess,
            block.timestamp
        );
    }

    /**
     * @notice Controllable processing of the target chain logic
     * @dev Is called by the current contract to enable error handling
     * @param _settings Target action settings
     * @param _targetMessage The content of the cross-chain message
     */
    function selfCallTarget(
        TargetSettings calldata _settings,
        TargetMessage calldata _targetMessage
    ) external onlySelf {
        if (_settings.vault == address(0)) {
            revert VaultNotSetError();
        }

        // - - - Transfer from vault - - -

        address assetAddress = IVault(_settings.vault).requestAsset(
            _targetMessage.targetSwapInfo.fromAmount,
            address(this),
            false
        );

        // - - -

        _processTarget(
            _settings,
            _targetMessage.actionId,
            assetAddress,
            _targetMessage.targetTokenAddress,
            _targetMessage.targetSwapInfo,
            _targetMessage.targetRecipient
        );
    }

    function _processSource(
        uint256 _actionId,
        bool _isLocal,
        address _fromTokenAddress,
        address _toTokenAddress,
        SwapInfo memory _sourceSwapInfo,
        address _routerAddress,
        address _routerTransferAddress
    ) private returns (uint256 resultAmount, uint256 nativeTokenSpent) {
        uint256 toTokenBalanceBefore = tokenBalance(_toTokenAddress);

        if (_fromTokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
            if (_routerAddress == address(0)) {
                revert RouterNotSetError();
            }

            // - - - Source swap (native token) - - -

            (bool routerCallSuccess, ) = payable(_routerAddress).call{
                value: _sourceSwapInfo.fromAmount
            }(_sourceSwapInfo.routerData);

            if (!routerCallSuccess) {
                revert SwapError();
            }

            // - - -

            nativeTokenSpent = _sourceSwapInfo.fromAmount;
        } else {
            TransferHelper.safeTransferFrom(
                _fromTokenAddress,
                msg.sender,
                address(this),
                _sourceSwapInfo.fromAmount
            );

            if (_fromTokenAddress != _toTokenAddress) {
                if (_routerAddress == address(0)) {
                    revert RouterNotSetError();
                }

                // - - - Source swap (non-native token) - - -

                TransferHelper.safeApprove(
                    _fromTokenAddress,
                    _routerTransferAddress,
                    _sourceSwapInfo.fromAmount
                );

                (bool routerCallSuccess, ) = _routerAddress.call(_sourceSwapInfo.routerData);

                if (!routerCallSuccess) {
                    revert SwapError();
                }

                TransferHelper.safeApprove(_fromTokenAddress, _routerTransferAddress, 0);

                // - - -
            }

            nativeTokenSpent = 0;
        }

        resultAmount = tokenBalance(_toTokenAddress) - toTokenBalanceBefore;

        emit SourceProcessed(
            _actionId,
            _isLocal,
            msg.sender,
            _sourceSwapInfo.routerType,
            _fromTokenAddress,
            _toTokenAddress,
            _sourceSwapInfo.fromAmount,
            resultAmount
        );
    }

    function _processTarget(
        TargetSettings memory settings,
        uint256 _actionId,
        address _fromTokenAddress,
        address _toTokenAddress,
        SwapInfo memory _targetSwapInfo,
        address _targetRecipient
    ) private {
        uint256 resultAmount;

        if (_toTokenAddress == _fromTokenAddress) {
            resultAmount = _targetSwapInfo.fromAmount;
        } else {
            if (settings.router == address(0)) {
                revert RouterNotSetError();
            }

            uint256 toTokenBalanceBefore = tokenBalance(_toTokenAddress);

            // - - - Target swap - - -

            TransferHelper.safeApprove(
                _fromTokenAddress,
                settings.routerTransfer,
                _targetSwapInfo.fromAmount
            );

            (bool success, ) = settings.router.call(_targetSwapInfo.routerData);

            if (!success) {
                revert SwapError();
            }

            TransferHelper.safeApprove(_fromTokenAddress, settings.routerTransfer, 0);

            // - - -

            resultAmount = tokenBalance(_toTokenAddress) - toTokenBalanceBefore;
        }

        if (_toTokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
            TransferHelper.safeTransferNative(_targetRecipient, resultAmount);
        } else {
            TransferHelper.safeTransfer(_toTokenAddress, _targetRecipient, resultAmount);
        }

        emit TargetProcessed(
            _actionId,
            _targetRecipient,
            _targetSwapInfo.routerType,
            _fromTokenAddress,
            _toTokenAddress,
            _targetSwapInfo.fromAmount,
            resultAmount
        );
    }

    function _targetAllocateVariableBalance(TargetMessage memory _targetMessage) private {
        address tokenRecipient = _targetMessage.targetRecipient;
        uint256 vaultType = _targetMessage.vaultType;
        uint256 tokenAmount = _targetMessage.targetSwapInfo.fromAmount;

        variableBalanceRecords.increaseBalance(tokenRecipient, vaultType, tokenAmount);

        emit VariableBalanceAllocated(
            _targetMessage.actionId,
            tokenRecipient,
            vaultType,
            tokenAmount
        );
    }

    function _processVariableBalanceRepayment(
        uint256 _vaultType,
        bool _convertToVaultAsset
    ) private {
        VariableBalanceRepaymentSettings memory settings = registry
            .variableBalanceRepaymentSettings(_vaultType);

        if (settings.vault == address(0)) {
            revert VaultNotSetError();
        }

        uint256 tokenAmount = variableBalanceRecords.getAccountBalance(msg.sender, _vaultType);

        variableBalanceRecords.clearBalance(msg.sender, _vaultType);

        if (tokenAmount > 0) {
            if (_convertToVaultAsset) {
                IVault(settings.vault).requestAsset(tokenAmount, msg.sender, true);
            } else {
                address variableTokenAddress = IVault(settings.vault).checkVariableTokenState();

                bool mintSuccess = ITokenMint(variableTokenAddress).mint(msg.sender, tokenAmount);

                if (!mintSuccess) {
                    revert TokenMintError();
                }
            }
        }
    }

    function _setRegistry(IRegistry _registry) private {
        AddressHelper.requireContract(address(_registry));

        registry = _registry;

        emit SetRegistry(address(_registry));
    }

    function _setVariableBalanceRecords(IVariableBalanceRecords _variableBalanceRecords) private {
        AddressHelper.requireContract(address(_variableBalanceRecords));

        variableBalanceRecords = _variableBalanceRecords;

        emit SetVariableBalanceRecords(address(_variableBalanceRecords));
    }

    function _sendMessage(
        SourceSettings memory settings,
        Action calldata _action,
        bytes memory _messageData,
        uint256 _availableValue
    ) private {
        if (settings.gateway == address(0)) {
            revert GatewayNotSetError();
        }

        uint256 messageFee = IGateway(settings.gateway).messageFee(
            _action.targetChainId,
            _messageData,
            _action.gatewaySettings
        );

        if (_availableValue < messageFee) {
            revert MessageFeeError();
        }

        IGateway(settings.gateway).sendMessage{ value: messageFee }(
            _action.targetChainId,
            _messageData,
            _action.gatewaySettings
        );
    }

    function _emitActionSourceEvent(
        uint256 _actionId,
        Action calldata _action,
        uint256 _amount,
        uint256 _fee
    ) private {
        emit ActionSource(
            _actionId,
            _action.targetChainId,
            msg.sender,
            _action.targetRecipient,
            _action.gatewayType,
            _action.sourceTokenAddress,
            _action.targetTokenAddress,
            _amount,
            _fee,
            block.timestamp
        );
    }

    function _checkSwapAmountLimits(
        uint256 _normalizedAmount,
        uint256 _swapAmountMin,
        uint256 _swapAmountMax
    ) private pure {
        if (_normalizedAmount < _swapAmountMin) {
            revert SwapAmountMinError();
        }

        if (_normalizedAmount > _swapAmountMax) {
            revert SwapAmountMaxError();
        }
    }

    function _calculateLocalAmount(
        uint256 _fromAmount,
        bool _isForward,
        uint256 _systemFeeLocal,
        bool _isWhitelist
    ) private pure returns (uint256 result) {
        if (_isWhitelist || _systemFeeLocal == 0) {
            return _fromAmount;
        }

        return
            _isForward
                ? (_fromAmount * (Constants.MILLIPERCENT_FACTOR - _systemFeeLocal)) /
                    Constants.MILLIPERCENT_FACTOR
                : (_fromAmount * Constants.MILLIPERCENT_FACTOR) /
                    (Constants.MILLIPERCENT_FACTOR - _systemFeeLocal);
    }

    function _calculateVaultAmount(
        uint256 _fromDecimals,
        uint256 _toDecimals,
        uint256 _fromAmount,
        bool _isForward,
        uint256 _systemFee,
        bool _isWhitelist
    ) private pure returns (uint256 result) {
        bool isZeroFee = _isWhitelist || _systemFee == 0;

        uint256 amountToConvert = (!_isForward || isZeroFee)
            ? _fromAmount
            : (_fromAmount * (Constants.MILLIPERCENT_FACTOR - _systemFee)) /
                Constants.MILLIPERCENT_FACTOR;

        uint256 convertedAmount = DecimalsHelper.convertDecimals(
            _fromDecimals,
            _toDecimals,
            amountToConvert
        );

        result = (_isForward || isZeroFee)
            ? convertedAmount
            : (convertedAmount * Constants.MILLIPERCENT_FACTOR) /
                (Constants.MILLIPERCENT_FACTOR - _systemFee);
    }

    function _blankMessage(bytes memory _targetRouterData) private pure returns (bytes memory) {
        bytes memory messageData = abi.encode(
            TargetMessage({
                actionId: uint256(0),
                sourceSender: address(0),
                vaultType: uint256(0),
                targetTokenAddress: address(0),
                targetSwapInfo: SwapInfo({
                    fromAmount: uint256(0),
                    routerType: uint256(0),
                    routerData: _targetRouterData
                }),
                targetRecipient: address(0)
            })
        );

        return messageData;
    }
}

File 2 of 28 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

File 4 of 28 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 6 of 28 : BalanceManagement.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { ITokenBalance } from './interfaces/ITokenBalance.sol';
import { ManagerRole } from './roles/ManagerRole.sol';
import './helpers/TransferHelper.sol' as TransferHelper;
import './Constants.sol' as Constants;

/**
 * @title BalanceManagement
 * @notice Base contract for the withdrawal of tokens, except for reserved ones
 */
abstract contract BalanceManagement is ManagerRole {
    /**
     * @notice Emitted when the specified token is reserved
     */
    error ReservedTokenError();

    /**
     * @notice Performs the withdrawal of tokens, except for reserved ones
     * @dev Use the "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" address for the native token
     * @param _tokenAddress The address of the token
     * @param _tokenAmount The amount of the token
     */
    function cleanup(address _tokenAddress, uint256 _tokenAmount) external onlyManager {
        if (isReservedToken(_tokenAddress)) {
            revert ReservedTokenError();
        }

        if (_tokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
            TransferHelper.safeTransferNative(msg.sender, _tokenAmount);
        } else {
            TransferHelper.safeTransfer(_tokenAddress, msg.sender, _tokenAmount);
        }
    }

    /**
     * @notice Getter of the token balance of the current contract
     * @dev Use the "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" address for the native token
     * @param _tokenAddress The address of the token
     * @return The token balance of the current contract
     */
    function tokenBalance(address _tokenAddress) public view returns (uint256) {
        if (_tokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
            return address(this).balance;
        } else {
            return ITokenBalance(_tokenAddress).balanceOf(address(this));
        }
    }

    /**
     * @notice Getter of the reserved token flag
     * @dev Override to add reserved token addresses
     * @param _tokenAddress The address of the token
     * @return The reserved token flag
     */
    function isReservedToken(address _tokenAddress) public view virtual returns (bool) {
        // The function returns false by default.
        // The explicit return statement is omitted to avoid the unused parameter warning.
        // See https://github.com/ethereum/solidity/issues/5295
    }
}

File 7 of 28 : CallerGuard.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { ManagerRole } from './roles/ManagerRole.sol';
import './helpers/AddressHelper.sol' as AddressHelper;
import './Constants.sol' as Constants;
import './DataStructures.sol' as DataStructures;

/**
 * @title CallerGuard
 * @notice Base contract to control access from other contracts
 */
abstract contract CallerGuard is ManagerRole {
    /**
     * @dev Caller guard mode enumeration
     */
    enum CallerGuardMode {
        ContractForbidden,
        ContractList,
        ContractAllowed
    }

    /**
     * @dev Caller guard mode value
     */
    CallerGuardMode public callerGuardMode = CallerGuardMode.ContractForbidden;

    /**
     * @dev Registered contract list for "ContractList" mode
     */
    address[] public listedCallerGuardContractList;

    /**
     * @dev Registered contract list indices for "ContractList" mode
     */
    mapping(address /*account*/ => DataStructures.OptionalValue /*index*/)
        public listedCallerGuardContractIndexMap;

    /**
     * @notice Emitted when the caller guard mode is set
     * @param callerGuardMode The caller guard mode
     */
    event SetCallerGuardMode(CallerGuardMode indexed callerGuardMode);

    /**
     * @notice Emitted when a registered contract for "ContractList" mode is added or removed
     * @param contractAddress The contract address
     * @param isListed The registered contract list inclusion flag
     */
    event SetListedCallerGuardContract(address indexed contractAddress, bool indexed isListed);

    /**
     * @notice Emitted when the caller is not allowed to perform the intended action
     */
    error CallerGuardError(address caller);

    /**
     * @dev Modifier to check if the caller is allowed to perform the intended action
     */
    modifier checkCaller() {
        if (msg.sender != tx.origin) {
            bool condition = (callerGuardMode == CallerGuardMode.ContractAllowed ||
                (callerGuardMode == CallerGuardMode.ContractList &&
                    isListedCallerGuardContract(msg.sender)));

            if (!condition) {
                revert CallerGuardError(msg.sender);
            }
        }

        _;
    }

    /**
     * @notice Sets the caller guard mode
     * @param _callerGuardMode The caller guard mode
     */
    function setCallerGuardMode(CallerGuardMode _callerGuardMode) external onlyManager {
        callerGuardMode = _callerGuardMode;

        emit SetCallerGuardMode(_callerGuardMode);
    }

    /**
     * @notice Updates the list of registered contracts for the "ContractList" mode
     * @param _items The addresses and flags for the contracts
     */
    function setListedCallerGuardContracts(
        DataStructures.AccountToFlag[] calldata _items
    ) external onlyManager {
        for (uint256 index; index < _items.length; index++) {
            DataStructures.AccountToFlag calldata item = _items[index];

            if (item.flag) {
                AddressHelper.requireContract(item.account);
            }

            DataStructures.uniqueAddressListUpdate(
                listedCallerGuardContractList,
                listedCallerGuardContractIndexMap,
                item.account,
                item.flag,
                Constants.LIST_SIZE_LIMIT_DEFAULT
            );

            emit SetListedCallerGuardContract(item.account, item.flag);
        }
    }

    /**
     * @notice Getter of the registered contract count
     * @return The registered contract count
     */
    function listedCallerGuardContractCount() external view returns (uint256) {
        return listedCallerGuardContractList.length;
    }

    /**
     * @notice Getter of the complete list of registered contracts
     * @return The complete list of registered contracts
     */
    function fullListedCallerGuardContractList() external view returns (address[] memory) {
        return listedCallerGuardContractList;
    }

    /**
     * @notice Getter of a listed contract flag
     * @param _account The contract address
     * @return The listed contract flag
     */
    function isListedCallerGuardContract(address _account) public view returns (bool) {
        return listedCallerGuardContractIndexMap[_account].isSet;
    }
}

File 8 of 28 : Constants.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @dev The default token decimals value
 */
uint256 constant DECIMALS_DEFAULT = 18;

/**
 * @dev The maximum uint256 value for swap amount limit settings
 */
uint256 constant INFINITY = type(uint256).max;

/**
 * @dev The default limit of account list size
 */
uint256 constant LIST_SIZE_LIMIT_DEFAULT = 100;

/**
 * @dev The limit of swap router list size
 */
uint256 constant LIST_SIZE_LIMIT_ROUTERS = 200;

/**
 * @dev The factor for percentage settings. Example: 100 is 0.1%
 */
uint256 constant MILLIPERCENT_FACTOR = 100_000;

/**
 * @dev The de facto standard address to denote the native token
 */
address constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

File 9 of 28 : IGateway.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title IGateway
 * @notice Cross-chain gateway interface
 */
interface IGateway {
    /**
     * @notice Send a cross-chain message
     * @param _targetChainId The message target chain ID
     * @param _message The message content
     * @param _settings The gateway-specific settings
     */
    function sendMessage(
        uint256 _targetChainId,
        bytes calldata _message,
        bytes calldata _settings
    ) external payable;

    /**
     * @notice Cross-chain message fee estimation
     * @param _targetChainId The ID of the target chain
     * @param _message The message content
     * @param _settings The gateway-specific settings
     */
    function messageFee(
        uint256 _targetChainId,
        bytes calldata _message,
        bytes calldata _settings
    ) external view returns (uint256);
}

File 10 of 28 : IGatewayClient.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title IGatewayClient
 * @notice Cross-chain gateway client interface
 */
interface IGatewayClient {
    /**
     * @notice Cross-chain message handler on the target chain
     * @dev The function is called by cross-chain gateways
     * @param _messageSourceChainId The ID of the message source chain
     * @param _payloadData The content of the cross-chain message
     */
    function handleExecutionPayload(
        uint256 _messageSourceChainId,
        bytes calldata _payloadData
    ) external;

    /**
     * @notice The standard "receive" function
     */
    receive() external payable;
}

File 11 of 28 : DataStructures.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Optional value structure
 * @dev Is used in mappings to allow zero values
 * @param isSet Value presence flag
 * @param value Numeric value
 */
struct OptionalValue {
    bool isSet;
    uint256 value;
}

/**
 * @notice Key-to-value structure
 * @dev Is used as an array parameter item to perform multiple key-value settings
 * @param key Numeric key
 * @param value Numeric value
 */
struct KeyToValue {
    uint256 key;
    uint256 value;
}

/**
 * @notice Key-to-value structure for address values
 * @dev Is used as an array parameter item to perform multiple key-value settings with address values
 * @param key Numeric key
 * @param value Address value
 */
struct KeyToAddressValue {
    uint256 key;
    address value;
}

/**
 * @notice Address-to-flag structure
 * @dev Is used as an array parameter item to perform multiple settings
 * @param account Account address
 * @param flag Flag value
 */
struct AccountToFlag {
    address account;
    bool flag;
}

/**
 * @notice Emitted when a list exceeds the size limit
 */
error ListSizeLimitError();

/**
 * @notice Sets or updates a value in a combined map (a mapping with a key list and key index mapping)
 * @param _map The mapping reference
 * @param _keyList The key list reference
 * @param _keyIndexMap The key list index mapping reference
 * @param _key The numeric key
 * @param _value The address value
 * @param _sizeLimit The map and list size limit
 * @return isNewKey True if the key was just added, otherwise false
 */
function combinedMapSet(
    mapping(uint256 => address) storage _map,
    uint256[] storage _keyList,
    mapping(uint256 => OptionalValue) storage _keyIndexMap,
    uint256 _key,
    address _value,
    uint256 _sizeLimit
) returns (bool isNewKey) {
    isNewKey = !_keyIndexMap[_key].isSet;

    if (isNewKey) {
        uniqueListAdd(_keyList, _keyIndexMap, _key, _sizeLimit);
    }

    _map[_key] = _value;
}

/**
 * @notice Removes a value from a combined map (a mapping with a key list and key index mapping)
 * @param _map The mapping reference
 * @param _keyList The key list reference
 * @param _keyIndexMap The key list index mapping reference
 * @param _key The numeric key
 * @return isChanged True if the combined map was changed, otherwise false
 */
function combinedMapRemove(
    mapping(uint256 => address) storage _map,
    uint256[] storage _keyList,
    mapping(uint256 => OptionalValue) storage _keyIndexMap,
    uint256 _key
) returns (bool isChanged) {
    isChanged = _keyIndexMap[_key].isSet;

    if (isChanged) {
        delete _map[_key];
        uniqueListRemove(_keyList, _keyIndexMap, _key);
    }
}

/**
 * @notice Adds a value to a unique value list (a list with value index mapping)
 * @param _list The list reference
 * @param _indexMap The value index mapping reference
 * @param _value The numeric value
 * @param _sizeLimit The list size limit
 * @return isChanged True if the list was changed, otherwise false
 */
function uniqueListAdd(
    uint256[] storage _list,
    mapping(uint256 => OptionalValue) storage _indexMap,
    uint256 _value,
    uint256 _sizeLimit
) returns (bool isChanged) {
    isChanged = !_indexMap[_value].isSet;

    if (isChanged) {
        if (_list.length >= _sizeLimit) {
            revert ListSizeLimitError();
        }

        _indexMap[_value] = OptionalValue(true, _list.length);
        _list.push(_value);
    }
}

/**
 * @notice Removes a value from a unique value list (a list with value index mapping)
 * @param _list The list reference
 * @param _indexMap The value index mapping reference
 * @param _value The numeric value
 * @return isChanged True if the list was changed, otherwise false
 */
function uniqueListRemove(
    uint256[] storage _list,
    mapping(uint256 => OptionalValue) storage _indexMap,
    uint256 _value
) returns (bool isChanged) {
    OptionalValue storage indexItem = _indexMap[_value];

    isChanged = indexItem.isSet;

    if (isChanged) {
        uint256 itemIndex = indexItem.value;
        uint256 lastIndex = _list.length - 1;

        if (itemIndex != lastIndex) {
            uint256 lastValue = _list[lastIndex];
            _list[itemIndex] = lastValue;
            _indexMap[lastValue].value = itemIndex;
        }

        _list.pop();
        delete _indexMap[_value];
    }
}

/**
 * @notice Adds a value to a unique address value list (a list with value index mapping)
 * @param _list The list reference
 * @param _indexMap The value index mapping reference
 * @param _value The address value
 * @param _sizeLimit The list size limit
 * @return isChanged True if the list was changed, otherwise false
 */
function uniqueAddressListAdd(
    address[] storage _list,
    mapping(address => OptionalValue) storage _indexMap,
    address _value,
    uint256 _sizeLimit
) returns (bool isChanged) {
    isChanged = !_indexMap[_value].isSet;

    if (isChanged) {
        if (_list.length >= _sizeLimit) {
            revert ListSizeLimitError();
        }

        _indexMap[_value] = OptionalValue(true, _list.length);
        _list.push(_value);
    }
}

/**
 * @notice Removes a value from a unique address value list (a list with value index mapping)
 * @param _list The list reference
 * @param _indexMap The value index mapping reference
 * @param _value The address value
 * @return isChanged True if the list was changed, otherwise false
 */
function uniqueAddressListRemove(
    address[] storage _list,
    mapping(address => OptionalValue) storage _indexMap,
    address _value
) returns (bool isChanged) {
    OptionalValue storage indexItem = _indexMap[_value];

    isChanged = indexItem.isSet;

    if (isChanged) {
        uint256 itemIndex = indexItem.value;
        uint256 lastIndex = _list.length - 1;

        if (itemIndex != lastIndex) {
            address lastValue = _list[lastIndex];
            _list[itemIndex] = lastValue;
            _indexMap[lastValue].value = itemIndex;
        }

        _list.pop();
        delete _indexMap[_value];
    }
}

/**
 * @notice Adds or removes a value to/from a unique address value list (a list with value index mapping)
 * @dev The list size limit is checked on items adding only
 * @param _list The list reference
 * @param _indexMap The value index mapping reference
 * @param _value The address value
 * @param _flag The value inclusion flag
 * @param _sizeLimit The list size limit
 * @return isChanged True if the list was changed, otherwise false
 */
function uniqueAddressListUpdate(
    address[] storage _list,
    mapping(address => OptionalValue) storage _indexMap,
    address _value,
    bool _flag,
    uint256 _sizeLimit
) returns (bool isChanged) {
    return
        _flag
            ? uniqueAddressListAdd(_list, _indexMap, _value, _sizeLimit)
            : uniqueAddressListRemove(_list, _indexMap, _value);
}

File 12 of 28 : Errors.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Emitted when an attempt to burn a token fails
 */
error TokenBurnError();

/**
 * @notice Emitted when an attempt to mint a token fails
 */
error TokenMintError();

/**
 * @notice Emitted when a zero address is specified where it is not allowed
 */
error ZeroAddressError();

File 13 of 28 : AddressHelper.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Emitted when the account is not a contract
 * @param account The account address
 */
error NonContractAddressError(address account);

/**
 * @notice Function to check if the account is a contract
 * @return The account contract status flag
 */
function isContract(address _account) view returns (bool) {
    return _account.code.length > 0;
}

/**
 * @notice Function to require an account to be a contract
 */
function requireContract(address _account) view {
    if (!isContract(_account)) {
        revert NonContractAddressError(_account);
    }
}

/**
 * @notice Function to require an account to be a contract or a zero address
 */
function requireContractOrZeroAddress(address _account) view {
    if (_account != address(0)) {
        requireContract(_account);
    }
}

File 14 of 28 : DecimalsHelper.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Function to perform decimals conversion
 * @param _fromDecimals Source value decimals
 * @param _toDecimals Target value decimals
 * @param _fromAmount Source value
 * @return Target value
 */
function convertDecimals(
    uint256 _fromDecimals,
    uint256 _toDecimals,
    uint256 _fromAmount
) pure returns (uint256) {
    if (_toDecimals == _fromDecimals) {
        return _fromAmount;
    } else if (_toDecimals > _fromDecimals) {
        return _fromAmount * 10 ** (_toDecimals - _fromDecimals);
    } else {
        return _fromAmount / 10 ** (_fromDecimals - _toDecimals);
    }
}

File 15 of 28 : GasReserveHelper.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Function to check if the available gas matches the specified gas reserve value
 * @param _gasReserve Gas reserve value
 * @return hasGasReserve Flag of gas reserve availability
 * @return gasAllowed The remaining gas quantity taking the reserve into account
 */
function checkGasReserve(
    uint256 _gasReserve
) view returns (bool hasGasReserve, uint256 gasAllowed) {
    uint256 gasLeft = gasleft();

    hasGasReserve = gasLeft >= _gasReserve;
    gasAllowed = hasGasReserve ? gasLeft - _gasReserve : 0;
}

File 16 of 28 : RefundHelper.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import './TransferHelper.sol' as TransferHelper;

/**
 * @notice Refunds the extra balance of the native token
 * @dev Reverts on subtraction if the actual balance is less than expected
 * @param _self The address of the executing contract
 * @param _expectedBalance The expected native token balance value
 * @param _to The refund receiver's address
 */
function refundExtraBalance(address _self, uint256 _expectedBalance, address payable _to) {
    uint256 extraBalance = _self.balance - _expectedBalance;

    if (extraBalance > 0) {
        TransferHelper.safeTransferNative(_to, extraBalance);
    }
}

File 17 of 28 : TransferHelper.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @notice Emitted when an approval action fails
 */
error SafeApproveError();

/**
 * @notice Emitted when a transfer action fails
 */
error SafeTransferError();

/**
 * @notice Emitted when a transferFrom action fails
 */
error SafeTransferFromError();

/**
 * @notice Emitted when a transfer of the native token fails
 */
error SafeTransferNativeError();

/**
 * @notice Safely approve the token to the account
 * @param _token The token address
 * @param _to The token approval recipient address
 * @param _value The token approval amount
 */
function safeApprove(address _token, address _to, uint256 _value) {
    // 0x095ea7b3 is the selector for "approve(address,uint256)"
    (bool success, bytes memory data) = _token.call(
        abi.encodeWithSelector(0x095ea7b3, _to, _value)
    );

    bool condition = success && (data.length == 0 || abi.decode(data, (bool)));

    if (!condition) {
        revert SafeApproveError();
    }
}

/**
 * @notice Safely transfer the token to the account
 * @param _token The token address
 * @param _to The token transfer recipient address
 * @param _value The token transfer amount
 */
function safeTransfer(address _token, address _to, uint256 _value) {
    // 0xa9059cbb is the selector for "transfer(address,uint256)"
    (bool success, bytes memory data) = _token.call(
        abi.encodeWithSelector(0xa9059cbb, _to, _value)
    );

    bool condition = success && (data.length == 0 || abi.decode(data, (bool)));

    if (!condition) {
        revert SafeTransferError();
    }
}

/**
 * @notice Safely transfer the token between the accounts
 * @param _token The token address
 * @param _from The token transfer source address
 * @param _to The token transfer recipient address
 * @param _value The token transfer amount
 */
function safeTransferFrom(address _token, address _from, address _to, uint256 _value) {
    // 0x23b872dd is the selector for "transferFrom(address,address,uint256)"
    (bool success, bytes memory data) = _token.call(
        abi.encodeWithSelector(0x23b872dd, _from, _to, _value)
    );

    bool condition = success && (data.length == 0 || abi.decode(data, (bool)));

    if (!condition) {
        revert SafeTransferFromError();
    }
}

/**
 * @notice Safely transfer the native token to the account
 * @param _to The native token transfer recipient address
 * @param _value The native token transfer amount
 */
function safeTransferNative(address _to, uint256 _value) {
    (bool success, ) = _to.call{ value: _value }(new bytes(0));

    if (!success) {
        revert SafeTransferNativeError();
    }
}

File 18 of 28 : IActionDataStructures.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title IActionDataStructures
 * @notice Action data structure declarations
 */
interface IActionDataStructures {
    /**
     * @notice Single-chain action data structure
     * @param fromTokenAddress The address of the input token
     * @param toTokenAddress The address of the output token
     * @param swapInfo The data for the single-chain swap
     * @param recipient The address of the recipient
     */
    struct LocalAction {
        address fromTokenAddress;
        address toTokenAddress;
        SwapInfo swapInfo;
        address recipient;
    }

    /**
     * @notice Cross-chain action data structure
     * @param gatewayType The numeric type of the cross-chain gateway
     * @param vaultType The numeric type of the vault
     * @param sourceTokenAddress The address of the input token on the source chain
     * @param sourceSwapInfo The data for the source chain swap
     * @param targetChainId The action target chain ID
     * @param targetTokenAddress The address of the output token on the destination chain
     * @param targetSwapInfoOptions The list of data options for the target chain swap
     * @param targetRecipient The address of the recipient on the target chain
     * @param gatewaySettings The gateway-specific settings data
     */
    struct Action {
        uint256 gatewayType;
        uint256 vaultType;
        address sourceTokenAddress;
        SwapInfo sourceSwapInfo;
        uint256 targetChainId;
        address targetTokenAddress;
        SwapInfo[] targetSwapInfoOptions;
        address targetRecipient;
        bytes gatewaySettings;
    }

    /**
     * @notice Token swap data structure
     * @param fromAmount The quantity of the token
     * @param routerType The numeric type of the swap router
     * @param routerData The data for the swap router call
     */
    struct SwapInfo {
        uint256 fromAmount;
        uint256 routerType;
        bytes routerData;
    }

    /**
     * @notice Cross-chain message data structure
     * @param actionId The unique identifier of the cross-chain action
     * @param sourceSender The address of the sender on the source chain
     * @param vaultType The numeric type of the vault
     * @param targetTokenAddress The address of the output token on the target chain
     * @param targetSwapInfo The data for the target chain swap
     * @param targetRecipient The address of the recipient on the target chain
     */
    struct TargetMessage {
        uint256 actionId;
        address sourceSender;
        uint256 vaultType;
        address targetTokenAddress;
        SwapInfo targetSwapInfo;
        address targetRecipient;
    }
}

File 19 of 28 : IRegistry.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { ISettings } from './ISettings.sol';

interface IRegistry is ISettings {
    /**
     * @notice Getter of the registered gateway flag by the account address
     * @param _account The account address
     * @return The registered gateway flag
     */
    function isGatewayAddress(address _account) external view returns (bool);

    /**
     * @notice Settings for a single-chain swap
     * @param _caller The user's account address
     * @param _routerType The type of the swap router
     * @return Settings for a single-chain swap
     */
    function localSettings(
        address _caller,
        uint256 _routerType
    ) external view returns (LocalSettings memory);

    /**
     * @notice Getter of source chain settings for a cross-chain swap
     * @param _caller The user's account address
     * @param _targetChainId The target chain ID
     * @param _gatewayType The type of the cross-chain gateway
     * @param _routerType The type of the swap router
     * @param _vaultType The type of the vault
     * @return Source chain settings for a cross-chain swap
     */
    function sourceSettings(
        address _caller,
        uint256 _targetChainId,
        uint256 _gatewayType,
        uint256 _routerType,
        uint256 _vaultType
    ) external view returns (SourceSettings memory);

    /**
     * @notice Getter of target chain settings for a cross-chain swap
     * @param _vaultType The type of the vault
     * @param _routerType The type of the swap router
     * @return Target chain settings for a cross-chain swap
     */
    function targetSettings(
        uint256 _vaultType,
        uint256 _routerType
    ) external view returns (TargetSettings memory);

    /**
     * @notice Getter of variable balance repayment settings
     * @param _vaultType The type of the vault
     * @return Variable balance repayment settings
     */
    function variableBalanceRepaymentSettings(
        uint256 _vaultType
    ) external view returns (VariableBalanceRepaymentSettings memory);

    /**
     * @notice Getter of cross-chain message fee estimation settings
     * @param _gatewayType The type of the cross-chain gateway
     * @return Cross-chain message fee estimation settings
     */
    function messageFeeEstimateSettings(
        uint256 _gatewayType
    ) external view returns (MessageFeeEstimateSettings memory);

    /**
     * @notice Getter of swap result calculation settings for a single-chain swap
     * @param _caller The user's account address
     * @return Swap result calculation settings for a single-chain swap
     */
    function localAmountCalculationSettings(
        address _caller
    ) external view returns (LocalAmountCalculationSettings memory);

    /**
     * @notice Getter of swap result calculation settings for a cross-chain swap
     * @param _caller The user's account address
     * @param _vaultType The type of the vault
     * @param _fromChainId The ID of the swap source chain
     * @param _toChainId The ID of the swap target chain
     * @return Swap result calculation settings for a cross-chain swap
     */
    function vaultAmountCalculationSettings(
        address _caller,
        uint256 _vaultType,
        uint256 _fromChainId,
        uint256 _toChainId
    ) external view returns (VaultAmountCalculationSettings memory);

    /**
     * @notice Getter of amount limits in USD for cross-chain swaps
     * @param _vaultType The type of the vault
     * @return min Minimum cross-chain swap amount in USD, with decimals = 18
     * @return max Maximum cross-chain swap amount in USD, with decimals = 18
     */
    function swapAmountLimits(uint256 _vaultType) external view returns (uint256 min, uint256 max);
}

File 20 of 28 : ISettings.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title ISettings
 * @notice Settings data structure declarations
 */
interface ISettings {
    /**
     * @notice Settings for a single-chain swap
     * @param router The swap router contract address
     * @param routerTransfer The swap router transfer contract address
     * @param systemFeeLocal The system fee value in milli-percent, e.g., 100 is 0.1%
     * @param feeCollectorLocal The address of the single-chain action fee collector
     * @param isWhitelist The whitelist flag
     */
    struct LocalSettings {
        address router;
        address routerTransfer;
        uint256 systemFeeLocal;
        address feeCollectorLocal;
        bool isWhitelist;
    }

    /**
     * @notice Source chain settings for a cross-chain swap
     * @param gateway The cross-chain gateway contract address
     * @param router The swap router contract address
     * @param routerTransfer The swap router transfer contract address
     * @param vault The vault contract address
     * @param sourceVaultDecimals The value of the vault decimals on the source chain
     * @param targetVaultDecimals The value of the vault decimals on the target chain
     * @param systemFee The system fee value in milli-percent, e.g., 100 is 0.1%
     * @param feeCollector The address of the cross-chain action fee collector
     * @param isWhitelist The whitelist flag
     * @param swapAmountMin The minimum cross-chain swap amount in USD, with decimals = 18
     * @param swapAmountMax The maximum cross-chain swap amount in USD, with decimals = 18
     */
    struct SourceSettings {
        address gateway;
        address router;
        address routerTransfer;
        address vault;
        uint256 sourceVaultDecimals;
        uint256 targetVaultDecimals;
        uint256 systemFee;
        address feeCollector;
        bool isWhitelist;
        uint256 swapAmountMin;
        uint256 swapAmountMax;
    }

    /**
     * @notice Target chain settings for a cross-chain swap
     * @param router The swap router contract address
     * @param routerTransfer The swap router transfer contract address
     * @param vault The vault contract address
     * @param gasReserve The target chain gas reserve value
     */
    struct TargetSettings {
        address router;
        address routerTransfer;
        address vault;
        uint256 gasReserve;
    }

    /**
     * @notice Variable balance repayment settings
     * @param vault The vault contract address
     */
    struct VariableBalanceRepaymentSettings {
        address vault;
    }

    /**
     * @notice Cross-chain message fee estimation settings
     * @param gateway The cross-chain gateway contract address
     */
    struct MessageFeeEstimateSettings {
        address gateway;
    }

    /**
     * @notice Swap result calculation settings for a single-chain swap
     * @param systemFee The system fee value in milli-percent, e.g., 100 is 0.1%
     * @param isWhitelist The whitelist flag
     */
    struct LocalAmountCalculationSettings {
        uint256 systemFeeLocal;
        bool isWhitelist;
    }

    /**
     * @notice Swap result calculation settings for a cross-chain swap
     * @param fromDecimals The value of the vault decimals on the source chain
     * @param toDecimals The value of the vault decimals on the target chain
     * @param systemFee The system fee value in milli-percent, e.g., 100 is 0.1%
     * @param isWhitelist The whitelist flag
     */
    struct VaultAmountCalculationSettings {
        uint256 fromDecimals;
        uint256 toDecimals;
        uint256 systemFee;
        bool isWhitelist;
    }
}

File 21 of 28 : ITokenBalance.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title ITokenBalance
 * @notice Token balance interface
 */
interface ITokenBalance {
    /**
     * @notice Getter of the token balance by the account
     * @param _account The account address
     * @return Token balance
     */
    function balanceOf(address _account) external view returns (uint256);
}

File 22 of 28 : ITokenMint.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title ITokenMint
 * @notice Token minting interface
 */
interface ITokenMint {
    /**
     * @notice Mints tokens to the account, increasing the total supply
     * @param _to The token receiver account address
     * @param _amount The number of tokens to mint
     * @return Token burning success status
     */
    function mint(address _to, uint256 _amount) external returns (bool);
}

File 23 of 28 : IVariableBalanceRecords.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title IVariableBalanceRecords
 * @notice Variable balance records interface
 */
interface IVariableBalanceRecords {
    /**
     * @notice Increases the variable balance for the account
     * @param _account The account address
     * @param _vaultType The vault type
     * @param _amount The amount by which to increase the variable balance
     */
    function increaseBalance(address _account, uint256 _vaultType, uint256 _amount) external;

    /**
     * @notice Clears the variable balance for the account
     * @param _account The account address
     * @param _vaultType The vault type
     */
    function clearBalance(address _account, uint256 _vaultType) external;

    /**
     * @notice Getter of the variable balance by the account
     * @param _account The account address
     * @param _vaultType The vault type
     */
    function getAccountBalance(
        address _account,
        uint256 _vaultType
    ) external view returns (uint256);
}

File 24 of 28 : IVault.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title IVault
 * @notice Vault interface
 */
interface IVault {
    /**
     * @notice The getter of the vault asset address
     */
    function asset() external view returns (address);

    /**
     * @notice Checks the status of the variable token and balance actions and the variable token address
     * @return The address of the variable token
     */
    function checkVariableTokenState() external view returns (address);

    /**
     * @notice Requests the vault asset tokens
     * @param _amount The amount of the vault asset tokens
     * @param _to The address of the vault asset tokens receiver
     * @param _forVariableBalance True if the request is made for a variable balance repayment, otherwise false
     * @return assetAddress The address of the vault asset token
     */
    function requestAsset(
        uint256 _amount,
        address _to,
        bool _forVariableBalance
    ) external returns (address assetAddress);
}

File 25 of 28 : Pausable.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { Pausable as PausableBase } from '@openzeppelin/contracts/security/Pausable.sol';
import { ManagerRole } from './roles/ManagerRole.sol';

/**
 * @title Pausable
 * @notice Base contract that implements the emergency pause mechanism
 */
abstract contract Pausable is PausableBase, ManagerRole {
    /**
     * @notice Enter pause state
     */
    function pause() external onlyManager whenNotPaused {
        _pause();
    }

    /**
     * @notice Exit pause state
     */
    function unpause() external onlyManager whenPaused {
        _unpause();
    }
}

File 26 of 28 : ManagerRole.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol';
import { RoleBearers } from './RoleBearers.sol';

/**
 * @title ManagerRole
 * @notice Base contract that implements the Manager role.
 * The manager role is a high-permission role for core team members only.
 * Managers can set vaults and routers addresses, fees, cross-chain protocols,
 * and other parameters for Interchain (cross-chain) swaps and single-network swaps.
 * Please note, the manager role is unique for every contract,
 * hence different addresses may be assigned as managers for different contracts.
 */
abstract contract ManagerRole is Ownable, RoleBearers {
    bytes32 private constant ROLE_KEY = keccak256('Manager');

    /**
     * @notice Emitted when the Manager role status for the account is updated
     * @param account The account address
     * @param value The Manager role status flag
     */
    event SetManager(address indexed account, bool indexed value);

    /**
     * @notice Emitted when the Manager role status for the account is renounced
     * @param account The account address
     */
    event RenounceManagerRole(address indexed account);

    /**
     * @notice Emitted when the caller is not a Manager role bearer
     */
    error OnlyManagerError();

    /**
     * @dev Modifier to check if the caller is a Manager role bearer
     */
    modifier onlyManager() {
        if (!isManager(msg.sender)) {
            revert OnlyManagerError();
        }

        _;
    }

    /**
     * @notice Updates the Manager role status for the account
     * @param _account The account address
     * @param _value The Manager role status flag
     */
    function setManager(address _account, bool _value) public onlyOwner {
        _setRoleBearer(ROLE_KEY, _account, _value);

        emit SetManager(_account, _value);
    }

    /**
     * @notice Renounces the Manager role
     */
    function renounceManagerRole() external onlyManager {
        _setRoleBearer(ROLE_KEY, msg.sender, false);

        emit RenounceManagerRole(msg.sender);
    }

    /**
     * @notice Getter of the Manager role bearer count
     * @return The Manager role bearer count
     */
    function managerCount() external view returns (uint256) {
        return _roleBearerCount(ROLE_KEY);
    }

    /**
     * @notice Getter of the complete list of the Manager role bearers
     * @return The complete list of the Manager role bearers
     */
    function fullManagerList() external view returns (address[] memory) {
        return _fullRoleBearerList(ROLE_KEY);
    }

    /**
     * @notice Getter of the Manager role bearer status
     * @param _account The account address
     */
    function isManager(address _account) public view returns (bool) {
        return _isRoleBearer(ROLE_KEY, _account);
    }

    function _initRoles(
        address _owner,
        address[] memory _managers,
        bool _addOwnerToManagers
    ) internal {
        address ownerAddress = _owner == address(0) ? msg.sender : _owner;

        for (uint256 index; index < _managers.length; index++) {
            setManager(_managers[index], true);
        }

        if (_addOwnerToManagers && !isManager(ownerAddress)) {
            setManager(ownerAddress, true);
        }

        if (ownerAddress != msg.sender) {
            transferOwnership(ownerAddress);
        }
    }
}

File 27 of 28 : RoleBearers.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

import '../Constants.sol' as Constants;
import '../DataStructures.sol' as DataStructures;

/**
 * @title RoleBearers
 * @notice Base contract that implements role-based access control
 * @dev A custom implementation providing full role bearer lists
 */
abstract contract RoleBearers {
    mapping(bytes32 /*roleKey*/ => address[] /*roleBearers*/) private roleBearerTable;
    mapping(bytes32 /*roleKey*/ => mapping(address /*account*/ => DataStructures.OptionalValue /*status*/))
        private roleBearerIndexTable;

    function _setRoleBearer(bytes32 _roleKey, address _account, bool _value) internal {
        DataStructures.uniqueAddressListUpdate(
            roleBearerTable[_roleKey],
            roleBearerIndexTable[_roleKey],
            _account,
            _value,
            Constants.LIST_SIZE_LIMIT_DEFAULT
        );
    }

    function _isRoleBearer(bytes32 _roleKey, address _account) internal view returns (bool) {
        return roleBearerIndexTable[_roleKey][_account].isSet;
    }

    function _roleBearerCount(bytes32 _roleKey) internal view returns (uint256) {
        return roleBearerTable[_roleKey].length;
    }

    function _fullRoleBearerList(bytes32 _roleKey) internal view returns (address[] memory) {
        return roleBearerTable[_roleKey];
    }
}

File 28 of 28 : SystemVersionId.sol
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity 0.8.19;

/**
 * @title SystemVersionId
 * @notice Base contract providing the system version identifier
 */
abstract contract SystemVersionId {
    /**
     * @dev The system version identifier
     */
    uint256 public constant SYSTEM_VERSION_ID = uint256(keccak256('2023-03'));
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IRegistry","name":"_registry","type":"address"},{"internalType":"contract IVariableBalanceRecords","name":"_variableBalanceRecords","type":"address"},{"internalType":"uint256","name":"_actionIdOffset","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address[]","name":"_managers","type":"address[]"},{"internalType":"bool","name":"_addOwnerToManagers","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerGuardError","type":"error"},{"inputs":[],"name":"GatewayNotSetError","type":"error"},{"inputs":[],"name":"ListSizeLimitError","type":"error"},{"inputs":[],"name":"MessageFeeError","type":"error"},{"inputs":[],"name":"NativeTokenValueError","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"NonContractAddressError","type":"error"},{"inputs":[],"name":"OnlyGatewayError","type":"error"},{"inputs":[],"name":"OnlyManagerError","type":"error"},{"inputs":[],"name":"OnlySelfError","type":"error"},{"inputs":[],"name":"ReservedTokenError","type":"error"},{"inputs":[],"name":"RouterNotSetError","type":"error"},{"inputs":[],"name":"SafeApproveError","type":"error"},{"inputs":[],"name":"SafeTransferError","type":"error"},{"inputs":[],"name":"SafeTransferFromError","type":"error"},{"inputs":[],"name":"SafeTransferNativeError","type":"error"},{"inputs":[],"name":"SameChainIdError","type":"error"},{"inputs":[],"name":"SameTokenError","type":"error"},{"inputs":[],"name":"SwapAmountMaxError","type":"error"},{"inputs":[],"name":"SwapAmountMinError","type":"error"},{"inputs":[],"name":"SwapError","type":"error"},{"inputs":[],"name":"TargetSwapInfoError","type":"error"},{"inputs":[],"name":"TokenMintError","type":"error"},{"inputs":[],"name":"VaultNotSetError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ActionLocal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"targetChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sourceSender","type":"address"},{"indexed":false,"internalType":"address","name":"targetRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"gatewayType","type":"uint256"},{"indexed":false,"internalType":"address","name":"sourceToken","type":"address"},{"indexed":false,"internalType":"address","name":"targetToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ActionSource","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isSuccess","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ActionTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"RenounceManagerRole","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum CallerGuard.CallerGuardMode","name":"callerGuardMode","type":"uint8"}],"name":"SetCallerGuardMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"bool","name":"isListed","type":"bool"}],"name":"SetListedCallerGuardContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"bool","name":"value","type":"bool"}],"name":"SetManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"registryAddress","type":"address"}],"name":"SetRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recordsAddress","type":"address"}],"name":"SetVariableBalanceRecords","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isLocal","type":"bool"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"routerType","type":"uint256"},{"indexed":false,"internalType":"address","name":"fromTokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"toTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resultAmount","type":"uint256"}],"name":"SourceProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"routerType","type":"uint256"},{"indexed":false,"internalType":"address","name":"fromTokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"toTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resultAmount","type":"uint256"}],"name":"TargetProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"actionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VariableBalanceAllocated","type":"event"},{"inputs":[],"name":"SYSTEM_VERSION_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromAmount","type":"uint256"},{"internalType":"bool","name":"_isForward","type":"bool"}],"name":"calculateLocalAmount","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vaultType","type":"uint256"},{"internalType":"uint256","name":"_fromChainId","type":"uint256"},{"internalType":"uint256","name":"_toChainId","type":"uint256"},{"internalType":"uint256","name":"_fromAmount","type":"uint256"},{"internalType":"bool","name":"_isForward","type":"bool"}],"name":"calculateVaultAmount","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callerGuardMode","outputs":[{"internalType":"enum CallerGuard.CallerGuardMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vaultType","type":"uint256"}],"name":"claimVariableToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"cleanup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vaultType","type":"uint256"}],"name":"convertVariableBalanceToVaultAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"gatewayType","type":"uint256"},{"internalType":"uint256","name":"vaultType","type":"uint256"},{"internalType":"address","name":"sourceTokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"routerType","type":"uint256"},{"internalType":"bytes","name":"routerData","type":"bytes"}],"internalType":"struct IActionDataStructures.SwapInfo","name":"sourceSwapInfo","type":"tuple"},{"internalType":"uint256","name":"targetChainId","type":"uint256"},{"internalType":"address","name":"targetTokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"routerType","type":"uint256"},{"internalType":"bytes","name":"routerData","type":"bytes"}],"internalType":"struct IActionDataStructures.SwapInfo[]","name":"targetSwapInfoOptions","type":"tuple[]"},{"internalType":"address","name":"targetRecipient","type":"address"},{"internalType":"bytes","name":"gatewaySettings","type":"bytes"}],"internalType":"struct IActionDataStructures.Action","name":"_action","type":"tuple"}],"name":"execute","outputs":[{"internalType":"uint256","name":"actionId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"fromTokenAddress","type":"address"},{"internalType":"address","name":"toTokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"routerType","type":"uint256"},{"internalType":"bytes","name":"routerData","type":"bytes"}],"internalType":"struct IActionDataStructures.SwapInfo","name":"swapInfo","type":"tuple"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IActionDataStructures.LocalAction","name":"_localAction","type":"tuple"}],"name":"executeLocal","outputs":[{"internalType":"uint256","name":"actionId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fullListedCallerGuardContractList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fullManagerList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_messageSourceChainId","type":"uint256"},{"internalType":"bytes","name":"_payloadData","type":"bytes"}],"name":"handleExecutionPayload","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isListedCallerGuardContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"isReservedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listedCallerGuardContractCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"listedCallerGuardContractIndexMap","outputs":[{"internalType":"bool","name":"isSet","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"listedCallerGuardContractList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managerCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gatewayType","type":"uint256"},{"internalType":"uint256","name":"_targetChainId","type":"uint256"},{"internalType":"bytes[]","name":"_targetRouterDataOptions","type":"bytes[]"},{"internalType":"bytes","name":"_gatewaySettings","type":"bytes"}],"name":"messageFeeEstimate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceManagerRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"routerTransfer","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"gasReserve","type":"uint256"}],"internalType":"struct ISettings.TargetSettings","name":"_settings","type":"tuple"},{"components":[{"internalType":"uint256","name":"actionId","type":"uint256"},{"internalType":"address","name":"sourceSender","type":"address"},{"internalType":"uint256","name":"vaultType","type":"uint256"},{"internalType":"address","name":"targetTokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"routerType","type":"uint256"},{"internalType":"bytes","name":"routerData","type":"bytes"}],"internalType":"struct IActionDataStructures.SwapInfo","name":"targetSwapInfo","type":"tuple"},{"internalType":"address","name":"targetRecipient","type":"address"}],"internalType":"struct IActionDataStructures.TargetMessage","name":"_targetMessage","type":"tuple"}],"name":"selfCallTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum CallerGuard.CallerGuardMode","name":"_callerGuardMode","type":"uint8"}],"name":"setCallerGuardMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"internalType":"struct AccountToFlag[]","name":"_items","type":"tuple[]"}],"name":"setListedCallerGuardContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_value","type":"bool"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRegistry","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"tokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_vaultType","type":"uint256"}],"name":"variableBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"variableBalanceRecords","outputs":[{"internalType":"contract IVariableBalanceRecords","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526004805460ff191690556200001d4662989680620006a6565b6200002c906204b339620006c0565b6009553480156200003c57600080fd5b5060405162004c0938038062004c098339810160408190526200005f9162000725565b6000805460ff191690556200007433620000c2565b600160035562000084866200011b565b6200008f8562000170565b8360096000828254620000a39190620006c0565b90915550620000b69050838383620001c5565b505050505050620008b4565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b62000126816200027f565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f278c70ced5f3e0e5eeb385b5ff9cb735748ba00a625147e66065ed48fc1562cd90600090a250565b6200017b816200027f565b600880546001600160a01b0319166001600160a01b0383169081179091556040517fd3f42b09987a9b16fb77c8731fc1acfc8c124f7fac825d558856665ae1f68f5990600090a250565b60006001600160a01b03841615620001de5783620001e0565b335b905060005b835181101562000233576200021e84828151811062000208576200020862000856565b60200260200101516001620002bb60201b60201c565b806200022a816200086c565b915050620001e5565b508180156200024a575062000248816200032e565b155b156200025d576200025d816001620002bb565b6001600160a01b03811633146200027957620002798162000370565b50505050565b6001600160a01b0381163b620002b857604051638c50d7cd60e01b81526001600160a01b03821660048201526024015b60405180910390fd5b50565b620002c5620003ec565b620002f27f6d439300980e333f0256d64be2c9f67e86f4493ce25f82498d6db7f4be3d9e6f838362000450565b604051811515906001600160a01b038416907fbe9474bb3e78da7e315cdffa5cfa30b767fcc95bbf44a6197da60228eea1028690600090a35050565b6001600160a01b03811660009081527f260b29b219d450563ddb0e5ca806bdadb1e125f7e8c506de0443797dd7122728602052604081205460ff165b92915050565b6200037a620003ec565b6001600160a01b038116620003e15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401620002af565b620002b881620000c2565b6000546001600160a01b036101009091041633146200044e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620002af565b565b60008381526001602090815260408083206002909252909120620002799190848460646000826200048e5762000488868686620004a6565b6200049c565b6200049c86868685620005db565b9695505050505050565b6001600160a01b0381166000908152602083905260409020805460ff16908115620005d35760018082015486549091600091620004e4919062000888565b90508082146200057857600087828154811062000505576200050562000856565b9060005260206000200160009054906101000a90046001600160a01b03169050808884815481106200053b576200053b62000856565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290879052604090206001018290555b868054806200058b576200058b6200089e565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825287905260408120805460ff191681556001015550505b509392505050565b6001600160a01b03821660009081526020849052604090205460ff16158015620006885784548211620006215760405163b1655e3360e01b815260040160405180910390fd5b6040805180820182526001808252875460208084019182526001600160a01b03881660008181528a83529586209451855460ff1916901515178555915193830193909355885491820189558884529190922090910180546001600160a01b03191690911790555b949350505050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176200036a576200036a62000690565b808201808211156200036a576200036a62000690565b6001600160a01b0381168114620002b857600080fd5b8051620006f981620006d6565b919050565b634e487b7160e01b600052604160045260246000fd5b80518015158114620006f957600080fd5b60008060008060008060c087890312156200073f57600080fd5b86516200074c81620006d6565b809650506020808801516200076181620006d6565b604089015160608a015191975095506200077b81620006d6565b60808901519094506001600160401b03808211156200079957600080fd5b818a0191508a601f830112620007ae57600080fd5b815181811115620007c357620007c3620006fe565b8060051b604051601f19603f83011681018181108582111715620007eb57620007eb620006fe565b60405291825284820192508381018501918d8311156200080a57600080fd5b938501935b8285101562000833576200082385620006ec565b845293850193928501926200080f565b8097505050505050506200084a60a0880162000714565b90509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60006001820162000881576200088162000690565b5060010190565b818103818111156200036a576200036a62000690565b634e487b7160e01b600052603160045260246000fd5b61434580620008c46000396000f3fe6080604052600436106102135760003560e01c80637b10399911610118578063c2c518e1116100a0578063f3ae24151161006f578063f3ae241514610659578063f416216714610679578063f6b3fe1d14610699578063f977350c146106b9578063fe14e8c3146106d957600080fd5b8063c2c518e1146105ef578063e3725b1514610604578063eedc966a14610619578063f2fde38b1461063957600080fd5b80638da5cb5b116100e75780638da5cb5b146105595780639f4876851461057c578063a5e90eee1461058f578063a91ee0dc146105af578063b20f5639146105cf57600080fd5b80637b103999146104d95780637b25b4d414610511578063819bc4b9146105315780638456cb591461054457600080fd5b80633f4ba83a1161019b578063607ab5e51161016a578063607ab5e514610448578063655a79e01461046f5780636b56a6911461048f578063715018a6146104a45780637734095e146104b957600080fd5b80633f4ba83a146103da578063440d7248146103ef57806348db6d77146104105780635c975abb1461043057600080fd5b806317daf0b4116101e257806317daf0b4146102f757806330eb127814610327578063341328c51461034957806338d9e86f1461039a5780633d5439a5146103ba57600080fd5b806304e535e21461021f578063052756511461024a578063093f0e2714610278578063103b7397146102ac57600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b506102346106f9565b60405161024191906134b6565b60405180910390f35b34801561025657600080fd5b5061026a610265366004613511565b61075b565b604051908152602001610241565b34801561028457600080fd5b5061026a7f8e1b4d9fa83837c77e7143aff1b7a1a921a3382984267c0eeb8d18dfd3898fca81565b3480156102b857600080fd5b506000805160206142f083398151915260005260016020527f3c2285c553468ca8f30447b24bb463c127f1b840e23a0cafa23caa79d906669a5461026a565b34801561030357600080fd5b50610317610312366004613573565b610811565b6040519015158152602001610241565b34801561033357600080fd5b50610347610342366004613590565b61082f565b005b34801561035557600080fd5b50610383610364366004613573565b6006602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610241565b3480156103a657600080fd5b5061026a6103b5366004613590565b610893565b3480156103c657600080fd5b506103476103d53660046135bc565b610912565b3480156103e657600080fd5b506103476109b6565b3480156103fb57600080fd5b5061031761040a366004613573565b50600090565b34801561041c57600080fd5b5061034761042b3660046135bc565b6109ee565b34801561043c57600080fd5b5060005460ff16610317565b34801561045457600080fd5b506004546104629060ff1681565b60405161024191906135eb565b34801561047b57600080fd5b5061034761048a36600461365b565b610a80565b34801561049b57600080fd5b5060055461026a565b3480156104b057600080fd5b50610347610c7a565b3480156104c557600080fd5b506103476104d43660046136be565b610c8c565b3480156104e557600080fd5b506007546104f9906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b34801561051d57600080fd5b506104f961052c3660046135bc565b610dd7565b61026a61053f366004613713565b610e01565b34801561055057600080fd5b506103476113d6565b34801561056557600080fd5b5060005461010090046001600160a01b03166104f9565b61026a61058a36600461374e565b61140c565b34801561059b57600080fd5b506103476105aa366004613782565b611872565b3480156105bb57600080fd5b506103476105ca366004613573565b6118cf565b3480156105db57600080fd5b5061026a6105ea3660046137b0565b6118fe565b3480156105fb57600080fd5b50610347611b64565b34801561061057600080fd5b50610234611bd1565b34801561062557600080fd5b5061026a610634366004613573565b611bea565b34801561064557600080fd5b50610347610654366004613573565b611c80565b34801561066557600080fd5b50610317610674366004613573565b611cf6565b34801561068557600080fd5b5061026a610694366004613863565b611d36565b3480156106a557600080fd5b506008546104f9906001600160a01b031681565b3480156106c557600080fd5b506103476106d4366004613888565b611dc4565b3480156106e557600080fd5b506103476106f43660046138a9565b611e4c565b6060600580548060200260200160405190810160405280929190818152602001828054801561075157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610733575b5050505050905090565b600754604051631771177960e11b815233600482015260248101879052604481018690526064810185905260009182916001600160a01b0390911690632ee22ef290608401608060405180830381865afa1580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e191906139fd565b905061080181600001518260200151868685604001518660600151611f58565b979650505050505050565b905090565b6001600160a01b031660009081526006602052604090205460ff1690565b61083833611cf6565b61085557604051637c3ea23f60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610888576108843382611ff7565b5050565b610884823383612085565b600854604051638758e33960e01b81526001600160a01b038481166004830152602482018490526000921690638758e33990604401602060405180830381865afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109099190613a49565b90505b92915050565b61091a612177565b6109226121bd565b33321461099e576000600260045460ff166002811115610944576109446135d5565b14806109755750600160045460ff166002811115610964576109646135d5565b148015610975575061097533610811565b90508061099c57604051630fa0970d60e11b81523360048201526024015b60405180910390fd5b505b6109a9816001612216565b6109b36001600355565b50565b6109bf33611cf6565b6109dc57604051637c3ea23f60e01b815260040160405180910390fd5b6109e461251c565b6109ec612565565b565b6109f6612177565b6109fe6121bd565b333214610a75576000600260045460ff166002811115610a2057610a206135d5565b1480610a515750600160045460ff166002811115610a4057610a406135d5565b148015610a515750610a5133610811565b905080610a7357604051630fa0970d60e11b8152336004820152602401610993565b505b6109a9816000612216565b610a88612177565b6007546040516307f9220960e41b81523360048201526001600160a01b0390911690637f92209090602401602060405180830381865afa158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af49190613a62565b610b1157604051635d3da26d60e01b815260040160405180910390fd5b6000610b1f82840184613b31565b60075460408083015160808401516020015191516308f59d7960e21b81529394506000936001600160a01b03909316926323d675e492610b6b9291600401918252602082015260400190565b608060405180830381865afa158015610b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bac9190613bf9565b90506000806000610bc084606001516125b7565b915091508115610c2757604051633b9a04af60e11b81523090637734095e908390610bf19088908a90600401613d31565b600060405180830381600088803b158015610c0b57600080fd5b5087f193505050508015610c1d575060015b15610c2757600192505b82610c3557610c35856125e3565b8451604051428152841515918a917fc678724853e8a8ed1f6ed64e9efc05afa8c6826d63a2c42e33fbd4697ff458459060200160405180910390a45050505050505050565b610c826126b2565b6109ec6000612712565b333014610cac576040516328a2ea3b60e01b815260040160405180910390fd5b6000610cbe6060840160408501613573565b6001600160a01b031603610ce557604051630b24de4b60e01b815260040160405180910390fd5b6000610cf76060840160408501613573565b6001600160a01b0316634b15b2a9610d126080850185613d77565b60405160e083901b6001600160e01b031916815290356004820152306024820152600060448201526064016020604051808303816000875af1158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190613d97565b9050610dd2610d9436859003850185613db4565b833583610da76080870160608801613573565b610db46080880188613d77565b610dbd90613e14565b610dcd60c0890160a08a01613573565b61276b565b505050565b60058181548110610de757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610e0b612177565b610e136121bd565b333214610e8a576000600260045460ff166002811115610e3557610e356135d5565b1480610e665750600160045460ff166002811115610e5557610e556135d5565b148015610e665750610e6633610811565b905080610e8857604051630fa0970d60e11b8152336004820152602401610993565b505b46826080013503610eae5760405163785a29dd60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610ed36060840160408501613573565b6001600160a01b0316148015610ef55750610ef16060830183613d77565b3534105b15610f1357604051637dd7aa2160e01b815260040160405180910390fd5b6000610f1f3447613e36565b600980549192506000610f3183613e49565b90915550506009546007549092506000906001600160a01b031663322f24323360808701358735610f6560608a018a613d77565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925260448301526020908101356064830152870135608482015260a40161016060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190613e62565b60608101519091506001600160a01b031661101c57604051630b24de4b60e01b815260040160405180910390fd5b600081606001516001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110849190613d97565b90506000806110c4868261109e60608b0160408c01613573565b866110ac60608d018d613d77565b6110b590613e14565b89602001518a60400151612934565b9150915060006110ea85608001518660a001518560018960c001518a6101000151611f58565b905061111060405180606001604052806000815260200160008152602001606081525090565b600061111f60c08b018b613f1b565b90509050806000036111905760405180606001604052808481526020016000815260200160006001600160401b0381111561115c5761115c61391d565b6040519080825280601f01601f191660200182016040528015611186576020820181803683370190505b509052915061121f565b60005b818110156111fc5760006111aa60c08d018d613f1b565b838181106111ba576111ba613f64565b90506020028101906111cc9190613d77565b6111d590613e14565b9050848160000151116111e95792506111fc565b50806111f481613e49565b915050611193565b50815160000361121f57604051637755fda760e01b815260040160405180910390fd5b60006112388860a0015189608001518560000151612bb7565b9050600061124c8960800151601284612bb7565b905088610100015161126d5761126d818a61012001518b6101400151612c1b565b61127c888a6060015184612085565b60006040518060c001604052808d8152602001336001600160a01b031681526020018e6020013581526020018e60a00160208101906112bb9190613573565b6001600160a01b0316815260200186815260200160006001600160a01b03168f60e00160208101906112ed9190613573565b6001600160a01b031614611313578e60e001602081019061130e9190613573565b611315565b335b6001600160a01b031690526040516113309190602001613f7a565b60408051601f1981840301815291905290506113578a8e836113528b34613e36565b612c5d565b6000611363848a613e36565b9050600081118015611381575060e08b01516001600160a01b031615155b15611395576113958a8c60e0015183612085565b6113a0308d33612dab565b6113bb8d8f856113b68f60800151601287612bb7565b612dd3565b5050505050505050505050506113d16001600355565b919050565b6113df33611cf6565b6113fc57604051637c3ea23f60e01b815260040160405180910390fd5b611404612177565b6109ec612e7b565b6000611416612177565b61141e6121bd565b333214611495576000600260045460ff166002811115611440576114406135d5565b14806114715750600160045460ff166002811115611460576114606135d5565b148015611471575061147133610811565b90508061149357604051630fa0970d60e11b8152336004820152602401610993565b505b6114a56040830160208401613573565b6001600160a01b03166114bb6020840184613573565b6001600160a01b0316036114e257604051633b0e2de560e21b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6115046020840184613573565b6001600160a01b031614801561152757506115226040830183613d77565b353414155b1561154557604051637dd7aa2160e01b815260040160405180910390fd5b60006115513447613e36565b60098054919250600061156383613e49565b90915550506009546007549092506000906001600160a01b031663f36dd64e336115906040880188613d77565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260200135602482015260440160a060405180830381865afa1580156115dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116019190613f8d565b9050600061164a8460016116186020890189613573565b61162860408a0160208b01613573565b61163560408b018b613d77565b61163e90613e14565b87516020890151612934565b5090506000806116606080880160608901613573565b6001600160a01b0316146116835761167e6080870160608801613573565b611685565b335b9050600061169e83600186604001518760800151612eb8565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6116c56040890160208a01613573565b6001600160a01b0316036116e2576116dd8282611ff7565b6116fc565b6116fc6116f56040890160208a01613573565b8383612085565b60006117088285613e36565b905080156117c25760608501516001600160a01b038116156117805773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61174960408b0160208c01613573565b6001600160a01b031603611766576117618183611ff7565b6117c0565b61176161177960408b0160208c01613573565b8284612085565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6117a560408b0160208c01613573565b6001600160a01b0316036117c0576117bd828861401b565b96505b505b6117cd308733612dab565b33877f64f803250cc450b9c5e2cef3ac4c82370f41b8c1e5692f4067b6b96d2430bfcb856117fe60208d018d613573565b61180e60408e0160208f01613573565b61181b60408f018f613d77565b604080516001600160a01b03958616815293851660208501529190931690820152903560608201526080810186905260a081018590524260c082015260e00160405180910390a35050505050506113d16001600355565b61187a6126b2565b6118936000805160206142f08339815191528383612f29565b604051811515906001600160a01b038416907fbe9474bb3e78da7e315cdffa5cfa30b767fcc95bbf44a6197da60228eea1028690600090a35050565b6118d833611cf6565b6118f557604051637c3ea23f60e01b815260040160405180910390fd5b6109b381612f50565b600046860361190f57506000611b5a565b6007546040516318fa0c2360e21b8152600481018990526000916001600160a01b0316906363e8308c90602401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d919061407d565b80519091506001600160a01b03166119a85760405163ba8ec24160e01b815260040160405180910390fd5b6000858103611a485781516040805160008152602081019091526001600160a01b039091169063aa4fc83d908a906119df90612fa3565b88886040518563ffffffff1660e01b8152600401611a009493929190614099565b602060405180830381865afa158015611a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a419190613a49565b9050611b56565b60005b86811015611b54576000611ab6898984818110611a6a57611a6a613f64565b9050602002810190611a7c91906140e6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fa392505050565b9050600084600001516001600160a01b031663aa4fc83d8c848b8b6040518563ffffffff1660e01b8152600401611af09493929190614099565b602060405180830381865afa158015611b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b319190613a49565b905083811115611b3f578093505b50508080611b4c90613e49565b915050611a4b565b505b9150505b9695505050505050565b611b6d33611cf6565b611b8a57604051637c3ea23f60e01b815260040160405180910390fd5b611ba46000805160206142f0833981519152336000612f29565b60405133907f6cc2c67081f55c2fffb7c008fa995fbbf890f48c7c16fba93d8220f00dc84cc590600090a2565b606061080c6000805160206142f0833981519152613037565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601611c18575047919050565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015611c5c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090c9190613a49565b611c886126b2565b6001600160a01b038116611ced5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610993565b6109b381612712565b6001600160a01b03811660009081527f260b29b219d450563ddb0e5ca806bdadb1e125f7e8c506de0443797dd7122728602052604081205460ff1661090c565b600754604051631a5a276d60e31b815233600482015260009182916001600160a01b039091169063d2d13b68906024016040805180830381865afa158015611d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da6919061412c565b9050611dbc848483600001518460200151612eb8565b949350505050565b611dcd33611cf6565b611dea57604051637c3ea23f60e01b815260040160405180910390fd5b6004805482919060ff19166001836002811115611e0957611e096135d5565b0217905550806002811115611e2057611e206135d5565b6040517f332a9f1d3bd9b0f7abbd95838fed6b417589632d0eb33f2d8ae6e2aa17178efd90600090a250565b611e5533611cf6565b611e7257604051637c3ea23f60e01b815260040160405180910390fd5b60005b81811015610dd25736838383818110611e9057611e90613f64565b9050604002019050806020016020810190611eab9190614181565b15611ec557611ec5611ec06020830183613573565b6130a3565b611ef060056006611ed96020850185613573565b611ee96040860160208701614181565b60646130d6565b50611f016040820160208301614181565b1515611f106020830183613573565b6001600160a01b03167f1470aed653fa8a8ce4c7b2f41287634199f7ec3c4f5fd0ace97d82cf006beec360405160405180910390a35080611f5081613e49565b915050611e75565b6000808280611f65575083155b90506000851580611f735750815b611f9e57620186a0611f858682613e36565b611f8f908961419e565b611f9991906141b5565b611fa0565b865b90506000611faf8a8a84612bb7565b90508680611fba5750825b611fe757611fcb86620186a0613e36565b611fd8620186a08361419e565b611fe291906141b5565b611fe9565b805b9a9950505050505050505050565b604080516000808252602082019092526001600160a01b03841690839060405161202191906141d7565b60006040518083038185875af1925050503d806000811461205e576040519150601f19603f3d011682016040523d82523d6000602084013e612063565b606091505b5050905080610dd257604051632e05b05360e21b815260040160405180910390fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916120e191906141d7565b6000604051808303816000865af19150503d806000811461211e576040519150601f19603f3d011682016040523d82523d6000602084013e612123565b606091505b5091509150600082801561214f57508151158061214f57508180602001905181019061214f9190613a62565b90508061216f57604051632fdb1b7f60e11b815260040160405180910390fd5b505050505050565b60005460ff16156109ec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610993565b60026003540361220f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610993565b6002600355565b60075460405163154d267d60e21b8152600481018490526000916001600160a01b03169063553499f490602401602060405180830381865afa158015612260573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612284919061407d565b80519091506001600160a01b03166122af57604051630b24de4b60e01b815260040160405180910390fd5b600854604051638758e33960e01b8152336004820152602481018590526000916001600160a01b031690638758e33990604401602060405180830381865afa1580156122ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123239190613a49565b6008546040516227421b60e61b8152336004820152602481018790529192506001600160a01b0316906309d086c090604401600060405180830381600087803b15801561236f57600080fd5b505af1158015612383573d6000803e3d6000fd5b505050506000811115612516578215612417578151604051634b15b2a960e01b815260048101839052336024820152600160448201526001600160a01b0390911690634b15b2a9906064016020604051808303816000875af11580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190613d97565b50612516565b600082600001516001600160a01b0316632c966a346040518163ffffffff1660e01b8152600401602060405180830381865afa15801561245b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247f9190613d97565b6040516340c10f1960e01b8152336004820152602481018490529091506000906001600160a01b038316906340c10f19906044016020604051808303816000875af11580156124d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f69190613a62565b90508061216f576040516320aaed5f60e21b815260040160405180910390fd5b50505050565b60005460ff166109ec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610993565b61256d61251c565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60008060005a9050838110159250826125d15760006125db565b6125db8482613e36565b915050915091565b60a08101516040808301516080840151516008549251631e9f7a9b60e01b81526001600160a01b03808616600483015260248201849052604482018390529293919290911690631e9f7a9b90606401600060405180830381600087803b15801561264c57600080fd5b505af1158015612660573d6000803e3d6000fd5b5050855160408051868152602081018690526001600160a01b03881694509192507fb9e12bbbbed208a973bc1ec9604e1f6d7f4b91b193fc2e1150df974b7d16635b910160405180910390a350505050565b6000546001600160a01b036101009091041633146109ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610993565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b6000846001600160a01b0316846001600160a01b03160361278e57508151612885565b86516001600160a01b03166127b65760405163ebb12eb360e01b815260040160405180910390fd5b60006127c185611bea565b90506127d686896020015186600001516130f9565b600088600001516001600160a01b031685604001516040516127f891906141d7565b6000604051808303816000865af19150503d8060008114612835576040519150601f19603f3d011682016040523d82523d6000602084013e61283a565b606091505b505090508061285c57604051633e1f5ce560e11b815260040160405180910390fd5b61286c878a6020015160006130f9565b8161287687611bea565b6128809190613e36565b925050505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038516016128b9576128b48282611ff7565b6128c4565b6128c4848383612085565b6020808401518451604080519283526001600160a01b0389811694840194909452878416908301526060820152608081018390529083169087907f26e7a43f3221294fff6b57719103b3bfdeb1c06dac5c3973de3e55932e7c1b3b9060a00160405180910390a350505050505050565b600080600061294287611bea565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03891601612a21576001600160a01b0385166129905760405163ebb12eb360e01b815260040160405180910390fd5b6000856001600160a01b0316876000015188604001516040516129b391906141d7565b60006040518083038185875af1925050503d80600081146129f0576040519150601f19603f3d011682016040523d82523d6000602084013e6129f5565b606091505b5050905080612a1757604051633e1f5ce560e11b815260040160405180910390fd5b5085519150612b15565b612a3188333089600001516131e3565b866001600160a01b0316886001600160a01b031614612b10576001600160a01b038516612a715760405163ebb12eb360e01b815260040160405180910390fd5b612a80888588600001516130f9565b6000856001600160a01b03168760400151604051612a9e91906141d7565b6000604051808303816000865af19150503d8060008114612adb576040519150601f19603f3d011682016040523d82523d6000602084013e612ae0565b606091505b5050905080612b0257604051633e1f5ce560e11b815260040160405180910390fd5b612b0e898660006130f9565b505b600091505b80612b1f88611bea565b612b299190613e36565b9250336001600160a01b03168915158b7f580273492d266e8e27b4253a13c46e1c74823e94794f9ad186ca8fe8b109e3ef89602001518c8c8c600001518a604051612ba29594939291909485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b60405180910390a45097509795505050505050565b6000838303612bc7575080612c14565b83831115612bf557612bd98484613e36565b612be490600a6142cd565b612bee908361419e565b9050612c14565b612bff8385613e36565b612c0a90600a6142cd565b612bee90836141b5565b9392505050565b81831015612c3c57604051632220ee1360e11b815260040160405180910390fd5b80831115610dd25760405163341cc20160e21b815260040160405180910390fd5b83516001600160a01b0316612c855760405163ba8ec24160e01b815260040160405180910390fd5b83516000906001600160a01b031663aa4fc83d608086013585612cac6101008901896140e6565b6040518563ffffffff1660e01b8152600401612ccb9493929190614099565b602060405180830381865afa158015612ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0c9190613a49565b905080821015612d2e57604051625a4bb360e21b815260040160405180910390fd5b84516001600160a01b0316636ea9cec982608087013586612d536101008a018a6140e6565b6040518663ffffffff1660e01b8152600401612d729493929190614099565b6000604051808303818588803b158015612d8b57600080fd5b505af1158015612d9f573d6000803e3d6000fd5b50505050505050505050565b6000612dc1836001600160a01b03861631613e36565b90508015612516576125168282611ff7565b336080840135857fc2ad425216cf8ac56ecd38af0315ed35266cb6771f34fc27e1f0cde1a5b3eb6a612e0c610100880160e08901613573565b8735612e1e60608a0160408b01613573565b612e2e60c08b0160a08c01613573565b604080516001600160a01b03958616815260208101949094529184168383015290921660608201526080810188905260a081018790524260c082015290519081900360e00190a450505050565b612e83612177565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861259a3390565b60008180612ec4575082155b15612ed0575083611dbc565b83612efe57612ee283620186a0613e36565b612eef620186a08761419e565b612ef991906141b5565b612f20565b620186a0612f0c8482613e36565b612f16908761419e565b612f2091906141b5565b95945050505050565b600083815260016020908152604080832060029092529091206125169190848460646130d6565b612f59816130a3565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f278c70ced5f3e0e5eeb385b5ff9cb735748ba00a625147e66065ed48fc1562cd90600090a250565b606060006040518060c001604052806000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016040518060600160405280600081526020016000815260200186815250815260200160006001600160a01b03168152506040516020016130209190613f7a565b60408051601f198184030181529190529392505050565b60008181526001602090815260409182902080548351818402810184019094528084526060939283018282801561309757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613079575b50505050509050919050565b6001600160a01b0381163b6109b357604051638c50d7cd60e01b81526001600160a01b0382166004820152602401610993565b6000826130ed576130e88686866132de565b611b5a565b611b5a86868685613406565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b179052915160009283929087169161315591906141d7565b6000604051808303816000865af19150503d8060008114613192576040519150601f19603f3d011682016040523d82523d6000602084013e613197565b606091505b509150915060008280156131c35750815115806131c35750818060200190518101906131c39190613a62565b90508061216f5760405163b45d44e760e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161324791906141d7565b6000604051808303816000865af19150503d8060008114613284576040519150601f19603f3d011682016040523d82523d6000602084013e613289565b606091505b509150915060008280156132b55750815115806132b55750818060200190518101906132b59190613a62565b9050806132d557604051632d9d5b4160e01b815260040160405180910390fd5b50505050505050565b6001600160a01b0381166000908152602083905260409020805460ff169081156133fe57600180820154865490916000916133199190613e36565b90508082146133a657600087828154811061333657613336613f64565b9060005260206000200160009054906101000a90046001600160a01b031690508088848154811061336957613369613f64565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290879052604090206001018290555b868054806133b6576133b66142d9565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825287905260408120805460ff191681556001015550505b509392505050565b6001600160a01b03821660009081526020849052604090205460ff16158015611dbc578454821161344a5760405163b1655e3360e01b815260040160405180910390fd5b6040805180820182526001808252875460208084019182526001600160a01b039790971660008181529888529388209251835460ff19169015151783555191810191909155865490810187559585529290932090930180546001600160a01b0319169091179055919050565b6020808252825182820181905260009190848201906040850190845b818110156134f75783516001600160a01b0316835292840192918401916001016134d2565b50909695505050505050565b80151581146109b357600080fd5b600080600080600060a0868803121561352957600080fd5b85359450602086013593506040860135925060608601359150608086013561355081613503565b809150509295509295909350565b6001600160a01b03811681146109b357600080fd5b60006020828403121561358557600080fd5b8135612c148161355e565b600080604083850312156135a357600080fd5b82356135ae8161355e565b946020939093013593505050565b6000602082840312156135ce57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061360d57634e487b7160e01b600052602160045260246000fd5b91905290565b60008083601f84011261362557600080fd5b5081356001600160401b0381111561363c57600080fd5b60208301915083602082850101111561365457600080fd5b9250929050565b60008060006040848603121561367057600080fd5b8335925060208401356001600160401b0381111561368d57600080fd5b61369986828701613613565b9497909650939450505050565b6000608082840312156136b857600080fd5b50919050565b60008060a083850312156136d157600080fd5b6136db84846136a6565b915060808301356001600160401b038111156136f657600080fd5b830160c0818603121561370857600080fd5b809150509250929050565b60006020828403121561372557600080fd5b81356001600160401b0381111561373b57600080fd5b82016101208185031215612c1457600080fd5b60006020828403121561376057600080fd5b81356001600160401b0381111561377657600080fd5b611dbc848285016136a6565b6000806040838503121561379557600080fd5b82356137a08161355e565b9150602083013561370881613503565b600080600080600080608087890312156137c957600080fd5b863595506020870135945060408701356001600160401b03808211156137ee57600080fd5b818901915089601f83011261380257600080fd5b81358181111561381157600080fd5b8a60208260051b850101111561382657600080fd5b60208301965080955050606089013591508082111561384457600080fd5b5061385189828a01613613565b979a9699509497509295939492505050565b6000806040838503121561387657600080fd5b82359150602083013561370881613503565b60006020828403121561389a57600080fd5b813560038110612c1457600080fd5b600080602083850312156138bc57600080fd5b82356001600160401b03808211156138d357600080fd5b818501915085601f8301126138e757600080fd5b8135818111156138f657600080fd5b8660208260061b850101111561390b57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156139555761395561391d565b60405290565b604051606081016001600160401b03811182821017156139555761395561391d565b60405160c081016001600160401b03811182821017156139555761395561391d565b60405161016081016001600160401b03811182821017156139555761395561391d565b604051601f8201601f191681016001600160401b03811182821017156139ea576139ea61391d565b604052919050565b80516113d181613503565b600060808284031215613a0f57600080fd5b613a17613933565b8251815260208301516020820152604083015160408201526060830151613a3d81613503565b60608201529392505050565b600060208284031215613a5b57600080fd5b5051919050565b600060208284031215613a7457600080fd5b8151612c1481613503565b600060608284031215613a9157600080fd5b613a9961395b565b9050813581526020808301358183015260408301356001600160401b0380821115613ac357600080fd5b818501915085601f830112613ad757600080fd5b813581811115613ae957613ae961391d565b613afb601f8201601f191685016139c2565b91508082528684828501011115613b1157600080fd5b808484018584013760008482840101525080604085015250505092915050565b600060208284031215613b4357600080fd5b81356001600160401b0380821115613b5a57600080fd5b9083019060c08286031215613b6e57600080fd5b613b7661397d565b823581526020830135613b888161355e565b6020820152604083810135908201526060830135613ba58161355e565b6060820152608083013582811115613bbc57600080fd5b613bc887828601613a7f565b60808301525060a08301359250613bde8361355e565b60a0810192909252509392505050565b80516113d18161355e565b600060808284031215613c0b57600080fd5b613c13613933565b8251613c1e8161355e565b81526020830151613c2e8161355e565b60208201526040830151613c418161355e565b60408201526060928301519281019290925250919050565b60005b83811015613c74578181015183820152602001613c5c565b50506000910152565b60008151808452613c95816020860160208601613c59565b601f01601f19169290920160200192915050565b805182526000602082015160018060a01b038082166020860152604084015160408601528060608501511660608601525050608082015160c06080850152805160c0850152602081015160e0850152604081015190506060610100850152613d15610120850182613c7d565b905060a08301516133fe60a08601826001600160a01b03169052565b600060018060a01b03808551168352806020860151166020840152806040860151166040840152506060840151606083015260a06080830152611dbc60a0830184613ca9565b60008235605e19833603018112613d8d57600080fd5b9190910192915050565b600060208284031215613da957600080fd5b8151612c148161355e565b600060808284031215613dc657600080fd5b613dce613933565b8235613dd98161355e565b81526020830135613de98161355e565b60208201526040830135613dfc8161355e565b60408201526060928301359281019290925250919050565b600061090c3683613a7f565b634e487b7160e01b600052601160045260246000fd5b8181038181111561090c5761090c613e20565b600060018201613e5b57613e5b613e20565b5060010190565b60006101608284031215613e7557600080fd5b613e7d61399f565b613e8683613bee565b8152613e9460208401613bee565b6020820152613ea560408401613bee565b6040820152613eb660608401613bee565b60608201526080830151608082015260a083015160a082015260c083015160c0820152613ee560e08401613bee565b60e0820152610100613ef88185016139f2565b908201526101208381015190820152610140928301519281019290925250919050565b6000808335601e19843603018112613f3257600080fd5b8301803591506001600160401b03821115613f4c57600080fd5b6020019150600581901b360382131561365457600080fd5b634e487b7160e01b600052603260045260246000fd5b6020815260006109096020830184613ca9565b600060a08284031215613f9f57600080fd5b60405160a081018181106001600160401b0382111715613fc157613fc161391d565b6040528251613fcf8161355e565b81526020830151613fdf8161355e565b6020820152604083810151908201526060830151613ffc8161355e565b6060820152608083015161400f81613503565b60808201529392505050565b8082018082111561090c5761090c613e20565b60006020828403121561404057600080fd5b604051602081018181106001600160401b03821117156140625761406261391d565b806040525080915082516140758161355e565b905292915050565b60006020828403121561408f57600080fd5b610909838361402e565b8481526060602082015260006140b26060830186613c7d565b8281036040840152838152838560208301376000602085830101526020601f19601f86011682010191505095945050505050565b6000808335601e198436030181126140fd57600080fd5b8301803591506001600160401b0382111561411757600080fd5b60200191503681900382131561365457600080fd5b60006040828403121561413e57600080fd5b604051604081018181106001600160401b03821117156141605761416061391d565b60405282518152602083015161417581613503565b60208201529392505050565b60006020828403121561419357600080fd5b8135612c1481613503565b808202811582820484141761090c5761090c613e20565b6000826141d257634e487b7160e01b600052601260045260246000fd5b500490565b60008251613d8d818460208701613c59565b600181815b8085111561422457816000190482111561420a5761420a613e20565b8085161561421757918102915b93841c93908002906141ee565b509250929050565b60008261423b5750600161090c565b816142485750600061090c565b816001811461425e576002811461426857614284565b600191505061090c565b60ff84111561427957614279613e20565b50506001821b61090c565b5060208310610133831016604e8410600b84101617156142a7575081810a61090c565b6142b183836141e9565b80600019048211156142c5576142c5613e20565b029392505050565b6000610909838361422c565b634e487b7160e01b600052603160045260246000fdfe6d439300980e333f0256d64be2c9f67e86f4493ce25f82498d6db7f4be3d9e6fa2646970667358221220c2aa62716ef10870fee4e652113ad4145dcfcad716e81c0c1526fa3788708ad664736f6c63430008130033000000000000000000000000f19ea8e63256992a823262c71568b0bb27ce146f000000000000000000000000bfc3b856b9bcc792875e79fc8ffcc09028aad40600000000000000000000000000000000000000000000000000000000000001f400000000000000000000000072e28c7f34100afefc399fcc0ae041b8fe5841ae00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f35dc3505b2b150369bb267ca48a8eac36b9217c

Deployed Bytecode

0x6080604052600436106102135760003560e01c80637b10399911610118578063c2c518e1116100a0578063f3ae24151161006f578063f3ae241514610659578063f416216714610679578063f6b3fe1d14610699578063f977350c146106b9578063fe14e8c3146106d957600080fd5b8063c2c518e1146105ef578063e3725b1514610604578063eedc966a14610619578063f2fde38b1461063957600080fd5b80638da5cb5b116100e75780638da5cb5b146105595780639f4876851461057c578063a5e90eee1461058f578063a91ee0dc146105af578063b20f5639146105cf57600080fd5b80637b103999146104d95780637b25b4d414610511578063819bc4b9146105315780638456cb591461054457600080fd5b80633f4ba83a1161019b578063607ab5e51161016a578063607ab5e514610448578063655a79e01461046f5780636b56a6911461048f578063715018a6146104a45780637734095e146104b957600080fd5b80633f4ba83a146103da578063440d7248146103ef57806348db6d77146104105780635c975abb1461043057600080fd5b806317daf0b4116101e257806317daf0b4146102f757806330eb127814610327578063341328c51461034957806338d9e86f1461039a5780633d5439a5146103ba57600080fd5b806304e535e21461021f578063052756511461024a578063093f0e2714610278578063103b7397146102ac57600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b506102346106f9565b60405161024191906134b6565b60405180910390f35b34801561025657600080fd5b5061026a610265366004613511565b61075b565b604051908152602001610241565b34801561028457600080fd5b5061026a7f8e1b4d9fa83837c77e7143aff1b7a1a921a3382984267c0eeb8d18dfd3898fca81565b3480156102b857600080fd5b506000805160206142f083398151915260005260016020527f3c2285c553468ca8f30447b24bb463c127f1b840e23a0cafa23caa79d906669a5461026a565b34801561030357600080fd5b50610317610312366004613573565b610811565b6040519015158152602001610241565b34801561033357600080fd5b50610347610342366004613590565b61082f565b005b34801561035557600080fd5b50610383610364366004613573565b6006602052600090815260409020805460019091015460ff9091169082565b604080519215158352602083019190915201610241565b3480156103a657600080fd5b5061026a6103b5366004613590565b610893565b3480156103c657600080fd5b506103476103d53660046135bc565b610912565b3480156103e657600080fd5b506103476109b6565b3480156103fb57600080fd5b5061031761040a366004613573565b50600090565b34801561041c57600080fd5b5061034761042b3660046135bc565b6109ee565b34801561043c57600080fd5b5060005460ff16610317565b34801561045457600080fd5b506004546104629060ff1681565b60405161024191906135eb565b34801561047b57600080fd5b5061034761048a36600461365b565b610a80565b34801561049b57600080fd5b5060055461026a565b3480156104b057600080fd5b50610347610c7a565b3480156104c557600080fd5b506103476104d43660046136be565b610c8c565b3480156104e557600080fd5b506007546104f9906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b34801561051d57600080fd5b506104f961052c3660046135bc565b610dd7565b61026a61053f366004613713565b610e01565b34801561055057600080fd5b506103476113d6565b34801561056557600080fd5b5060005461010090046001600160a01b03166104f9565b61026a61058a36600461374e565b61140c565b34801561059b57600080fd5b506103476105aa366004613782565b611872565b3480156105bb57600080fd5b506103476105ca366004613573565b6118cf565b3480156105db57600080fd5b5061026a6105ea3660046137b0565b6118fe565b3480156105fb57600080fd5b50610347611b64565b34801561061057600080fd5b50610234611bd1565b34801561062557600080fd5b5061026a610634366004613573565b611bea565b34801561064557600080fd5b50610347610654366004613573565b611c80565b34801561066557600080fd5b50610317610674366004613573565b611cf6565b34801561068557600080fd5b5061026a610694366004613863565b611d36565b3480156106a557600080fd5b506008546104f9906001600160a01b031681565b3480156106c557600080fd5b506103476106d4366004613888565b611dc4565b3480156106e557600080fd5b506103476106f43660046138a9565b611e4c565b6060600580548060200260200160405190810160405280929190818152602001828054801561075157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610733575b5050505050905090565b600754604051631771177960e11b815233600482015260248101879052604481018690526064810185905260009182916001600160a01b0390911690632ee22ef290608401608060405180830381865afa1580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e191906139fd565b905061080181600001518260200151868685604001518660600151611f58565b979650505050505050565b905090565b6001600160a01b031660009081526006602052604090205460ff1690565b61083833611cf6565b61085557604051637c3ea23f60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610888576108843382611ff7565b5050565b610884823383612085565b600854604051638758e33960e01b81526001600160a01b038481166004830152602482018490526000921690638758e33990604401602060405180830381865afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109099190613a49565b90505b92915050565b61091a612177565b6109226121bd565b33321461099e576000600260045460ff166002811115610944576109446135d5565b14806109755750600160045460ff166002811115610964576109646135d5565b148015610975575061097533610811565b90508061099c57604051630fa0970d60e11b81523360048201526024015b60405180910390fd5b505b6109a9816001612216565b6109b36001600355565b50565b6109bf33611cf6565b6109dc57604051637c3ea23f60e01b815260040160405180910390fd5b6109e461251c565b6109ec612565565b565b6109f6612177565b6109fe6121bd565b333214610a75576000600260045460ff166002811115610a2057610a206135d5565b1480610a515750600160045460ff166002811115610a4057610a406135d5565b148015610a515750610a5133610811565b905080610a7357604051630fa0970d60e11b8152336004820152602401610993565b505b6109a9816000612216565b610a88612177565b6007546040516307f9220960e41b81523360048201526001600160a01b0390911690637f92209090602401602060405180830381865afa158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af49190613a62565b610b1157604051635d3da26d60e01b815260040160405180910390fd5b6000610b1f82840184613b31565b60075460408083015160808401516020015191516308f59d7960e21b81529394506000936001600160a01b03909316926323d675e492610b6b9291600401918252602082015260400190565b608060405180830381865afa158015610b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bac9190613bf9565b90506000806000610bc084606001516125b7565b915091508115610c2757604051633b9a04af60e11b81523090637734095e908390610bf19088908a90600401613d31565b600060405180830381600088803b158015610c0b57600080fd5b5087f193505050508015610c1d575060015b15610c2757600192505b82610c3557610c35856125e3565b8451604051428152841515918a917fc678724853e8a8ed1f6ed64e9efc05afa8c6826d63a2c42e33fbd4697ff458459060200160405180910390a45050505050505050565b610c826126b2565b6109ec6000612712565b333014610cac576040516328a2ea3b60e01b815260040160405180910390fd5b6000610cbe6060840160408501613573565b6001600160a01b031603610ce557604051630b24de4b60e01b815260040160405180910390fd5b6000610cf76060840160408501613573565b6001600160a01b0316634b15b2a9610d126080850185613d77565b60405160e083901b6001600160e01b031916815290356004820152306024820152600060448201526064016020604051808303816000875af1158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190613d97565b9050610dd2610d9436859003850185613db4565b833583610da76080870160608801613573565b610db46080880188613d77565b610dbd90613e14565b610dcd60c0890160a08a01613573565b61276b565b505050565b60058181548110610de757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610e0b612177565b610e136121bd565b333214610e8a576000600260045460ff166002811115610e3557610e356135d5565b1480610e665750600160045460ff166002811115610e5557610e556135d5565b148015610e665750610e6633610811565b905080610e8857604051630fa0970d60e11b8152336004820152602401610993565b505b46826080013503610eae5760405163785a29dd60e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610ed36060840160408501613573565b6001600160a01b0316148015610ef55750610ef16060830183613d77565b3534105b15610f1357604051637dd7aa2160e01b815260040160405180910390fd5b6000610f1f3447613e36565b600980549192506000610f3183613e49565b90915550506009546007549092506000906001600160a01b031663322f24323360808701358735610f6560608a018a613d77565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925260448301526020908101356064830152870135608482015260a40161016060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190613e62565b60608101519091506001600160a01b031661101c57604051630b24de4b60e01b815260040160405180910390fd5b600081606001516001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110849190613d97565b90506000806110c4868261109e60608b0160408c01613573565b866110ac60608d018d613d77565b6110b590613e14565b89602001518a60400151612934565b9150915060006110ea85608001518660a001518560018960c001518a6101000151611f58565b905061111060405180606001604052806000815260200160008152602001606081525090565b600061111f60c08b018b613f1b565b90509050806000036111905760405180606001604052808481526020016000815260200160006001600160401b0381111561115c5761115c61391d565b6040519080825280601f01601f191660200182016040528015611186576020820181803683370190505b509052915061121f565b60005b818110156111fc5760006111aa60c08d018d613f1b565b838181106111ba576111ba613f64565b90506020028101906111cc9190613d77565b6111d590613e14565b9050848160000151116111e95792506111fc565b50806111f481613e49565b915050611193565b50815160000361121f57604051637755fda760e01b815260040160405180910390fd5b60006112388860a0015189608001518560000151612bb7565b9050600061124c8960800151601284612bb7565b905088610100015161126d5761126d818a61012001518b6101400151612c1b565b61127c888a6060015184612085565b60006040518060c001604052808d8152602001336001600160a01b031681526020018e6020013581526020018e60a00160208101906112bb9190613573565b6001600160a01b0316815260200186815260200160006001600160a01b03168f60e00160208101906112ed9190613573565b6001600160a01b031614611313578e60e001602081019061130e9190613573565b611315565b335b6001600160a01b031690526040516113309190602001613f7a565b60408051601f1981840301815291905290506113578a8e836113528b34613e36565b612c5d565b6000611363848a613e36565b9050600081118015611381575060e08b01516001600160a01b031615155b15611395576113958a8c60e0015183612085565b6113a0308d33612dab565b6113bb8d8f856113b68f60800151601287612bb7565b612dd3565b5050505050505050505050506113d16001600355565b919050565b6113df33611cf6565b6113fc57604051637c3ea23f60e01b815260040160405180910390fd5b611404612177565b6109ec612e7b565b6000611416612177565b61141e6121bd565b333214611495576000600260045460ff166002811115611440576114406135d5565b14806114715750600160045460ff166002811115611460576114606135d5565b148015611471575061147133610811565b90508061149357604051630fa0970d60e11b8152336004820152602401610993565b505b6114a56040830160208401613573565b6001600160a01b03166114bb6020840184613573565b6001600160a01b0316036114e257604051633b0e2de560e21b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6115046020840184613573565b6001600160a01b031614801561152757506115226040830183613d77565b353414155b1561154557604051637dd7aa2160e01b815260040160405180910390fd5b60006115513447613e36565b60098054919250600061156383613e49565b90915550506009546007549092506000906001600160a01b031663f36dd64e336115906040880188613d77565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260200135602482015260440160a060405180830381865afa1580156115dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116019190613f8d565b9050600061164a8460016116186020890189613573565b61162860408a0160208b01613573565b61163560408b018b613d77565b61163e90613e14565b87516020890151612934565b5090506000806116606080880160608901613573565b6001600160a01b0316146116835761167e6080870160608801613573565b611685565b335b9050600061169e83600186604001518760800151612eb8565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6116c56040890160208a01613573565b6001600160a01b0316036116e2576116dd8282611ff7565b6116fc565b6116fc6116f56040890160208a01613573565b8383612085565b60006117088285613e36565b905080156117c25760608501516001600160a01b038116156117805773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61174960408b0160208c01613573565b6001600160a01b031603611766576117618183611ff7565b6117c0565b61176161177960408b0160208c01613573565b8284612085565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6117a560408b0160208c01613573565b6001600160a01b0316036117c0576117bd828861401b565b96505b505b6117cd308733612dab565b33877f64f803250cc450b9c5e2cef3ac4c82370f41b8c1e5692f4067b6b96d2430bfcb856117fe60208d018d613573565b61180e60408e0160208f01613573565b61181b60408f018f613d77565b604080516001600160a01b03958616815293851660208501529190931690820152903560608201526080810186905260a081018590524260c082015260e00160405180910390a35050505050506113d16001600355565b61187a6126b2565b6118936000805160206142f08339815191528383612f29565b604051811515906001600160a01b038416907fbe9474bb3e78da7e315cdffa5cfa30b767fcc95bbf44a6197da60228eea1028690600090a35050565b6118d833611cf6565b6118f557604051637c3ea23f60e01b815260040160405180910390fd5b6109b381612f50565b600046860361190f57506000611b5a565b6007546040516318fa0c2360e21b8152600481018990526000916001600160a01b0316906363e8308c90602401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d919061407d565b80519091506001600160a01b03166119a85760405163ba8ec24160e01b815260040160405180910390fd5b6000858103611a485781516040805160008152602081019091526001600160a01b039091169063aa4fc83d908a906119df90612fa3565b88886040518563ffffffff1660e01b8152600401611a009493929190614099565b602060405180830381865afa158015611a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a419190613a49565b9050611b56565b60005b86811015611b54576000611ab6898984818110611a6a57611a6a613f64565b9050602002810190611a7c91906140e6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fa392505050565b9050600084600001516001600160a01b031663aa4fc83d8c848b8b6040518563ffffffff1660e01b8152600401611af09493929190614099565b602060405180830381865afa158015611b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b319190613a49565b905083811115611b3f578093505b50508080611b4c90613e49565b915050611a4b565b505b9150505b9695505050505050565b611b6d33611cf6565b611b8a57604051637c3ea23f60e01b815260040160405180910390fd5b611ba46000805160206142f0833981519152336000612f29565b60405133907f6cc2c67081f55c2fffb7c008fa995fbbf890f48c7c16fba93d8220f00dc84cc590600090a2565b606061080c6000805160206142f0833981519152613037565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601611c18575047919050565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015611c5c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090c9190613a49565b611c886126b2565b6001600160a01b038116611ced5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610993565b6109b381612712565b6001600160a01b03811660009081527f260b29b219d450563ddb0e5ca806bdadb1e125f7e8c506de0443797dd7122728602052604081205460ff1661090c565b600754604051631a5a276d60e31b815233600482015260009182916001600160a01b039091169063d2d13b68906024016040805180830381865afa158015611d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da6919061412c565b9050611dbc848483600001518460200151612eb8565b949350505050565b611dcd33611cf6565b611dea57604051637c3ea23f60e01b815260040160405180910390fd5b6004805482919060ff19166001836002811115611e0957611e096135d5565b0217905550806002811115611e2057611e206135d5565b6040517f332a9f1d3bd9b0f7abbd95838fed6b417589632d0eb33f2d8ae6e2aa17178efd90600090a250565b611e5533611cf6565b611e7257604051637c3ea23f60e01b815260040160405180910390fd5b60005b81811015610dd25736838383818110611e9057611e90613f64565b9050604002019050806020016020810190611eab9190614181565b15611ec557611ec5611ec06020830183613573565b6130a3565b611ef060056006611ed96020850185613573565b611ee96040860160208701614181565b60646130d6565b50611f016040820160208301614181565b1515611f106020830183613573565b6001600160a01b03167f1470aed653fa8a8ce4c7b2f41287634199f7ec3c4f5fd0ace97d82cf006beec360405160405180910390a35080611f5081613e49565b915050611e75565b6000808280611f65575083155b90506000851580611f735750815b611f9e57620186a0611f858682613e36565b611f8f908961419e565b611f9991906141b5565b611fa0565b865b90506000611faf8a8a84612bb7565b90508680611fba5750825b611fe757611fcb86620186a0613e36565b611fd8620186a08361419e565b611fe291906141b5565b611fe9565b805b9a9950505050505050505050565b604080516000808252602082019092526001600160a01b03841690839060405161202191906141d7565b60006040518083038185875af1925050503d806000811461205e576040519150601f19603f3d011682016040523d82523d6000602084013e612063565b606091505b5050905080610dd257604051632e05b05360e21b815260040160405180910390fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916120e191906141d7565b6000604051808303816000865af19150503d806000811461211e576040519150601f19603f3d011682016040523d82523d6000602084013e612123565b606091505b5091509150600082801561214f57508151158061214f57508180602001905181019061214f9190613a62565b90508061216f57604051632fdb1b7f60e11b815260040160405180910390fd5b505050505050565b60005460ff16156109ec5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610993565b60026003540361220f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610993565b6002600355565b60075460405163154d267d60e21b8152600481018490526000916001600160a01b03169063553499f490602401602060405180830381865afa158015612260573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612284919061407d565b80519091506001600160a01b03166122af57604051630b24de4b60e01b815260040160405180910390fd5b600854604051638758e33960e01b8152336004820152602481018590526000916001600160a01b031690638758e33990604401602060405180830381865afa1580156122ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123239190613a49565b6008546040516227421b60e61b8152336004820152602481018790529192506001600160a01b0316906309d086c090604401600060405180830381600087803b15801561236f57600080fd5b505af1158015612383573d6000803e3d6000fd5b505050506000811115612516578215612417578151604051634b15b2a960e01b815260048101839052336024820152600160448201526001600160a01b0390911690634b15b2a9906064016020604051808303816000875af11580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190613d97565b50612516565b600082600001516001600160a01b0316632c966a346040518163ffffffff1660e01b8152600401602060405180830381865afa15801561245b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247f9190613d97565b6040516340c10f1960e01b8152336004820152602481018490529091506000906001600160a01b038316906340c10f19906044016020604051808303816000875af11580156124d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f69190613a62565b90508061216f576040516320aaed5f60e21b815260040160405180910390fd5b50505050565b60005460ff166109ec5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610993565b61256d61251c565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60008060005a9050838110159250826125d15760006125db565b6125db8482613e36565b915050915091565b60a08101516040808301516080840151516008549251631e9f7a9b60e01b81526001600160a01b03808616600483015260248201849052604482018390529293919290911690631e9f7a9b90606401600060405180830381600087803b15801561264c57600080fd5b505af1158015612660573d6000803e3d6000fd5b5050855160408051868152602081018690526001600160a01b03881694509192507fb9e12bbbbed208a973bc1ec9604e1f6d7f4b91b193fc2e1150df974b7d16635b910160405180910390a350505050565b6000546001600160a01b036101009091041633146109ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610993565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b6000846001600160a01b0316846001600160a01b03160361278e57508151612885565b86516001600160a01b03166127b65760405163ebb12eb360e01b815260040160405180910390fd5b60006127c185611bea565b90506127d686896020015186600001516130f9565b600088600001516001600160a01b031685604001516040516127f891906141d7565b6000604051808303816000865af19150503d8060008114612835576040519150601f19603f3d011682016040523d82523d6000602084013e61283a565b606091505b505090508061285c57604051633e1f5ce560e11b815260040160405180910390fd5b61286c878a6020015160006130f9565b8161287687611bea565b6128809190613e36565b925050505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038516016128b9576128b48282611ff7565b6128c4565b6128c4848383612085565b6020808401518451604080519283526001600160a01b0389811694840194909452878416908301526060820152608081018390529083169087907f26e7a43f3221294fff6b57719103b3bfdeb1c06dac5c3973de3e55932e7c1b3b9060a00160405180910390a350505050505050565b600080600061294287611bea565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03891601612a21576001600160a01b0385166129905760405163ebb12eb360e01b815260040160405180910390fd5b6000856001600160a01b0316876000015188604001516040516129b391906141d7565b60006040518083038185875af1925050503d80600081146129f0576040519150601f19603f3d011682016040523d82523d6000602084013e6129f5565b606091505b5050905080612a1757604051633e1f5ce560e11b815260040160405180910390fd5b5085519150612b15565b612a3188333089600001516131e3565b866001600160a01b0316886001600160a01b031614612b10576001600160a01b038516612a715760405163ebb12eb360e01b815260040160405180910390fd5b612a80888588600001516130f9565b6000856001600160a01b03168760400151604051612a9e91906141d7565b6000604051808303816000865af19150503d8060008114612adb576040519150601f19603f3d011682016040523d82523d6000602084013e612ae0565b606091505b5050905080612b0257604051633e1f5ce560e11b815260040160405180910390fd5b612b0e898660006130f9565b505b600091505b80612b1f88611bea565b612b299190613e36565b9250336001600160a01b03168915158b7f580273492d266e8e27b4253a13c46e1c74823e94794f9ad186ca8fe8b109e3ef89602001518c8c8c600001518a604051612ba29594939291909485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b60405180910390a45097509795505050505050565b6000838303612bc7575080612c14565b83831115612bf557612bd98484613e36565b612be490600a6142cd565b612bee908361419e565b9050612c14565b612bff8385613e36565b612c0a90600a6142cd565b612bee90836141b5565b9392505050565b81831015612c3c57604051632220ee1360e11b815260040160405180910390fd5b80831115610dd25760405163341cc20160e21b815260040160405180910390fd5b83516001600160a01b0316612c855760405163ba8ec24160e01b815260040160405180910390fd5b83516000906001600160a01b031663aa4fc83d608086013585612cac6101008901896140e6565b6040518563ffffffff1660e01b8152600401612ccb9493929190614099565b602060405180830381865afa158015612ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0c9190613a49565b905080821015612d2e57604051625a4bb360e21b815260040160405180910390fd5b84516001600160a01b0316636ea9cec982608087013586612d536101008a018a6140e6565b6040518663ffffffff1660e01b8152600401612d729493929190614099565b6000604051808303818588803b158015612d8b57600080fd5b505af1158015612d9f573d6000803e3d6000fd5b50505050505050505050565b6000612dc1836001600160a01b03861631613e36565b90508015612516576125168282611ff7565b336080840135857fc2ad425216cf8ac56ecd38af0315ed35266cb6771f34fc27e1f0cde1a5b3eb6a612e0c610100880160e08901613573565b8735612e1e60608a0160408b01613573565b612e2e60c08b0160a08c01613573565b604080516001600160a01b03958616815260208101949094529184168383015290921660608201526080810188905260a081018790524260c082015290519081900360e00190a450505050565b612e83612177565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861259a3390565b60008180612ec4575082155b15612ed0575083611dbc565b83612efe57612ee283620186a0613e36565b612eef620186a08761419e565b612ef991906141b5565b612f20565b620186a0612f0c8482613e36565b612f16908761419e565b612f2091906141b5565b95945050505050565b600083815260016020908152604080832060029092529091206125169190848460646130d6565b612f59816130a3565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f278c70ced5f3e0e5eeb385b5ff9cb735748ba00a625147e66065ed48fc1562cd90600090a250565b606060006040518060c001604052806000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016040518060600160405280600081526020016000815260200186815250815260200160006001600160a01b03168152506040516020016130209190613f7a565b60408051601f198184030181529190529392505050565b60008181526001602090815260409182902080548351818402810184019094528084526060939283018282801561309757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613079575b50505050509050919050565b6001600160a01b0381163b6109b357604051638c50d7cd60e01b81526001600160a01b0382166004820152602401610993565b6000826130ed576130e88686866132de565b611b5a565b611b5a86868685613406565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b179052915160009283929087169161315591906141d7565b6000604051808303816000865af19150503d8060008114613192576040519150601f19603f3d011682016040523d82523d6000602084013e613197565b606091505b509150915060008280156131c35750815115806131c35750818060200190518101906131c39190613a62565b90508061216f5760405163b45d44e760e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161324791906141d7565b6000604051808303816000865af19150503d8060008114613284576040519150601f19603f3d011682016040523d82523d6000602084013e613289565b606091505b509150915060008280156132b55750815115806132b55750818060200190518101906132b59190613a62565b9050806132d557604051632d9d5b4160e01b815260040160405180910390fd5b50505050505050565b6001600160a01b0381166000908152602083905260409020805460ff169081156133fe57600180820154865490916000916133199190613e36565b90508082146133a657600087828154811061333657613336613f64565b9060005260206000200160009054906101000a90046001600160a01b031690508088848154811061336957613369613f64565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290879052604090206001018290555b868054806133b6576133b66142d9565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825287905260408120805460ff191681556001015550505b509392505050565b6001600160a01b03821660009081526020849052604090205460ff16158015611dbc578454821161344a5760405163b1655e3360e01b815260040160405180910390fd5b6040805180820182526001808252875460208084019182526001600160a01b039790971660008181529888529388209251835460ff19169015151783555191810191909155865490810187559585529290932090930180546001600160a01b0319169091179055919050565b6020808252825182820181905260009190848201906040850190845b818110156134f75783516001600160a01b0316835292840192918401916001016134d2565b50909695505050505050565b80151581146109b357600080fd5b600080600080600060a0868803121561352957600080fd5b85359450602086013593506040860135925060608601359150608086013561355081613503565b809150509295509295909350565b6001600160a01b03811681146109b357600080fd5b60006020828403121561358557600080fd5b8135612c148161355e565b600080604083850312156135a357600080fd5b82356135ae8161355e565b946020939093013593505050565b6000602082840312156135ce57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061360d57634e487b7160e01b600052602160045260246000fd5b91905290565b60008083601f84011261362557600080fd5b5081356001600160401b0381111561363c57600080fd5b60208301915083602082850101111561365457600080fd5b9250929050565b60008060006040848603121561367057600080fd5b8335925060208401356001600160401b0381111561368d57600080fd5b61369986828701613613565b9497909650939450505050565b6000608082840312156136b857600080fd5b50919050565b60008060a083850312156136d157600080fd5b6136db84846136a6565b915060808301356001600160401b038111156136f657600080fd5b830160c0818603121561370857600080fd5b809150509250929050565b60006020828403121561372557600080fd5b81356001600160401b0381111561373b57600080fd5b82016101208185031215612c1457600080fd5b60006020828403121561376057600080fd5b81356001600160401b0381111561377657600080fd5b611dbc848285016136a6565b6000806040838503121561379557600080fd5b82356137a08161355e565b9150602083013561370881613503565b600080600080600080608087890312156137c957600080fd5b863595506020870135945060408701356001600160401b03808211156137ee57600080fd5b818901915089601f83011261380257600080fd5b81358181111561381157600080fd5b8a60208260051b850101111561382657600080fd5b60208301965080955050606089013591508082111561384457600080fd5b5061385189828a01613613565b979a9699509497509295939492505050565b6000806040838503121561387657600080fd5b82359150602083013561370881613503565b60006020828403121561389a57600080fd5b813560038110612c1457600080fd5b600080602083850312156138bc57600080fd5b82356001600160401b03808211156138d357600080fd5b818501915085601f8301126138e757600080fd5b8135818111156138f657600080fd5b8660208260061b850101111561390b57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156139555761395561391d565b60405290565b604051606081016001600160401b03811182821017156139555761395561391d565b60405160c081016001600160401b03811182821017156139555761395561391d565b60405161016081016001600160401b03811182821017156139555761395561391d565b604051601f8201601f191681016001600160401b03811182821017156139ea576139ea61391d565b604052919050565b80516113d181613503565b600060808284031215613a0f57600080fd5b613a17613933565b8251815260208301516020820152604083015160408201526060830151613a3d81613503565b60608201529392505050565b600060208284031215613a5b57600080fd5b5051919050565b600060208284031215613a7457600080fd5b8151612c1481613503565b600060608284031215613a9157600080fd5b613a9961395b565b9050813581526020808301358183015260408301356001600160401b0380821115613ac357600080fd5b818501915085601f830112613ad757600080fd5b813581811115613ae957613ae961391d565b613afb601f8201601f191685016139c2565b91508082528684828501011115613b1157600080fd5b808484018584013760008482840101525080604085015250505092915050565b600060208284031215613b4357600080fd5b81356001600160401b0380821115613b5a57600080fd5b9083019060c08286031215613b6e57600080fd5b613b7661397d565b823581526020830135613b888161355e565b6020820152604083810135908201526060830135613ba58161355e565b6060820152608083013582811115613bbc57600080fd5b613bc887828601613a7f565b60808301525060a08301359250613bde8361355e565b60a0810192909252509392505050565b80516113d18161355e565b600060808284031215613c0b57600080fd5b613c13613933565b8251613c1e8161355e565b81526020830151613c2e8161355e565b60208201526040830151613c418161355e565b60408201526060928301519281019290925250919050565b60005b83811015613c74578181015183820152602001613c5c565b50506000910152565b60008151808452613c95816020860160208601613c59565b601f01601f19169290920160200192915050565b805182526000602082015160018060a01b038082166020860152604084015160408601528060608501511660608601525050608082015160c06080850152805160c0850152602081015160e0850152604081015190506060610100850152613d15610120850182613c7d565b905060a08301516133fe60a08601826001600160a01b03169052565b600060018060a01b03808551168352806020860151166020840152806040860151166040840152506060840151606083015260a06080830152611dbc60a0830184613ca9565b60008235605e19833603018112613d8d57600080fd5b9190910192915050565b600060208284031215613da957600080fd5b8151612c148161355e565b600060808284031215613dc657600080fd5b613dce613933565b8235613dd98161355e565b81526020830135613de98161355e565b60208201526040830135613dfc8161355e565b60408201526060928301359281019290925250919050565b600061090c3683613a7f565b634e487b7160e01b600052601160045260246000fd5b8181038181111561090c5761090c613e20565b600060018201613e5b57613e5b613e20565b5060010190565b60006101608284031215613e7557600080fd5b613e7d61399f565b613e8683613bee565b8152613e9460208401613bee565b6020820152613ea560408401613bee565b6040820152613eb660608401613bee565b60608201526080830151608082015260a083015160a082015260c083015160c0820152613ee560e08401613bee565b60e0820152610100613ef88185016139f2565b908201526101208381015190820152610140928301519281019290925250919050565b6000808335601e19843603018112613f3257600080fd5b8301803591506001600160401b03821115613f4c57600080fd5b6020019150600581901b360382131561365457600080fd5b634e487b7160e01b600052603260045260246000fd5b6020815260006109096020830184613ca9565b600060a08284031215613f9f57600080fd5b60405160a081018181106001600160401b0382111715613fc157613fc161391d565b6040528251613fcf8161355e565b81526020830151613fdf8161355e565b6020820152604083810151908201526060830151613ffc8161355e565b6060820152608083015161400f81613503565b60808201529392505050565b8082018082111561090c5761090c613e20565b60006020828403121561404057600080fd5b604051602081018181106001600160401b03821117156140625761406261391d565b806040525080915082516140758161355e565b905292915050565b60006020828403121561408f57600080fd5b610909838361402e565b8481526060602082015260006140b26060830186613c7d565b8281036040840152838152838560208301376000602085830101526020601f19601f86011682010191505095945050505050565b6000808335601e198436030181126140fd57600080fd5b8301803591506001600160401b0382111561411757600080fd5b60200191503681900382131561365457600080fd5b60006040828403121561413e57600080fd5b604051604081018181106001600160401b03821117156141605761416061391d565b60405282518152602083015161417581613503565b60208201529392505050565b60006020828403121561419357600080fd5b8135612c1481613503565b808202811582820484141761090c5761090c613e20565b6000826141d257634e487b7160e01b600052601260045260246000fd5b500490565b60008251613d8d818460208701613c59565b600181815b8085111561422457816000190482111561420a5761420a613e20565b8085161561421757918102915b93841c93908002906141ee565b509250929050565b60008261423b5750600161090c565b816142485750600061090c565b816001811461425e576002811461426857614284565b600191505061090c565b60ff84111561427957614279613e20565b50506001821b61090c565b5060208310610133831016604e8410600b84101617156142a7575081810a61090c565b6142b183836141e9565b80600019048211156142c5576142c5613e20565b029392505050565b6000610909838361422c565b634e487b7160e01b600052603160045260246000fdfe6d439300980e333f0256d64be2c9f67e86f4493ce25f82498d6db7f4be3d9e6fa2646970667358221220c2aa62716ef10870fee4e652113ad4145dcfcad716e81c0c1526fa3788708ad664736f6c63430008130033

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

000000000000000000000000f19ea8e63256992a823262c71568b0bb27ce146f000000000000000000000000bfc3b856b9bcc792875e79fc8ffcc09028aad40600000000000000000000000000000000000000000000000000000000000001f400000000000000000000000072e28c7f34100afefc399fcc0ae041b8fe5841ae00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f35dc3505b2b150369bb267ca48a8eac36b9217c

-----Decoded View---------------
Arg [0] : _registry (address): 0xF19EA8e63256992a823262C71568b0bb27cE146f
Arg [1] : _variableBalanceRecords (address): 0xbFc3b856b9BCC792875E79Fc8FFcc09028AAD406
Arg [2] : _actionIdOffset (uint256): 500
Arg [3] : _owner (address): 0x72E28c7F34100AfefC399fcc0AE041B8fe5841AE
Arg [4] : _managers (address[]): 0xF35dC3505B2b150369BB267ca48a8eAC36B9217c
Arg [5] : _addOwnerToManagers (bool): True

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000f19ea8e63256992a823262c71568b0bb27ce146f
Arg [1] : 000000000000000000000000bfc3b856b9bcc792875e79fc8ffcc09028aad406
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [3] : 00000000000000000000000072e28c7f34100afefc399fcc0ae041b8fe5841ae
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [7] : 000000000000000000000000f35dc3505b2b150369bb267ca48a8eac36b9217c


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Interport allows most efficient crosschain trades via all supported networks.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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