donatewithfeedback

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0, BSD-2-Clause, Apache-2.0, + 1 more Imports: 1 Imported by: 0

README

donatewithfeedback

Sample smart contract

Allows for donations and registers feedback associated with the donation.
The contract owner can at any point decide to withdraw donated funds
from the contract.

Documentation

Index

Constants

View Source
const (
	ScName  = "donatewithfeedback"
	HScName = wasmlib.ScHname(0x696d7f66)
)
View Source
const (
	ParamAmount   = wasmlib.Key("amount")
	ParamFeedback = wasmlib.Key("feedback")
	ParamNr       = wasmlib.Key("nr")
)
View Source
const (
	ResultAmount        = wasmlib.Key("amount")
	ResultCount         = wasmlib.Key("count")
	ResultDonator       = wasmlib.Key("donator")
	ResultError         = wasmlib.Key("error")
	ResultFeedback      = wasmlib.Key("feedback")
	ResultMaxDonation   = wasmlib.Key("maxDonation")
	ResultTimestamp     = wasmlib.Key("timestamp")
	ResultTotalDonation = wasmlib.Key("totalDonation")
)
View Source
const (
	StateLog           = wasmlib.Key("log")
	StateMaxDonation   = wasmlib.Key("maxDonation")
	StateTotalDonation = wasmlib.Key("totalDonation")
)
View Source
const (
	FuncDonate       = "donate"
	FuncWithdraw     = "withdraw"
	ViewDonation     = "donation"
	ViewDonationInfo = "donationInfo"
)
View Source
const (
	HFuncDonate       = wasmlib.ScHname(0xdc9b133a)
	HFuncWithdraw     = wasmlib.ScHname(0x9dcc0f41)
	HViewDonation     = wasmlib.ScHname(0xbdb245ba)
	HViewDonationInfo = wasmlib.ScHname(0xc8f7c726)
)
View Source
const (
	IdxParamAmount         = 0
	IdxParamFeedback       = 1
	IdxParamNr             = 2
	IdxResultAmount        = 3
	IdxResultCount         = 4
	IdxResultDonator       = 5
	IdxResultError         = 6
	IdxResultFeedback      = 7
	IdxResultMaxDonation   = 8
	IdxResultTimestamp     = 9
	IdxResultTotalDonation = 10
	IdxStateLog            = 11
	IdxStateMaxDonation    = 12
	IdxStateTotalDonation  = 13
)

Variables

This section is empty.

Functions

func OnLoad

func OnLoad()

Types

type ArrayOfImmutableDonation

type ArrayOfImmutableDonation struct {
	// contains filtered or unexported fields
}

func (ArrayOfImmutableDonation) GetDonation

func (a ArrayOfImmutableDonation) GetDonation(index int32) ImmutableDonation

func (ArrayOfImmutableDonation) Length

func (a ArrayOfImmutableDonation) Length() int32

type ArrayOfMutableDonation

type ArrayOfMutableDonation struct {
	// contains filtered or unexported fields
}

func (ArrayOfMutableDonation) Clear

func (a ArrayOfMutableDonation) Clear()

func (ArrayOfMutableDonation) GetDonation

func (a ArrayOfMutableDonation) GetDonation(index int32) MutableDonation

func (ArrayOfMutableDonation) Length

func (a ArrayOfMutableDonation) Length() int32

type DonateCall

type DonateCall struct {
	Func   *wasmlib.ScFunc
	Params MutableDonateParams
}

type DonateContext

type DonateContext struct {
	Params ImmutableDonateParams
	State  MutableDonateWithFeedbackState
}

type Donation

type Donation struct {
	Amount    int64             // amount donated
	Donator   wasmlib.ScAgentID // who donated
	Error     string            // error to be reported to donator if anything goes wrong
	Feedback  string            // the feedback for the person donated to
	Timestamp int64             // when the donation took place
}

func NewDonationFromBytes

func NewDonationFromBytes(bytes []byte) *Donation

func (*Donation) Bytes

func (o *Donation) Bytes() []byte

type DonationCall

type DonationCall struct {
	Func    *wasmlib.ScView
	Params  MutableDonationParams
	Results ImmutableDonationResults
}

type DonationContext

type DonationContext struct {
	Params  ImmutableDonationParams
	Results MutableDonationResults
	State   ImmutableDonateWithFeedbackState
}

type DonationInfoCall

