contract

package
v1.4.2-beta3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpecVerInvalid = iota
	SpecVer1       = 1
	SpecVer2       = 2
)
View Source
const PtmkeyDefaultLength = 44

Variables

View Source
var (
	ErrToken            = errors.New("token err")
	ErrUnpackMethod     = errors.New("unpack method err")
	ErrPackMethod       = errors.New("pack method err")
	ErrNotEnoughPledge  = errors.New("not enough pledge")
	ErrCheckParam       = errors.New("check param err")
	ErrSetStorage       = errors.New("set storage err")
	ErrCalcAmount       = errors.New("calc amount err")
	ErrNotEnoughFee     = errors.New("not enough fee")
	ErrGetVerifier      = errors.New("get verifier err")
	ErrAccountInvalid   = errors.New("invalid account")
	ErrAccountNotExist  = errors.New("account not exist")
	ErrGetNodeHeight    = errors.New("get node height err")
	ErrEndHeightInvalid = errors.New("invalid claim end height")
	ErrClaimRepeat      = errors.New("claim reward repeatedly")
	ErrGetRewardHistory = errors.New("get reward history err")
	ErrVerifierNum      = errors.New("verifier num err")
	ErrPledgeNotReady   = errors.New("pledge is not ready")
	ErrGetAdmin         = errors.New("get admin err")
	ErrInvalidAdmin     = errors.New("invalid admin")
	ErrInvalidLen       = errors.New("invalid len")
	ErrInvalidOperator  = errors.New("invalid operator")
)
View Source
var BlackHoleContract = NewChainContract(
	map[string]Contract{
		cabi.MethodNameDestroy: &BlackHole{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer: SpecVer2,
					pending: true,
				},
			},
		},
	},
	cabi.BlackHoleABI,
	cabi.JsonDestroy,
)
View Source
var DoDSettlementContract = NewChainContract(
	map[string]Contract{
		abi.MethodNameDoDSettleCreateOrder: &DoDSettleCreateOrder{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					pending:   true,
				},
			},
		},
		abi.MethodNameDoDSettleUpdateOrderInfo: &DoDSettleUpdateOrderInfo{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					pending:   true,
				},
			},
		},
		abi.MethodNameDoDSettleChangeOrder: &DoDSettleChangeOrder{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					pending:   true,
				},
			},
		},
		abi.MethodNameDoDSettleTerminateOrder: &DoDSettleTerminateOrder{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					pending:   true,
				},
			},
		},
		abi.MethodNameDoDSettleUpdateProductInfo: &DoDSettleUpdateProductInfo{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					pending:   true,
				},
			},
		},
	},
	abi.DoDSettlementABI,
	abi.JsonDoDSettlement,
)
View Source
var KYCContract = NewChainContract(
	map[string]Contract{
		abi.MethodNameKYCAdminHandOver: &KYCAdminHandOver{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
		abi.MethodNameKYCStatusUpdate: &KYCStatusUpdate{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
		abi.MethodNameKYCTradeAddressUpdate: &KYCTradeAddressUpdate{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
		abi.MethodNameKYCOperatorUpdate: &KYCOperatorUpdate{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
	},
	abi.KYCStatusABI,
	abi.JsonKYCStatus,
)
View Source
var (
	MinPledgeAmount = big.NewInt(5 * 1e13) // 50K QLC

)
View Source
var MinerContract = NewChainContract(
	map[string]Contract{
		cabi.MethodNameMinerReward: &MinerReward{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					pending:   true,
					work:      true,
				},
			},
		},
	},
	cabi.MinerABI,
	cabi.JsonMiner,
)
View Source
var MintageContract = NewChainContract(
	map[string]Contract{
		mintage2.MethodNameMintage: &Mintage{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer1,
					signature: true,
					work:      true,
				},
			},
		},
		mintage2.MethodNameMintageWithdraw: &WithdrawMintage{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer1,
					signature: true,
					work:      true,
				},
			},
		},
	},
	mintage2.MintageABI,
	mintage2.JsonMintage,
)
View Source
var Nep5Contract = NewChainContract(
	map[string]Contract{
		cabi.MethodNEP5Pledge: &Nep5Pledge{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer1,
					signature: true,
					work:      true,
				},
			},
		},
		cabi.MethodWithdrawNEP5Pledge: &WithdrawNep5Pledge{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer1,
					signature: true,
					work:      true,
				},
			},
		},
	},
	cabi.NEP5PledgeABI,
	cabi.JsonNEP5Pledge,
)
View Source
var PKDContract = NewChainContract(
	map[string]Contract{
		abi.MethodNamePKDVerifierRegister: &VerifierRegister{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
				},
			},
		},
		abi.MethodNamePKDVerifierUnregister: &VerifierUnregister{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
				},
			},
		},
		abi.MethodNamePKDPublish: &Publish{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					povState:  true,
				},
			},
		},
		abi.MethodNamePKDUnPublish: &UnPublish{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
				},
			},
		},
		abi.MethodNamePKDOracle: &Oracle{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					povState:  true,
				},
			},
		},
		abi.MethodNamePKDReward: &PKDReward{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					pending:   true,
					work:      true,
				},
			},
		},
		abi.MethodNamePKDVerifierHeart: &VerifierHeart{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					povState:  true,
				},
			},
		},
	},
	abi.PublicKeyDistributionABI,
	abi.JsonPublicKeyDistribution,
)
View Source
var PdkvContract = NewChainContract(
	map[string]Contract{
		abi.MethodNamePrivacyDemoKVSet: &PrivacyDemoKVSet{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
				},
			},
		},
	},
	abi.PrivacyDemoKVABI,
	abi.JsonPrivacyDemoKV,
)
View Source
var PermissionContract = NewChainContract(
	map[string]Contract{
		abi.MethodNamePermissionAdminHandOver: &AdminHandOver{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
		abi.MethodNamePermissionNodeUpdate: &NodeUpdate{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
					povState:  true,
				},
			},
		},
	},
	abi.PermissionABI,
	abi.JsonPermission,
)
View Source
var PtmkeyContract = NewChainContract(
	map[string]Contract{
		abi.MethodNamePtmKeyDelete: &PtmKeyDelete{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
				},
			},
		},
		abi.MethodNamePtmKeyUpdate: &PtmKeyUpdate{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					work:      true,
				},
			},
		},
	},
	abi.PtmKeyABI,
	abi.JsonPtmKey,
)

