Documentation
¶
Overview ¶
Package chaincode implements ERC721 for HF9 Vaccination Slots.
Index ¶
- type Approval
- type ApprovalForAll
- type TokenIdGenerator
- type TokenIdGeneratorInterface
- type TradeOffer
- type Transfer
- type VaccinationContract
- func (c *VaccinationContract) AcceptOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
- func (c *VaccinationContract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
- func (c *VaccinationContract) BurnToken(ctx contractapi.TransactionContextInterface, slotUuid string) error
- func (c *VaccinationContract) ClientAccountId(ctx contractapi.TransactionContextInterface) (string, error)
- func (c *VaccinationContract) DeleteOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
- func (c *VaccinationContract) GetApproved(ctx contractapi.TransactionContextInterface, tokenId string) (string, error)
- func (c *VaccinationContract) GetSlots(ctx contractapi.TransactionContextInterface, owner string) (string, error)
- func (c *VaccinationContract) IsApprovedForAll(ctx contractapi.TransactionContextInterface, owner string, operator string) (bool, error)
- func (c *VaccinationContract) IssueSlot(ctx contractapi.TransactionContextInterface, ...) (string, error)
- func (c *VaccinationContract) ListOffers(ctx contractapi.TransactionContextInterface) (string, error)
- func (c *VaccinationContract) MakeOffer(ctx contractapi.TransactionContextInterface, ...) (offerUuid string, err error)
- func (c *VaccinationContract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenId string) (string, error)
- type VaccinationDate
- type VaccinationSlot
- type VaccinationSlotData
- type VaccinationType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalForAll ¶
type TokenIdGenerator ¶ added in v1.0.0
type TokenIdGenerator struct {
}
func (*TokenIdGenerator) HasNext ¶ added in v1.0.0
func (g *TokenIdGenerator) HasNext() bool
func (*TokenIdGenerator) Next ¶ added in v1.0.0
func (g *TokenIdGenerator) Next() string
type TokenIdGeneratorInterface ¶ added in v1.0.0
type TradeOffer ¶
type TradeOffer struct {
Uuid string `json:"uuid"`
Sender string `json:"sender"`
SenderItem string `json:"senderItem"`
Recipient string `json:"recipient"`
RecipientItem string `json:"recipientItem"`
}
TradeOffer represents a trade offer for specific slots of specific identities.
Making an offer:
func (c *VaccinationContract) MakeOffer(ctx contractapi.TransactionContextInterface, mySlotUuid, recipient, recipientSlotUuid string) (offerUuid string, err error)
Accepting an offer:
func (c *VaccinationContract) AcceptOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
Offers are stored in the global state as offer.sender.offerUuid and offer.recipient.offerUuid offer.offerUuid. This way it enables queries by partial key.
type VaccinationContract ¶
type VaccinationContract struct {
contractapi.Contract
IdGenerator TokenIdGeneratorInterface
}
VaccinationContract is a smart contract for managing vaccination slots. Implements ERC-721.
func (*VaccinationContract) AcceptOffer ¶
func (c *VaccinationContract) AcceptOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
func (*VaccinationContract) BalanceOf ¶
func (c *VaccinationContract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
func (*VaccinationContract) BurnToken ¶ added in v1.0.0
func (c *VaccinationContract) BurnToken(ctx contractapi.TransactionContextInterface, slotUuid string) error
func (*VaccinationContract) ClientAccountId ¶
func (c *VaccinationContract) ClientAccountId(ctx contractapi.TransactionContextInterface) (string, error)
func (*VaccinationContract) DeleteOffer ¶ added in v1.0.0
func (c *VaccinationContract) DeleteOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
func (*VaccinationContract) GetApproved ¶
func (c *VaccinationContract) GetApproved(ctx contractapi.TransactionContextInterface, tokenId string) (string, error)
func (*VaccinationContract) GetSlots ¶
func (c *VaccinationContract) GetSlots(ctx contractapi.TransactionContextInterface, owner string) (string, error)
func (*VaccinationContract) IsApprovedForAll ¶
func (c *VaccinationContract) IsApprovedForAll(ctx contractapi.TransactionContextInterface, owner string, operator string) (bool, error)
func (*VaccinationContract) IssueSlot ¶
func (c *VaccinationContract) IssueSlot(ctx contractapi.TransactionContextInterface, vaccine, date, patient, previous string) (string, error)
IssueSlot can be used by doctors to issue vaccination slots to patients.
Vaccine must be one of the values defined VaccinationType enum.
Date format must be 2006-01-02.
func (*VaccinationContract) ListOffers ¶ added in v0.1.1
func (c *VaccinationContract) ListOffers(ctx contractapi.TransactionContextInterface) (string, error)
func (*VaccinationContract) MakeOffer ¶
func (c *VaccinationContract) MakeOffer(ctx contractapi.TransactionContextInterface, mySlotUuid, recipient, recipientSlotUuid string) (offerUuid string, err error)
func (*VaccinationContract) OwnerOf ¶
func (c *VaccinationContract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenId string) (string, error)
type VaccinationDate ¶
VaccinationDate is a simplified date format to identify specific occasions
func (*VaccinationDate) MarshalJSON ¶
func (vd *VaccinationDate) MarshalJSON() ([]byte, error)
MarshalJSON marshals the date into 2006-01-02 format
func (*VaccinationDate) UnmarshalJSON ¶
func (vd *VaccinationDate) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON unmarshals date from 2006-01-02 format
type VaccinationSlot ¶
type VaccinationSlot struct {
VaccinationSlotData
TokenId string `json:"tokenId"`
Owner string `json:"owner"`
Approved string `json:"approved"`
}
VaccinationSlot contains ERC712 related data (this is the NFT)
type VaccinationSlotData ¶
type VaccinationSlotData struct {
// Type of the vaccine.
// May change when the token is transferred.
Type VaccinationType `json:"type"`
// When the vaccine should be administered.
// Never changes.
Date VaccinationDate `json:"date"`
// Previously administered vaccine of the same type.
// If present it may forbid the transfer of the token.
// May change when the token is transferred.
Previous string `json:"previous,omitempty"`
Burned bool `json:"burned,omitempty"`
}
VaccinationSlotData contains information about specific occasion
type VaccinationType ¶
type VaccinationType string
const ( Alpha VaccinationType = "alpha" Bravo VaccinationType = "bravo" Charlie VaccinationType = "charlie" Delta VaccinationType = "delta" Echo VaccinationType = "echo" )
func (*VaccinationType) MarshalJSON ¶
func (vt *VaccinationType) MarshalJSON() ([]byte, error)
func (*VaccinationType) UnmarshalJSON ¶
func (vt *VaccinationType) UnmarshalJSON(data []byte) error