types

package
v0.10.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the contract module
	ModuleName = "wasm"

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// TStoreKey is the string transient store representation
	TStoreKey = "transient_" + ModuleName

	// QuerierRoute is the querier route for the staking module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the staking module
	RouterKey = ModuleName
)
View Source
const (
	AttributeKeyContract = "contract_address"
	AttributeKeyCodeID   = "code_id"
	AttributeKeySigner   = "signer"
)
View Source
const (
	MaxWasmSize = 500 * 1024

	// MaxLabelSize is the longest label that can be used when Instantiating a contract
	MaxLabelSize = 128

	// BuildTagRegexp is a docker image regexp.
	// We only support max 128 characters, with at least one organization name (subset of all legal names).
	//
	// Details from https://docs.docker.com/engine/reference/commandline/tag/#extended-description :
	//
	// An image name is made up of slash-separated name components (optionally prefixed by a registry hostname).
	// Name components may contain lowercase characters, digits and separators.
	// A separator is defined as a period, one or two underscores, or one or more dashes. A name component may not start or end with a separator.
	//
	// A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes.
	// A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
	BuildTagRegexp = "^[a-z0-9][a-z0-9._-]*[a-z0-9](/[a-z0-9][a-z0-9._-]*[a-z0-9])+:[a-zA-Z0-9_][a-zA-Z0-9_.-]*$"

	MaxBuildTagSize = 128
)
View Source
const AttributeKeyContractAddr = "contract_address"
View Source
const CustomEventType = "wasm"
View Source
const (
	// DefaultParamspace for params keeper
	DefaultParamspace = ModuleName
)

Variables

View Source
var (
	DefaultCodespace = ModuleName

	// ErrCreateFailed error for wasm code that has already been uploaded or failed
	ErrCreateFailed = sdkErrors.Register(DefaultCodespace, 1, "create wasm contract failed")

	// ErrAccountExists error for a contract account that already exists
	ErrAccountExists = sdkErrors.Register(DefaultCodespace, 2, "contract account already exists")

	// ErrInstantiateFailed error for rust instantiate contract failure
	ErrInstantiateFailed = sdkErrors.Register(DefaultCodespace, 3, "instantiate wasm contract failed")

	// ErrExecuteFailed error for rust execution contract failure
	ErrExecuteFailed = sdkErrors.Register(DefaultCodespace, 4, "execute wasm contract failed")

	// ErrGasLimit error for out of gas
	ErrGasLimit = sdkErrors.Register(DefaultCodespace, 5, "insufficient gas")

	// ErrInvalidGenesis error for invalid genesis file syntax
	ErrInvalidGenesis = sdkErrors.Register(DefaultCodespace, 6, "invalid genesis")

	// ErrNotFound error for an entry not found in the store
	ErrNotFound = sdkErrors.Register(DefaultCodespace, 7, "not found")

	// ErrQueryFailed error for rust smart query contract failure
	ErrQueryFailed = sdkErrors.Register(DefaultCodespace, 8, "query wasm contract failed")

	// ErrInvalidMsg error when we cannot process the error returned from the contract
	ErrInvalidMsg = sdkErrors.Register(DefaultCodespace, 9, "invalid CosmosMsg from the contract")

	// ErrMigrationFailed error for rust execution contract failure
	ErrMigrationFailed = sdkErrors.Register(DefaultCodespace, 10, "migrate wasm contract failed")

	// ErrEmpty error for empty content
	ErrEmpty = sdkErrors.Register(DefaultCodespace, 11, "empty")

	// ErrLimit error for content that exceeds a limit
	ErrLimit = sdkErrors.Register(DefaultCodespace, 12, "exceeds limit")

	// ErrInvalid error for content that is invalid in this context
	ErrInvalid = sdkErrors.Register(DefaultCodespace, 13, "invalid")

	// ErrDuplicate error for content that exsists
	ErrDuplicate = sdkErrors.Register(DefaultCodespace, 14, "duplicate")
)

Codes for wasm contract errors

