Last active
January 21, 2018 14:59
-
-
Save axic/3db459a06141af7a650f841d89bc1c00 to your computer and use it in GitHub Desktop.
Dummy eWASM sentinel contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0061736d0100000001170560017e006000017f60037f7f7f0060027f7f0060000002580408657468657265756d06757365476173000008657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000208657468657265756d0672657475726e0003030201040503010001071102066d656d6f72790200046d61696e00040a25012301017f1001210042ba022000ad7e42e40080100041004100200010024100200010030b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; | |
| ;; Dummy sentinel contract. Accepts any input and passes it through. | |
| ;; | |
| (module | |
| (import "ethereum" "useGas" (func $useGas (param i64))) | |
| (import "ethereum" "getCallDataSize" (func $getCallDataSize (result i32))) | |
| (import "ethereum" "callDataCopy" (func $callDataCopy (param i32 i32 i32))) | |
| (import "ethereum" "return" (func $return (param i32 i32))) | |
| (memory 1) | |
| (export "memory" (memory 0)) | |
| (export "main" (func $main)) | |
| (func $main | |
| (local $size i32) | |
| (set_local $size (call $getCallDataSize)) | |
| ;; Charge π gas per byte | |
| (call $useGas (i64.div_u (i64.mul (i64.const 314) (i64.extend_u/i32 (get_local $size))) (i64.const 100))) | |
| (call $callDataCopy (i32.const 0) (i32.const 0) (get_local $size)) | |
| (call $return (i32.const 0) (get_local $size)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment