Documentation
¶
Overview ¶
Package chaincode implements ERC721 for HF9 Vaccination Slots.
Index ¶
- type Approval
- type ApprovalForAll
- type TradeOffer
- type Transfer
- type VaccinationContract
- func (c *VaccinationContract) AcceptOffer(ctx contractapi.TransactionContextInterface, offerUuid string) error
- func (c *VaccinationContract) Approve(ctx contractapi.TransactionContextInterface, operator string, tokenId string) (bool, error)
- func (c *VaccinationContract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
- func (c *VaccinationContract) ClientAccountId(ctx contractapi.TransactionContextInterface) (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, vaccine, date, patient string) (string, error)
- func (c *VaccinationContract) MakeOffer(ctx contractapi.TransactionContextInterface, ...) (offerUuid string, err error)
- func (c *VaccinationContract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenId string) (string, error)
- func (c *VaccinationContract) SetApprovalForAll(ctx contractapi.TransactionContextInterface, operator string, approved bool) (bool, error)
- func (c *VaccinationContract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, ...) (bool, 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 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. This way it enables queries by partial key.
type VaccinationContract ¶
type VaccinationContract struct {
contractapi.Contract
}
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) Approve ¶
func (c *VaccinationContract) Approve(ctx contractapi.TransactionContextInterface, operator string, tokenId string) (bool, error)
func (*VaccinationContract) BalanceOf ¶
func (c *VaccinationContract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
func (*VaccinationContract) ClientAccountId ¶
func (c *VaccinationContract) ClientAccountId(ctx contractapi.TransactionContextInterface) (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 string) (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)
func (*VaccinationContract) SetApprovalForAll ¶
func (c *VaccinationContract) SetApprovalForAll(ctx contractapi.TransactionContextInterface, operator string, approved bool) (bool, error)
func (*VaccinationContract) TransferFrom ¶
func (c *VaccinationContract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, tokenId string) (bool, 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"` }
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