Documentation ¶
Index ¶
- Constants
- Variables
- func ChannelStoreKey(chainName, channelPort string) []byte
- func GetEscrowAddress() sdk.AccAddress
- func OrderStoreKey(orderID uint64) []byte
- func RegisterCodec(cdc *codec.Codec)
- type BankKeeper
- type BorshDecoder
- type ChannelKeeper
- type Encoder
- func (encoder *Encoder) EncodeBytes(value []byte)
- func (encoder *Encoder) EncodeSigned16(value int16)
- func (encoder *Encoder) EncodeSigned32(value int32)
- func (encoder *Encoder) EncodeSigned64(value int64)
- func (encoder *Encoder) EncodeSigned8(value int8)
- func (encoder *Encoder) EncodeString(value string)
- func (encoder *Encoder) EncodeU16(value uint16)
- func (encoder *Encoder) EncodeU32(value uint32)
- func (encoder *Encoder) EncodeU64(value uint64)
- func (encoder *Encoder) EncodeU8(value uint8)
- func (encoder *Encoder) GetEncodedData() []byte
- type MsgBuyGold
- type MsgCreateProduct
- type MsgCreateReservation
- type MsgCreateSell
- type MsgDecideSell
- type MsgDeleteReservation
- type MsgDeleteSell
- type MsgPayReservation
- type MsgPayReservationByAtom
- type MsgSetSourceChannel
- type MsgUpdateProduct
- type MsgUpdateReservation
- type MsgUpdateSell
- type Order
- type OrderStatus
- type Product
- type QueryResProducts
- type QueryResReservations
- type QueryResSells
- type Reservation
- type Result
- type Sell
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "sunchain" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
const RouterKey = ModuleName
RouterKey is they name of the goldcdp module
Variables ¶
var ( ErrInvalidBasicMsg = sdkerrors.Register(ModuleName, 1, "InvalidBasicMsg") ErrBadDataValue = sdkerrors.Register(ModuleName, 2, "BadDataValue") ErrItemDuplication = sdkerrors.Register(ModuleName, 4, "ItemDuplication") ErrItemNotFound = sdkerrors.Register(ModuleName, 5, "ItemNotFound") ErrInvalidState = sdkerrors.Register(ModuleName, 6, "InvalidState") ErrBadWasmExecution = sdkerrors.Register(ModuleName, 7, "BadWasmExecution") ErrOnlyOneDenomAllowed = sdkerrors.Register(ModuleName, 8, "OnlyOneDenomAllowed") ErrInvalidDenom = sdkerrors.Register(ModuleName, 9, "InvalidDenom") ErrUnknownClientID = sdkerrors.Register(ModuleName, 10, "UnknownClientID") ErrProductDoesNotExist = sdkerrors.Register(ModuleName, 11, "product does not exist") ErrProductAlreadyExists = sdkerrors.Register(ModuleName, 12, "product already exists") ErrSellDoesNotExist = sdkerrors.Register(ModuleName, 13, "sell does not exist") ErrSellAlreadyExists = sdkerrors.Register(ModuleName, 14, "sell already exists") ErrReservationDoesNotExist = sdkerrors.Register(ModuleName, 15, "reservation does not exist") ErrReservationAlreadyExists = sdkerrors.Register(ModuleName, 16, "reservation already exists") ErrReservationNotDecided = sdkerrors.Register(ModuleName, 17, "reservation not decided") )
var ( // GlobalStoreKeyPrefix is a prefix for global primitive state variable GlobalStoreKeyPrefix = []byte{0x00} // OrdersCountStoreKey is a key that help getting to current orders count state variable OrdersCountStoreKey = append(GlobalStoreKeyPrefix, []byte("OrdersCount")...) // ChannelStoreKeyPrefix is a prefix for storing channel ChannelStoreKeyPrefix = []byte{0x01} // OrderStoreKeyPrefix is a prefix for storing order OrderStoreKeyPrefix = []byte{0x02} )
var MinNamePrice = sdk.Coins{sdk.NewInt64Coin("nametoken", 1)}
MinNamePrice is Initial Starting Price for a name that was never previously owned
var MinProductPrice = sdk.Coins{sdk.NewInt64Coin("producttoken", 1)}
MinProductPrice is Initial Starting Price for a product that was never previously owned
var ModuleCdc = codec.New()
ModuleCdc is the codec for the module.
Functions ¶
func ChannelStoreKey ¶
ChannelStoreKey is a function to generate key for each verified channel in store
func GetEscrowAddress ¶
func GetEscrowAddress() sdk.AccAddress
func OrderStoreKey ¶
OrderStoreKey is a function to generate key for each order in store
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec.
Types ¶
type BankKeeper ¶
type BankKeeper interface { AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error) SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error }
BankKeeper defines the expected bank keeper
type BorshDecoder ¶
type BorshDecoder struct {
// contains filtered or unexported fields
}
func NewBorshDecoder ¶
func NewBorshDecoder(data []byte) BorshDecoder
func (*BorshDecoder) DecodeString ¶
func (decoder *BorshDecoder) DecodeString() (string, error)
func (*BorshDecoder) DecodeU32 ¶
func (decoder *BorshDecoder) DecodeU32() (uint32, error)
func (*BorshDecoder) DecodeU64 ¶
func (decoder *BorshDecoder) DecodeU64() (uint64, error)
func (*BorshDecoder) DecodeU8 ¶
func (decoder *BorshDecoder) DecodeU8() (uint8, error)
func (*BorshDecoder) Finished ¶
func (decoder *BorshDecoder) Finished() bool
type ChannelKeeper ¶
type ChannelKeeper interface { GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) SendPacket(ctx sdk.Context, packet channelexported.PacketI) error PacketExecuted(ctx sdk.Context, packet channelexported.PacketI, acknowledgement []byte) error ChanCloseInit(ctx sdk.Context, portID, channelID string) error TimeoutExecuted(ctx sdk.Context, packet channelexported.PacketI) error }
ChannelKeeper defines the expected IBC channel keeper
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder stores the information necessary for the encoding functions
func (*Encoder) EncodeBytes ¶
EncodeBytes takes a `[]byte` variable and encodes it into a byte array
func (*Encoder) EncodeSigned16 ¶
EncodeSigned16 takes an `int16` variable and encodes it into a byte array
func (*Encoder) EncodeSigned32 ¶
EncodeSigned32 takes an `int32` variable and encodes it into a byte array
func (*Encoder) EncodeSigned64 ¶
EncodeSigned64 takes an `int64` variable and encodes it into a byte array
func (*Encoder) EncodeSigned8 ¶
EncodeSigned8 takes an `int8` variable and encodes it into a byte array
func (*Encoder) EncodeString ¶
EncodeString takes a `string` variable and encodes it into a byte array
func (*Encoder) GetEncodedData ¶
GetEncodedData returns the `data` byte slice containing all the previously encoded data
type MsgBuyGold ¶
type MsgBuyGold struct { Buyer sdk.AccAddress `json:"buyer"` Amount sdk.Coins `json:"amount"` }
MsgBuyGold is a message for creating order to buy gold
func NewMsgBuyGold ¶
func NewMsgBuyGold( buyer sdk.AccAddress, amount sdk.Coins, ) MsgBuyGold
NewMsgBuyGold creates a new MsgBuyGold instance.
func (MsgBuyGold) GetSignBytes ¶
func (msg MsgBuyGold) GetSignBytes() []byte
GetSignBytes implements the sdk.Msg interface for MsgBuyGold.
func (MsgBuyGold) GetSigners ¶
func (msg MsgBuyGold) GetSigners() []sdk.AccAddress
GetSigners implements the sdk.Msg interface for MsgBuyGold.
func (MsgBuyGold) Route ¶
func (msg MsgBuyGold) Route() string
Route implements the sdk.Msg interface for MsgBuyGold.
func (MsgBuyGold) Type ¶
func (msg MsgBuyGold) Type() string
Type implements the sdk.Msg interface for MsgBuyGold.
func (MsgBuyGold) ValidateBasic ¶
func (msg MsgBuyGold) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface for MsgBuyGold.
type MsgCreateProduct ¶
type MsgCreateProduct struct { ProductID string `json:"productID"` Title string `json:"title"` Description string `json:"description"` Category string `json:"category"` Images string `json:"images"` Signer sdk.AccAddress `json:"signer"` }
MsgCreateProduct defines a SetProduct message
func NewMsgCreateProduct ¶
func NewMsgCreateProduct(productID string, title string, description string, category string, images string, signer sdk.AccAddress) MsgCreateProduct
NewMsgCreateProduct is a constructor function for MsgSetProduct
func (MsgCreateProduct) GetSignBytes ¶
func (msg MsgCreateProduct) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateProduct) GetSigners ¶
func (msg MsgCreateProduct) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateProduct) Route ¶
func (msg MsgCreateProduct) Route() string
Route should return the name of the module
func (MsgCreateProduct) Type ¶
func (msg MsgCreateProduct) Type() string
Type should return the action
func (MsgCreateProduct) ValidateBasic ¶
func (msg MsgCreateProduct) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgCreateReservation ¶
type MsgCreateReservation struct { ReservationID string `json:"reservationID"` SellID string `json:"sellID"` Signer sdk.AccAddress `json:"buyer"` Price sdk.Coins `json:"price"` }
MsgSetReservation defines a SetReservation message
func NewMsgCreateReservation ¶
func NewMsgCreateReservation(reservationID string, sellID string, signer sdk.AccAddress, price sdk.Coins) MsgCreateReservation
NewMsgCreateReservation is a constructor function for MsgCreateReservation
func (MsgCreateReservation) GetSignBytes ¶
func (msg MsgCreateReservation) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateReservation) GetSigners ¶
func (msg MsgCreateReservation) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateReservation) Route ¶
func (msg MsgCreateReservation) Route() string
Route should return the name of the module
func (MsgCreateReservation) Type ¶
func (msg MsgCreateReservation) Type() string
Type should return the action
func (MsgCreateReservation) ValidateBasic ¶
func (msg MsgCreateReservation) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgCreateSell ¶
type MsgCreateSell struct { SellID string `json:"sellID"` ProductID string `json:"productID"` Signer sdk.AccAddress `json:"signer"` MinPrice sdk.Coins `json:"minPrice"` }
MsgSetSell defines a SetSell message
func NewMsgCreateSell ¶
func NewMsgCreateSell(sellID string, productID string, signer sdk.AccAddress, minPrice sdk.Coins) MsgCreateSell
NewMsgCreateSell is a constructor function for MsgCreateSell
func (MsgCreateSell) GetSignBytes ¶
func (msg MsgCreateSell) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateSell) GetSigners ¶
func (msg MsgCreateSell) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateSell) Route ¶
func (msg MsgCreateSell) Route() string
Route should return the name of the module
func (MsgCreateSell) ValidateBasic ¶
func (msg MsgCreateSell) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgDecideSell ¶
type MsgDecideSell struct { ReservationID string `json:"reservationID"` Signer sdk.AccAddress `json:"signer"` }
MsgDecideSell defines a DecideSell message
func NewMsgDecideSell ¶
func NewMsgDecideSell(reservationID string, signer sdk.AccAddress) MsgDecideSell
NewMsgDecideSell is a constructor function for MsgDecideSell
func (MsgDecideSell) GetSignBytes ¶
func (msg MsgDecideSell) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgDecideSell) GetSigners ¶
func (msg MsgDecideSell) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgDecideSell) Route ¶
func (msg MsgDecideSell) Route() string
Route should return the name of the module
func (MsgDecideSell) ValidateBasic ¶
func (msg MsgDecideSell) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgDeleteReservation ¶
type MsgDeleteReservation struct { ReservationID string `json:"reservationID"` Signer sdk.AccAddress `json:"signer"` }
MsgDeleteReservation defines a DeleteReservation message
func NewMsgDeleteReservation ¶
func NewMsgDeleteReservation(reservationId string, signer sdk.AccAddress) MsgDeleteReservation
NewMsgDeleteReservation is a constructor function for MsgDeleteReservation
func (MsgDeleteReservation) GetSignBytes ¶
func (msg MsgDeleteReservation) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgDeleteReservation) GetSigners ¶
func (msg MsgDeleteReservation) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgDeleteReservation) Route ¶
func (msg MsgDeleteReservation) Route() string
Route should return the name of the module
func (MsgDeleteReservation) Type ¶
func (msg MsgDeleteReservation) Type() string
Type should return the action
func (MsgDeleteReservation) ValidateBasic ¶
func (msg MsgDeleteReservation) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgDeleteSell ¶
type MsgDeleteSell struct { SellID string `json:"sellID"` Signer sdk.AccAddress `json:"signer"` }
MsgDeleteSell defines a DeleteSell message
func NewMsgDeleteSell ¶
func NewMsgDeleteSell(sellID string, signer sdk.AccAddress) MsgDeleteSell
NewMsgDeleteSell is a constructor function for MsgDeleteSell
func (MsgDeleteSell) GetSignBytes ¶
func (msg MsgDeleteSell) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgDeleteSell) GetSigners ¶
func (msg MsgDeleteSell) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgDeleteSell) Route ¶
func (msg MsgDeleteSell) Route() string
Route should return the name of the module
func (MsgDeleteSell) ValidateBasic ¶
func (msg MsgDeleteSell) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgPayReservation ¶
type MsgPayReservation struct { ReservationID string `json:"reservationID"` Signer sdk.AccAddress `json:"signer"` }
MsgDecideSell defines a DecideSell message
func NewMsgPayReservation ¶
func NewMsgPayReservation(reservationID string, signer sdk.AccAddress) MsgPayReservation
NewMsgPayReservation is a constructor function for MsgPayReservation
func (MsgPayReservation) GetSignBytes ¶
func (msg MsgPayReservation) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgPayReservation) GetSigners ¶
func (msg MsgPayReservation) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgPayReservation) Route ¶
func (msg MsgPayReservation) Route() string
Route should return the name of the module
func (MsgPayReservation) Type ¶
func (msg MsgPayReservation) Type() string
Type should return the action
func (MsgPayReservation) ValidateBasic ¶
func (msg MsgPayReservation) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgPayReservationByAtom ¶
type MsgPayReservationByAtom struct { ReservationID string `json:"reservationID"` Signer sdk.AccAddress `json:"signer"` }
MsgDecideSell defines a DecideSell message
func NewMsgPayReservationByAtom ¶
func NewMsgPayReservationByAtom(reservationID string, signer sdk.AccAddress) MsgPayReservationByAtom
NewMsgPayReservationByAtom is a constructor function for MsgPayReservationByAtom
func (MsgPayReservationByAtom) GetSignBytes ¶
func (msg MsgPayReservationByAtom) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgPayReservationByAtom) GetSigners ¶
func (msg MsgPayReservationByAtom) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgPayReservationByAtom) Route ¶
func (msg MsgPayReservationByAtom) Route() string
Route should return the name of the module
func (MsgPayReservationByAtom) Type ¶
func (msg MsgPayReservationByAtom) Type() string
Type should return the action
func (MsgPayReservationByAtom) ValidateBasic ¶
func (msg MsgPayReservationByAtom) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgSetSourceChannel ¶
type MsgSetSourceChannel struct { ChainName string `json:"chain_name"` SourcePort string `json:"source_port"` SourceChannel string `json:"source_channel"` Signer sdk.AccAddress `json:"signer"` }
MsgSetSoruceChannel is a message for setting source channel to other chain
func NewMsgSetSourceChannel ¶
func NewMsgSetSourceChannel( chainName, sourcePort, sourceChannel string, signer sdk.AccAddress, ) MsgSetSourceChannel
func (MsgSetSourceChannel) GetSignBytes ¶
func (msg MsgSetSourceChannel) GetSignBytes() []byte
GetSignBytes implements the sdk.Msg interface for MsgSetSourceChannel.
func (MsgSetSourceChannel) GetSigners ¶
func (msg MsgSetSourceChannel) GetSigners() []sdk.AccAddress
GetSigners implements the sdk.Msg interface for MsgSetSourceChannel.
func (MsgSetSourceChannel) Route ¶
func (msg MsgSetSourceChannel) Route() string
Route implements the sdk.Msg interface for MsgSetSourceChannel.
func (MsgSetSourceChannel) Type ¶
func (msg MsgSetSourceChannel) Type() string
Type implements the sdk.Msg interface for MsgSetSourceChannel.
func (MsgSetSourceChannel) ValidateBasic ¶
func (msg MsgSetSourceChannel) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface for MsgSetSourceChannel.
type MsgUpdateProduct ¶
type MsgUpdateProduct struct { ProductID string `json:"productID"` Title string `json:"title"` Description string `json:"description"` Category string `json:"category"` Images string `json:"images"` Signer sdk.AccAddress `json:"signer"` }
MsgUpdateProduct defines a UpdateProduct message
func NewMsgUpdateProduct ¶
func NewMsgUpdateProduct(productID string, title string, description string, category string, images string, signer sdk.AccAddress) MsgUpdateProduct
NewMsgUpdateProduct is a constructor function for MsgSetProduct
func (MsgUpdateProduct) GetSignBytes ¶
func (msg MsgUpdateProduct) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgUpdateProduct) GetSigners ¶
func (msg MsgUpdateProduct) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgUpdateProduct) Route ¶
func (msg MsgUpdateProduct) Route() string
Route should return the name of the module
func (MsgUpdateProduct) Type ¶
func (msg MsgUpdateProduct) Type() string
Type should return the action
func (MsgUpdateProduct) ValidateBasic ¶
func (msg MsgUpdateProduct) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgUpdateReservation ¶
type MsgUpdateReservation struct { ReservationID string `json:"reservationID"` Signer sdk.AccAddress `json:"signer"` Price sdk.Coins `json:"price"` }
MsgUpdateReservation defines a SetReservationPrice message
func NewMsgUpdateReservation ¶
func NewMsgUpdateReservation(reservationID string, signer sdk.AccAddress, price sdk.Coins) MsgUpdateReservation
NewMsgUpdateReservation is a constructor function for MsgUpdateReservation
func (MsgUpdateReservation) GetSignBytes ¶
func (msg MsgUpdateReservation) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgUpdateReservation) GetSigners ¶
func (msg MsgUpdateReservation) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgUpdateReservation) Route ¶
func (msg MsgUpdateReservation) Route() string
Route should return the name of the module
func (MsgUpdateReservation) Type ¶
func (msg MsgUpdateReservation) Type() string
Type should return the action
func (MsgUpdateReservation) ValidateBasic ¶
func (msg MsgUpdateReservation) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgUpdateSell ¶
type MsgUpdateSell struct { SellID string `json:"sellID"` Signer sdk.AccAddress `json:"signer"` MinPrice sdk.Coins `json:"minPrice"` }
MsgUpdateSell defines a SetSellMinPrice message
func NewMsgUpdateSell ¶
func NewMsgUpdateSell(sellID string, signer sdk.AccAddress, minPrice sdk.Coins) MsgUpdateSell
NewMsgUpdateSell is a constructor function for MsgUpdateSell
func (MsgUpdateSell) GetSignBytes ¶
func (msg MsgUpdateSell) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgUpdateSell) GetSigners ¶
func (msg MsgUpdateSell) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgUpdateSell) Route ¶
func (msg MsgUpdateSell) Route() string
Route should return the name of the module
func (MsgUpdateSell) ValidateBasic ¶
func (msg MsgUpdateSell) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Order ¶
type Order struct { Owner sdk.AccAddress `json:"owner"` Amount sdk.Coins `json:"amount"` Gold sdk.Coin `json:"gold"` Status OrderStatus `json:"status"` }
type Product ¶
type Product struct { ProductID string `json:"productID"` Title string `json:"title"` Description string `json:"description"` Category string `json:"category"` Images string `json:"images"` Owner sdk.AccAddress `json:"owner"` Selling bool `json:"selling"` SellID string `json:"sellID"` }
Product is struct that contains all the metadata of a product
type Reservation ¶
type Reservation struct { ReservationID string `json:"reservationID"` SellID string `json:"sellID"` Buyer sdk.AccAddress `json:"buyer"` Price sdk.Coins `json:"price"` Decide bool `json:"decide"` }
Reservation is a struct contains all the metadata of a reservation