wasm

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package wasm supports smart contract integration with the provenance marker module.

Package wasm supports smart contract integration with the provenance marker module.

Package wasm supports smart contract integration with the provenance marker module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encoder

func Encoder(contract sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error)

Encoder returns a smart contract message encoder for the name module.

func Querier

func Querier(keeper keeper.Keeper) provwasm.Querier

Querier returns a smart contract querier for the name module.

Types

type AccessGrant

type AccessGrant struct {
	Address     string             `json:"address"`
	Permissions []MarkerPermission `json:"permissions,omitempty"`
}

AccessGrant are marker permissions granted to an account.

type ActivateMarkerParams

type ActivateMarkerParams struct {
	// The marker denomination
	Denom string `json:"denom"`
}

ActivateMarkerParams are params for encoding a MsgActivateRequest.

func (*ActivateMarkerParams) Encode

func (params *ActivateMarkerParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgActivateRequest. The contract must be the administrator of the marker.

type BurnSupplyParams

type BurnSupplyParams struct {
	// The marker denomination and amount to burn
	Coin sdk.Coin `json:"coin"`
}

BurnSupplyParams are params for encoding a MsgBurnRequest.

func (*BurnSupplyParams) Encode

func (params *BurnSupplyParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgBurnRequest. The contract must be the administrator of the marker.

type CancelMarkerParams

type CancelMarkerParams struct {
	// The marker denomination
	Denom string `json:"denom"`
}

CancelMarkerParams are params for encoding a MsgCancelRequest.

func (*CancelMarkerParams) Encode

func (params *CancelMarkerParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgCancelRequest. The contract must be the administrator of the marker.

type CreateMarkerParams

type CreateMarkerParams struct {
	// The marker denomination and amount
	Coin sdk.Coin `json:"coin"`
	// The marker type
	Type string `json:"marker_type,omitempty"`
	// Allow forced transfers
	AllowForcedTransfer bool `json:"allow_forced_transfer,omitempty"`
	// List of restricted attributes
	RestrictedAttributes []string `json:"restricted_attributes,omitempty"`
	// UsdCents used to initialize the net asset value of marker
	UsdCents uint64 `json:"usd_cents,omitempty"`
	// Volume for the net asset value of marker
	Volume uint64 `json:"volume,omitempty"`
}

CreateMarkerParams are params for encoding a MsgAddMarkerRequest.

func (*CreateMarkerParams) Encode

func (params *CreateMarkerParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgAddMarkerRequest. The contract must be the signer (from address) and manager of the marker.

type DestroyMarkerParams

type DestroyMarkerParams struct {
	// The marker denomination
	Denom string `json:"denom"`
}

DestroyMarkerParams are params for encoding a MsgDeleteRequest.

func (*DestroyMarkerParams) Encode

func (params *DestroyMarkerParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgDeleteRequest. The contract must be the administrator of the marker.

type FinalizeMarkerParams

type FinalizeMarkerParams struct {
	// The marker denomination
	Denom string `json:"denom"`
}

FinalizeMarkerParams are params for encoding a MsgFinalizeRequest.

func (*FinalizeMarkerParams) Encode

func (params *FinalizeMarkerParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgFinalizeRequest. The contract must be the administrator of the marker.

type GetMarkerByAddress

type GetMarkerByAddress struct {
	// The marker address
	Address string `json:"address,omitempty"`
}

GetMarkerByAddress represent a query request to get a marker by address.

func (*GetMarkerByAddress) Run

func (params *GetMarkerByAddress) Run(ctx sdk.Context, keeper keeper.Keeper) ([]byte, error)

Run gets a marker by address or denomination.

type GetMarkerByDenom

type GetMarkerByDenom struct {
	// The marker denomination
	Denom string `json:"denom,omitempty"`
}

GetMarkerByDenom represent a query request to get a marker by denomination.

func (*GetMarkerByDenom) Run

func (params *GetMarkerByDenom) Run(ctx sdk.Context, keeper keeper.Keeper) ([]byte, error)

Run gets a marker by address or denomination.

type GrantAccessParams

type GrantAccessParams struct {
	// The marker denomination
	Denom string `json:"denom"`
	// The grant permissions
	Permissions []string `json:"permissions"`
	// The grant address
	Address string `json:"address"`
}

GrantAccessParams are params for encoding a MsgAddAccessRequest.

func (*GrantAccessParams) Encode

func (params *GrantAccessParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgAddAccessRequest. The contract must be the administrator of the marker.

type Marker

type Marker struct {
	AccountNumber       uint64         `json:"account_number"`
	Address             string         `json:"address"`
	Coins               sdk.Coins      `json:"coins"`
	Denom               string         `json:"denom"`
	Manager             string         `json:"manager"`
	MarkerType          MarkerType     `json:"marker_type"`
	Permissions         []*AccessGrant `json:"permissions,omitempty"`
	Sequence            uint64         `json:"sequence"`
	Status              MarkerStatus   `json:"status"`
	TotalSupply         string         `json:"total_supply"`
	SupplyFixed         bool           `json:"supply_fixed"`
	AllowForcedTransfer bool           `json:"allow_forced_transfer"`
}

Marker represents a marker account in provwasm supported format.

type MarkerMsgParams

type MarkerMsgParams struct {
	// Params for encoding a MsgAddMarkerRequest
	Create *CreateMarkerParams `json:"create_marker,omitempty"`
	// Params for encoding a MsgAddAccessRequest
	Grant *GrantAccessParams `json:"grant_marker_access,omitempty"`
	// Params for encoding a MsgRevokeAccess
	Revoke *RevokeAccessParams `json:"revoke_marker_access,omitempty"`
	// Params for encoding a MsgFinalizeRequest
	Finalize *FinalizeMarkerParams `json:"finalize_marker,omitempty"`
	// Params for encoding a MsgActivateMarker
	Activate *ActivateMarkerParams `json:"activate_marker,omitempty"`
	// Params for encoding a MsgCancelRequest
	Cancel *CancelMarkerParams `json:"cancel_marker,omitempty"`
	// Params for encoding a MsgDeleteRequest
	Destroy *DestroyMarkerParams `json:"destroy_marker,omitempty"`
	// Params for encoding a MsgMintRequest
	Mint *MintSupplyParams `json:"mint_marker_supply,omitempty"`
	// Params for encoding a MsgBurnRequest
	Burn *BurnSupplyParams `json:"burn_marker_supply,omitempty"`
	// Params for encoding a MsgWithdrawRequest
	Withdraw *WithdrawParams `json:"withdraw_coins,omitempty"`
	// Params for encoding a MsgTransferRequest
	Transfer *TransferParams `json:"transfer_marker_coins,omitempty"`
}

MarkerMsgParams are params for encoding []sdk.Msg types from the marker module. Only one field should be set per request.

type MarkerPermission

type MarkerPermission string

MarkerPermission defines marker permission types.

const (
	// MarkerPermissionAdmin is a concrete marker permission type
	MarkerPermissionAdmin MarkerPermission = "admin"
	// MarkerPermissionBurn is a concrete marker permission type
	MarkerPermissionBurn MarkerPermission = "burn"
	// MarkerPermissionDelete is a concrete marker permission type
	MarkerPermissionDelete MarkerPermission = "delete"
	// MarkerPermissionDeposit is a concrete marker permission type
	MarkerPermissionDeposit MarkerPermission = "deposit"
	// MarkerPermissionMint is a concrete marker permission type
	MarkerPermissionMint MarkerPermission = "mint"
	// MarkerPermissionTransfer is a concrete marker permission type
	MarkerPermissionTransfer MarkerPermission = "transfer"
	// MarkerPermissionUnspecified is a concrete marker permission type
	MarkerPermissionUnspecified MarkerPermission = "unspecified"
	// MarkerPermissionWithdraw is a concrete marker permission type
	MarkerPermissionWithdraw MarkerPermission = "withdraw"
)

type MarkerQueryParams

type MarkerQueryParams struct {
	// Get a marker by address.
	*GetMarkerByAddress `json:"get_marker_by_address,omitempty"`
	// Get a marker by denomination.
	*GetMarkerByDenom `json:"get_marker_by_denom,omitempty"`
}

MarkerQueryParams represent parameters used to query the marker module.

type MarkerStatus

type MarkerStatus string

MarkerStatus defines marker status types.

const (
	// MarkerStatusActive is a concrete marker status type
	MarkerStatusActive MarkerStatus = "active"
	// MarkerStatusCancelled is a concrete marker status type
	MarkerStatusCancelled MarkerStatus = "cancelled"
	// MarkerStatusDestroyed is a concrete marker status type
	MarkerStatusDestroyed MarkerStatus = "destroyed"
	// MarkerStatusFinalized is a concrete marker status type
	MarkerStatusFinalized MarkerStatus = "finalized"
	// MarkerStatusProposed is a concrete marker status type
	MarkerStatusProposed MarkerStatus = "proposed"
	// MarkerStatusUnspecified is a concrete marker status type
	MarkerStatusUnspecified MarkerStatus = "unspecified"
)

type MarkerType

type MarkerType string

MarkerType defines types of markers.

const (
	// MarkerTypeCoin is a concrete marker type
	MarkerTypeCoin MarkerType = "coin"
	// MarkerTypeRestricted is a concrete marker type
	MarkerTypeRestricted MarkerType = "restricted"
	// MarkerTypeUnspecified is a concrete marker type
	MarkerTypeUnspecified MarkerType = "unspecified"
)

type MintSupplyParams

type MintSupplyParams struct {
	// The marker denomination and amount to mint
	Coin sdk.Coin `json:"coin"`
}

MintSupplyParams are params for encoding a MsgMintRequest.

func (*MintSupplyParams) Encode

func (params *MintSupplyParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgMintRequest. The contract must be the administrator of the marker.

type RevokeAccessParams

type RevokeAccessParams struct {
	// The marker denom
	Denom string `json:"denom"`
	// The address to revoke
	Address string `json:"address"`
}

RevokeAccessParams are params for encoding a MsgDeleteAccessRequest.

func (*RevokeAccessParams) Encode

func (params *RevokeAccessParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgDeleteAccessRequest. The contract must be the administrator of the marker.

type TransferParams

type TransferParams struct {
	// The denomination and amount to transfer
	Coin sdk.Coin `json:"coin"`
	// The recipient of the transfer
	To string `json:"to"`
	// The sender of the transfer
	From string `json:"from"`
}

TransferParams are params for encoding a MsgTransferRequest.

func (*TransferParams) Encode

func (params *TransferParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgTransferRequest. The contract must be the administrator of the marker.

type WithdrawParams

type WithdrawParams struct {
	// The marker denomination
	Denom string `json:"marker_denom"`
	// The withdrawal denomination and amount
	Coin sdk.Coin `json:"coin"`
	// The recipient of the withdrawal
	Recipient string `json:"recipient"`
}

WithdrawParams are params for encoding a MsgWithdrawRequest.

func (*WithdrawParams) Encode

func (params *WithdrawParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error)

Encode creates a MsgWithdrawRequest. The contract must be the administrator of the marker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL