Skip to content

File: src/Xcm/v5/Instruction/InstructionCodec.sol

InstructionCodec

Kind: library

ABI Surface

Errors

  • error InvalidInstructionLength()
  • error InvalidInstructionPayload()
  • error InvalidInstructionVariant(uint8 variant)

Function Surface

  • function encode(struct Instruction instruction) internal pure returns (bytes)
    • Encodes an Instruction into SCALE bytes.
  • function encodedSizeAt(bytes data, uint256 offset) internal pure returns (uint256)
    • Returns the number of bytes that an Instruction occupies when SCALE-encoded.
  • function decode(bytes data) internal pure returns (struct Instruction, uint256)
    • Decodes an Instruction from SCALE bytes starting at the beginning.
  • function decodeAt(bytes data, uint256 offset) internal pure returns (struct Instruction, uint256)
    • Decodes an Instruction from SCALE bytes starting at a given offset.
  • function asWithdrawAsset(struct Instruction instruction) internal pure returns (struct WithdrawAssetParams)
    • Extracts the decoded WithdrawAssetParams from a WithdrawAsset instruction. Reverts if the instruction is not of type WithdrawAsset.
  • function asReserveAssetDeposited(struct Instruction instruction) internal pure returns (struct ReserveAssetDepositedParams)
    • Extracts the decoded ReserveAssetDepositedParams from a ReserveAssetDeposited instruction. Reverts if the instruction is not of type ReserveAssetDeposited.
  • function asReceiveTeleportedAsset(struct Instruction instruction) internal pure returns (struct ReceiveTeleportedAssetParams)
    • Extracts the decoded ReceiveTeleportedAssetParams from a ReceiveTeleportedAsset instruction. Reverts if the instruction is not of type ReceiveTeleportedAsset.
  • function asQueryResponse(struct Instruction instruction) internal pure returns (struct QueryResponseParams)
    • Extracts the decoded QueryResponseParams from a QueryResponse instruction. Reverts if the instruction is not of type QueryResponse.
  • function asTransferAsset(struct Instruction instruction) internal pure returns (struct TransferAssetParams)
    • Extracts the decoded TransferAssetParams from a TransferAsset instruction. Reverts if the instruction is not of type TransferAsset.
  • function asTransferReserveAsset(struct Instruction instruction) internal pure returns (struct TransferReserveAssetParams)
    • Extracts the decoded TransferReserveAssetParams from a TransferReserveAsset instruction. Reverts if the instruction is not of type TransferReserveAsset.
  • function asTransact(struct Instruction instruction) internal pure returns (struct TransactParams)
    • Extracts the decoded TransactParams from a Transact instruction. Reverts if the instruction is not of type Transact.
  • function asHrmpNewChannelOpenRequest(struct Instruction instruction) internal pure returns (struct HrmpNewChannelOpenRequestParams)
    • Extracts the decoded HrmpNewChannelOpenRequestParams from a HrmpNewChannelOpenRequest instruction. Reverts if the instruction is not of type HrmpNewChannelOpenRequest.
  • function asHrmpChannelAccepted(struct Instruction instruction) internal pure returns (struct HrmpChannelAcceptedParams)
    • Extracts the decoded HrmpChannelAcceptedParams from a HrmpChannelAccepted instruction. Reverts if the instruction is not of type HrmpChannelAccepted.
  • function asHrmpChannelClosing(struct Instruction instruction) internal pure returns (struct HrmpChannelClosingParams)
    • Extracts the decoded HrmpChannelClosingParams from a HrmpChannelClosing instruction. Reverts if the instruction is not of type HrmpChannelClosing.
  • function asClearOrigin(struct Instruction instruction) internal pure
    • Validates a ClearOrigin instruction payload. Reverts if the instruction is not of type ClearOrigin or the payload is invalid.
  • function asDescendOrigin(struct Instruction instruction) internal pure returns (struct DescendOriginParams)
    • Extracts the decoded DescendOriginParams from a DescendOrigin instruction. Reverts if the instruction is not of type DescendOrigin.
  • function asReportError(struct Instruction instruction) internal pure returns (struct ReportErrorParams)
    • Extracts the decoded ReportErrorParams from a ReportError instruction. Reverts if the instruction is not of type ReportError.
  • function asDepositAsset(struct Instruction instruction) internal pure returns (struct DepositAssetParams)
    • Extracts the decoded DepositAssetParams from a DepositAsset instruction. Reverts if the instruction is not of type DepositAsset.
  • function asDepositReserveAsset(struct Instruction instruction) internal pure returns (struct DepositReserveAssetParams)
    • Extracts the decoded DepositReserveAssetParams from a DepositReserveAsset instruction. Reverts if the instruction is not of type DepositReserveAsset.
  • function asExchangeAsset(struct Instruction instruction) internal pure returns (struct ExchangeAssetParams)
    • Extracts the decoded ExchangeAssetParams from a ExchangeAsset instruction. Reverts if the instruction is not of type ExchangeAsset.
  • function asInitiateReserveWithdraw(struct Instruction instruction) internal pure returns (struct InitiateReserveWithdrawParams)
    • Extracts the decoded InitiateReserveWithdrawParams from a InitiateReserveWithdraw instruction. Reverts if the instruction is not of type InitiateReserveWithdraw.
  • function asInitiateTeleport(struct Instruction instruction) internal pure returns (struct InitiateTeleportParams)
    • Extracts the decoded InitiateTeleportParams from a InitiateTeleport instruction. Reverts if the instruction is not of type InitiateTeleport.
  • function asReportHolding(struct Instruction instruction) internal pure returns (struct ReportHoldingParams)
    • Extracts the decoded ReportHoldingParams from a ReportHolding instruction. Reverts if the instruction is not of type ReportHolding.
  • function asBuyExecution(struct Instruction instruction) internal pure returns (struct BuyExecutionParams)
    • Extracts the decoded BuyExecutionParams from a BuyExecution instruction. Reverts if the instruction is not of type BuyExecution.
  • function asRefundSurplus(struct Instruction instruction) internal pure
    • Validates a RefundSurplus instruction payload. Reverts if the instruction is not of type RefundSurplus or the payload is invalid.
  • function asSetErrorHandler(struct Instruction instruction) internal pure returns (struct SetErrorHandlerParams)
    • Extracts the decoded SetErrorHandlerParams from a SetErrorHandler instruction. Reverts if the instruction is not of type SetErrorHandler.
  • function asSetAppendix(struct Instruction instruction) internal pure returns (struct SetAppendixParams)
    • Extracts the decoded SetAppendixParams from a SetAppendix instruction. Reverts if the instruction is not of type SetAppendix.
  • function asClearError(struct Instruction instruction) internal pure
    • Validates a ClearError instruction payload. Reverts if the instruction is not of type ClearError or the payload is invalid.
  • function asClaimAsset(struct Instruction instruction) internal pure returns (struct ClaimAssetParams)
    • Extracts the decoded ClaimAssetParams from a ClaimAsset instruction. Reverts if the instruction is not of type ClaimAsset.
  • function asTrap(struct Instruction instruction) internal pure returns (struct TrapParams)
    • Extracts the decoded TrapParams from a Trap instruction. Reverts if the instruction is not of type Trap.
  • function asSubscribeVersion(struct Instruction instruction) internal pure returns (struct SubscribeVersionParams)
    • Extracts the decoded SubscribeVersionParams from a SubscribeVersion instruction. Reverts if the instruction is not of type SubscribeVersion.
  • function asUnsubscribeVersion(struct Instruction instruction) internal pure
    • Validates a UnsubscribeVersion instruction payload. Reverts if the instruction is not of type UnsubscribeVersion or the payload is invalid.
  • function asBurnAsset(struct Instruction instruction) internal pure returns (struct BurnAssetParams)
    • Extracts the decoded BurnAssetParams from a BurnAsset instruction. Reverts if the instruction is not of type BurnAsset.
  • function asExpectAsset(struct Instruction instruction) internal pure returns (struct ExpectAssetParams)
    • Extracts the decoded ExpectAssetParams from a ExpectAsset instruction. Reverts if the instruction is not of type ExpectAsset.
  • function asExpectOrigin(struct Instruction instruction) internal pure returns (struct ExpectOriginParams)
    • Extracts the decoded ExpectOriginParams from a ExpectOrigin instruction. Reverts if the instruction is not of type ExpectOrigin.
  • function asExpectError(struct Instruction instruction) internal pure returns (struct ExpectErrorParams)
    • Extracts the decoded ExpectErrorParams from a ExpectError instruction. Reverts if the instruction is not of type ExpectError.
  • function asExpectTransactStatus(struct Instruction instruction) internal pure returns (struct ExpectTransactStatusParams)
    • Extracts the decoded ExpectTransactStatusParams from a ExpectTransactStatus instruction. Reverts if the instruction is not of type ExpectTransactStatus.
  • function asQueryPallet(struct Instruction instruction) internal pure returns (struct QueryPalletParams)
    • Extracts the decoded QueryPalletParams from a QueryPallet instruction. Reverts if the instruction is not of type QueryPallet.
  • function asExpectPallet(struct Instruction instruction) internal pure returns (struct ExpectPalletParams)
    • Extracts the decoded ExpectPalletParams from a ExpectPallet instruction. Reverts if the instruction is not of type ExpectPallet.
  • function asReportTransactStatus(struct Instruction instruction) internal pure returns (struct ReportTransactStatusParams)
    • Extracts the decoded ReportTransactStatusParams from a ReportTransactStatus instruction. Reverts if the instruction is not of type ReportTransactStatus.
  • function asClearTransactStatus(struct Instruction instruction) internal pure
    • Validates a ClearTransactStatus instruction payload. Reverts if the instruction is not of type ClearTransactStatus or the payload is invalid.
  • function asUniversalOrigin(struct Instruction instruction) internal pure returns (struct UniversalOriginParams)
    • Extracts the decoded UniversalOriginParams from a UniversalOrigin instruction. Reverts if the instruction is not of type UniversalOrigin.
  • function asExportMessage(struct Instruction instruction) internal pure returns (struct ExportMessageParams)
    • Extracts the decoded ExportMessageParams from a ExportMessage instruction. Reverts if the instruction is not of type ExportMessage.
  • function asLockAsset(struct Instruction instruction) internal pure returns (struct LockAssetParams)
    • Extracts the decoded LockAssetParams from a LockAsset instruction. Reverts if the instruction is not of type LockAsset.
  • function asUnlockAsset(struct Instruction instruction) internal pure returns (struct UnlockAssetParams)
    • Extracts the decoded UnlockAssetParams from a UnlockAsset instruction. Reverts if the instruction is not of type UnlockAsset.
  • function asNoteUnlockable(struct Instruction instruction) internal pure returns (struct NoteUnlockableParams)
    • Extracts the decoded NoteUnlockableParams from a NoteUnlockable instruction. Reverts if the instruction is not of type NoteUnlockable.
  • function asRequestUnlock(struct Instruction instruction) internal pure returns (struct RequestUnlockParams)
    • Extracts the decoded RequestUnlockParams from a RequestUnlock instruction. Reverts if the instruction is not of type RequestUnlock.
  • function asSetFeesMode(struct Instruction instruction) internal pure returns (struct SetFeesModeParams)
    • Extracts the decoded SetFeesModeParams from a SetFeesMode instruction. Reverts if the instruction is not of type SetFeesMode.
  • function asSetTopic(struct Instruction instruction) internal pure returns (struct SetTopicParams)
    • Extracts the decoded SetTopicParams from a SetTopic instruction. Reverts if the instruction is not of type SetTopic.
  • function asClearTopic(struct Instruction instruction) internal pure
    • Validates a ClearTopic instruction payload. Reverts if the instruction is not of type ClearTopic or the payload is invalid.
  • function asAliasOrigin(struct Instruction instruction) internal pure returns (struct AliasOriginParams)
    • Extracts the decoded AliasOriginParams from a AliasOrigin instruction. Reverts if the instruction is not of type AliasOrigin.
  • function asUnpaidExecution(struct Instruction instruction) internal pure returns (struct UnpaidExecutionParams)
    • Extracts the decoded UnpaidExecutionParams from a UnpaidExecution instruction. Reverts if the instruction is not of type UnpaidExecution.
  • function asPayFees(struct Instruction instruction) internal pure returns (struct PayFeesParams)
    • Extracts the decoded PayFeesParams from a PayFees instruction. Reverts if the instruction is not of type PayFees.
  • function asInitiateTransfer(struct Instruction instruction) internal pure returns (struct InitiateTransferParams)
    • Extracts the decoded InitiateTransferParams from a InitiateTransfer instruction. Reverts if the instruction is not of type InitiateTransfer.
  • function asExecuteWithOrigin(struct Instruction instruction) internal pure returns (struct ExecuteWithOriginParams)
    • Extracts the decoded ExecuteWithOriginParams from a ExecuteWithOrigin instruction. Reverts if the instruction is not of type ExecuteWithOrigin.
  • function asSetHints(struct Instruction instruction) internal pure returns (struct SetHintsParams)
    • Extracts the decoded SetHintsParams from a SetHints instruction. Reverts if the instruction is not of type SetHints.
  • function \_xcmEncodedSizeAt(bytes data, uint256 offset) private pure returns (uint256)
    • Returns the encoded size of an XCM byte sequence at offset.
  • function \_assertVariant(struct Instruction instruction, enum InstructionVariant expectedType) private pure
  • function \_decodeXcmAt(bytes payload, uint256 offset) private pure returns (bytes, uint256)

Created with solidity-doc-generator