Skip to content

Commit

Permalink
Dummy contract
Browse files Browse the repository at this point in the history
  • Loading branch information
pmikolajczyk41 committed Aug 28, 2023
1 parent b23bcac commit 26f4a79
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 49 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions drink/src/contract_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ mod tests {
#[test]
fn can_upload_code() {
let mut sandbox = Sandbox::<MinimalRuntime>::new().unwrap();
let wasm_binary = compile_module("transfer");
let wasm_binary = compile_module("dummy");
let hash = <<MinimalRuntime as frame_system::Config>::Hashing>::hash(&wasm_binary);

let result = sandbox.upload_contract(wasm_binary, DEFAULT_ACTOR, None);
Expand All @@ -180,7 +180,7 @@ mod tests {
#[test]
fn can_deploy_contract() {
let mut sandbox = Sandbox::<MinimalRuntime>::new().unwrap();
let wasm_binary = compile_module("transfer");
let wasm_binary = compile_module("dummy");

let events_before = sandbox.get_current_block_events();
assert!(events_before.is_empty());
Expand Down Expand Up @@ -208,7 +208,7 @@ mod tests {
#[test]
fn can_call_contract() {
let mut sandbox = Sandbox::<MinimalRuntime>::new().unwrap();
let wasm_binary = compile_module("transfer");
let wasm_binary = compile_module("dummy");

let result = sandbox.deploy_contract(
wasm_binary,
Expand Down
25 changes: 25 additions & 0 deletions drink/test-resources/dummy.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
;; Dummy contract emitting a dummy event.
(module
(import "seal0" "seal_deposit_event" (func $seal_deposit_event (param i32 i32 i32 i32)))
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32)))
(import "env" "memory" (memory 1 1))

(func (export "deploy"))

(func (export "call")
;; emit dummy event
(call $seal_deposit_event
(i32.const 0) ;; The topics buffer
(i32.const 0) ;; The topics buffer's length
(i32.const 8) ;; The data buffer
(i32.const 4) ;; The data buffer's length
)

;; exit with success
(call $seal_return
(i32.const 0) ;; flags
(i32.const 0) ;; returned value
(i32.const 4) ;; length of returned value
)
)
)
44 changes: 0 additions & 44 deletions drink/test-resources/transfer.wat

This file was deleted.

0 comments on commit 26f4a79

Please sign in to comment.