warranty

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Keys for store prefixes
	ContractKeyPrefix = []byte{0x00} // prefix for each key to a contract
)

nolint

Functions

func GetContractKey

func GetContractKey(contractID string) []byte

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler ...

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type Claim

type Claim struct {
	Status    ClaimStatus
	Recipient sdk.Address // warranty 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.Address `json:"issuer"`
	Recipient sdk.Address `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.Address, status ClaimStatus) (valid bool)

ValidateClaimProcess ...

func (Contract) ValidateCreateClaim

func (c Contract) ValidateCreateClaim(addr sdk.Address) (valid bool)

CanCreateClaim

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper manages contracts

func NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *wire.Codec, bank bank.Keeper) Keeper

NewKeeper returns the keeper

func (Keeper) CreateClaim

func (k Keeper) CreateClaim(ctx sdk.Context, msg MsgCreateClaim) sdk.Error

CreateClaim create new a claim

func (Keeper) CreateContract

func (k Keeper) CreateContract(ctx sdk.Context, msg MsgCreateContract) sdk.Error

CreateContract create new a contract

func (Keeper) GetContract

func (k Keeper) GetContract(ctx sdk.Context, contractID string) *Contract

GetContract get contract by ID

func (Keeper) ProcessClaim

func (k Keeper) ProcessClaim(ctx sdk.Context, msg MsgProcessClaim) sdk.Error

ProcessClaim process claim

type MsgCreateClaim

type MsgCreateClaim struct {
	ContractID string      `json:"contract_id"`
	Issuer     sdk.Address `json:"issuer"`
	Recipient  sdk.Address `json:"recipient"`
}

MsgCreateClaim --------------------------------------------------

func NewMsgCreateClaim

func NewMsgCreateClaim(issuer, recipient sdk.Address, contractID string) MsgCreateClaim

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.Address

func (MsgCreateClaim) String

func (msg MsgCreateClaim) String() string

func (MsgCreateClaim) Type

func (msg MsgCreateClaim) Type() string

nolint ...

func (MsgCreateClaim) ValidateBasic

func (msg MsgCreateClaim) ValidateBasic() sdk.Error

Implements Msg.

type MsgCreateContract

type MsgCreateContract struct {
	ID        string      `json:"id"`
	Issuer    sdk.Address `json:"issuer"`
	Recipient sdk.Address `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.Address

func (MsgCreateContract) String

func (msg MsgCreateContract) String() string

func (MsgCreateContract) Type

func (msg MsgCreateContract) Type() string

nolint ...

func (MsgCreateContract) ValidateBasic

func (msg MsgCreateContract) ValidateBasic() sdk.Error

Implements Msg.

type MsgProcessClaim

type MsgProcessClaim struct {
	ContractID string      `json:"contract_id"`
	Issuer     sdk.Address `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.Address

func (MsgProcessClaim) String

func (msg MsgProcessClaim) String() string

func (MsgProcessClaim) Type

func (msg MsgProcessClaim) Type() string

nolint ...

func (MsgProcessClaim) ValidateBasic

func (msg MsgProcessClaim) ValidateBasic() sdk.Error

Implements Msg.

Directories

Path Synopsis
client

Jump to

Keyboard shortcuts

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