PtmkeyContract contract define

View Source
var RepContract = NewChainContract(
	map[string]Contract{
		cabi.MethodNameRepReward: &RepReward{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer:   SpecVer2,
					signature: true,
					pending:   true,
					work:      true,
				},
			},
		},
	},
	cabi.RepABI,
	cabi.JsonRep,
)
View Source
var RewardsContract = NewChainContract(
	map[string]Contract{
		cabi.MethodNameAirdropRewards: &AirdropRewards{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer: SpecVer1,
					pending: true,
				},
			},
		},
		cabi.MethodNameConfidantRewards: &ConfidantRewards{
			BaseContract: BaseContract{
				Describe: Describe{
					specVer: SpecVer1,
					pending: true,
				},
			},
		},
	},
	cabi.RewardsABI,
	cabi.JsonRewards,
)

Functions

func GetAbiByContractAddress added in v1.3.0

func GetAbiByContractAddress(addr types.Address) (string, error)

func GetChainContractName added in v1.2.0

func GetChainContractName(addr types.Address, methodSelector []byte) (string, bool, error)

func IsChainContract

func IsChainContract(addr types.Address) bool

func NewChainContract added in v1.4.0

func NewChainContract(m map[string]Contract, abi abi.ABIContract, abiJson string) *qlcChainContract

func RegisterContracts added in v1.4.0

func RegisterContracts(addr types.Address, contract *qlcChainContract)

func SetMinMintageTime added in v1.4.0

func SetMinMintageTime(y, m, d, h, i, s int)

SetMinMintageTime only for test

func SetPledgeTime added in v1.4.0

