git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 7465ee54b512e6772d88465794c551333e42ecfe

Files: 7465ee54b512e6772d88465794c551333e42ecfe / wasm / interface.wast

1424 bytesRaw
1(module
2 ;; useGas
3 (import $useGas "interface" "useGas" (param i32 i32))
4 (func $useGasShim
5 (param $amount i64)
6 (call_import $useGas
7 (i32.wrap/i64
8 (i64.shr_u (get_local $amount) (i64.const 32)))
9 (i32.wrap/i64 (get_local $amount)))
10 )
11 (export "useGas" $useGasShim)
12
13 ;; getGasLeft
14 (import $getGasLeftHigh "interface" "getGasLeftHigh" (result i32))
15 (import $getGasLeftLow "interface" "getGasLeftLow" (result i32))
16 (func $getGasLeft
17 (result i64)
18 (call_import $useGas (i32.const 0) (i32.const 2))
19 (return
20 (i64.add
21 (i64.shl (i64.extend_u/i32 (call_import $getGasLeftHigh)) (i64.const 32))
22 (i64.extend_u/i32 (call_import $getGasLeftLow))))
23 )
24 (export "getGasLeft" $getGasLeft)
25
26 ;; call
27 ;; (import $call "ethereum" "call" (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32))
28 (import $call "interface" "call" (param i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32))
29 (func $callShim
30 (param i64 i32 i32 i32 i32 i32 i32 i32)
31 (result i32)
32 (call_import $call
33 (i32.wrap/i64
34 (i64.shr_u (get_local 0) (i64.const 32)))
35 (i32.wrap/i64 (get_local 0))
36 (get_local 1)
37 (get_local 2)
38 (get_local 3)
39 (get_local 4)
40 (get_local 5)
41 (get_local 6)
42 (get_local 7)
43 )
44 )
45 (export "call" $callShim)
46)
47

Built with git-ssb-web