Browse Source

Staking withdrawal

master
Lev 2 years ago
parent
commit
5e9dd36037
  1. BIN
      sources/output/jetton_PseudoStaking.code.boc
  2. 69
      sources/output/jetton_PseudoStaking.code.fc
  3. 113
      sources/output/jetton_PseudoStaking.code.fif
  4. 107
      sources/output/jetton_PseudoStaking.code.rev.fif
  5. 2
      sources/output/jetton_PseudoStaking.md
  6. 2
      sources/output/jetton_PseudoStaking.pkg
  7. 4
      sources/output/jetton_PseudoStaking.ts
  8. BIN
      sources/output/jetton_TONB.code.boc
  9. 5
      sources/output/jetton_TONB.code.fc
  10. 28
      sources/output/jetton_TONB.code.fif
  11. 185
      sources/output/jetton_TONB.code.rev.fif
  12. 2
      sources/output/jetton_TONB.md
  13. 2
      sources/output/jetton_TONB.pkg
  14. 4
      sources/output/jetton_TONB.ts
  15. 3
      sources/pseudostaking.tact
  16. 1
      sources/staking.tact
  17. 36
      sources/tests/__snapshots__/jetton.spec.ts.snap
  18. 8
      sources/tests/jetton.spec.ts

BIN
sources/output/jetton_PseudoStaking.code.boc

Binary file not shown.

69
sources/output/jetton_PseudoStaking.code.fc