func SetPledgeTime(y, m, d, h, i, s int)

SetPledgeTime only for test

Types

type AdminHandOver added in v1.4.0

type AdminHandOver struct {
	BaseContract
}

func (*AdminHandOver) DoSendOnPov added in v1.4.0

func (a *AdminHandOver) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*AdminHandOver) ProcessSend added in v1.4.0

type AirdropRewards added in v1.4.0

type AirdropRewards struct {
	BaseContract
}

func (*AirdropRewards) DoPending added in v1.4.0

func (ar *AirdropRewards) DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*AirdropRewards) DoReceive added in v1.4.0

func (ar *AirdropRewards) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*AirdropRewards) DoSend added in v1.4.0

func (ar *AirdropRewards) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

func (*AirdropRewards) GetRefundData added in v1.4.0

func (*AirdropRewards) GetRefundData() []byte

func (*AirdropRewards) GetTargetReceiver added in v1.4.0

func (*AirdropRewards) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

type BaseContract added in v1.4.0

type BaseContract struct {
	Describe
}

func (*BaseContract) DoGap added in v1.4.0

func (c *BaseContract) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*BaseContract) DoPending added in v1.4.0

func (c *BaseContract) DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

DoPending generate pending info from send block

func (*BaseContract) DoReceive added in v1.4.0

func (c *BaseContract) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

check status, update state

func (*BaseContract) DoReceiveOnPov added in v1.4.0

func (c *BaseContract) DoReceiveOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock, input *types.StateBlock) error

func (*BaseContract) DoSend added in v1.4.0

func (c *BaseContract) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

ProcessSend verify or update StateBlock.Data

func (*BaseContract) DoSendOnPov added in v1.4.0

func (c *BaseContract) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*BaseContract) GetDescribe added in v1.4.0

func (c *BaseContract) GetDescribe() Describe

func (*BaseContract) GetFee added in v1.4.0

func (c *BaseContract) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)

func (*BaseContract) GetRefundData added in v1.4.0

func (c *BaseContract) GetRefundData() []byte

refund data at receive error

func (*BaseContract) GetTargetReceiver added in v1.4.0

func (c *BaseContract) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*BaseContract) ProcessSend added in v1.4.0

func (c *BaseContract) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

ProcessSend verify or update StateBlock.Data

type BlackHole added in v1.3.0

type BlackHole struct {
	BaseContract
}

func (*BlackHole) DoReceive added in v1.3.0

func (b *BlackHole) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock,
	input *types.StateBlock) ([]*ContractBlock, error)

func (*BlackHole) ProcessSend added in v1.3.0

func (b *BlackHole) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

TODO: save contract data

type ConfidantRewards added in v1.2.0

type ConfidantRewards struct {
	BaseContract
}

func (*ConfidantRewards) DoPending added in v1.2.0

func (*ConfidantRewards) DoReceive added in v1.2.0

func (*ConfidantRewards) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock,
	input *types.StateBlock) ([]*ContractBlock, error)

func (*ConfidantRewards) DoSend added in v1.2.0

func (*ConfidantRewards) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

func (*ConfidantRewards) GetRefundData added in v1.2.0

func (*ConfidantRewards) GetRefundData() []byte

func (*ConfidantRewards) GetTargetReceiver added in v1.4.0

func (*ConfidantRewards) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

type Contract added in v1.4.0

type Contract interface {
	// Contract meta describe
	GetDescribe() Describe
	// Target receiver address
	GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

	GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)
	// check status, update state
	DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)
	// refund data at receive error
	GetRefundData() []byte

	// DoPending generate pending info from send block
	DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)
	// ProcessSend verify or update StateBlock.Data
	DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

	// ProcessSend verify or update StateBlock.Data
	ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)
	DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

	DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error
	DoReceiveOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock, input *types.StateBlock) error
}

func GetChainContract

func GetChainContract(addr types.Address, methodSelector []byte) (Contract, bool, error)

type ContractBlock

