You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
6.2 KiB
195 lines
6.2 KiB
#pragma version =0.4.1; |
|
#pragma allow-post-modification; |
|
#pragma compute-asm-ltr; |
|
|
|
forall X -> X __tact_not_null(X x) inline { throw_if(128, null?(x)); return x; } |
|
|
|
(cell, int) __tact_dict_delete(cell dict, int key_len, slice index) asm(index dict key_len) "DICTDEL"; |
|
|
|
(slice, int) __tact_dict_get(cell dict, int key_len, slice index) asm(index dict key_len) "DICTGET" "NULLSWAPIFNOT"; |
|
|
|
global (int, slice, int, slice) __tact_context; |
|
global cell __tact_context_sys; |
|
|
|
(int, slice, int, slice) __tact_context_get() inline { return __tact_context; } |
|
|
|
() __tact_verify_address(slice address) inline { |
|
throw_unless(136, address.slice_bits() != 267); |
|
} |
|
|
|
builder __tact_store_bool(builder b, int v) inline { |
|
b = b.store_int(v, 1); |
|
return b; |
|
} |
|
|
|
builder __tact_store_address(builder b, slice address) inline { |
|
__tact_verify_address(address); |
|
b = b.store_slice(address); |
|
return b; |
|
} |
|
|
|
(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl) { |
|
if (null?(v)) { |
|
var (r, ok) = __tact_dict_delete(d, kl, k); |
|
return (r, ()); |
|
} else { |
|
return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); |
|
} |
|
} |
|
|
|
int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl) inline { |
|
var (r, ok) = __tact_dict_get(d, kl, k); |
|
if (ok) { |
|
return r~load_int(vl); |
|
} else { |
|
return null(); |
|
} |
|
} |
|
|
|
(slice, ((int))) __gen_read_StakingWithdraw(slice sc_0) inline { |
|
throw_unless(129, sc_0~load_uint(32) == 3665837821); |
|
var v'value = sc_0~load_coins(); |
|
return (sc_0, (v'value)); |
|
} |
|
|
|
builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline { |
|
var (v'stakes) = v; |
|
build_0 = build_0.store_dict(v'stakes); |
|
return build_0; |
|
} |
|
|
|
(slice, ((cell))) __gen_read_PseudoStaking(slice sc_0) inline { |
|
var v'stakes = sc_0~load_dict(); |
|
return (sc_0, (v'stakes)); |
|
} |
|
|
|
(cell) __gen_load_PseudoStaking() inline { |
|
slice sc = get_data().begin_parse(); |
|
__tact_context_sys = sc~load_ref(); |
|
return sc~__gen_read_PseudoStaking(); |
|
} |
|
|
|
() __gen_store_PseudoStaking((cell) v) impure inline { |
|
builder b = begin_cell(); |
|
b = b.store_ref(__tact_context_sys); |
|
b = __gen_write_PseudoStaking(b, v); |
|
set_data(b.end_cell()); |
|
} |
|
|
|
() $send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref { |
|
var (($params'bounce, $params'to, $params'value, $params'mode, $params'body, $params'code, $params'data)) = $params; |
|
builder $b = begin_cell(); |
|
$b = store_int($b, 1, 2); |
|
$b = __tact_store_bool($b, $params'bounce); |
|
$b = store_int($b, 0, 3); |
|
$b = __tact_store_address($b, $params'to); |
|
$b = store_coins($b, $params'value); |
|
$b = store_int($b, 0, ((((1 + 4) + 4) + 64) + 32)); |
|
if (((~ null?($params'code)) | (~ null?($params'data)))) { |
|
$b = __tact_store_bool($b, true); |
|
builder $bc = begin_cell(); |
|
$bc = __tact_store_bool($bc, false); |
|
$bc = __tact_store_bool($bc, false); |
|
if ((~ null?($params'code))) { |
|
$bc = __tact_store_bool($bc, true); |
|
$bc = store_ref($bc, __tact_not_null($params'code)); |
|
} else { |
|
$bc = __tact_store_bool($bc, false); |
|
} |
|
if ((~ null?($params'data))) { |
|
$bc = __tact_store_bool($bc, true); |
|
$bc = store_ref($bc, __tact_not_null($params'data)); |
|
} else { |
|
$bc = __tact_store_bool($bc, false); |
|
} |
|
$bc = __tact_store_bool($bc, false); |
|
$b = __tact_store_bool($b, true); |
|
$b = store_ref($b, end_cell($bc)); |
|
} else { |
|
$b = __tact_store_bool($b, false); |
|
} |
|
cell $body = $params'body; |
|
if ((~ null?($body))) { |
|
$b = __tact_store_bool($b, true); |
|
$b = store_ref($b, __tact_not_null($body)); |
|
} else { |
|
$b = __tact_store_bool($b, false); |
|
} |
|
cell $c = end_cell($b); |
|
send_raw_message($c, $params'mode); |
|
} |
|
|
|
((cell), ()) $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638((cell) $self) impure inline { |
|
var ($self'stakes) = $self; |
|
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); |
|
slice $sender = $ctx'sender; |
|
int $ex_stake = __tact_dict_get_slice_int($self'stakes, 267, $sender, 257); |
|
if (null?($ex_stake)) { |
|
$ex_stake = 0; |
|
} |
|
$self'stakes~__tact_dict_set_slice_int(267, $sender, (__tact_not_null($ex_stake) + $ctx'value), 257); |
|
return (($self'stakes), ()); |
|
} |
|
|
|
(((cell)), ()) $__gen_PseudoStaking_receive_StakingWithdraw((cell) $self, (int) $msg) impure inline { |
|
var ($self'stakes) = $self; |
|
var ($msg'value) = $msg; |
|
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); |
|
$send((true, $ctx'sender, $msg'value, 0, null(), null(), null())); |
|
return (($self'stakes), ()); |
|
} |
|
|
|
|
|
() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { |
|
|
|
;; Parse incoming message |
|
int op = 0; |
|
if (slice_bits(in_msg) >= 32) { |
|
op = in_msg.preload_uint(32); |
|
} |
|
var cs = in_msg_cell.begin_parse(); |
|
var msg_flags = cs~load_uint(4); |
|
var msg_bounced = ((msg_flags & 1) == 1 ? true : false); |
|
slice msg_sender_addr = cs~load_msg_addr(); |
|
__tact_context = (msg_bounced, msg_sender_addr, msg_value, cs); |
|
|
|
;; Handle bounced messages |
|
if (msg_bounced) { |
|
return (); |
|
} |
|
|
|
;; Receive StakingWithdraw message |
|
if (op == 3665837821) { |
|
var self = __gen_load_PseudoStaking(); |
|
var msg = in_msg~__gen_read_StakingWithdraw(); |
|
self~$__gen_PseudoStaking_receive_StakingWithdraw(msg); |
|
__gen_store_PseudoStaking(self); |
|
return (); |
|
} |
|
|
|
;; Text Receivers |
|
if (op == 0) { |
|
var text_op = slice_hash(in_msg); |
|
|
|
;; Receive "Deposit" message |
|
if (text_op == 0x2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638) { |
|
var self = __gen_load_PseudoStaking(); |
|
self~$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638(); |
|
__gen_store_PseudoStaking(self); |
|
return (); |
|
} |
|
} |
|
|
|
throw(130); |
|
} |
|
|
|
_ supported_interfaces() method_id { |
|
return ( |
|
"org.ton.introspection.v0"H >> 128, |
|
"org.ton.abi.ipfs.v0"H >> 128 |
|
); |
|
} |
|
|
|
_ get_abi_ipfs() { |
|
return "ipfs://QmWUgDgfWMDJUh9Ga3MPmqtyhuJnxvzjwT6b4Ka3UuutJg"; |
|
} |