Documentation ¶
Index ¶
- Constants
- Variables
- func ImportedAssetID(assetID ids.ID, sourceChainID ids.ID) ids.ID
- func ImportedAssetMetadata(assetID ids.ID, sourceChainID ids.ID) []byte
- func UnmarshalBurnAsset(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalCreateAsset(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalExportAsset(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalExportBlockMsg(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalImportAsset(p *codec.Packer, wm *warp.Message) (chain.Action, error)
- func UnmarshalImportBlockMsg(p *codec.Packer, wm *warp.Message) (chain.Action, error)
- func UnmarshalMintAsset(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalSequencerMsg(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func UnmarshalTransfer(p *codec.Packer, _ *warp.Message) (chain.Action, error)
- func ValidSwapParams(value uint64, swapIn uint64, assetOut ids.ID, swapOut uint64, swapExpiry int64) bool
- type BurnAsset
- func (b *BurnAsset) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*BurnAsset) GetTypeID() uint8
- func (b *BurnAsset) Marshal(p *codec.Packer)
- func (*BurnAsset) MaxComputeUnits(chain.Rules) uint64
- func (*BurnAsset) OutputsWarpMessage() bool
- func (*BurnAsset) Size() int
- func (b *BurnAsset) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (*BurnAsset) StateKeysMaxChunks() []uint16
- func (*BurnAsset) ValidRange(chain.Rules) (int64, int64)
- type CreateAsset
- func (c *CreateAsset) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*CreateAsset) GetTypeID() uint8
- func (c *CreateAsset) Marshal(p *codec.Packer)
- func (*CreateAsset) MaxComputeUnits(chain.Rules) uint64
- func (*CreateAsset) OutputsWarpMessage() bool
- func (c *CreateAsset) Size() int
- func (*CreateAsset) StateKeys(_ chain.Auth, txID ids.ID) []string
- func (*CreateAsset) StateKeysMaxChunks() []uint16
- func (*CreateAsset) ValidRange(chain.Rules) (int64, int64)
- type ExportAsset
- func (e *ExportAsset) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*ExportAsset) GetTypeID() uint8
- func (e *ExportAsset) Marshal(p *codec.Packer)
- func (*ExportAsset) MaxComputeUnits(chain.Rules) uint64
- func (*ExportAsset) OutputsWarpMessage() bool
- func (*ExportAsset) Size() int
- func (e *ExportAsset) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (e *ExportAsset) StateKeysMaxChunks() []uint16
- func (*ExportAsset) ValidRange(chain.Rules) (int64, int64)
- type ExportBlockMsg
- func (e *ExportBlockMsg) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*ExportBlockMsg) GetTypeID() uint8
- func (e *ExportBlockMsg) Marshal(p *codec.Packer)
- func (*ExportBlockMsg) MaxComputeUnits(chain.Rules) uint64
- func (*ExportBlockMsg) MaxUnits(chain.Rules) uint64
- func (*ExportBlockMsg) OutputsWarpMessage() bool
- func (*ExportBlockMsg) Size() int
- func (e *ExportBlockMsg) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (e *ExportBlockMsg) StateKeysMaxChunks() []uint16
- func (*ExportBlockMsg) ValidRange(chain.Rules) (int64, int64)
- type ImportAsset
- func (i *ImportAsset) Execute(ctx context.Context, r chain.Rules, mu state.Mutable, t int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*ImportAsset) GetTypeID() uint8
- func (i *ImportAsset) Marshal(p *codec.Packer)
- func (*ImportAsset) MaxComputeUnits(chain.Rules) uint64
- func (*ImportAsset) OutputsWarpMessage() bool
- func (*ImportAsset) Size() int
- func (i *ImportAsset) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (i *ImportAsset) StateKeysMaxChunks() []uint16
- func (*ImportAsset) ValidRange(chain.Rules) (int64, int64)
- type ImportBlockMsg
- func (i *ImportBlockMsg) Execute(ctx context.Context, r chain.Rules, mu state.Mutable, t int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*ImportBlockMsg) GetTypeID() uint8
- func (i *ImportBlockMsg) Marshal(p *codec.Packer)
- func (i *ImportBlockMsg) MaxComputeUnits(chain.Rules) uint64
- func (*ImportBlockMsg) OutputsWarpMessage() bool
- func (*ImportBlockMsg) Size() int
- func (e *ImportBlockMsg) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (i *ImportBlockMsg) StateKeysMaxChunks() []uint16
- func (*ImportBlockMsg) ValidRange(chain.Rules) (int64, int64)
- type MintAsset
- func (m *MintAsset) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*MintAsset) GetTypeID() uint8
- func (m *MintAsset) Marshal(p *codec.Packer)
- func (*MintAsset) MaxComputeUnits(chain.Rules) uint64
- func (*MintAsset) OutputsWarpMessage() bool
- func (*MintAsset) Size() int
- func (m *MintAsset) StateKeys(chain.Auth, ids.ID) []string
- func (*MintAsset) StateKeysMaxChunks() []uint16
- func (*MintAsset) ValidRange(chain.Rules) (int64, int64)
- type SequencerMsg
- func (t *SequencerMsg) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*SequencerMsg) GetTypeID() uint8
- func (t *SequencerMsg) Marshal(p *codec.Packer)
- func (*SequencerMsg) MaxComputeUnits(chain.Rules) uint64
- func (*SequencerMsg) OutputsWarpMessage() bool
- func (*SequencerMsg) Size() int
- func (t *SequencerMsg) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (*SequencerMsg) StateKeysMaxChunks() []uint16
- func (*SequencerMsg) ValidRange(chain.Rules) (int64, int64)
- type Transfer
- func (t *Transfer) Execute(ctx context.Context, _ chain.Rules, mu state.Mutable, _ int64, ...) (bool, uint64, []byte, *warp.UnsignedMessage, error)
- func (*Transfer) GetTypeID() uint8
- func (t *Transfer) Marshal(p *codec.Packer)
- func (*Transfer) MaxComputeUnits(chain.Rules) uint64
- func (*Transfer) OutputsWarpMessage() bool
- func (t *Transfer) Size() int
- func (t *Transfer) StateKeys(rauth chain.Auth, _ ids.ID) []string
- func (*Transfer) StateKeysMaxChunks() []uint16
- func (*Transfer) ValidRange(chain.Rules) (int64, int64)
- type WarpTransfer
Constants ¶
View Source
const ( // TODO: tune this BurnComputeUnits = 2 CloseOrderComputeUnits = 5 CreateAssetComputeUnits = 10 ExportAssetComputeUnits = 10 ImportAssetComputeUnits = 10 CreateOrderComputeUnits = 5 NoFillOrderComputeUnits = 5 FillOrderComputeUnits = 15 MintAssetComputeUnits = 2 TransferComputeUnits = 1 ExportBlockComputeUnits = 15 ImportBlockComputeUnits = 15 MsgComputeUnits = 15 MaxSymbolSize = 8 MaxMemoSize = 256 MaxMetadataSize = 256 MaxDecimals = 9 )
Variables ¶
View Source
var ( OutputValueZero = []byte("value is zero") OutputMemoTooLarge = []byte("memo is too large") OutputAssetIsNative = []byte("cannot mint native asset") OutputAssetAlreadyExists = []byte("asset already exists") OutputAssetMissing = []byte("asset missing") OutputInTickZero = []byte("in rate is zero") OutputOutTickZero = []byte("out rate is zero") OutputSupplyZero = []byte("supply is zero") OutputSupplyMisaligned = []byte("supply is misaligned") OutputOrderMissing = []byte("order is missing") OutputWrongIn = []byte("wrong in asset") OutputWrongOut = []byte("wrong out asset") OutputWrongOwner = []byte("wrong owner") OutputInsufficientInput = []byte("insufficient input") OutputInsufficientOutput = []byte("insufficient output") OutputValueMisaligned = []byte("value is misaligned") OutputSymbolEmpty = []byte("symbol is empty") OutputSymbolIncorrect = []byte("symbol is incorrect") OutputSymbolTooLarge = []byte("symbol is too large") OutputDecimalsIncorrect = []byte("decimal is incorrect") OutputDecimalsTooLarge = []byte("decimal is too large") OutputMetadataEmpty = []byte("metadata is empty") OutputMetadataTooLarge = []byte("metadata is too large") OutputSameInOut = []byte("same asset used for in and out") OutputConflictingAsset = []byte("warp has same asset as another") OutputAnycast = []byte("anycast output") OutputNotWarpAsset = []byte("not warp asset") OutputWarpAsset = []byte("warp asset") OutputWrongDestination = []byte("wrong destination") OutputMustFill = []byte("must fill request") OutputWarpVerificationFailed = []byte("warp verification failed") OutputInvalidDestination = []byte("invalid destination") )
View Source
var ErrNoSwapToFill = errors.New("no swap to fill")
Functions ¶
func ImportedAssetMetadata ¶
func UnmarshalBurnAsset ¶
func UnmarshalCreateAsset ¶
func UnmarshalExportAsset ¶
func UnmarshalExportBlockMsg ¶ added in v0.3.0
func UnmarshalImportAsset ¶
func UnmarshalImportBlockMsg ¶ added in v0.3.0
func UnmarshalMintAsset ¶
func UnmarshalSequencerMsg ¶
func UnmarshalTransfer ¶
Types ¶
type BurnAsset ¶
type BurnAsset struct { // Asset is the [TxID] that created the asset. Asset ids.ID `json:"asset"` // Number of assets to mint to [To]. Value uint64 `json:"value"` }
func (*BurnAsset) MaxComputeUnits ¶ added in v0.3.0
func (*BurnAsset) OutputsWarpMessage ¶ added in v0.3.0
func (*BurnAsset) StateKeysMaxChunks ¶ added in v0.3.0
type CreateAsset ¶
type CreateAsset struct { Symbol []byte `json:"symbol"` Decimals uint8 `json:"decimals"` Metadata []byte `json:"metadata"` }
func (*CreateAsset) GetTypeID ¶ added in v0.3.0
func (*CreateAsset) GetTypeID() uint8
func (*CreateAsset) Marshal ¶
func (c *CreateAsset) Marshal(p *codec.Packer)
func (*CreateAsset) MaxComputeUnits ¶ added in v0.3.0
func (*CreateAsset) MaxComputeUnits(chain.Rules) uint64
func (*CreateAsset) OutputsWarpMessage ¶ added in v0.3.0
func (*CreateAsset) OutputsWarpMessage() bool
func (*CreateAsset) Size ¶ added in v0.3.0
func (c *CreateAsset) Size() int
func (*CreateAsset) StateKeysMaxChunks ¶ added in v0.3.0
func (*CreateAsset) StateKeysMaxChunks() []uint16
func (*CreateAsset) ValidRange ¶
func (*CreateAsset) ValidRange(chain.Rules) (int64, int64)
type ExportAsset ¶
type ExportAsset struct { To ed25519.PublicKey `json:"to"` Asset ids.ID `json:"asset"` Value uint64 `json:"value"` Return bool `json:"return"` Reward uint64 `json:"reward"` SwapIn uint64 `json:"swapIn"` AssetOut ids.ID `json:"assetOut"` SwapOut uint64 `json:"swapOut"` SwapExpiry int64 `json:"swapExpiry"` Destination ids.ID `json:"destination"` }
func (*ExportAsset) GetTypeID ¶ added in v0.3.0
func (*ExportAsset) GetTypeID() uint8
func (*ExportAsset) Marshal ¶
func (e *ExportAsset) Marshal(p *codec.Packer)
func (*ExportAsset) MaxComputeUnits ¶ added in v0.3.0
func (*ExportAsset) MaxComputeUnits(chain.Rules) uint64
func (*ExportAsset) OutputsWarpMessage ¶ added in v0.3.0
func (*ExportAsset) OutputsWarpMessage() bool
func (*ExportAsset) Size ¶ added in v0.3.0
func (*ExportAsset) Size() int
func (*ExportAsset) StateKeysMaxChunks ¶ added in v0.3.0
func (e *ExportAsset) StateKeysMaxChunks() []uint16
func (*ExportAsset) ValidRange ¶
func (*ExportAsset) ValidRange(chain.Rules) (int64, int64)
type ExportBlockMsg ¶ added in v0.3.0
type ExportBlockMsg struct { Prnt ids.ID `json:"parent"` Tmstmp int64 `json:"timestamp"` Hght uint64 `json:"height"` StateRoot ids.ID `json:"stateRoot"` Destination ids.ID `json:"destination"` }
func (*ExportBlockMsg) GetTypeID ¶ added in v0.3.0
func (*ExportBlockMsg) GetTypeID() uint8
func (*ExportBlockMsg) Marshal ¶ added in v0.3.0
func (e *ExportBlockMsg) Marshal(p *codec.Packer)
func (*ExportBlockMsg) MaxComputeUnits ¶ added in v0.3.0
func (*ExportBlockMsg) MaxComputeUnits(chain.Rules) uint64
func (*ExportBlockMsg) MaxUnits ¶ added in v0.3.0
func (*ExportBlockMsg) MaxUnits(chain.Rules) uint64
func (*ExportBlockMsg) OutputsWarpMessage ¶ added in v0.3.0
func (*ExportBlockMsg) OutputsWarpMessage() bool
func (*ExportBlockMsg) Size ¶ added in v0.3.0
func (*ExportBlockMsg) Size() int
func (*ExportBlockMsg) StateKeysMaxChunks ¶ added in v0.3.0
func (e *ExportBlockMsg) StateKeysMaxChunks() []uint16
TODO probably need to fix
func (*ExportBlockMsg) ValidRange ¶ added in v0.3.0
func (*ExportBlockMsg) ValidRange(chain.Rules) (int64, int64)
type ImportAsset ¶
type ImportAsset struct { // Fill indicates if the actor wishes to fill the order request in the warp // message. This must be true if the warp message is in a block with // a timestamp < [SwapExpiry]. Fill bool `json:"fill"` // contains filtered or unexported fields }
func (*ImportAsset) GetTypeID ¶ added in v0.3.0
func (*ImportAsset) GetTypeID() uint8
func (*ImportAsset) Marshal ¶
func (i *ImportAsset) Marshal(p *codec.Packer)
All we encode that is action specific for now is the type byte from the registry.
func (*ImportAsset) MaxComputeUnits ¶ added in v0.3.0
func (*ImportAsset) MaxComputeUnits(chain.Rules) uint64
func (*ImportAsset) OutputsWarpMessage ¶ added in v0.3.0
func (*ImportAsset) OutputsWarpMessage() bool
func (*ImportAsset) Size ¶ added in v0.3.0
func (*ImportAsset) Size() int
func (*ImportAsset) StateKeysMaxChunks ¶ added in v0.3.0
func (i *ImportAsset) StateKeysMaxChunks() []uint16
func (*ImportAsset) ValidRange ¶
func (*ImportAsset) ValidRange(chain.Rules) (int64, int64)
type ImportBlockMsg ¶ added in v0.3.0
type ImportBlockMsg struct { // Fill indicates if the actor wishes to fill the order request in the warp // message. This must be true if the warp message is in a block with // a timestamp < [SwapExpiry]. Fill bool `json:"fill"` // contains filtered or unexported fields }
func (*ImportBlockMsg) GetTypeID ¶ added in v0.3.0
func (*ImportBlockMsg) GetTypeID() uint8
func (*ImportBlockMsg) Marshal ¶ added in v0.3.0
func (i *ImportBlockMsg) Marshal(p *codec.Packer)
All we encode that is action specific for now is the type byte from the registry.
func (*ImportBlockMsg) MaxComputeUnits ¶ added in v0.3.0
func (i *ImportBlockMsg) MaxComputeUnits(chain.Rules) uint64
func (*ImportBlockMsg) OutputsWarpMessage ¶ added in v0.3.0
func (*ImportBlockMsg) OutputsWarpMessage() bool
func (*ImportBlockMsg) Size ¶ added in v0.3.0
func (*ImportBlockMsg) Size() int
func (*ImportBlockMsg) StateKeysMaxChunks ¶ added in v0.3.0
func (i *ImportBlockMsg) StateKeysMaxChunks() []uint16
func (*ImportBlockMsg) ValidRange ¶ added in v0.3.0
func (*ImportBlockMsg) ValidRange(chain.Rules) (int64, int64)
type MintAsset ¶
type MintAsset struct { // To is the recipient of the [Value]. To ed25519.PublicKey `json:"to"` // Asset is the [TxID] that created the asset. Asset ids.ID `json:"asset"` // Number of assets to mint to [To]. Value uint64 `json:"value"` }
func (*MintAsset) MaxComputeUnits ¶ added in v0.3.0
func (*MintAsset) OutputsWarpMessage ¶ added in v0.3.0
func (*MintAsset) StateKeysMaxChunks ¶ added in v0.3.0
type SequencerMsg ¶
type SequencerMsg struct { //TODO might need to add this back in at some point but rn it should be fine ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` FromAddress ed25519.PublicKey `json:"from_address"` }
func (*SequencerMsg) GetTypeID ¶ added in v0.3.0
func (*SequencerMsg) GetTypeID() uint8
func (*SequencerMsg) Marshal ¶
func (t *SequencerMsg) Marshal(p *codec.Packer)
func (*SequencerMsg) MaxComputeUnits ¶ added in v0.3.0
func (*SequencerMsg) MaxComputeUnits(chain.Rules) uint64
func (*SequencerMsg) OutputsWarpMessage ¶ added in v0.3.0
func (*SequencerMsg) OutputsWarpMessage() bool
func (*SequencerMsg) Size ¶ added in v0.3.0
func (*SequencerMsg) Size() int
func (*SequencerMsg) StateKeysMaxChunks ¶ added in v0.3.0
func (*SequencerMsg) StateKeysMaxChunks() []uint16
TODO fix this
func (*SequencerMsg) ValidRange ¶
func (*SequencerMsg) ValidRange(chain.Rules) (int64, int64)
type Transfer ¶
type Transfer struct { // To is the recipient of the [Value]. To ed25519.PublicKey `json:"to"` // Asset to transfer to [To]. Asset ids.ID `json:"asset"` // Amount are transferred to [To]. Value uint64 `json:"value"` // Optional message to accompany transaction. Memo []byte `json:"memo"` }
func (*Transfer) MaxComputeUnits ¶ added in v0.3.0
func (*Transfer) OutputsWarpMessage ¶ added in v0.3.0
func (*Transfer) StateKeysMaxChunks ¶ added in v0.3.0
type WarpTransfer ¶
type WarpTransfer struct { To ed25519.PublicKey `json:"to"` Symbol []byte `json:"symbol"` Decimals uint8 `json:"decimals"` Asset ids.ID `json:"asset"` Value uint64 `json:"value"` // Return is set to true when a warp message is sending funds back to the // chain where they were created. Return bool `json:"return"` // Reward is the amount of [Asset] to send the [Actor] that submits this // transaction. Reward uint64 `json:"reward"` // SwapIn is the amount of [Asset] we are willing to swap for [AssetOut]. SwapIn uint64 `json:"swapIn"` // AssetOut is the asset we are seeking to get for [SwapIn]. AssetOut ids.ID `json:"assetOut"` // SwapOut is the amount of [AssetOut] we are seeking. SwapOut uint64 `json:"swapOut"` // SwapExpiry is the unix timestamp at which the swap becomes invalid (and // the message can be processed without a swap. SwapExpiry int64 `json:"swapExpiry"` // TxID is the transaction that created this message. This is used to ensure // there is WarpID uniqueness. TxID ids.ID `json:"txID"` // DestinationChainID is the destination of this transfer. We assume this // must be populated (not anycast). DestinationChainID ids.ID `json:"destinationChainID"` }
func UnmarshalWarpTransfer ¶
func UnmarshalWarpTransfer(b []byte) (*WarpTransfer, error)
func (*WarpTransfer) Marshal ¶
func (w *WarpTransfer) Marshal() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.