module Token { resource T {v: u64} public new(v: u64): R#Self.T { return T{v: move(v)}; } public value(this: &R#Self.T): u64 { let vref: &u64; vref = ©(this).v; release(move(this)); return *move(vref); } public has(addr: address): bool { let yes: bool; yes = exists(move(addr)); return move(yes); } public publish(t: R#Self.T) { move_to_sender(move(t)); return; } public test() { let z: R#Self.T; let addr1: address; let struct1: &mut R#Self.T; let imms1: &R#Self.T; let struct1_original_balance: u64; z = Self.new(0); Self.publish(move(z)); addr1 = get_txn_sender(); struct1 = borrow_global(move(addr1)); imms1 = freeze(move(struct1)); struct1_original_balance = Self.value(move(imms1)); assert(copy(struct1_original_balance) == 0, 42); return; } } //! new-transaction import {{default}}.Token; main() { Token.test(); return; }