type ContractBlock struct {
	VMContext *vmstore.VMContext
	Block     *types.StateBlock
	ToAddress types.Address
	BlockType types.BlockType
	Amount    types.Balance
	Token     types.Hash
	Data      []byte
}

ContractBlock generated by contract

type Describe added in v1.3.0

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

func (Describe) GetVersion added in v1.4.0

func (d Describe) GetVersion() int

func (Describe) WithPending added in v1.3.0

func (d Describe) WithPending() bool

func (Describe) WithPovState added in v1.4.0

func (d Describe) WithPovState() bool

func (Describe) WithSignature added in v1.3.0

func (d Describe) WithSignature() bool

func (Describe) WithWork added in v1.4.0

func (d Describe) WithWork() bool

type DoDSettleChangeOrder added in v1.4.0

type DoDSettleChangeOrder struct {
	BaseContract
}

func (*DoDSettleChangeOrder) DoReceive added in v1.4.0

func (co *DoDSettleChangeOrder) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*DoDSettleChangeOrder) GetTargetReceiver added in v1.4.0

func (co *DoDSettleChangeOrder) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*DoDSettleChangeOrder) ProcessSend added in v1.4.0

type DoDSettleCreateOrder added in v1.4.0

type DoDSettleCreateOrder struct {
	BaseContract
}

func (*DoDSettleCreateOrder) DoReceive added in v1.4.0

func (co *DoDSettleCreateOrder) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*DoDSettleCreateOrder) GetTargetReceiver added in v1.4.0

func (co *DoDSettleCreateOrder) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*DoDSettleCreateOrder) ProcessSend added in v1.4.0

type DoDSettleTerminateOrder added in v1.4.0

type DoDSettleTerminateOrder struct {
	BaseContract
}

func (*DoDSettleTerminateOrder) DoReceive added in v1.4.0

func (to *DoDSettleTerminateOrder) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*DoDSettleTerminateOrder) GetTargetReceiver added in v1.4.0

func (to *DoDSettleTerminateOrder) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*DoDSettleTerminateOrder) ProcessSend added in v1.4.0

type DoDSettleUpdateOrderInfo added in v1.4.0

type DoDSettleUpdateOrderInfo struct {
	BaseContract
}

func (*DoDSettleUpdateOrderInfo) DoGap added in v1.4.0

func (uo *DoDSettleUpdateOrderInfo) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*DoDSettleUpdateOrderInfo) DoReceive added in v1.4.0

func (uo *DoDSettleUpdateOrderInfo) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*DoDSettleUpdateOrderInfo) GetTargetReceiver added in v1.4.0

func (uo *DoDSettleUpdateOrderInfo) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*DoDSettleUpdateOrderInfo) ProcessSend added in v1.4.0

type DoDSettleUpdateProductInfo added in v1.4.0

type DoDSettleUpdateProductInfo struct {
	BaseContract
}

func (*DoDSettleUpdateProductInfo) DoGap added in v1.4.0

func (up *DoDSettleUpdateProductInfo) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*DoDSettleUpdateProductInfo) ProcessSend added in v1.4.0

type KYCAdminHandOver added in v1.4.1

type KYCAdminHandOver struct {
	BaseContract
}

func (*KYCAdminHandOver) DoSendOnPov added in v1.4.1

func (a *KYCAdminHandOver) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*KYCAdminHandOver) ProcessSend added in v1.4.1

type KYCOperatorUpdate added in v1.4.1

type KYCOperatorUpdate struct {
	BaseContract
}

func (*KYCOperatorUpdate) DoSendOnPov added in v1.4.1

func (a *KYCOperatorUpdate) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*KYCOperatorUpdate) ProcessSend added in v1.4.1

func (*KYCOperatorUpdate) VerifyParam added in v1.4.1

func (a *KYCOperatorUpdate) VerifyParam(ctx *vmstore.VMContext, oa *abi.KYCOperatorAccount) error

type KYCStatusUpdate added in v1.4.1

type KYCStatusUpdate struct {
	BaseContract
}

func (*KYCStatusUpdate) DoSendOnPov added in v1.4.1

