forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contracts Add storage_deposit test (paritytech#14003)
* contracts Add storage_deposit test * fix comments * PR comments
- Loading branch information
1 parent
4fc7f6e
commit de48892
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
;; This calls another contract as passed as its account id. | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "seal1" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32) (result i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
(func $assert (param i32) | ||
(block $ok | ||
(br_if $ok | ||
(get_local 0) | ||
) | ||
(unreachable) | ||
) | ||
) | ||
|
||
(func (export "deploy")) | ||
|
||
(func (export "call") | ||
;; Store length of input buffer. | ||
(i32.store (i32.const 0) (i32.const 512)) | ||
|
||
;; Copy input at address 4. | ||
(call $seal_input (i32.const 4) (i32.const 0)) | ||
|
||
;; Call passed contract. | ||
(call $assert (i32.eqz | ||
(call $seal_call | ||
(i32.const 0) ;; No flags | ||
(i32.const 8) ;; Pointer to "callee" address. | ||
(i64.const 0) ;; How much gas to devote for the execution. 0 = all. | ||
(i32.const 512) ;; Pointer to the buffer with value to transfer | ||
(i32.const 4) ;; Pointer to input data buffer address | ||
(i32.const 4) ;; Length of input data buffer | ||
(i32.const 4294967295) ;; u32 max value is the sentinel value: do not copy output | ||
(i32.const 0) ;; Length is ignored in this case | ||
) | ||
)) | ||
) | ||
) |
This file contains 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