Documentation
¶
Index ¶
- func CreateCommercialPaperKey(issuer string, paperNumber string) string
- func Deserialize(bytes []byte, cp *CommercialPaper) error
- type CommercialPaper
- func (cp *CommercialPaper) GetSplitKey() []string
- func (cp *CommercialPaper) GetState() State
- func (cp *CommercialPaper) IsIssued() bool
- func (cp *CommercialPaper) IsRedeemed() bool
- func (cp *CommercialPaper) IsTrading() bool
- func (cp CommercialPaper) MarshalJSON() ([]byte, error)
- func (cp *CommercialPaper) Serialize() ([]byte, error)
- func (cp *CommercialPaper) SetIssued()
- func (cp *CommercialPaper) SetRedeemed()
- func (cp *CommercialPaper) SetTrading()
- func (cp *CommercialPaper) UnmarshalJSON(data []byte) error
- type Contract
- func (c *Contract) Buy(ctx TransactionContextInterface, issuer string, paperNumber string, ...) (*CommercialPaper, error)
- func (c *Contract) Instantiate()
- func (c *Contract) Issue(ctx TransactionContextInterface, issuer string, paperNumber string, ...) (*CommercialPaper, error)
- func (c *Contract) Redeem(ctx TransactionContextInterface, issuer string, paperNumber string, ...) (*CommercialPaper, error)
- type ListInterface
- type State
- type TransactionContext
- type TransactionContextInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCommercialPaperKey ¶
CreateCommercialPaperKey creates a key for commercial papers
func Deserialize ¶
func Deserialize(bytes []byte, cp *CommercialPaper) error
Deserialize formats the commercial paper from JSON bytes
Types ¶
type CommercialPaper ¶
type CommercialPaper struct { PaperNumber string `json:"paperNumber"` Issuer string `json:"issuer"` IssueDateTime string `json:"issueDateTime"` FaceValue int `json:"faceValue"` MaturityDateTime string `json:"maturityDateTime"` Owner string `json:"owner"` // contains filtered or unexported fields }
CommercialPaper defines a commercial paper
func (*CommercialPaper) GetSplitKey ¶
func (cp *CommercialPaper) GetSplitKey() []string
GetSplitKey returns values which should be used to form key
func (*CommercialPaper) GetState ¶
func (cp *CommercialPaper) GetState() State
GetState returns the state
func (*CommercialPaper) IsIssued ¶
func (cp *CommercialPaper) IsIssued() bool
IsIssued returns true if state is issued
func (*CommercialPaper) IsRedeemed ¶
func (cp *CommercialPaper) IsRedeemed() bool
IsRedeemed returns true if state is redeemed
func (*CommercialPaper) IsTrading ¶
func (cp *CommercialPaper) IsTrading() bool
IsTrading returns true if state is trading
func (CommercialPaper) MarshalJSON ¶
func (cp CommercialPaper) MarshalJSON() ([]byte, error)
MarshalJSON special handler for managing JSON marshalling
func (*CommercialPaper) Serialize ¶
func (cp *CommercialPaper) Serialize() ([]byte, error)
Serialize formats the commercial paper as JSON bytes
func (*CommercialPaper) SetIssued ¶
func (cp *CommercialPaper) SetIssued()
SetIssued returns the state to issued
func (*CommercialPaper) SetRedeemed ¶
func (cp *CommercialPaper) SetRedeemed()
SetRedeemed sets the state to redeemed
func (*CommercialPaper) SetTrading ¶
func (cp *CommercialPaper) SetTrading()
SetTrading sets the state to trading
func (*CommercialPaper) UnmarshalJSON ¶
func (cp *CommercialPaper) UnmarshalJSON(data []byte) error
UnmarshalJSON special handler for managing JSON marshalling
type Contract ¶
type Contract struct {
contractapi.Contract
}
Contract chaincode that defines the business logic for managing commercial paper
func (*Contract) Buy ¶
func (c *Contract) Buy(ctx TransactionContextInterface, issuer string, paperNumber string, currentOwner string, newOwner string, price int, purchaseDateTime string) (*CommercialPaper, error)
Buy updates a commercial paper to be in trading status and sets the new owner
func (*Contract) Issue ¶
func (c *Contract) Issue(ctx TransactionContextInterface, issuer string, paperNumber string, issueDateTime string, maturityDateTime string, faceValue int) (*CommercialPaper, error)
Issue creates a new commercial paper and stores it in the world state
func (*Contract) Redeem ¶
func (c *Contract) Redeem(ctx TransactionContextInterface, issuer string, paperNumber string, redeemingOwner string, redeenDateTime string) (*CommercialPaper, error)
Redeem updates a commercial paper status to be redeemed
type ListInterface ¶
type ListInterface interface { AddPaper(*CommercialPaper) error GetPaper(string, string) (*CommercialPaper, error) UpdatePaper(*CommercialPaper) error }
ListInterface defines functionality needed to interact with the world state on behalf of a commercial paper
type TransactionContext ¶
type TransactionContext struct { contractapi.TransactionContext // contains filtered or unexported fields }
TransactionContext implementation of TransactionContextInterface for use with commercial paper contract
func (*TransactionContext) GetPaperList ¶
func (tc *TransactionContext) GetPaperList() ListInterface
GetPaperList return paper list
type TransactionContextInterface ¶
type TransactionContextInterface interface { contractapi.TransactionContextInterface GetPaperList() ListInterface }
TransactionContextInterface an interface to describe the minimum required functions for a transaction context in the commercial paper