Documentation ¶
Index ¶
- Constants
- Variables
- func GetAccountContractKey(addr sdk.AccAddress, contractID string) []byte
- func GetAccountContractsKey(addr sdk.AccAddress) []byte
- func GetContractKey(contractID string) []byte
- func NewHandler(k Keeper) sdk.Handler
- func NewPubKey(pk string) (res ed25519.PubKeyEd25519)
- func RegisterWire(cdc *wire.Codec)
- func TestAddr(addr string, bech string) sdk.AccAddress
- func ValidatorByPowerIndexExists(ctx sdk.Context, keeper Keeper, power []byte) bool
- type Claim
- type ClaimStatus
- type Contract
- type Keeper
- func (k Keeper) CreateClaim(ctx sdk.Context, msg MsgCreateClaim) sdk.Error
- func (k Keeper) CreateContract(ctx sdk.Context, msg MsgCreateContract) (sdk.Tags, sdk.Error)
- func (k Keeper) GetContract(ctx sdk.Context, contractID string) *Contract
- func (k Keeper) ProcessClaim(ctx sdk.Context, msg MsgProcessClaim) sdk.Error
- type MsgCreateClaim
- func (msg MsgCreateClaim) Get(key interface{}) (value interface{})
- func (msg MsgCreateClaim) GetSignBytes() []byte
- func (msg MsgCreateClaim) GetSigners() []sdk.AccAddress
- func (msg MsgCreateClaim) String() string
- func (msg MsgCreateClaim) Type() string
- func (msg MsgCreateClaim) ValidateBasic() sdk.Error
- type MsgCreateContract
- type MsgProcessClaim
- func (msg MsgProcessClaim) Get(key interface{}) (value interface{})
- func (msg MsgProcessClaim) GetSignBytes() []byte
- func (msg MsgProcessClaim) GetSigners() []sdk.AccAddress
- func (msg MsgProcessClaim) String() string
- func (msg MsgProcessClaim) Type() string
- func (msg MsgProcessClaim) ValidateBasic() sdk.Error
Constants ¶
View Source
const ( // DefaultCodespace ... DefaultCodespace sdk.CodespaceType = 12 )
Variables ¶
View Source
var ( // Keys for store prefixes ContractKeyPrefix = []byte{0x00} // prefix for each key to a contract AccountContractKey = []byte{0x01} )
nolint
View Source
var MsgCdc *wire.Codec
generic sealed codec to be used throughout sdk
Functions ¶
func GetAccountContractKey ¶ added in v0.9.0
func GetAccountContractKey(addr sdk.AccAddress, contractID string) []byte
func GetAccountContractsKey ¶ added in v0.9.0
func GetAccountContractsKey(addr sdk.AccAddress) []byte
func GetContractKey ¶
func NewPubKey ¶ added in v0.20.0
func NewPubKey(pk string) (res ed25519.PubKeyEd25519)
Types ¶
type Claim ¶
type Claim struct { Status ClaimStatus Recipient sdk.AccAddress // insurance address }
Claim the claim of the contract
type ClaimStatus ¶
type ClaimStatus int
ClaimStatus status of a claim
const ( // The claim is pending ClaimStatusPending ClaimStatus = iota // The claim has been rejected ClaimStatusRejected // The item is up for repair or had been repaired ClaimStatusClaimRepair // The customer should be reimbursed ClaimStatusReimbursement // The theft of the item has been confirmed by authorities ClaimStatusTheftConfirmed )
type Contract ¶
type Contract struct { ID string `json:"id"` Issuer sdk.AccAddress `json:"issuer"` Recipient sdk.AccAddress `json:"recipient"` AssetID string `json:"asset_id"` // the id of asset Serial string `json:"serial"` // the serial of asset Expires time.Time `json:"expires"` Claim *Claim // the claim of contract }
Contract
func (Contract) ValidateClaimProcess ¶
func (c Contract) ValidateClaimProcess(addr sdk.AccAddress, status ClaimStatus) (valid bool)
ValidateClaimProcess ...
func (Contract) ValidateCreateClaim ¶
func (c Contract) ValidateCreateClaim(addr sdk.AccAddress) (valid bool)
CanCreateClaim
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper manages contracts
func (Keeper) CreateClaim ¶
CreateClaim create new a claim
func (Keeper) CreateContract ¶
CreateContract create new a contract
func (Keeper) GetContract ¶
GetContract get contract by ID
func (Keeper) ProcessClaim ¶
ProcessClaim process claim
type MsgCreateClaim ¶
type MsgCreateClaim struct { ContractID string `json:"contract_id"` Issuer sdk.AccAddress `json:"issuer"` Recipient sdk.AccAddress `json:"recipient"` }
MsgCreateClaim msg create claim --------------------------------------------------
func NewMsgCreateClaim ¶
func NewMsgCreateClaim(issuer, recipient sdk.AccAddress, contractID string) MsgCreateClaim
NewMsgCreateClaim new msg create claim
func (MsgCreateClaim) Get ¶
func (msg MsgCreateClaim) Get(key interface{}) (value interface{})
func (MsgCreateClaim) GetSignBytes ¶
func (msg MsgCreateClaim) GetSignBytes() []byte
Implements Msg.
func (MsgCreateClaim) GetSigners ¶
func (msg MsgCreateClaim) GetSigners() []sdk.AccAddress
func (MsgCreateClaim) String ¶
func (msg MsgCreateClaim) String() string
func (MsgCreateClaim) ValidateBasic ¶
func (msg MsgCreateClaim) ValidateBasic() sdk.Error
Implements Msg.
type MsgCreateContract ¶
type MsgCreateContract struct { ID string `json:"id"` Issuer sdk.AccAddress `json:"issuer"` Recipient sdk.AccAddress `json:"recipient"` Expires time.Time `json:"expires"` Serial string `json:"serial"` AssetID string `json:"asset_id"` }
MsgCreateContract --------------------------------------------------
func (MsgCreateContract) Get ¶
func (msg MsgCreateContract) Get(key interface{}) (value interface{})
func (MsgCreateContract) GetSignBytes ¶
func (msg MsgCreateContract) GetSignBytes() []byte
Implements Msg.
func (MsgCreateContract) GetSigners ¶
func (msg MsgCreateContract) GetSigners() []sdk.AccAddress
func (MsgCreateContract) ValidateBasic ¶
func (msg MsgCreateContract) ValidateBasic() sdk.Error
Implements Msg.
type MsgProcessClaim ¶
type MsgProcessClaim struct { ContractID string `json:"contract_id"` Issuer sdk.AccAddress `json:"issuer"` Status ClaimStatus `json:"status"` }
MsgCompleteClaim --------------------------------------------------
func (MsgProcessClaim) Get ¶
func (msg MsgProcessClaim) Get(key interface{}) (value interface{})
func (MsgProcessClaim) GetSignBytes ¶
func (msg MsgProcessClaim) GetSignBytes() []byte
Implements Msg.
func (MsgProcessClaim) GetSigners ¶
func (msg MsgProcessClaim) GetSigners() []sdk.AccAddress
func (MsgProcessClaim) String ¶
func (msg MsgProcessClaim) String() string
func (MsgProcessClaim) ValidateBasic ¶
func (msg MsgProcessClaim) ValidateBasic() sdk.Error
Implements Msg.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.