func (n *KYCStatusUpdate) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*KYCStatusUpdate) ProcessSend added in v1.4.1

func (*KYCStatusUpdate) VerifyParam added in v1.4.1

func (n *KYCStatusUpdate) VerifyParam(ctx *vmstore.VMContext, status *abi.KYCStatus) error

type KYCTradeAddressUpdate added in v1.4.1

type KYCTradeAddressUpdate struct {
	BaseContract
}

func (*KYCTradeAddressUpdate) DoSendOnPov added in v1.4.1

func (n *KYCTradeAddressUpdate) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*KYCTradeAddressUpdate) ProcessSend added in v1.4.1

func (*KYCTradeAddressUpdate) VerifyParam added in v1.4.1

func (n *KYCTradeAddressUpdate) VerifyParam(ctx *vmstore.VMContext, ka *abi.KYCAddress) error

type MinerReward added in v1.2.3

type MinerReward struct {
	BaseContract
}

func (*MinerReward) DoGap added in v1.4.0

func (m *MinerReward) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*MinerReward) DoReceive added in v1.2.3

func (m *MinerReward) DoReceive(ctx *vmstore.VMContext, block, input *types.StateBlock) ([]*ContractBlock, error)

func (*MinerReward) GetAvailRewardInfo added in v1.2.3

func (m *MinerReward) GetAvailRewardInfo(ctx *vmstore.VMContext, coinbase types.Address, nodeHeight uint64, lastRewardHeight uint64) (*cabi.MinerRewardInfo, error)

func (*MinerReward) GetLastRewardHeight added in v1.3.0

func (m *MinerReward) GetLastRewardHeight(ctx *vmstore.VMContext, coinbase types.Address) (uint64, error)

func (*MinerReward) GetNodeRewardHeight added in v1.2.3

func (m *MinerReward) GetNodeRewardHeight(ctx *vmstore.VMContext) (uint64, error)

func (*MinerReward) GetRewardHistory added in v1.3.0

func (m *MinerReward) GetRewardHistory(ctx *vmstore.VMContext, coinbase types.Address) (*cabi.MinerRewardInfo, error)

func (*MinerReward) GetTargetReceiver added in v1.4.0

func (m *MinerReward) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*MinerReward) ProcessSend added in v1.3.0

func (m *MinerReward) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*MinerReward) SetStorage added in v1.3.1

func (m *MinerReward) SetStorage(ctx *vmstore.VMContext, endHeight uint64, RewardAmount *big.Int, RewardBlocks uint64, block *types.StateBlock) error

type Mintage

type Mintage struct {
	BaseContract
}

func (*Mintage) DoPending added in v1.2.0

func (m *Mintage) DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*Mintage) DoReceive

func (m *Mintage) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*Mintage) DoSend

func (m *Mintage) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

func (*Mintage) GetTargetReceiver added in v1.4.0

func (m *Mintage) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

type Nep5Pledge added in v1.1.0

type Nep5Pledge struct {
	BaseContract
}

func (*Nep5Pledge) DoPending added in v1.2.0

func (*Nep5Pledge) DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*Nep5Pledge) DoReceive added in v1.1.0

func (*Nep5Pledge) DoReceive(ctx *vmstore.VMContext, block, input *types.StateBlock) ([]*ContractBlock, error)

func (*Nep5Pledge) DoSend added in v1.1.0

func (*Nep5Pledge) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

check pledge chain coin - address is normal user address - small than min pledge amount transfer quota to beneficial address

func (*Nep5Pledge) GetRefundData added in v1.1.0

func (*Nep5Pledge) GetRefundData() []byte

func (*Nep5Pledge) GetTargetReceiver added in v1.4.0

func (*Nep5Pledge) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

type NodeUpdate added in v1.4.0

type NodeUpdate struct {
	BaseContract
}

func (*NodeUpdate) DoSendOnPov added in v1.4.0

func (n *NodeUpdate) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*NodeUpdate) ProcessSend added in v1.4.0

func (n *NodeUpdate) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*NodeUpdate) VerifyParam added in v1.4.0

