Skip to content

Commit 65a7a13

Browse files
committed
Add all missing ewasm methods
1 parent 4e925c3 commit 65a7a13

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

assembly/lib/ethereum.ts

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
import "allocator/arena";
44

5+
export declare function useGas(amount: i64): void;
6+
7+
export declare function getGasLeft(): i64;
8+
9+
export declare function getAddress(resultOffset: i32): void;
10+
11+
export declare function getBalance(addressOffset: i32, resultOffset: i32): void;
12+
13+
export declare function getBlockCoinbase(resultOffset: i32): void;
14+
15+
export declare function getBlockDifficulty(resultOffset: i32): void;
16+
17+
export declare function getBlockGasLimit(): i64;
18+
19+
export declare function getBlockHash(number: i64, resultOffset: i32): void;
20+
21+
export declare function getBlockNumber(): i64;
22+
23+
export declare function getBlockTimestamp(): i64;
24+
25+
export declare function getTxGasPrice(valueOffset: i32): void;
26+
27+
export declare function getTxOrigin(resultOffest: i32): void;
28+
29+
export declare function log(dataOffset: i32, length: i32, numberOfTopics: i32, topic1: i32, topic2: i32, topic3: i32, topic4: i32): void;
30+
31+
export declare function call(gas: i64, addressOffset: i32, valueOffset: i32, dataOffset: i32, dataLength: i32): i32;
32+
33+
export declare function callCode(gas: i64, addressOffset: i32, valueOffset: i32, dataOffset: i32, dataLength: i32): i32;
34+
35+
export declare function callDelegate(gas: i64, addressOffset: i32, dataOffset: i32, dataLength: i32): i32;
36+
37+
export declare function callStatic(gas: i64, addressOffset: i32, dataOffset: i32, dataLength: i32): i32;
38+
39+
export declare function create(valueOffset: i32, dataOffset: i32, length: i32, resultOffset: i32): i32;
40+
41+
export declare function returnDataCopy(resultOffset: i32, dataOffset: i32, length: i32): void;
42+
43+
export declare function getReturnDataSize(): i32;
44+
545
@external("return")
646
export declare function finish(dataOffset: i32, length: i32): void;
747

@@ -11,13 +51,43 @@ export declare function callDataCopy(resultOffset: i32, dataOffset: i32, length:
1151

1252
export declare function getCallDataSize(): i32;
1353

14-
export declare function getCaller(dataOffset: i32): void;
54+
export declare function getCaller(resultOffset: i32): void;
55+
56+
export declare function getCallValue(resultOffset: i32): void;
57+
58+
export declare function codeCopy(resultOffset: i32, codeOffset: i32, length: i32): void;
59+
60+
export declare function getCodeSize(): i32;
61+
62+
export declare function externalCodeCopy(addressOffset: i32, resultOffset: i32, codeOffset: i32, lengh: i32): void;
63+
64+
export declare function getExternalCodeSize(addressOffset: i32): i32;
1565

1666
export declare function storageStore(pathOffset: i32, valueOffset: i32): void;
1767

1868
export declare function storageLoad(pathOffset: i32, resultOffset: i32): void;
1969

70+
export declare function selfDestruct(addressOffset: i32): void;
71+
72+
@external("debug", "print32")
73+
export declare function print32(value: i32): void;
74+
75+
@external("debug", "print64")
76+
export declare function print64(value: i64): void;
77+
78+
@external("debug", "printMem")
79+
export declare function printMem(dataOffset: i32, length: i32): void;
80+
2081
@external("debug", "printMemHex")
2182
export declare function printMemHex(dataOffset: i32, length: i32): void;
2283

84+
@external("debug", "printStorage")
85+
export declare function printStorage(pathOffset: i32): void;
86+
87+
@external("debug", "printStorageHex")
88+
export declare function printStorageHex(pathOffset: i32): void;
89+
90+
@external("debug", "evmTrace")
91+
export declare function evmTrace(pc: i32, opcode: i32, cost: i32, sp: i32): void;
92+
2393
// TODO: need to implement a nice wrapper over the native functions which use native types and handles the memory.

0 commit comments

Comments
 (0)