MCPcopy Create free account
hub / github.com/DNAProject/DNA / invoke

Function invoke

wasmtest/contracts-rust/contractop/src/lib.rs:18–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17#[no_mangle]
18pub fn invoke() {
19 let input = runtime::input();
20 let mut source = Source::new(&input);
21 let action: &[u8] = source.read().unwrap();
22 let mut sink = Sink::new(12);
23 match action {
24 b"test_migrate" => {
25 /** file: test_migrate3.wat
26 (module
27 (type (;0;) (func))
28 (type (;1;) (func (param i32 i32)))
29 (type (;2;) (func (param i32 i32 i32 i32 i32) (result i32)))
30 (import "env" "ontio_return" (func (;0;) (type 1)))
31 (import "env" "ontio_storage_read" (func (;1;) (type 2)))
32 (func (;2;) (type 0)
33 i32.const 0 ;; storge offset
34 i32.const 37;; init key 0x25(KEY_MIGRATE_STORE)
35 i32.store8 ;; store key
36 i32.const 0 ;; key addr
37 i32.const 1 ;; key size 1 byte
38 i32.const 8 ;; data addr
39 i32.const 8 ;; data is i64
40 i32.const 0 ;; always 0
41 call 1 ;; read key to data addr of data size
42 i32.const 8 ;; should read 8
43 i32.ne
44 if
45 unreachable ;; if read length not 8 will panic
46 end
47 i32.const 8 ;; data addr
48 i64.load
49 i64.const 1278615 ;; data(VAL_MIGRAGE_STORE)
50 i64.ne
51 if
52 unreachable ;;
53 end ;; ===first key storage check end===
54 i32.const 0 ;; storge offset
55 i32.const 20 ;; init key 0x14(KEY_MIGRATE_STORE2)
56 i32.store8 ;; store key
57 i32.const 0 ;; key addr
58 i32.const 1 ;; key size 1 byte
59 i32.const 8 ;; data addr
60 i32.const 8 ;; data is i64
61 i32.const 0 ;; always 0
62 call 1 ;; read key to data addr of data size
63 i32.const 8 ;; should read 8
64 i32.ne
65 if
66 unreachable ;; if read length not 8 will panic
67 end
68 i32.const 8 ;; data addr
69 i64.load
70 i64.const 206643;; data(VAL_MIGRAGE_STORE2)
71 i64.ne
72 if
73 unreachable ;;
74 end
75 i32.const 8 ;; data addr

Callers

nothing calls this directly

Calls 6

get_tcFunction · 0.85
allowanceFunction · 0.85
writeMethod · 0.80
testcaseFunction · 0.70
transferFunction · 0.50
approveFunction · 0.50

Tested by

no test coverage detected