module LibraAccount { import 0x0.LibraAccount; resource T{sequence_number: u64} public new(m: u64): R#Self.T { return T{sequence_number: move(m)}; } public sequence_number(this: &R#Self.T): u64 { let ref: &u64; ref = ©(this).sequence_number; release(move(this)); return *move(ref); } public publish(r: R#Self.T) { move_to_sender(move(r)); return; } public test() { let c1: R#Self.T; let sender: address; let sequence_number: u64; let fake_ref: &mut R#Self.T; let fake_ref_frozen: &R#Self.T; let fake_value: u64; c1 = Self.new(112); Self.publish(move(c1)); sender = get_txn_sender(); sequence_number = LibraAccount.sequence_number(copy(sender)); assert(copy(sequence_number) == 1, 42); fake_ref = borrow_global(copy(sender)); fake_ref_frozen = freeze(move(fake_ref)); fake_value = Self.sequence_number(move(fake_ref_frozen)); assert(copy(fake_value) == 112, 43); return; } } //! new-transaction import {{default}}.LibraAccount as MyAccount; main() { MyAccount.test(); return; }