More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 50,245 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Single Direct Si... | 61613835 | 1 min ago | IN | 0 POL | 0.02743554 | ||||
Single Direct Si... | 61613792 | 3 mins ago | IN | 0 POL | 0.03714315 | ||||
Single X Chain S... | 61613502 | 14 mins ago | IN | 1.31156481 POL | 0.03172757 | ||||
Single X Chain S... | 61613468 | 16 mins ago | IN | 1.31163768 POL | 0.03330447 | ||||
Single Direct Si... | 61610675 | 1 hr ago | IN | 0 POL | 0.02938792 | ||||
Single Direct Si... | 61610555 | 1 hr ago | IN | 0 POL | 0.01009613 | ||||
Single Direct Si... | 61610480 | 2 hrs ago | IN | 0 POL | 0.01823318 | ||||
Single Direct Si... | 61610458 | 2 hrs ago | IN | 0 POL | 0.0120296 | ||||
Single Direct Si... | 61609858 | 2 hrs ago | IN | 0.001 POL | 0.02209822 | ||||
Single Direct Si... | 61609810 | 2 hrs ago | IN | 0 POL | 0.02293077 | ||||
Single Direct Si... | 61609742 | 2 hrs ago | IN | 0 POL | 0.00972892 | ||||
Single X Chain S... | 61608581 | 3 hrs ago | IN | 3.44255302 POL | 0.07403643 | ||||
Single Direct Si... | 61608405 | 3 hrs ago | IN | 0 POL | 0.02315146 | ||||
Single X Chain S... | 61607736 | 3 hrs ago | IN | 0.85119495 POL | 0.02914888 | ||||
Single Direct Si... | 61607266 | 3 hrs ago | IN | 0 POL | 0.05091835 | ||||
Single Direct Si... | 61606159 | 4 hrs ago | IN | 0 POL | 0.01032071 | ||||
Single Direct Si... | 61606031 | 4 hrs ago | IN | 0 POL | 0.00975324 | ||||
Single Direct Si... | 61605970 | 4 hrs ago | IN | 0 POL | 0.02237139 | ||||
Single X Chain S... | 61605525 | 5 hrs ago | IN | 1.7229796 POL | 0.02488215 | ||||
Single X Chain S... | 61605397 | 5 hrs ago | IN | 0.82470903 POL | 0.02421978 | ||||
Single X Chain S... | 61604591 | 5 hrs ago | IN | 0.2433016 POL | 0.02639909 | ||||
Single X Chain S... | 61604292 | 5 hrs ago | IN | 0.8219777 POL | 0.0237795 | ||||
Single X Chain S... | 61603907 | 5 hrs ago | IN | 0.82197429 POL | 0.02378022 | ||||
Single X Chain S... | 61603473 | 6 hrs ago | IN | 2.54824202 POL | 0.03283548 | ||||
Single Direct Si... | 61602702 | 6 hrs ago | IN | 0 POL | 0.01598862 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
61613502 | 14 mins ago | 0.18534295 POL | ||||
61613502 | 14 mins ago | 1.12622185 POL | ||||
61613468 | 16 mins ago | 0.18541583 POL | ||||
61613468 | 16 mins ago | 1.12622185 POL | ||||
61609858 | 2 hrs ago | 0.001 POL | ||||
61608581 | 3 hrs ago | 1.40718452 POL | ||||
61608581 | 3 hrs ago | 1.12202378 POL | ||||
61608581 | 3 hrs ago | 0.91334471 POL | ||||
61607736 | 3 hrs ago | 0.05368235 POL | ||||
61607736 | 3 hrs ago | 0.7975126 POL | ||||
61605525 | 5 hrs ago | 0.18503885 POL | ||||
61605525 | 5 hrs ago | 1.53794075 POL | ||||
61605397 | 5 hrs ago | 0.03674184 POL | ||||
61605397 | 5 hrs ago | 0.78796719 POL | ||||
61604591 | 5 hrs ago | 0.01757787 POL | ||||
61604591 | 5 hrs ago | 0.22572372 POL | ||||
61604292 | 5 hrs ago | 0.03679595 POL | ||||
61604292 | 5 hrs ago | 0.78518174 POL | ||||
61603907 | 5 hrs ago | 0.03679254 POL | ||||
61603907 | 5 hrs ago | 0.78518174 POL | ||||
61603473 | 6 hrs ago | 0.79611982 POL | ||||
61603473 | 6 hrs ago | 1.7521222 POL | ||||
61602112 | 7 hrs ago | 0.18513842 POL | ||||
61602112 | 7 hrs ago | 1.53649954 POL | ||||
61602081 | 7 hrs ago | 0.03673025 POL |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
SuperformRouter
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { BaseRouterImplementation } from "src/BaseRouterImplementation.sol"; import { BaseRouter } from "src/BaseRouter.sol"; import { IBaseRouter } from "src/interfaces/IBaseRouter.sol"; import { SingleDirectSingleVaultStateReq, SingleXChainSingleVaultStateReq, SingleDirectMultiVaultStateReq, SingleXChainMultiVaultStateReq, MultiDstSingleVaultStateReq, MultiDstMultiVaultStateReq } from "src/types/DataTypes.sol"; /// @title SuperformRouter /// @dev Routes funds and action information to a remote execution chain /// @author Zeropoint Labs contract SuperformRouter is BaseRouterImplementation { ////////////////////////////////////////////////////////////// // CONSTRUCTOR // ////////////////////////////////////////////////////////////// /// @param superRegistry_ the superform registry contract constructor(address superRegistry_) BaseRouterImplementation(superRegistry_) { } ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @inheritdoc IBaseRouter function singleDirectSingleVaultDeposit(SingleDirectSingleVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleDirectSingleVaultDeposit(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleXChainSingleVaultDeposit(SingleXChainSingleVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleXChainSingleVaultDeposit(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleDirectMultiVaultDeposit(SingleDirectMultiVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleDirectMultiVaultDeposit(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleXChainMultiVaultDeposit(SingleXChainMultiVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleXChainMultiVaultDeposit(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function multiDstSingleVaultDeposit(MultiDstSingleVaultStateReq calldata req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; uint256 len = req_.dstChainIds.length; for (uint256 i; i < len; ++i) { if (CHAIN_ID == req_.dstChainIds[i]) { _singleDirectSingleVaultDeposit(SingleDirectSingleVaultStateReq(req_.superformsData[i])); } else { _singleXChainSingleVaultDeposit( SingleXChainSingleVaultStateReq(req_.ambIds[i], req_.dstChainIds[i], req_.superformsData[i]) ); } } _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function multiDstMultiVaultDeposit(MultiDstMultiVaultStateReq calldata req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; uint256 len = req_.dstChainIds.length; for (uint256 i; i < len; ++i) { if (CHAIN_ID == req_.dstChainIds[i]) { _singleDirectMultiVaultDeposit(SingleDirectMultiVaultStateReq(req_.superformsData[i])); } else { _singleXChainMultiVaultDeposit( SingleXChainMultiVaultStateReq(req_.ambIds[i], req_.dstChainIds[i], req_.superformsData[i]) ); } } _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleDirectSingleVaultWithdraw(SingleDirectSingleVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleDirectSingleVaultWithdraw(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleXChainSingleVaultWithdraw(SingleXChainSingleVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleXChainSingleVaultWithdraw(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleDirectMultiVaultWithdraw(SingleDirectMultiVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleDirectMultiVaultWithdraw(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function singleXChainMultiVaultWithdraw(SingleXChainMultiVaultStateReq memory req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; _singleXChainMultiVaultWithdraw(req_); _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function multiDstSingleVaultWithdraw(MultiDstSingleVaultStateReq calldata req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; uint256 len = req_.dstChainIds.length; for (uint256 i; i < len; ++i) { if (CHAIN_ID == req_.dstChainIds[i]) { _singleDirectSingleVaultWithdraw(SingleDirectSingleVaultStateReq(req_.superformsData[i])); } else { _singleXChainSingleVaultWithdraw( SingleXChainSingleVaultStateReq(req_.ambIds[i], req_.dstChainIds[i], req_.superformsData[i]) ); } } _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function multiDstMultiVaultWithdraw(MultiDstMultiVaultStateReq calldata req_) external payable override(BaseRouter, IBaseRouter) { uint256 balanceBefore = address(this).balance - msg.value; uint256 len = req_.dstChainIds.length; for (uint256 i; i < len; ++i) { if (CHAIN_ID == req_.dstChainIds[i]) { _singleDirectMultiVaultWithdraw(SingleDirectMultiVaultStateReq(req_.superformsData[i])); } else { _singleXChainMultiVaultWithdraw( SingleXChainMultiVaultStateReq(req_.ambIds[i], req_.dstChainIds[i], req_.superformsData[i]) ); } } _forwardPayment(balanceBefore); } /// @inheritdoc IBaseRouter function forwardDustToPaymaster(address token_) external override(BaseRouter, IBaseRouter) { _forwardDustToPaymaster(token_); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { BaseRouter } from "src/BaseRouter.sol"; import { IBaseRouterImplementation } from "src/interfaces/IBaseRouterImplementation.sol"; import { IBaseStateRegistry } from "src/interfaces/IBaseStateRegistry.sol"; import { IPayMaster } from "src/interfaces/IPayMaster.sol"; import { IPaymentHelper } from "src/interfaces/IPaymentHelper.sol"; import { ISuperformFactory } from "src/interfaces/ISuperformFactory.sol"; import { IBaseForm } from "src/interfaces/IBaseForm.sol"; import { IBridgeValidator } from "src/interfaces/IBridgeValidator.sol"; import { ISuperPositions } from "src/interfaces/ISuperPositions.sol"; import { DataLib } from "src/libraries/DataLib.sol"; import { Error } from "src/libraries/Error.sol"; import { IPermit2 } from "src/vendor/dragonfly-xyz/IPermit2.sol"; import { LiquidityHandler } from "src/crosschain-liquidity/LiquidityHandler.sol"; import { SingleDirectSingleVaultStateReq, SingleXChainSingleVaultStateReq, SingleDirectMultiVaultStateReq, SingleXChainMultiVaultStateReq, MultiDstSingleVaultStateReq, MultiDstMultiVaultStateReq, LiqRequest, InitSingleVaultData, InitMultiVaultData, MultiVaultSFData, SingleVaultSFData, AMBMessage, CallbackType, TransactionType } from "src/types/DataTypes.sol"; import { IERC20 } from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import { IERC1155Receiver } from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol"; import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { IERC1155Errors } from "openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol"; /// @title BaseRouterImplementation /// @dev Extends BaseRouter with standard internal execution functions /// @author Zeropoint Labs abstract contract BaseRouterImplementation is IBaseRouterImplementation, BaseRouter, LiquidityHandler { using SafeERC20 for IERC20; using DataLib for uint256; ////////////////////////////////////////////////////////////// // STATE VARIABLES // ////////////////////////////////////////////////////////////// /// @dev tracks the total payloads uint256 public payloadIds; uint256 internal constant ENTIRE_SLIPPAGE = 10_000; ////////////////////////////////////////////////////////////// // STRUCTS // ////////////////////////////////////////////////////////////// struct ValidateAndDispatchTokensArgs { LiqRequest liqRequest; address superform; uint64 srcChainId; uint64 dstChainId; address srcSender; bool deposit; } struct DirectDepositArgs { address superform; uint256 payloadId; uint256 superformId; uint256 amount; uint256 outputAmount; uint256 maxSlippage; bool retain4626; LiqRequest liqData; address receiverAddress; bytes extraFormData; uint256 msgValue; address srcSender; } struct SingleDepositLocalVars { address superform; uint256 shares; } struct SingleDepositArgs { address srcSender; bytes permit2data; address receiverAddressSP; InitSingleVaultData vaultData; } struct MultiDepositLocalVars { uint256 len; address[] superforms; uint256[] shares; bool[] mints; } struct MultiDepositArgs { address srcSender; bytes permit2data; address receiverAddressSP; InitMultiVaultData vaultData; } struct SingleTokenForwardLocalVars { IERC20 token; uint256 txDataLength; uint256 totalAmount; uint256 amountIn; uint8 bridgeId; address permit2; } struct MultiTokenForwardLocalVars { IERC20 token; uint256 len; uint256 totalAmount; uint256 permit2dataLen; uint256 targetLen; uint256[] amountsIn; uint8[] bridgeIds; address permit2; } ////////////////////////////////////////////////////////////// // CONSTRUCTOR // ////////////////////////////////////////////////////////////// /// @param superRegistry_ the superform registry contract constructor(address superRegistry_) BaseRouter(superRegistry_) { } ////////////////////////////////////////////////////////////// // CORE INTERNAL FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev getter for PERMIT2 in case it is not supported or set on a given chain function _getPermit2() internal view returns (address) { return superRegistry.PERMIT2(); } /// @dev returns the address from super registry function _getAddress(bytes32 id_) internal view returns (address) { return superRegistry.getAddress(id_); } /// @dev handles same-chain single vault deposit function _singleDirectSingleVaultDeposit(SingleDirectSingleVaultStateReq memory req_) internal virtual { /// @dev validate superformData if ( !_validateSuperformData( req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.receiverAddress, req_.superformData.receiverAddressSP, CHAIN_ID, true, ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY"))), false ) ) { revert Error.INVALID_SUPERFORMS_DATA(); } InitSingleVaultData memory vaultData = InitSingleVaultData( 0, req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.liqRequest, false, req_.superformData.retain4626, req_.superformData.receiverAddress, req_.superformData.extraFormData ); /// @dev same chain action & forward residual payment to Paymaster _directSingleDeposit( SingleDepositArgs( msg.sender, req_.superformData.permit2data, req_.superformData.receiverAddressSP, vaultData ) ); emit Completed(); } /// @dev handles cross-chain single vault deposit function _singleXChainSingleVaultDeposit(SingleXChainSingleVaultStateReq memory req_) internal virtual { /// @dev validate the action ActionLocalVars memory vars; vars.srcChainId = CHAIN_ID; if (vars.srcChainId == req_.dstChainId) revert Error.INVALID_ACTION(); /// @dev validate superformData if ( !_validateSuperformData( req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.receiverAddress, req_.superformData.receiverAddressSP, req_.dstChainId, true, ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY"))), false ) ) { revert Error.INVALID_SUPERFORMS_DATA(); } vars.currentPayloadId = ++payloadIds; InitSingleVaultData memory ambData = InitSingleVaultData( vars.currentPayloadId, req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.liqRequest, req_.superformData.hasDstSwap, req_.superformData.retain4626, req_.superformData.receiverAddress, req_.superformData.extraFormData ); (address superform,,) = req_.superformData.superformId.getSuperform(); (uint256 amountIn, uint8 bridgeId) = _singleVaultTokenForward(msg.sender, address(0), req_.superformData.permit2data, ambData, true); LiqRequest memory emptyRequest; /// @dev dispatch liquidity data if ( _validateAndDispatchTokens( ValidateAndDispatchTokensArgs( req_.superformData.liqRequest, superform, vars.srcChainId, req_.dstChainId, msg.sender, true ) ) ) emptyRequest.interimToken = req_.superformData.liqRequest.interimToken; /// @dev overrides user set liqData to just contain interimToken in case there is a dstSwap /// @dev this information is needed in case the dstSwap fails so that we can validate the interimToken in /// DstSwapper.sol on destination ambData.liqData = emptyRequest; uint256[] memory superformIds = new uint256[](1); superformIds[0] = req_.superformData.superformId; /// @dev dispatch message information, notice multiVaults is set to 0 _dispatchAmbMessage( DispatchAMBMessageVars( TransactionType.DEPOSIT, abi.encode(ambData), superformIds, msg.sender, req_.ambIds, 0, vars.srcChainId, req_.dstChainId, vars.currentPayloadId ), req_.superformData.receiverAddressSP ); emit CrossChainInitiatedDepositSingle( vars.currentPayloadId, req_.dstChainId, req_.superformData.superformId, amountIn, bridgeId, req_.ambIds ); } /// @dev handles same-chain multi vault deposit function _singleDirectMultiVaultDeposit(SingleDirectMultiVaultStateReq memory req_) internal virtual { /// @dev validate superformData if (!_validateSuperformsData(req_.superformData, CHAIN_ID, true)) { revert Error.INVALID_SUPERFORMS_DATA(); } InitMultiVaultData memory vaultData = InitMultiVaultData( 0, req_.superformData.superformIds, req_.superformData.amounts, req_.superformData.outputAmounts, req_.superformData.maxSlippages, req_.superformData.liqRequests, new bool[](req_.superformData.amounts.length), req_.superformData.retain4626s, req_.superformData.receiverAddress, req_.superformData.extraFormData ); /// @dev same chain action & forward residual payment to Paymaster _directMultiDeposit( MultiDepositArgs( msg.sender, req_.superformData.permit2data, req_.superformData.receiverAddressSP, vaultData ) ); emit Completed(); } /// @dev handles cross-chain multi vault deposit function _singleXChainMultiVaultDeposit(SingleXChainMultiVaultStateReq memory req_) internal virtual { /// @dev validate the action ActionLocalVars memory vars; vars.srcChainId = CHAIN_ID; if (vars.srcChainId == req_.dstChainId) revert Error.INVALID_ACTION(); /// @dev validate superformsData if (!_validateSuperformsData(req_.superformsData, req_.dstChainId, true)) { revert Error.INVALID_SUPERFORMS_DATA(); } vars.currentPayloadId = ++payloadIds; InitMultiVaultData memory ambData = InitMultiVaultData( vars.currentPayloadId, req_.superformsData.superformIds, req_.superformsData.amounts, req_.superformsData.outputAmounts, req_.superformsData.maxSlippages, req_.superformsData.liqRequests, req_.superformsData.hasDstSwaps, req_.superformsData.retain4626s, req_.superformsData.receiverAddress, req_.superformsData.extraFormData ); address superform; uint256 len = req_.superformsData.superformIds.length; (uint256[] memory amountsIn, uint8[] memory bridgeIds) = _multiVaultTokenForward(msg.sender, new address[](0), req_.superformsData.permit2data, ambData, true); /// @dev empties the liqData after multiVaultTokenForward ambData.liqData = new LiqRequest[](len); /// @dev this loop is what allows to deposit to >1 different underlying on destination /// @dev if a loop fails in a validation the whole chain should be reverted for (uint256 i; i < len; ++i) { vars.liqRequest = req_.superformsData.liqRequests[i]; (superform,,) = req_.superformsData.superformIds[i].getSuperform(); /// @dev dispatch liquidity data if ( _validateAndDispatchTokens( ValidateAndDispatchTokensArgs( vars.liqRequest, superform, vars.srcChainId, req_.dstChainId, msg.sender, true ) ) ) ambData.liqData[i].interimToken = vars.liqRequest.interimToken; } /// @dev dispatch message information, notice multiVaults is set to 1 _dispatchAmbMessage( DispatchAMBMessageVars( TransactionType.DEPOSIT, abi.encode(ambData), req_.superformsData.superformIds, msg.sender, req_.ambIds, 1, vars.srcChainId, req_.dstChainId, vars.currentPayloadId ), req_.superformsData.receiverAddressSP ); emit CrossChainInitiatedDepositMulti( vars.currentPayloadId, req_.dstChainId, req_.superformsData.superformIds, amountsIn, bridgeIds, req_.ambIds ); } /// @dev handles same-chain single vault withdraw function _singleDirectSingleVaultWithdraw(SingleDirectSingleVaultStateReq memory req_) internal virtual { /// @dev validate Superform data if ( !_validateSuperformData( req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.receiverAddress, req_.superformData.receiverAddressSP, CHAIN_ID, false, ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY"))), false ) ) { revert Error.INVALID_SUPERFORMS_DATA(); } ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).burnSingle( msg.sender, req_.superformData.superformId, req_.superformData.amount ); InitSingleVaultData memory vaultData = InitSingleVaultData( 0, req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.liqRequest, false, req_.superformData.retain4626, req_.superformData.receiverAddress, req_.superformData.extraFormData ); /// @dev same chain action _directSingleWithdraw(vaultData, msg.sender); emit Completed(); } /// @dev handles cross-chain single vault withdraw function _singleXChainSingleVaultWithdraw(SingleXChainSingleVaultStateReq memory req_) internal virtual { /// @dev validate the action ActionLocalVars memory vars; vars.srcChainId = CHAIN_ID; if (vars.srcChainId == req_.dstChainId) { revert Error.INVALID_ACTION(); } /// @dev validate the Superforms data if ( !_validateSuperformData( req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.receiverAddress, req_.superformData.receiverAddressSP, req_.dstChainId, false, ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY"))), false ) ) { revert Error.INVALID_SUPERFORMS_DATA(); } ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).burnSingle( msg.sender, req_.superformData.superformId, req_.superformData.amount ); vars.currentPayloadId = ++payloadIds; InitSingleVaultData memory ambData = InitSingleVaultData( vars.currentPayloadId, req_.superformData.superformId, req_.superformData.amount, req_.superformData.outputAmount, req_.superformData.maxSlippage, req_.superformData.liqRequest, false, req_.superformData.retain4626, req_.superformData.receiverAddress, req_.superformData.extraFormData ); uint256[] memory superformIds = new uint256[](1); superformIds[0] = req_.superformData.superformId; /// @dev dispatch message information, notice multiVaults is set to 0 _dispatchAmbMessage( DispatchAMBMessageVars( TransactionType.WITHDRAW, abi.encode(ambData), superformIds, msg.sender, req_.ambIds, 0, vars.srcChainId, req_.dstChainId, vars.currentPayloadId ), req_.superformData.receiverAddressSP ); emit CrossChainInitiatedWithdrawSingle( vars.currentPayloadId, req_.dstChainId, req_.superformData.superformId, req_.ambIds ); } /// @dev handles same-chain multi vault withdraw function _singleDirectMultiVaultWithdraw(SingleDirectMultiVaultStateReq memory req_) internal virtual { ActionLocalVars memory vars; vars.srcChainId = CHAIN_ID; /// @dev validates the Superform data if (!_validateSuperformsData(req_.superformData, vars.srcChainId, false)) { revert Error.INVALID_SUPERFORMS_DATA(); } /// @dev SuperPositions are burnt optimistically here ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).burnBatch( msg.sender, req_.superformData.superformIds, req_.superformData.amounts ); InitMultiVaultData memory vaultData = InitMultiVaultData( 0, req_.superformData.superformIds, req_.superformData.amounts, req_.superformData.outputAmounts, req_.superformData.maxSlippages, req_.superformData.liqRequests, new bool[](req_.superformData.superformIds.length), req_.superformData.retain4626s, req_.superformData.receiverAddress, req_.superformData.extraFormData ); /// @dev same chain action & forward residual payment to Paymaster _directMultiWithdraw(vaultData, msg.sender); emit Completed(); } /// @dev handles cross-chain multi vault withdraw function _singleXChainMultiVaultWithdraw(SingleXChainMultiVaultStateReq memory req_) internal virtual { /// @dev validate the action ActionLocalVars memory vars; vars.srcChainId = CHAIN_ID; if (vars.srcChainId == req_.dstChainId) { revert Error.INVALID_ACTION(); } /// @dev validate superformsData if (!_validateSuperformsData(req_.superformsData, req_.dstChainId, false)) { revert Error.INVALID_SUPERFORMS_DATA(); } ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).burnBatch( msg.sender, req_.superformsData.superformIds, req_.superformsData.amounts ); vars.currentPayloadId = ++payloadIds; InitMultiVaultData memory ambData = InitMultiVaultData( vars.currentPayloadId, req_.superformsData.superformIds, req_.superformsData.amounts, req_.superformsData.outputAmounts, req_.superformsData.maxSlippages, req_.superformsData.liqRequests, new bool[](req_.superformsData.amounts.length), req_.superformsData.retain4626s, req_.superformsData.receiverAddress, req_.superformsData.extraFormData ); /// @dev dispatch message information, notice multiVaults is set to 1 _dispatchAmbMessage( DispatchAMBMessageVars( TransactionType.WITHDRAW, abi.encode(ambData), req_.superformsData.superformIds, msg.sender, req_.ambIds, 1, vars.srcChainId, req_.dstChainId, vars.currentPayloadId ), req_.superformsData.receiverAddressSP ); emit CrossChainInitiatedWithdrawMulti( vars.currentPayloadId, req_.dstChainId, req_.superformsData.superformIds, req_.ambIds ); } function _validateAndDispatchTokens(ValidateAndDispatchTokensArgs memory args_) internal virtual returns (bool hasDstSwap) { address bridgeValidator = superRegistry.getBridgeValidator(args_.liqRequest.bridgeId); /// @dev validates remaining params of txData hasDstSwap = IBridgeValidator(bridgeValidator).validateTxData( IBridgeValidator.ValidateTxDataArgs( args_.liqRequest.txData, args_.srcChainId, args_.dstChainId, args_.liqRequest.liqDstChainId, args_.deposit, args_.superform, args_.srcSender, args_.liqRequest.token, args_.liqRequest.interimToken ) ); /// @dev dispatches tokens through the selected liquidity bridge to the destination contract _dispatchTokens( superRegistry.getBridgeAddress(args_.liqRequest.bridgeId), args_.liqRequest.txData, args_.liqRequest.token, IBridgeValidator(bridgeValidator).decodeAmountIn(args_.liqRequest.txData, true), args_.liqRequest.nativeAmount ); } function _dispatchAmbMessage(DispatchAMBMessageVars memory vars_, address receiverAddressSP_) internal virtual { uint256 txInfo = DataLib.packTxInfo( uint8(vars_.txType), uint8(CallbackType.INIT), vars_.multiVaults, STATE_REGISTRY_TYPE, vars_.srcSender, vars_.srcChainId ); bytes memory ambMessage = abi.encode(AMBMessage(txInfo, vars_.ambData)); (uint256 fees, bytes memory extraData) = IPaymentHelper(_getAddress(keccak256("PAYMENT_HELPER"))) .calculateAMBData(vars_.dstChainId, vars_.ambIds, ambMessage); ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).updateTxHistory( vars_.currentPayloadId, txInfo, receiverAddressSP_ ); /// @dev this call dispatches the message to the AMB bridge through dispatchPayload IBaseStateRegistry(_getAddress(keccak256("CORE_STATE_REGISTRY"))).dispatchPayload{ value: fees }( vars_.srcSender, vars_.ambIds, vars_.dstChainId, ambMessage, extraData ); } ////////////////////////////////////////////////////////////// // INTERNAL DEPOSIT HELPERS // ////////////////////////////////////////////////////////////// /// @notice fulfils the final stage of same chain deposit action function _directDeposit(DirectDepositArgs memory args) internal virtual returns (uint256 shares) { // @dev deposits token to a given vault and mint vault positions directly through the form shares = IBaseForm(args.superform).directDepositIntoVault{ value: args.msgValue }( InitSingleVaultData( args.payloadId, args.superformId, args.amount, args.outputAmount, args.maxSlippage, args.liqData, false, args.retain4626, args.receiverAddress, args.extraFormData ), args.srcSender ); } /// @notice deposits to single vault on the same chain /// @dev calls `_directDeposit` function _directSingleDeposit(SingleDepositArgs memory args_) internal virtual { SingleDepositLocalVars memory v; // @dev decode superforms (v.superform,,) = args_.vaultData.superformId.getSuperform(); _singleVaultTokenForward(args_.srcSender, v.superform, args_.permit2data, args_.vaultData, false); // @dev deposits token to a given vault and mint vault positions. v.shares = _directDeposit( DirectDepositArgs( v.superform, args_.vaultData.payloadId, args_.vaultData.superformId, args_.vaultData.amount, args_.vaultData.outputAmount, args_.vaultData.maxSlippage, args_.vaultData.retain4626, args_.vaultData.liqData, args_.vaultData.receiverAddress, args_.vaultData.extraFormData, args_.vaultData.liqData.nativeAmount, args_.srcSender ) ); if (v.shares != 0 && !args_.vaultData.retain4626) { // @dev mint super positions at the end of the deposit action if user doesn't retain 4626 ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).mintSingle( args_.receiverAddressSP, args_.vaultData.superformId, v.shares ); } } /// @notice deposits to multiple vaults on the same chain /// @dev loops and call `_directDeposit` function _directMultiDeposit(MultiDepositArgs memory args_) internal virtual { MultiDepositLocalVars memory v; v.len = args_.vaultData.superformIds.length; v.superforms = new address[](v.len); v.shares = new uint256[](v.len); /// @dev decode superforms v.superforms = DataLib.getSuperforms(args_.vaultData.superformIds); _multiVaultTokenForward(args_.srcSender, v.superforms, args_.permit2data, args_.vaultData, false); for (uint256 i; i < v.len; ++i) { /// @dev deposits token to a given vault and mint vault positions. v.shares[i] = _directDeposit( DirectDepositArgs( v.superforms[i], args_.vaultData.payloadId, args_.vaultData.superformIds[i], args_.vaultData.amounts[i], args_.vaultData.outputAmounts[i], args_.vaultData.maxSlippages[i], args_.vaultData.retain4626s[i], args_.vaultData.liqData[i], args_.vaultData.receiverAddress, args_.vaultData.extraFormData, args_.vaultData.liqData[i].nativeAmount, args_.srcSender ) ); /// @dev if retain4626 is set to True, set the amount of SuperPositions to mint to 0 if (v.shares[i] != 0 && args_.vaultData.retain4626s[i]) { v.shares[i] = 0; } } /// @dev in direct deposits, SuperPositions are minted right after depositing to vaults ISuperPositions(_getAddress(keccak256("SUPER_POSITIONS"))).mintBatch( args_.receiverAddressSP, args_.vaultData.superformIds, v.shares ); } ////////////////////////////////////////////////////////////// // INTERNAL WITHDRAW HELPERS // ////////////////////////////////////////////////////////////// /// @notice fulfils the final stage of same chain withdrawal action function _directWithdraw( address superform_, uint256 payloadId_, uint256 superformId_, uint256 amount_, uint256 outputAmount_, uint256 maxSlippage_, LiqRequest memory liqData_, bool retain4626_, address receiverAddress_, bytes memory extraFormData_, address srcSender_ ) internal virtual { /// @dev in direct withdraws, form is called directly IBaseForm(superform_).directWithdrawFromVault( InitSingleVaultData( payloadId_, superformId_, amount_, outputAmount_, maxSlippage_, liqData_, false, retain4626_, receiverAddress_, extraFormData_ ), srcSender_ ); } /// @notice withdraws from single vault on the same chain /// @dev call `_directWithdraw` function _directSingleWithdraw(InitSingleVaultData memory vaultData_, address srcSender_) internal virtual { /// @dev decode superforms (address superform,,) = vaultData_.superformId.getSuperform(); _directWithdraw( superform, vaultData_.payloadId, vaultData_.superformId, vaultData_.amount, vaultData_.outputAmount, vaultData_.maxSlippage, vaultData_.liqData, vaultData_.retain4626, vaultData_.receiverAddress, vaultData_.extraFormData, srcSender_ ); } /// @notice withdraws from multiple vaults on the same chain /// @dev loops and call `_directWithdraw` function _directMultiWithdraw(InitMultiVaultData memory vaultData_, address srcSender_) internal virtual { /// @dev decode superforms address[] memory superforms = DataLib.getSuperforms(vaultData_.superformIds); uint256 len = superforms.length; for (uint256 i; i < len; ++i) { /// @dev deposits token to a given vault and mint vault positions. _directWithdraw( superforms[i], vaultData_.payloadId, vaultData_.superformIds[i], vaultData_.amounts[i], vaultData_.outputAmounts[i], vaultData_.maxSlippages[i], vaultData_.liqData[i], vaultData_.retain4626s[i], vaultData_.receiverAddress, vaultData_.extraFormData, srcSender_ ); } } function _forwardDustToPaymaster(address token_) internal { if (token_ == address(0)) revert Error.ZERO_ADDRESS(); address paymaster = _getAddress(keccak256("PAYMASTER")); IERC20 token = IERC20(token_); uint256 dust = token.balanceOf(address(this)); if (dust != 0) { token.safeTransfer(paymaster, dust); emit RouterDustForwardedToPaymaster(token_, dust); } } ////////////////////////////////////////////////////////////// // INTERNAL VALIDATION HELPERS // ////////////////////////////////////////////////////////////// function _validateSuperformData( uint256 superformId_, uint256 amount_, uint256 outputAmount_, uint256 maxSlippage_, address receiverAddress_, address receiverAddressSP_, uint64 dstChainId_, bool isDeposit_, ISuperformFactory factory_, bool multi_ ) internal virtual returns (bool) { /// @dev if same chain, validate if the superform exists on factory if (dstChainId_ == CHAIN_ID && !factory_.isSuperform(superformId_)) { return false; } /// @dev the dstChainId_ (in the state request) must match the superforms' chainId (superform must exist on /// destination) (, uint32 formImplementationId, uint64 sfDstChainId) = superformId_.getSuperform(); if (dstChainId_ != sfDstChainId) return false; /// @dev 10000 = 100% slippage if (maxSlippage_ > ENTIRE_SLIPPAGE) return false; /// @dev amounts can't be 0 if (amount_ == 0 || outputAmount_ == 0) return false; /// @dev only validate this for non multi case (multi case is validated in _validateSuperformsData) /// @dev ensure that receiver address is set always /// @dev in deposits, this is important for receive4626 (on destination). It is also important for refunds on /// destination /// @dev in withdraws, this is important for the user to receive their tokens in the liqDstChainId if (!multi_ && receiverAddress_ == address(0)) { return false; } /// @dev redundant check on same chain, but helpful on xchain actions to halt deposits earlier if (isDeposit_) { if (factory_.isFormImplementationPaused(formImplementationId)) { return false; } /// @dev only validate this for non multi case (multi case is validated in _validateSuperformsData) if (!multi_) { if (receiverAddressSP_ == address(0)) { return false; } else { /// @dev if receiverAddressSP_ is set and is a contract, it must implement onERC1155Received _doSafeTransferAcceptanceCheck(receiverAddressSP_); } } } return true; } function _validateSuperformsData( MultiVaultSFData memory superformsData_, uint64 dstChainId_, bool deposit_ ) internal virtual returns (bool) { uint256 len = superformsData_.amounts.length; uint256 lenSuperforms = superformsData_.superformIds.length; uint256 liqRequestsLen = superformsData_.liqRequests.length; /// @dev empty requests are not allowed, as well as requests with length mismatch if (len == 0 || liqRequestsLen == 0) return false; if (len != liqRequestsLen) return false; /// @dev all other length checks if ( lenSuperforms != len || lenSuperforms != superformsData_.outputAmounts.length || lenSuperforms != superformsData_.maxSlippages.length || lenSuperforms != superformsData_.hasDstSwaps.length || lenSuperforms != superformsData_.retain4626s.length ) { return false; } /// @dev deposits beyond multi vault limit for a given destination chain blocked if (lenSuperforms > superRegistry.getVaultLimitPerDestination(dstChainId_)) { return false; } /// @dev since this is a multi case, validate receiverAddress here once if (superformsData_.receiverAddress == address(0)) { return false; } /// @dev since this is a multi case, validate receiverAddressSP here once if (deposit_) { if (superformsData_.receiverAddressSP == address(0)) { return false; } else { /// @dev if receiverAddressSP_ is set and is a contract, it must implement onERC1155Received _doSafeTransferAcceptanceCheck(superformsData_.receiverAddressSP); } } ISuperformFactory factory = ISuperformFactory(_getAddress(keccak256("SUPERFORM_FACTORY"))); /// @dev slippage, amount, paused status validation for (uint256 i; i < len; ++i) { if ( !_validateSuperformData( superformsData_.superformIds[i], superformsData_.amounts[i], superformsData_.outputAmounts[i], superformsData_.maxSlippages[i], superformsData_.receiverAddress, superformsData_.receiverAddressSP, dstChainId_, deposit_, factory, true ) ) { return false; } /// @dev ensure interimTokens aren't repeated on destination chains address interimToken = superformsData_.liqRequests[i].interimToken; if (interimToken != address(0)) { for (uint256 j; j < i; ++j) { if (j != i) { if (interimToken == superformsData_.liqRequests[j].interimToken) { return false; } } } } } return true; } ////////////////////////////////////////////////////////////// // INTERNAL FEE FORWARDING HELPERS // ////////////////////////////////////////////////////////////// /// @dev forwards the residual payment to Paymaster function _forwardPayment(uint256 _balanceBefore) internal virtual { if (address(this).balance < _balanceBefore) revert Error.INSUFFICIENT_BALANCE(); /// @dev deducts what's already available sends what's left in msg.value to Paymaster uint256 residualPayment = address(this).balance - _balanceBefore; if (residualPayment != 0) { IPayMaster(_getAddress(keccak256("PAYMASTER"))).makePayment{ value: residualPayment }(msg.sender); } } ////////////////////////////////////////////////////////////// // INTERNAL SAME CHAIN TOKEN SETTLEMENT HELPERS // ////////////////////////////////////////////////////////////// function _singleVaultTokenForward( address srcSender_, address target_, bytes memory permit2data_, InitSingleVaultData memory vaultData_, bool xChain ) internal virtual returns (uint256, uint8) { SingleTokenForwardLocalVars memory v; v.bridgeId = vaultData_.liqData.bridgeId; v.txDataLength = vaultData_.liqData.txData.length; if (v.txDataLength == 0 && xChain) { revert Error.NO_TXDATA_PRESENT(); } if (v.txDataLength != 0) { v.amountIn = IBridgeValidator(superRegistry.getBridgeValidator(v.bridgeId)).decodeAmountIn( vaultData_.liqData.txData, false ); } else { v.amountIn = vaultData_.amount; } if (vaultData_.liqData.token != NATIVE) { v.token = IERC20(vaultData_.liqData.token); if (permit2data_.length != 0) { v.permit2 = _getPermit2(); (uint256 nonce, uint256 deadline, bytes memory signature) = abi.decode(permit2data_, (uint256, uint256, bytes)); /// @dev moves the tokens from the user to the router IPermit2(v.permit2).permitTransferFrom( // The permit message. IPermit2.PermitTransferFrom({ permitted: IPermit2.TokenPermissions({ token: v.token, amount: v.amountIn }), nonce: nonce, deadline: deadline }), // The transfer recipient and amount. IPermit2.SignatureTransferDetails({ to: address(this), requestedAmount: v.amountIn }), // The owner of the tokens, which must also be // the signer of the message, otherwise this call // will fail. srcSender_, // The packed signature that was the result of signing // the EIP712 hash of `permit`. signature ); } else { if (v.token.allowance(srcSender_, address(this)) < v.amountIn) { revert Error.INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT(); } /// @dev moves the tokens from the user to the router v.token.safeTransferFrom(srcSender_, address(this), v.amountIn); } if (target_ != address(0)) { /// @dev approves the input amount to the target v.token.safeIncreaseAllowance(target_, v.amountIn); } } return (v.amountIn, v.bridgeId); } function _multiVaultTokenForward( address srcSender_, address[] memory targets_, bytes memory permit2data_, InitMultiVaultData memory vaultData_, bool xChain ) internal virtual returns (uint256[] memory, uint8[] memory) { MultiTokenForwardLocalVars memory v; address token = vaultData_.liqData[0].token; v.len = vaultData_.liqData.length; v.amountsIn = new uint256[](v.len); v.bridgeIds = new uint8[](v.len); for (uint256 i; i < v.len; ++i) { v.bridgeIds[i] = vaultData_.liqData[i].bridgeId; if (vaultData_.liqData[i].txData.length != 0) { v.amountsIn[i] = IBridgeValidator(superRegistry.getBridgeValidator(v.bridgeIds[i])).decodeAmountIn( vaultData_.liqData[i].txData, false ); } else { v.amountsIn[i] = vaultData_.amounts[i]; } } if (token != NATIVE) { v.token = IERC20(token); v.permit2dataLen = permit2data_.length; for (uint256 i; i < v.len; ++i) { if (vaultData_.liqData[i].token != address(v.token)) { revert Error.INVALID_DEPOSIT_TOKEN(); } uint256 txDataLength = vaultData_.liqData[i].txData.length; if (txDataLength == 0 && xChain) { revert Error.NO_TXDATA_PRESENT(); } v.totalAmount += v.amountsIn[i]; } if (v.totalAmount == 0) { revert Error.ZERO_AMOUNT(); } if (v.permit2dataLen != 0) { (uint256 nonce, uint256 deadline, bytes memory signature) = abi.decode(permit2data_, (uint256, uint256, bytes)); v.permit2 = _getPermit2(); /// @dev moves the tokens from the user to the router IPermit2(v.permit2).permitTransferFrom( // The permit message. IPermit2.PermitTransferFrom({ permitted: IPermit2.TokenPermissions({ token: v.token, amount: v.totalAmount }), nonce: nonce, deadline: deadline }), // The transfer recipient and amount. IPermit2.SignatureTransferDetails({ to: address(this), requestedAmount: v.totalAmount }), // The owner of the tokens, which must also be // the signer of the message, otherwise this call // will fail. srcSender_, // The packed signature that was the result of signing // the EIP712 hash of `permit`. signature ); } else { if (v.token.allowance(srcSender_, address(this)) < v.totalAmount) { revert Error.INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT(); } /// @dev moves the tokens from the user to the router v.token.safeTransferFrom(srcSender_, address(this), v.totalAmount); } /// @dev approves individual final targets if needed here v.targetLen = targets_.length; for (uint256 i; i < v.targetLen; ++i) { /// @dev approves the superform v.token.safeIncreaseAllowance(targets_[i], v.amountsIn[i]); } } return (v.amountsIn, v.bridgeIds); } /// @dev implementation copied from OpenZeppelin 5.0 and stripped down function _doSafeTransferAcceptanceCheck(address to) private view { if (to.code.length > 0) { try IERC165(to).supportsInterface(type(IERC1155Receiver).interfaceId) returns (bool supported) { if (!supported) revert IERC1155Errors.ERC1155InvalidReceiver(to); } catch { revert IERC1155Errors.ERC1155InvalidReceiver(to); } } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { IBaseRouter } from "src/interfaces/IBaseRouter.sol"; import { ISuperRegistry } from "src/interfaces/ISuperRegistry.sol"; import { Error } from "src/libraries/Error.sol"; import { SingleDirectSingleVaultStateReq, SingleXChainSingleVaultStateReq, SingleDirectMultiVaultStateReq, SingleXChainMultiVaultStateReq, MultiDstSingleVaultStateReq, MultiDstMultiVaultStateReq } from "src/types/DataTypes.sol"; import { IERC20 } from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title BaseRouter /// @dev Abstract implementation that allows Routers to implement the logic /// @author Zeropoint Labs abstract contract BaseRouter is IBaseRouter { using SafeERC20 for IERC20; ////////////////////////////////////////////////////////////// // CONSTANTS // ////////////////////////////////////////////////////////////// ISuperRegistry public immutable superRegistry; uint64 public immutable CHAIN_ID; uint8 internal constant STATE_REGISTRY_TYPE = 1; ////////////////////////////////////////////////////////////// // CONSTRUCTOR // ////////////////////////////////////////////////////////////// /// @param superRegistry_ the superform registry contract constructor(address superRegistry_) { if (superRegistry_ == address(0)) { revert Error.ZERO_ADDRESS(); } if (block.chainid > type(uint64).max) { revert Error.BLOCK_CHAIN_ID_OUT_OF_BOUNDS(); } CHAIN_ID = uint64(block.chainid); superRegistry = ISuperRegistry(superRegistry_); } ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @notice receive enables processing native token transfers into the smart contract. /// @notice liquidity bridge fails without a native receive function. receive() external payable { } /// @inheritdoc IBaseRouter function singleDirectSingleVaultDeposit(SingleDirectSingleVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleXChainSingleVaultDeposit(SingleXChainSingleVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleDirectMultiVaultDeposit(SingleDirectMultiVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleXChainMultiVaultDeposit(SingleXChainMultiVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function multiDstSingleVaultDeposit(MultiDstSingleVaultStateReq calldata req_) external payable virtual override; /// @inheritdoc IBaseRouter function multiDstMultiVaultDeposit(MultiDstMultiVaultStateReq calldata req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleDirectSingleVaultWithdraw(SingleDirectSingleVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleXChainSingleVaultWithdraw(SingleXChainSingleVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleDirectMultiVaultWithdraw(SingleDirectMultiVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function singleXChainMultiVaultWithdraw(SingleXChainMultiVaultStateReq memory req_) external payable virtual override; /// @inheritdoc IBaseRouter function multiDstSingleVaultWithdraw(MultiDstSingleVaultStateReq calldata req_) external payable virtual override; /// @inheritdoc IBaseRouter function multiDstMultiVaultWithdraw(MultiDstMultiVaultStateReq calldata req_) external payable virtual override; /// @inheritdoc IBaseRouter function forwardDustToPaymaster(address token_) external virtual override; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import "src/types/DataTypes.sol"; /// @title IBaseRouter /// @dev Interface for abstract BaseRouter /// @author Zeropoint Labs interface IBaseRouter { ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev Performs single direct x single vault deposits /// @param req_ is the request object containing all the necessary data for the action function singleDirectSingleVaultDeposit(SingleDirectSingleVaultStateReq memory req_) external payable; /// @dev Performs single xchain destination x single vault deposits /// @param req_ is the request object containing all the necessary data for the action function singleXChainSingleVaultDeposit(SingleXChainSingleVaultStateReq memory req_) external payable; /// @dev Performs single direct x multi vault deposits /// @param req_ is the request object containing all the necessary data for the action function singleDirectMultiVaultDeposit(SingleDirectMultiVaultStateReq memory req_) external payable; /// @dev Performs single destination x multi vault deposits /// @param req_ is the request object containing all the necessary data for the action function singleXChainMultiVaultDeposit(SingleXChainMultiVaultStateReq memory req_) external payable; /// @dev Performs multi destination x single vault deposits /// @param req_ is the request object containing all the necessary data for the action function multiDstSingleVaultDeposit(MultiDstSingleVaultStateReq calldata req_) external payable; /// @dev Performs multi destination x multi vault deposits /// @param req_ is the request object containing all the necessary data for the action function multiDstMultiVaultDeposit(MultiDstMultiVaultStateReq calldata req_) external payable; /// @dev Performs single direct x single vault withdraws /// @param req_ is the request object containing all the necessary data for the action function singleDirectSingleVaultWithdraw(SingleDirectSingleVaultStateReq memory req_) external payable; /// @dev Performs single xchain destination x single vault withdraws /// @param req_ is the request object containing all the necessary data for the action function singleXChainSingleVaultWithdraw(SingleXChainSingleVaultStateReq memory req_) external payable; /// @dev Performs single direct x multi vault withdraws /// @param req_ is the request object containing all the necessary data for the action function singleDirectMultiVaultWithdraw(SingleDirectMultiVaultStateReq memory req_) external payable; /// @dev Performs single destination x multi vault withdraws /// @param req_ is the request object containing all the necessary data for the action function singleXChainMultiVaultWithdraw(SingleXChainMultiVaultStateReq memory req_) external payable; /// @dev Performs multi destination x single vault withdraws /// @param req_ is the request object containing all the necessary data for the action function multiDstSingleVaultWithdraw(MultiDstSingleVaultStateReq calldata req_) external payable; /// @dev Performs multi destination x multi vault withdraws /// @param req_ is the request object containing all the necessary data for the action function multiDstMultiVaultWithdraw(MultiDstMultiVaultStateReq calldata req_) external payable; /// @dev Forwards dust to Paymaster /// @param token_ the token to forward function forwardDustToPaymaster(address token_) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; /// @dev contains all the common struct and enums used for data communication between chains. /// @dev There are two transaction types in Superform Protocol enum TransactionType { DEPOSIT, WITHDRAW } /// @dev Message types can be INIT, RETURN (for successful Deposits) and FAIL (for failed withdraws) enum CallbackType { INIT, RETURN, FAIL } /// @dev Payloads are stored, updated (deposits) or processed (finalized) enum PayloadState { STORED, UPDATED, PROCESSED } /// @dev contains all the common struct used for interchain token transfers. struct LiqRequest { /// @dev generated data bytes txData; /// @dev input token for deposits, desired output token on target liqDstChainId for withdraws. Must be set for /// txData to be updated on destination for withdraws address token; /// @dev intermediary token on destination. Relevant for xChain deposits where a destination swap is needed for /// validation purposes address interimToken; /// @dev what bridge to use to move tokens uint8 bridgeId; /// @dev dstChainId = liqDstchainId for deposits. For withdraws it is the target chain id for where the underlying /// is to be delivered uint64 liqDstChainId; /// @dev currently this amount is used as msg.value in the txData call. uint256 nativeAmount; } /// @dev main struct that holds required multi vault data for an action struct MultiVaultSFData { // superformids must have same destination. Can have different underlyings uint256[] superformIds; uint256[] amounts; // on deposits, amount of token to deposit on dst, on withdrawals, superpositions to burn uint256[] outputAmounts; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive uint256[] maxSlippages; LiqRequest[] liqRequests; // if length = 1; amount = sum(amounts) | else amounts must match the amounts being sent bytes permit2data; bool[] hasDstSwaps; bool[] retain4626s; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead address receiverAddress; /// this address must always be an EOA otherwise funds may be lost address receiverAddressSP; /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits bytes extraFormData; // extraFormData } /// @dev main struct that holds required single vault data for an action struct SingleVaultSFData { // superformids must have same destination. Can have different underlyings uint256 superformId; uint256 amount; uint256 outputAmount; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive uint256 maxSlippage; LiqRequest liqRequest; // if length = 1; amount = sum(amounts)| else amounts must match the amounts being sent bytes permit2data; bool hasDstSwap; bool retain4626; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead address receiverAddress; /// this address must always be an EOA otherwise funds may be lost address receiverAddressSP; /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits bytes extraFormData; // extraFormData } /// @dev overarching struct for multiDst requests with multi vaults struct MultiDstMultiVaultStateReq { uint8[][] ambIds; uint64[] dstChainIds; MultiVaultSFData[] superformsData; } /// @dev overarching struct for single cross chain requests with multi vaults struct SingleXChainMultiVaultStateReq { uint8[] ambIds; uint64 dstChainId; MultiVaultSFData superformsData; } /// @dev overarching struct for multiDst requests with single vaults struct MultiDstSingleVaultStateReq { uint8[][] ambIds; uint64[] dstChainIds; SingleVaultSFData[] superformsData; } /// @dev overarching struct for single cross chain requests with single vaults struct SingleXChainSingleVaultStateReq { uint8[] ambIds; uint64 dstChainId; SingleVaultSFData superformData; } /// @dev overarching struct for single direct chain requests with single vaults struct SingleDirectSingleVaultStateReq { SingleVaultSFData superformData; } /// @dev overarching struct for single direct chain requests with multi vaults struct SingleDirectMultiVaultStateReq { MultiVaultSFData superformData; } /// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId) /// @dev realize that receiverAddressSP is not passed, only needed on source chain to mint struct InitMultiVaultData { uint256 payloadId; uint256[] superformIds; uint256[] amounts; uint256[] outputAmounts; uint256[] maxSlippages; LiqRequest[] liqData; bool[] hasDstSwaps; bool[] retain4626s; address receiverAddress; bytes extraFormData; } /// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId) struct InitSingleVaultData { uint256 payloadId; uint256 superformId; uint256 amount; uint256 outputAmount; uint256 maxSlippage; LiqRequest liqData; bool hasDstSwap; bool retain4626; address receiverAddress; bytes extraFormData; } /// @dev struct for Emergency Queue struct QueuedWithdrawal { address receiverAddress; uint256 superformId; uint256 amount; uint256 srcPayloadId; bool isProcessed; } /// @dev all statuses of the timelock payload enum TimelockStatus { UNAVAILABLE, PENDING, PROCESSED } /// @dev holds information about the timelock payload struct TimelockPayload { uint8 isXChain; uint64 srcChainId; uint256 lockedTill; InitSingleVaultData data; TimelockStatus status; } /// @dev struct that contains the type of transaction, callback flags and other identification, as well as the vaults /// data in params struct AMBMessage { uint256 txInfo; // tight packing of TransactionType txType, CallbackType flag if multi/single vault, registry id, // srcSender and srcChainId bytes params; // decoding txInfo will point to the right datatype of params. Refer PayloadHelper.sol } /// @dev struct that contains the information required for broadcasting changes struct BroadcastMessage { bytes target; bytes32 messageType; bytes message; } /// @dev struct that contains info on returned data from destination struct ReturnMultiData { uint256 payloadId; uint256[] superformIds; uint256[] amounts; } /// @dev struct that contains info on returned data from destination struct ReturnSingleData { uint256 payloadId; uint256 superformId; uint256 amount; } /// @dev struct that contains the data on the fees to pay to the AMBs struct AMBExtraData { uint256[] gasPerAMB; bytes[] extraDataPerAMB; } /// @dev struct that contains the data on the fees to pay to the AMBs on broadcasts struct BroadCastAMBExtraData { uint256[] gasPerDst; bytes[] extraDataPerDst; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { IBaseRouter } from "src/interfaces/IBaseRouter.sol"; import { AMBMessage, LiqRequest, TransactionType } from "src/types/DataTypes.sol"; /// @title IBaseRouterImplementation /// @dev Interface for BaseRouterImplementation /// @author Zeropoint Labs interface IBaseRouterImplementation is IBaseRouter { ////////////////////////////////////////////////////////////// // STRUCTS // ////////////////////////////////////////////////////////////// /// @dev For local memory variable loading and avoiding stack too deep errors struct ActionLocalVars { AMBMessage ambMessage; LiqRequest liqRequest; uint64 srcChainId; uint256 currentPayloadId; uint256 liqRequestsLen; } struct DispatchAMBMessageVars { TransactionType txType; bytes ambData; uint256[] superformIds; address srcSender; uint8[] ambIds; uint8 multiVaults; uint64 srcChainId; uint64 dstChainId; uint256 currentPayloadId; } ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev is emitted when a cross-chain deposit multi vault transaction is initiated. event CrossChainInitiatedDepositMulti( uint256 indexed payloadId, uint64 indexed dstChainId, uint256[] superformIds, uint256[] amountsIn, uint8[] bridgeIds, uint8[] ambIds ); /// @dev is emitted when a cross-chain deposit single vault transaction is initiated. event CrossChainInitiatedDepositSingle( uint256 indexed payloadId, uint64 indexed dstChainId, uint256 superformIds, uint256 amountIn, uint8 bridgeId, uint8[] ambIds ); /// @dev is emitted when a cross-chain withdraw multi vault transaction is initiated. event CrossChainInitiatedWithdrawMulti( uint256 indexed payloadId, uint64 indexed dstChainId, uint256[] superformIds, uint8[] ambIds ); /// @dev is emitted when a cross-chain withdraw single vault transaction is initiated. event CrossChainInitiatedWithdrawSingle( uint256 indexed payloadId, uint64 indexed dstChainId, uint256 superformIds, uint8[] ambIds ); /// @dev is emitted when a direct chain action is complete event Completed(); /// @dev is emitted when dust is forwarded to paymaster event RouterDustForwardedToPaymaster(address indexed token, uint256 indexed amount); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { PayloadState } from "src/types/DataTypes.sol"; /// @title IBaseStateRegistry /// @dev Interface for BaseStateRegistry /// @author ZeroPoint Labs interface IBaseStateRegistry { ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev is emitted when a cross-chain payload is received in the state registry event PayloadReceived(uint64 indexed srcChainId, uint64 indexed dstChainId, uint256 indexed payloadId); /// @dev is emitted when a cross-chain proof is received in the state registry /// NOTE: comes handy if quorum required is more than 0 event ProofReceived(bytes32 indexed proof); /// @dev is emitted when a payload id gets updated event PayloadUpdated(uint256 indexed payloadId); /// @dev is emitted when a payload id gets processed event PayloadProcessed(uint256 indexed payloadId); /// @dev is emitted when the super registry address is updated event SuperRegistryUpdated(address indexed superRegistry); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev allows users to read the total payloads received by the registry function payloadsCount() external view returns (uint256); /// @dev allows user to read the payload state /// uint256 payloadId_ is the unique payload identifier allocated on the destination chain function payloadTracking(uint256 payloadId_) external view returns (PayloadState payloadState_); /// @dev allows users to read the bytes payload_ stored per payloadId_ /// @param payloadId_ is the unique payload identifier allocated on the destination chain /// @return payloadBody_ the crosschain data received function payloadBody(uint256 payloadId_) external view returns (bytes memory payloadBody_); /// @dev allows users to read the uint256 payloadHeader stored per payloadId_ /// @param payloadId_ is the unique payload identifier allocated on the destination chain /// @return payloadHeader_ the crosschain header received function payloadHeader(uint256 payloadId_) external view returns (uint256 payloadHeader_); /// @dev allows users to read the ambs that delivered the payload id /// @param payloadId_ is the unique payload identifier allocated on the destination chain /// @return ambIds_ is the identifier of ambs that delivered the message and proof function getMessageAMB(uint256 payloadId_) external view returns (uint8[] memory ambIds_); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev allows core contracts to send payload to a destination chain. /// @param srcSender_ is the caller of the function (used for gas refunds). /// @param ambIds_ is the identifier of the arbitrary message bridge to be used /// @param dstChainId_ is the internal chainId used throughout the protocol /// @param message_ is the crosschain payload to be sent /// @param extraData_ defines all the message bridge related overrides /// NOTE: dstChainId_ is mapped to message bridge's destination id inside it's implementation contract /// NOTE: ambIds_ are superform assigned unique identifier for arbitrary message bridges function dispatchPayload( address srcSender_, uint8[] memory ambIds_, uint64 dstChainId_, bytes memory message_, bytes memory extraData_ ) external payable; /// @dev allows state registry to receive messages from message bridge implementations /// @param srcChainId_ is the superform chainId from which the payload is dispatched/sent /// @param message_ is the crosschain payload received /// NOTE: Only {IMPLEMENTATION_CONTRACT} role can call this function. function receivePayload(uint64 srcChainId_, bytes memory message_) external; /// @dev allows privileged actors to process cross-chain payloads /// @param payloadId_ is the identifier of the cross-chain payload /// NOTE: Only {CORE_STATE_REGISTRY_PROCESSOR_ROLE} role can call this function /// NOTE: this should handle reverting the state on source chain in-case of failure /// (or) can implement scenario based reverting like in coreStateRegistry function processPayload(uint256 payloadId_) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { LiqRequest } from "src/types/DataTypes.sol"; /// @title IPayMaster /// @dev Interface for PayMaster /// @author ZeroPoint Labs interface IPayMaster { ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev is emitted when a new payment is made event Payment(address indexed user, uint256 indexed amount); /// @dev is emitted when tokens are moved out of paymaster event TokenWithdrawn(address indexed receiver, address indexed token, uint256 indexed amount); /// @dev is emitted when native tokens are moved out of paymaster event NativeWithdrawn(address indexed receiver, uint256 indexed amount); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev withdraws token funds from pay master to target id from superRegistry /// @param superRegistryId_ is the id of the target address in superRegistry /// @param token_ is the token to withdraw from pay master /// @param amount_ is the amount to withdraw from pay master function withdrawTo(bytes32 superRegistryId_, address token_, uint256 amount_) external; /// @dev withdraws native funds from pay master to target id from superRegistry /// @param superRegistryId_ is the id of the target address in superRegistry /// @param nativeAmount_ is the amount to withdraw from pay master function withdrawNativeTo(bytes32 superRegistryId_, uint256 nativeAmount_) external; /// @dev withdraws fund from pay master to target id from superRegistry /// @param superRegistryId_ is the id of the target address in superRegistry /// @param req_ is the off-chain generated liquidity request to move funds /// @param dstChainId_ is the destination chain id function rebalanceTo(bytes32 superRegistryId_, LiqRequest memory req_, uint64 dstChainId_) external; /// @dev retries a stuck payload on any supported amb using funds from paymaster /// @param ambId_ is the identifier of the AMB /// @param nativeValue_ is the native fees to be sent along the transaction /// @param data_ is the amb specific encoded retry data [check individual AMB implementations] function treatAMB(uint8 ambId_, uint256 nativeValue_, bytes memory data_) external; /// @dev accepts payment from user /// @param user_ is the wallet address of the paying user function makePayment(address user_) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { MultiDstMultiVaultStateReq, MultiDstSingleVaultStateReq, SingleXChainMultiVaultStateReq, SingleXChainSingleVaultStateReq, SingleDirectSingleVaultStateReq, SingleDirectMultiVaultStateReq } from "src/types/DataTypes.sol"; /// @title IPaymentHelper /// @dev Interface for PaymentHelper /// @author ZeroPoint Labs interface IPaymentHelper { ////////////////////////////////////////////////////////////// // STRUCTS // ////////////////////////////////////////////////////////////// /// @param nativeFeedOracle is the native price feed oracle /// @param gasPriceOracle is the gas price oracle /// @param swapGasUsed is the swap gas params /// @param updateGasUsed is the update gas params /// @param depositGasUsed is the deposit per vault gas on the chain /// @param withdrawGasUsed is the withdraw per vault gas on the chain /// @param defaultNativePrice is the native price on the specified chain /// @param defaultGasPrice is the gas price on the specified chain /// @param dstGasPerByte is the gas per size of data on the specified chain /// @param ackGasCost is the gas cost for sending and processing from dst->src /// @param timelockCost is the extra cost for processing timelocked payloads /// @param emergencyCost is the extra cost for processing emergency payloads struct PaymentHelperConfig { address nativeFeedOracle; address gasPriceOracle; uint256 swapGasUsed; uint256 updateGasUsed; uint256 depositGasUsed; uint256 withdrawGasUsed; uint256 defaultNativePrice; uint256 defaultGasPrice; uint256 dstGasPerByte; uint256 ackGasCost; uint256 timelockCost; uint256 emergencyCost; } ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// event ChainConfigUpdated(uint64 indexed chainId_, uint256 indexed configType_, bytes config_); event ChainConfigAdded(uint64 chainId_, PaymentHelperConfig config_); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev returns the amb overrides & gas to be used /// @param dstChainId_ is the unique dst chain identifier /// @param ambIds_ is the identifiers of arbitrary message bridges to be used /// @param message_ is the encoded cross-chain payload function calculateAMBData( uint64 dstChainId_, uint8[] calldata ambIds_, bytes memory message_ ) external view returns (uint256 totalFees, bytes memory extraData); /// @dev returns the amb overrides & gas to be used /// @return extraData the amb specific override information function getRegisterTransmuterAMBData() external view returns (bytes memory extraData); /// @dev estimates the gas fees for multiple destination and multi vault operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateMultiDstMultiVault( MultiDstMultiVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount); /// @dev estimates the gas fees for multiple destination and single vault operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateMultiDstSingleVault( MultiDstSingleVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount); /// @dev estimates the gas fees for single destination and multi vault operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateSingleXChainMultiVault( SingleXChainMultiVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount); /// @dev estimates the gas fees for single destination and single vault operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return dstAmount is the gas expense on dst chain in terms of src chain's native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateSingleXChainSingleVault( SingleXChainSingleVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 dstAmount, uint256 totalAmount); /// @dev estimates the gas fees for same chain operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateSingleDirectSingleVault( SingleDirectSingleVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount); /// @dev estimates the gas fees for multiple same chain operation /// @param req_ is the request object containing all necessary data for the actual operation on SuperRouter /// @param isDeposit_ indicated if the datatype will be used for a deposit /// @return liqAmount is the amount of liquidity to be provided in native tokens /// @return srcAmount is the gas expense on source chain in native tokens /// @return totalAmount is the native_tokens to be sent along the transaction function estimateSingleDirectMultiVault( SingleDirectMultiVaultStateReq calldata req_, bool isDeposit_ ) external view returns (uint256 liqAmount, uint256 srcAmount, uint256 totalAmount); /// @dev returns the gas fees estimation in native tokens if we send message through a combination of AMBs /// @param ambIds_ is the identifier of different AMBs /// @param dstChainId_ is the identifier of the destination chain /// @param message_ is the cross-chain message /// @param extraData_ is any amb-specific information /// @return ambFees is the native_tokens to be sent along the transaction for all the ambIds_ included function estimateAMBFees( uint8[] memory ambIds_, uint64 dstChainId_, bytes memory message_, bytes[] memory extraData_ ) external view returns (uint256 ambFees, uint256[] memory); /// @dev helps estimate the acknowledgement costs for amb processing /// @param payloadId_ is the payload identifier /// @return totalFees is the total fees to be paid in native tokens function estimateAckCost(uint256 payloadId_) external view returns (uint256 totalFees); /// @dev helps estimate the acknowledgement costs for amb processing without relying on payloadId (using max values) /// @param multi is the flag indicating if the payload is multi or single /// @param ackAmbIds is the list of ambIds to be used for acknowledgement /// @param srcChainId is the source chain identifier /// @return totalFees is the total fees to be paid in native tokens function estimateAckCostDefault( bool multi, uint8[] memory ackAmbIds, uint64 srcChainId ) external view returns (uint256 totalFees); /// @dev helps estimate the acknowledgement costs for amb processing without relying on payloadId (using max values) /// with source native amounts /// @param multi is the flag indicating if the payload is multi or single /// @param ackAmbIds is the list of ambIds to be used for acknowledgement /// @param srcChainId is the source chain identifier /// @return totalFees is the total fees to be paid in native tokens function estimateAckCostDefaultNativeSource( bool multi, uint8[] memory ackAmbIds, uint64 srcChainId ) external view returns (uint256 totalFees); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev admin can configure a remote chain for first time /// @param chainId_ is the identifier of new chain id /// @param config_ is the chain config function addRemoteChain(uint64 chainId_, PaymentHelperConfig calldata config_) external; /// @dev admin can specifically configure/update certain configuration of a remote chain /// @param chainId_ is the remote chain's identifier /// @param configType_ is the type of config from 1 -> 6 /// @param config_ is the encoded new configuration function updateRemoteChain(uint64 chainId_, uint256 configType_, bytes memory config_) external; /// @dev admin updates config for register transmuter amb params /// @param extraDataForTransmuter_ is the broadcast extra data function updateRegisterAERC20Params(bytes memory extraDataForTransmuter_) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; /// @title ISuperformFactory /// @dev Interface for SuperformFactory /// @author ZeroPoint Labs interface ISuperformFactory { ////////////////////////////////////////////////////////////// // CONSTANTS // ////////////////////////////////////////////////////////////// enum PauseStatus { NON_PAUSED, PAUSED } ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev emitted when a new formImplementation is entered into the factory /// @param formImplementation is the address of the new form implementation /// @param formImplementationId is the id of the formImplementation /// @param formStateRegistryId is any additional state registry id of the formImplementation event FormImplementationAdded( address indexed formImplementation, uint256 indexed formImplementationId, uint8 indexed formStateRegistryId ); /// @dev emitted when a new Superform is created /// @param formImplementationId is the id of the form implementation /// @param vault is the address of the vault /// @param superformId is the id of the superform /// @param superform is the address of the superform event SuperformCreated( uint256 indexed formImplementationId, address indexed vault, uint256 indexed superformId, address superform ); /// @dev emitted when a new SuperRegistry is set /// @param superRegistry is the address of the super registry event SuperRegistrySet(address indexed superRegistry); /// @dev emitted when a form implementation is paused /// @param formImplementationId is the id of the form implementation /// @param paused is the new paused status event FormImplementationPaused(uint256 indexed formImplementationId, PauseStatus indexed paused); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev returns the number of forms /// @return forms_ is the number of forms function getFormCount() external view returns (uint256 forms_); /// @dev returns the number of superforms /// @return superforms_ is the number of superforms function getSuperformCount() external view returns (uint256 superforms_); /// @dev returns the address of a form implementation /// @param formImplementationId_ is the id of the form implementation /// @return formImplementation_ is the address of the form implementation function getFormImplementation(uint32 formImplementationId_) external view returns (address formImplementation_); /// @dev returns the form state registry id of a form implementation /// @param formImplementationId_ is the id of the form implementation /// @return stateRegistryId_ is the additional state registry id of the form function getFormStateRegistryId(uint32 formImplementationId_) external view returns (uint8 stateRegistryId_); /// @dev returns the paused status of form implementation /// @param formImplementationId_ is the id of the form implementation /// @return paused_ is the current paused status of the form formImplementationId_ function isFormImplementationPaused(uint32 formImplementationId_) external view returns (bool paused_); /// @dev returns the address of a superform /// @param superformId_ is the id of the superform /// @return superform_ is the address of the superform /// @return formImplementationId_ is the id of the form implementation /// @return chainId_ is the chain id function getSuperform(uint256 superformId_) external pure returns (address superform_, uint32 formImplementationId_, uint64 chainId_); /// @dev returns if an address has been added to a Form /// @param superformId_ is the id of the superform /// @return isSuperform_ bool if it exists function isSuperform(uint256 superformId_) external view returns (bool isSuperform_); /// @dev Reverse query of getSuperform, returns all superforms for a given vault /// @param vault_ is the address of a vault /// @return superformIds_ is the id of the superform /// @return superforms_ is the address of the superform function getAllSuperformsFromVault(address vault_) external view returns (uint256[] memory superformIds_, address[] memory superforms_); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev allows an admin to add a Form implementation to the factory /// @param formImplementation_ is the address of a form implementation /// @param formImplementationId_ is the id of the form implementation (generated off-chain and equal in all chains) /// @param formStateRegistryId_ is the id of any additional state registry for that form /// @dev formStateRegistryId_ 1 is default for all form implementations, pass in formStateRegistryId_ only if an /// additional state registry is required function addFormImplementation( address formImplementation_, uint32 formImplementationId_, uint8 formStateRegistryId_ ) external; /// @dev To add new vaults to Form implementations, fusing them together into Superforms /// @param formImplementationId_ is the form implementation we want to attach the vault to /// @param vault_ is the address of the vault /// @return superformId_ is the id of the created superform /// @return superform_ is the address of the created superform function createSuperform( uint32 formImplementationId_, address vault_ ) external returns (uint256 superformId_, address superform_); /// @dev to synchronize superforms added to different chains using broadcast registry /// @param data_ is the cross-chain superform id function stateSyncBroadcast(bytes memory data_) external payable; /// @dev allows an admin to change the status of a form /// @param formImplementationId_ is the id of the form implementation /// @param status_ is the new status /// @param extraData_ is optional & passed when broadcasting of status is needed function changeFormImplementationPauseStatus( uint32 formImplementationId_, PauseStatus status_, bytes memory extraData_ ) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { InitSingleVaultData } from "src/types/DataTypes.sol"; import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { IERC4626 } from "openzeppelin-contracts/contracts/interfaces/IERC4626.sol"; /// @title IBaseForm /// @dev Interface for BaseForm /// @author ZeroPoint Labs interface IBaseForm is IERC165 { ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev is emitted when a new vault is added by the admin. event VaultAdded(uint256 indexed id, IERC4626 indexed vault); /// @dev is emitted when a payload is processed by the destination contract. event Processed( uint64 indexed srcChainID, uint64 indexed dstChainId, uint256 indexed srcPayloadId, uint256 amount, address vault ); /// @dev is emitted when an emergency withdrawal is processed event EmergencyWithdrawalProcessed(address indexed refundAddress, uint256 indexed amount); /// @dev is emitted when dust is forwarded to the paymaster event FormDustForwardedToPaymaster(address indexed token, uint256 indexed amount); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @notice get Superform name of the ERC20 vault representation /// @return The ERC20 name function superformYieldTokenName() external view returns (string memory); /// @notice get Superform symbol of the ERC20 vault representation /// @return The ERC20 symbol function superformYieldTokenSymbol() external view returns (string memory); /// @notice get the state registry id associated with the vault function getStateRegistryId() external view returns (uint8); /// @notice Returns the vault address /// @return The address of the vault function getVaultAddress() external view returns (address); /// @notice Returns the vault address /// @return The address of the vault asset function getVaultAsset() external view returns (address); /// @notice Returns the name of the vault. /// @return The name of the vault function getVaultName() external view returns (string memory); /// @notice Returns the symbol of a vault. /// @return The symbol associated with a vault function getVaultSymbol() external view returns (string memory); /// @notice Returns the number of decimals in a vault for accounting purposes /// @return The number of decimals in the vault balance function getVaultDecimals() external view returns (uint256); /// @notice Returns the amount of underlying tokens each share of a vault is worth. /// @return The pricePerVaultShare value function getPricePerVaultShare() external view returns (uint256); /// @notice Returns the amount of vault shares owned by the form. /// @return The form's vault share balance function getVaultShareBalance() external view returns (uint256); /// @notice get the total amount of underlying managed in the ERC4626 vault function getTotalAssets() external view returns (uint256); /// @notice get the total amount of unredeemed vault shares in circulation function getTotalSupply() external view returns (uint256); /// @notice get the total amount of assets received if shares are actually redeemed /// @notice https://eips.ethereum.org/EIPS/eip-4626 function getPreviewPricePerVaultShare() external view returns (uint256); /// @dev API may need to know state of funds deployed function previewDepositTo(uint256 assets_) external view returns (uint256); /// @notice positionBalance() -> .vaultIds&destAmounts /// @return how much of an asset + interest (accrued) is to withdraw from the Vault function previewWithdrawFrom(uint256 assets_) external view returns (uint256); /// @dev API may need to know state of funds deployed function previewRedeemFrom(uint256 shares_) external view returns (uint256); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev process same chain id deposits /// @param singleVaultData_ A bytes representation containing all the data required to make a form action /// @param srcSender_ The address of the sender of the transaction /// @return shares The amount of vault shares received function directDepositIntoVault( InitSingleVaultData memory singleVaultData_, address srcSender_ ) external payable returns (uint256 shares); /// @dev process same chain id deposits /// @param singleVaultData_ A bytes representation containing all the data required to make a form action /// @param srcSender_ The address of the sender of the transaction /// @param srcChainId_ The chain id of the source chain /// @return shares The amount of vault shares received /// @dev is shares is `0` then no further action/acknowledgement needs to be sent function xChainDepositIntoVault( InitSingleVaultData memory singleVaultData_, address srcSender_, uint64 srcChainId_ ) external returns (uint256 shares); /// @dev process withdrawal of asset from a vault /// @param singleVaultData_ A bytes representation containing all the data required to make a form action /// @param srcSender_ The address of the sender of the transaction /// @return assets The amount of assets received function directWithdrawFromVault( InitSingleVaultData memory singleVaultData_, address srcSender_ ) external returns (uint256 assets); /// @dev process withdrawal of asset from a vault /// @param singleVaultData_ A bytes representation containing all the data required to make a form action /// @param srcSender_ The address of the sender of the transaction /// @param srcChainId_ The chain id of the source chain /// @return assets The amount of assets received function xChainWithdrawFromVault( InitSingleVaultData memory singleVaultData_, address srcSender_, uint64 srcChainId_ ) external returns (uint256 assets); /// @dev process withdrawal of shares if form is paused /// @param receiverAddress_ The address to refund the shares to /// @param amount_ The amount of vault shares to refund function emergencyWithdraw(address receiverAddress_, uint256 amount_) external; /// @dev moves all dust in the contract to Paymaster contract /// @param token_ The address of the token to forward function forwardDustToPaymaster(address token_) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; /// @title Bridge Validator Interface /// @dev Interface all Bridge Validators must follow /// @author Zeropoint Labs interface IBridgeValidator { ////////////////////////////////////////////////////////////// // STRUCTS // ////////////////////////////////////////////////////////////// struct ValidateTxDataArgs { bytes txData; uint64 srcChainId; uint64 dstChainId; uint64 liqDstChainId; bool deposit; address superform; address receiverAddress; address liqDataToken; address liqDataInterimToken; } ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev validates the receiver of the liquidity request /// @param txData_ is the txData of the cross chain deposit /// @param receiver_ is the address of the receiver to validate /// @return valid_ if the address is valid function validateReceiver(bytes calldata txData_, address receiver_) external view returns (bool valid_); /// @dev validates the txData of a cross chain deposit /// @param args_ the txData arguments to validate in txData /// @return hasDstSwap if the txData contains a destination swap function validateTxData(ValidateTxDataArgs calldata args_) external view returns (bool hasDstSwap); /// @dev decodes the txData and returns the amount of input token on source /// @param txData_ is the txData of the cross chain deposit /// @param genericSwapDisallowed_ true if generic swaps are disallowed /// @return amount_ the amount expected function decodeAmountIn( bytes calldata txData_, bool genericSwapDisallowed_ ) external view returns (uint256 amount_); /// @dev decodes neccesary information for processing swaps on the destination chain /// @param txData_ is the txData to be decoded /// @return token_ is the address of the token /// @return amount_ the amount expected function decodeDstSwap(bytes calldata txData_) external pure returns (address token_, uint256 amount_); /// @dev decodes the final output token address (for only direct chain actions!) /// @param txData_ is the txData to be decoded /// @return token_ the address of the token function decodeSwapOutputToken(bytes calldata txData_) external pure returns (address token_); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { IERC1155A } from "ERC1155A/interfaces/IERC1155A.sol"; import { AMBMessage } from "../types/DataTypes.sol"; /// @title ISuperPositions /// @dev Interface for SuperPositions /// @author Zeropoint Labs interface ISuperPositions is IERC1155A { ////////////////////////////////////////////////////////////// // STRUCTS // ////////////////////////////////////////////////////////////// struct TxHistory { uint256 txInfo; address receiverAddressSP; } ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev is emitted when a dynamic uri is updated event DynamicURIUpdated(string indexed oldURI, string indexed newURI, bool indexed frozen); /// @dev is emitted when a cross-chain transaction is completed. event Completed(uint256 indexed txId); /// @dev is emitted when a aErc20 token is registered event AERC20TokenRegistered(uint256 indexed tokenId, address indexed tokenAddress); /// @dev is emitted when a tx info is saved event TxHistorySet(uint256 indexed payloadId, uint256 txInfo, address indexed receiverAddress); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev returns the payload header and the receiver address for a tx id on the source chain /// @param txId_ is the identifier of the transaction issued by superform router /// @return txInfo is the header of the payload /// @return receiverAddressSP is the address of the receiver of superPositions function txHistory(uint256 txId_) external view returns (uint256 txInfo, address receiverAddressSP); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev saves the message being sent together with the associated id formulated in a router /// @param payloadId_ is the id of the message being saved /// @param txInfo_ is the header of the AMBMessage of the transaction being saved /// @param receiverAddressSP_ is the address of the receiver of superPositions function updateTxHistory(uint256 payloadId_, uint256 txInfo_, address receiverAddressSP_) external; /// @dev allows minter to mint shares on source /// @param receiverAddress_ is the beneficiary of shares /// @param id_ is the id of the shares /// @param amount_ is the amount of shares to mint function mintSingle(address receiverAddress_, uint256 id_, uint256 amount_) external; /// @dev allows minter to mint shares on source in batch /// @param receiverAddress_ is the beneficiary of shares /// @param ids_ are the ids of the shares /// @param amounts_ are the amounts of shares to mint function mintBatch(address receiverAddress_, uint256[] memory ids_, uint256[] memory amounts_) external; /// @dev allows superformRouter to burn shares on source /// @notice burn is done optimistically by the router in the beginning of the withdraw transactions /// @notice in case the withdraw tx fails on the destination, shares are reminted through stateSync /// @param srcSender_ is the address of the sender /// @param id_ is the id of the shares /// @param amount_ is the amount of shares to burn function burnSingle(address srcSender_, uint256 id_, uint256 amount_) external; /// @dev allows burner to burn shares on source in batch /// @param srcSender_ is the address of the sender /// @param ids_ are the ids of the shares /// @param amounts_ are the amounts of shares to burn function burnBatch(address srcSender_, uint256[] memory ids_, uint256[] memory amounts_) external; /// @dev allows state registry contract to mint shares on source /// @param data_ is the received information to be processed. /// @return srcChainId_ is the decoded srcChainId. function stateMultiSync(AMBMessage memory data_) external returns (uint64 srcChainId_); /// @dev allows state registry contract to mint shares on source /// @param data_ is the received information to be processed. /// @return srcChainId_ is the decoded srcChainId. function stateSync(AMBMessage memory data_) external returns (uint64 srcChainId_); /// @dev sets the dynamic uri for NFT /// @param dynamicURI_ is the dynamic uri of the NFT /// @param freeze_ is to prevent updating the metadata once migrated to IPFS function setDynamicURI(string memory dynamicURI_, bool freeze_) external; /// @dev allows to create sERC0 using broadcast state registry /// @param data_ is the crosschain payload function stateSyncBroadcast(bytes memory data_) external payable; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { Error } from "src/libraries/Error.sol"; library DataLib { function packTxInfo( uint8 txType_, uint8 callbackType_, uint8 multi_, uint8 registryId_, address srcSender_, uint64 srcChainId_ ) internal pure returns (uint256 txInfo) { txInfo = uint256(txType_); txInfo |= uint256(callbackType_) << 8; txInfo |= uint256(multi_) << 16; txInfo |= uint256(registryId_) << 24; txInfo |= uint256(uint160(srcSender_)) << 32; txInfo |= uint256(srcChainId_) << 192; } function decodeTxInfo(uint256 txInfo_) internal pure returns (uint8 txType, uint8 callbackType, uint8 multi, uint8 registryId, address srcSender, uint64 srcChainId) { txType = uint8(txInfo_); callbackType = uint8(txInfo_ >> 8); multi = uint8(txInfo_ >> 16); registryId = uint8(txInfo_ >> 24); srcSender = address(uint160(txInfo_ >> 32)); srcChainId = uint64(txInfo_ >> 192); } /// @dev returns the vault-form-chain pair of a superform /// @param superformId_ is the id of the superform /// @return superform_ is the address of the superform /// @return formImplementationId_ is the form id /// @return chainId_ is the chain id function getSuperform(uint256 superformId_) internal pure returns (address superform_, uint32 formImplementationId_, uint64 chainId_) { superform_ = address(uint160(superformId_)); formImplementationId_ = uint32(superformId_ >> 160); chainId_ = uint64(superformId_ >> 192); if (chainId_ == 0) { revert Error.INVALID_CHAIN_ID(); } } /// @dev returns the vault-form-chain pair of an array of superforms /// @param superformIds_ array of superforms /// @return superforms_ are the address of the vaults function getSuperforms(uint256[] memory superformIds_) internal pure returns (address[] memory superforms_) { uint256 len = superformIds_.length; superforms_ = new address[](len); for (uint256 i; i < len; ++i) { (superforms_[i],,) = getSuperform(superformIds_[i]); } } /// @dev returns the destination chain of a given superform /// @param superformId_ is the id of the superform /// @return chainId_ is the chain id function getDestinationChain(uint256 superformId_) internal pure returns (uint64 chainId_) { chainId_ = uint64(superformId_ >> 192); if (chainId_ == 0) { revert Error.INVALID_CHAIN_ID(); } } /// @dev generates the superformId /// @param superform_ is the address of the superform /// @param formImplementationId_ is the type of the form /// @param chainId_ is the chain id on which the superform is deployed function packSuperform( address superform_, uint32 formImplementationId_, uint64 chainId_ ) internal pure returns (uint256 superformId_) { superformId_ = uint256(uint160(superform_)); superformId_ |= uint256(formImplementationId_) << 160; superformId_ |= uint256(chainId_) << 192; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; library Error { ////////////////////////////////////////////////////////////// // CONFIGURATION ERRORS // ////////////////////////////////////////////////////////////// ///@notice errors thrown in protocol setup /// @dev thrown if chain id exceeds max(uint64) error BLOCK_CHAIN_ID_OUT_OF_BOUNDS(); /// @dev thrown if not possible to revoke a role in broadcasting error CANNOT_REVOKE_NON_BROADCASTABLE_ROLES(); /// @dev thrown if not possible to revoke last admin error CANNOT_REVOKE_LAST_ADMIN(); /// @dev thrown if trying to set again pseudo immutables in super registry error DISABLED(); /// @dev thrown if rescue delay is not yet set for a chain error DELAY_NOT_SET(); /// @dev thrown if get native token price estimate in paymentHelper is 0 error INVALID_NATIVE_TOKEN_PRICE(); /// @dev thrown if wormhole refund chain id is not set error REFUND_CHAIN_ID_NOT_SET(); /// @dev thrown if wormhole relayer is not set error RELAYER_NOT_SET(); /// @dev thrown if a role to be revoked is not assigned error ROLE_NOT_ASSIGNED(); ////////////////////////////////////////////////////////////// // AUTHORIZATION ERRORS // ////////////////////////////////////////////////////////////// ///@notice errors thrown if functions cannot be called /// COMMON AUTHORIZATION ERRORS /// --------------------------------------------------------- /// @dev thrown if caller is not address(this), internal call error INVALID_INTERNAL_CALL(); /// @dev thrown if msg.sender is not a valid amb implementation error NOT_AMB_IMPLEMENTATION(); /// @dev thrown if msg.sender is not an allowed broadcaster error NOT_ALLOWED_BROADCASTER(); /// @dev thrown if msg.sender is not broadcast amb implementation error NOT_BROADCAST_AMB_IMPLEMENTATION(); /// @dev thrown if msg.sender is not broadcast state registry error NOT_BROADCAST_REGISTRY(); /// @dev thrown if msg.sender is not core state registry error NOT_CORE_STATE_REGISTRY(); /// @dev thrown if msg.sender is not emergency admin error NOT_EMERGENCY_ADMIN(); /// @dev thrown if msg.sender is not emergency queue error NOT_EMERGENCY_QUEUE(); /// @dev thrown if msg.sender is not minter error NOT_MINTER(); /// @dev thrown if msg.sender is not minter state registry error NOT_MINTER_STATE_REGISTRY_ROLE(); /// @dev thrown if msg.sender is not paymaster error NOT_PAYMASTER(); /// @dev thrown if msg.sender is not payment admin error NOT_PAYMENT_ADMIN(); /// @dev thrown if msg.sender is not protocol admin error NOT_PROTOCOL_ADMIN(); /// @dev thrown if msg.sender is not state registry error NOT_STATE_REGISTRY(); /// @dev thrown if msg.sender is not super registry error NOT_SUPER_REGISTRY(); /// @dev thrown if msg.sender is not superform router error NOT_SUPERFORM_ROUTER(); /// @dev thrown if msg.sender is not a superform error NOT_SUPERFORM(); /// @dev thrown if msg.sender is not superform factory error NOT_SUPERFORM_FACTORY(); /// @dev thrown if msg.sender is not timelock form error NOT_TIMELOCK_SUPERFORM(); /// @dev thrown if msg.sender is not timelock state registry error NOT_TIMELOCK_STATE_REGISTRY(); /// @dev thrown if msg.sender is not user or disputer error NOT_VALID_DISPUTER(); /// @dev thrown if the msg.sender is not privileged caller error NOT_PRIVILEGED_CALLER(bytes32 role); /// STATE REGISTRY AUTHORIZATION ERRORS /// --------------------------------------------------------- /// @dev layerzero adapter specific error, thrown if caller not layerzero endpoint error CALLER_NOT_ENDPOINT(); /// @dev hyperlane adapter specific error, thrown if caller not hyperlane mailbox error CALLER_NOT_MAILBOX(); /// @dev wormhole relayer specific error, thrown if caller not wormhole relayer error CALLER_NOT_RELAYER(); /// @dev thrown if src chain sender is not valid error INVALID_SRC_SENDER(); ////////////////////////////////////////////////////////////// // INPUT VALIDATION ERRORS // ////////////////////////////////////////////////////////////// ///@notice errors thrown if input variables are not valid /// COMMON INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if there is an array length mismatch error ARRAY_LENGTH_MISMATCH(); /// @dev thrown if payload id does not exist error INVALID_PAYLOAD_ID(); /// @dev error thrown when msg value should be zero in certain payable functions error MSG_VALUE_NOT_ZERO(); /// @dev thrown if amb ids length is 0 error ZERO_AMB_ID_LENGTH(); /// @dev thrown if address input is address 0 error ZERO_ADDRESS(); /// @dev thrown if amount input is 0 error ZERO_AMOUNT(); /// @dev thrown if final token is address 0 error ZERO_FINAL_TOKEN(); /// @dev thrown if value input is 0 error ZERO_INPUT_VALUE(); /// SUPERFORM ROUTER INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if the vaults data is invalid error INVALID_SUPERFORMS_DATA(); /// @dev thrown if receiver address is not set error RECEIVER_ADDRESS_NOT_SET(); /// SUPERFORM FACTORY INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if a form is not ERC165 compatible error ERC165_UNSUPPORTED(); /// @dev thrown if a form is not form interface compatible error FORM_INTERFACE_UNSUPPORTED(); /// @dev error thrown if form implementation address already exists error FORM_IMPLEMENTATION_ALREADY_EXISTS(); /// @dev error thrown if form implementation id already exists error FORM_IMPLEMENTATION_ID_ALREADY_EXISTS(); /// @dev thrown if a form does not exist error FORM_DOES_NOT_EXIST(); /// @dev thrown if form id is larger than max uint16 error INVALID_FORM_ID(); /// @dev thrown if superform not on factory error SUPERFORM_ID_NONEXISTENT(); /// @dev thrown if same vault and form implementation is used to create new superform error VAULT_FORM_IMPLEMENTATION_COMBINATION_EXISTS(); /// FORM INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if in case of no txData, if liqData.token != vault.asset() /// in case of txData, if token output of swap != vault.asset() error DIFFERENT_TOKENS(); /// @dev thrown if the amount in direct withdraw is not correct error DIRECT_WITHDRAW_INVALID_LIQ_REQUEST(); /// @dev thrown if the amount in xchain withdraw is not correct error XCHAIN_WITHDRAW_INVALID_LIQ_REQUEST(); /// LIQUIDITY BRIDGE INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if route id is blacklisted in socket error BLACKLISTED_ROUTE_ID(); /// @dev thrown if route id is not blacklisted in socket error NOT_BLACKLISTED_ROUTE_ID(); /// @dev error thrown when txData selector of lifi bridge is a blacklisted selector error BLACKLISTED_SELECTOR(); /// @dev error thrown when txData selector of lifi bridge is not a blacklisted selector error NOT_BLACKLISTED_SELECTOR(); /// @dev thrown if a certain action of the user is not allowed given the txData provided error INVALID_ACTION(); /// @dev thrown if in deposits, the liqDstChainId doesn't match the stateReq dstChainId error INVALID_DEPOSIT_LIQ_DST_CHAIN_ID(); /// @dev thrown if index is invalid error INVALID_INDEX(); /// @dev thrown if the chain id in the txdata is invalid error INVALID_TXDATA_CHAIN_ID(); /// @dev thrown if the validation of bridge txData fails due to a destination call present error INVALID_TXDATA_NO_DESTINATIONCALL_ALLOWED(); /// @dev thrown if the validation of bridge txData fails due to wrong receiver error INVALID_TXDATA_RECEIVER(); /// @dev thrown if the validation of bridge txData fails due to wrong token error INVALID_TXDATA_TOKEN(); /// @dev thrown if txData is not present (in case of xChain actions) error NO_TXDATA_PRESENT(); /// STATE REGISTRY INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if payload is being updated with final amounts length different than amounts length error DIFFERENT_PAYLOAD_UPDATE_AMOUNTS_LENGTH(); /// @dev thrown if payload is being updated with tx data length different than liq data length error DIFFERENT_PAYLOAD_UPDATE_TX_DATA_LENGTH(); /// @dev thrown if keeper update final token is different than the vault underlying error INVALID_UPDATE_FINAL_TOKEN(); /// @dev thrown if broadcast finality for wormhole is invalid error INVALID_BROADCAST_FINALITY(); /// @dev thrown if amb id is not valid leading to an address 0 of the implementation error INVALID_BRIDGE_ID(); /// @dev thrown if chain id involved in xchain message is invalid error INVALID_CHAIN_ID(); /// @dev thrown if payload update amount isn't equal to dst swapper amount error INVALID_DST_SWAP_AMOUNT(); /// @dev thrown if message amb and proof amb are the same error INVALID_PROOF_BRIDGE_ID(); /// @dev thrown if order of proof AMBs is incorrect, either duplicated or not incrementing error INVALID_PROOF_BRIDGE_IDS(); /// @dev thrown if rescue data lengths are invalid error INVALID_RESCUE_DATA(); /// @dev thrown if delay is invalid error INVALID_TIMELOCK_DELAY(); /// @dev thrown if amounts being sent in update payload mean a negative slippage error NEGATIVE_SLIPPAGE(); /// @dev thrown if slippage is outside of bounds error SLIPPAGE_OUT_OF_BOUNDS(); /// SUPERPOSITION INPUT VALIDATION ERRORS /// --------------------------------------------------------- /// @dev thrown if src senders mismatch in state sync error SRC_SENDER_MISMATCH(); /// @dev thrown if src tx types mismatch in state sync error SRC_TX_TYPE_MISMATCH(); ////////////////////////////////////////////////////////////// // EXECUTION ERRORS // ////////////////////////////////////////////////////////////// ///@notice errors thrown due to function execution logic /// COMMON EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if the swap in a direct deposit resulted in insufficient tokens error DIRECT_DEPOSIT_SWAP_FAILED(); /// @dev thrown if payload is not unique error DUPLICATE_PAYLOAD(); /// @dev thrown if native tokens fail to be sent to superform contracts error FAILED_TO_SEND_NATIVE(); /// @dev thrown if allowance is not correct to deposit error INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT(); /// @dev thrown if contract has insufficient balance for operations error INSUFFICIENT_BALANCE(); /// @dev thrown if native amount is not at least equal to the amount in the request error INSUFFICIENT_NATIVE_AMOUNT(); /// @dev thrown if payload cannot be decoded error INVALID_PAYLOAD(); /// @dev thrown if payload status is invalid error INVALID_PAYLOAD_STATUS(); /// @dev thrown if payload type is invalid error INVALID_PAYLOAD_TYPE(); /// LIQUIDITY BRIDGE EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if we try to decode the final swap output token in a xChain liquidity bridging action error CANNOT_DECODE_FINAL_SWAP_OUTPUT_TOKEN(); /// @dev thrown if liquidity bridge fails for erc20 or native tokens error FAILED_TO_EXECUTE_TXDATA(address token); /// @dev thrown if asset being used for deposit mismatches in multivault deposits error INVALID_DEPOSIT_TOKEN(); /// STATE REGISTRY EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if bridge tokens haven't arrived to destination error BRIDGE_TOKENS_PENDING(); /// @dev thrown if withdrawal tx data cannot be updated error CANNOT_UPDATE_WITHDRAW_TX_DATA(); /// @dev thrown if rescue passed dispute deadline error DISPUTE_TIME_ELAPSED(); /// @dev thrown if message failed to reach the specified level of quorum needed error INSUFFICIENT_QUORUM(); /// @dev thrown if broadcast payload is invalid error INVALID_BROADCAST_PAYLOAD(); /// @dev thrown if broadcast fee is invalid error INVALID_BROADCAST_FEE(); /// @dev thrown if retry fees is less than required error INVALID_RETRY_FEE(); /// @dev thrown if broadcast message type is wrong error INVALID_MESSAGE_TYPE(); /// @dev thrown if payload hash is invalid during `retryMessage` on Layezero implementation error INVALID_PAYLOAD_HASH(); /// @dev thrown if update payload function was called on a wrong payload error INVALID_PAYLOAD_UPDATE_REQUEST(); /// @dev thrown if a state registry id is 0 error INVALID_REGISTRY_ID(); /// @dev thrown if a form state registry id is 0 error INVALID_FORM_REGISTRY_ID(); /// @dev thrown if trying to finalize the payload but the withdraw is still locked error LOCKED(); /// @dev thrown if payload is already updated (during xChain deposits) error PAYLOAD_ALREADY_UPDATED(); /// @dev thrown if payload is already processed error PAYLOAD_ALREADY_PROCESSED(); /// @dev thrown if payload is not in UPDATED state error PAYLOAD_NOT_UPDATED(); /// @dev thrown if rescue is still in timelocked state error RESCUE_LOCKED(); /// @dev thrown if rescue is already proposed error RESCUE_ALREADY_PROPOSED(); /// @dev thrown if payload hash is zero during `retryMessage` on Layezero implementation error ZERO_PAYLOAD_HASH(); /// DST SWAPPER EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if process dst swap is tried for processed payload id error DST_SWAP_ALREADY_PROCESSED(); /// @dev thrown if indices have duplicates error DUPLICATE_INDEX(); /// @dev thrown if failed dst swap is already updated error FAILED_DST_SWAP_ALREADY_UPDATED(); /// @dev thrown if indices are out of bounds error INDEX_OUT_OF_BOUNDS(); /// @dev thrown if failed swap token amount is 0 error INVALID_DST_SWAPPER_FAILED_SWAP(); /// @dev thrown if failed swap token amount is not 0 and if token balance is less than amount (non zero) error INVALID_DST_SWAPPER_FAILED_SWAP_NO_TOKEN_BALANCE(); /// @dev thrown if failed swap token amount is not 0 and if native amount is less than amount (non zero) error INVALID_DST_SWAPPER_FAILED_SWAP_NO_NATIVE_BALANCE(); /// @dev forbid xChain deposits with destination swaps without interim token set (for user protection) error INVALID_INTERIM_TOKEN(); /// @dev thrown if dst swap output is less than minimum expected error INVALID_SWAP_OUTPUT(); /// FORM EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if try to forward 4626 share from the superform error CANNOT_FORWARD_4646_TOKEN(); /// @dev thrown in KYCDAO form if no KYC token is present error NO_VALID_KYC_TOKEN(); /// @dev thrown in forms where a certain functionality is not allowed or implemented error NOT_IMPLEMENTED(); /// @dev thrown if form implementation is PAUSED, users cannot perform any action error PAUSED(); /// @dev thrown if shares != deposit output or assets != redeem output when minting SuperPositions error VAULT_IMPLEMENTATION_FAILED(); /// @dev thrown if withdrawal tx data is not updated error WITHDRAW_TOKEN_NOT_UPDATED(); /// @dev thrown if withdrawal tx data is not updated error WITHDRAW_TX_DATA_NOT_UPDATED(); /// @dev thrown when redeeming from vault yields zero collateral error WITHDRAW_ZERO_COLLATERAL(); /// PAYMENT HELPER EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if chainlink is reporting an improper price error CHAINLINK_MALFUNCTION(); /// @dev thrown if chainlink is reporting an incomplete round error CHAINLINK_INCOMPLETE_ROUND(); /// @dev thrown if feed decimals is not 8 error CHAINLINK_UNSUPPORTED_DECIMAL(); /// EMERGENCY QUEUE EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if emergency withdraw is not queued error EMERGENCY_WITHDRAW_NOT_QUEUED(); /// @dev thrown if emergency withdraw is already processed error EMERGENCY_WITHDRAW_PROCESSED_ALREADY(); /// SUPERPOSITION EXECUTION ERRORS /// --------------------------------------------------------- /// @dev thrown if uri cannot be updated error DYNAMIC_URI_FROZEN(); /// @dev thrown if tx history is not found while state sync error TX_HISTORY_NOT_FOUND(); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.23; import { IERC20 } from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; /// @title Liquidity Handler. /// @author https://github.com/dragonfly-xyz/useful-solidity-patterns/blob/main/patterns/permit2/Permit2Vault.sol /// @dev Minimal Permit2 interface, derived from /// @dev https://github.com/Uniswap/permit2/blob/main/src/interfaces/ISignatureTransfer.sol interface IPermit2 { // Token and amount in a permit message. struct TokenPermissions { // Token to transfer. IERC20 token; // Amount to transfer. uint256 amount; } // The permit2 message. struct PermitTransferFrom { // Permitted token and amount. TokenPermissions permitted; // Unique identifier for this permit. uint256 nonce; // Expiration for this permit. uint256 deadline; } // Transfer details for permitTransferFrom(). struct SignatureTransferDetails { // Recipient of tokens. address to; // Amount to transfer. uint256 requestedAmount; } // Consume a permit2 message and transfer tokens. function permitTransferFrom( PermitTransferFrom calldata permit, SignatureTransferDetails calldata transferDetails, address owner, bytes calldata signature ) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import { Error } from "src/libraries/Error.sol"; import { IERC20 } from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title LiquidityHandler /// @dev Executes an action with tokens to either bridge from Chain A -> Chain B or swap on same chain /// @dev To be inherited by contracts that move liquidity /// @author ZeroPoint Labs abstract contract LiquidityHandler { using SafeERC20 for IERC20; ////////////////////////////////////////////////////////////// // CONSTANTS // ////////////////////////////////////////////////////////////// address constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; ////////////////////////////////////////////////////////////// // INTERNAL FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev dispatches tokens via a liquidity bridge or exchange /// @param bridge_ Bridge address to pass tokens to /// @param txData_ liquidity bridge data /// @param token_ Token caller deposits into superform /// @param amount_ Amount of tokens to deposit /// @param nativeAmount_ msg.value or msg.value + native tokens function _dispatchTokens( address bridge_, bytes memory txData_, address token_, uint256 amount_, uint256 nativeAmount_ ) internal virtual { if (amount_ == 0) { revert Error.ZERO_AMOUNT(); } if (bridge_ == address(0)) { revert Error.ZERO_ADDRESS(); } if (token_ != NATIVE) { IERC20(token_).safeIncreaseAllowance(bridge_, amount_); } else { if (nativeAmount_ < amount_) revert Error.INSUFFICIENT_NATIVE_AMOUNT(); if (nativeAmount_ > address(this).balance) revert Error.INSUFFICIENT_BALANCE(); } (bool success,) = payable(bridge_).call{ value: nativeAmount_ }(txData_); if (!success) revert Error.FAILED_TO_EXECUTE_TXDATA(token_); if (token_ != NATIVE) { IERC20 token = IERC20(token_); if (token.allowance(address(this), bridge_) > 0) token.forceApprove(bridge_, 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC-1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC-1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; /// @title ISuperRegistry /// @dev Interface for SuperRegistry /// @author Zeropoint Labs interface ISuperRegistry { ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev emitted when permit2 is set. event SetPermit2(address indexed permit2); /// @dev is emitted when an address is set. event AddressUpdated( bytes32 indexed protocolAddressId, uint64 indexed chainId, address indexed oldAddress, address newAddress ); /// @dev is emitted when a new token bridge is configured. event SetBridgeAddress(uint256 indexed bridgeId, address indexed bridgeAddress); /// @dev is emitted when a new bridge validator is configured. event SetBridgeValidator(uint256 indexed bridgeId, address indexed bridgeValidator); /// @dev is emitted when a new amb is configured. event SetAmbAddress(uint8 indexed ambId_, address indexed ambAddress_, bool indexed isBroadcastAMB_); /// @dev is emitted when a new state registry is configured. event SetStateRegistryAddress(uint8 indexed registryId_, address indexed registryAddress_); /// @dev is emitted when a new delay is configured. event SetDelay(uint256 indexed oldDelay_, uint256 indexed newDelay_); /// @dev is emitted when a new vault limit is configured event SetVaultLimitPerDestination(uint64 indexed chainId_, uint256 indexed vaultLimit_); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev gets the deposit rescue delay function delay() external view returns (uint256); /// @dev returns the permit2 address function PERMIT2() external view returns (address); /// @dev returns the id of the superform router module function SUPERFORM_ROUTER() external view returns (bytes32); /// @dev returns the id of the superform factory module function SUPERFORM_FACTORY() external view returns (bytes32); /// @dev returns the id of the superform paymaster contract function PAYMASTER() external view returns (bytes32); /// @dev returns the id of the superform payload helper contract function PAYMENT_HELPER() external view returns (bytes32); /// @dev returns the id of the core state registry module function CORE_STATE_REGISTRY() external view returns (bytes32); /// @dev returns the id of the timelock form state registry module function TIMELOCK_STATE_REGISTRY() external view returns (bytes32); /// @dev returns the id of the broadcast state registry module function BROADCAST_REGISTRY() external view returns (bytes32); /// @dev returns the id of the super positions module function SUPER_POSITIONS() external view returns (bytes32); /// @dev returns the id of the super rbac module function SUPER_RBAC() external view returns (bytes32); /// @dev returns the id of the payload helper module function PAYLOAD_HELPER() external view returns (bytes32); /// @dev returns the id of the dst swapper keeper function DST_SWAPPER() external view returns (bytes32); /// @dev returns the id of the emergency queue function EMERGENCY_QUEUE() external view returns (bytes32); /// @dev returns the id of the superform receiver function SUPERFORM_RECEIVER() external view returns (bytes32); /// @dev returns the id of the payment admin keeper function PAYMENT_ADMIN() external view returns (bytes32); /// @dev returns the id of the core state registry processor keeper function CORE_REGISTRY_PROCESSOR() external view returns (bytes32); /// @dev returns the id of the broadcast registry processor keeper function BROADCAST_REGISTRY_PROCESSOR() external view returns (bytes32); /// @dev returns the id of the timelock form state registry processor keeper function TIMELOCK_REGISTRY_PROCESSOR() external view returns (bytes32); /// @dev returns the id of the core state registry updater keeper function CORE_REGISTRY_UPDATER() external view returns (bytes32); /// @dev returns the id of the core state registry updater keeper function CORE_REGISTRY_RESCUER() external view returns (bytes32); /// @dev returns the id of the core state registry updater keeper function CORE_REGISTRY_DISPUTER() external view returns (bytes32); /// @dev returns the id of the core state registry updater keeper function DST_SWAPPER_PROCESSOR() external view returns (bytes32); /// @dev gets the address of a contract on current chain /// @param id_ is the id of the contract function getAddress(bytes32 id_) external view returns (address); /// @dev gets the address of a contract on a target chain /// @param id_ is the id of the contract /// @param chainId_ is the chain id of that chain function getAddressByChainId(bytes32 id_, uint64 chainId_) external view returns (address); /// @dev gets the address of a bridge /// @param bridgeId_ is the id of a bridge /// @return bridgeAddress_ is the address of the form function getBridgeAddress(uint8 bridgeId_) external view returns (address bridgeAddress_); /// @dev gets the address of a bridge validator /// @param bridgeId_ is the id of a bridge /// @return bridgeValidator_ is the address of the form function getBridgeValidator(uint8 bridgeId_) external view returns (address bridgeValidator_); /// @dev gets the address of a amb /// @param ambId_ is the id of a bridge /// @return ambAddress_ is the address of the form function getAmbAddress(uint8 ambId_) external view returns (address ambAddress_); /// @dev gets the id of the amb /// @param ambAddress_ is the address of an amb /// @return ambId_ is the identifier of an amb function getAmbId(address ambAddress_) external view returns (uint8 ambId_); /// @dev gets the address of the registry /// @param registryId_ is the id of the state registry /// @return registryAddress_ is the address of the state registry function getStateRegistry(uint8 registryId_) external view returns (address registryAddress_); /// @dev gets the id of the registry /// @notice reverts if the id is not found /// @param registryAddress_ is the address of the state registry /// @return registryId_ is the id of the state registry function getStateRegistryId(address registryAddress_) external view returns (uint8 registryId_); /// @dev gets the safe vault limit /// @param chainId_ is the id of the remote chain /// @return vaultLimitPerDestination_ is the safe number of vaults to deposit /// without hitting out of gas error function getVaultLimitPerDestination(uint64 chainId_) external view returns (uint256 vaultLimitPerDestination_); /// @dev helps validate if an address is a valid state registry /// @param registryAddress_ is the address of the state registry /// @return valid_ a flag indicating if its valid. function isValidStateRegistry(address registryAddress_) external view returns (bool valid_); /// @dev helps validate if an address is a valid amb implementation /// @param ambAddress_ is the address of the amb implementation /// @return valid_ a flag indicating if its valid. function isValidAmbImpl(address ambAddress_) external view returns (bool valid_); /// @dev helps validate if an address is a valid broadcast amb implementation /// @param ambAddress_ is the address of the broadcast amb implementation /// @return valid_ a flag indicating if its valid. function isValidBroadcastAmbImpl(address ambAddress_) external view returns (bool valid_); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @dev sets the deposit rescue delay /// @param delay_ the delay in seconds before the deposit rescue can be finalized function setDelay(uint256 delay_) external; /// @dev sets the permit2 address /// @param permit2_ the address of the permit2 contract function setPermit2(address permit2_) external; /// @dev sets the safe vault limit /// @param chainId_ is the remote chain identifier /// @param vaultLimit_ is the max limit of vaults per transaction function setVaultLimitPerDestination(uint64 chainId_, uint256 vaultLimit_) external; /// @dev sets new addresses on specific chains. /// @param ids_ are the identifiers of the address on that chain /// @param newAddresses_ are the new addresses on that chain /// @param chainIds_ are the chain ids of that chain function batchSetAddress( bytes32[] calldata ids_, address[] calldata newAddresses_, uint64[] calldata chainIds_ ) external; /// @dev sets a new address on a specific chain. /// @param id_ the identifier of the address on that chain /// @param newAddress_ the new address on that chain /// @param chainId_ the chain id of that chain function setAddress(bytes32 id_, address newAddress_, uint64 chainId_) external; /// @dev allows admin to set the bridge address for an bridge id. /// @notice this function operates in an APPEND-ONLY fashion. /// @param bridgeId_ represents the bridge unique identifier. /// @param bridgeAddress_ represents the bridge address. /// @param bridgeValidator_ represents the bridge validator address. function setBridgeAddresses( uint8[] memory bridgeId_, address[] memory bridgeAddress_, address[] memory bridgeValidator_ ) external; /// @dev allows admin to set the amb address for an amb id. /// @notice this function operates in an APPEND-ONLY fashion. /// @param ambId_ represents the bridge unique identifier. /// @param ambAddress_ represents the bridge address. /// @param isBroadcastAMB_ represents whether the amb implementation supports broadcasting function setAmbAddress( uint8[] memory ambId_, address[] memory ambAddress_, bool[] memory isBroadcastAMB_ ) external; /// @dev allows admin to set the state registry address for an state registry id. /// @notice this function operates in an APPEND-ONLY fashion. /// @param registryId_ represents the state registry's unique identifier. /// @param registryAddress_ represents the state registry's address. function setStateRegistryAddress(uint8[] memory registryId_, address[] memory registryAddress_) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol"; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC-4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import { IERC1155 } from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol"; /// @title IERC1155A /// @author Zeropoint Labs /// @dev Single/range based id approve capability with conversion to ERC20s interface IERC1155A is IERC1155 { ////////////////////////////////////////////////////////////// // EVENTS // ////////////////////////////////////////////////////////////// /// @dev emitted when single id approval is set event ApprovalForOne(address indexed owner, address indexed spender, uint256 id, uint256 amount); /// @dev emitted when an ERC1155A id is transmuted to an aERC20 event TransmutedToERC20(address indexed user, uint256 id, uint256 amount, address indexed receiver); /// @dev emitted when an aERC20 is transmuted to an ERC1155 id event TransmutedToERC1155A(address indexed user, uint256 id, uint256 amount, address indexed receiver); /// @dev emitted when multiple ERC1155A ids are transmuted to aERC20s event TransmutedBatchToERC20(address indexed user, uint256[] ids, uint256[] amounts, address indexed receiver); /// @dev emitted when multiple aERC20s are transmuted to ERC1155A ids event TransmutedBatchToERC1155A(address indexed user, uint256[] ids, uint256[] amounts, address indexed receiver); ////////////////////////////////////////////////////////////// // ERRORS // ////////////////////////////////////////////////////////////// /// @dev thrown if aERC20 was already registered error AERC20_ALREADY_REGISTERED(); /// @dev thrown if aERC20 was not registered error AERC20_NOT_REGISTERED(); /// @dev thrown if allowance amount will be decreased below zero error DECREASED_ALLOWANCE_BELOW_ZERO(); /// @dev thrown if the associated ERC1155A id has not been minted before registering an aERC20 error ID_NOT_MINTED_YET(); /// @dev thrown if there is a length mismatch in batch operations error LENGTH_MISMATCH(); /// @dev thrown if transfer is made to address 0 error TRANSFER_TO_ADDRESS_ZERO(); /// @dev thrown if address is 0 error ZERO_ADDRESS(); ////////////////////////////////////////////////////////////// // EXTERNAL VIEW FUNCTIONS // ////////////////////////////////////////////////////////////// /// @notice Public getter for existing single id total supply /// @param id id of the ERC1155 function totalSupply(uint256 id) external view returns (uint256); /// @notice Public getter to know if a token id exists /// @dev determines based on total supply for the id /// @param id id of the ERC1155 function exists(uint256 id) external view returns (bool); /// @notice Public getter for existing single id approval /// @param owner address of the owner of the ERC1155A id /// @param spender address of the contract to approve /// @param id id of the ERC1155A to approve function allowance(address owner, address spender, uint256 id) external returns (uint256); /// @notice handy helper to check if a AERC20 is registered /// @param id id of the ERC1155 function aERC20Exists(uint256 id) external view returns (bool); /// @notice Public getter for the address of the aErc20 token for a given ERC1155 id /// @param id id of the ERC1155 to get the aErc20 token address for /// @return aERC20 address of the aErc20 token for the given ERC1155 id function getERC20TokenAddress(uint256 id) external view returns (address aERC20); /// @notice Compute return string from baseURI set for this contract and unique vaultId /// @param id id of the ERC1155 function uri(uint256 id) external view returns (string memory); /// @notice ERC1155A name function name() external view returns (string memory); /// @notice ERC1155A symbol function symbol() external view returns (string memory); ////////////////////////////////////////////////////////////// // EXTERNAL WRITE FUNCTIONS // ////////////////////////////////////////////////////////////// /// @notice Public function for setting single id approval /// @dev Notice `owner` param, it will always be msg.sender, see _setApprovalForOne() /// @param spender address of the contract to approve /// @param id id of the ERC1155A to approve /// @param amount amount of the ERC1155A to approve function setApprovalForOne(address spender, uint256 id, uint256 amount) external; /// @notice Public function for setting multiple id approval /// @dev extension of sigle id approval /// @param spender address of the contract to approve /// @param ids ids of the ERC1155A to approve /// @param amounts amounts of the ERC1155A to approve function setApprovalForMany(address spender, uint256[] memory ids, uint256[] memory amounts) external; /// @notice Public function for increasing single id approval amount /// @dev Re-adapted from ERC20 /// @param spender address of the contract to approve /// @param id id of the ERC1155A to approve /// @param addedValue amount of the allowance to increase by function increaseAllowance(address spender, uint256 id, uint256 addedValue) external returns (bool); /// @notice Public function for decreasing single id approval amount /// @dev Re-adapted from ERC20 /// @param spender address of the contract to approve /// @param id id of the ERC1155A to approve /// @param subtractedValue amount of the allowance to decrease by function decreaseAllowance(address spender, uint256 id, uint256 subtractedValue) external returns (bool); /// @notice Public function for increasing multiple id approval amount at once /// @dev extension of single id increase allowance /// @param spender address of the contract to approve /// @param ids ids of the ERC1155A to approve /// @param addedValues amounts of the allowance to increase by function increaseAllowanceForMany( address spender, uint256[] memory ids, uint256[] memory addedValues ) external returns (bool); /// @notice Public function for decreasing multiple id approval amount at once /// @dev extension of single id decrease allowance /// @param spender address of the contract to approve /// @param ids ids of the ERC1155A to approve /// @param subtractedValues amounts of the allowance to decrease by function decreaseAllowanceForMany( address spender, uint256[] memory ids, uint256[] memory subtractedValues ) external returns (bool); /// @notice Turn ERC1155A id into an aERC20 /// @dev allows owner to send ERC1155A id as an aERC20 to receiver /// @param owner address of the user on whose behalf this transmutation is happening /// @param id id of the ERC20s to transmute to aERC20 /// @param amount amount of the ERC20s to transmute to aERC20 /// @param receiver address of the user to receive the aERC20 token function transmuteToERC20(address owner, uint256 id, uint256 amount, address receiver) external; /// @notice Turn aERC20 into an ERC1155A id /// @dev allows owner to send ERC20 as an ERC1155A id to receiver /// @param owner address of the user on whose behalf this transmutation is happening /// @param id id of the ERC20s to transmute to erc1155 /// @param amount amount of the ERC20s to transmute to erc1155 /// @param receiver address of the user to receive the erc1155 token id function transmuteToERC1155A(address owner, uint256 id, uint256 amount, address receiver) external; /// @notice Turn ERC1155A ids into aERC20s /// @dev allows owner to send ERC1155A ids as aERC20s to receiver /// @param owner address of the user on whose behalf this transmutation is happening /// @param ids ids of the ERC1155A to transmute /// @param amounts amounts of the ERC1155A to transmute /// @param receiver address of the user to receive the aERC20 tokens function transmuteBatchToERC20( address owner, uint256[] memory ids, uint256[] memory amounts, address receiver ) external; /// @notice Turn aERC20s into ERC1155A ids /// @dev allows owner to send aERC20s as ERC1155A ids to receiver /// @param owner address of the user on whose behalf this transmutation is happening /// @param ids ids of the ERC20 to transmute /// @param amounts amounts of the ERC20 to transmute /// @param receiver address of the user to receive the ERC1155 token ids function transmuteBatchToERC1155A( address owner, uint256[] memory ids, uint256[] memory amounts, address receiver ) external; /// @notice payable to allow any implementing cross-chain protocol to be paid for fees for broadcasting /// @dev should emit any required events inside _registerAERC20 internal function /// @param id of the ERC1155 to create a ERC20 for function registerAERC20(uint256 id) external payable returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. * * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC-20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[ERC]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
{ "remappings": [ "solmate/=lib/ERC1155A/lib/solmate/src/", "ERC1155A/=lib/ERC1155A/src/", "@openzeppelin/contracts/=lib/ERC1155A/lib/openzeppelin-contracts/contracts/", "ds-test/=lib/ds-test/src/", "erc4626-tests/=lib/ERC1155A/lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/ERC1155A/lib/openzeppelin-contracts/", "pigeon/=lib/pigeon/src/", "solady/=lib/pigeon/lib/solady/", "super-vaults/=lib/super-vaults/src/", "v2-core/=lib/super-vaults/lib/v2-core/contracts/", "v2-periphery/=lib/super-vaults/lib/v2-periphery/contracts/", "v3-core/=lib/super-vaults/lib/v3-core/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"superRegistry_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"BLOCK_CHAIN_ID_OUT_OF_BOUNDS","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"FAILED_TO_EXECUTE_TXDATA","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT","type":"error"},{"inputs":[],"name":"INSUFFICIENT_BALANCE","type":"error"},{"inputs":[],"name":"INSUFFICIENT_NATIVE_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_ACTION","type":"error"},{"inputs":[],"name":"INVALID_CHAIN_ID","type":"error"},{"inputs":[],"name":"INVALID_DEPOSIT_TOKEN","type":"error"},{"inputs":[],"name":"INVALID_SUPERFORMS_DATA","type":"error"},{"inputs":[],"name":"NO_TXDATA_PRESENT","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZERO_ADDRESS","type":"error"},{"inputs":[],"name":"ZERO_AMOUNT","type":"error"},{"anonymous":false,"inputs":[],"name":"Completed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"payloadId","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"indexed":false,"internalType":"uint8[]","name":"bridgeIds","type":"uint8[]"},{"indexed":false,"internalType":"uint8[]","name":"ambIds","type":"uint8[]"}],"name":"CrossChainInitiatedDepositMulti","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"payloadId","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"superformIds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"bridgeId","type":"uint8"},{"indexed":false,"internalType":"uint8[]","name":"ambIds","type":"uint8[]"}],"name":"CrossChainInitiatedDepositSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"payloadId","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"indexed":false,"internalType":"uint8[]","name":"ambIds","type":"uint8[]"}],"name":"CrossChainInitiatedWithdrawMulti","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"payloadId","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"superformIds","type":"uint256"},{"indexed":false,"internalType":"uint8[]","name":"ambIds","type":"uint8[]"}],"name":"CrossChainInitiatedWithdrawSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RouterDustForwardedToPaymaster","type":"event"},{"inputs":[],"name":"CHAIN_ID","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"forwardDustToPaymaster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"multiDstMultiVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"multiDstMultiVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"multiDstSingleVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[][]","name":"ambIds","type":"uint8[][]"},{"internalType":"uint64[]","name":"dstChainIds","type":"uint64[]"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData[]","name":"superformsData","type":"tuple[]"}],"internalType":"struct MultiDstSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"multiDstSingleVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"payloadIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"singleDirectMultiVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"singleDirectMultiVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"singleDirectSingleVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleDirectSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"singleDirectSingleVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformsData","type":"tuple"}],"internalType":"struct SingleXChainMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"singleXChainMultiVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256[]","name":"superformIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSlippages","type":"uint256[]"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest[]","name":"liqRequests","type":"tuple[]"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool[]","name":"hasDstSwaps","type":"bool[]"},{"internalType":"bool[]","name":"retain4626s","type":"bool[]"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct MultiVaultSFData","name":"superformsData","type":"tuple"}],"internalType":"struct SingleXChainMultiVaultStateReq","name":"req_","type":"tuple"}],"name":"singleXChainMultiVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleXChainSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"singleXChainSingleVaultDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8[]","name":"ambIds","type":"uint8[]"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"components":[{"internalType":"uint256","name":"superformId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"maxSlippage","type":"uint256"},{"components":[{"internalType":"bytes","name":"txData","type":"bytes"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"interimToken","type":"address"},{"internalType":"uint8","name":"bridgeId","type":"uint8"},{"internalType":"uint64","name":"liqDstChainId","type":"uint64"},{"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"internalType":"struct LiqRequest","name":"liqRequest","type":"tuple"},{"internalType":"bytes","name":"permit2data","type":"bytes"},{"internalType":"bool","name":"hasDstSwap","type":"bool"},{"internalType":"bool","name":"retain4626","type":"bool"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"address","name":"receiverAddressSP","type":"address"},{"internalType":"bytes","name":"extraFormData","type":"bytes"}],"internalType":"struct SingleVaultSFData","name":"superformData","type":"tuple"}],"internalType":"struct SingleXChainSingleVaultStateReq","name":"req_","type":"tuple"}],"name":"singleXChainSingleVaultWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"superRegistry","outputs":[{"internalType":"contract ISuperRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162005c8838038062005c888339810160408190526200003491620000a9565b80806001600160a01b0381166200005e5760405163538ba4f960e01b815260040160405180910390fd5b6001600160401b034611156200008757604051637ecdf93360e01b815260040160405180910390fd5b6001600160401b03461660a0526001600160a01b031660805250620000db9050565b600060208284031215620000bc57600080fd5b81516001600160a01b0381168114620000d457600080fd5b9392505050565b60805160a051615afb6200018d6000396000818161020b01528181610333015281816105290152818161079c015281816109b101528181610b5801528181610d3b0152818161111a015281816112cc0152818161172501528181611b2201528181611c7001528181611ff101526128a401526000818161013d015281816122160152818161249001528181612cf6015281816132b901528181613475015281816137d601526141640152615afb6000f3fe6080604052600436106100f75760003560e01c806385e1f4d01161008a578063b19dcc3311610059578063b19dcc331461027e578063e5672e2314610291578063f9d4f18c146102a4578063fa0f64eb146102b757600080fd5b806385e1f4d0146101f957806387493e2114610245578063881d42bb14610258578063ae1068f21461026b57600080fd5b8063407c7b1d116100c6578063407c7b1d1461018f5780634325082e146101a25780634dcd03c0146101c657806367d70a29146101e657600080fd5b8063165b7a3b14610103578063178f00381461011857806324c73dda1461012b5780632c1c0ba41461017c57600080fd5b366100fe57005b600080fd5b6101166101113660046148a8565b6102ca565b005b6101166101263660046148a8565b6104c0565b34801561013757600080fd5b5061015f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61011661018a366004614e40565b6106a7565b61011661019d366004614f58565b6106cb565b3480156101ae57600080fd5b506101b860005481565b604051908152602001610173565b3480156101d257600080fd5b506101166101e1366004614fb8565b6106e2565b6101166101f436600461503b565b6106ee565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160401b039091168152602001610173565b6101166102533660046150dc565b610705565b6101166102663660046150dc565b61071c565b6101166102793660046148a8565b610733565b61011661028c366004614f58565b61091a565b61011661029f36600461503b565b610931565b6101166102b23660046148a8565b610948565b6101166102c5366004614e40565b610b2f565b60006102d63447615184565b905060006102e76020840184615197565b9050905060005b818110156104b1576103036020850185615197565b82818110610313576103136151e7565b905060200201602081019061032891906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b0316036103b5576103b0604051806020016040528086806040019061037e9190615197565b8581811061038e5761038e6151e7565b90506020028101906103a09190615218565b6103a990615239565b9052610b46565b6104a9565b60408051606081019091526104a990806103cf8780615197565b858181106103df576103df6151e7565b90506020028101906103f19190615197565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060209081019061043790880188615197565b85818110610447576104476151e7565b905060200201602081019061045c91906151fd565b6001600160401b031681526020016104776040880188615197565b85818110610487576104876151e7565b90506020028101906104999190615218565b6104a290615239565b9052610d29565b6001016102ee565b506104bb82611034565b505050565b60006104cc3447615184565b905060006104dd6020840184615197565b9050905060005b818110156104b1576104f96020850185615197565b82818110610509576105096151e7565b905060200201602081019061051e91906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b0316036105ab576105a660405180602001604052808680604001906105749190615197565b85818110610584576105846151e7565b90506020028101906105969190615218565b61059f90615245565b90526110f3565b61069f565b604080516060810190915261069f90806105c58780615197565b858181106105d5576105d56151e7565b90506020028101906105e79190615197565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060209081019061062d90880188615197565b8581811061063d5761063d6151e7565b905060200201602081019061065291906151fd565b6001600160401b0316815260200161066d6040880188615197565b8581811061067d5761067d6151e7565b905060200281019061068f9190615218565b61069890615245565b90526112ba565b6001016104e4565b60006106b33447615184565b90506106be82610b46565b6106c781611034565b5050565b60006106d73447615184565b90506106be826110f3565b6106eb816115f8565b50565b60006106fa3447615184565b90506106be826112ba565b60006107113447615184565b90506106be82610d29565b60006107283447615184565b90506106be82611713565b600061073f3447615184565b905060006107506020840184615197565b9050905060005b818110156104b15761076c6020850185615197565b8281811061077c5761077c6151e7565b905060200201602081019061079191906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b03160361081e5761081960405180602001604052808680604001906107e79190615197565b858181106107f7576107f76151e7565b90506020028101906108099190615218565b61081290615245565b9052611afb565b610912565b604080516060810190915261091290806108388780615197565b85818110610848576108486151e7565b905060200281019061085a9190615197565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506020908101906108a090880188615197565b858181106108b0576108b06151e7565b90506020020160208101906108c591906151fd565b6001600160401b031681526020016108e06040880188615197565b858181106108f0576108f06151e7565b90506020028101906109029190615218565b61090b90615245565b9052611c5e565b600101610757565b60006109263447615184565b90506106be82611afb565b600061093d3447615184565b90506106be82611c5e565b60006109543447615184565b905060006109656020840184615197565b9050905060005b818110156104b1576109816020850185615197565b82818110610991576109916151e7565b90506020020160208101906109a691906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000006001600160401b031603610a3357610a2e60405180602001604052808680604001906109fc9190615197565b85818110610a0c57610a0c6151e7565b9050602002810190610a1e9190615218565b610a2790615239565b9052611fe9565b610b27565b6040805160608101909152610b279080610a4d8780615197565b85818110610a5d57610a5d6151e7565b9050602002810190610a6f9190615197565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602090810190610ab590880188615197565b85818110610ac557610ac56151e7565b9050602002016020810190610ada91906151fd565b6001600160401b03168152602001610af56040880188615197565b85818110610b0557610b056151e7565b9050602002810190610b179190615218565b610b2090615239565b9052611713565b60010161096c565b6000610b3b3447615184565b90506106be82611fe9565b610b4e614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000000016604082018190528251610b8c916000612160565b610ba9576040516329c0f4af60e01b815260040160405180910390fd5b610bc0600080516020615a86833981519152612477565b82518051602090910151604051631ac8311560e21b81526001600160a01b039390931692636b20c45492610bf892339260040161528d565b600060405180830381600087803b158015610c1257600080fd5b505af1158015610c26573d6000803e3d6000fd5b5050604080516101408101825260008082528651516020808401919091528751015182840152865190920151606080830191909152865101516080808301919091528651015160a082015285515151919350915060c08201906001600160401b03811115610c9657610c966148e4565b604051908082528060200260200182016040528015610cbf578160200160208202803683370190505b508152845160e001516020820152845161010001516001600160a01b03166040820152845161014001516060909101529050610cfb8133612509565b6040517fe06452d00b2b58f14a1fa6d499ea982ff93ea827ae700ea9ba03f4daddc94bc190600090a1505050565b610d31614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000000081166040830181905260208401519091169003610d8a5760405163f33d056960e01b815260040160405180910390fd5b610d9e826040015183602001516000612160565b610dbb576040516329c0f4af60e01b815260040160405180910390fd5b610dd2600080516020615a86833981519152612477565b6001600160a01b0316636b20c454338460400151600001518560400151602001516040518463ffffffff1660e01b8152600401610e119392919061528d565b600060405180830381600087803b158015610e2b57600080fd5b505af1158015610e3f573d6000803e3d6000fd5b505050506000808154610e51906152c3565b91829055506060808301918252604080516101408101825292518352848101805151602080860191909152815181015185840152815190920151848401528051909201516080808501919091528251015160a084015290510151516000919060c08201906001600160401b03811115610ecc57610ecc6148e4565b604051908082528060200260200182016040528015610ef5578160200160208202803683370190505b5081526040808601805160e001516020840152805161010001516001600160a01b03168284015251610140015160609092019190915280516101208101909152909150610fd790806001815260200183604051602001610f55919061543c565b60405160208183030381529060405281526020018560400151600001518152602001336001600160a01b0316815260200185600001518152602001600160ff16815260200184604001516001600160401b0316815260200185602001516001600160401b0316815260200184606001518152508460400151610120015161261f565b82602001516001600160401b031682606001517fa23e8d828c95d9dae2c33b414d2a56816a00ecdf695c52f69f0f0932f05c1a488560400151600001518660000151604051611027929190615583565b60405180910390a3505050565b8047101561105557604051632858f9ab60e11b815260040160405180910390fd5b60006110618247615184565b905080156106c7576110927fbddfa8c39a1f6275bcfb3aa5c70638c466999edbf14e6162d81b3492caca9fce612477565b604051630c02f93f60e21b81523360048201526001600160a01b03919091169063300be4fc9083906024016000604051808303818588803b1580156110d657600080fd5b505af11580156110ea573d6000803e3d6000fd5b50505050505050565b805180516020820151604083015160608401516101008501516101209095015161115995907f00000000000000000000000000000000000000000000000000000000000000006000611152600080516020615aa6833981519152612477565b60006128a0565b611176576040516329c0f4af60e01b815260040160405180910390fd5b61118d600080516020615a86833981519152612477565b81518051602090910151604051630995a40b60e11b8152336004820152602481019290925260448201526001600160a01b03919091169063132b481690606401600060405180830381600087803b1580156111e757600080fd5b505af11580156111fb573d6000803e3d6000fd5b505060408051610140808201835260008083528651516020808501919091528751015183850152865190930151606080840191909152865101516080808401919091528651015160a083015260c0820192909252845160e0908101511515908201528451610100908101516001600160a01b031690820152845190910151610120820152915061128d90508133612aa0565b6040517fe06452d00b2b58f14a1fa6d499ea982ff93ea827ae700ea9ba03f4daddc94bc190600090a15050565b6112c2614814565b6001600160401b037f00000000000000000000000000000000000000000000000000000000000000008116604083018190526020840151909116900361131b5760405163f33d056960e01b815260040160405180910390fd5b604080830151805160208083015193830151606084015161010085015161012090950151928801516113689694959293919291906000611152600080516020615aa6833981519152612477565b611385576040516329c0f4af60e01b815260040160405180910390fd5b61139c600080516020615a86833981519152612477565b60408084015180516020909101519151630995a40b60e11b8152336004820152602481019190915260448101919091526001600160a01b03919091169063132b481690606401600060405180830381600087803b1580156113fc57600080fd5b505af1158015611410573d6000803e3d6000fd5b505050506000808154611422906152c3565b918290555060608281019182526040805161014080820183529351815285820180515160208084019190915281510151828401528051830151828501528051909301516080808301919091528351015160a0820152600060c08201819052835160e0908101511515908301528351610100908101516001600160a01b0316908301529251909301516101208401528051600180825281830190925290816020016020820280368337019050509050836040015160000151816000815181106114ec576114ec6151e7565b602090810291909101015260408051610120810190915261159a908060018152602001846040516020016115209190615647565b6040516020818303038152906040528152602001838152602001336001600160a01b0316815260200186600001518152602001600060ff16815260200185604001516001600160401b0316815260200186602001516001600160401b0316815260200185606001518152508560400151610120015161261f565b83602001516001600160401b031683606001517f4dbd819bde4882c7e19b36e6205148983b9e3b863a72a2f8f5576044e4d41b3386604001516000015187600001516040516115ea92919061565a565b60405180910390a350505050565b6001600160a01b03811661161f5760405163538ba4f960e01b815260040160405180910390fd5b600061164a7fbddfa8c39a1f6275bcfb3aa5c70638c466999edbf14e6162d81b3492caca9fce612477565b6040516370a0823160e01b815230600482015290915082906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ba9190615673565b9050801561170d576116d66001600160a01b0383168483612aec565b60405181906001600160a01b038616907f3b6a4197c91aad8284f4773a802871b6ef942f15034468da745ac41325904bc590600090a35b50505050565b61171b614814565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000811660408301819052602084015190911690036117745760405163f33d056960e01b815260040160405180910390fd5b611788826040015183602001516001612160565b6117a5576040516329c0f4af60e01b815260040160405180910390fd5b60008081546117b3906152c3565b91829055506060828101918252604080516101408082018352935181528582018051516020808401919091528151810151838501528151840151838601528151909401516080808401919091528151015160a0830152805160c09081015190830152805160e090810151908301528051610100908101516001600160a01b03169083015280519094015161012082015292515151815160008082529381019092529082908190611870903390896040015160a00151886001612b4b565b91509150826001600160401b0381111561188c5761188c6148e4565b6040519080825280602002602001820160405280156118c557816020015b6118b2614861565b8152602001906001900390816118aa5790505b5060a086015260005b838110156119ea5787604001516080015181815181106118f0576118f06151e7565b6020026020010151876020018190525061192a886040015160000151828151811061191d5761191d6151e7565b6020026020010151613261565b905050809550506119996040518060c0016040528089602001518152602001876001600160a01b0316815260200189604001516001600160401b031681526020018a602001516001600160401b03168152602001336001600160a01b0316815260200160011515815250613295565b156119e2578660200151604001518660a0015182815181106119bd576119bd6151e7565b6020026020010151604001906001600160a01b031690816001600160a01b0316815250505b6001016118ce565b50604080516101208101909152611a9690806000815260200187604051602001611a14919061543c565b60405160208183030381529060405281526020018960400151600001518152602001336001600160a01b0316815260200189600001518152602001600160ff16815260200188604001516001600160401b0316815260200189602001516001600160401b0316815260200188606001518152508860400151610120015161261f565b86602001516001600160401b031686606001517f3442cbaf79658b5b8750f04e22ec7e6a0d1a64699201b231b23dad10fa9ddcc989604001516000015185858c60000151604051611aea949392919061568c565b60405180910390a350505050505050565b8051805160208201516040830151606084015161010085015161012090950151611b5a95907f00000000000000000000000000000000000000000000000000000000000000006001611152600080516020615aa6833981519152612477565b611b77576040516329c0f4af60e01b815260040160405180910390fd5b60006040518061014001604052806000815260200183600001516000015181526020018360000151602001518152602001836000015160400151815260200183600001516060015181526020018360000151608001518152602001600015158152602001836000015160e0015115158152602001836000015161010001516001600160a01b0316815260200183600001516101400151815250905061128d6040518060800160405280336001600160a01b03168152602001846000015160a001518152602001846000015161012001516001600160a01b0316815260200183815250613573565b611c66614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000000081166040830181905260208401519091169003611cbf5760405163f33d056960e01b815260040160405180910390fd5b60408083015180516020808301519383015160608401516101008501516101209095015192880151611d0c9694959293919291906001611152600080516020615aa6833981519152612477565b611d29576040516329c0f4af60e01b815260040160405180910390fd5b6000808154611d37906152c3565b91829055506060808301918252604080516101408082018352935181528582018051516020808401919091528151015182840152805190920151818401528151909201516080808401919091528151015160a0830152805160c090810151151590830152805160e0908101511515908301528051610100908101516001600160a01b031690830152805190920151610120820152905151600090611dda90613261565b50509050600080611df8336000886040015160a00151876001613737565b91509150611e04614861565b611e706040518060c001604052808960400151608001518152602001866001600160a01b0316815260200188604001516001600160401b0316815260200189602001516001600160401b03168152602001336001600160a01b0316815260200160011515815250613295565b15611e9057604080880151608001518101516001600160a01b0316908201525b60a085018190526040805160018082528183019092526000916020808301908036833701905050905087604001516000015181600081518110611ed557611ed56151e7565b6020908102919091010152604080516101208101909152611f8390806000815260200188604051602001611f099190615647565b6040516020818303038152906040528152602001838152602001336001600160a01b031681526020018a600001518152602001600060ff16815260200189604001516001600160401b031681526020018a602001516001600160401b0316815260200189606001518152508960400151610120015161261f565b87602001516001600160401b031687606001517f718b2e429b305262cd4094e2ee5ecd54cb40d7fa42ca6bb16f2a0acbd49ef8b58a604001516000015187878d60000151604051611fd794939291906156e4565b60405180910390a35050505050505050565b8051612017907f00000000000000000000000000000000000000000000000000000000000000006001612160565b612034576040516329c0f4af60e01b815260040160405180910390fd5b60006040518061014001604052806000815260200183600001516000015181526020018360000151602001518152602001836000015160400151815260200183600001516060015181526020018360000151608001518152602001836000015160200151516001600160401b038111156120b0576120b06148e4565b6040519080825280602002602001820160405280156120d9578160200160208202803683370190505b508152602001836000015160e001518152602001836000015161010001516001600160a01b0316815260200183600001516101400151815250905061128d6040518060800160405280336001600160a01b03168152602001846000015160a001518152602001846000015161012001516001600160a01b0316815260200183815250613b1f565b602083015151835151608085015151600092919082158061217f575080155b156121905760009350505050612470565b8083146121a35760009350505050612470565b82821415806121b757508660400151518214155b806121c757508660600151518214155b806121d757508660c00151518214155b806121e757508660e00151518214155b156121f85760009350505050612470565b60405163bffc1e1360e01b81526001600160401b03871660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bffc1e1390602401602060405180830381865afa158015612265573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122899190615673565b82111561229c5760009350505050612470565b6101008701516001600160a01b03166122bb5760009350505050612470565b84156122ee576101208701516001600160a01b03166122e05760009350505050612470565b6122ee876101200151613eb9565b6000612307600080516020615aa6833981519152612477565b905060005b84811015612466576123a58960000151828151811061232d5761232d6151e7565b60200260200101518a60200151838151811061234b5761234b6151e7565b60200260200101518b604001518481518110612369576123696151e7565b60200260200101518c606001518581518110612387576123876151e7565b60200260200101518d61010001518e61012001518e8e8a60016128a0565b6123b757600095505050505050612470565b6000896080015182815181106123cf576123cf6151e7565b602002602001015160400151905060006001600160a01b0316816001600160a01b03161461245d5760005b8281101561245b57828114612453578a60800151818151811061241f5761241f6151e7565b6020026020010151604001516001600160a01b0316826001600160a01b031603612453576000975050505050505050612470565b6001016123fa565b505b5060010161230c565b5060019450505050505b9392505050565b6040516321f8a72160e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906321f8a72190602401602060405180830381865afa1580156124df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612503919061570c565b92915050565b60006125188360200151613f86565b805190915060005b818110156126185761261083828151811061253d5761253d6151e7565b6020026020010151866000015187602001518481518110612560576125606151e7565b60200260200101518860400151858151811061257e5761257e6151e7565b60200260200101518960600151868151811061259c5761259c6151e7565b60200260200101518a6080015187815181106125ba576125ba6151e7565b60200260200101518b60a0015188815181106125d8576125d86151e7565b60200260200101518c60e0015189815181106125f6576125f66151e7565b60200260200101518d61010001518e61012001518e61402b565b600101612520565b5050505050565b600061268a8360000151600181111561263a5761263a6152dc565b60a0850151606086015160c08088015160ff9490941660109390931b62ff0000169290921760209190911b640100000000600160c01b03161791901b6001600160c01b0319161763010000001790565b90506000604051806040016040528083815260200185602001518152506040516020016126b79190615729565b60405160208183030381529060405290506000806126f47fab437a16135e856111e538dc45051dd9c2778c6069d25a22fb9ac4766c356aa1612477565b6001600160a01b0316633283166a8760e001518860800151866040518463ffffffff1660e01b815260040161272b9392919061574e565b600060405180830381865afa158015612748573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261277091908101906157c7565b9150915061278b600080516020615a86833981519152612477565b610100870151604051634ec1bec760e01b81526004810191909152602481018690526001600160a01b0387811660448301529190911690634ec1bec790606401600060405180830381600087803b1580156127e557600080fd5b505af11580156127f9573d6000803e3d6000fd5b505050506128267f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b612477565b6001600160a01b03166323de31e183886060015189608001518a60e0015188876040518763ffffffff1660e01b815260040161286695949392919061580d565b6000604051808303818588803b15801561287f57600080fd5b505af1158015612893573d6000803e3d6000fd5b5050505050505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160401b0316856001600160401b0316148015612949575060405163b5c7569760e01b8152600481018c90526001600160a01b0384169063b5c7569790602401602060405180830381865afa158015612923573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129479190615872565b155b1561295657506000612a92565b6000806129628d613261565b9250925050806001600160401b0316876001600160401b03161461298b57600092505050612a92565b6127108a11156129a057600092505050612a92565b8b15806129ab57508a155b156129bb57600092505050612a92565b831580156129d057506001600160a01b038916155b156129e057600092505050612a92565b8515612a8b5760405163596db71760e01b815263ffffffff831660048201526001600160a01b0386169063596db71790602401602060405180830381865afa158015612a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a549190615872565b15612a6457600092505050612a92565b83612a8b576001600160a01b038816612a8257600092505050612a92565b612a8b88613eb9565b6001925050505b9a9950505050505050505050565b6000612aaf8360200151613261565b505090506104bb81846000015185602001518660400151876060015188608001518960a001518a60e001518b61010001518c61012001518c61402b565b6040516001600160a01b038381166024830152604482018390526104bb91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506140fd565b606080612ba860405180610100016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160006001600160a01b031681525090565b60008560a00151600081518110612bc157612bc16151e7565b60209081029190910181015181015160a08801515191840182905291506001600160401b03811115612bf557612bf56148e4565b604051908082528060200260200182016040528015612c1e578160200160208202803683370190505b5060a083015260208201516001600160401b03811115612c4057612c406148e4565b604051908082528060200260200182016040528015612c69578160200160208202803683370190505b5060c083015260005b8260200151811015612ea7578660a001518181518110612c9457612c946151e7565b6020026020010151606001518360c001518281518110612cb657612cb66151e7565b602002602001019060ff16908160ff16815250508660a001518181518110612ce057612ce06151e7565b60200260200101516000015151600014612e5e577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e85b2b548460c001518381518110612d3957612d396151e7565b60200260200101516040518263ffffffff1660e01b8152600401612d66919060ff91909116815260200190565b602060405180830381865afa158015612d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612da7919061570c565b6001600160a01b0316639bbbb5c88860a001518381518110612dcb57612dcb6151e7565b60200260200101516000015160006040518363ffffffff1660e01b8152600401612df692919061588f565b602060405180830381865afa158015612e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e379190615673565b8360a001518281518110612e4d57612e4d6151e7565b602002602001018181525050612e9f565b86604001518181518110612e7457612e746151e7565b60200260200101518360a001518281518110612e9257612e926151e7565b6020026020010181815250505b600101612c72565b506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14613247576001600160a01b03811682528651606083015260005b8260200151811015612fd25782600001516001600160a01b03168760a001518281518110612f1257612f126151e7565b6020026020010151602001516001600160a01b031614612f455760405163563abc2760e01b815260040160405180910390fd5b60008760a001518281518110612f5d57612f5d6151e7565b602002602001015160000151519050806000148015612f795750865b15612f9757604051633918ba7d60e21b815260040160405180910390fd5b8360a001518281518110612fad57612fad6151e7565b602002602001015184604001818151612fc691906158b3565b90525050600101612ee2565b508160400151600003612ff857604051630f6fa54560e41b815260040160405180910390fd5b6060820151156131165760008060008980602001905181019061301b91906158c6565b925092509250613029614160565b8560e001906001600160a01b031690816001600160a01b0316815250508460e001516001600160a01b03166330f28b7a604051806060016040528060405180604001604052808a600001516001600160a01b031681526020018a604001518152508152602001868152602001858152506040518060400160405280306001600160a01b0316815260200189604001518152508f856040518563ffffffff1660e01b81526004016130dc9493929190615915565b600060405180830381600087803b1580156130f657600080fd5b505af115801561310a573d6000803e3d6000fd5b505050505050506131cf565b60408281015183519151636eb1769f60e11b81526001600160a01b038c811660048301523060248301529192919091169063dd62ed3e90604401602060405180830381865afa15801561316d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131919190615673565b10156131af576040516263c69360e11b815260040160405180910390fd5b604082015182516131cf916001600160a01b03909116908b9030906141e9565b8751608083015260005b82608001518110156132455761323d8982815181106131fa576131fa6151e7565b60200260200101518460a001518381518110613218576132186151e7565b602002602001015185600001516001600160a01b03166142229092919063ffffffff16565b6001016131d9565b505b8160a001518260c001519350935050509550959350505050565b8060a081901c60c082901c600081900361328e5760405163030042b760e01b815260040160405180910390fd5b9193909250565b805160600151604051633a16cad560e21b815260ff909116600482015260009081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e85b2b5490602401602060405180830381865afa158015613308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061332c919061570c565b9050806001600160a01b031663c87439eb604051806101200160405280866000015160000151815260200186604001516001600160401b0316815260200186606001516001600160401b031681526020018660000151608001516001600160401b031681526020018660a001511515815260200186602001516001600160a01b0316815260200186608001516001600160a01b031681526020018660000151602001516001600160a01b031681526020018660000151604001516001600160a01b03168152506040518263ffffffff1660e01b815260040161340e9190615976565b602060405180830381865afa15801561342b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061344f9190615872565b83516060015160405163ca7adffb60e01b815260ff909116600482015290925061356d907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063ca7adffb90602401602060405180830381865afa1580156134c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134e8919061570c565b8451805160209091015160405163137776b960e31b81526001600160a01b03861690639bbbb5c89061352190859060019060040161588f565b602060405180830381865afa15801561353e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135629190615673565b875160a001516142ac565b50919050565b6040805180820190915260008082526020820152613598826060015160200151613261565b50506001600160a01b03168082528251602084015160608501516135bf9391906000613737565b5050604080516101808101825282516001600160a01b0390811682526060808601805151602080860191909152815101518486015280519094015181840152835101516080808401919091528351015160a080840191909152835160e090810151151560c085015284518201519084015283516101009081015183169084015283516101209081015190840152925183015190920151610140820152835190911661016082015261366f906144b1565b602082018190521580159061368a5750816060015160e00151155b156106c7576136a6600080516020615a86833981519152612477565b6001600160a01b0316638d04e40e836040015184606001516020015184602001516040518463ffffffff1660e01b8152600401613701939291906001600160a01b039390931683526020830191909152604082015260600190565b600060405180830381600087803b15801561371b57600080fd5b505af115801561372f573d6000803e3d6000fd5b505050505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101829052819060a0850180516060015160ff166080830152515151602082018190521580156137905750835b156137ae57604051633918ba7d60e21b815260040160405180910390fd5b6020810151156138c9576080810151604051633a16cad560e21b815260ff90911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e85b2b5490602401602060405180830381865afa158015613825573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613849919061570c565b60a08601515160405163137776b960e31b81526001600160a01b039290921691639bbbb5c89161387e9160009060040161588f565b602060405180830381865afa15801561389b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138bf9190615673565b60608201526138d4565b604085015160608201525b60a0850151602001516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14613b065760a0850151602001516001600160a01b03168152855115613a2357613923614160565b6001600160a01b031660a082015285516000908190819061394d908a016020908101908b016158c6565b9250925092508360a001516001600160a01b03166330f28b7a6040518060600160405280604051806040016040528089600001516001600160a01b0316815260200189606001518152508152602001868152602001858152506040518060400160405280306001600160a01b0316815260200188606001518152508e856040518563ffffffff1660e01b81526004016139e99493929190615915565b600060405180830381600087803b158015613a0357600080fd5b505af1158015613a17573d6000803e3d6000fd5b50505050505050613ad9565b60608101518151604051636eb1769f60e11b81526001600160a01b038b811660048301523060248301529091169063dd62ed3e90604401602060405180830381865afa158015613a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a9b9190615673565b1015613ab9576040516263c69360e11b815260040160405180910390fd5b60608101518151613ad9916001600160a01b03909116908a9030906141e9565b6001600160a01b03871615613b065760608101518151613b06916001600160a01b03909116908990614222565b8060600151816080015192509250509550959350505050565b613b4a6040518060800160405280600081526020016060815260200160608152602001606081525090565b606082015160200151518082526001600160401b03811115613b6e57613b6e6148e4565b604051908082528060200260200182016040528015613b97578160200160208202803683370190505b50602082015280516001600160401b03811115613bb657613bb66148e4565b604051908082528060200260200182016040528015613bdf578160200160208202803683370190505b506040820152606082015160200151613bf790613f86565b60208083018290528351908401516060850151613c179391906000612b4b565b505060005b8151811015613e6257613dc260405180610180016040528084602001518481518110613c4a57613c4a6151e7565b60200260200101516001600160a01b0316815260200185606001516000015181526020018560600151602001518481518110613c8857613c886151e7565b602002602001015181526020018560600151604001518481518110613caf57613caf6151e7565b602002602001015181526020018560600151606001518481518110613cd657613cd66151e7565b602002602001015181526020018560600151608001518481518110613cfd57613cfd6151e7565b60200260200101518152602001856060015160e001518481518110613d2457613d246151e7565b602002602001015115158152602001856060015160a001518481518110613d4d57613d4d6151e7565b60200260200101518152602001856060015161010001516001600160a01b03168152602001856060015161012001518152602001856060015160a001518481518110613d9b57613d9b6151e7565b602002602001015160a00151815260200185600001516001600160a01b03168152506144b1565b82604001518281518110613dd857613dd86151e7565b60200260200101818152505081604001518181518110613dfa57613dfa6151e7565b6020026020010151600014158015613e305750826060015160e001518181518110613e2757613e276151e7565b60200260200101515b15613e5a57600082604001518281518110613e4d57613e4d6151e7565b6020026020010181815250505b600101613c1c565b50613e7a600080516020615a86833981519152612477565b6001600160a01b031663d81d0a15836040015184606001516020015184604001516040518463ffffffff1660e01b81526004016137019392919061528d565b6001600160a01b0381163b156106eb576040516301ffc9a760e01b8152630271189760e51b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa925050508015613f30575060408051601f3d908101601f19168201909252613f2d91810190615872565b60015b613f5d57604051632bfa23e760e11b81526001600160a01b03821660048201526024015b60405180910390fd5b806106c757604051632bfa23e760e11b81526001600160a01b0383166004820152602401613f54565b8051606090806001600160401b03811115613fa357613fa36148e4565b604051908082528060200260200182016040528015613fcc578160200160208202803683370190505b50915060005b8181101561402457613fef84828151811061191d5761191d6151e7565b905050838281518110614004576140046151e7565b6001600160a01b0390921660209283029190910190910152600101613fd2565b5050919050565b8a6001600160a01b031663cb829dc36040518061014001604052808d81526020018c81526020018b81526020018a81526020018981526020018881526020016000151581526020018715158152602001866001600160a01b0316815260200185815250836040518363ffffffff1660e01b81526004016140ac929190615a49565b6020604051808303816000875af11580156140cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140ef9190615673565b505050505050505050505050565b60006141126001600160a01b038416836145ac565b905080516000141580156141375750808060200190518101906141359190615872565b155b156104bb57604051635274afe760e01b81526001600160a01b0384166004820152602401613f54565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636afdd8506040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141e4919061570c565b905090565b6040516001600160a01b03848116602483015283811660448301526064820183905261170d9186918216906323b872dd90608401612b19565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015614272573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142969190615673565b905061170d84846142a785856158b3565b6145ba565b816000036142cd57604051630f6fa54560e41b815260040160405180910390fd5b6001600160a01b0385166142f45760405163538ba4f960e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146143315761432c6001600160a01b0384168684614222565b614373565b818110156143525760405163e4f2466360e01b815260040160405180910390fd5b4781111561437357604051632858f9ab60e11b815260040160405180910390fd5b6000856001600160a01b0316828660405161438e9190615a73565b60006040518083038185875af1925050503d80600081146143cb576040519150601f19603f3d011682016040523d82523d6000602084013e6143d0565b606091505b50509050806143fd57604051632accaa1560e01b81526001600160a01b0385166004820152602401613f54565b6001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461372f57604051636eb1769f60e11b81523060048201526001600160a01b038781166024830152859160009183169063dd62ed3e90604401602060405180830381865afa158015614472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144969190615673565b11156110ea576110ea6001600160a01b0382168860006145ba565b600081600001516001600160a01b031663b9232775836101400151604051806101400160405280866020015181526020018660400151815260200186606001518152602001866080015181526020018660a0015181526020018660e0015181526020016000151581526020018660c00151151581526020018661010001516001600160a01b031681526020018661012001518152508561016001516040518463ffffffff1660e01b8152600401614569929190615a49565b60206040518083038185885af1158015614587573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906125039190615673565b60606124708383600061464a565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261460b84826146e7565b61170d576040516001600160a01b0384811660248301526000604483015261464091869182169063095ea7b390606401612b19565b61170d84826140fd565b60608147101561466f5760405163cd78605960e01b8152306004820152602401613f54565b600080856001600160a01b0316848660405161468b9190615a73565b60006040518083038185875af1925050503d80600081146146c8576040519150601f19603f3d011682016040523d82523d6000602084013e6146cd565b606091505b50915091506146dd86838361478f565b9695505050505050565b6000806000846001600160a01b0316846040516147049190615a73565b6000604051808303816000865af19150503d8060008114614741576040519150601f19603f3d011682016040523d82523d6000602084013e614746565b606091505b50915091508180156147705750805115806147705750808060200190518101906147709190615872565b801561478657506000856001600160a01b03163b115b95945050505050565b6060826147a45761479f826147eb565b612470565b81511580156147bb57506001600160a01b0384163b155b156147e457604051639996b31560e01b81526001600160a01b0385166004820152602401613f54565b5080612470565b8051156147fb5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160e08101909152600060a08201908152606060c083015281526020810161483d614861565b815260200160006001600160401b0316815260200160008152602001600081525090565b6040805160c081018252606080825260006020830181905292820183905281018290526080810182905260a081019190915290565b60006060828403121561356d57600080fd5b6000602082840312156148ba57600080fd5b81356001600160401b038111156148d057600080fd5b6148dc84828501614896565b949350505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561491d5761491d6148e4565b60405290565b604051602081016001600160401b038111828210171561491d5761491d6148e4565b604051606081016001600160401b038111828210171561491d5761491d6148e4565b604051601f8201601f191681016001600160401b038111828210171561498f5761498f6148e4565b604052919050565b60006001600160401b038211156149b0576149b06148e4565b5060051b60200190565b600082601f8301126149cb57600080fd5b813560206149e06149db83614997565b614967565b8083825260208201915060208460051b870101935086841115614a0257600080fd5b602086015b84811015614a1e5780358352918301918301614a07565b509695505050505050565b60006001600160401b03821115614a4257614a426148e4565b50601f01601f191660200190565b600082601f830112614a6157600080fd5b8135614a6f6149db82614a29565b818152846020838601011115614a8457600080fd5b816020850160208301376000918101602001919091529392505050565b6001600160a01b03811681146106eb57600080fd5b8035614ac181614aa1565b919050565b803560ff81168114614ac157600080fd5b80356001600160401b0381168114614ac157600080fd5b600060c08284031215614b0057600080fd5b60405160c081016001600160401b038282108183111715614b2357614b236148e4565b816040528293508435915080821115614b3b57600080fd5b50614b4885828601614a50565b8252506020830135614b5981614aa1565b60208201526040830135614b6c81614aa1565b6040820152614b7d60608401614ac6565b6060820152614b8e60808401614ad7565b608082015260a083013560a08201525092915050565b600082601f830112614bb557600080fd5b81356020614bc56149db83614997565b82815260059290921b84018101918181019086841115614be457600080fd5b8286015b84811015614a1e5780356001600160401b03811115614c075760008081fd5b614c158986838b0101614aee565b845250918301918301614be8565b80151581146106eb57600080fd5b8035614ac181614c23565b600082601f830112614c4d57600080fd5b81356020614c5d6149db83614997565b8083825260208201915060208460051b870101935086841115614c7f57600080fd5b602086015b84811015614a1e578035614c9781614c23565b8352918301918301614c84565b60006101608284031215614cb757600080fd5b614cbf6148fa565b905081356001600160401b0380821115614cd857600080fd5b614ce4858386016149ba565b83526020840135915080821115614cfa57600080fd5b614d06858386016149ba565b60208401526040840135915080821115614d1f57600080fd5b614d2b858386016149ba565b60408401526060840135915080821115614d4457600080fd5b614d50858386016149ba565b60608401526080840135915080821115614d6957600080fd5b614d7585838601614ba4565b608084015260a0840135915080821115614d8e57600080fd5b614d9a85838601614a50565b60a084015260c0840135915080821115614db357600080fd5b614dbf85838601614c3c565b60c084015260e0840135915080821115614dd857600080fd5b614de485838601614c3c565b60e08401526101009150614df9828501614ab6565b828401526101209150614e0d828501614ab6565b8284015261014091508184013581811115614e2757600080fd5b614e3386828701614a50565b8385015250505092915050565b600060208284031215614e5257600080fd5b81356001600160401b0380821115614e6957600080fd5b9083019060208286031215614e7d57600080fd5b614e85614923565b823582811115614e9457600080fd5b614ea087828601614ca4565b82525095945050505050565b60006101608284031215614ebf57600080fd5b614ec76148fa565b90508135815260208201356020820152604082013560408201526060820135606082015260808201356001600160401b0380821115614f0557600080fd5b614f1185838601614aee565b608084015260a0840135915080821115614f2a57600080fd5b614f3685838601614a50565b60a0840152614f4760c08501614c31565b60c0840152614de460e08501614c31565b600060208284031215614f6a57600080fd5b81356001600160401b0380821115614f8157600080fd5b9083019060208286031215614f9557600080fd5b614f9d614923565b823582811115614fac57600080fd5b614ea087828601614eac565b600060208284031215614fca57600080fd5b813561247081614aa1565b600082601f830112614fe657600080fd5b81356020614ff66149db83614997565b8083825260208201915060208460051b87010193508684111561501857600080fd5b602086015b84811015614a1e5761502e81614ac6565b835291830191830161501d565b60006020828403121561504d57600080fd5b81356001600160401b038082111561506457600080fd5b908301906060828603121561507857600080fd5b615080614945565b82358281111561508f57600080fd5b61509b87828601614fd5565b8252506150aa60208401614ad7565b60208201526040830135828111156150c157600080fd5b6150cd87828601614eac565b60408301525095945050505050565b6000602082840312156150ee57600080fd5b81356001600160401b038082111561510557600080fd5b908301906060828603121561511957600080fd5b615121614945565b82358281111561513057600080fd5b61513c87828601614fd5565b82525061514b60208401614ad7565b602082015260408301358281111561516257600080fd5b6150cd87828601614ca4565b634e487b7160e01b600052601160045260246000fd5b818103818111156125035761250361516e565b6000808335601e198436030181126151ae57600080fd5b8301803591506001600160401b038211156151c857600080fd5b6020019150600581901b36038213156151e057600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561520f57600080fd5b61247082614ad7565b6000823561015e1983360301811261522f57600080fd5b9190910192915050565b60006125033683614ca4565b60006125033683614eac565b60008151808452602080850194506020840160005b8381101561528257815187529582019590820190600101615266565b509495945050505050565b6001600160a01b03841681526060602082018190526000906152b190830185615251565b82810360408401526146dd8185615251565b6000600182016152d5576152d561516e565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b8381101561530d5781810151838201526020016152f5565b50506000910152565b6000815180845261532e8160208601602086016152f2565b601f01601f19169290920160200192915050565b6000815160c0845261535760c0850182615316565b9050602083015160018060a01b038082166020870152806040860151166040870152505060ff60608401511660608501526001600160401b03608084015116608085015260a083015160a08501528091505092915050565b60008282518085526020808601955060208260051b8401016020860160005b848110156153fc57601f198684030189526153ea838351615342565b988401989250908301906001016153ce565b5090979650505050505050565b60008151808452602080850194506020840160005b8381101561528257815115158752958201959082019060010161541e565b602081528151602082015260006020830151610140806040850152615465610160850183615251565b91506040850151601f19808685030160608701526154838483615251565b935060608701519150808685030160808701526154a08483615251565b935060808701519150808685030160a08701526154bd8483615251565b935060a08701519150808685030160c08701526154da84836153af565b935060c08701519150808685030160e08701526154f78483615409565b935060e087015191506101008187860301818801526155168584615409565b945080880151925050610120615536818801846001600160a01b03169052565b8701518685039091018387015290506146dd8382615316565b60008151808452602080850194506020840160005b8381101561528257815160ff1687529582019590820190600101615564565b6040815260006155966040830185615251565b8281036020840152614786818561554f565b6000610140825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a08301518160a08601526155f082860182615342565b91505060c083015161560660c086018215159052565b5060e083015161561a60e086018215159052565b50610100838101516001600160a01b03169085015261012080840151858303828701526146dd8382615316565b60208152600061247060208301846155a8565b8281526040602082015260006148dc604083018461554f565b60006020828403121561568557600080fd5b5051919050565b60808152600061569f6080830187615251565b82810360208401526156b18187615251565b905082810360408401526156c5818661554f565b905082810360608401526156d9818561554f565b979650505050505050565b84815283602082015260ff831660408201526080606082015260006146dd608083018461554f565b60006020828403121561571e57600080fd5b815161247081614aa1565b6020815281516020820152600060208301516040808401526148dc6060840182615316565b6001600160401b0384168152606060208201526000615770606083018561554f565b82810360408401526146dd8185615316565b600082601f83011261579357600080fd5b81516157a16149db82614a29565b8181528460208386010111156157b657600080fd5b6148dc8260208301602087016152f2565b600080604083850312156157da57600080fd5b8251915060208301516001600160401b038111156157f757600080fd5b61580385828601615782565b9150509250929050565b6001600160a01b038616815260a0602082018190526000906158319083018761554f565b6001600160401b038616604084015282810360608401526158528186615316565b905082810360808401526158668185615316565b98975050505050505050565b60006020828403121561588457600080fd5b815161247081614c23565b6040815260006158a26040830185615316565b905082151560208301529392505050565b808201808211156125035761250361516e565b6000806000606084860312156158db57600080fd5b835192506020840151915060408401516001600160401b038111156158ff57600080fd5b61590b86828701615782565b9150509250925092565b6000610100865160018060a01b03808251168552602082015160208601526020890151604086015260408901516060860152808851166080860152602088015160a086015280871660c086015250508060e08401526156d981840185615316565b6020815260008251610120806020850152615995610140850183615316565b915060208501516159b160408601826001600160401b03169052565b5060408501516001600160401b03811660608601525060608501516001600160401b038116608086015250608085015180151560a08601525060a08501516001600160a01b03811660c08601525060c08501516001600160a01b03811660e08601525060e0850151610100615a30818701836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b604081526000615a5c60408301856155a8565b905060018060a01b03831660208301529392505050565b6000825161522f8184602087016152f256feba0b74768b1de73590a53e1384870dcbc846e5c73bab23c07d71eaa7cbf8411bbcc180fb907e9ae431665de4bc74305c00b7b27442aadd477980ecc4bb14c011a264697066735822122088091fe0ba83aafde520a474398181bb4c729a7bba3965b856b51ac9d273db4064736f6c6343000817003300000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514
Deployed Bytecode
0x6080604052600436106100f75760003560e01c806385e1f4d01161008a578063b19dcc3311610059578063b19dcc331461027e578063e5672e2314610291578063f9d4f18c146102a4578063fa0f64eb146102b757600080fd5b806385e1f4d0146101f957806387493e2114610245578063881d42bb14610258578063ae1068f21461026b57600080fd5b8063407c7b1d116100c6578063407c7b1d1461018f5780634325082e146101a25780634dcd03c0146101c657806367d70a29146101e657600080fd5b8063165b7a3b14610103578063178f00381461011857806324c73dda1461012b5780632c1c0ba41461017c57600080fd5b366100fe57005b600080fd5b6101166101113660046148a8565b6102ca565b005b6101166101263660046148a8565b6104c0565b34801561013757600080fd5b5061015f7f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a251481565b6040516001600160a01b0390911681526020015b60405180910390f35b61011661018a366004614e40565b6106a7565b61011661019d366004614f58565b6106cb565b3480156101ae57600080fd5b506101b860005481565b604051908152602001610173565b3480156101d257600080fd5b506101166101e1366004614fb8565b6106e2565b6101166101f436600461503b565b6106ee565b34801561020557600080fd5b5061022d7f000000000000000000000000000000000000000000000000000000000000008981565b6040516001600160401b039091168152602001610173565b6101166102533660046150dc565b610705565b6101166102663660046150dc565b61071c565b6101166102793660046148a8565b610733565b61011661028c366004614f58565b61091a565b61011661029f36600461503b565b610931565b6101166102b23660046148a8565b610948565b6101166102c5366004614e40565b610b2f565b60006102d63447615184565b905060006102e76020840184615197565b9050905060005b818110156104b1576103036020850185615197565b82818110610313576103136151e7565b905060200201602081019061032891906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000896001600160401b0316036103b5576103b0604051806020016040528086806040019061037e9190615197565b8581811061038e5761038e6151e7565b90506020028101906103a09190615218565b6103a990615239565b9052610b46565b6104a9565b60408051606081019091526104a990806103cf8780615197565b858181106103df576103df6151e7565b90506020028101906103f19190615197565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060209081019061043790880188615197565b85818110610447576104476151e7565b905060200201602081019061045c91906151fd565b6001600160401b031681526020016104776040880188615197565b85818110610487576104876151e7565b90506020028101906104999190615218565b6104a290615239565b9052610d29565b6001016102ee565b506104bb82611034565b505050565b60006104cc3447615184565b905060006104dd6020840184615197565b9050905060005b818110156104b1576104f96020850185615197565b82818110610509576105096151e7565b905060200201602081019061051e91906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000896001600160401b0316036105ab576105a660405180602001604052808680604001906105749190615197565b85818110610584576105846151e7565b90506020028101906105969190615218565b61059f90615245565b90526110f3565b61069f565b604080516060810190915261069f90806105c58780615197565b858181106105d5576105d56151e7565b90506020028101906105e79190615197565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060209081019061062d90880188615197565b8581811061063d5761063d6151e7565b905060200201602081019061065291906151fd565b6001600160401b0316815260200161066d6040880188615197565b8581811061067d5761067d6151e7565b905060200281019061068f9190615218565b61069890615245565b90526112ba565b6001016104e4565b60006106b33447615184565b90506106be82610b46565b6106c781611034565b5050565b60006106d73447615184565b90506106be826110f3565b6106eb816115f8565b50565b60006106fa3447615184565b90506106be826112ba565b60006107113447615184565b90506106be82610d29565b60006107283447615184565b90506106be82611713565b600061073f3447615184565b905060006107506020840184615197565b9050905060005b818110156104b15761076c6020850185615197565b8281811061077c5761077c6151e7565b905060200201602081019061079191906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000896001600160401b03160361081e5761081960405180602001604052808680604001906107e79190615197565b858181106107f7576107f76151e7565b90506020028101906108099190615218565b61081290615245565b9052611afb565b610912565b604080516060810190915261091290806108388780615197565b85818110610848576108486151e7565b905060200281019061085a9190615197565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506020908101906108a090880188615197565b858181106108b0576108b06151e7565b90506020020160208101906108c591906151fd565b6001600160401b031681526020016108e06040880188615197565b858181106108f0576108f06151e7565b90506020028101906109029190615218565b61090b90615245565b9052611c5e565b600101610757565b60006109263447615184565b90506106be82611afb565b600061093d3447615184565b90506106be82611c5e565b60006109543447615184565b905060006109656020840184615197565b9050905060005b818110156104b1576109816020850185615197565b82818110610991576109916151e7565b90506020020160208101906109a691906151fd565b6001600160401b03167f00000000000000000000000000000000000000000000000000000000000000896001600160401b031603610a3357610a2e60405180602001604052808680604001906109fc9190615197565b85818110610a0c57610a0c6151e7565b9050602002810190610a1e9190615218565b610a2790615239565b9052611fe9565b610b27565b6040805160608101909152610b279080610a4d8780615197565b85818110610a5d57610a5d6151e7565b9050602002810190610a6f9190615197565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602090810190610ab590880188615197565b85818110610ac557610ac56151e7565b9050602002016020810190610ada91906151fd565b6001600160401b03168152602001610af56040880188615197565b85818110610b0557610b056151e7565b9050602002810190610b179190615218565b610b2090615239565b9052611713565b60010161096c565b6000610b3b3447615184565b90506106be82611fe9565b610b4e614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000008916604082018190528251610b8c916000612160565b610ba9576040516329c0f4af60e01b815260040160405180910390fd5b610bc0600080516020615a86833981519152612477565b82518051602090910151604051631ac8311560e21b81526001600160a01b039390931692636b20c45492610bf892339260040161528d565b600060405180830381600087803b158015610c1257600080fd5b505af1158015610c26573d6000803e3d6000fd5b5050604080516101408101825260008082528651516020808401919091528751015182840152865190920151606080830191909152865101516080808301919091528651015160a082015285515151919350915060c08201906001600160401b03811115610c9657610c966148e4565b604051908082528060200260200182016040528015610cbf578160200160208202803683370190505b508152845160e001516020820152845161010001516001600160a01b03166040820152845161014001516060909101529050610cfb8133612509565b6040517fe06452d00b2b58f14a1fa6d499ea982ff93ea827ae700ea9ba03f4daddc94bc190600090a1505050565b610d31614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000008981166040830181905260208401519091169003610d8a5760405163f33d056960e01b815260040160405180910390fd5b610d9e826040015183602001516000612160565b610dbb576040516329c0f4af60e01b815260040160405180910390fd5b610dd2600080516020615a86833981519152612477565b6001600160a01b0316636b20c454338460400151600001518560400151602001516040518463ffffffff1660e01b8152600401610e119392919061528d565b600060405180830381600087803b158015610e2b57600080fd5b505af1158015610e3f573d6000803e3d6000fd5b505050506000808154610e51906152c3565b91829055506060808301918252604080516101408101825292518352848101805151602080860191909152815181015185840152815190920151848401528051909201516080808501919091528251015160a084015290510151516000919060c08201906001600160401b03811115610ecc57610ecc6148e4565b604051908082528060200260200182016040528015610ef5578160200160208202803683370190505b5081526040808601805160e001516020840152805161010001516001600160a01b03168284015251610140015160609092019190915280516101208101909152909150610fd790806001815260200183604051602001610f55919061543c565b60405160208183030381529060405281526020018560400151600001518152602001336001600160a01b0316815260200185600001518152602001600160ff16815260200184604001516001600160401b0316815260200185602001516001600160401b0316815260200184606001518152508460400151610120015161261f565b82602001516001600160401b031682606001517fa23e8d828c95d9dae2c33b414d2a56816a00ecdf695c52f69f0f0932f05c1a488560400151600001518660000151604051611027929190615583565b60405180910390a3505050565b8047101561105557604051632858f9ab60e11b815260040160405180910390fd5b60006110618247615184565b905080156106c7576110927fbddfa8c39a1f6275bcfb3aa5c70638c466999edbf14e6162d81b3492caca9fce612477565b604051630c02f93f60e21b81523360048201526001600160a01b03919091169063300be4fc9083906024016000604051808303818588803b1580156110d657600080fd5b505af11580156110ea573d6000803e3d6000fd5b50505050505050565b805180516020820151604083015160608401516101008501516101209095015161115995907f00000000000000000000000000000000000000000000000000000000000000896000611152600080516020615aa6833981519152612477565b60006128a0565b611176576040516329c0f4af60e01b815260040160405180910390fd5b61118d600080516020615a86833981519152612477565b81518051602090910151604051630995a40b60e11b8152336004820152602481019290925260448201526001600160a01b03919091169063132b481690606401600060405180830381600087803b1580156111e757600080fd5b505af11580156111fb573d6000803e3d6000fd5b505060408051610140808201835260008083528651516020808501919091528751015183850152865190930151606080840191909152865101516080808401919091528651015160a083015260c0820192909252845160e0908101511515908201528451610100908101516001600160a01b031690820152845190910151610120820152915061128d90508133612aa0565b6040517fe06452d00b2b58f14a1fa6d499ea982ff93ea827ae700ea9ba03f4daddc94bc190600090a15050565b6112c2614814565b6001600160401b037f00000000000000000000000000000000000000000000000000000000000000898116604083018190526020840151909116900361131b5760405163f33d056960e01b815260040160405180910390fd5b604080830151805160208083015193830151606084015161010085015161012090950151928801516113689694959293919291906000611152600080516020615aa6833981519152612477565b611385576040516329c0f4af60e01b815260040160405180910390fd5b61139c600080516020615a86833981519152612477565b60408084015180516020909101519151630995a40b60e11b8152336004820152602481019190915260448101919091526001600160a01b03919091169063132b481690606401600060405180830381600087803b1580156113fc57600080fd5b505af1158015611410573d6000803e3d6000fd5b505050506000808154611422906152c3565b918290555060608281019182526040805161014080820183529351815285820180515160208084019190915281510151828401528051830151828501528051909301516080808301919091528351015160a0820152600060c08201819052835160e0908101511515908301528351610100908101516001600160a01b0316908301529251909301516101208401528051600180825281830190925290816020016020820280368337019050509050836040015160000151816000815181106114ec576114ec6151e7565b602090810291909101015260408051610120810190915261159a908060018152602001846040516020016115209190615647565b6040516020818303038152906040528152602001838152602001336001600160a01b0316815260200186600001518152602001600060ff16815260200185604001516001600160401b0316815260200186602001516001600160401b0316815260200185606001518152508560400151610120015161261f565b83602001516001600160401b031683606001517f4dbd819bde4882c7e19b36e6205148983b9e3b863a72a2f8f5576044e4d41b3386604001516000015187600001516040516115ea92919061565a565b60405180910390a350505050565b6001600160a01b03811661161f5760405163538ba4f960e01b815260040160405180910390fd5b600061164a7fbddfa8c39a1f6275bcfb3aa5c70638c466999edbf14e6162d81b3492caca9fce612477565b6040516370a0823160e01b815230600482015290915082906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ba9190615673565b9050801561170d576116d66001600160a01b0383168483612aec565b60405181906001600160a01b038616907f3b6a4197c91aad8284f4773a802871b6ef942f15034468da745ac41325904bc590600090a35b50505050565b61171b614814565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000089811660408301819052602084015190911690036117745760405163f33d056960e01b815260040160405180910390fd5b611788826040015183602001516001612160565b6117a5576040516329c0f4af60e01b815260040160405180910390fd5b60008081546117b3906152c3565b91829055506060828101918252604080516101408082018352935181528582018051516020808401919091528151810151838501528151840151838601528151909401516080808401919091528151015160a0830152805160c09081015190830152805160e090810151908301528051610100908101516001600160a01b03169083015280519094015161012082015292515151815160008082529381019092529082908190611870903390896040015160a00151886001612b4b565b91509150826001600160401b0381111561188c5761188c6148e4565b6040519080825280602002602001820160405280156118c557816020015b6118b2614861565b8152602001906001900390816118aa5790505b5060a086015260005b838110156119ea5787604001516080015181815181106118f0576118f06151e7565b6020026020010151876020018190525061192a886040015160000151828151811061191d5761191d6151e7565b6020026020010151613261565b905050809550506119996040518060c0016040528089602001518152602001876001600160a01b0316815260200189604001516001600160401b031681526020018a602001516001600160401b03168152602001336001600160a01b0316815260200160011515815250613295565b156119e2578660200151604001518660a0015182815181106119bd576119bd6151e7565b6020026020010151604001906001600160a01b031690816001600160a01b0316815250505b6001016118ce565b50604080516101208101909152611a9690806000815260200187604051602001611a14919061543c565b60405160208183030381529060405281526020018960400151600001518152602001336001600160a01b0316815260200189600001518152602001600160ff16815260200188604001516001600160401b0316815260200189602001516001600160401b0316815260200188606001518152508860400151610120015161261f565b86602001516001600160401b031686606001517f3442cbaf79658b5b8750f04e22ec7e6a0d1a64699201b231b23dad10fa9ddcc989604001516000015185858c60000151604051611aea949392919061568c565b60405180910390a350505050505050565b8051805160208201516040830151606084015161010085015161012090950151611b5a95907f00000000000000000000000000000000000000000000000000000000000000896001611152600080516020615aa6833981519152612477565b611b77576040516329c0f4af60e01b815260040160405180910390fd5b60006040518061014001604052806000815260200183600001516000015181526020018360000151602001518152602001836000015160400151815260200183600001516060015181526020018360000151608001518152602001600015158152602001836000015160e0015115158152602001836000015161010001516001600160a01b0316815260200183600001516101400151815250905061128d6040518060800160405280336001600160a01b03168152602001846000015160a001518152602001846000015161012001516001600160a01b0316815260200183815250613573565b611c66614814565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000008981166040830181905260208401519091169003611cbf5760405163f33d056960e01b815260040160405180910390fd5b60408083015180516020808301519383015160608401516101008501516101209095015192880151611d0c9694959293919291906001611152600080516020615aa6833981519152612477565b611d29576040516329c0f4af60e01b815260040160405180910390fd5b6000808154611d37906152c3565b91829055506060808301918252604080516101408082018352935181528582018051516020808401919091528151015182840152805190920151818401528151909201516080808401919091528151015160a0830152805160c090810151151590830152805160e0908101511515908301528051610100908101516001600160a01b031690830152805190920151610120820152905151600090611dda90613261565b50509050600080611df8336000886040015160a00151876001613737565b91509150611e04614861565b611e706040518060c001604052808960400151608001518152602001866001600160a01b0316815260200188604001516001600160401b0316815260200189602001516001600160401b03168152602001336001600160a01b0316815260200160011515815250613295565b15611e9057604080880151608001518101516001600160a01b0316908201525b60a085018190526040805160018082528183019092526000916020808301908036833701905050905087604001516000015181600081518110611ed557611ed56151e7565b6020908102919091010152604080516101208101909152611f8390806000815260200188604051602001611f099190615647565b6040516020818303038152906040528152602001838152602001336001600160a01b031681526020018a600001518152602001600060ff16815260200189604001516001600160401b031681526020018a602001516001600160401b0316815260200189606001518152508960400151610120015161261f565b87602001516001600160401b031687606001517f718b2e429b305262cd4094e2ee5ecd54cb40d7fa42ca6bb16f2a0acbd49ef8b58a604001516000015187878d60000151604051611fd794939291906156e4565b60405180910390a35050505050505050565b8051612017907f00000000000000000000000000000000000000000000000000000000000000896001612160565b612034576040516329c0f4af60e01b815260040160405180910390fd5b60006040518061014001604052806000815260200183600001516000015181526020018360000151602001518152602001836000015160400151815260200183600001516060015181526020018360000151608001518152602001836000015160200151516001600160401b038111156120b0576120b06148e4565b6040519080825280602002602001820160405280156120d9578160200160208202803683370190505b508152602001836000015160e001518152602001836000015161010001516001600160a01b0316815260200183600001516101400151815250905061128d6040518060800160405280336001600160a01b03168152602001846000015160a001518152602001846000015161012001516001600160a01b0316815260200183815250613b1f565b602083015151835151608085015151600092919082158061217f575080155b156121905760009350505050612470565b8083146121a35760009350505050612470565b82821415806121b757508660400151518214155b806121c757508660600151518214155b806121d757508660c00151518214155b806121e757508660e00151518214155b156121f85760009350505050612470565b60405163bffc1e1360e01b81526001600160401b03871660048201527f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b03169063bffc1e1390602401602060405180830381865afa158015612265573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122899190615673565b82111561229c5760009350505050612470565b6101008701516001600160a01b03166122bb5760009350505050612470565b84156122ee576101208701516001600160a01b03166122e05760009350505050612470565b6122ee876101200151613eb9565b6000612307600080516020615aa6833981519152612477565b905060005b84811015612466576123a58960000151828151811061232d5761232d6151e7565b60200260200101518a60200151838151811061234b5761234b6151e7565b60200260200101518b604001518481518110612369576123696151e7565b60200260200101518c606001518581518110612387576123876151e7565b60200260200101518d61010001518e61012001518e8e8a60016128a0565b6123b757600095505050505050612470565b6000896080015182815181106123cf576123cf6151e7565b602002602001015160400151905060006001600160a01b0316816001600160a01b03161461245d5760005b8281101561245b57828114612453578a60800151818151811061241f5761241f6151e7565b6020026020010151604001516001600160a01b0316826001600160a01b031603612453576000975050505050505050612470565b6001016123fa565b505b5060010161230c565b5060019450505050505b9392505050565b6040516321f8a72160e01b8152600481018290526000907f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316906321f8a72190602401602060405180830381865afa1580156124df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612503919061570c565b92915050565b60006125188360200151613f86565b805190915060005b818110156126185761261083828151811061253d5761253d6151e7565b6020026020010151866000015187602001518481518110612560576125606151e7565b60200260200101518860400151858151811061257e5761257e6151e7565b60200260200101518960600151868151811061259c5761259c6151e7565b60200260200101518a6080015187815181106125ba576125ba6151e7565b60200260200101518b60a0015188815181106125d8576125d86151e7565b60200260200101518c60e0015189815181106125f6576125f66151e7565b60200260200101518d61010001518e61012001518e61402b565b600101612520565b5050505050565b600061268a8360000151600181111561263a5761263a6152dc565b60a0850151606086015160c08088015160ff9490941660109390931b62ff0000169290921760209190911b640100000000600160c01b03161791901b6001600160c01b0319161763010000001790565b90506000604051806040016040528083815260200185602001518152506040516020016126b79190615729565b60405160208183030381529060405290506000806126f47fab437a16135e856111e538dc45051dd9c2778c6069d25a22fb9ac4766c356aa1612477565b6001600160a01b0316633283166a8760e001518860800151866040518463ffffffff1660e01b815260040161272b9392919061574e565b600060405180830381865afa158015612748573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261277091908101906157c7565b9150915061278b600080516020615a86833981519152612477565b610100870151604051634ec1bec760e01b81526004810191909152602481018690526001600160a01b0387811660448301529190911690634ec1bec790606401600060405180830381600087803b1580156127e557600080fd5b505af11580156127f9573d6000803e3d6000fd5b505050506128267f55b101fc856aff484166c46ad33bc74831c135693c159b0092bb3b72254ffb6b612477565b6001600160a01b03166323de31e183886060015189608001518a60e0015188876040518763ffffffff1660e01b815260040161286695949392919061580d565b6000604051808303818588803b15801561287f57600080fd5b505af1158015612893573d6000803e3d6000fd5b5050505050505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000896001600160401b0316856001600160401b0316148015612949575060405163b5c7569760e01b8152600481018c90526001600160a01b0384169063b5c7569790602401602060405180830381865afa158015612923573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129479190615872565b155b1561295657506000612a92565b6000806129628d613261565b9250925050806001600160401b0316876001600160401b03161461298b57600092505050612a92565b6127108a11156129a057600092505050612a92565b8b15806129ab57508a155b156129bb57600092505050612a92565b831580156129d057506001600160a01b038916155b156129e057600092505050612a92565b8515612a8b5760405163596db71760e01b815263ffffffff831660048201526001600160a01b0386169063596db71790602401602060405180830381865afa158015612a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a549190615872565b15612a6457600092505050612a92565b83612a8b576001600160a01b038816612a8257600092505050612a92565b612a8b88613eb9565b6001925050505b9a9950505050505050505050565b6000612aaf8360200151613261565b505090506104bb81846000015185602001518660400151876060015188608001518960a001518a60e001518b61010001518c61012001518c61402b565b6040516001600160a01b038381166024830152604482018390526104bb91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506140fd565b606080612ba860405180610100016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160006001600160a01b031681525090565b60008560a00151600081518110612bc157612bc16151e7565b60209081029190910181015181015160a08801515191840182905291506001600160401b03811115612bf557612bf56148e4565b604051908082528060200260200182016040528015612c1e578160200160208202803683370190505b5060a083015260208201516001600160401b03811115612c4057612c406148e4565b604051908082528060200260200182016040528015612c69578160200160208202803683370190505b5060c083015260005b8260200151811015612ea7578660a001518181518110612c9457612c946151e7565b6020026020010151606001518360c001518281518110612cb657612cb66151e7565b602002602001019060ff16908160ff16815250508660a001518181518110612ce057612ce06151e7565b60200260200101516000015151600014612e5e577f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b031663e85b2b548460c001518381518110612d3957612d396151e7565b60200260200101516040518263ffffffff1660e01b8152600401612d66919060ff91909116815260200190565b602060405180830381865afa158015612d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612da7919061570c565b6001600160a01b0316639bbbb5c88860a001518381518110612dcb57612dcb6151e7565b60200260200101516000015160006040518363ffffffff1660e01b8152600401612df692919061588f565b602060405180830381865afa158015612e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e379190615673565b8360a001518281518110612e4d57612e4d6151e7565b602002602001018181525050612e9f565b86604001518181518110612e7457612e746151e7565b60200260200101518360a001518281518110612e9257612e926151e7565b6020026020010181815250505b600101612c72565b506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14613247576001600160a01b03811682528651606083015260005b8260200151811015612fd25782600001516001600160a01b03168760a001518281518110612f1257612f126151e7565b6020026020010151602001516001600160a01b031614612f455760405163563abc2760e01b815260040160405180910390fd5b60008760a001518281518110612f5d57612f5d6151e7565b602002602001015160000151519050806000148015612f795750865b15612f9757604051633918ba7d60e21b815260040160405180910390fd5b8360a001518281518110612fad57612fad6151e7565b602002602001015184604001818151612fc691906158b3565b90525050600101612ee2565b508160400151600003612ff857604051630f6fa54560e41b815260040160405180910390fd5b6060820151156131165760008060008980602001905181019061301b91906158c6565b925092509250613029614160565b8560e001906001600160a01b031690816001600160a01b0316815250508460e001516001600160a01b03166330f28b7a604051806060016040528060405180604001604052808a600001516001600160a01b031681526020018a604001518152508152602001868152602001858152506040518060400160405280306001600160a01b0316815260200189604001518152508f856040518563ffffffff1660e01b81526004016130dc9493929190615915565b600060405180830381600087803b1580156130f657600080fd5b505af115801561310a573d6000803e3d6000fd5b505050505050506131cf565b60408281015183519151636eb1769f60e11b81526001600160a01b038c811660048301523060248301529192919091169063dd62ed3e90604401602060405180830381865afa15801561316d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131919190615673565b10156131af576040516263c69360e11b815260040160405180910390fd5b604082015182516131cf916001600160a01b03909116908b9030906141e9565b8751608083015260005b82608001518110156132455761323d8982815181106131fa576131fa6151e7565b60200260200101518460a001518381518110613218576132186151e7565b602002602001015185600001516001600160a01b03166142229092919063ffffffff16565b6001016131d9565b505b8160a001518260c001519350935050509550959350505050565b8060a081901c60c082901c600081900361328e5760405163030042b760e01b815260040160405180910390fd5b9193909250565b805160600151604051633a16cad560e21b815260ff909116600482015260009081907f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b03169063e85b2b5490602401602060405180830381865afa158015613308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061332c919061570c565b9050806001600160a01b031663c87439eb604051806101200160405280866000015160000151815260200186604001516001600160401b0316815260200186606001516001600160401b031681526020018660000151608001516001600160401b031681526020018660a001511515815260200186602001516001600160a01b0316815260200186608001516001600160a01b031681526020018660000151602001516001600160a01b031681526020018660000151604001516001600160a01b03168152506040518263ffffffff1660e01b815260040161340e9190615976565b602060405180830381865afa15801561342b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061344f9190615872565b83516060015160405163ca7adffb60e01b815260ff909116600482015290925061356d907f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b03169063ca7adffb90602401602060405180830381865afa1580156134c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134e8919061570c565b8451805160209091015160405163137776b960e31b81526001600160a01b03861690639bbbb5c89061352190859060019060040161588f565b602060405180830381865afa15801561353e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135629190615673565b875160a001516142ac565b50919050565b6040805180820190915260008082526020820152613598826060015160200151613261565b50506001600160a01b03168082528251602084015160608501516135bf9391906000613737565b5050604080516101808101825282516001600160a01b0390811682526060808601805151602080860191909152815101518486015280519094015181840152835101516080808401919091528351015160a080840191909152835160e090810151151560c085015284518201519084015283516101009081015183169084015283516101209081015190840152925183015190920151610140820152835190911661016082015261366f906144b1565b602082018190521580159061368a5750816060015160e00151155b156106c7576136a6600080516020615a86833981519152612477565b6001600160a01b0316638d04e40e836040015184606001516020015184602001516040518463ffffffff1660e01b8152600401613701939291906001600160a01b039390931683526020830191909152604082015260600190565b600060405180830381600087803b15801561371b57600080fd5b505af115801561372f573d6000803e3d6000fd5b505050505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101829052819060a0850180516060015160ff166080830152515151602082018190521580156137905750835b156137ae57604051633918ba7d60e21b815260040160405180910390fd5b6020810151156138c9576080810151604051633a16cad560e21b815260ff90911660048201527f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b03169063e85b2b5490602401602060405180830381865afa158015613825573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613849919061570c565b60a08601515160405163137776b960e31b81526001600160a01b039290921691639bbbb5c89161387e9160009060040161588f565b602060405180830381865afa15801561389b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138bf9190615673565b60608201526138d4565b604085015160608201525b60a0850151602001516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14613b065760a0850151602001516001600160a01b03168152855115613a2357613923614160565b6001600160a01b031660a082015285516000908190819061394d908a016020908101908b016158c6565b9250925092508360a001516001600160a01b03166330f28b7a6040518060600160405280604051806040016040528089600001516001600160a01b0316815260200189606001518152508152602001868152602001858152506040518060400160405280306001600160a01b0316815260200188606001518152508e856040518563ffffffff1660e01b81526004016139e99493929190615915565b600060405180830381600087803b158015613a0357600080fd5b505af1158015613a17573d6000803e3d6000fd5b50505050505050613ad9565b60608101518151604051636eb1769f60e11b81526001600160a01b038b811660048301523060248301529091169063dd62ed3e90604401602060405180830381865afa158015613a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a9b9190615673565b1015613ab9576040516263c69360e11b815260040160405180910390fd5b60608101518151613ad9916001600160a01b03909116908a9030906141e9565b6001600160a01b03871615613b065760608101518151613b06916001600160a01b03909116908990614222565b8060600151816080015192509250509550959350505050565b613b4a6040518060800160405280600081526020016060815260200160608152602001606081525090565b606082015160200151518082526001600160401b03811115613b6e57613b6e6148e4565b604051908082528060200260200182016040528015613b97578160200160208202803683370190505b50602082015280516001600160401b03811115613bb657613bb66148e4565b604051908082528060200260200182016040528015613bdf578160200160208202803683370190505b506040820152606082015160200151613bf790613f86565b60208083018290528351908401516060850151613c179391906000612b4b565b505060005b8151811015613e6257613dc260405180610180016040528084602001518481518110613c4a57613c4a6151e7565b60200260200101516001600160a01b0316815260200185606001516000015181526020018560600151602001518481518110613c8857613c886151e7565b602002602001015181526020018560600151604001518481518110613caf57613caf6151e7565b602002602001015181526020018560600151606001518481518110613cd657613cd66151e7565b602002602001015181526020018560600151608001518481518110613cfd57613cfd6151e7565b60200260200101518152602001856060015160e001518481518110613d2457613d246151e7565b602002602001015115158152602001856060015160a001518481518110613d4d57613d4d6151e7565b60200260200101518152602001856060015161010001516001600160a01b03168152602001856060015161012001518152602001856060015160a001518481518110613d9b57613d9b6151e7565b602002602001015160a00151815260200185600001516001600160a01b03168152506144b1565b82604001518281518110613dd857613dd86151e7565b60200260200101818152505081604001518181518110613dfa57613dfa6151e7565b6020026020010151600014158015613e305750826060015160e001518181518110613e2757613e276151e7565b60200260200101515b15613e5a57600082604001518281518110613e4d57613e4d6151e7565b6020026020010181815250505b600101613c1c565b50613e7a600080516020615a86833981519152612477565b6001600160a01b031663d81d0a15836040015184606001516020015184604001516040518463ffffffff1660e01b81526004016137019392919061528d565b6001600160a01b0381163b156106eb576040516301ffc9a760e01b8152630271189760e51b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa925050508015613f30575060408051601f3d908101601f19168201909252613f2d91810190615872565b60015b613f5d57604051632bfa23e760e11b81526001600160a01b03821660048201526024015b60405180910390fd5b806106c757604051632bfa23e760e11b81526001600160a01b0383166004820152602401613f54565b8051606090806001600160401b03811115613fa357613fa36148e4565b604051908082528060200260200182016040528015613fcc578160200160208202803683370190505b50915060005b8181101561402457613fef84828151811061191d5761191d6151e7565b905050838281518110614004576140046151e7565b6001600160a01b0390921660209283029190910190910152600101613fd2565b5050919050565b8a6001600160a01b031663cb829dc36040518061014001604052808d81526020018c81526020018b81526020018a81526020018981526020018881526020016000151581526020018715158152602001866001600160a01b0316815260200185815250836040518363ffffffff1660e01b81526004016140ac929190615a49565b6020604051808303816000875af11580156140cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140ef9190615673565b505050505050505050505050565b60006141126001600160a01b038416836145ac565b905080516000141580156141375750808060200190518101906141359190615872565b155b156104bb57604051635274afe760e01b81526001600160a01b0384166004820152602401613f54565b60007f00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a25146001600160a01b0316636afdd8506040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141e4919061570c565b905090565b6040516001600160a01b03848116602483015283811660448301526064820183905261170d9186918216906323b872dd90608401612b19565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015614272573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142969190615673565b905061170d84846142a785856158b3565b6145ba565b816000036142cd57604051630f6fa54560e41b815260040160405180910390fd5b6001600160a01b0385166142f45760405163538ba4f960e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146143315761432c6001600160a01b0384168684614222565b614373565b818110156143525760405163e4f2466360e01b815260040160405180910390fd5b4781111561437357604051632858f9ab60e11b815260040160405180910390fd5b6000856001600160a01b0316828660405161438e9190615a73565b60006040518083038185875af1925050503d80600081146143cb576040519150601f19603f3d011682016040523d82523d6000602084013e6143d0565b606091505b50509050806143fd57604051632accaa1560e01b81526001600160a01b0385166004820152602401613f54565b6001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461372f57604051636eb1769f60e11b81523060048201526001600160a01b038781166024830152859160009183169063dd62ed3e90604401602060405180830381865afa158015614472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144969190615673565b11156110ea576110ea6001600160a01b0382168860006145ba565b600081600001516001600160a01b031663b9232775836101400151604051806101400160405280866020015181526020018660400151815260200186606001518152602001866080015181526020018660a0015181526020018660e0015181526020016000151581526020018660c00151151581526020018661010001516001600160a01b031681526020018661012001518152508561016001516040518463ffffffff1660e01b8152600401614569929190615a49565b60206040518083038185885af1158015614587573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906125039190615673565b60606124708383600061464a565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261460b84826146e7565b61170d576040516001600160a01b0384811660248301526000604483015261464091869182169063095ea7b390606401612b19565b61170d84826140fd565b60608147101561466f5760405163cd78605960e01b8152306004820152602401613f54565b600080856001600160a01b0316848660405161468b9190615a73565b60006040518083038185875af1925050503d80600081146146c8576040519150601f19603f3d011682016040523d82523d6000602084013e6146cd565b606091505b50915091506146dd86838361478f565b9695505050505050565b6000806000846001600160a01b0316846040516147049190615a73565b6000604051808303816000865af19150503d8060008114614741576040519150601f19603f3d011682016040523d82523d6000602084013e614746565b606091505b50915091508180156147705750805115806147705750808060200190518101906147709190615872565b801561478657506000856001600160a01b03163b115b95945050505050565b6060826147a45761479f826147eb565b612470565b81511580156147bb57506001600160a01b0384163b155b156147e457604051639996b31560e01b81526001600160a01b0385166004820152602401613f54565b5080612470565b8051156147fb5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160e08101909152600060a08201908152606060c083015281526020810161483d614861565b815260200160006001600160401b0316815260200160008152602001600081525090565b6040805160c081018252606080825260006020830181905292820183905281018290526080810182905260a081019190915290565b60006060828403121561356d57600080fd5b6000602082840312156148ba57600080fd5b81356001600160401b038111156148d057600080fd5b6148dc84828501614896565b949350505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561491d5761491d6148e4565b60405290565b604051602081016001600160401b038111828210171561491d5761491d6148e4565b604051606081016001600160401b038111828210171561491d5761491d6148e4565b604051601f8201601f191681016001600160401b038111828210171561498f5761498f6148e4565b604052919050565b60006001600160401b038211156149b0576149b06148e4565b5060051b60200190565b600082601f8301126149cb57600080fd5b813560206149e06149db83614997565b614967565b8083825260208201915060208460051b870101935086841115614a0257600080fd5b602086015b84811015614a1e5780358352918301918301614a07565b509695505050505050565b60006001600160401b03821115614a4257614a426148e4565b50601f01601f191660200190565b600082601f830112614a6157600080fd5b8135614a6f6149db82614a29565b818152846020838601011115614a8457600080fd5b816020850160208301376000918101602001919091529392505050565b6001600160a01b03811681146106eb57600080fd5b8035614ac181614aa1565b919050565b803560ff81168114614ac157600080fd5b80356001600160401b0381168114614ac157600080fd5b600060c08284031215614b0057600080fd5b60405160c081016001600160401b038282108183111715614b2357614b236148e4565b816040528293508435915080821115614b3b57600080fd5b50614b4885828601614a50565b8252506020830135614b5981614aa1565b60208201526040830135614b6c81614aa1565b6040820152614b7d60608401614ac6565b6060820152614b8e60808401614ad7565b608082015260a083013560a08201525092915050565b600082601f830112614bb557600080fd5b81356020614bc56149db83614997565b82815260059290921b84018101918181019086841115614be457600080fd5b8286015b84811015614a1e5780356001600160401b03811115614c075760008081fd5b614c158986838b0101614aee565b845250918301918301614be8565b80151581146106eb57600080fd5b8035614ac181614c23565b600082601f830112614c4d57600080fd5b81356020614c5d6149db83614997565b8083825260208201915060208460051b870101935086841115614c7f57600080fd5b602086015b84811015614a1e578035614c9781614c23565b8352918301918301614c84565b60006101608284031215614cb757600080fd5b614cbf6148fa565b905081356001600160401b0380821115614cd857600080fd5b614ce4858386016149ba565b83526020840135915080821115614cfa57600080fd5b614d06858386016149ba565b60208401526040840135915080821115614d1f57600080fd5b614d2b858386016149ba565b60408401526060840135915080821115614d4457600080fd5b614d50858386016149ba565b60608401526080840135915080821115614d6957600080fd5b614d7585838601614ba4565b608084015260a0840135915080821115614d8e57600080fd5b614d9a85838601614a50565b60a084015260c0840135915080821115614db357600080fd5b614dbf85838601614c3c565b60c084015260e0840135915080821115614dd857600080fd5b614de485838601614c3c565b60e08401526101009150614df9828501614ab6565b828401526101209150614e0d828501614ab6565b8284015261014091508184013581811115614e2757600080fd5b614e3386828701614a50565b8385015250505092915050565b600060208284031215614e5257600080fd5b81356001600160401b0380821115614e6957600080fd5b9083019060208286031215614e7d57600080fd5b614e85614923565b823582811115614e9457600080fd5b614ea087828601614ca4565b82525095945050505050565b60006101608284031215614ebf57600080fd5b614ec76148fa565b90508135815260208201356020820152604082013560408201526060820135606082015260808201356001600160401b0380821115614f0557600080fd5b614f1185838601614aee565b608084015260a0840135915080821115614f2a57600080fd5b614f3685838601614a50565b60a0840152614f4760c08501614c31565b60c0840152614de460e08501614c31565b600060208284031215614f6a57600080fd5b81356001600160401b0380821115614f8157600080fd5b9083019060208286031215614f9557600080fd5b614f9d614923565b823582811115614fac57600080fd5b614ea087828601614eac565b600060208284031215614fca57600080fd5b813561247081614aa1565b600082601f830112614fe657600080fd5b81356020614ff66149db83614997565b8083825260208201915060208460051b87010193508684111561501857600080fd5b602086015b84811015614a1e5761502e81614ac6565b835291830191830161501d565b60006020828403121561504d57600080fd5b81356001600160401b038082111561506457600080fd5b908301906060828603121561507857600080fd5b615080614945565b82358281111561508f57600080fd5b61509b87828601614fd5565b8252506150aa60208401614ad7565b60208201526040830135828111156150c157600080fd5b6150cd87828601614eac565b60408301525095945050505050565b6000602082840312156150ee57600080fd5b81356001600160401b038082111561510557600080fd5b908301906060828603121561511957600080fd5b615121614945565b82358281111561513057600080fd5b61513c87828601614fd5565b82525061514b60208401614ad7565b602082015260408301358281111561516257600080fd5b6150cd87828601614ca4565b634e487b7160e01b600052601160045260246000fd5b818103818111156125035761250361516e565b6000808335601e198436030181126151ae57600080fd5b8301803591506001600160401b038211156151c857600080fd5b6020019150600581901b36038213156151e057600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561520f57600080fd5b61247082614ad7565b6000823561015e1983360301811261522f57600080fd5b9190910192915050565b60006125033683614ca4565b60006125033683614eac565b60008151808452602080850194506020840160005b8381101561528257815187529582019590820190600101615266565b509495945050505050565b6001600160a01b03841681526060602082018190526000906152b190830185615251565b82810360408401526146dd8185615251565b6000600182016152d5576152d561516e565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b8381101561530d5781810151838201526020016152f5565b50506000910152565b6000815180845261532e8160208601602086016152f2565b601f01601f19169290920160200192915050565b6000815160c0845261535760c0850182615316565b9050602083015160018060a01b038082166020870152806040860151166040870152505060ff60608401511660608501526001600160401b03608084015116608085015260a083015160a08501528091505092915050565b60008282518085526020808601955060208260051b8401016020860160005b848110156153fc57601f198684030189526153ea838351615342565b988401989250908301906001016153ce565b5090979650505050505050565b60008151808452602080850194506020840160005b8381101561528257815115158752958201959082019060010161541e565b602081528151602082015260006020830151610140806040850152615465610160850183615251565b91506040850151601f19808685030160608701526154838483615251565b935060608701519150808685030160808701526154a08483615251565b935060808701519150808685030160a08701526154bd8483615251565b935060a08701519150808685030160c08701526154da84836153af565b935060c08701519150808685030160e08701526154f78483615409565b935060e087015191506101008187860301818801526155168584615409565b945080880151925050610120615536818801846001600160a01b03169052565b8701518685039091018387015290506146dd8382615316565b60008151808452602080850194506020840160005b8381101561528257815160ff1687529582019590820190600101615564565b6040815260006155966040830185615251565b8281036020840152614786818561554f565b6000610140825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a08301518160a08601526155f082860182615342565b91505060c083015161560660c086018215159052565b5060e083015161561a60e086018215159052565b50610100838101516001600160a01b03169085015261012080840151858303828701526146dd8382615316565b60208152600061247060208301846155a8565b8281526040602082015260006148dc604083018461554f565b60006020828403121561568557600080fd5b5051919050565b60808152600061569f6080830187615251565b82810360208401526156b18187615251565b905082810360408401526156c5818661554f565b905082810360608401526156d9818561554f565b979650505050505050565b84815283602082015260ff831660408201526080606082015260006146dd608083018461554f565b60006020828403121561571e57600080fd5b815161247081614aa1565b6020815281516020820152600060208301516040808401526148dc6060840182615316565b6001600160401b0384168152606060208201526000615770606083018561554f565b82810360408401526146dd8185615316565b600082601f83011261579357600080fd5b81516157a16149db82614a29565b8181528460208386010111156157b657600080fd5b6148dc8260208301602087016152f2565b600080604083850312156157da57600080fd5b8251915060208301516001600160401b038111156157f757600080fd5b61580385828601615782565b9150509250929050565b6001600160a01b038616815260a0602082018190526000906158319083018761554f565b6001600160401b038616604084015282810360608401526158528186615316565b905082810360808401526158668185615316565b98975050505050505050565b60006020828403121561588457600080fd5b815161247081614c23565b6040815260006158a26040830185615316565b905082151560208301529392505050565b808201808211156125035761250361516e565b6000806000606084860312156158db57600080fd5b835192506020840151915060408401516001600160401b038111156158ff57600080fd5b61590b86828701615782565b9150509250925092565b6000610100865160018060a01b03808251168552602082015160208601526020890151604086015260408901516060860152808851166080860152602088015160a086015280871660c086015250508060e08401526156d981840185615316565b6020815260008251610120806020850152615995610140850183615316565b915060208501516159b160408601826001600160401b03169052565b5060408501516001600160401b03811660608601525060608501516001600160401b038116608086015250608085015180151560a08601525060a08501516001600160a01b03811660c08601525060c08501516001600160a01b03811660e08601525060e0850151610100615a30818701836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b604081526000615a5c60408301856155a8565b905060018060a01b03831660208301529392505050565b6000825161522f8184602087016152f256feba0b74768b1de73590a53e1384870dcbc846e5c73bab23c07d71eaa7cbf8411bbcc180fb907e9ae431665de4bc74305c00b7b27442aadd477980ecc4bb14c011a264697066735822122088091fe0ba83aafde520a474398181bb4c729a7bba3965b856b51ac9d273db4064736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514
-----Decoded View---------------
Arg [0] : superRegistry_ (address): 0x17A332dC7B40aE701485023b219E9D6f493a2514
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000017a332dc7b40ae701485023b219e9d6f493a2514
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 23.21% | $2,302.29 | 0.1075 | $247.53 | |
OP | 17.99% | $2,303.37 | 0.0833 | $191.9 | |
OP | 2.52% | $2,310.43 | 0.0116 | $26.82 | |
OP | 0.09% | $1.45 | 0.645 | $0.9344 | |
SCROLL | 12.79% | $2,302.29 | 0.0592 | $136.39 | |
BASE | 10.09% | $2,303.14 | 0.0467 | $107.62 | |
BASE | 0.75% | $0.998943 | 8 | $7.99 | |
BASE | 0.36% | <$0.000001 | 295,774,647 | $3.85 | |
BASE | 0.19% | $1 | 2.0149 | $2.01 | |
BASE | 0.03% | $0.003071 | 101 | $0.3101 | |
BSC | 8.63% | $503.6 | 0.1827 | $92.01 | |
BSC | 1.08% | $2,308.95 | 0.00501 | $11.57 | |
BSC | 0.01% | $0.998667 | 0.1324 | $0.1321 | |
LINEA | 9.30% | $2,302.29 | 0.0431 | $99.18 | |
ARB | 8.25% | $2,302.01 | 0.0382 | $87.96 | |
ARB | 0.29% | $0.998952 | 3.11 | $3.11 | |
ARB | 0.10% | $0.998667 | 1.0592 | $1.06 | |
POL | Polygon (POL) | 1.44% | $0.374905 | 40.9011 | $15.33 |
POL | 0.20% | $0.999771 | 2.163 | $2.16 | |
POL | 0.14% | $0.999861 | 1.45 | $1.45 | |
POL | 0.07% | $2,309.95 | 0.00033 | $0.7622 | |
POL | 0.02% | $0.859578 | 0.2 | $0.1719 | |
POL | <0.01% | $0.999771 | 0.101 | $0.1009 | |
ZKSYNC | 1.48% | $2,302.29 | 0.0068365 | $15.74 | |
AVAX | 0.55% | $23.5 | 0.2502 | $5.88 | |
AVAX | 0.02% | $0.999914 | 0.18 | $0.1799 | |
OPBNB | 0.22% | $503.89 | 0.00473668 | $2.39 | |
BLAST | 0.17% | $2,303.45 | 0.00078103 | $1.8 | |
FTM | <0.01% | $0.443071 | 0.2 | $0.088614 | |
ARBNOVA | <0.01% | $2,302.85 | 0.00001 | $0.023029 |
[ 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.