leo/tests/compiler/finalize/read_write_mapping_fail.leo

31 lines
636 B
Plaintext
Raw Normal View History

2022-09-08 09:09:11 +03:00
/*
namespace: Compile
expectation: Fail
*/
mapping balances: address => u128;
function read(public addr: address) -> public u128 {
return balances[addr];
}
function write(public addr: address, public amount: u128) {
balances[addr] = amount;
}
function read_in_finalize(public addr: address) {
finalize(addr);
2022-09-13 12:06:24 +03:00
}
finalize read_in_finalize(public addr: address) -> public u128 {
2022-09-08 09:09:11 +03:00
return balances[addr];
}
function write_in_finalize(public addr: address, public amount: u128) {
2022-09-21 23:18:50 +03:00
async finalize(addr, amount);
2022-09-13 12:06:24 +03:00
}
finalize write_in_finalize(public: addr: address, public amount: u128) {
2022-09-08 09:09:11 +03:00
balances[addr] = amount;
}