func (n *NodeUpdate) VerifyParam(ctx *vmstore.VMContext, pn *abi.PermNode) error

type Oracle added in v1.4.0

type Oracle struct {
	BaseContract
}

func (*Oracle) DoGap added in v1.4.0

func (o *Oracle) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*Oracle) DoSendOnPov added in v1.4.0

func (o *Oracle) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*Oracle) ProcessSend added in v1.4.0

func (o *Oracle) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*Oracle) SetStorage added in v1.4.0

func (o *Oracle) SetStorage(ctx *vmstore.VMContext, account types.Address, ot uint32, id types.Hash, kt uint16, pk []byte, code string, hash types.Hash) error

type PKDReward added in v1.4.0

type PKDReward struct {
	BaseContract
}

func (*PKDReward) DoGap added in v1.4.0

func (r *PKDReward) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*PKDReward) DoReceive added in v1.4.0

func (r *PKDReward) DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*PKDReward) GetRewardInfo added in v1.4.0

func (r *PKDReward) GetRewardInfo(ctx *vmstore.VMContext, address types.Address) (*dpki.PKDRewardInfo, error)

func (*PKDReward) GetTargetReceiver added in v1.4.0

func (r *PKDReward) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*PKDReward) GetVerifierState added in v1.4.0

func (r *PKDReward) GetVerifierState(ctx *vmstore.VMContext, povHeight uint64, address types.Address) (*types.PovVerifierState, error)

func (*PKDReward) ProcessSend added in v1.4.0

func (r *PKDReward) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*PKDReward) SetRewardInfo added in v1.4.0

func (r *PKDReward) SetRewardInfo(ctx *vmstore.VMContext, address types.Address, rwdInfo *dpki.PKDRewardInfo) error

type PrivacyDemoKVSet added in v1.4.0

type PrivacyDemoKVSet struct {
	BaseContract
}

func (*PrivacyDemoKVSet) ProcessSend added in v1.4.0

type PtmKeyDelete added in v1.4.0

type PtmKeyDelete struct {
	BaseContract
}

func (*PtmKeyDelete) ProcessSend added in v1.4.0

func (pkd *PtmKeyDelete) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*PtmKeyDelete) SetStorage added in v1.4.0

func (pkd *PtmKeyDelete) SetStorage(ctx *vmstore.VMContext, account types.Address, vBtype uint16, vKey []byte) error

type PtmKeyUpdate added in v1.4.0

type PtmKeyUpdate struct {
	BaseContract
}

func (*PtmKeyUpdate) ProcessSend added in v1.4.0

func (pku *PtmKeyUpdate) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*PtmKeyUpdate) SetStorage added in v1.4.0

func (pku *PtmKeyUpdate) SetStorage(ctx *vmstore.VMContext, account types.Address, vBtype uint16, vKey []byte) error

type Publish added in v1.4.0

type Publish struct {
	BaseContract
}

func (*Publish) DoSendOnPov added in v1.4.0

func (p *Publish) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*Publish) ProcessSend added in v1.4.0

func (p *Publish) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*Publish) SetStorage added in v1.4.0

func (p *Publish) SetStorage(ctx *vmstore.VMContext, account types.Address, pt uint32, id types.Hash, kt uint16,
	pk []byte, vs []types.Address, cs []types.Hash, fee types.Balance, hash types.Hash) error

type RepReward added in v1.3.0

type RepReward struct {
	BaseContract
}

func (*RepReward) DoGap added in v1.4.0

func (r *RepReward) DoGap(ctx *vmstore.VMContext, block *types.StateBlock) (common.ContractGapType, interface{}, error)

func (*RepReward) DoReceive added in v1.3.0

func (r *RepReward) DoReceive(ctx *vmstore.VMContext, block, input *types.StateBlock) ([]*ContractBlock, error)

func (*RepReward) GetAvailRewardInfo added in v1.3.0

func (r *RepReward) GetAvailRewardInfo(ctx *vmstore.VMContext, account types.Address, nodeHeight uint64, lastRewardHeight uint64) (*cabi.RepRewardInfo, error)

func (*RepReward) GetLastRewardHeight added in v1.3.0

func (r *RepReward) GetLastRewardHeight(ctx *vmstore.VMContext, account types.Address) (uint64, error)

func (*RepReward) GetNodeRewardHeight added in v1.3.0

func (r *RepReward) GetNodeRewardHeight(ctx *vmstore.VMContext) (uint64, error)

func (*RepReward) GetRewardHistory added in v1.3.0

func (r *RepReward) GetRewardHistory(ctx *vmstore.VMContext, account types.Address) (*cabi.RepRewardInfo, error)

func (*RepReward) GetTargetReceiver added in v1.4.0

func (r *RepReward) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

func (*RepReward) ProcessSend added in v1.3.0

func (r *RepReward) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*RepReward) SetStorage added in v1.3.1

func (r *RepReward) SetStorage(ctx *vmstore.VMContext, endHeight uint64, RewardAmount *big.Int, RewardBlocks uint64, block *types.StateBlock) error

type UnPublish added in v1.4.0

type UnPublish struct {
	BaseContract
}

func (*UnPublish) ProcessSend added in v1.4.0

func (up *UnPublish) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

func (*UnPublish) SetStorage added in v1.4.0

func (up *UnPublish) SetStorage(ctx *vmstore.VMContext, pt uint32, id types.Hash, kt uint16, pk []byte, hash types.Hash) error

type VerifierHeart added in v1.4.0

type VerifierHeart struct {
	BaseContract
}

func (*VerifierHeart) DoSendOnPov added in v1.4.0

func (vh *VerifierHeart) DoSendOnPov(ctx *vmstore.VMContext, csdb *statedb.PovContractStateDB, povHeight uint64, block *types.StateBlock) error

func (*VerifierHeart) ProcessSend added in v1.4.0

func (vh *VerifierHeart) ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)

type VerifierRegister added in v1.4.0

type VerifierRegister struct {
	BaseContract
}

func (*VerifierRegister) ProcessSend added in v1.4.0

func (*VerifierRegister) SetStorage added in v1.4.0

func (vr *VerifierRegister) SetStorage(ctx *vmstore.VMContext, account types.Address, vType uint32, vInfo string, vKey []byte) error

type VerifierUnregister added in v1.4.0

type VerifierUnregister struct {
	BaseContract
}

func (*VerifierUnregister) ProcessSend added in v1.4.0

func (*VerifierUnregister) SetStorage added in v1.4.0

func (vu *VerifierUnregister) SetStorage(ctx *vmstore.VMContext, account types.Address, vType uint32, vInfo string, vKey []byte) error

type WithdrawMintage

type WithdrawMintage struct {
	BaseContract
}

func (*WithdrawMintage) DoPending added in v1.2.0

func (*WithdrawMintage) DoReceive

func (m *WithdrawMintage) DoReceive(ctx *vmstore.VMContext, block, input *types.StateBlock) ([]*ContractBlock, error)

func (*WithdrawMintage) DoSend

func (m *WithdrawMintage) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

type WithdrawNep5Pledge added in v1.1.0

type WithdrawNep5Pledge struct {
	BaseContract
}

func (*WithdrawNep5Pledge) DoPending added in v1.2.0

func (*WithdrawNep5Pledge) DoReceive added in v1.1.0

func (*WithdrawNep5Pledge) DoReceive(ctx *vmstore.VMContext, block, input *types.StateBlock) ([]*ContractBlock, error)

func (*WithdrawNep5Pledge) DoSend added in v1.1.0

func (*WithdrawNep5Pledge) DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error

func (*WithdrawNep5Pledge) GetRefundData added in v1.1.0

func (*WithdrawNep5Pledge) GetRefundData() []byte

func (*WithdrawNep5Pledge) GetTargetReceiver added in v1.4.0

func (*WithdrawNep5Pledge) GetTargetReceiver(ctx *vmstore.VMContext, block *types.StateBlock) (types.Address, error)

Directories

Path Synopsis
abi

Jump to

Keyboard shortcuts

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