type DonationInfoCall struct {
	Func    *wasmlib.ScView
	Results ImmutableDonationInfoResults
}

type DonationInfoContext

type DonationInfoContext struct {
	Results MutableDonationInfoResults
	State   ImmutableDonateWithFeedbackState
}

type Funcs

type Funcs struct{}
var ScFuncs Funcs

func (Funcs) Donate

func (sc Funcs) Donate(ctx wasmlib.ScFuncCallContext) *DonateCall

func (Funcs) Donation

func (sc Funcs) Donation(ctx wasmlib.ScViewCallContext) *DonationCall

func (Funcs) DonationInfo

func (sc Funcs) DonationInfo(ctx wasmlib.ScViewCallContext) *DonationInfoCall

func (Funcs) Withdraw

func (sc Funcs) Withdraw(ctx wasmlib.ScFuncCallContext) *WithdrawCall

type ImmutableDonateParams

type ImmutableDonateParams struct {
	// contains filtered or unexported fields
}

func (ImmutableDonateParams) Feedback

type ImmutableDonateWithFeedbackState

type ImmutableDonateWithFeedbackState struct {
	// contains filtered or unexported fields
}

func (ImmutableDonateWithFeedbackState) Log

func (ImmutableDonateWithFeedbackState) MaxDonation

func (ImmutableDonateWithFeedbackState) TotalDonation

type ImmutableDonation

type ImmutableDonation struct {
	// contains filtered or unexported fields
}

func (ImmutableDonation) Exists

func (o ImmutableDonation) Exists() bool

func (ImmutableDonation) Value

func (o ImmutableDonation) Value() *Donation

type ImmutableDonationInfoResults

type ImmutableDonationInfoResults struct {
	// contains filtered or unexported fields
}

func (ImmutableDonationInfoResults) Count

func (ImmutableDonationInfoResults) MaxDonation

func (ImmutableDonationInfoResults) TotalDonation

type ImmutableDonationParams

type ImmutableDonationParams struct {
	// contains filtered or unexported fields
}

func (ImmutableDonationParams) Nr

type ImmutableDonationResults

type ImmutableDonationResults struct {
	// contains filtered or unexported fields
}

func (ImmutableDonationResults) Amount

func (ImmutableDonationResults) Donator

func (ImmutableDonationResults) Error

func (ImmutableDonationResults) Feedback

func (ImmutableDonationResults) Timestamp

type ImmutableWithdrawParams

type ImmutableWithdrawParams struct {
	// contains filtered or unexported fields
}

func (ImmutableWithdrawParams) Amount

type MutableDonateParams

type MutableDonateParams struct {
	// contains filtered or unexported fields
}

func (MutableDonateParams) Feedback

type MutableDonateWithFeedbackState

type MutableDonateWithFeedbackState struct {
	// contains filtered or unexported fields
}

func (MutableDonateWithFeedbackState) Log

func (MutableDonateWithFeedbackState) MaxDonation

func (MutableDonateWithFeedbackState) TotalDonation

type MutableDonation

type MutableDonation struct {
	// contains filtered or unexported fields
}

func (MutableDonation) Exists

func (o MutableDonation) Exists() bool

func (MutableDonation) SetValue

func (o MutableDonation) SetValue(value *Donation)

func (MutableDonation) Value

func (o MutableDonation) Value() *Donation

type MutableDonationInfoResults

type MutableDonationInfoResults struct {
	// contains filtered or unexported fields
}

func (MutableDonationInfoResults) Count

func (MutableDonationInfoResults) MaxDonation

func (MutableDonationInfoResults) TotalDonation

type MutableDonationParams

type MutableDonationParams struct {
	// contains filtered or unexported fields
}

func (MutableDonationParams) Nr

type MutableDonationResults

type MutableDonationResults struct {
	// contains filtered or unexported fields
}

func (MutableDonationResults) Amount

func (MutableDonationResults) Donator

func (MutableDonationResults) Error

func (MutableDonationResults) Feedback

func (MutableDonationResults) Timestamp

type MutableWithdrawParams

type MutableWithdrawParams struct {
	// contains filtered or unexported fields
}

func (MutableWithdrawParams) Amount

type WithdrawCall

type WithdrawCall struct {
	Func   *wasmlib.ScFunc
	Params MutableWithdrawParams
}

type WithdrawContext

type WithdrawContext struct {
	Params ImmutableWithdrawParams
	State  MutableDonateWithFeedbackState
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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