Skip to content
solidity
import "solidity-scale-codec/src/Xcm/v5/AssetInstance/AssetInstanceCodec.sol";

AssetInstanceCodec

Kind: library

Functions

encode(struct AssetInstance assetInstance)

solidity
function encode(struct AssetInstance assetInstance) internal pure returns (bytes)

Encodes an `AssetInstance` struct into bytes.

encodedSizeAt(bytes data, uint256 offset)

solidity
function encodedSizeAt(bytes data, uint256 offset) internal pure returns (uint256)

Returns the total number of bytes that an `AssetInstance` would occupy when encoded, based on the type and payload.

decode(bytes data)

solidity
function decode(bytes data) internal pure returns (struct AssetInstance, uint256)

Decodes an `AssetInstance` struct from bytes starting at the beginning of the data.

decodeAt(bytes data, uint256 offset)

solidity
function decodeAt(bytes data, uint256 offset) internal pure returns (struct AssetInstance, uint256)

Decodes an `AssetInstance` struct from bytes starting at a given offset.

asIndex(struct AssetInstance assetInstance)

solidity
function asIndex(struct AssetInstance assetInstance) internal pure returns (struct IndexParams)

Extracts the index value from an `Index` asset instance. Reverts if the asset instance is not of type `Index` or if the decoded index exceeds the maximum value for `uint128`.

asArray4(struct AssetInstance assetInstance)

solidity
function asArray4(struct AssetInstance assetInstance) internal pure returns (struct Array4Params)

Extracts the 4-byte data from an `Array4` asset instance. Reverts if the asset instance is not of type `Array4`.

asArray8(struct AssetInstance assetInstance)

solidity
function asArray8(struct AssetInstance assetInstance) internal pure returns (struct Array8Params)

Extracts the 8-byte data from an `Array8` asset instance. Reverts if the asset instance is not of type `Array8`.

asArray16(struct AssetInstance assetInstance)

solidity
function asArray16(struct AssetInstance assetInstance) internal pure returns (struct Array16Params)

Extracts the 16-byte data from an `Array16` asset instance. Reverts if the asset instance is not of type `Array16`.

asArray32(struct AssetInstance assetInstance)

solidity
function asArray32(struct AssetInstance assetInstance) internal pure returns (struct Array32Params)

Extracts the 32-byte data from an `Array32` asset instance. Reverts if the asset instance is not of type `Array32`.