View Source
var (
	CodeKeyPrefix              = []byte{0x01}
	ContractKeyPrefix          = []byte{0x02}
	ContractStorePrefix        = []byte{0x03}
	SequenceKeyPrefix          = []byte{0x04}
	ContractHistoryStorePrefix = []byte{0x05}

	KeyLastCodeID     = append(SequenceKeyPrefix, []byte("lastCodeId")...)
	KeyLastInstanceID = append(SequenceKeyPrefix, []byte("lastContractId")...)
)

nolint

View Source
var (
	DefaultUploadAccess = AllowEverybody
	AllowEverybody      = AccessConfig{Type: Everybody}
	AllowNobody         = AccessConfig{Type: Nobody}
)
View Source
var AllAccessTypes = map[AccessType]struct{}{
	Nobody:      {},
	OnlyAddress: {},
	Everybody:   {},
}
View Source
var DisableAllProposals []ProposalType

DisableAllProposals contains no wasm gov types.

EnableAllProposals contains all wasm gov types as keys.

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

View Source
var ParamStoreKeyInstantiateAccess = []byte("instantiateAccess")
View Source
var ParamStoreKeyUploadAccess = []byte("uploadAccess")

Functions

func GetCodeKey

func GetCodeKey(codeID uint64) []byte

GetCodeKey constructs the key for retreiving the ID for the WASM code

func GetContractAddressKey

func GetContractAddressKey(addr sdk.AccAddress) []byte

GetContractAddressKey returns the key for the WASM contract instance

func GetContractStorePrefixKey

func GetContractStorePrefixKey(addr sdk.AccAddress) []byte

GetContractStorePrefixKey returns the store prefix for the WASM contract instance

func NewEnv

func NewEnv(ctx sdk.Context, creator sdk.AccAddress, deposit sdk.Coins, contractAddr sdk.AccAddress) wasmTypes.Env

NewEnv initializes the environment for a contract instance

func NewWasmCoins

func NewWasmCoins(cosmosCoins sdk.Coins) (wasmCoins []wasmTypes.Coin)

NewWasmCoins translates between Cosmos SDK coins and Wasm coins

func OnlyGenesisFields added in v0.10.0

func OnlyGenesisFields(info *ContractInfo)

func ParamKeyTable added in v0.10.0

func ParamKeyTable() params.KeyTable

ParamKeyTable returns the parameter key table.

func ParseEvents added in v0.9.0

func ParseEvents(logs []wasmTypes.LogAttribute, contractAddr sdk.AccAddress) sdk.Events

ParseEvents converts wasm LogAttributes into an sdk.Events (with 0 or 1 elements)

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the account types and interface

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of supply genesis data returning an error for any failed validation criteria.

func WithSHA256CodeHash added in v0.10.0

func WithSHA256CodeHash(wasmCode []byte) func(info *CodeInfo)

Types

type AbsoluteTxPosition added in v0.9.0

type AbsoluteTxPosition struct {
	// BlockHeight is the block the contract was created at
	BlockHeight int64
	// TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed)
	TxIndex uint64
}

AbsoluteTxPosition can be used to sort contracts

func NewAbsoluteTxPosition added in v0.10.0

func NewAbsoluteTxPosition(ctx sdk.Context) *AbsoluteTxPosition

NewAbsoluteTxPosition gets a timestamp from the context

func (*AbsoluteTxPosition) LessThan added in v0.9.0

func (a *AbsoluteTxPosition) LessThan(b *AbsoluteTxPosition) bool

LessThan can be used to sort

type AccessConfig added in v0.10.0

type AccessConfig struct {
	Type    AccessType     `json:"permission" yaml:"permission"`
	Address sdk.AccAddress `json:"address,omitempty" yaml:"address"`
}

func (AccessConfig) Allowed added in v0.10.0

func (v AccessConfig) Allowed(actor sdk.AccAddress) bool

func (AccessConfig) Equals added in v0.10.0

func (a AccessConfig) Equals(o AccessConfig) bool

func (AccessConfig) ValidateBasic added in v0.10.0

func (v AccessConfig) ValidateBasic() error

type AccessType added in v0.10.0

type AccessType string
const (
	Undefined   AccessType = "Undefined"
	Nobody      AccessType = "Nobody"
	OnlyAddress AccessType = "OnlyAddress"
	Everybody   AccessType = "Everybody"
)

func (AccessType) MarshalText added in v0.10.0

func (a AccessType) MarshalText() ([]byte, error)

func (*AccessType) UnmarshalText added in v0.10.0

func (a *AccessType) UnmarshalText(text []byte) error

func (AccessType) With added in v0.10.0

func (a AccessType) With(addr sdk.AccAddress) AccessConfig

type ClearAdminProposal added in v0.10.0

type ClearAdminProposal struct {
	WasmProposal `yaml:",inline"`

	Contract sdk.AccAddress `json:"contract" yaml:"contract"`
}

ClearAdminProposal gov proposal content type to clear the admin of a contract.

func ClearAdminProposalFixture added in v0.10.0

func ClearAdminProposalFixture(mutators ...func(p *ClearAdminProposal)) ClearAdminProposal

func (ClearAdminProposal) ProposalType added in v0.10.0

func (p ClearAdminProposal) ProposalType() string

ProposalType returns the type

func (ClearAdminProposal) String added in v0.10.0

func (p ClearAdminProposal) String() string

String implements the Stringer interface.

func (ClearAdminProposal) ValidateBasic added in v0.10.0

func (p ClearAdminProposal) ValidateBasic() error

ValidateBasic validates the proposal

type Code

type Code struct {
	CodeID     uint64   `json:"code_id"`
	CodeInfo   CodeInfo `json:"code_info"`
	CodesBytes []byte   `json:"code_bytes"`
}

Code struct encompasses CodeInfo and CodeBytes

func CodeFixture added in v0.9.0

func CodeFixture(mutators ...func(*Code)) Code

func (Code) ValidateBasic added in v0.9.0

func (c Code) ValidateBasic() error

type CodeInfo

type CodeInfo struct {
	CodeHash          []byte         `json:"code_hash"`
	Creator           sdk.AccAddress `json:"creator"`
	Source            string         `json:"source"`
	Builder           string         `json:"builder"`
	InstantiateConfig AccessConfig   `json:"instantiate_config"`
}

CodeInfo is data for the uploaded contract WASM code

func CodeInfoFixture added in v0.9.0

func CodeInfoFixture(mutators ...func(*CodeInfo)) CodeInfo

func NewCodeInfo

func NewCodeInfo(codeHash []byte, creator sdk.AccAddress, source string, builder string, instantiatePermission AccessConfig) CodeInfo

NewCodeInfo fills a new Contract struct

func (CodeInfo) ValidateBasic added in v0.9.0

func (c CodeInfo) ValidateBasic() error

type Contract

type Contract struct {
	ContractAddress sdk.AccAddress `json:"contract_address"`
	ContractInfo    ContractInfo   `json:"contract_info"`
	ContractState   []Model        `json:"contract_state"`
}

Contract struct encompasses ContractAddress, ContractInfo, and ContractState

func ContractFixture added in v0.9.0

func ContractFixture(mutators ...func(*Contract)) Contract

func (Contract) ValidateBasic added in v0.9.0

func (c Contract) ValidateBasic() error

type ContractCodeHistoryEntry added in v0.10.0

type ContractCodeHistoryEntry struct {
	Operation ContractCodeHistoryOperationType `json:"operation"`
	CodeID    uint64                           `json:"code_id"`
	Updated   *AbsoluteTxPosition              `json:"updated,omitempty"`
	Msg       json.RawMessage                  `json:"msg,omitempty"`
}

ContractCodeHistoryEntry stores code updates to a contract.

type ContractCodeHistoryOperationType added in v0.10.0

type ContractCodeHistoryOperationType string
const (
	InitContractCodeHistoryType    ContractCodeHistoryOperationType = "Init"
	MigrateContractCodeHistoryType ContractCodeHistoryOperationType = "Migrate"
	GenesisContractCodeHistoryType ContractCodeHistoryOperationType = "Genesis"
)

type ContractInfo

type ContractInfo struct {
	CodeID  uint64         `json:"code_id"`
	Creator sdk.AccAddress `json:"creator"`
	Admin   sdk.AccAddress `json:"admin,omitempty"`
	Label   string         `json:"label"`
	// never show this in query results, just use for sorting
	// (Note: when using json tag "-" amino refused to serialize it...)
	Created *AbsoluteTxPosition `json:"created,omitempty"`
}

ContractInfo stores a WASM contract instance

func ContractInfoFixture added in v0.9.0

func ContractInfoFixture(mutators ...func(*ContractInfo)) ContractInfo

func NewContractInfo

func NewContractInfo(codeID uint64, creator, admin sdk.AccAddress, label string, createdAt *AbsoluteTxPosition) ContractInfo

NewContractInfo creates a new instance of a given WASM contract info

func (*ContractInfo) AddMigration added in v0.10.0

func (c *ContractInfo) AddMigration(ctx sdk.Context, codeID uint64, msg []byte) ContractCodeHistoryEntry

func (ContractInfo) InitialHistory added in v0.10.0

func (c ContractInfo) InitialHistory(initMsg []byte) ContractCodeHistoryEntry

func (*ContractInfo) ResetFromGenesis added in v0.10.0

func (c *ContractInfo) ResetFromGenesis(ctx sdk.Context) ContractCodeHistoryEntry

ResetFromGenesis resets contracts timestamp and history.

func (*ContractInfo) ValidateBasic added in v0.9.0

func (c *ContractInfo) ValidateBasic() error

type GenesisState

type GenesisState struct {
	Params    Params     `json:"params"`
	Codes     []Code     `json:"codes,omitempty"`
	Contracts []Contract `json:"contracts,omitempty"`
	Sequences []Sequence `json:"sequences,omitempty"`
}

GenesisState is the struct representation of the export genesis

func GenesisFixture added in v0.9.0

func GenesisFixture(mutators ...func(*GenesisState)) GenesisState

func (GenesisState) ValidateBasic added in v0.9.0

func (s GenesisState) ValidateBasic() error

type InstantiateContractProposal added in v0.10.0

type InstantiateContractProposal struct {
	WasmProposal
	// RunAs is the address that pays the init funds
	RunAs sdk.AccAddress `json:"run_as"`
	// Admin is an optional address that can execute migrations
	Admin     sdk.AccAddress  `json:"admin,omitempty"`
	CodeID    uint64          `json:"code_id"`
	Label     string          `json:"label"`
	InitMsg   json.RawMessage `json:"init_msg"`
	InitFunds sdk.Coins       `json:"init_funds"`
}

InstantiateContractProposal gov proposal content type to instantiate a contract.

func InstantiateContractProposalFixture added in v0.10.0

func InstantiateContractProposalFixture(mutators ...func(p *InstantiateContractProposal)) InstantiateContractProposal

func (InstantiateContractProposal) MarshalYAML added in v0.10.0

func (p InstantiateContractProposal) MarshalYAML() (interface{}, error)

func (InstantiateContractProposal) ProposalType added in v0.10.0

func (p InstantiateContractProposal) ProposalType() string

ProposalType returns the type

func (InstantiateContractProposal) String added in v0.10.0

String implements the Stringer interface.

func (InstantiateContractProposal) ValidateBasic added in v0.10.0

func (p InstantiateContractProposal) ValidateBasic() error

ValidateBasic validates the proposal

type MigrateContractProposal added in v0.10.0

type MigrateContractProposal struct {
	WasmProposal `yaml:",inline"`
	Contract     sdk.AccAddress  `json:"contract"`
	CodeID       uint64          `json:"code_id"`
	MigrateMsg   json.RawMessage `json:"msg"`
	// RunAs is the address that is passed to the contract's environment as sender
	RunAs sdk.AccAddress `json:"run_as"`
}

MigrateContractProposal gov proposal content type to migrate a contract.

func MigrateContractProposalFixture added in v0.10.0

func MigrateContractProposalFixture(mutators ...func(p *MigrateContractProposal)) MigrateContractProposal

func (MigrateContractProposal) MarshalYAML added in v0.10.0

func (p MigrateContractProposal) MarshalYAML() (interface{}, error)

func (MigrateContractProposal) ProposalType added in v0.10.0

func (p MigrateContractProposal) ProposalType() string

ProposalType returns the type

func (MigrateContractProposal) String added in v0.10.0

func (p MigrateContractProposal) String() string

String implements the Stringer interface.

func (MigrateContractProposal) ValidateBasic added in v0.10.0

func (p MigrateContractProposal) ValidateBasic() error

ValidateBasic validates the proposal

type Model

type Model struct {
	// hex-encode key to read it better (this is often ascii)
	Key tmBytes.HexBytes `json:"key"`
	// base64-encode raw value
	Value []byte `json:"val"`
}

Model is a struct that holds a KV pair

func (Model) ValidateBasic added in v0.9.0

func (m Model) ValidateBasic() error

type MsgClearAdmin added in v0.9.0

type MsgClearAdmin struct {
	Sender   sdk.AccAddress `json:"sender" yaml:"sender"`
	Contract sdk.AccAddress `json:"contract" yaml:"contract"`
}

func (MsgClearAdmin) GetSignBytes added in v0.9.0

func (msg MsgClearAdmin) GetSignBytes() []byte

func (MsgClearAdmin) GetSigners added in v0.9.0

func (msg MsgClearAdmin) GetSigners() []sdk.AccAddress

func (MsgClearAdmin) Route added in v0.9.0

func (msg MsgClearAdmin) Route() string

func (MsgClearAdmin) Type added in v0.9.0

func (msg MsgClearAdmin) Type() string

func (MsgClearAdmin) ValidateBasic added in v0.9.0

func (msg MsgClearAdmin) ValidateBasic() error

type MsgExecuteContract

type MsgExecuteContract struct {
	Sender    sdk.AccAddress  `json:"sender" yaml:"sender"`
	Contract  sdk.AccAddress  `json:"contract" yaml:"contract"`
	Msg       json.RawMessage `json:"msg" yaml:"msg"`
	SentFunds sdk.Coins       `json:"sent_funds" yaml:"sent_funds"`
}

func (MsgExecuteContract) GetSignBytes

func (msg MsgExecuteContract) GetSignBytes() []byte

func (MsgExecuteContract) GetSigners

func (msg MsgExecuteContract) GetSigners() []sdk.AccAddress

func (MsgExecuteContract) Route

func (msg MsgExecuteContract) Route() string

func (MsgExecuteContract) Type

func (msg MsgExecuteContract) Type() string

func (MsgExecuteContract) ValidateBasic

func (msg MsgExecuteContract) ValidateBasic() error

type MsgInstantiateContract

type MsgInstantiateContract struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	// Admin is an optional address that can execute migrations
	Admin     sdk.AccAddress  `json:"admin,omitempty" yaml:"admin"`
	CodeID    uint64          `json:"code_id" yaml:"code_id"`
	Label     string          `json:"label" yaml:"label"`
	InitMsg   json.RawMessage `json:"init_msg" yaml:"init_msg"`
	InitFunds sdk.Coins       `json:"init_funds" yaml:"init_funds"`
}

func (MsgInstantiateContract) GetSignBytes

func (msg MsgInstantiateContract) GetSignBytes() []byte

func (MsgInstantiateContract) GetSigners

func (msg MsgInstantiateContract) GetSigners() []sdk.AccAddress

func (MsgInstantiateContract) Route

func (msg MsgInstantiateContract) Route() string

func (MsgInstantiateContract) Type

func (msg MsgInstantiateContract) Type() string

func (MsgInstantiateContract) ValidateBasic

func (msg MsgInstantiateContract) ValidateBasic() error

type MsgMigrateContract added in v0.9.0

type MsgMigrateContract struct {
	Sender     sdk.AccAddress  `json:"sender" yaml:"sender"`
	Contract   sdk.AccAddress  `json:"contract" yaml:"contract"`
	CodeID     uint64          `json:"code_id" yaml:"code_id"`
	MigrateMsg json.RawMessage `json:"msg" yaml:"msg"`
}

func (MsgMigrateContract) GetSignBytes added in v0.9.0

func (msg MsgMigrateContract) GetSignBytes() []byte

func (MsgMigrateContract) GetSigners added in v0.9.0

func (msg MsgMigrateContract) GetSigners() []sdk.AccAddress

func (MsgMigrateContract) Route added in v0.9.0

func (msg MsgMigrateContract) Route() string

func (MsgMigrateContract) Type added in v0.9.0

func (msg MsgMigrateContract) Type() string

func (MsgMigrateContract) ValidateBasic added in v0.9.0

func (msg MsgMigrateContract) ValidateBasic() error

type MsgStoreCode

type MsgStoreCode struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	// WASMByteCode can be raw or gzip compressed
	WASMByteCode []byte `json:"wasm_byte_code" yaml:"wasm_byte_code"`
	// Source is a valid absolute HTTPS URI to the contract's source code, optional
	Source string `json:"source" yaml:"source"`
	// Builder is a valid docker image name with tag, optional
	Builder string `json:"builder" yaml:"builder"`
	// InstantiatePermission to apply on contract creation, optional
	InstantiatePermission *AccessConfig `json:"instantiate_permission,omitempty" yaml:"instantiate_permission"`
}

func (MsgStoreCode) GetSignBytes

func (msg MsgStoreCode) GetSignBytes() []byte

func (MsgStoreCode) GetSigners

func (msg MsgStoreCode) GetSigners() []sdk.AccAddress

func (MsgStoreCode) Route

func (msg MsgStoreCode) Route() string

func (MsgStoreCode) Type

func (msg MsgStoreCode) Type() string

func (MsgStoreCode) ValidateBasic

func (msg MsgStoreCode) ValidateBasic() error

type MsgUpdateAdmin added in v0.9.0

type MsgUpdateAdmin struct {
	Sender   sdk.AccAddress `json:"sender" yaml:"sender"`
	NewAdmin sdk.AccAddress `json:"new_admin" yaml:"new_admin"`
	Contract sdk.AccAddress `json:"contract" yaml:"contract"`
}

func (MsgUpdateAdmin) GetSignBytes added in v0.9.0

func (msg MsgUpdateAdmin) GetSignBytes() []byte

func (MsgUpdateAdmin) GetSigners added in v0.9.0

func (msg MsgUpdateAdmin) GetSigners() []sdk.AccAddress

func (MsgUpdateAdmin) Route added in v0.9.0

func (msg MsgUpdateAdmin) Route() string

func (MsgUpdateAdmin) Type added in v0.9.0

func (msg MsgUpdateAdmin) Type() string

func (MsgUpdateAdmin) ValidateBasic added in v0.9.0

func (msg MsgUpdateAdmin) ValidateBasic() error

type Params added in v0.10.0

type Params struct {
	UploadAccess                 AccessConfig `json:"code_upload_access" yaml:"code_upload_access"`
	DefaultInstantiatePermission AccessType   `json:"instantiate_default_permission" yaml:"instantiate_default_permission"`
}

Params defines the set of wasm parameters.

func DefaultParams added in v0.10.0

func DefaultParams() Params

DefaultParams returns default wasm parameters

func (*Params) ParamSetPairs added in v0.10.0

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs returns the parameter set pairs.

func (Params) String added in v0.10.0

func (p Params) String() string

func (Params) ValidateBasic added in v0.10.0

func (p Params) ValidateBasic() error

ValidateBasic performs basic validation on wasm parameters

type ProposalType added in v0.10.0

type ProposalType string
const (
	ProposalTypeStoreCode                ProposalType = "StoreCode"
	ProposalTypeStoreInstantiateContract ProposalType = "InstantiateContract"
	ProposalTypeMigrateContract          ProposalType = "MigrateContract"
	ProposalTypeUpdateAdmin              ProposalType = "UpdateAdmin"
	ProposalTypeClearAdmin               ProposalType = "ClearAdmin"
)

type Sequence added in v0.9.0

type Sequence struct {
	IDKey []byte `json:"id_key"`
	Value uint64 `json:"value"`
}

func (Sequence) ValidateBasic added in v0.9.0

func (s Sequence) ValidateBasic() error

type StoreCodeProposal added in v0.10.0

type StoreCodeProposal struct {
	WasmProposal
	// RunAs is the address that "owns" the code object
	RunAs sdk.AccAddress `json:"run_as"`
	// WASMByteCode can be raw or gzip compressed
	WASMByteCode []byte `json:"wasm_byte_code"`
	// Source is a valid absolute HTTPS URI to the contract's source code, optional
	Source string `json:"source"`
	// Builder is a valid docker image name with tag, optional
	Builder string `json:"builder"`
	// InstantiatePermission to apply on contract creation, optional
	InstantiatePermission *AccessConfig `json:"instantiate_permission"`
}

StoreCodeProposal gov proposal content type to store wasm code.

func StoreCodeProposalFixture added in v0.10.0

func StoreCodeProposalFixture(mutators ...func(*StoreCodeProposal)) StoreCodeProposal

func (StoreCodeProposal) MarshalYAML added in v0.10.0

func (p StoreCodeProposal) MarshalYAML() (interface{}, error)

func (StoreCodeProposal) ProposalType added in v0.10.0

func (p StoreCodeProposal) ProposalType() string

ProposalType returns the type

func (StoreCodeProposal) String added in v0.10.0

func (p StoreCodeProposal) String() string

String implements the Stringer interface.

func (StoreCodeProposal) ValidateBasic added in v0.10.0

func (p StoreCodeProposal) ValidateBasic() error

ValidateBasic validates the proposal

type UpdateAdminProposal added in v0.10.0

type UpdateAdminProposal struct {
	WasmProposal `yaml:",inline"`
	NewAdmin     sdk.AccAddress `json:"new_admin" yaml:"new_admin"`
	Contract     sdk.AccAddress `json:"contract" yaml:"contract"`
}

UpdateAdminProposal gov proposal content type to set an admin for a contract.

func UpdateAdminProposalFixture added in v0.10.0

func UpdateAdminProposalFixture(mutators ...func(p *UpdateAdminProposal)) UpdateAdminProposal

func (UpdateAdminProposal) ProposalType added in v0.10.0

func (p UpdateAdminProposal) ProposalType() string

ProposalType returns the type

func (UpdateAdminProposal) String added in v0.10.0

func (p UpdateAdminProposal) String() string

String implements the Stringer interface.

func (UpdateAdminProposal) ValidateBasic added in v0.10.0

func (p UpdateAdminProposal) ValidateBasic() error

ValidateBasic validates the proposal

type WasmConfig

type WasmConfig struct {
	SmartQueryGasLimit uint64 `mapstructure:"query_gas_limit"`
	CacheSize          uint64 `mapstructure:"lru_size"`
}

WasmConfig is the extra config required for wasm

func DefaultWasmConfig

func DefaultWasmConfig() WasmConfig

DefaultWasmConfig returns the default settings for WasmConfig

type WasmProposal added in v0.10.0

type WasmProposal struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
}

WasmProposal contains common proposal data.

func (WasmProposal) GetDescription added in v0.10.0

func (p WasmProposal) GetDescription() string

GetDescription returns the description of a parameter change proposal.

func (WasmProposal) GetTitle added in v0.10.0

func (p WasmProposal) GetTitle() string

GetTitle returns the title of a parameter change proposal.

func (WasmProposal) ProposalRoute added in v0.10.0

func (p WasmProposal) ProposalRoute() string

ProposalRoute returns the routing key of a parameter change proposal.

func (WasmProposal) ValidateBasic added in v0.10.0

func (p WasmProposal) ValidateBasic() error

ValidateBasic validates the proposal

Jump to

Keyboard shortcuts

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