donatewithfeedback

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

DonateWithFeedback is a smart contract which handles donation account and log of feedback messages sent together with the donations

Index

Constants

View Source
const (
	// code of the 'donate' request
	RequestDonate = sctransaction.RequestCode(uint16(1))
	// code of the 'withdraw' request. It is protected (checks authorisation at the protocol level)
	RequestWithdraw = sctransaction.RequestCode(uint16(2) | sctransaction.RequestCodeProtected)

	// state vars
	// name of the feedback message log
	VarStateTheLog = "l"
	// largest donation so far
	VarStateMaxDonation = "maxd"
	// total donation so far
	VarStateTotalDonations = "total"

	// request arguments
	// variable containing feedback text
	VarReqFeedback = "f"
	// sum to withdraw with the 'withdraw' request
	VarReqWithdrawSum = "s"
)

main external constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DonationInfo

type DonationInfo struct {
	Seq      int64
	Id       *sctransaction.RequestId
	When     time.Time // not marshaled, filled in from timestamp
	Amount   int64
	Sender   address.Address
	Feedback string // max 16 bit length
	Error    string
}

DonationInfo is a structure which contains one donation it is marshalled to the deterministic binary form and saves as one entry in the state

func DonationInfoFromBytes

func DonationInfoFromBytes(data []byte) (*DonationInfo, error)

func (*DonationInfo) Bytes

func (di *DonationInfo) Bytes() []byte

func (*DonationInfo) Read

func (di *DonationInfo) Read(r io.Reader) error

func (*DonationInfo) Write

func (di *DonationInfo) Write(w io.Writer) error

Directories

Path Synopsis
hard coded smart contract code implements DonateWithFeedback
hard coded smart contract code implements DonateWithFeedback

Jump to

Keyboard shortcuts

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