Documentation ¶
Index ¶
- Constants
- Variables
- func CodeToDefaultMsg(code sdk.CodeType) string
- func ErrAssetAlreadyFinal(assetID string) sdk.Error
- func ErrAssetNotFound(assetID string) sdk.Error
- func ErrInvalidAssetQuantity(assetID string) sdk.Error
- func ErrInvalidAssetRoot(assetID string) sdk.Error
- func ErrInvalidField(field string) sdk.Error
- func ErrInvalidRevokeRecipient(addr sdk.Address) sdk.Error
- func ErrInvalidTransaction(msg string) sdk.Error
- func ErrMissingField(field string) sdk.Error
- func ErrUnknownAsset(msg string) sdk.Error
- func GetAssetKey(assetID string) []byte
- func NewHandler(k Keeper) sdk.Handler
- func RegisterWire(cdc *wire.Codec)
- type AddQuantityMsg
- func (msg AddQuantityMsg) Get(key interface{}) (value interface{})
- func (msg AddQuantityMsg) GetSignBytes() []byte
- func (msg AddQuantityMsg) GetSigners() []sdk.Address
- func (msg AddQuantityMsg) String() string
- func (msg AddQuantityMsg) Type() string
- func (msg AddQuantityMsg) ValidateBasic() sdk.Error
- type AnswerProposalMsg
- func (msg AnswerProposalMsg) Get(key interface{}) (value interface{})
- func (msg AnswerProposalMsg) GetSignBytes() []byte
- func (msg AnswerProposalMsg) GetSigners() []sdk.Address
- func (msg AnswerProposalMsg) String() string
- func (msg AnswerProposalMsg) Type() string
- func (msg AnswerProposalMsg) ValidateBasic() sdk.Error
- type Asset
- func (a Asset) CheckUpdateAttributeAuthorization(address sdk.Address, prop Property) bool
- func (a Asset) IsIssuer(addr sdk.Address) bool
- func (a Asset) IsOwner(addr sdk.Address) bool
- func (a Asset) ValidateProposalAnswer(recipient sdk.Address, answer ProposalStatus) (proposal *Proposal, proposalIndex int, authorized bool)
- func (a Asset) ValidatePropossal(issuer sdk.Address, recipient sdk.Address) (*Proposal, int, bool)
- type AttributeType
- type CreateProposalMsg
- func (msg CreateProposalMsg) Get(key interface{}) (value interface{})
- func (msg CreateProposalMsg) GetSignBytes() []byte
- func (msg CreateProposalMsg) GetSigners() []sdk.Address
- func (msg CreateProposalMsg) String() string
- func (msg CreateProposalMsg) Type() string
- func (msg CreateProposalMsg) ValidateBasic() sdk.Error
- type Keeper
- func (k Keeper) AddMaterials(ctx sdk.Context, msg MsgAddMaterials) (sdk.Tags, sdk.Error)
- func (k Keeper) AddQuantity(ctx sdk.Context, msg AddQuantityMsg) (sdk.Tags, sdk.Error)
- func (k Keeper) AnswerProposal(ctx sdk.Context, msg AnswerProposalMsg) (sdk.Tags, sdk.Error)
- func (k Keeper) CreateAsset(ctx sdk.Context, msg MsgCreateAsset) (sdk.Tags, sdk.Error)
- func (k Keeper) CreateProposal(ctx sdk.Context, msg CreateProposalMsg) (sdk.Tags, sdk.Error)
- func (k Keeper) Finalize(ctx sdk.Context, msg MsgFinalize) (sdk.Tags, sdk.Error)
- func (k Keeper) GetAsset(ctx sdk.Context, assetID string) *Asset
- func (k Keeper) Has(ctx sdk.Context, assetID string) bool
- func (k Keeper) RevokeProposal(ctx sdk.Context, msg RevokeProposalMsg) (sdk.Tags, sdk.Error)
- func (k Keeper) Send(ctx sdk.Context, msg MsgSend) (sdk.Tags, sdk.Error)
- func (k Keeper) SubtractQuantity(ctx sdk.Context, msg SubtractQuantityMsg) (sdk.Tags, sdk.Error)
- func (k Keeper) UpdatePropertipes(ctx sdk.Context, msg MsgUpdatePropertipes) (sdk.Tags, sdk.Error)
- type Location
- type Material
- type Materials
- type MsgAddMaterials
- func (msg MsgAddMaterials) Get(key interface{}) (value interface{})
- func (msg MsgAddMaterials) GetSignBytes() []byte
- func (msg MsgAddMaterials) GetSigners() []sdk.Address
- func (msg MsgAddMaterials) String() string
- func (msg MsgAddMaterials) Type() string
- func (msg MsgAddMaterials) ValidateBasic() sdk.Error
- type MsgCreateAsset
- func (msg MsgCreateAsset) Get(key interface{}) (value interface{})
- func (msg MsgCreateAsset) GetSignBytes() []byte
- func (msg MsgCreateAsset) GetSigners() []sdk.Address
- func (msg MsgCreateAsset) String() string
- func (msg MsgCreateAsset) Type() string
- func (msg MsgCreateAsset) ValidateBasic() sdk.Error
- type MsgFinalize
- type MsgSend
- type MsgUpdatePropertipes
- func (msg MsgUpdatePropertipes) Get(key interface{}) (value interface{})
- func (msg MsgUpdatePropertipes) GetSignBytes() []byte
- func (msg MsgUpdatePropertipes) GetSigners() []sdk.Address
- func (msg MsgUpdatePropertipes) String() string
- func (msg MsgUpdatePropertipes) Type() string
- func (msg MsgUpdatePropertipes) ValidateBasic() sdk.Error
- type Propertipes
- type Property
- type Proposal
- type ProposalRole
- type ProposalStatus
- type Proposals
- type RevokeProposalMsg
- func (msg RevokeProposalMsg) Get(key interface{}) (value interface{})
- func (msg RevokeProposalMsg) GetSignBytes() []byte
- func (msg RevokeProposalMsg) GetSigners() []sdk.Address
- func (msg RevokeProposalMsg) String() string
- func (msg RevokeProposalMsg) Type() string
- func (msg RevokeProposalMsg) ValidateBasic() sdk.Error
- type SubtractQuantityMsg
- func (msg SubtractQuantityMsg) Get(key interface{}) (value interface{})
- func (msg SubtractQuantityMsg) GetSignBytes() []byte
- func (msg SubtractQuantityMsg) GetSigners() []sdk.Address
- func (msg SubtractQuantityMsg) String() string
- func (msg SubtractQuantityMsg) Type() string
- func (msg SubtractQuantityMsg) ValidateBasic() sdk.Error
Constants ¶
const ( CodeUnknownAsset sdk.CodeType = 500 CodeInvalidTransaction sdk.CodeType = 501 CodeInvalidInput sdk.CodeType = 502 CodeInvalidOutput sdk.CodeType = 503 CodeInvalidAssets sdk.CodeType = 504 CodeMissingField sdk.CodeType = 505 CodeInvalidField sdk.CodeType = 506 CodeInvalidRevokeRecipient sdk.CodeType = 507 CodeInvalidAssetQuantity sdk.CodeType = 508 CodeAssetAlreadyFinal sdk.CodeType = 509 CodeInvalidAssetRoot sdk.CodeType = 5090 DefaultCodespace sdk.CodespaceType = 10 )
ABCI Response Codes Base SDK reserves 500 - 599.
Variables ¶
var ( // Keys for store prefixes AssetKey = []byte{0x00} // prefix for each key to a candidate )
nolint
Functions ¶
func CodeToDefaultMsg ¶
CodeToDefaultMsg NOTE: Don't stringer this, we'll put better messages in later.
func ErrAssetAlreadyFinal ¶ added in v0.2.1
func ErrAssetNotFound ¶ added in v0.1.0
func ErrInvalidAssetQuantity ¶ added in v0.2.1
ErrInvalidAssetQuantity ...
func ErrInvalidAssetRoot ¶ added in v0.2.1
func ErrInvalidField ¶ added in v0.1.0
ErrInvalidField ...
func ErrInvalidRevokeRecipient ¶ added in v0.1.0
ErrInvalidRevokeRecipient is used when the recipient of a revoke proposal message is not in the asset's proposal list
func ErrInvalidTransaction ¶ added in v0.2.1
InvalidTransaction ...
func GetAssetKey ¶
GetAssetKey get the key for the record with address
func RegisterWire ¶ added in v0.0.2
Register concrete types on wire codec
Types ¶
type AddQuantityMsg ¶
type AddQuantityMsg struct { Issuer sdk.Address `json:"issuer"` ID string `json:"id"` Quantity int64 `json:"quantity"` Materials Materials `json:"materials"` }
AddQuantityMsg ... ---------------------------------------------------------------
func (AddQuantityMsg) Get ¶
func (msg AddQuantityMsg) Get(key interface{}) (value interface{})
func (AddQuantityMsg) GetSignBytes ¶
func (msg AddQuantityMsg) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (AddQuantityMsg) GetSigners ¶
func (msg AddQuantityMsg) GetSigners() []sdk.Address
func (AddQuantityMsg) String ¶
func (msg AddQuantityMsg) String() string
func (AddQuantityMsg) Type ¶
func (msg AddQuantityMsg) Type() string
func (AddQuantityMsg) ValidateBasic ¶
func (msg AddQuantityMsg) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type AnswerProposalMsg ¶
type AnswerProposalMsg struct { AssetID string `json:"asset_id"` Recipient sdk.Address `json:"recipient"` Response ProposalStatus `json:"response"` }
AnswerProposalMsg ...
func (AnswerProposalMsg) Get ¶
func (msg AnswerProposalMsg) Get(key interface{}) (value interface{})
func (AnswerProposalMsg) GetSignBytes ¶
func (msg AnswerProposalMsg) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (AnswerProposalMsg) GetSigners ¶
func (msg AnswerProposalMsg) GetSigners() []sdk.Address
func (AnswerProposalMsg) String ¶
func (msg AnswerProposalMsg) String() string
func (AnswerProposalMsg) Type ¶
func (msg AnswerProposalMsg) Type() string
func (AnswerProposalMsg) ValidateBasic ¶
func (msg AnswerProposalMsg) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type Asset ¶
type Asset struct { ID string `json:"id"` Name string `json:"name"` Issuer sdk.Address `json:"issuer"` Owner sdk.Address `json:"owner"` Parent string `json:"parent"` // the id of the asset parent Root string `json:"root"` // the id of the asset root Quantity int64 `json:"quantity"` Company string `json:"company"` Email string `json:"email"` Final bool `json:"final"` Propertipes Propertipes `json:"propertipes"` Proposals Proposals `json:"proposals"` Materials Materials `json:"materials"` }
Asset asset infomation
func (Asset) CheckUpdateAttributeAuthorization ¶ added in v0.1.0
CheckUpdateAttributeAuthorization returns whether the address is authorized to update the attribute
func (Asset) ValidateProposalAnswer ¶ added in v0.1.0
func (a Asset) ValidateProposalAnswer(recipient sdk.Address, answer ProposalStatus) (proposal *Proposal, proposalIndex int, authorized bool)
ValidateProposalAnswer checks whether the recipient is authorized to answer, if authorized then returns the existing proposal and its index
func (Asset) ValidatePropossal ¶ added in v0.1.0
ValidatePropossal returns whether the address is authorized to create a new proposal, optionally return a proposal and its index if a proposal for the recipient already exists
type AttributeType ¶ added in v0.1.0
type AttributeType int
AttributeType define the type ò the attribute
const ( AttributeTypeBytes AttributeType = iota AttributeTypeString AttributeTypeBoolean AttributeTypeNumber AttributeTypeEnum AttributeTypeLocation )
All avaliable type ò the attribute
type CreateProposalMsg ¶
type CreateProposalMsg struct { AssetID string `json:"asset_id"` Issuer sdk.Address `json:"issuer"` Recipient sdk.Address `json:"recipient"` Propertipes []string `json:"propertipes"` Role ProposalRole `json:"role"` }
CreateProposalMsg ...
func (CreateProposalMsg) Get ¶
func (msg CreateProposalMsg) Get(key interface{}) (value interface{})
func (CreateProposalMsg) GetSignBytes ¶
func (msg CreateProposalMsg) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (CreateProposalMsg) GetSigners ¶
func (msg CreateProposalMsg) GetSigners() []sdk.Address
func (CreateProposalMsg) String ¶
func (msg CreateProposalMsg) String() string
func (CreateProposalMsg) Type ¶
func (msg CreateProposalMsg) Type() string
func (CreateProposalMsg) ValidateBasic ¶
func (msg CreateProposalMsg) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper ...
func (Keeper) AddMaterials ¶ added in v0.2.1
AddMaterials add materials to the asset
func (Keeper) AddQuantity ¶
AddQuantity ...
func (Keeper) AnswerProposal ¶ added in v0.1.0
AnswerProposal update the status of the proposal of the recipient if the answer is valid
func (Keeper) CreateAsset ¶ added in v0.2.1
Register register new asset
func (Keeper) CreateProposal ¶ added in v0.1.0
CreateProposal validates and adds a new proposal to the asset, or update a propsal if there already exists one for the recipient
func (Keeper) RevokeProposal ¶ added in v0.1.0
RevokeProposal delete some properties from an existing proposal and will delete the proposal if there is no property left
func (Keeper) SubtractQuantity ¶
SubtractQuantity ...
func (Keeper) UpdatePropertipes ¶ added in v0.2.1
UpdateAttribute ...
type Material ¶ added in v0.1.0
Material defines the total material of new asset
func (Material) SameAssetAs ¶ added in v0.1.0
SameDenomAs returns true if the two assets are the same asset
type Materials ¶ added in v0.1.0
type Materials []Material
Materials - list of materials
func (Materials) Plus ¶ added in v0.1.0
Plus combines two sets of materials CONTRACT: Plus will never return materials where one Material has a 0 quantity.
type MsgAddMaterials ¶ added in v0.1.0
type MsgAddMaterials struct { AssetID string `json:"asset_id"` Sender sdk.Address `json:"sender"` Materials Materials `json:"materials"` }
MsgAddMaterials ...
func (MsgAddMaterials) Get ¶ added in v0.1.0
func (msg MsgAddMaterials) Get(key interface{}) (value interface{})
func (MsgAddMaterials) GetSignBytes ¶ added in v0.1.0
func (msg MsgAddMaterials) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (MsgAddMaterials) GetSigners ¶ added in v0.1.0
func (msg MsgAddMaterials) GetSigners() []sdk.Address
func (MsgAddMaterials) String ¶ added in v0.1.0
func (msg MsgAddMaterials) String() string
func (MsgAddMaterials) Type ¶ added in v0.1.0
func (msg MsgAddMaterials) Type() string
func (MsgAddMaterials) ValidateBasic ¶ added in v0.1.0
func (msg MsgAddMaterials) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type MsgCreateAsset ¶ added in v0.2.1
type MsgCreateAsset struct { Issuer sdk.Address `json:"issuer"` AssetID string `json:"asset_id"` Name string `json:"name"` Quantity int64 `json:"quantity"` Parent string `json:"parent"` // the id of the parent asset Materials Materials `json:"materials"` Propertipes Propertipes `json:"propertipes"` }
MsgCreateAsset A really msg record create type, these fields are can be entirely arbitrary and custom to your message
func NewMsgCreateAsset ¶ added in v0.2.1
func NewMsgCreateAsset(issuer sdk.Address, id, name string, quantity int64, parent string) MsgCreateAsset
NewMsgCreateAsset new record create msg
func (MsgCreateAsset) Get ¶ added in v0.2.1
func (msg MsgCreateAsset) Get(key interface{}) (value interface{})
func (MsgCreateAsset) GetSignBytes ¶ added in v0.2.1
func (msg MsgCreateAsset) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (MsgCreateAsset) GetSigners ¶ added in v0.2.1
func (msg MsgCreateAsset) GetSigners() []sdk.Address
func (MsgCreateAsset) String ¶ added in v0.2.1
func (msg MsgCreateAsset) String() string
func (MsgCreateAsset) ValidateBasic ¶ added in v0.2.1
func (msg MsgCreateAsset) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type MsgFinalize ¶ added in v0.2.1
MsgSend ...
func (MsgFinalize) Get ¶ added in v0.2.1
func (msg MsgFinalize) Get(key interface{}) (value interface{})
func (MsgFinalize) GetSignBytes ¶ added in v0.2.1
func (msg MsgFinalize) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (MsgFinalize) GetSigners ¶ added in v0.2.1
func (msg MsgFinalize) GetSigners() []sdk.Address
func (MsgFinalize) String ¶ added in v0.2.1
func (msg MsgFinalize) String() string
func (MsgFinalize) Type ¶ added in v0.2.1
func (msg MsgFinalize) Type() string
func (MsgFinalize) ValidateBasic ¶ added in v0.2.1
func (msg MsgFinalize) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type MsgSend ¶ added in v0.2.1
type MsgSend struct { Sender sdk.Address `json:"sender"` Recipient sdk.Address `json:"recipient"` Assets []string `json:"assets"` }
MsgSend ...
func (MsgSend) GetSignBytes ¶ added in v0.2.1
GetSignBytes Get the bytes for the message signer to sign on
func (MsgSend) GetSigners ¶ added in v0.2.1
func (MsgSend) ValidateBasic ¶ added in v0.2.1
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type MsgUpdatePropertipes ¶ added in v0.2.1
type MsgUpdatePropertipes struct { Issuer sdk.Address `json:"issuer"` ID string `json:"id"` Propertipes Propertipes `json:"propertipes"` }
MsgUpdatePropertipes ... ---------------------------------------------------------------
func (MsgUpdatePropertipes) Get ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) Get(key interface{}) (value interface{})
func (MsgUpdatePropertipes) GetSignBytes ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (MsgUpdatePropertipes) GetSigners ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) GetSigners() []sdk.Address
func (MsgUpdatePropertipes) String ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) String() string
func (MsgUpdatePropertipes) Type ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) Type() string
func (MsgUpdatePropertipes) ValidateBasic ¶ added in v0.2.1
func (msg MsgUpdatePropertipes) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type Propertipes ¶ added in v0.2.1
type Propertipes []Property
list all propertipes
func (Propertipes) Adds ¶ added in v0.2.1
func (propertipesA Propertipes) Adds(othersB ...Property) Propertipes
func (Propertipes) Less ¶ added in v0.2.1
func (propertipes Propertipes) Less(i, j int) bool
func (Propertipes) Sort ¶ added in v0.2.1
func (propertipes Propertipes) Sort() Propertipes
Sort is a helper function to sort the set of materials inplace
func (Propertipes) Swap ¶ added in v0.2.1
func (propertipes Propertipes) Swap(i, j int)
type Property ¶ added in v0.2.1
type Property struct { Name string `json:"name"` Type AttributeType `json:"type"` BytesValue []byte `json:"bytes_value"` StringValue string `json:"string_value"` BooleanValue bool `json:"boolean_value"` NumberValue int64 `json:"number_value"` EnumValue []string `json:"enum_value"` Location Location `json:"location_value"` }
Property property of the asset
type Proposal ¶
type Proposal struct { Role ProposalRole `json:"role"` // The role assigned to the recipient Status ProposalStatus `json:"status"` // The response of the recipient Properties []string `json:"properties"` // The asset's attributes name that the recipient is authorized to update Issuer sdk.Address `json:"issuer"` // The proposal issuer Recipient sdk.Address `json:"recipient"` // The recipient of the proposal }
Proposal is an invitation to manage an asset
func (*Proposal) AddProperties ¶ added in v0.1.0
AddProperties add new properties to the proposal, filtering existing value
func (*Proposal) IsAccepted ¶ added in v0.1.0
IsAccepted returns true if the proposal was accepted
func (*Proposal) RemoveProperties ¶ added in v0.1.0
RemoveProperties removes the listed properties from the proposal
type ProposalRole ¶ added in v0.1.0
type ProposalRole int
ProposalRole defines the authority of the proposal's recipient
const ( // RoleReporter is authorized to update the asset's attributes // whose name is included in the proposal's properties field RoleReporter ProposalRole = iota // RoleOwner has the same authorization as RoleReporter // but also authorized to make proposal to other recipient RoleOwner )
type ProposalStatus ¶ added in v0.1.0
type ProposalStatus int
ProposalStatus define the status of the proposal
const ( StatusPending ProposalStatus = iota // The recipient has not answered StatusAccepted // The recipient accepted the proposal StatusRefused // The recipient refused the proposal )
All available status of the proposal
type RevokeProposalMsg ¶
type RevokeProposalMsg struct { AssetID string `json:"asset_id"` Issuer sdk.Address `json:"issuer"` Recipient sdk.Address `json:"recipient"` Propertipes []string `json:"propertipes"` }
RevokeProposalMsg ...
func (RevokeProposalMsg) Get ¶
func (msg RevokeProposalMsg) Get(key interface{}) (value interface{})
func (RevokeProposalMsg) GetSignBytes ¶
func (msg RevokeProposalMsg) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (RevokeProposalMsg) GetSigners ¶
func (msg RevokeProposalMsg) GetSigners() []sdk.Address
func (RevokeProposalMsg) String ¶
func (msg RevokeProposalMsg) String() string
func (RevokeProposalMsg) Type ¶
func (msg RevokeProposalMsg) Type() string
func (RevokeProposalMsg) ValidateBasic ¶
func (msg RevokeProposalMsg) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly
type SubtractQuantityMsg ¶
type SubtractQuantityMsg struct { Issuer sdk.Address `json:"issuer"` ID string `json:"id"` Quantity int64 `json:"quantity"` }
AddQuantityMsg ... ---------------------------------------------------------------
func (SubtractQuantityMsg) Get ¶
func (msg SubtractQuantityMsg) Get(key interface{}) (value interface{})
func (SubtractQuantityMsg) GetSignBytes ¶
func (msg SubtractQuantityMsg) GetSignBytes() []byte
GetSignBytes Get the bytes for the message signer to sign on
func (SubtractQuantityMsg) GetSigners ¶
func (msg SubtractQuantityMsg) GetSigners() []sdk.Address
func (SubtractQuantityMsg) String ¶
func (msg SubtractQuantityMsg) String() string
func (SubtractQuantityMsg) Type ¶
func (msg SubtractQuantityMsg) Type() string
func (SubtractQuantityMsg) ValidateBasic ¶
func (msg SubtractQuantityMsg) ValidateBasic() sdk.Error
ValidateBasic Validate Basic is used to quickly disqualify obviously invalid messages quickly