Lev
2 years ago
39 changed files with 2878 additions and 32 deletions
@ -0,0 +1,98 @@
|
||||
const subcommand = require('subcommand'); |
||||
|
||||
const { deployTONB, deposit, withdraw, transfer, blacklistAddress } = require('./utils/interactions'); |
||||
const { wallet_data, client } = require('./utils/config'); |
||||
const { randomAddress, TON } = require('./utils/helpers'); |
||||
const { toNano, Address } = require('ton'); |
||||
|
||||
const match = subcommand([ |
||||
{ |
||||
name: 'deposit', |
||||
options: [ |
||||
{ |
||||
name: 'amount', |
||||
help: 'Amount of TON to deposit', |
||||
default: '0.45' |
||||
}, |
||||
{ |
||||
name: 'wallet', |
||||
abbr: 'w', |
||||
default: '0', |
||||
required: false |
||||
} |
||||
], |
||||
async command(opts) { |
||||
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1])); |
||||
let tonb_addr = await deployTONB(undefined, true); |
||||
await deposit(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr); |
||||
} |
||||
}, |
||||
{ |
||||
name: 'withdraw', |
||||
options: [ |
||||
{ |
||||
name: 'amount', |
||||
abbr: 'a', |
||||
help: 'Amount of TON to withdraw', |
||||
default: '0.2' |
||||
}, |
||||
{ |
||||
name: 'wallet', |
||||
abbr: 'w', |
||||
default: '0', |
||||
required: false |
||||
} |
||||
], |
||||
async command(opts) { |
||||
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1])); |
||||
let tonb_addr = await deployTONB(undefined, true); |
||||
await withdraw(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr); |
||||
} |
||||
}, |
||||
{ |
||||
name: 'transfer', |
||||
options: [ |
||||
{ |
||||
name: 'amount', |
||||
help: 'Amount of TON to transfer', |
||||
default: '0.2' |
||||
}, |
||||
{ |
||||
name: 'address', |
||||
help: 'Address to transfer TON to', |
||||
default: randomAddress() |
||||
}], |
||||
async command(opts) { |
||||
let {my_wallet, secretKey} = await wallet_data(); |
||||
let tonb_addr = await deployTONB(undefined, true); |
||||
await transfer(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr, opts._[1]); |
||||
} |
||||
}, |
||||
{ |
||||
name: 'blacklist', |
||||
options: [ |
||||
{ |
||||
name: 'address', |
||||
}, |
||||
{ |
||||
name: 'wallet', |
||||
abbr: 'w', |
||||
default: '0', |
||||
required: false |
||||
} |
||||
], |
||||
async command(opts) { |
||||
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1])); |
||||
let tonb_addr = await deployTONB(undefined, true); |
||||
if (!opts._[0]) { |
||||
opts._[0] = 'kQD7zbEMaWC2yMgSJXmIF7HbLr1yuBo2GnZF_CJNkUiGSVZ8'// my_wallet.address;
|
||||
} |
||||
let addr = Address.parse(opts._[0]); |
||||
await blacklistAddress(my_wallet, secretKey, tonb_addr, addr); |
||||
} |
||||
} |
||||
]); |
||||
const argv = process.argv.slice(2); |
||||
|
||||
let opts = match(argv); |
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,195 @@
|
||||
#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"; |
||||
} |
@ -0,0 +1,311 @@
|
||||
PROGRAM{ |
||||
DECLPROC __tact_not_null |
||||
DECLPROC __tact_context_get |
||||
DECLPROC __tact_verify_address |
||||
DECLPROC __tact_store_bool |
||||
DECLPROC __tact_store_address |
||||
DECLPROC __tact_dict_set_slice_int |
||||
DECLPROC __tact_dict_get_slice_int |
||||
DECLPROC __gen_read_StakingWithdraw |
||||
DECLPROC __gen_write_PseudoStaking |
||||
DECLPROC __gen_read_PseudoStaking |
||||
DECLPROC __gen_load_PseudoStaking |
||||
DECLPROC __gen_store_PseudoStaking |
||||
DECLPROC $send |
||||
DECLPROC $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 |
||||
DECLPROC $__gen_PseudoStaking_receive_StakingWithdraw |
||||
DECLPROC recv_internal |
||||
113617 DECLMETHOD supported_interfaces |
||||
DECLPROC get_abi_ipfs |
||||
DECLGLOBVAR __tact_context |
||||
DECLGLOBVAR __tact_context_sys |
||||
__tact_not_null PROCINLINE:<{ |
||||
DUP |
||||
ISNULL |
||||
128 THROWIF |
||||
}> |
||||
__tact_context_get PROCINLINE:<{ |
||||
__tact_context GETGLOB |
||||
4 UNTUPLE |
||||
}> |
||||
__tact_verify_address PROCINLINE:<{ |
||||
SBITS |
||||
267 PUSHINT |
||||
NEQ |
||||
136 THROWIFNOT |
||||
}> |
||||
__tact_store_bool PROCINLINE:<{ |
||||
SWAP |
||||
1 STI |
||||
}> |
||||
__tact_store_address PROCINLINE:<{ |
||||
STSLICER |
||||
}> |
||||
__tact_dict_set_slice_int PROC:<{ |
||||
OVER |
||||
ISNULL |
||||
IFJMP:<{ |
||||
2DROP |
||||
-ROT |
||||
DICTDEL |
||||
DROP |
||||
}> |
||||
NEWC |
||||
SWAP |
||||
STIX |
||||
s1 s3 s3 XCHG3 |
||||
DICTSETB |
||||
}> |
||||
__tact_dict_get_slice_int PROCINLINE:<{ |
||||
s1 s3 s3 XCHG3 |
||||
DICTGET |
||||
NULLSWAPIFNOT |
||||
IF:<{ |
||||
SWAP |
||||
LDIX |
||||
DROP |
||||
}>ELSE<{ |
||||
2DROP |
||||
PUSHNULL |
||||
}> |
||||
}> |
||||
__gen_read_StakingWithdraw PROCINLINE:<{ |
||||
32 LDU |
||||
SWAP |
||||
3665837821 PUSHINT |
||||
EQUAL |
||||
129 THROWIFNOT |
||||
LDGRAMS |
||||
SWAP |
||||
}> |
||||
__gen_write_PseudoStaking PROCINLINE:<{ |
||||
SWAP |
||||
STDICT |
||||
}> |
||||
__gen_read_PseudoStaking PROCINLINE:<{ |
||||
LDDICT |
||||
SWAP |
||||
}> |
||||
__gen_load_PseudoStaking PROCINLINE:<{ |
||||
c4 PUSH |
||||
CTOS |
||||
LDREF |
||||
SWAP |
||||
__tact_context_sys SETGLOB |
||||
__gen_read_PseudoStaking INLINECALLDICT |
||||
NIP |
||||
}> |
||||
__gen_store_PseudoStaking PROCINLINE:<{ |
||||
NEWC |
||||
__tact_context_sys GETGLOB |
||||
SWAP |
||||
STREF |
||||
SWAP |
||||
__gen_write_PseudoStaking INLINECALLDICT |
||||
ENDC |
||||
c4 POP |
||||
}> |
||||
$send PROCREF:<{ |
||||
NEWC |
||||
1 PUSHINT |
||||
SWAP |
||||
2 STI |
||||
s0 s7 XCHG2 |
||||
__tact_store_bool INLINECALLDICT |
||||
0 PUSHINT |
||||
SWAP |
||||
3 STI |
||||
s0 s5 XCHG2 |
||||
__tact_store_address INLINECALLDICT |
||||
s0 s3 XCHG2 |
||||
STGRAMS |
||||
0 PUSHINT |
||||
SWAP |
||||
105 STI |
||||
s3 PUSH |
||||
ISNULL |
||||
NOT |
||||
s5 PUSH |
||||
ISNULL |
||||
NOT |
||||
OR |
||||
IF:<{ |
||||
TRUE |
||||
__tact_store_bool INLINECALLDICT |
||||
NEWC |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
s4 PUSH |
||||
ISNULL |
||||
NOT |
||||
IF:<{ |
||||
TRUE |
||||
__tact_store_bool INLINECALLDICT |
||||
s0 s4 XCHG |
||||
__tact_not_null INLINECALLDICT |
||||
s0 s4 XCHG2 |
||||
STREF |
||||
}>ELSE<{ |
||||
s4 POP |
||||
s0 s3 XCHG |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
}> |
||||
s4 PUSH |
||||
ISNULL |
||||
NOT |
||||
IF:<{ |
||||
TRUE |
||||
__tact_store_bool INLINECALLDICT |
||||
s0 s4 XCHG |
||||
__tact_not_null INLINECALLDICT |
||||
s0 s4 XCHG2 |
||||
STREF |
||||
}>ELSE<{ |
||||
s4 POP |
||||
s0 s3 XCHG |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
}> |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
s0 s2 XCHG |
||||
TRUE |
||||
__tact_store_bool INLINECALLDICT |
||||
s0 s2 XCHG |
||||
ENDC |
||||
ROT |
||||
STREF |
||||
}>ELSE<{ |
||||
s3 POP |
||||
s3 POP |
||||
SWAP |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
}> |
||||
OVER |
||||
ISNULL |
||||
NOT |
||||
IF:<{ |
||||
TRUE |
||||
__tact_store_bool INLINECALLDICT |
||||
SWAP |
||||
__tact_not_null INLINECALLDICT |
||||
SWAP |
||||
STREF |
||||
}>ELSE<{ |
||||
NIP |
||||
FALSE |
||||
__tact_store_bool INLINECALLDICT |
||||
}> |
||||
ENDC |
||||
SWAP |
||||
SENDRAWMSG |
||||
}> |
||||
$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 PROCINLINE:<{ |
||||
__tact_context_get INLINECALLDICT |
||||
DROP |
||||
s2 POP |
||||
s2 PUSH |
||||
267 PUSHINT |
||||
s2 PUSH |
||||
257 PUSHINT |
||||
__tact_dict_get_slice_int INLINECALLDICT |
||||
DUP |
||||
ISNULL |
||||
IF:<{ |
||||
DROP |
||||
0 PUSHINT |
||||
}> |
||||
267 PUSHINT |
||||
SWAP |
||||
__tact_not_null INLINECALLDICT |
||||
s0 s3 XCHG2 |
||||
ADD |
||||
257 PUSHINT |
||||
__tact_dict_set_slice_int CALLDICT |
||||
}> |
||||
$__gen_PseudoStaking_receive_StakingWithdraw PROCINLINE:<{ |
||||
__tact_context_get INLINECALLDICT |
||||
s2 s3 XCHG |
||||
3 BLKDROP |
||||
TRUE |
||||
s0 s2 XCHG |
||||
0 PUSHINT |
||||
PUSHNULL |
||||
PUSHNULL |
||||
PUSHNULL |
||||
$send INLINECALLDICT |
||||
}> |
||||
recv_internal PROC:<{ |
||||
c2 SAVE |
||||
SAMEALTSAVE |
||||
0 PUSHINT |
||||
OVER |
||||
SBITS |
||||
31 GTINT |
||||
IF:<{ |
||||
DROP |
||||
DUP |
||||
32 PLDU |
||||
}> |
||||
s0 s2 XCHG |
||||
CTOS |
||||
4 LDU |
||||
SWAP |
||||
1 PUSHINT |
||||
AND |
||||
1 EQINT |
||||
IF:<{ |
||||
TRUE |
||||
}>ELSE<{ |
||||
FALSE |
||||
}> |
||||
SWAP |
||||
LDMSGADDR |
||||
s2 PUSH |
||||
s6 s6 XCHG2 |
||||
4 TUPLE |
||||
__tact_context SETGLOB |
||||
s0 s2 XCHG |
||||
IFJMP:<{ |
||||
2DROP |
||||
}> |
||||
DUP |
||||
3665837821 PUSHINT |
||||
EQUAL |
||||
IFJMP:<{ |
||||
DROP |
||||
__gen_load_PseudoStaking INLINECALLDICT |
||||
SWAP |
||||
__gen_read_StakingWithdraw INLINECALLDICT |
||||
NIP |
||||
$__gen_PseudoStaking_receive_StakingWithdraw INLINECALLDICT |
||||
__gen_store_PseudoStaking INLINECALLDICT |
||||
}> |
||||
0 EQINT |
||||
IF:<{ |
||||
HASHSU |
||||
20712925151889215669912116818955575927875783670988084319049521716100301489720 PUSHINT |
||||
EQUAL |
||||
IFJMP:<{ |
||||
__gen_load_PseudoStaking INLINECALLDICT |
||||
$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 INLINECALLDICT |
||||
__gen_store_PseudoStaking INLINECALLDICT |
||||
RETALT |
||||
}> |
||||
}>ELSE<{ |
||||
DROP |
||||
}> |
||||
130 THROW |
||||
}> |
||||
supported_interfaces PROC:<{ |
||||
123515602279859691144772641439386770278 PUSHINT |
||||
209801025412363888721030803524359905849 PUSHINT |
||||
}> |
||||
get_abi_ipfs PROC:<{ |
||||
x{697066733a2f2f516d575567446766574d444a5568394761334d506d71747968754a6e78767a6a77543662344b6133557575744a67} PUSHSLICE |
||||
}> |
||||
}END>c |
@ -0,0 +1,300 @@
|
||||
SETCP0 |
||||
(:methods |
||||
recv_internal: |
||||
c2 SAVE |
||||
SAMEALTSAVE |
||||
0 PUSHINT |
||||
s1 PUSH |
||||
SBITS |
||||
31 GTINT |
||||
<{ |
||||
s0 POP |
||||
s0 PUSH |
||||
32 PLDU |
||||
}> PUSHCONT |
||||
IF |
||||
s0 s2 XCHG |
||||
CTOS |
||||
4 LDU |
||||
s0 s1 XCHG |
||||
1 PUSHINT |
||||
AND |
||||
1 EQINT |
||||
<{ |
||||
-1 PUSHINT |
||||
}> PUSHCONT |
||||
<{ |
||||
0 PUSHINT |
||||
}> PUSHCONT |
||||
IFELSE |
||||
s0 s1 XCHG |
||||
LDMSGADDR |
||||
s2 PUSH |
||||
s6 s6 XCHG2 |
||||
4 TUPLE |
||||
1 SETGLOBVAR |
||||
s0 s2 XCHG |
||||
<{ |
||||
2DROP |
||||
}> PUSHCONT |
||||
IFJMP |
||||
s0 PUSH |
||||
3665837821 PUSHINT |
||||
EQUAL |
||||
<{ |
||||
s0 POP |
||||
c4 PUSH |
||||
CTOS |
||||
LDREF |
||||
s0 s1 XCHG |
||||
2 SETGLOBVAR |
||||
LDDICT |
||||
s0 s1 XCHG |
||||
s1 POP |
||||
s0 s1 XCHG |
||||
32 LDU |
||||
s0 s1 XCHG |
||||
3665837821 PUSHINT |
||||
EQUAL |
||||
129 THROWIFNOT |
||||
LDGRAMS |
||||
s0 s1 XCHG |
||||
s1 POP |
||||
1 GETGLOBVAR |
||||
4 UNTUPLE |
||||
s2 s3 XCHG |
||||
3 BLKDROP |
||||
-1 PUSHINT |
||||
s0 s2 XCHG |
||||
0 PUSHINT |
||||
PUSHNULL |
||||
PUSHNULL |
||||
PUSHNULL |
||||
<{ |
||||
NEWC |
||||
1 PUSHINT |
||||
s0 s1 XCHG |
||||
2 STI |
||||
s0 s7 XCHG2 |
||||
s0 s1 XCHG |
||||
1 STI |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
3 STI |
||||
s0 s5 XCHG2 |
||||
STSLICER |
||||
s0 s3 XCHG2 |
||||
STGRAMS |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
105 STI |
||||
s3 PUSH |
||||
ISNULL |
||||
NOT |
||||
s5 PUSH |
||||
ISNULL |
||||
NOT |
||||
OR |
||||
<{ |
||||
-1 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
NEWC |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s4 PUSH |
||||
ISNULL |
||||
NOT |
||||
<{ |
||||
-1 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s0 s4 XCHG |
||||
s0 PUSH |
||||
ISNULL |
||||
128 THROWIF |
||||
s0 s4 XCHG2 |
||||
STREF |
||||
}> PUSHCONT |
||||
<{ |
||||
s4 POP |
||||
s0 s3 XCHG |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
}> PUSHCONT |
||||
IFELSE |
||||
s4 PUSH |
||||
ISNULL |
||||
NOT |
||||
<{ |
||||
-1 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s0 s4 XCHG |
||||
s0 PUSH |
||||
ISNULL |
||||
128 THROWIF |
||||
s0 s4 XCHG2 |
||||
STREF |
||||
}> PUSHCONT |
||||
<{ |
||||
s4 POP |
||||
s0 s3 XCHG |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
}> PUSHCONT |
||||
IFELSE |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s0 s2 XCHG |
||||
-1 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s0 s2 XCHG |
||||
ENDC |
||||
ROT |
||||
STREF |
||||
}> PUSHCONT |
||||
<{ |
||||
s3 POP |
||||
s3 POP |
||||
s0 s1 XCHG |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
}> PUSHCONT |
||||
IFELSE |
||||
s1 PUSH |
||||
ISNULL |
||||
NOT |
||||
<{ |
||||
-1 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
s0 s1 XCHG |
||||
s0 PUSH |
||||
ISNULL |
||||
128 THROWIF |
||||
s0 s1 XCHG |
||||
STREF |
||||
}> PUSHCONT |
||||
<{ |
||||
s1 POP |
||||
0 PUSHINT |
||||
s0 s1 XCHG |
||||
1 STI |
||||
}> PUSHCONT |
||||
IFELSE |
||||
ENDC |
||||
s0 s1 XCHG |
||||
SENDRAWMSG |
||||
}> CALLREF |
||||
NEWC |
||||
2 GETGLOBVAR |
||||
s0 s1 XCHG |
||||
STREF |
||||
s0 s1 XCHG |
||||
s0 s1 XCHG |
||||
STDICT |
||||
ENDC |
||||
c4 POP |
||||
}> PUSHCONT |
||||
IFJMP |
||||
0 EQINT |
||||
<{ |
||||
s0 POP |
||||
}> PUSHCONT |
||||
<{ |
||||
HASHSU |
||||
20712925151889215669912116818955575927875783670988084319049521716100301489720 PUSHINT |
||||
EQUAL |
||||
<{ |
||||
c4 PUSH |
||||
CTOS |
||||
LDREF |
||||
s0 s1 XCHG |
||||
2 SETGLOBVAR |
||||
LDDICT |
||||
s0 s1 XCHG |
||||
s1 POP |
||||
1 GETGLOBVAR |
||||
4 UNTUPLE |
||||
s0 POP |
||||
s2 POP |
||||
s2 PUSH |
||||
267 PUSHINT |
||||
s2 PUSH |
||||
257 PUSHINT |
||||
s1 s3 s3 XCHG3 |
||||
DICTGET |
||||
NULLSWAPIFNOT |
||||
<{ |
||||
s0 s1 XCHG |
||||
LDI |
||||
s0 POP |
||||
}> PUSHCONT |
||||
<{ |
||||
2DROP |
||||
PUSHNULL |
||||
}> PUSHCONT |
||||
IFELSE |
||||
s0 PUSH |
||||
ISNULL |
||||
<{ |
||||
s0 POP |
||||
0 PUSHINT |
||||
}> PUSHCONT |
||||
IF |
||||
267 PUSHINT |
||||
s0 s1 XCHG |
||||
s0 PUSH |
||||
ISNULL |
||||
128 THROWIF |
||||
s0 s3 XCHG2 |
||||
ADD |
||||
257 PUSHINT |
||||
6 CALLDICT |
||||
NEWC |
||||
2 GETGLOBVAR |
||||
s0 s1 XCHG |
||||
STREF |
||||
s0 s1 XCHG |
||||
s0 s1 XCHG |
||||
STDICT |
||||
ENDC |
||||
c4 POP |
||||
RETALT |
||||
}> PUSHCONT |
||||
IFJMP |
||||
}> IFREFELSE |
||||
130 THROW |
||||
|
||||
6: |
||||
s1 PUSH |
||||
ISNULL |
||||
<{ |
||||
2DROP |
||||
ROTREV |
||||
DICTDEL |
||||
s0 POP |
||||
}> PUSHCONT |
||||
IFJMP |
||||
NEWC |
||||
s0 s1 XCHG |
||||
STIX |
||||
s1 s3 s3 XCHG3 |
||||
DICTSETB |
||||
|
||||
113617: |
||||
123515602279859691144772641439386770278 PUSHINT |
||||
209801025412363888721030803524359905849 PUSHINT |
||||
) 19 DICTPUSHCONST |
||||
DICTIGETJMPZ |
||||
11 THROWARG |
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
#pragma version =0.4.1; |
||||
#pragma allow-post-modification; |
||||
#pragma compute-asm-ltr; |
||||
|
||||
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; |
||||
} |
||||
|
||||
cell $__gen_PseudoStaking_init(cell sys') { |
||||
var (($self'stakes)) = (null()); |
||||
var b' = begin_cell(); |
||||
b' = b'.store_ref(sys'); |
||||
b' = __gen_write_PseudoStaking(b', ($self'stakes)); |
||||
return b'.end_cell(); |
||||
} |
||||
|
||||
cell init(cell sys') method_id { |
||||
return $__gen_PseudoStaking_init(sys'); |
||||
} |
||||
|
||||
() main() { |
||||
} |
@ -0,0 +1,24 @@
|
||||
PROGRAM{ |
||||
DECLPROC __gen_write_PseudoStaking |
||||
DECLPROC $__gen_PseudoStaking_init |
||||
107886 DECLMETHOD init |
||||
DECLPROC main |
||||
__gen_write_PseudoStaking PROCINLINE:<{ |
||||
SWAP |
||||
STDICT |
||||
}> |
||||
$__gen_PseudoStaking_init PROC:<{ |
||||
PUSHNULL |
||||
SWAP |
||||
NEWC |
||||
STREF |
||||
SWAP |
||||
__gen_write_PseudoStaking INLINECALLDICT |
||||
ENDC |
||||
}> |
||||
init PROC:<{ |
||||
$__gen_PseudoStaking_init CALLDICT |
||||
}> |
||||
main PROC:<{ |
||||
}> |
||||
}END>c |
@ -0,0 +1,19 @@
|
||||
SETCP0 |
||||
(:methods |
||||
recv_internal: |
||||
|
||||
2: |
||||
PUSHNULL |
||||
s0 s1 XCHG |
||||
NEWC |
||||
STREF |
||||
s0 s1 XCHG |
||||
s0 s1 XCHG |
||||
STDICT |
||||
ENDC |
||||
|
||||
107886: |
||||
2 CALLDICT |
||||
) 19 DICTPUSHCONST |
||||
DICTIGETJMPZ |
||||
11 THROWARG |
@ -0,0 +1,121 @@
|
||||
# TACT Compilation Report |
||||
Contract: PseudoStaking |
||||
BOC Size: 495 bytes |
||||
|
||||
# Types |
||||
Total Types: 28 |
||||
|
||||
## StateInit |
||||
TLB: `_ code:^cell data:^cell = StateInit` |
||||
Signature: `StateInit{code:^cell,data:^cell}` |
||||
|
||||
## Context |
||||
TLB: `_ bounced:bool sender:address value:int257 raw:^slice = Context` |
||||
Signature: `Context{bounced:bool,sender:address,value:int257,raw:^slice}` |
||||
|
||||
## SendParameters |
||||
TLB: `_ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters` |
||||
Signature: `SendParameters{bounce:bool,to:address,value:int257,mode:int257,body:Maybe ^cell,code:Maybe ^cell,data:Maybe ^cell}` |
||||
|
||||
## TokenTransfer |
||||
TLB: `token_transfer#0f8a7ea5 queryId:uint64 amount:coins destination:address responseDestination:Maybe address customPayload:Maybe ^cell forwardTonAmount:coins forwardPayload:remainder<slice> = TokenTransfer` |
||||
Signature: `TokenTransfer{queryId:uint64,amount:coins,destination:address,responseDestination:Maybe address,customPayload:Maybe ^cell,forwardTonAmount:coins,forwardPayload:remainder<slice>}` |
||||
|
||||
## TokenTransferInternal |
||||
TLB: `token_transfer_internal#178d4519 queryId:uint64 amount:coins from:address responseAddress:Maybe address forwardTonAmount:coins forwardPayload:remainder<slice> setLinker:Maybe int257 setLinkerAddress:Maybe address = TokenTransferInternal` |
||||
Signature: `TokenTransferInternal{queryId:uint64,amount:coins,from:address,responseAddress:Maybe address,forwardTonAmount:coins,forwardPayload:remainder<slice>,setLinker:Maybe int257,setLinkerAddress:Maybe address}` |
||||
|
||||
## TokenNotification |
||||
TLB: `token_notification#7362d09c queryId:uint64 amount:coins from:address forwardPayload:remainder<slice> = TokenNotification` |
||||
Signature: `TokenNotification{queryId:uint64,amount:coins,from:address,forwardPayload:remainder<slice>}` |
||||
|
||||
## TokenBurn |
||||
TLB: `token_burn#595f07bc queryId:uint64 amount:coins owner:address responseAddress:Maybe address = TokenBurn` |
||||
Signature: `TokenBurn{queryId:uint64,amount:coins,owner:address,responseAddress:Maybe address}` |
||||
|
||||
## TokenBurnNotification |
||||
TLB: `token_burn_notification#7bdd97de queryId:uint64 amount:coins owner:address responseAddress:Maybe address = TokenBurnNotification` |
||||
Signature: `TokenBurnNotification{queryId:uint64,amount:coins,owner:address,responseAddress:Maybe address}` |
||||
|
||||
## TokenExcesses |
||||
TLB: `token_excesses#d53276db queryId:uint64 = TokenExcesses` |
||||
Signature: `TokenExcesses{queryId:uint64}` |
||||
|
||||
## TokenUpdateContent |
||||
TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent` |
||||
Signature: `TokenUpdateContent{content:Maybe ^cell}` |
||||
|
||||
## StakingWithdraw |
||||
TLB: `staking_withdraw#da803efd value:coins = StakingWithdraw` |
||||
Signature: `StakingWithdraw{value:coins}` |
||||
|
||||
## JettonData |
||||
TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData` |
||||
Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}` |
||||
|
||||
## JettonWalletData |
||||
TLB: `_ balance:int257 owner:address master:address walletCode:^cell = JettonWalletData` |
||||
Signature: `JettonWalletData{balance:int257,owner:address,master:address,walletCode:^cell}` |
||||
|
||||
## SetLinkerNeighbor |
||||
TLB: `set_linker_neighbor#b3fcf4c1 neighbor:Maybe address = SetLinkerNeighbor` |
||||
Signature: `SetLinkerNeighbor{neighbor:Maybe address}` |
||||
|
||||
## InitLinker |
||||
TLB: `init_linker#67c08154 neighbor:Maybe address walletAmount:int257 walletCode:^cell walletData:^cell walletAddress:address responseAddress:Maybe address = InitLinker` |
||||
Signature: `InitLinker{neighbor:Maybe address,walletAmount:int257,walletCode:^cell,walletData:^cell,walletAddress:address,responseAddress:Maybe address}` |
||||
|
||||
## ForwardToWallet |
||||
TLB: `forward_to_wallet#5d1da2bb body:^cell = ForwardToWallet` |
||||
Signature: `ForwardToWallet{body:^cell}` |
||||
|
||||
## BlacklistWallet |
||||
TLB: `blacklist_wallet#029c8396 wallet:address = BlacklistWallet` |
||||
Signature: `BlacklistWallet{wallet:address}` |
||||
|
||||
## InitiateBlacklistVote |
||||
TLB: `initiate_blacklist_vote#e8fffb0b adminIndex:int257 wallet:address quorum_percent:int257 vote_time:int257 = InitiateBlacklistVote` |
||||
Signature: `InitiateBlacklistVote{adminIndex:int257,wallet:address,quorum_percent:int257,vote_time:int257}` |
||||
|
||||
## InitiateLiquidationVote |
||||
TLB: `initiate_liquidation_vote#11fb862f adminIndex:int257 quorum_percent:int257 vote_time:int257 = InitiateLiquidationVote` |
||||
Signature: `InitiateLiquidationVote{adminIndex:int257,quorum_percent:int257,vote_time:int257}` |
||||
|
||||
## FinishVote |
||||
TLB: `finish_vote#2a574443 voteId:int257 = FinishVote` |
||||
Signature: `FinishVote{voteId:int257}` |
||||
|
||||
## Vote |
||||
TLB: `vote#b670f4ce voteId:int257 adminIndex:int257 vote:int257 = Vote` |
||||
Signature: `Vote{voteId:int257,adminIndex:int257,vote:int257}` |
||||
|
||||
## AddressList |
||||
TLB: `_ addresses:dict<int, address> length:int257 = AddressList` |
||||
Signature: `AddressList{addresses:dict<int, address>,length:int257}` |
||||
|
||||
## Distribution |
||||
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<address, int> = Distribution` |
||||
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}` |
||||
|
||||
## InitiateDistributionVote |
||||
TLB: `initiate_distribution_vote#1078d0b5 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = InitiateDistributionVote` |
||||
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}` |
||||
|
||||
## WithdrawalRequests |
||||
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = WithdrawalRequests` |
||||
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}` |
||||
|
||||
## ChangeOwner |
||||
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner` |
||||
Signature: `ChangeOwner{newOwner:address}` |
||||
|
||||
## Deposit |
||||
TLB: `deposit#21eeb607 amount:coins = Deposit` |
||||
Signature: `Deposit{amount:coins}` |
||||
|
||||
## Withdraw |
||||
TLB: `withdraw#60591510 amount:int257 = Withdraw` |
||||
Signature: `Withdraw{amount:int257}` |
||||
|
||||
# Get Methods |
||||
Total Get Methods: 0 |
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,25 @@
|
||||
// Pseudo staking contract for the tests |
||||
import "./messages"; |
||||
|
||||
contract PseudoStaking { |
||||
stakes: map[Address]Int; |
||||
init() {} |
||||
|
||||
receive("Deposit") { |
||||
let ctx: Context = context(); |
||||
let sender: Address = ctx.sender; |
||||
let ex_stake: Int? = self.stakes.get(sender); |
||||
if (ex_stake == null) { |
||||
ex_stake = 0; |
||||
} |
||||
self.stakes.set(sender, ex_stake!! + ctx.value); |
||||
} |
||||
|
||||
receive(msg: StakingWithdraw) { |
||||
let ctx: Context = context(); |
||||
send(SendParameters { |
||||
value: msg.value, |
||||
to: ctx.sender |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
import { toNano, Address } from "ton"; |
||||
import { ContractSystem } from "ton-emulator"; |
||||
import {TONB} from '../output/jetton_TONB'; |
||||
import { default_content } from '../utils/config'; |
||||
import { TONBWallet } from '../output/jetton_TONBWallet'; |
||||
import { beginCell } from 'ton-core'; |
||||
import { PseudoStaking } from '../output/jetton_PseudoStaking'; |
||||
|
||||
|
||||
|
||||
describe('jetton', () => { |
||||
it('should be able to create a vote', async () => { |
||||
|
||||
// Create jetton
|
||||
let system = await ContractSystem.create(); |
||||
let owner = system.treasure('owner'); |
||||
let contract = system.open(await TONB.fromInit(owner.address, default_content)); |
||||
let tracker = system.track(contract.address); |
||||
}); |
||||
}); |
Loading…
Reference in new issue