@ -46,6 +46,63 @@ int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl) inline {
} }
} }
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 { (slice, ((int))) __gen_read_StakingWithdraw(slice sc_0) inline {
throw_unless(129, sc_0~load_uint(32) == 3665837821); throw_unless(129, sc_0~load_uint(32) == 3665837821);
var v'value = sc_0~load_coins(); var v'value = sc_0~load_coins();
@ -76,6 +133,9 @@ builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline {
set_data(b.end_cell()); 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 { () $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; var (($params'bounce, $params'to, $params'value, $params'mode, $params'body, $params'code, $params'data)) = $params;
builder $b = begin_cell(); builder $b = begin_cell();
@ -119,6 +179,13 @@ builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline {
send_raw_message($c, $params'mode); 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 { ((cell), ()) $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638((cell) $self) impure inline {
var ($self'stakes) = $self; var ($self'stakes) = $self;
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
@ -135,7 +202,7 @@ builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline {
var ($self'stakes) = $self; var ($self'stakes) = $self;
var ($msg'value) = $msg; var ($msg'value) = $msg;
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
$send((true, $ctx'sender, $msg'value, 0, null(), null(), null())); $send((true, $ctx'sender, $msg'value, 0, $__gen_String_asComment(__gen_str_2874951020()), null(), null()));
return (($self'stakes), ()); return (($self'stakes), ());
} }

113
sources/output/jetton_PseudoStaking.code.fif

@ -6,12 +6,17 @@ PROGRAM{
DECLPROC __tact_store_address DECLPROC __tact_store_address
DECLPROC __tact_dict_set_slice_int DECLPROC __tact_dict_set_slice_int
DECLPROC __tact_dict_get_slice_int DECLPROC __tact_dict_get_slice_int
DECLPROC __tact_string_builder_start
DECLPROC __tact_string_builder_start_comment
DECLPROC __tact_string_builder_end
DECLPROC __tact_string_builder_append
DECLPROC __gen_read_StakingWithdraw DECLPROC __gen_read_StakingWithdraw
DECLPROC __gen_write_PseudoStaking DECLPROC __gen_write_PseudoStaking
DECLPROC __gen_read_PseudoStaking DECLPROC __gen_read_PseudoStaking
DECLPROC __gen_load_PseudoStaking DECLPROC __gen_load_PseudoStaking
DECLPROC __gen_store_PseudoStaking DECLPROC __gen_store_PseudoStaking
DECLPROC $send DECLPROC $send
DECLPROC $__gen_String_asComment
DECLPROC $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 DECLPROC $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638
DECLPROC $__gen_PseudoStaking_receive_StakingWithdraw DECLPROC $__gen_PseudoStaking_receive_StakingWithdraw
DECLPROC $__gen_PseudoStaking_receive_fallback DECLPROC $__gen_PseudoStaking_receive_fallback
@ -70,6 +75,103 @@ PROGRAM{
PUSHNULL PUSHNULL
}> }>
}> }>
__tact_string_builder_start PROCINLINE:<{
NIL
SWAP
TPUSH
PUSHNULL
TPUSH
}>
__tact_string_builder_start_comment PROCINLINE:<{
NEWC
0 PUSHINT
SWAP
32 STU
__tact_string_builder_start INLINECALLDICT
}>
__tact_string_builder_end PROCINLINE:<{
UNCONS
SWAP
ENDC
WHILE:<{
OVER
ISNULL
NOT
}>DO<{
SWAP
UNCONS
-ROT
STREF
ENDC
}>
NIP
}>
__tact_string_builder_append PROCREF:<{
DUP
SREFS
OVER
SBITS
WHILE:<{
DUP
0 GTINT
s2 PUSH
0 GTINT
OR
}>DO<{
s0 s3 XCHG
UNCONS
127 PUSHINT
s2 PUSH
BBITS
3 RSHIFT#
SUB
s0 s5 XCHG
3 RSHIFT#
s5 s5 XCPU
MIN
DUP
0 GTINT
IF:<{
DUP
3 LSHIFT#
s1 s5 XCHG
LDSLICEX
s3 s3 XCHG2
STSLICER
s0 s1 s4 XCHG3
}>
-ROT
CONS
s4 s1 PUSH2
SUB
0 GTINT
IF:<{
NEWC
SWAP
CONS
s4 s4 XCHG2
SUB
3 LSHIFT#
}>ELSE<{
NIP
s3 POP
0 GTINT
IF:<{
LDREF
DROP
CTOS
DUP
SREFS
OVER
SBITS
}>ELSE<{
0 PUSHINT
DUP
}>
}>
}>
3 BLKDROP
}>
__gen_read_StakingWithdraw PROCINLINE:<{ __gen_read_StakingWithdraw PROCINLINE:<{
32 LDU 32 LDU
SWAP SWAP
@ -205,6 +307,12 @@ PROGRAM{
SWAP SWAP
SENDRAWMSG SENDRAWMSG
}> }>
$__gen_String_asComment PROCREF:<{
__tact_string_builder_start_comment INLINECALLDICT
SWAP
__tact_string_builder_append INLINECALLDICT
__tact_string_builder_end INLINECALLDICT
}>
$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 PROCINLINE:<{ $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 PROCINLINE:<{
__tact_context_get INLINECALLDICT __tact_context_get INLINECALLDICT
DROP DROP
@ -233,9 +341,10 @@ PROGRAM{
s2 s3 XCHG s2 s3 XCHG
3 BLKDROP 3 BLKDROP
TRUE TRUE
s0 s2 XCHG
0 PUSHINT 0 PUSHINT
PUSHNULL B{b5ee9c72410101010014000024576974686472617720636f6d706c65746564f7612edd} B>boc <s PUSHSLICE
$__gen_String_asComment INLINECALLDICT
s2 s4 XCHG
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
$send INLINECALLDICT $send INLINECALLDICT

107
sources/output/jetton_PseudoStaking.code.rev.fif

@ -65,9 +65,111 @@ SETCP0
s2 s3 XCHG s2 s3 XCHG
3 BLKDROP 3 BLKDROP
-1 PUSHINT -1 PUSHINT
s0 s2 XCHG
0 PUSHINT 0 PUSHINT
PUSHSLICE
<{
NEWC
0 PUSHINT
s0 s1 XCHG
32 STU
NIL
s0 s1 XCHG
TPUSH
PUSHNULL PUSHNULL
TPUSH
s0 s1 XCHG
<{
s0 PUSH
SREFS
s1 PUSH
SBITS
<{
s0 PUSH
0 GTINT
s2 PUSH
0 GTINT
OR
}> PUSHCONT
<{
s0 s3 XCHG
2 UNTUPLE
127 PUSHINT
s2 PUSH
BBITS
3 RSHIFT
SUB
s0 s5 XCHG
3 RSHIFT
s5 s5 XCPU
MIN
s0 PUSH
0 GTINT
<{
s0 PUSH
3 LSHIFT
s1 s5 XCHG
LDSLICEX
s3 s3 XCHG2
STSLICER
s0 s1 s4 XCHG3
}> PUSHCONT
IF
ROTREV
PAIR
s4 s1 PUSH2
SUB
0 GTINT
<{
NEWC
s0 s1 XCHG
PAIR
s4 s4 XCHG2
SUB
3 LSHIFT
}> PUSHCONT
<{
s1 POP
s3 POP
0 GTINT
<{
LDREF
s0 POP
CTOS
s0 PUSH
SREFS
s1 PUSH
SBITS
}> PUSHCONT
<{
0 PUSHINT
s0 PUSH
}> PUSHCONT
IFELSE
}> PUSHCONT
IFELSE
}> PUSHCONT
WHILE
3 BLKDROP
}> CALLREF
2 UNTUPLE
s0 s1 XCHG
ENDC
<{
s1 PUSH
ISNULL
NOT
}> PUSHCONT
<{
s0 s1 XCHG
2 UNTUPLE
ROTREV
STREF
ENDC
}> PUSHCONT
WHILE
s1 POP
}> CALLREF
s2 s4 XCHG
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
<{ <{
@ -205,8 +307,7 @@ SETCP0
STDICT STDICT
ENDC ENDC
c4 POP c4 POP
}> PUSHCONT }> IFJMPREF
IFJMP
0 EQINT 0 EQINT
<{ <{
s0 PUSH s0 PUSH

2
sources/output/jetton_PseudoStaking.md

@ -1,6 +1,6 @@
# TACT Compilation Report # TACT Compilation Report
Contract: PseudoStaking Contract: PseudoStaking
BOC Size: 584 bytes BOC Size: 741 bytes
# Types # Types
Total Types: 30 Total Types: 30

2
sources/output/jetton_PseudoStaking.pkg

File diff suppressed because one or more lines are too long

4
sources/output/jetton_PseudoStaking.ts

@ -1519,8 +1519,8 @@ function dictValueParserWithdraw(): DictionaryValue<Withdraw> {
} }
async function PseudoStaking_init() { async function PseudoStaking_init() {
const __init = 'te6ccgEBBgEALQABFP8A9KQT9LzyyAsBAgFiAgMCAs4EBQAJoUrd4AUAAUgAE0bQHIzAEB9ADJg='; const __init = 'te6ccgEBBgEALQABFP8A9KQT9LzyyAsBAgFiAgMCAs4EBQAJoUrd4AUAAUgAE0bQHIzAEB9ADJg=';
const __code = 'te6ccgECCgEAAjwAART/APSkE/S88sgLAQIBYgIDAgLNBAUATaF3owTgudh6ullc9j0J2HOslQo2zQThO6xqWlbI+WZFp15b++LEcwPt120Xb9uBDrpOEPypgQa4WP7wF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coA4skB+wABQshwAcsfbwABb4xtb4wB2zxvIgHJkyFus5YBbyJZzMnoMQ4AuiDXSiHXSZcgwgAiwgCxjkoDbyKAfyLPMasCoQWrAlFVtgggwgCcIKoCFdcYUDPPFkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfA6VLM8k=';
let systemCell = Cell.fromBase64(__system); let systemCell = Cell.fromBase64(__system);
let builder = new TupleBuilder(); let builder = new TupleBuilder();
builder.writeCell(systemCell); builder.writeCell(systemCell);

BIN
sources/output/jetton_TONB.code.boc

Binary file not shown.

5
sources/output/jetton_TONB.code.fc

@ -391,6 +391,10 @@ slice $contractAddress((cell, cell) $s) impure inline_ref {
return (true, $pool, $value, 0, end_cell(store_uint(begin_cell(), 2077040623, 32)), null(), null()); return (true, $pool, $value, 0, end_cell(store_uint(begin_cell(), 2077040623, 32)), null(), null());
} }
(int, slice, int, int, cell, cell, cell) $stakingWithdrawMessage(int $value, slice $pool) impure inline_ref {
return (true, $pool, 50000000, 0, end_cell(store_coins(store_uint(begin_cell(), 3665837821, 32), $value)), null(), null());
}
cell $__gen_TONBWallet_init(cell sys', slice $master, slice $owner) { cell $__gen_TONBWallet_init(cell sys', slice $master, slice $owner) {
var (($self'balance, $self'owner, $self'master, $self'blacklisted, $self'linker, $self'linker_address)) = (null(), null(), null(), false, null(), null()); var (($self'balance, $self'owner, $self'master, $self'blacklisted, $self'linker, $self'linker_address)) = (null(), null(), null(), false, null(), null());
$self'balance = 0; $self'balance = 0;
@ -534,6 +538,7 @@ _ $__gen_get_owner() method_id(83229) {
$self'withdrawal_requests'addresses~__tact_dict_set_int_slice(257, $self'withdrawal_requests'n_requests, $address); $self'withdrawal_requests'addresses~__tact_dict_set_int_slice(257, $self'withdrawal_requests'n_requests, $address);
$self'withdrawal_requests'amounts~__tact_dict_set_int_int(257, $self'withdrawal_requests'n_requests, $value, 257); $self'withdrawal_requests'amounts~__tact_dict_set_int_int(257, $self'withdrawal_requests'n_requests, $value, 257);
$self'withdrawal_requests'n_requests = ($self'withdrawal_requests'n_requests + 1); $self'withdrawal_requests'n_requests = ($self'withdrawal_requests'n_requests + 1);
$send($stakingWithdrawMessage($value, __tact_not_null($self'staking_pool)));
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, $self'in_the_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ()); return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, $self'in_the_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
} }

28
sources/output/jetton_TONB.code.fif

@ -49,6 +49,7 @@ PROGRAM{
DECLPROC $contractAddress DECLPROC $contractAddress
DECLPROC $send DECLPROC $send
DECLPROC $stakingDepositMessage DECLPROC $stakingDepositMessage
DECLPROC $stakingWithdrawMessage
DECLPROC $__gen_TONBWallet_init DECLPROC $__gen_TONBWallet_init
DECLPROC $__gen_TONBWallet_init_child DECLPROC $__gen_TONBWallet_init_child
DECLPROC $__gen_Linker_init DECLPROC $__gen_Linker_init
@ -697,6 +698,21 @@ PROGRAM{
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
}> }>
$stakingWithdrawMessage PROCREF:<{
TRUE
50000000 PUSHINT
0 PUSHINT
NEWC
3665837821 PUSHINT
SWAP
32 STU
s0 s5 XCHG2
STGRAMS
ENDC
s1 s4 s0 XCHG3
PUSHNULL
PUSHNULL
}>
$__gen_TONBWallet_init PROC:<{ $__gen_TONBWallet_init PROC:<{
FALSE FALSE
PUSHNULL PUSHNULL
@ -931,13 +947,17 @@ PROGRAM{
s0 s3 s5 XCPUXC s0 s3 s5 XCPUXC
__tact_dict_set_int_slice INLINECALLDICT __tact_dict_set_int_slice INLINECALLDICT
257 PUSHINT 257 PUSHINT
DUP s3 s0 s0 XC2PU
s3 s4 XCHG s3 s5 s(-2) PU2XC
s4 s0 s2 PUXC2
s6 s6 XCHG2
__tact_dict_set_int_int INLINECALLDICT __tact_dict_set_int_int INLINECALLDICT
SWAP SWAP
INC INC
s5 PUSH
__tact_not_null INLINECALLDICT
s1 s4 XCHG
$stakingWithdrawMessage INLINECALLDICT
$send INLINECALLDICT
ROT
}> }>
$__gen_TONB_receive_Deposit PROCINLINE:<{ $__gen_TONB_receive_Deposit PROCINLINE:<{
__tact_context_get INLINECALLDICT __tact_context_get INLINECALLDICT

185
sources/output/jetton_TONB.code.rev.fif

@ -170,7 +170,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -207,7 +207,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
10 2 -2 PU2XC 10 2 -2 PU2XC
54 CALLDICT 55 CALLDICT
2DUP 2DUP
<{ <{
0 PUSHINT 0 PUSHINT
@ -1199,7 +1199,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -2077,7 +2077,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
s0 s1 XCHG s0 s1 XCHG
4429 PUSHINT 4429 PUSHINT
@ -2500,7 +2500,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
12 2 BLKDROP2 12 2 BLKDROP2
<{ <{
@ -2697,10 +2697,8 @@ SETCP0
}> PUSHCONT }> PUSHCONT
IFELSE IFELSE
257 PUSHINT 257 PUSHINT
s0 PUSH 3 0 0 XC2PU
s3 s4 XCHG 3 5 -2 PU2XC
4 0 2 PUXC2
s6 s6 XCHG2
s1 PUSH s1 PUSH
ISNULL ISNULL
<{ <{
@ -2719,6 +2717,153 @@ SETCP0
IFELSE IFELSE
s0 s1 XCHG s0 s1 XCHG
INC INC
s5 PUSH
s0 PUSH
ISNULL
128 THROWIF
s1 s4 XCHG
<{
-1 PUSHINT
50000000 PUSHINT
0 PUSHINT
NEWC
3665837821 PUSHINT
s0 s1 XCHG
32 STU
s0 s5 XCHG2
STGRAMS
ENDC
s1 s4 s0 XCHG3
PUSHNULL
PUSHNULL
}> CALLREF
<{
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
ROT
}> CALLREF }> CALLREF
}> IFREFELSE }> IFREFELSE
NEWC NEWC
@ -2936,7 +3081,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
<{ <{
0 PUSHINT 0 PUSHINT
@ -3326,7 +3471,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -3373,7 +3518,7 @@ SETCP0
s9 s-1 PUXC s9 s-1 PUXC
s17 PUSH s17 PUSH
s0 s1 XCHG s0 s1 XCHG
54 CALLDICT 55 CALLDICT
2DUP 2DUP
<{ <{
0 PUSHINT 0 PUSHINT
@ -4253,7 +4398,7 @@ SETCP0
IFELSE IFELSE
130 THROW 130 THROW
51: 52:
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
@ -4309,7 +4454,7 @@ SETCP0
STREF STREF
ENDC ENDC
52: 53:
s0 s2 XCHG s0 s2 XCHG
CTOS CTOS
LDDICT LDDICT
@ -4332,9 +4477,9 @@ SETCP0
STDICT STDICT
ENDC ENDC
s0 s0 s3 XCHG3 s0 s0 s3 XCHG3
51 CALLDICT 52 CALLDICT
53: 54:
PUSHNULL PUSHNULL
s0 s4 XCHG s0 s4 XCHG
NEWC NEWC
@ -4366,7 +4511,7 @@ SETCP0
STREF STREF
ENDC ENDC
54: 55:
s0 s3 XCHG s0 s3 XCHG
CTOS CTOS
LDDICT LDDICT
@ -4390,7 +4535,7 @@ SETCP0
ENDC ENDC
3 1 BLKSWAP 3 1 BLKSWAP
s0 s4 XCHG s0 s4 XCHG
53 CALLDICT 54 CALLDICT
owner: owner:
c4 PUSH c4 PUSH
@ -4571,7 +4716,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
12 2 BLKDROP2 12 2 BLKDROP2
<{ <{
@ -4697,7 +4842,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
52 CALLDICT 53 CALLDICT
}> CALLREF }> CALLREF
8 2 BLKDROP2 8 2 BLKDROP2
s0 POP s0 POP

2
sources/output/jetton_TONB.md

@ -1,6 +1,6 @@
# TACT Compilation Report # TACT Compilation Report
Contract: TONB Contract: TONB
BOC Size: 3745 bytes BOC Size: 3785 bytes
# Types # Types
Total Types: 30 Total Types: 30

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

4
sources/output/jetton_TONB.ts

File diff suppressed because one or more lines are too long

3
sources/pseudostaking.tact

@ -19,7 +19,8 @@ contract PseudoStaking {
let ctx: Context = context(); let ctx: Context = context();
send(SendParameters { send(SendParameters {
value: msg.value, value: msg.value,
to: ctx.sender to: ctx.sender,
body: "Withdraw completed".asComment()
}); });
} }

1
sources/staking.tact

@ -79,5 +79,6 @@ trait StakingTrait {
self.withdrawal_requests.addresses.set(self.withdrawal_requests.n_requests, address); self.withdrawal_requests.addresses.set(self.withdrawal_requests.n_requests, address);
self.withdrawal_requests.amounts.set(self.withdrawal_requests.n_requests, value); self.withdrawal_requests.amounts.set(self.withdrawal_requests.n_requests, value);
self.withdrawal_requests.n_requests = self.withdrawal_requests.n_requests + 1; self.withdrawal_requests.n_requests = self.withdrawal_requests.n_requests + 1;
send(stakingWithdrawMessage(value, self.staking_pool!!));
} }
} }

36
sources/tests/__snapshots__/jetton.spec.ts.snap

@ -13,14 +13,14 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
}, },
"bounce": true, "bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P", "from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQBlV9n2WlhBQZuY-iA0VWSTOykYvzU61JiygM950JnqGI58", "to": "kQDN21ZUuydn_R7jdQECoGikDdJkC5lERbPzQ8-F4wkV3B1S",
"type": "internal", "type": "internal",
"value": 1200000000n, "value": 1200000000n,
}, },
"type": "received", "type": "received",
}, },
{ {
"gasUsed": 32815n, "gasUsed": 32790n,
"type": "processed", "type": "processed",
}, },
{ {
@ -31,8 +31,8 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQBlV9n2WlhBQZuY-iA0VWSTOykYvzU61JiygM950JnqGI58", "from": "kQDN21ZUuydn_R7jdQECoGikDdJkC5lERbPzQ8-F4wkV3B1S",
"to": "kQDCv0UFsmlWdo2QSZ_wHaKo10d0x-JIbuOdTa5x6p8rqv-p", "to": "kQCD0xDqEk8PMauelTY9tsV1vLLY_ZKxdKkX65ZI2UWtHyp0",
"type": "internal", "type": "internal",
"value": 11365000n, "value": 11365000n,
}, },
@ -43,13 +43,13 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"messages": [ "messages": [
{ {
"body": { "body": {
"cell": "x{178D4519000000000000000043B9ACA00800CAAFB3ECB4B082833731F44068AAC9267652317E6A75A93165019EF3A133D43100023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_} "cell": "x{178D4519000000000000000043B9ACA008019BB6ACA9764ECFFA3DC6EA020540D1481BA4C81732888B67E6879F0BC6122BB900023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200615FA282D934AB3B46C824CFF80ED1546BA3BA63F1243771CEA6D738F54F95D54_}", x{800000000000000000000000000000000000000000000000000000000000000020041E9887509278798D5CF4A9B1EDB62BADE596C7EC958BA548BF5CB246CA2D68FC_}",
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQBlV9n2WlhBQZuY-iA0VWSTOykYvzU61JiygM950JnqGI58", "from": "kQDN21ZUuydn_R7jdQECoGikDdJkC5lERbPzQ8-F4wkV3B1S",
"to": "kQD36XkQiZgovUNdKm0YESkF9ukWFb4nZ0bhfjR1rWRGnfuH", "to": "kQCW8uN7SGXO3Ev7zU3ufBOBwpfqwb6QByAZqYWUs_cmSweE",
"type": "internal", "type": "internal",
"value": 41723000n, "value": 41723000n,
}, },
@ -69,14 +69,14 @@ exports[`jetton should work correctly with the staking 1`] = `
}, },
"bounce": true, "bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P", "from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQDPsaN8zrq_pbfsttObqfZmkwendx9IOF5giFl71SafPE45", "to": "kQABS2GwT2RO_ayCOq1syTehl_0YJs6awEj1KGZidNqtt7wR",
"type": "internal", "type": "internal",
"value": 100200000000n, "value": 100200000000n,
}, },
"type": "received", "type": "received",
}, },
{ {
"gasUsed": 36098n, "gasUsed": 36073n,
"type": "processed", "type": "processed",
}, },
{ {
@ -87,8 +87,8 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQDPsaN8zrq_pbfsttObqfZmkwendx9IOF5giFl71SafPE45", "from": "kQABS2GwT2RO_ayCOq1syTehl_0YJs6awEj1KGZidNqtt7wR",
"to": "kQCm0JH-Bq_lKD51Ytp7Dz6nuP-_wlohUMWHff55zxHui-f-", "to": "kQDXemLuELhIqpFvUfQjvfbkWV9Xd8h4_e2ejxaVkSDM6zJM",
"type": "internal", "type": "internal",
"value": 11365000n, "value": 11365000n,
}, },
@ -99,13 +99,13 @@ exports[`jetton should work correctly with the staking 1`] = `
"messages": [ "messages": [
{ {
"body": { "body": {
"cell": "x{178D451900000000000000005174876E8008019F6346F99D757F4B6FD96DA73753ECCD260F4EEE3E9070BCC110B2F7AA4D3E7900023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_} "cell": "x{178D451900000000000000005174876E8008000296C3609EC89DFB5904755AD9926F432FFA304D9D358091EA50CCC4E9B55B6F00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200536848FF0357F2941F3AB16D3D879F53DC7FDFE12D10A862C3BEFF3CE788F745C_}", x{80000000000000000000000000000000000000000000000000000000000000002006BBD3177085C245548B7A8FA11DEFB722CAFABBBE43C7EF6CF478B4AC8906675C_}",
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQDPsaN8zrq_pbfsttObqfZmkwendx9IOF5giFl71SafPE45", "from": "kQABS2GwT2RO_ayCOq1syTehl_0YJs6awEj1KGZidNqtt7wR",
"to": "kQArzurjMe3EIlNNuEVtY2MNex06iyKlvOa1oiBoepw42npF", "to": "kQB-9Tm-Ms2IjYzp3kNadOgg6-b1SOP8HvOzjvGbmSmaHo12",
"type": "internal", "type": "internal",
"value": 41715000n, "value": 41715000n,
}, },
@ -120,8 +120,8 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell", "type": "cell",
}, },
"bounce": true, "bounce": true,
"from": "kQDPsaN8zrq_pbfsttObqfZmkwendx9IOF5giFl71SafPE45", "from": "kQABS2GwT2RO_ayCOq1syTehl_0YJs6awEj1KGZidNqtt7wR",
"to": "kQAQUSIm_zYC9VxtmVfOeKhmjxmGLXoU3PR_y7RQR9lxXtJM", "to": "kQB6IAwD4Haze61PlYJmyim_0AB0bs-PNhn8XOUwnkMnEcnp",
"type": "internal", "type": "internal",
"value": 99491421000n, "value": 99491421000n,
}, },

8
sources/tests/jetton.spec.ts

@ -53,7 +53,7 @@ describe('jetton', () => {
await contract.send(owner, { value: toNano('0.1') }, { $$type: "SetStakingPool", staking_pool: pseudostaking_contract.address }); await contract.send(owner, { value: toNano('0.1') }, { $$type: "SetStakingPool", staking_pool: pseudostaking_contract.address });
await system.run(); await system.run();
let tracker = system.track(contract.address); let tracker = system.track(contract.address);
// Mint // Mint - The contract should stake the money
await contract.send(owner, { value: toNano('100.2') }, { $$type: 'Deposit', amount: toNano('100') }); await contract.send(owner, { value: toNano('100.2') }, { $$type: 'Deposit', amount: toNano('100') });
let log = await system.run(); let log = await system.run();
let events = tracker.events(); let events = tracker.events();
@ -61,6 +61,12 @@ describe('jetton', () => {
expect(events).toMatchSnapshot(); expect(events).toMatchSnapshot();
expect((events[4] as any).messages[0].value).toBeGreaterThan(99000000000n); expect((events[4] as any).messages[0].value).toBeGreaterThan(99000000000n);
// Try to withdraw
await contract.send(owner, { value: toNano('0.15') }, { $$type: 'Withdraw', amount: toNano('50') });
await system.run();
events = tracker.events();
// console.log(events);
expect((events[events.length - 1] as any).messages[0].value).toBeGreaterThan(49000000000n);
}); });
it('should correctly work with transfers', async () => { it('should correctly work with transfers', async () => {

Loading…
Cancel
Save