contract

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

)

Functions

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 {
}

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 ChainContract

type ChainContract interface {
	GetFee(ctx *vmstore.VMContext, block *types.StateBlock) (types.Balance, error)
	// DoSend verify or update StateBlock.Data
	DoSend(ctx *vmstore.VMContext, block *types.StateBlock) error
	// DoPending generate pending info from send block
	DoPending(block *types.StateBlock) (*types.PendingKey, *types.PendingInfo, error)
	// check status, update state
	DoReceive(ctx *vmstore.VMContext, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)
	// refund data at receive error
	GetRefundData() []byte
}

func GetChainContract

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

type ConfidantRewards added in v1.2.0

type ConfidantRewards struct {
}

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 MinerReward added in v1.2.3

type MinerReward struct{}

func (*MinerReward) DoPending added in v1.2.3

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

func (*MinerReward) DoReceive added in v1.2.3

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

func (*MinerReward) DoSend added in v1.2.3

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

func (*MinerReward) GetAllRewardInfos added in v1.2.3

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

func (*MinerReward) GetAvailRewardInfo added in v1.2.3

func (m *MinerReward) GetAvailRewardInfo(ctx *vmstore.VMContext, coinbase types.Address) (*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) GetMaxRewardInfo added in v1.2.3

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

type Mintage

type Mintage struct{}

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 {
}

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 WithdrawMintage

type WithdrawMintage struct{}

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 {
}

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