|
|
|
#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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tuple __tact_string_builder_start(builder b) inline {
|
|
|
|
return tpush(tpush(empty_tuple(), b), null());
|
|
|
|
}
|
|
|
|
|
|
|
|
tuple __tact_string_builder_start_comment() inline {
|
|
|
|
return __tact_string_builder_start(begin_cell().store_uint(0, 32));
|
|
|
|
}
|
|
|
|
|
|
|
|
cell __tact_string_builder_end(tuple builders) inline {
|
|
|
|
(builder b, tuple tail) = uncons(builders);
|
|
|
|
cell c = b.end_cell();
|
|
|
|
while(~ null?(tail)) {
|
|
|
|
(b, tail) = uncons(tail);
|
|
|
|
c = b.store_ref(c).end_cell();
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
((tuple), ()) __tact_string_builder_append(tuple builders, slice sc) inline_ref {
|
|
|
|
int sliceRefs = slice_refs(sc);
|
|
|
|
int sliceBits = slice_bits(sc);
|
|
|
|
|
|
|
|
while((sliceBits > 0) | (sliceRefs > 0)) {
|
|
|
|
|
|
|
|
;; Load the current builder
|
|
|
|
(builder b, tuple tail) = uncons(builders);
|
|
|
|
int remBytes = 127 - (builder_bits(b) / 8);
|
|
|
|
int exBytes = sliceBits / 8;
|
|
|
|
|
|
|
|
;; Append bits
|
|
|
|
int amount = min(remBytes, exBytes);
|
|
|
|
if (amount > 0) {
|
|
|
|
slice read = sc~load_bits(amount * 8);
|
|
|
|
b = b.store_slice(read);
|
|
|
|
}
|
|
|
|
|
|
|
|
;; Update builders
|
|
|
|
builders = cons(b, tail);
|
|
|
|
|
|
|
|
;; Check if we need to add a new cell and continue
|
|
|
|
if (exBytes - amount > 0) {
|
|
|
|
var bb = begin_cell();
|
|
|
|
builders = cons(bb, builders);
|
|
|
|
sliceBits = (exBytes - amount) * 8;
|
|
|
|
} elseif (sliceRefs > 0) {
|
|
|
|
sc = sc~load_ref().begin_parse();
|
|
|
|
sliceRefs = slice_refs(sc);
|
|
|
|
sliceBits = slice_bits(sc);
|
|
|
|
} else {
|
|
|
|
sliceBits = 0;
|
|
|
|
sliceRefs = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((builders), ());
|
|
|
|
}
|
|
|
|
|
|
|
|
(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());
|
|
|
|
}
|
|
|
|
|
|
|
|
;; String "Withdraw completed"
|
|
|
|
slice __gen_str_2874951020() asm "B{b5ee9c72410101010014000024576974686472617720636f6d706c65746564f7612edd} B>boc <s PUSHSLICE";
|
|
|
|
|
|
|
|
() $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_String_asComment(slice $self) impure inline_ref {
|
|
|
|
var ($self) = $self;
|
|
|
|
tuple $b = __tact_string_builder_start_comment();
|
|
|
|
$b~__tact_string_builder_append($self);
|
|
|
|
return __tact_string_builder_end($b);
|
|
|
|
}
|
|
|
|
|
|
|
|
((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();
|
|
|
|
int $value = $msg'value;
|
|
|
|
if (($value == 0)) {
|
|
|
|
$value = ((__tact_not_null(__tact_dict_get_slice_int($self'stakes, 267, $ctx'sender, 257)) * 110) / 100);
|
|
|
|
}
|
|
|
|
$self'stakes~__tact_dict_set_slice_int(267, $ctx'sender, (__tact_not_null(__tact_dict_get_slice_int($self'stakes, 267, $ctx'sender, 257)) - $value), 257);
|
|
|
|
if ((__tact_not_null(__tact_dict_get_slice_int($self'stakes, 267, $ctx'sender, 257)) < 0)) {
|
|
|
|
$self'stakes~__tact_dict_set_slice_int(267, $ctx'sender, 0, 257);
|
|
|
|
}
|
|
|
|
$send((true, $ctx'sender, $value, 0, $__gen_String_asComment(__gen_str_2874951020()), null(), null()));
|
|
|
|
return (($self'stakes), ());
|
|
|
|
}
|
|
|
|
|
|
|
|
((cell), ()) $__gen_PseudoStaking_receive_fallback((cell) $self, slice $msg) impure inline {
|
|
|
|
var ($self'stakes) = $self;
|
|
|
|
int $op = $msg~load_uint(32);
|
|
|
|
if (($op == 2077040623)) {
|
|
|
|
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), ());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
() 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 ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
;; Receiver fallback
|
|
|
|
var self = __gen_load_PseudoStaking();
|
|
|
|
self~$__gen_PseudoStaking_receive_fallback(in_msg);
|
|
|
|
__gen_store_PseudoStaking(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
_ supported_interfaces() method_id {
|
|
|
|
return (
|
|
|
|
"org.ton.introspection.v0"H >> 128,
|
|
|
|
"org.ton.abi.ipfs.v0"H >> 128
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_ get_abi_ipfs() {
|
|
|
|
return "ipfs://QmTpVYvpJy7wvLrPak1F6KJSC44yccvcdix7pmrnjZmAHa";
|
|
|
|
}
|