contract

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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
	GetQuota() uint64
}

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) GetQuota

func (m *Mintage) GetQuota() uint64

func (*Mintage) GetRefundData

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

type Pledge

type Pledge struct {
}

func (*Pledge) DoReceive

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

func (*Pledge) DoSend

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

func (*Pledge) GetFee

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

func (*Pledge) GetQuota

func (*Pledge) GetQuota() uint64

func (*Pledge) GetRefundData

func (*Pledge) 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) GetQuota

func (m *WithdrawMintage) GetQuota() uint64

func (*WithdrawMintage) GetRefundData

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

type WithdrawPledge

type WithdrawPledge struct {
}

func (*WithdrawPledge) DoReceive

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

func (*WithdrawPledge) DoSend

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

func (*WithdrawPledge) GetFee

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

func (*WithdrawPledge) GetQuota

func (*WithdrawPledge) GetQuota() uint64

func (*WithdrawPledge) GetRefundData

func (*WithdrawPledge) GetRefundData() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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