insurance

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

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 GetContractKey(contractID string) []byte

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler ...

func NewPubKey added in v0.20.0

func NewPubKey(pk string) (res ed25519.PubKeyEd25519)

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

func TestAddr added in v0.20.0

func TestAddr(addr string, bech string) sdk.AccAddress

for incode address generation

func ValidatorByPowerIndexExists added in v0.20.0

func ValidatorByPowerIndexExists(ctx sdk.Context, keeper Keeper, power []byte) bool

does a certain by-power index record exist

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 NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *wire.Codec, assetKeeper asset.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.Tags, 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.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) 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.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) 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.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) 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