Documentation ¶
Index ¶
- Constants
- Variables
- func AddBalance(db dbInterface, id *types.TokenTypeId, amount *big.Int)
- func CalcQuotaUsed(useQuota bool, quotaTotal, quotaAddition, quotaLeft uint64, err error) (q uint64, qUsed uint64)
- func DataGasCost(data []byte) (uint64, error)
- func DealWithErr(v interface{})
- func GetCodeFromCreateContractData(data []byte) []byte
- func GetConfirmTimeFromCreateContractData(data []byte) uint8
- func GetContractCode(db CommonDb, addr *types.Address, status GlobalStatus) ([]byte, []byte)
- func GetContractTypeFromCreateContractData(data []byte) []byte
- func GetCreateContractData(bytecode []byte, contractType []byte, confirmTimes uint8, quotaRatio uint8, ...) []byte
- func GetGidFromCreateContractData(data []byte) types.Gid
- func GetQuotaRatioFromCreateContractData(data []byte) uint8
- func GetValue(db dbInterface, key []byte) []byte
- func IntrinsicGasCost(data []byte, isCreate bool, confirmTime uint8) (uint64, error)
- func IsDelegateGid(gid types.Gid) bool
- func IsExistContractType(contractType []byte) bool
- func IsPoW(block *ledger.AccountBlock) bool
- func IsSnapshotGid(gid types.Gid) bool
- func IsUserAccount(addr types.Address) bool
- func IsValidQuotaRatio(quotaRatio uint8) bool
- func IsViteToken(tokenId types.TokenTypeId) bool
- func MakeSendBlock(fromAddress types.Address, toAddress types.Address, blockType byte, ...) *ledger.AccountBlock
- func MultipleCost(cost uint64, quotaRatio uint8) (uint64, error)
- func NewContractAddress(accountAddress types.Address, accountBlockHeight uint64, ...) types.Address
- func NewLog(c abi.ABIContract, name string, params ...interface{}) *ledger.VmLog
- func PackContractCode(contractType, code []byte) []byte
- func PrintMap(m map[string][]byte) string
- func SetValue(db dbInterface, key []byte, value []byte)
- func SubBalance(db dbInterface, id *types.TokenTypeId, amount *big.Int)
- func UseQuota(quotaLeft, cost uint64) (uint64, error)
- func UseQuotaWithFlag(quotaLeft, cost uint64, flag bool) (uint64, error)
- type CommonDb
- type ConsensusReader
- type GlobalStatus
- type SBPStatReader
- type VMConsensusReader
- func (r *VMConsensusReader) GetConsensusDetailByDay(startIndex, endIndex uint64) ([]*core.DayStats, error)
- func (r *VMConsensusReader) GetEndTimeByIndex(index uint64) int64
- func (r *VMConsensusReader) GetIndexByEndTime(t int64, genesisTime int64) (uint64, int64, bool)
- func (r *VMConsensusReader) GetIndexByStartTime(t int64, genesisTime int64) (uint64, int64, bool)
- func (r *VMConsensusReader) GetIndexByTime(t int64, genesisTime int64) uint64
- type VMError
Constants ¶
Variables ¶
View Source
var ( ErrInvalidMethodParam = VMError{"invalid method param", false} ErrInvalidQuotaRatio = VMError{"invalid quota ratio", false} ErrRewardIsNotDrained = VMError{"reward is not drained", false} ErrInsufficientBalance = VMError{"insufficient balance for transfer", false} ErrCalcPoWTwice = VMError{"calc PoW twice referring to one snapshot block", false} ErrAbiMethodNotFound = VMError{"abi: method not found", false} ErrInvalidConfirmTime = VMError{"invalid confirm time", false} ErrAddressNotMatch = VMError{"current address not match", false} ErrTransactionTypeNotSupport = VMError{"transaction type not supported", false} ErrVersionNotSupport = VMError{"feature not supported in current snapshot height", false} ErrBlockTypeNotSupported = VMError{"block type not supported", true} ErrDataNotExist = VMError{"data not exist", false} ErrContractNotExists = VMError{"contract not exists", false} ErrNoReliableStatus = VMError{"no reliable status", false} ErrAddressCollision = VMError{"contract address collision", false} ErrIdCollision = VMError{"id collision", false} ErrRewardNotDue = VMError{"reward not due", false} ErrExecutionReverted = VMError{"execution reverted", false} ErrDepth = VMError{"max call depth exceeded", false} ErrGasUintOverflow = VMError{"gas uint64 overflow", true} ErrMemSizeOverflow = VMError{"memory size uint64 overflow", true} ErrReturnDataOutOfBounds = VMError{"vm: return data out of bounds", true} ErrBlockQuotaLimitReached = VMError{"quota limit for block reached", true} ErrAccountQuotaLimitReached = VMError{"quota limit for account reached", true} ErrOutOfQuota = VMError{"out of quota", true} ErrInvalidUnconfirmedQuota = VMError{"calc quota failed, invalid unconfirmed quota", true} ErrStackLimitReached = VMError{"stack limit reached", true} ErrStackUnderflow = VMError{"stack underflow", true} ErrInvalidJumpDestination = VMError{"invalid jump destination", true} ErrInvalidOpCode = VMError{"invalid opcode", true} ErrChainForked = VMError{"chain forked", false} ErrContractCreationFail = VMError{"contract creation failed", false} )
View Source
var (
SolidityPPContractType = []byte{1}
)
Functions ¶
func AddBalance ¶
func AddBalance(db dbInterface, id *types.TokenTypeId, amount *big.Int)
func CalcQuotaUsed ¶
func DealWithErr ¶
func DealWithErr(v interface{})
func GetCodeFromCreateContractData ¶ added in v1.2.0
func GetConfirmTimeFromCreateContractData ¶
func GetContractCode ¶ added in v1.2.0
func GetContractTypeFromCreateContractData ¶ added in v1.2.0
func GetCreateContractData ¶ added in v1.2.0
func GetGidFromCreateContractData ¶ added in v1.2.0
func GetQuotaRatioFromCreateContractData ¶
func IntrinsicGasCost ¶
func IsPoW ¶
func IsPoW(block *ledger.AccountBlock) bool
func IsViteToken ¶
func IsViteToken(tokenId types.TokenTypeId) bool
func MakeSendBlock ¶
func NewContractAddress ¶ added in v1.2.0
func NewLog ¶ added in v1.3.0
func NewLog(c abi.ABIContract, name string, params ...interface{}) *ledger.VmLog
func SubBalance ¶
func SubBalance(db dbInterface, id *types.TokenTypeId, amount *big.Int)
Types ¶
type CommonDb ¶ added in v1.2.0
type ConsensusReader ¶
type ConsensusReader interface { GetIndexByStartTime(t int64, genesisTime int64) (startIndex uint64, startTime int64, drained bool) GetIndexByEndTime(t int64, genesisTime int64) (endIndex uint64, endTime int64, withinADay bool) GetIndexByTime(t int64, genesisTime int64) uint64 GetEndTimeByIndex(index uint64) int64 GetConsensusDetailByDay(startIndex, endIndex uint64) ([]*core.DayStats, error) }
type GlobalStatus ¶
type GlobalStatus interface { Seed() (uint64, error) SnapshotBlock() *ledger.SnapshotBlock }
type SBPStatReader ¶
type VMConsensusReader ¶
type VMConsensusReader struct {
// contains filtered or unexported fields
}
func NewVmConsensusReader ¶
func NewVmConsensusReader(sr SBPStatReader) *VMConsensusReader
func (*VMConsensusReader) GetConsensusDetailByDay ¶
func (r *VMConsensusReader) GetConsensusDetailByDay(startIndex, endIndex uint64) ([]*core.DayStats, error)
func (*VMConsensusReader) GetEndTimeByIndex ¶
func (r *VMConsensusReader) GetEndTimeByIndex(index uint64) int64
func (*VMConsensusReader) GetIndexByEndTime ¶
get first index before t and index start time if t <= genesis time + 24h, return index 0, within one day if t ∈ (genesis time + 24h, genesis time + 48h], return index 0
func (*VMConsensusReader) GetIndexByStartTime ¶
index 0 : (genesis time, genesis time + 24h] index 1: (genesis time + 24h, genesis time + 48h] get first index after t and index start time if t == -1, reward drained if t == 0, return index 0 if t ∈ (genesis time, genesis time + 24h], return index 1
func (*VMConsensusReader) GetIndexByTime ¶
func (r *VMConsensusReader) GetIndexByTime(t int64, genesisTime int64) uint64
Click to show internal directories.
Click to hide internal directories.