2024-10-31 07:11:41 +00:00
|
|
|
|
|
|
|
@pure
|
|
|
|
fun f_pure1(): int {
|
|
|
|
return f_pure2();
|
|
|
|
}
|
|
|
|
|
|
|
|
@pure
|
|
|
|
fun f_pure2(): int {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@pure
|
|
|
|
fun get_contract_data(): (int, int) {
|
2024-10-31 07:16:19 +00:00
|
|
|
var c: cell = getContractData();
|
|
|
|
var cs: slice = c.beginParse();
|
2024-10-31 07:18:54 +00:00
|
|
|
cs.loadBits(32);
|
|
|
|
var value: int = cs.loadUint(16);
|
2024-10-31 07:11:41 +00:00
|
|
|
return (1, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
fun save_contract_data(value: int) {
|
2024-10-31 07:16:19 +00:00
|
|
|
var b: builder = beginCell().storeInt(1, 32).storeUint(value, 16);
|
|
|
|
setContractData(b.endCell());
|
2024-10-31 07:11:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@pure
|
|
|
|
@method_id(101)
|
|
|
|
fun test1(): int {
|
|
|
|
return f_pure1();
|
|
|
|
}
|
|
|
|
|
|
|
|
@method_id(102)
|
|
|
|
fun test2(value: int): int {
|
|
|
|
save_contract_data(value);
|
|
|
|
var (_, restored: auto) = get_contract_data();
|
|
|
|
return restored;
|
|
|
|
}
|
|
|
|
|
|
|
|
fun main() { return; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
@testcase | 101 | | 2
|
|
|
|
@testcase | 102 | 44 | 44
|
|
|
|
|
|
|
|
*/
|