wasm

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const Error = 1
View Source
const Revert = 2
View Source
const Success = 0
View Source
const ValueByteSize = 16

Variables

View Source
var Abi_CREATETest = []byte(`[{"type":"constructor","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"createChild","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"getChild","type":"function","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"close","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"txPrice","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"blockDifficulty","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"}]`)
View Source
var Abi_storage_test = []byte(`[{"type":"constructor","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"getFooPlus2","type":"function","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"name":"incFoo","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"}]`)
View Source
var Bytecode_storage_test = hex.MustDecodeString("0061736D01000000011C0660027F7F0060017F006000017F60037F7F7F0060017F017F6000000280010608657468657265756D0C73746F7261676553746F7265000008657468657265756D0C67657443616C6C56616C7565000108657468657265756D0B676574436F646553697A65000208657468657265756D08636F6465436F7079000308657468657265756D0666696E697368000008657468657265756D06726576657274000003060500040502050405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E000A0AAB0305240002402001450D00034020004200370300200041086A21002001417F6A22010D000B0B0BA60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B4E01017F230041C0006B22002400200041386A4200370300200042003703302000420037032820004200370320200041041006200042E600370300200041206A20001000200041C0006A240041000B5E01027F230041106B220024002000100102402000290300200041086A290300844200520D0010084100100241C0736A22003602B00741002000100722013602B407200141C00C2000100310091A410041AE071004000B410041001005000B0BB507010041000BAE070061736D01000000011C0660017F006000017F60037F7F7F0060027F7F0060017F017F600000029F010708657468657265756D0C67657443616C6C56616C7565000008657468657265756D0F67657443616C6C4461746153697A65000108657468657265756D0C63616C6C44617461436F7079000208657468657265756D0B73746F726167654C6F6164000308657468657265756D06726576657274000308657468657265756D0C73746F7261676553746F7265000308657468657265756D0666696E697368000303060503020405050405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E000B0AB20505240002402001450D00034020004200370300200041086A21002001417F6A22010D000B0B0B2D002001411F6A21010340200120002D00003A00002001417F6A2101200041016A21002002417F6A22020D000B0BA60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B850302037F017E230041A0016B22002400200041086A100002400240024002402000290308200041106A290300844200520D00100A41001001220136020441002001100922023602082002410020011002200141034D0D014100200228020022013602000240200141DE9AB88F79460D00200141A298B6BE01470D0220004198016A420037030020004200370390012000420037038801200042003703800120004180016A200041E0006A10032000200029036042027C3703184100450D03410041001004000B20004180016A41186A420037030020004200370390012000420037038801200042003703800120004180016A200041E0006A1003200041C0006A41186A420037030020004200370350200042003703482000420037034020002903602103200041206A410410072000200342017C370320200041C0006A200041206A10054100450D03410041001004000B410041001004000B410041001004000B41201009220141041007200041186A200141081008200141201006000B410041001006000B")
View Source
var CREATETest = hex.MustDecodeString("0061736d01000000011c0660017f0060027f7f006000017f60037f7f7f0060017f017f600000026b0508657468657265756d0967657443616c6c6572000008657468657265756d0c73746f7261676553746f7265000108657468657265756d0b676574436f646553697a65000208657468657265756d08636f6465436f7079000308657468657265756d0666696e697368000103060501040502050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00090abd0305240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b890102017f037e230041e0006b22002400200041c8006a1000200041c0006a4200370300200042003703382000420037033020004200370328200041d8006a3502002101200041d0006a290300210220002903482103200041086a410410052000200237031020002003370308200020013e0218200041286a200041086a1001200041e0006a240041000b3401027f10074100100241b35e6a22003602c01c41002000100622013602c41c200141cd212000100310081a410041bf1c1004000b0bc61c010041000bbf1c0061736d01000000012d0860047f7f7f7f017f60027f7f0060017f006000017f60037f7f7f0060017f017f60000060057e7e7e7e7f017f0280020b08657468657265756d06637265617465000008657468657265756d0b73746f726167654c6f6164000108657468657265756d0c73746f7261676553746f7265000108657468657265756d06726576657274000108657468657265756d0c67657443616c6c56616c7565000208657468657265756d0f67657443616c6c4461746153697a65000308657468657265756d0c63616c6c44617461436f7079000408657468657265756d12676574426c6f636b446966666963756c7479000208657468657265756d0d67657454784761735072696365000208657468657265756d0c73656c664465737472756374000208657468657265756d0666696e6973680001030b0a040104040405060307060405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00140ae70f0a2e0002402002450d000340200020012d00003a0000200041016a2100200141016a21012002417f6a22020d000b0b0b240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0b2d002000411f6a21000340200120002d00003a0000200141016a21012000417f6a21002002417f6a22020d000b0b29002000417f6a210003402001200020026a2d00003a0000200141016a21012002417f6a22020d000b0b2d002001411f6a21010340200120002d00003a00002001417f6a2101200041016a21002002417f6a22020d000b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040bcf0405037f037e017f067e017f230041c0006b2200240041db0910102201410041db09100b200141db096a419b01100c20002202420037032020024200370318200241186a200141db092002100021012002200241286a4114100e024020010d00200241286a41106a3502002103200241286a41086a290300210420022903282105200041606a220022012400200041186a4200370300200042003703102000420037030820004201370300200141606a22012206240020002001100120012903002107200141086a2903002108200141186a2903002109200141106a290300210a200641606a22012200240020012008200742c88eb0f4dffad89c6a7c220b2007542206ad7c42d4acba91b798dfbfd8007c220c3703082001200b3703002001200a428f89e3afcef7859c277c220b2006200c200854200c2008511bad7c220c370310200141186a2009200b200a54ad7c200c200b54ad7c42baebad86e1d48ecba57f7c370300200041606a2200220624002000200437030820002005370300200020033e0210200641606a2206220d240020064104100c2006200029030837030820062000290300370300200620003502103e0210200120061002200d41606a220022012400200041186a4200370300200042003703102000420037030820004201370300200141606a22012400200141186a2009200a200742017c220c200754220620082006ad7c220b200854200c20075a1bad7c2207200a54ad7c370300200120073703102001200b3703082001200c370300200020011002200241c0006a240041000f0b410041001003000bd60203027f027e027f230041c0006b220524002005220641206a41186a4200370300200642003703302006420037032820064201370320200641206a20061001024020002006290300542001200641086a29030022075420012007511b2002200641106a2903002208542003200641186a29030022075420032007511b2002200885200320078584501b0d00410041001003000b200541606a2205220924002005200042c88eb0f4dffad89c6a7c2207370300200520012007200054220aad7c42d4acba91b798dfbfd8007c220037030820052002428f89e3afcef7859c277c2207200a200020015420002001511bad7c2201370310200541186a20032007200254ad7c2001200754ad7c42baebad86e1d48ecba57f7c370300200941606a220924002005200910012004200941086a290300370308200420092903003703002004200941106a3502003e0210200641c0006a240041000b8a0502047f027e230041e0016b220024002000100402400240024002400240024002402000290300200041086a290300844200520d0010114100100522013602e00941002001101022023602e4092002410020011006200141034d0d064100200228020022033602dc09024002400240200341c993a89704460d000240200341a2c9ea8d034a0d00200341c3ae9bb17d460d03200341d688adbb01460d020c0a0b0240200341a3c9ea8d03460d00200341d8dfd3d007470d0a200041c0016a1007200041106a41186a200041c0016a41186a2903003703002000200041d0016a2903003703202000200041c8016a290300370318200020002903c0013703104100450d05410041001003000b1012450d05410041001003000b2001417c6a4120490d05200241046a200041306a4120100d2000290330200041386a290300200041c0006a290300200041c8006a290300200041d0006a1013450d06410041001003000b200041c0016a100820004180016a200041c8016a2903002204423f87220537030020002004370370200020002903c001370368200020053703784100450d06410041001003000b200041d8016a4200370300200042003703d001200042003703c801200042003703c001200041c0016a200041a0016a10012000200041a8016a29030037039001200020002903a001370388012000200041b0016a3502003e02980120004188016a1009000b410041001003000b4120101022014104100c200041106a20014120100f20014120100a000b41004100100a000b200041e0016a240041020f0b4120101022014104100c200041d0006a20014114100f20014120100a000b4120101022014104100c200041e8006a20014120100f20014120100a000b410041001003000b0be209010041000bdb090061736d01000000011c0660017f0060027f7f006000017f60037f7f7f0060017f017f6000000295010708657468657265756d0967657443616c6c6572000008657468657265756d0c73746f7261676553746f7265000108657468657265756d0c67657443616c6c56616c7565000008657468657265756d0b676574436f646553697a65000208657468657265756d08636f6465436f7079000308657468657265756d0666696e697368000108657468657265756d06726576657274000103060501040502050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e000b0ae70305240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b890102017f037e230041e0006b22002400200041c8006a1000200041c0006a4200370300200042003703382000420037033020004200370328200041d8006a3502002101200041d0006a290300210220002903482103200041086a410410072000200237031020002003370308200020013e0218200041286a200041086a1001200041e0006a240041000b5e01027f230041106b220024002000100202402000290300200041086a290300844200520d0010094100100341a5766a22003602f80341002000100822013602fc03200141db0920001004100a1a410041f8031005000b410041001006000b0bff03010041000bf8030061736d01000000011c0660017f006000017f60037f7f7f0060027f7f0060017f017f600000025e0408657468657265756d0c67657443616c6c56616c7565000008657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000208657468657265756d0672657665727400030304030405050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00060ac00203a60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b6701027f230041106b220024002000100002402000290300200041086a290300844200520d001005410010012200360204410020001004220136020820014100200010020240200041034d0d00410020012802003602000b410041001003000b410041001003000b")
View Source
var DefaultVMConfig = lifeExec.VMConfig{
	DisableFloatingPoint: true,
	MaxMemoryPages:       16,
	DefaultMemoryPages:   16,
}

Implements ewasm, see https://github.com/ewasm/design WASM

Functions

This section is empty.

Types

type Contract added in v0.31.0

type Contract struct {
	// contains filtered or unexported fields
}

func (*Contract) Call added in v0.31.0

func (c *Contract) Call(state engine.State, params engine.CallParams) (output []byte, err error)

type WVM added in v0.31.0

type WVM struct {
	engine.Externals
	// contains filtered or unexported fields
}

func Default added in v0.31.0

func Default() *WVM

func New added in v0.31.0

func New(options engine.Options) *WVM

func (*WVM) Contract added in v0.31.0

func (vm *WVM) Contract(code []byte) *Contract

func (*WVM) Dispatch added in v0.31.0

func (vm *WVM) Dispatch(acc *acm.Account) engine.Callable

func (*WVM) Execute added in v0.31.0

func (vm *WVM) Execute(st acmstate.ReaderWriter, blockchain engine.Blockchain, eventSink exec.EventSink,
	params engine.CallParams, code []byte) (output []byte, cerr error)

RunWASM creates a WASM VM, and executes the given WASM contract code

Jump to

Keyboard shortcuts

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