contract

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: MIT, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinPledgeAmount = big.NewInt(5 * 1e13) // 50K QLC

)

Functions

func GetAbiByContractAddress added in v1.3.0

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

func GetChainContract

func GetChainContract(addr types.Address, methodSelector []byte) (interface{}, bool, 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

Types

type AirdropRewords added in v1.2.0

type AirdropRewords struct {
	NoSignWithPending
}

func (*AirdropRewords) DoPending added in v1.2.0

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

func (*AirdropRewords) DoReceive added in v1.2.0

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

func (*AirdropRewords) DoSend added in v1.2.0

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

func (*AirdropRewords) GetFee added in v1.2.0

func (ar *AirdropRewords) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)

func (*AirdropRewords) GetRefundData added in v1.2.0

func (*AirdropRewords) GetRefundData() []byte

type BlackHole added in v1.3.0

type BlackHole struct {
	NoSignWithPending
}

func (*BlackHole) DoGapPov added in v1.3.0

func (b *BlackHole) DoGapPov(ctx *vmstore.VMContext, block *types.StateBlock) (uint64, error)

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) GetFee added in v1.3.0

func (b *BlackHole) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)

func (*BlackHole) GetRefundData added in v1.3.0

func (b *BlackHole) GetRefundData() []byte

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 ChainContractV1 added in v1.3.0

type ChainContractV1 interface {
	InternalContract
	// 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
}

type ChainContractV2 added in v1.3.0

type ChainContractV2 interface {
	InternalContract
	// ProcessSend verify or update StateBlock.Data
	ProcessSend(ctx *vmstore.VMContext, block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)
	DoGapPov(ctx *vmstore.VMContext, block *types.StateBlock) (uint64, error)
}

type ConfidantRewards added in v1.2.0

type ConfidantRewards struct {
	NoSignWithPending
}

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) GetFee added in v1.2.0

func (*ConfidantRewards) GetRefundData added in v1.2.0

func (*ConfidantRewards) GetRefundData() []byte

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) WithPending added in v1.3.0

func (d Describe) WithPending() bool

func (Describe) WithSignature added in v1.3.0

func (d Describe) WithSignature() bool

type InternalContract added in v1.3.0

type InternalContract interface {
	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
	GetDescribe() Describe
}

type MinerReward added in v1.2.3

type MinerReward struct {
	WithSignAndPending
}

func (*MinerReward) DoGapPov added in v1.3.0

func (m *MinerReward) DoGapPov(ctx *vmstore.VMContext, block *types.StateBlock) (uint64, 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) GetFee added in v1.2.3

func (m *MinerReward) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, 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) GetRefundData added in v1.2.3

func (m *MinerReward) GetRefundData() []byte

func (*MinerReward) GetRewardHistory added in v1.3.0

func (m *MinerReward) GetRewardHistory(ctx *vmstore.VMContext, coinbase types.Address) (*cabi.MinerRewardInfo, 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 {
	WithSignNoPending
}

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)

TODO: verify input block timestamp

func (*Mintage) DoSend

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

func (*Mintage) GetFee

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

func (*Mintage) GetRefundData

func (m *Mintage) GetRefundData() []byte

type Nep5Pledge added in v1.1.0

type Nep5Pledge struct {
	WithSignNoPending
}

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) GetFee added in v1.1.0

func (p *Nep5Pledge) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)

func (*Nep5Pledge) GetRefundData added in v1.1.0

func (*Nep5Pledge) GetRefundData() []byte

type NoSignWithPending added in v1.3.0

type NoSignWithPending struct {
}

func (NoSignWithPending) GetDescribe added in v1.3.0

func (NoSignWithPending) GetDescribe() Describe

type RepReward added in v1.3.0

type RepReward struct {
	WithSignAndPending
}

func (*RepReward) DoGapPov added in v1.3.0

func (r *RepReward) DoGapPov(ctx *vmstore.VMContext, block *types.StateBlock) (uint64, 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) GetFee added in v1.3.0

func (r *RepReward) GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, 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) GetRefundData added in v1.3.0

func (r *RepReward) GetRefundData() []byte

func (*RepReward) GetRewardHistory added in v1.3.0

func (r *RepReward) GetRewardHistory(ctx *vmstore.VMContext, account types.Address) (*cabi.RepRewardInfo, 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 WithSignAndPending added in v1.3.0

type WithSignAndPending struct {
}

func (WithSignAndPending) GetDescribe added in v1.3.0

func (WithSignAndPending) GetDescribe() Describe

type WithSignNoPending added in v1.3.0

type WithSignNoPending struct {
}

func (WithSignNoPending) GetDescribe added in v1.3.0

func (WithSignNoPending) GetDescribe() Describe

type WithdrawMintage

type WithdrawMintage struct {
	WithSignNoPending
}

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

func (*WithdrawMintage) GetFee

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

func (*WithdrawMintage) GetRefundData

func (m *WithdrawMintage) GetRefundData() []byte

type WithdrawNep5Pledge added in v1.1.0

type WithdrawNep5Pledge struct {
	WithSignNoPending
}

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) (err error)

func (*WithdrawNep5Pledge) GetFee added in v1.1.0

func (*WithdrawNep5Pledge) GetRefundData added in v1.1.0

func (*WithdrawNep5Pledge) GetRefundData() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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