|
|
|
#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; }
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
(slice, slice) __tact_load_address(slice cs) inline {
|
|
|
|
slice raw = cs~load_msg_addr();
|
|
|
|
__tact_verify_address(raw);
|
|
|
|
return (cs, raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
(slice, slice) __tact_load_address_opt(slice cs) inline {
|
|
|
|
slice raw = cs~load_msg_addr();
|
|
|
|
if (raw.preload_uint(2) != 0) {
|
|
|
|
__tact_verify_address(raw);
|
|
|
|
return (cs, raw);
|
|
|
|
} else {
|
|
|
|
return (cs, null());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
builder __tact_store_address(builder b, slice address) inline {
|
|
|
|
__tact_verify_address(address);
|
|
|
|
b = b.store_slice(address);
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
builder __tact_store_address_opt(builder b, slice address) inline {
|
|
|
|
if (null?(address)) {
|
|
|
|
b = b.store_uint(0, 2);
|
|
|
|
return b;
|
|
|
|
} else {
|
|
|
|
return __tact_store_address(b, address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int __tact_address_eq(slice a, slice b) inline {
|
|
|
|
return equal_slice_bits(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
(slice, ((slice))) __gen_read_SetLinkerNeighbor(slice sc_0) inline {
|
|
|
|
throw_unless(129, sc_0~load_uint(32) == 3019699393);
|
|
|
|
var v'neighbor = sc_0~__tact_load_address_opt();
|
|
|
|
return (sc_0, (v'neighbor));
|
|
|
|
}
|
|
|
|
|
|
|
|
(slice, ((cell))) __gen_read_ForwardToWallet(slice sc_0) inline {
|
|
|
|
throw_unless(129, sc_0~load_uint(32) == 1562223291);
|
|
|
|
var v'body = sc_0~load_ref();
|
|
|
|
return (sc_0, (v'body));
|
|
|
|
}
|
|
|
|
|
|
|
|
builder __gen_write_Linker(builder build_0, (int, slice, slice, slice) v) inline {
|
|
|
|
var (v'index, v'master, v'owner, v'neighbor) = v;
|
|
|
|
build_0 = build_0.store_int(v'index, 257);
|
|
|
|
build_0 = __tact_store_address(build_0, v'master);
|
|
|
|
build_0 = __tact_store_address(build_0, v'owner);
|
|
|
|
var build_1 = begin_cell();
|
|
|
|
build_1 = __tact_store_address_opt(build_1, v'neighbor);
|
|
|
|
build_0 = store_ref(build_0, build_1.end_cell());
|
|
|
|
return build_0;
|
|
|
|
}
|
|
|
|
|
|
|
|
(slice, ((int, slice, slice, slice))) __gen_read_Linker(slice sc_0) inline {
|
|
|
|
var v'index = sc_0~load_int(257);
|
|
|
|
var v'master = sc_0~__tact_load_address();
|
|
|
|
var v'owner = sc_0~__tact_load_address();
|
|
|
|
slice sc_1 = sc_0~load_ref().begin_parse();
|
|
|
|
var v'neighbor = sc_1~__tact_load_address_opt();
|
|
|
|
return (sc_0, (v'index, v'master, v'owner, v'neighbor));
|
|
|
|
}
|
|
|
|
|
|
|
|
(int, slice, slice, slice) __gen_load_Linker() inline {
|
|
|
|
slice sc = get_data().begin_parse();
|
|
|
|
__tact_context_sys = sc~load_ref();
|
|
|
|
return sc~__gen_read_Linker();
|
|
|
|
}
|
|
|
|
|
|
|
|
() __gen_store_Linker((int, slice, slice, slice) v) impure inline {
|
|
|
|
builder b = begin_cell();
|
|
|
|
b = b.store_ref(__tact_context_sys);
|
|
|
|
b = __gen_write_Linker(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);
|
|
|
|
}
|
|
|
|
|
|
|
|
slice $__gen_Linker_owner((int, slice, slice, slice) $self) impure inline_ref {
|
|
|
|
var (($self'index, $self'master, $self'owner, $self'neighbor)) = $self;
|
|
|
|
return $self'owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ $__gen_get_owner() method_id(83229) {
|
|
|
|
var self = __gen_load_Linker();
|
|
|
|
var res = $__gen_Linker_owner(self);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
slice $__gen_Linker_master((int, slice, slice, slice) $self) impure inline_ref {
|
|
|
|
var (($self'index, $self'master, $self'owner, $self'neighbor)) = $self;
|
|
|
|
return $self'master;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ $__gen_get_master() method_id(120253) {
|
|
|
|
var self = __gen_load_Linker();
|
|
|
|
var res = $__gen_Linker_master(self);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
(((int, slice, slice, slice)), ()) $__gen_Linker_receive_SetLinkerNeighbor((int, slice, slice, slice) $self, (slice) $msg) impure inline {
|
|
|
|
var ($self'index, $self'master, $self'owner, $self'neighbor) = $self;
|
|
|
|
var ($msg'neighbor) = $msg;
|
|
|
|
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
|
|
|
|
throw_unless(4429, __tact_address_eq($ctx'sender, $self'master));
|
|
|
|
$self'neighbor = $msg'neighbor;
|
|
|
|
return (($self'index, $self'master, $self'owner, $self'neighbor), ());
|
|
|
|
}
|
|
|
|
|
|
|
|
(((int, slice, slice, slice)), ()) $__gen_Linker_receive_ForwardToWallet((int, slice, slice, slice) $self, (cell) $msg) impure inline {
|
|
|
|
var ($self'index, $self'master, $self'owner, $self'neighbor) = $self;
|
|
|
|
var ($msg'body) = $msg;
|
|
|
|
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
|
|
|
|
throw_unless(4429, __tact_address_eq($ctx'sender, $self'master));
|
|
|
|
$send((true, $self'owner, 0, 64, $msg'body, null(), null()));
|
|
|
|
return (($self'index, $self'master, $self'owner, $self'neighbor), ());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
() 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 SetLinkerNeighbor message
|
|
|
|
if (op == 3019699393) {
|
|
|
|
var self = __gen_load_Linker();
|
|
|
|
var msg = in_msg~__gen_read_SetLinkerNeighbor();
|
|
|
|
self~$__gen_Linker_receive_SetLinkerNeighbor(msg);
|
|
|
|
__gen_store_Linker(self);
|
|
|
|
return ();
|
|
|
|
}
|
|
|
|
|
|
|
|
;; Receive ForwardToWallet message
|
|
|
|
if (op == 1562223291) {
|
|
|
|
var self = __gen_load_Linker();
|
|
|
|
var msg = in_msg~__gen_read_ForwardToWallet();
|
|
|
|
self~$__gen_Linker_receive_ForwardToWallet(msg);
|
|
|
|
__gen_store_Linker(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://QmPdxwain9Y3xSr42K9ApJ5UsTURQZGtDmdhUSMQqrzYux";
|
|
|
|
}
|