Documentation ¶
Index ¶
- Constants
- Variables
- func CodeSavageCost(size int) *contract.Cost
- func CommonErrorCost(layer int) *contract.Cost
- func EventCost(size int) *contract.Cost
- func Post(topic event.Event_Topic, data string) *contract.Cost
- func ReceiptCost(size int) *contract.Cost
- type APIDelegate
- type Context
- type DBHandler
- func (h *DBHandler) Del(key string) *contract.Cost
- func (h *DBHandler) Get(key string) (value interface{}, cost *contract.Cost)
- func (h *DBHandler) GlobalGet(con, key string) (value interface{}, cost *contract.Cost)
- func (h *DBHandler) GlobalMapGet(con, key, field string) (value interface{}, cost *contract.Cost)
- func (h *DBHandler) GlobalMapKeys(con, key string) (keys []string, cost *contract.Cost)
- func (h *DBHandler) GlobalMapLen(con, key string) (length int, cost *contract.Cost)
- func (h *DBHandler) Has(key string) (bool, *contract.Cost)
- func (h *DBHandler) MapDel(key, field string) *contract.Cost
- func (h *DBHandler) MapGet(key, field string) (value interface{}, cost *contract.Cost)
- func (h *DBHandler) MapHas(key, field string) (bool, *contract.Cost)
- func (h *DBHandler) MapKeys(key string) (fields []string, cost *contract.Cost)
- func (h *DBHandler) MapLen(key string) (int, *contract.Cost)
- func (h *DBHandler) MapPut(key, field string, value interface{}) *contract.Cost
- func (h *DBHandler) Put(key string, value interface{}) *contract.Cost
- type DHCP
- type EventPoster
- type Host
- func (h *Host) Call(contract, api, jarg string) ([]interface{}, *contract.Cost, error)
- func (h *Host) CallWithReceipt(contractName, api, jarg string) ([]interface{}, *contract.Cost, error)
- func (h *Host) Context() *Context
- func (h *Host) DB() *database.Visitor
- func (h *Host) Deadline() time.Time
- func (h *Host) DestroyCode(contractName string) (*contract.Cost, error)
- func (h *Host) Logger() *ilog.Logger
- func (h *Host) PopCtx()
- func (h *Host) PushCtx()
- func (h *Host) SetCode(c *contract.Contract) (*contract.Cost, error)
- func (h *Host) SetContext(ctx *Context)
- func (h *Host) SetDeadline(t time.Time)
- func (h *Host) UpdateCode(c *contract.Contract, id database.SerializedJSON) (*contract.Cost, error)
- type Info
- type Monitor
- type Teller
- func (h *Teller) ConsumeCoin(coinName, from string, amount int64) (cost *contract.Cost, err error)
- func (h *Teller) ConsumeServi(from string, amount int64) (cost *contract.Cost, err error)
- func (h *Teller) Countermand(c, to string, amount int64) (*contract.Cost, error)
- func (h *Teller) Deposit(from string, amount int64) (*contract.Cost, error)
- func (h *Teller) DoPay(witness string, gasPrice int64) error
- func (h *Teller) GetBalance(from string) (int64, *contract.Cost, error)
- func (h *Teller) GrantCoin(coinName, to string, amount int64) (*contract.Cost, error)
- func (h *Teller) GrantServi(to string, amount int64) (*contract.Cost, error)
- func (h *Teller) PayCost(c *contract.Cost, who string)
- func (h *Teller) Privilege(id string) int
- func (h *Teller) TopUp(c, from string, amount int64) (*contract.Cost, error)
- func (h *Teller) TotalServi() (ts int64, cost *contract.Cost)
- func (h *Teller) Transfer(from, to string, amount int64) (*contract.Cost, error)
- func (h *Teller) Withdraw(to string, amount int64) (*contract.Cost, error)
Constants ¶
const ( DHCPTable = "dhcp_table" DHCPRTable = "dhcp_revert_table" DHCPOwnerTable = "dhcp_owner_table" )
const table name
const ( ContractAccountPrefix = "CA" ContractGasPrefix = "CG" )
const prefixs
Variables ¶
var ( PutCost = contract.NewCost(100, 0, 12) GetCost = contract.NewCost(100, 0, 8) DelCost = contract.NewCost(0, 0, 8) KeysCost = contract.NewCost(100, 0, 12) CompileErrCost = contract.NewCost(0, 0, 10) ContractNotFoundCost = contract.NewCost(0, 0, 10) ABINotFoundCost = contract.NewCost(0, 0, 11) DelContractCost = contract.NewCost(0, 0, 10) BlockInfoCost = contract.NewCost(0, 0, 1) TxInfoCost = contract.NewCost(0, 0, 1) TransferCost = contract.NewCost(300, 0, 3) RequireAuthCost = contract.NewCost(0, 0, 1) )
var list cost
var ( ErrBalanceNotEnough = errors.New("balance not enough") ErrTransferNegValue = errors.New("trasfer amount less than zero") ErrReenter = errors.New("re-entering") ErrPermissionLost = errors.New("transaction has no permission") ErrContractNotFound = errors.New("contract not exists") ErrUpdateRefused = errors.New("update refused") ErrDestroyRefused = errors.New("destroy refused") ErrCoinExists = errors.New("coin exists") ErrCoinNotExists = errors.New("coin not exists") ErrCoinIssueRefused = errors.New("coin issue refused") ErrCoinSetRateRefused = errors.New("coin set rate refused") )
var errors
Functions ¶
func CodeSavageCost ¶
CodeSavageCost cost in deploy contract based on code size
func CommonErrorCost ¶
CommonErrorCost returns cost increased by stack layer
Types ¶
type APIDelegate ¶
type APIDelegate struct {
// contains filtered or unexported fields
}
APIDelegate ...
func (*APIDelegate) RequireAuth ¶
func (h *APIDelegate) RequireAuth(pubkey string) (ok bool, cost *contract.Cost)
RequireAuth ...
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context thread unsafe context with global fields
type DBHandler ¶
type DBHandler struct {
// contains filtered or unexported fields
}
DBHandler struct {
func (*DBHandler) GlobalMapGet ¶
GlobalMapGet get another contract's map data
func (*DBHandler) GlobalMapKeys ¶
GlobalMapKeys get another contract's map keys
func (*DBHandler) GlobalMapLen ¶
GlobalMapLen get another contract's map length
type DHCP ¶
type DHCP struct {
// contains filtered or unexported fields
}
DHCP dhcp server handler
func (*DHCP) URLTransfer ¶
URLTransfer give url to another id
type Host ¶
type Host struct { DBHandler Info Teller APIDelegate EventPoster DHCP // contains filtered or unexported fields }
Host host struct, used as isolate of vm
func (*Host) CallWithReceipt ¶
func (h *Host) CallWithReceipt(contractName, api, jarg string) ([]interface{}, *contract.Cost, error)
CallWithReceipt call and generate receipt
func (*Host) DestroyCode ¶
DestroyCode delete code
func (*Host) SetContext ¶
SetContext set a new context to host
func (*Host) SetDeadline ¶
SetDeadline set this host's deadline
func (*Host) UpdateCode ¶
UpdateCode update code
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info current info handler of this isolate
type Monitor ¶
type Monitor interface { Call(host *Host, contractName, api string, jarg string) (rtn []interface{}, cost *contract.Cost, err error) Compile(con *contract.Contract) (string, error) }
Monitor monitor interface
type Teller ¶
type Teller struct {
// contains filtered or unexported fields
}
Teller handler of iost
func (*Teller) ConsumeCoin ¶
ConsumeCoin consume coin from
func (*Teller) ConsumeServi ¶
ConsumeServi ...
func (*Teller) Countermand ¶
Countermand ...
func (*Teller) GetBalance ¶
GetBalance return balance of an id
func (*Teller) GrantServi ¶
GrantServi ...
func (*Teller) TotalServi ¶
TotalServi ...