git.delta.rocks / unique-network / refs/commits / e8fdadb89923

difftreelog

source

pallets/contracts/fixtures/drain.wat1.1 KiBsourcehistory
1(module2	(import "seal0" "seal_balance" (func $seal_balance (param i32 i32)))3	(import "seal0" "seal_transfer" (func $seal_transfer (param i32 i32 i32 i32) (result i32)))4	(import "env" "memory" (memory 1 1))56	;; [0, 8) reserved for $seal_balance output78	;; [8, 16) length of the buffer9	(data (i32.const 8) "\08")1011	;; [16, inf) zero initialized1213	(func $assert (param i32)14		(block $ok15			(br_if $ok16				(get_local 0)17			)18			(unreachable)19		)20	)2122	(func (export "deploy"))2324	(func (export "call")25		;; Send entire remaining balance to the 0 address.26		(call $seal_balance (i32.const 0) (i32.const 8))2728		;; Balance should be encoded as a u64.29		(call $assert30			(i32.eq31				(i32.load (i32.const 8))32				(i32.const 8)33			)34		)3536		;; Self-destruct by sending full balance to the 0 address.37		(call $assert38			(i32.eq39				(call $seal_transfer40					(i32.const 16)	;; Pointer to destination address41					(i32.const 32)	;; Length of destination address42					(i32.const 0)	;; Pointer to the buffer with value to transfer43					(i32.const 8)	;; Length of the buffer with value to transfer44				)45				(i32.const 4) ;; ReturnCode::BelowSubsistenceThreshold46			)47		)48	)49)