contract

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinPledgeAmount = big.NewInt(1e12) // 10K QLC

)

Functions

func IsChainContract

func IsChainContract(addr types.Address) bool

Types

type ChainContract

type ChainContract interface {
	GetFee(ledger *ledger.Ledger, block *types.StateBlock) (types.Balance, error)
	// DoSend verify or update StateBlock.Data
	DoSend(ledger *ledger.Ledger, block *types.StateBlock) error
	// check status, update state
	DoReceive(ledger *ledger.Ledger, 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 ContractBlock

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

ContractBlock generated by contract

type Mintage

type Mintage struct{}

func (*Mintage) DoReceive

func (m *Mintage) DoReceive(ledger *l.Ledger, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

TODO: verify input block timestamp

func (*Mintage) DoSend

func (m *Mintage) DoSend(l *l.Ledger, block *types.StateBlock) error

func (*Mintage) GetFee

func (m *Mintage) GetFee(ledger *l.Ledger, block *types.StateBlock) (types.Balance, error)

TODO: implement

func (*Mintage) GetRefundData

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

type VotePledge added in v1.0.3

type VotePledge struct {
}

func (*VotePledge) DoReceive added in v1.0.3

func (*VotePledge) DoReceive(ledger *ledger.Ledger, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*VotePledge) DoSend added in v1.0.3

func (*VotePledge) DoSend(l *ledger.Ledger, block *types.StateBlock) error

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

func (*VotePledge) GetFee added in v1.0.3

func (p *VotePledge) GetFee(l *ledger.Ledger, block *types.StateBlock) (types.Balance, error)

func (*VotePledge) GetRefundData added in v1.0.3

func (*VotePledge) GetRefundData() []byte

type WithdrawMintage

type WithdrawMintage struct{}

func (*WithdrawMintage) DoReceive

func (m *WithdrawMintage) DoReceive(ledger *l.Ledger, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*WithdrawMintage) DoSend

func (m *WithdrawMintage) DoSend(ledger *l.Ledger, block *types.StateBlock) error

func (*WithdrawMintage) GetFee

func (m *WithdrawMintage) GetFee(ledger *l.Ledger, block *types.StateBlock) (types.Balance, error)

func (*WithdrawMintage) GetRefundData

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

type WithdrawVotePledge added in v1.0.3

type WithdrawVotePledge struct {
}

func (*WithdrawVotePledge) DoReceive added in v1.0.3

func (*WithdrawVotePledge) DoReceive(ledger *ledger.Ledger, block *types.StateBlock, input *types.StateBlock) ([]*ContractBlock, error)

func (*WithdrawVotePledge) DoSend added in v1.0.3

func (*WithdrawVotePledge) DoSend(ledger *ledger.Ledger, block *types.StateBlock) (err error)

func (*WithdrawVotePledge) GetFee added in v1.0.3

func (*WithdrawVotePledge) GetFee(ledger *ledger.Ledger, block *types.StateBlock) (types.Balance, error)

func (*WithdrawVotePledge) GetRefundData added in v1.0.3

func (*WithdrawVotePledge) GetRefundData() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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