Documentation ¶
Index ¶
- Constants
- Variables
- func CalcQuotaUsed(quotaTotal, quotaAddition, quotaLeft, quotaRefund uint64, err error) uint64
- func DataGasCost(data []byte) (uint64, error)
- func GetCodeFromCreateContractData(data []byte) []byte
- func GetContractCode(db CommonDb, addr *types.Address) ([]byte, []byte)
- func GetContractTypeFromCreateContractData(data []byte) []byte
- func GetCreateContractData(bytecode []byte, contractType []byte, gid types.Gid) []byte
- func GetGidFromCreateContractData(data []byte) types.Gid
- func IntrinsicGasCost(data []byte, isCreate bool) (uint64, error)
- func IsExistContractType(contractType []byte) bool
- func IsSnapshotGid(gid types.Gid) bool
- func IsUserAccount(db CommonDb, addr types.Address) bool
- func IsViteToken(tokenId types.TokenTypeId) bool
- func MakeSendBlock(block *ledger.AccountBlock, toAddress types.Address, blockType byte, ...) *ledger.AccountBlock
- 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 UseQuota(quotaLeft, cost uint64) (uint64, error)
- func UseQuotaForData(data []byte, quotaLeft uint64) (uint64, error)
- type CommonDb
Constants ¶
View Source
const ( TxGas uint64 = 21000 // Per transaction not creating a contract. PrecompiledContractsSendGas uint64 = 21068 RefundGas uint64 = 21000 )
Variables ¶
View Source
var ( ErrInvalidMethodParam = errors.New("invalid method param") ErrInsufficientBalance = errors.New("insufficient balance for transfer") ErrContractAddressCreationFail = errors.New("contract address creation fail") ErrAddressCollision = errors.New("contract address collision") ErrIdCollision = errors.New("id collision") ErrExecutionReverted = errors.New("execution reverted") ErrGasUintOverflow = errors.New("gas uint64 overflow") ErrMemSizeOverflow = errors.New("memory size uint64 overflow") ErrReturnDataOutOfBounds = errors.New("vm: return data out of bounds") ErrCalcPoWTwice = errors.New("calc PoW twice referring to one snapshot block") ErrAbiMethodNotFound = errors.New("abi: method not found") ErrDepth = errors.New("max call depth exceeded") ErrForked = errors.New("chain forked") ErrCalcPoWLimitReached = errors.New("can not calc PoW in this block") ErrContractSendBlockRunFailed = errors.New("contract send block run failed") ErrVersionNotSupport = errors.New("feature not supported in current snapshot height") )
View Source
var (
AttovPerVite = big.NewInt(1e18)
)
View Source
var (
ErrOutOfQuota = errors.New("out of quota")
)
View Source
var (
SolidityPPContractType = []byte{1}
)
Functions ¶
func CalcQuotaUsed ¶
func DataGasCost ¶
func GetCodeFromCreateContractData ¶ added in v1.2.0
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 IsExistContractType ¶ added in v1.2.0
func IsSnapshotGid ¶
func IsViteToken ¶
func IsViteToken(tokenId types.TokenTypeId) bool
func MakeSendBlock ¶
func MakeSendBlock(block *ledger.AccountBlock, toAddress types.Address, blockType byte, amount *big.Int, tokenId types.TokenTypeId, height uint64, data []byte) *ledger.AccountBlock
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 PackContractCode ¶ added in v1.2.0
Types ¶
Click to show internal directories.
Click to hide internal directories.