Browse Source

Staking, foundation

master
Lev 2 years ago
parent
commit
7e4ffe0ac5
  1. 49
      sources/foundation.tact
  2. 1
      sources/jetton.tact
  3. 4
      sources/jetton_trait.tact
  4. 12
      sources/messages.tact
  5. 2
      sources/output/jetton_Linker.abi
  6. 2
      sources/output/jetton_Linker.code.fc
  7. 2
      sources/output/jetton_Linker.code.fif
  8. 14
      sources/output/jetton_Linker.md
  9. 2
      sources/output/jetton_Linker.pkg
  10. 124
      sources/output/jetton_Linker.ts
  11. 2
      sources/output/jetton_PseudoStaking.abi
  12. BIN
      sources/output/jetton_PseudoStaking.code.boc
  13. 12
      sources/output/jetton_PseudoStaking.code.fc
  14. 44
      sources/output/jetton_PseudoStaking.code.fif
  15. 434
      sources/output/jetton_PseudoStaking.code.rev.fif
  16. 16
      sources/output/jetton_PseudoStaking.md
  17. 2
      sources/output/jetton_PseudoStaking.pkg
  18. 128
      sources/output/jetton_PseudoStaking.ts
  19. 2
      sources/output/jetton_TONB.abi
  20. BIN
      sources/output/jetton_TONB.code.boc
  21. 50
      sources/output/jetton_TONB.code.fc
  22. 92
      sources/output/jetton_TONB.code.fif
  23. 550
      sources/output/jetton_TONB.code.rev.fif
  24. 16
      sources/output/jetton_TONB.md
  25. 2
      sources/output/jetton_TONB.pkg
  26. 133
      sources/output/jetton_TONB.ts
  27. 2
      sources/output/jetton_TONBWallet.abi
  28. 2
      sources/output/jetton_TONBWallet.code.fc
  29. 2
      sources/output/jetton_TONBWallet.code.fif
  30. 14
      sources/output/jetton_TONBWallet.md
  31. 2
      sources/output/jetton_TONBWallet.pkg
  32. 124
      sources/output/jetton_TONBWallet.ts
  33. 4218
      sources/output/types.json
  34. 10
      sources/pseudostaking.tact
  35. 22
      sources/staking.tact
  36. 36
      sources/tests/__snapshots__/jetton.spec.ts.snap
  37. 11
      sources/tests/jetton.spec.ts
  38. 11
      sources/utils/compile_types.py

49
sources/foundation.tact

@ -33,6 +33,7 @@ contract Foundation {
admins: Distribution/* Distribution is defined in messages.tact */; admins: Distribution/* Distribution is defined in messages.tact */;
tonb: Address; tonb: Address;
votes: map[Int]Vote; votes: map[Int]Vote;
profits: map[Address]Int;
n_votes: Int; n_votes: Int;
init(admins: Distribution, founders: AddressList, tonb: Address) { init(admins: Distribution, founders: AddressList, tonb: Address) {
@ -177,4 +178,52 @@ contract Foundation {
self.votes.set(self.n_votes, vote); self.votes.set(self.n_votes, vote);
self.n_votes = self.n_votes + 1; self.n_votes = self.n_votes + 1;
} }
receive(msg: Unstake /* staking profits */) {
// If this is sent by TONB, it means that this is receiving stake profits
let ctx: Context = context();
if (ctx.sender == self.tonb) {
let value: Int = ctx.value;
let i: Int = 0;
while (i < self.admins.addresses.length) {
let addr: Address = self.admins.addresses.addresses.get(i)!!;
let percent: Int = self.admins.percents.percents.get(i)!!;
let amount: Int = value * percent / 100;
// todo: record the profit
let current_profit: Int = 0;
let profit_record: Int? = self.profits.get(addr);
if (profit_record != null) {
current_profit = profit_record!!;
}
self.profits.set(addr, current_profit + amount);
i = i + 1;
}
}
}
receive(msg: RequestUnstake) {
// If this is sent by one of the founders, it means that the user wants to unstake
let ctx: Context = context();
require(self.founders.get(msg.founderIndex) == ctx.sender, "Only a founder can request unstake");
send(SendParameters{
to: self.tonb,
value: msg.amount,
mode: SendRemainingValue,
body: Unstake { amount: 0 }.toCell()
});
}
receive(msg: CollectProfit) {
let ctx: Context = context();
require(self.admins.addresses.addresses.get(msg.adminIndex) == ctx.sender, "Only an admin can collect profit");
let profit: Int? = self.profits.get(ctx.sender);
require(profit != null, "No profit to collect");
let amount: Int = profit!!;
self.profits.set(ctx.sender, 0);
send(SendParameters{
to: ctx.sender,
value: amount - withdraw_gas_consumption,
mode: SendRemainingValue
});
}
} }

1
sources/jetton.tact

@ -29,7 +29,6 @@ contract TONB with TONBTrait {
staking_pool: Address?; staking_pool: Address?;
in_the_pool: Int = 0; in_the_pool: Int = 0;
withdrawal_requests: WithdrawalRequests; withdrawal_requests: WithdrawalRequests;
requested_withdrawal: Int = 0;
init(owner: Address, content: Cell?, staking_pool: Address?) { init(owner: Address, content: Cell?, staking_pool: Address?) {
self.totalSupply = 0; self.totalSupply = 0;

4
sources/jetton_trait.tact

@ -23,8 +23,6 @@ trait TONBTrait with Ownable, StakingTrait {
staking_pool: Address?; staking_pool: Address?;
in_the_pool: Int = 0; in_the_pool: Int = 0;
withdrawal_requests: WithdrawalRequests; withdrawal_requests: WithdrawalRequests;
requested_withdrawal: Int = 0;
// //
// Receivers // Receivers
@ -52,7 +50,7 @@ trait TONBTrait with Ownable, StakingTrait {
let diff: Int = msg.amount - available; let diff: Int = msg.amount - available;
send(SendParameters{ send(SendParameters{
to: msg.owner, to: msg.owner,
value: myBalance() - tonb_floor, value: myBalance() - tonb_floor - withdraw_gas_consumption,
bounce: false bounce: false
}); });
let body: Cell = TokenTransferInternal{ let body: Cell = TokenTransferInternal{

12
sources/messages.tact

@ -134,3 +134,15 @@ message SetStakingPool {
message RequestLinker { message RequestLinker {
client: Address; client: Address;
} }
message Unstake {
amount: Int;
}
message RequestUnstake {
founderIndex: Int;
}
message CollectProfit {
adminIndex: Int;
}

2
sources/output/jetton_Linker.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_Linker.code.fc

@ -229,5 +229,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmUSvHrma2CS7pvfxCP2ZnYPCvVGM3Z1FstSNW6u8M2T4h"; return "ipfs://QmeGA7QUi3FCDzQtd9VhqDi1VpHx2sbycwoWaDsMsQNDS3";
} }

2
sources/output/jetton_Linker.code.fif

@ -354,6 +354,6 @@ PROGRAM{
209801025412363888721030803524359905849 PUSHINT 209801025412363888721030803524359905849 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d55537648726d6132435337707666784350325a6e5950437656474d335a31467374534e573675384d32543468} PUSHSLICE x{697066733a2f2f516d65474137515569334643447a51746439566871446931567048783273627963776f576144734d73514e445333} PUSHSLICE
}> }>
}END>c }END>c

14
sources/output/jetton_Linker.md

@ -3,7 +3,7 @@ Contract: Linker
BOC Size: 645 bytes BOC Size: 645 bytes
# Types # Types
Total Types: 30 Total Types: 33
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -109,6 +109,18 @@ Signature: `SetStakingPool{staking_pool:Maybe address}`
TLB: `request_linker#5a29431e client:address = RequestLinker` TLB: `request_linker#5a29431e client:address = RequestLinker`
Signature: `RequestLinker{client:address}` Signature: `RequestLinker{client:address}`
## Unstake
TLB: `unstake#ba522821 amount:int257 = Unstake`
Signature: `Unstake{amount:int257}`
## RequestUnstake
TLB: `request_unstake#e9cedf7f founderIndex:int257 = RequestUnstake`
Signature: `RequestUnstake{founderIndex:int257}`
## CollectProfit
TLB: `collect_profit#51912735 adminIndex:int257 = CollectProfit`
Signature: `CollectProfit{adminIndex:int257}`
## WithdrawalRequests ## WithdrawalRequests
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = 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}` Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`

2
sources/output/jetton_Linker.pkg

File diff suppressed because one or more lines are too long

124
sources/output/jetton_Linker.ts

@ -1345,6 +1345,129 @@ function dictValueParserRequestLinker(): DictionaryValue<RequestLinker> {
} }
} }
} }
export type Unstake = {
$$type: 'Unstake';
amount: bigint;
}
export function storeUnstake(src: Unstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3125946401, 32);
b_0.storeInt(src.amount, 257);
};
}
export function loadUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3125946401) { throw Error('Invalid prefix'); }
let _amount = sc_0.loadIntBig(257);
return { $$type: 'Unstake' as const, amount: _amount };
}
function loadTupleUnstake(source: TupleReader) {
let _amount = source.readBigNumber();
return { $$type: 'Unstake' as const, amount: _amount };
}
function storeTupleUnstake(source: Unstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.amount);
return builder.build();
}
function dictValueParserUnstake(): DictionaryValue<Unstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeUnstake(src)).endCell());
},
parse: (src) => {
return loadUnstake(src.loadRef().beginParse());
}
}
}
export type RequestUnstake = {
$$type: 'RequestUnstake';
founderIndex: bigint;
}
export function storeRequestUnstake(src: RequestUnstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3922648959, 32);
b_0.storeInt(src.founderIndex, 257);
};
}
export function loadRequestUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3922648959) { throw Error('Invalid prefix'); }
let _founderIndex = sc_0.loadIntBig(257);
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function loadTupleRequestUnstake(source: TupleReader) {
let _founderIndex = source.readBigNumber();
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function storeTupleRequestUnstake(source: RequestUnstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.founderIndex);
return builder.build();
}
function dictValueParserRequestUnstake(): DictionaryValue<RequestUnstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeRequestUnstake(src)).endCell());
},
parse: (src) => {
return loadRequestUnstake(src.loadRef().beginParse());
}
}
}
export type CollectProfit = {
$$type: 'CollectProfit';
adminIndex: bigint;
}
export function storeCollectProfit(src: CollectProfit) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(1368467253, 32);
b_0.storeInt(src.adminIndex, 257);
};
}
export function loadCollectProfit(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 1368467253) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function loadTupleCollectProfit(source: TupleReader) {
let _adminIndex = source.readBigNumber();
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function storeTupleCollectProfit(source: CollectProfit) {
let builder = new TupleBuilder();
builder.writeNumber(source.adminIndex);
return builder.build();
}
function dictValueParserCollectProfit(): DictionaryValue<CollectProfit> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeCollectProfit(src)).endCell());
},
parse: (src) => {
return loadCollectProfit(src.loadRef().beginParse());
}
}
}
export type WithdrawalRequests = { export type WithdrawalRequests = {
$$type: 'WithdrawalRequests'; $$type: 'WithdrawalRequests';
addresses: Dictionary<bigint, Address>; addresses: Dictionary<bigint, Address>;
@ -1577,6 +1700,7 @@ const Linker_errors: { [key: number]: { message: string } } = {
32366: { message: `not enough money for deposit` }, 32366: { message: `not enough money for deposit` },
41207: { message: `invalid sender` }, 41207: { message: `invalid sender` },
44816: { message: `Wallet is blacklisted` }, 44816: { message: `Wallet is blacklisted` },
61265: { message: `Only the owner can trigger un-staking` },
62972: { message: `Invalid balance` }, 62972: { message: `Invalid balance` },
} }

2
sources/output/jetton_PseudoStaking.abi

File diff suppressed because one or more lines are too long

BIN
sources/output/jetton_PseudoStaking.code.boc

Binary file not shown.

12
sources/output/jetton_PseudoStaking.code.fc

@ -202,7 +202,15 @@ cell $__gen_String_asComment(slice $self) impure inline_ref {
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, $__gen_String_asComment(__gen_str_2874951020()), null(), null())); 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), ()); return (($self'stakes), ());
} }
@ -276,5 +284,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmPwuNr3oQ5NQcD4Xd7t7WX9wnsfuhfVhNMNuVNSKXHm5R"; return "ipfs://QmTpVYvpJy7wvLrPak1F6KJSC44yccvcdix7pmrnjZmAHa";
} }

44
sources/output/jetton_PseudoStaking.code.fif

@ -340,11 +340,53 @@ PROGRAM{
__tact_context_get INLINECALLDICT __tact_context_get INLINECALLDICT
s2 s3 XCHG s2 s3 XCHG
3 BLKDROP 3 BLKDROP
OVER
0 EQINT
IF:<{
NIP
OVER
267 PUSHINT
s2 PUSH
257 PUSHINT
__tact_dict_get_slice_int INLINECALLDICT
__tact_not_null INLINECALLDICT
110 MULCONST
100 PUSHINT
DIV
SWAP
}>
267 PUSHINT
s3 s0 s1 PUSH3
257 PUSHINT
__tact_dict_get_slice_int INLINECALLDICT
__tact_not_null INLINECALLDICT
s3 PUSH
SUB
s2 PUSH
s3 s5 XCHG
SWAP
257 PUSHINT
__tact_dict_set_slice_int CALLDICT
DUP
267 PUSHINT
s4 PUSH
257 PUSHINT
__tact_dict_get_slice_int INLINECALLDICT
__tact_not_null INLINECALLDICT
0 LESSINT
IF:<{
267 PUSHINT
s3 PUSH
0 PUSHINT
257 PUSHINT
__tact_dict_set_slice_int CALLDICT
}>
TRUE TRUE
0 PUSHINT 0 PUSHINT
B{b5ee9c72410101010014000024576974686472617720636f6d706c65746564f7612edd} B>boc <s PUSHSLICE B{b5ee9c72410101010014000024576974686472617720636f6d706c65746564f7612edd} B>boc <s PUSHSLICE
$__gen_String_asComment INLINECALLDICT $__gen_String_asComment INLINECALLDICT
s2 s4 XCHG s2 s4 XCHG
s3 s5 XCHG
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
$send INLINECALLDICT $send INLINECALLDICT
@ -448,6 +490,6 @@ PROGRAM{
209801025412363888721030803524359905849 PUSHINT 209801025412363888721030803524359905849 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d5077754e72336f51354e516344345864377437575839776e736675686656684e4d4e75564e534b58486d3552} PUSHSLICE x{697066733a2f2f516d5470565976704a793777764c7250616b3146364b4a53433434796363766364697837706d726e6a5a6d414861} PUSHSLICE
}> }>
}END>c }END>c

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

@ -60,243 +60,330 @@ SETCP0
LDGRAMS LDGRAMS
s0 s1 XCHG s0 s1 XCHG
s1 POP s1 POP
1 GETGLOBVAR
4 UNTUPLE
s2 s3 XCHG
3 BLKDROP
-1 PUSHINT
0 PUSHINT
PUSHSLICE
<{ <{
NEWC 1 GETGLOBVAR
0 PUSHINT 4 UNTUPLE
s0 s1 XCHG s2 s3 XCHG
32 STU 3 BLKDROP
NIL s1 PUSH
s0 s1 XCHG 0 EQINT
TPUSH
PUSHNULL
TPUSH
s0 s1 XCHG
<{ <{
s0 PUSH s1 POP
SREFS
s1 PUSH s1 PUSH
SBITS 267 PUSHINT
s2 PUSH
257 PUSHINT
s1 s3 s3 XCHG3
DICTGET
NULLSWAPIFNOT
<{ <{
s0 PUSH s0 s1 XCHG
0 GTINT LDI
s2 PUSH s0 POP
0 GTINT
OR
}> PUSHCONT }> PUSHCONT
<{ <{
s0 s3 XCHG 2DROP
2 UNTUPLE PUSHNULL
127 PUSHINT }> PUSHCONT
s2 PUSH IFELSE
BBITS s0 PUSH
3 RSHIFT ISNULL
SUB 128 THROWIF
s0 s5 XCHG 110 MULCONST
3 RSHIFT 100 PUSHINT
s5 s5 XCPU DIV QOUT
MIN s0 s1 XCHG
}> PUSHCONT
IF
267 PUSHINT
3 0 1 PUSH3
257 PUSHINT
s1 s3 s3 XCHG3
DICTGET
NULLSWAPIFNOT
<{
s0 s1 XCHG
LDI
s0 POP
}> PUSHCONT
<{
2DROP
PUSHNULL
}> PUSHCONT
IFELSE
s0 PUSH
ISNULL
128 THROWIF
s3 PUSH
SUB
s2 PUSH
s3 s5 XCHG
s0 s1 XCHG
257 PUSHINT
6 CALLDICT
s0 PUSH
267 PUSHINT
s4 PUSH
257 PUSHINT
s1 s3 s3 XCHG3
DICTGET
NULLSWAPIFNOT
<{
s0 s1 XCHG
LDI
s0 POP
}> PUSHCONT
<{
2DROP
PUSHNULL
}> PUSHCONT
IFELSE
s0 PUSH
ISNULL
128 THROWIF
0 LESSINT
<{
267 PUSHINT
s3 PUSH
0 PUSHINT
257 PUSHINT
6 CALLDICT
}> IFREF
-1 PUSHINT
0 PUSHINT
PUSHSLICE
<{
NEWC
0 PUSHINT
s0 s1 XCHG
32 STU
NIL
s0 s1 XCHG
TPUSH
PUSHNULL
TPUSH
s0 s1 XCHG
<{
s0 PUSH s0 PUSH
0 GTINT SREFS
s1 PUSH
SBITS
<{ <{
s0 PUSH s0 PUSH
3 LSHIFT 0 GTINT
s1 s5 XCHG s2 PUSH
LDSLICEX 0 GTINT
s3 s3 XCHG2 OR
STSLICER
s0 s1 s4 XCHG3
}> PUSHCONT }> PUSHCONT
IF
ROTREV
PAIR
s4 s1 PUSH2
SUB
0 GTINT
<{ <{
NEWC s0 s3 XCHG
s0 s1 XCHG 2 UNTUPLE
PAIR 127 PUSHINT
s4 s4 XCHG2 s2 PUSH
BBITS
3 RSHIFT
SUB SUB
3 LSHIFT s0 s5 XCHG
}> PUSHCONT 3 RSHIFT
<{ s5 s5 XCPU
s1 POP MIN
s3 POP s0 PUSH
0 GTINT 0 GTINT
<{ <{
LDREF
s0 POP
CTOS
s0 PUSH s0 PUSH
SREFS 3 LSHIFT
s1 PUSH s1 s5 XCHG
SBITS LDSLICEX
s3 s3 XCHG2
STSLICER
s0 s1 s4 XCHG3
}> PUSHCONT }> PUSHCONT
IF
ROTREV
PAIR
s4 s1 PUSH2
SUB
0 GTINT
<{ <{
0 PUSHINT NEWC
s0 PUSH 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 }> PUSHCONT
IFELSE IFELSE
}> PUSHCONT }> PUSHCONT
IFELSE WHILE
3 BLKDROP
}> CALLREF
2 UNTUPLE
s0 s1 XCHG
ENDC
<{
s1 PUSH
ISNULL
NOT
}> PUSHCONT
<{
s0 s1 XCHG
2 UNTUPLE
ROTREV
STREF
ENDC
}> PUSHCONT }> PUSHCONT
WHILE WHILE
3 BLKDROP s1 POP
}> CALLREF }> CALLREF
2 UNTUPLE s2 s4 XCHG
s0 s1 XCHG s3 s5 XCHG
ENDC PUSHNULL
<{ PUSHNULL
s1 PUSH
ISNULL
NOT
}> PUSHCONT
<{ <{
NEWC
1 PUSHINT
s0 s1 XCHG s0 s1 XCHG
2 UNTUPLE 2 STI
ROTREV s0 s7 XCHG2
STREF
ENDC
}> PUSHCONT
WHILE
s1 POP
}> CALLREF
s2 s4 XCHG
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 s0 s1 XCHG
1 STI 1 STI
NEWC
0 PUSHINT 0 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 3 STI
s0 s5 XCHG2
STSLICER
s0 s3 XCHG2
STGRAMS
0 PUSHINT 0 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 105 STI
s4 PUSH s3 PUSH
ISNULL ISNULL
NOT NOT
s5 PUSH
ISNULL
NOT
OR
<{ <{
-1 PUSHINT -1 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
s0 s4 XCHG NEWC
s0 PUSH 0 PUSHINT
s0 s1 XCHG
1 STI
0 PUSHINT
s0 s1 XCHG
1 STI
s4 PUSH
ISNULL ISNULL
128 THROWIF NOT
s0 s4 XCHG2 <{
-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 STREF
}> PUSHCONT }> PUSHCONT
<{ <{
s4 POP s3 POP
s0 s3 XCHG s3 POP
s0 s1 XCHG
0 PUSHINT 0 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
}> PUSHCONT }> PUSHCONT
IFELSE IFELSE
s4 PUSH s1 PUSH
ISNULL ISNULL
NOT NOT
<{ <{
-1 PUSHINT -1 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
s0 s4 XCHG s0 s1 XCHG
s0 PUSH s0 PUSH
ISNULL ISNULL
128 THROWIF 128 THROWIF
s0 s4 XCHG2 s0 s1 XCHG
STREF STREF
}> PUSHCONT }> PUSHCONT
<{ <{
s4 POP s1 POP
s0 s3 XCHG
0 PUSHINT 0 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
}> PUSHCONT }> PUSHCONT
IFELSE IFELSE
0 PUSHINT
s0 s1 XCHG
1 STI
s0 s2 XCHG
-1 PUSHINT
s0 s1 XCHG
1 STI
s0 s2 XCHG
ENDC ENDC
ROT
STREF
}> PUSHCONT
<{
s3 POP
s3 POP
s0 s1 XCHG
0 PUSHINT
s0 s1 XCHG s0 s1 XCHG
1 STI SENDRAWMSG
}> PUSHCONT }> CALLREF
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 }> CALLREF
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -307,7 +394,8 @@ SETCP0
STDICT STDICT
ENDC ENDC
c4 POP c4 POP
}> IFJMPREF }> PUSHCONT
IFJMP
0 EQINT 0 EQINT
<{ <{
s0 PUSH s0 PUSH

16
sources/output/jetton_PseudoStaking.md

@ -1,9 +1,9 @@
# TACT Compilation Report # TACT Compilation Report
Contract: PseudoStaking Contract: PseudoStaking
BOC Size: 741 bytes BOC Size: 876 bytes
# Types # Types
Total Types: 30 Total Types: 33
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -109,6 +109,18 @@ Signature: `SetStakingPool{staking_pool:Maybe address}`
TLB: `request_linker#5a29431e client:address = RequestLinker` TLB: `request_linker#5a29431e client:address = RequestLinker`
Signature: `RequestLinker{client:address}` Signature: `RequestLinker{client:address}`
## Unstake
TLB: `unstake#ba522821 amount:int257 = Unstake`
Signature: `Unstake{amount:int257}`
## RequestUnstake
TLB: `request_unstake#e9cedf7f founderIndex:int257 = RequestUnstake`
Signature: `RequestUnstake{founderIndex:int257}`
## CollectProfit
TLB: `collect_profit#51912735 adminIndex:int257 = CollectProfit`
Signature: `CollectProfit{adminIndex:int257}`
## WithdrawalRequests ## WithdrawalRequests
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = 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}` Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`

2
sources/output/jetton_PseudoStaking.pkg

File diff suppressed because one or more lines are too long

128
sources/output/jetton_PseudoStaking.ts

@ -1345,6 +1345,129 @@ function dictValueParserRequestLinker(): DictionaryValue<RequestLinker> {
} }
} }
} }
export type Unstake = {
$$type: 'Unstake';
amount: bigint;
}
export function storeUnstake(src: Unstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3125946401, 32);
b_0.storeInt(src.amount, 257);
};
}
export function loadUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3125946401) { throw Error('Invalid prefix'); }
let _amount = sc_0.loadIntBig(257);
return { $$type: 'Unstake' as const, amount: _amount };
}
function loadTupleUnstake(source: TupleReader) {
let _amount = source.readBigNumber();
return { $$type: 'Unstake' as const, amount: _amount };
}
function storeTupleUnstake(source: Unstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.amount);
return builder.build();
}
function dictValueParserUnstake(): DictionaryValue<Unstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeUnstake(src)).endCell());
},
parse: (src) => {
return loadUnstake(src.loadRef().beginParse());
}
}
}
export type RequestUnstake = {
$$type: 'RequestUnstake';
founderIndex: bigint;
}
export function storeRequestUnstake(src: RequestUnstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3922648959, 32);
b_0.storeInt(src.founderIndex, 257);
};
}
export function loadRequestUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3922648959) { throw Error('Invalid prefix'); }
let _founderIndex = sc_0.loadIntBig(257);
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function loadTupleRequestUnstake(source: TupleReader) {
let _founderIndex = source.readBigNumber();
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function storeTupleRequestUnstake(source: RequestUnstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.founderIndex);
return builder.build();
}
function dictValueParserRequestUnstake(): DictionaryValue<RequestUnstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeRequestUnstake(src)).endCell());
},
parse: (src) => {
return loadRequestUnstake(src.loadRef().beginParse());
}
}
}
export type CollectProfit = {
$$type: 'CollectProfit';
adminIndex: bigint;
}
export function storeCollectProfit(src: CollectProfit) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(1368467253, 32);
b_0.storeInt(src.adminIndex, 257);
};
}
export function loadCollectProfit(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 1368467253) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function loadTupleCollectProfit(source: TupleReader) {
let _adminIndex = source.readBigNumber();
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function storeTupleCollectProfit(source: CollectProfit) {
let builder = new TupleBuilder();
builder.writeNumber(source.adminIndex);
return builder.build();
}
function dictValueParserCollectProfit(): DictionaryValue<CollectProfit> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeCollectProfit(src)).endCell());
},
parse: (src) => {
return loadCollectProfit(src.loadRef().beginParse());
}
}
}
export type WithdrawalRequests = { export type WithdrawalRequests = {
$$type: 'WithdrawalRequests'; $$type: 'WithdrawalRequests';
addresses: Dictionary<bigint, Address>; addresses: Dictionary<bigint, Address>;
@ -1519,8 +1642,8 @@ function dictValueParserWithdraw(): DictionaryValue<Withdraw> {
} }
async function PseudoStaking_init() { async function PseudoStaking_init() {
const __init = 'te6ccgEBBgEALQABFP8A9KQT9LzyyAsBAgFiAgMCAs4EBQAJoUrd4AUAAUgAE0bQHIzAEB9ADJg='; const __init = 'te6ccgEBBgEALQABFP8A9KQT9LzyyAsBAgFiAgMCAs4EBQAJoUrd4AUAAUgAE0bQHIzAEB9ADJg=';
const __code = 'te6ccgECDQEAAtkAART/APSkE/S88sgLAQIBYgIDAgLNBAUATaF3owTgudh6ullc9j0J2HOslQo2zQThO6xqWlbI+WZFp15b++LEcwOP120Xb9uBDrpOEPypgQa4WP7wFoaYGAuNhgAMi/yLhxAP0gESgzN4J8MIFIrfAQQQhtQB9+3XGBYABxgHaiaGoA/DF6AgCYgMBgcIACNohbpVbWfRZMODIAc8AQTP0QYCojDtRNDUAfhi9AQBMQHTHwGCENqAPv268uCB+gABMfhBbyQQI18Df3CNBJXaXRoZHJhdyBjb21wbGV0ZWSDbPBAkbW3bPMj4QgHMAQH0AMntVAkKAO4g+QGC8C3LGaW4nbnTN3/GUcb5trktub5iQGDGKlBXLNyXloY4uo5OMO1E0NQB+GL0BAEx+EFvJDAyIoEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbpIwcN6BAQsBIG7y0IBQA6CBAQHwBsj4QgHMAQH0AMntVNsx4ACa0x8wghB7zR/vuo40+EFvJDAyIoEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbpIwcN6BAQsBIG7y0IBQA6CBAQHwBt7I+EIBzAEB9ADJ7VQBQshwAcsfbwABb4xtb4wB2zxvIgHJkyFus5YBbyJZzMnoMQsB9shxAcoBUAcBygBwAcoCUAXPFlAD+gJwAcpoI26zJW6zsY5MfwHKAMhwAcoAcAHKACRus51/AcoABCBu8tCAUATMljQDcAHKAOIkbrOdfwHKAAQgbvLQgFAEzJY0A3ABygDicAHKAAJ/AcoAAslYzJczMwFwAcoA4iFuswwAuiDXSiHXSZcgwgAiwgCxjkoDbyKAfyLPMasCoQWrAlFVtgggwgCcIKoCFdcYUDPPFkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfAwAwnH8BygABIG7y0IABzJUxcAHKAOLJAfsA'; const __code = 'te6ccgECDwEAA2AAART/APSkE/S88sgLAQIBYgIDAgLNBAUATaF3owTgudh6ullc9j0J2HOslQo2zQThO6xqWlbI+WZFp15b++LEcwPp120Xb9uBDrpOEPypgQa4WP7wFoaYGAuNhgAMi/yLhxAP0gESgzN4J8MIFIrfAQQQhtQB9+3UdWGHaiaGoA/DF6AgCYgOmPgMEIbUAfft15cED9AACY7Z5kfCEA5gCA+gBk9qpwYABxgHaiaGoA/DF6AgCYgMBgcIACNohbpVbWfRZMODIAc8AQTP0QYC9vhBbyQQI18DIcAAjiQxIYEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbvLQgKdugGSpBAHegQELVHMBgQEBQTP0Cm+hlAHXADCSW23iIG7y0IAjoSIQNQGBAQHwBiCBAQskgQEBQTP0Cm+hlAHXADCSW23iIG7y0IDBAOMAfwkKAO4g+QGC8C3LGaW4nbnTN3/GUcb5trktub5iQGDGKlBXLNyXloY4uo5OMO1E0NQB+GL0BAEx+EFvJDAyIoEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbpIwcN6BAQsBIG7y0IBQA6CBAQHwBsj4QgHMAQH0AMntVNsx4ACa0x8wghB7zR/vuo40+EFvJDAyIoEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbpIwcN6BAQsBIG7y0IBQA6CBAQHwBt7I+EIBzAEB9ADJ7VQAFIEBCyNwgQEB8AYCQHCNBJXaXRoZHJhdyBjb21wbGV0ZWSDbPBAkEDVtbds8CwwBQshwAcsfbwABb4xtb4wB2zxvIgHJkyFus5YBbyJZzMnoMQ0B9shxAcoBUAcBygBwAcoCUAXPFlAD+gJwAcpoI26zJW6zsY5MfwHKAMhwAcoAcAHKACRus51/AcoABCBu8tCAUATMljQDcAHKAOIkbrOdfwHKAAQgbvLQgFAEzJY0A3ABygDicAHKAAJ/AcoAAslYzJczMwFwAcoA4iFusw4AuiDXSiHXSZcgwgAiwgCxjkoDbyKAfyLPMasCoQWrAlFVtgggwgCcIKoCFdcYUDPPFkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfAwAwnH8BygABIG7y0IABzJUxcAHKAOLJAfsA';
const __system = 'te6cckECDwEAAuMAAQHAAQEFoGa7AgEU/wD0pBP0vPLICwMCAWIFBABNoXejBOC52Hq6WVz2PQnYc6yVCjbNBOE7rGpaVsj5ZkWnXlv74sRzAgLNBwYAI2iFulVtZ9Fkw4MgBzwBBM/RBgOP120Xb9uBDrpOEPypgQa4WP7wFoaYGAuNhgAMi/yLhxAP0gESgzN4J8MIFIrfAQQQhtQB9+3XGBYABxgHaiaGoA/DF6AgCYgMCgkIAJrTHzCCEHvNH++6jjT4QW8kMDIigQELIoEBAUEz9ApvoZQB1wAwkltt4iBukjBw3oEBCwEgbvLQgFADoIEBAfAG3sj4QgHMAQH0AMntVADuIPkBgvAtyxmluJ250zd/xlHG+ba5Lbm+YkBgxipQVyzcl5aGOLqOTjDtRNDUAfhi9AQBMfhBbyQwMiKBAQsigQEBQTP0Cm+hlAHXADCSW23iIG6SMHDegQELASBu8tCAUAOggQEB8AbI+EIBzAEB9ADJ7VTbMeACojDtRNDUAfhi9AQBMQHTHwGCENqAPv268uCB+gABMfhBbyQQI18Df3CNBJXaXRoZHJhdyBjb21wbGV0ZWSDbPBAkbW3bPMj4QgHMAQH0AMntVA0LAfbIcQHKAVAHAcoAcAHKAlAFzxZQA/oCcAHKaCNusyVus7GOTH8BygDIcAHKAHABygAkbrOdfwHKAAQgbvLQgFAEzJY0A3ABygDiJG6znX8BygAEIG7y0IBQBMyWNANwAcoA4nABygACfwHKAALJWMyXMzMBcAHKAOIhbrMMADCcfwHKAAEgbvLQgAHMlTFwAcoA4skB+wABQshwAcsfbwABb4xtb4wB2zxvIgHJkyFus5YBbyJZzMnoMQ4AuiDXSiHXSZcgwgAiwgCxjkoDbyKAfyLPMasCoQWrAlFVtgggwgCcIKoCFdcYUDPPFkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfA6VLM8k='; const __system = 'te6cckECEQEAA2oAAQHAAQEFoGa7AgEU/wD0pBP0vPLICwMCAWIFBABNoXejBOC52Hq6WVz2PQnYc6yVCjbNBOE7rGpaVsj5ZkWnXlv74sRzAgLNBwYAI2iFulVtZ9Fkw4MgBzwBBM/RBgPp120Xb9uBDrpOEPypgQa4WP7wFoaYGAuNhgAMi/yLhxAP0gESgzN4J8MIFIrfAQQQhtQB9+3UdWGHaiaGoA/DF6AgCYgOmPgMEIbUAfft15cED9AACY7Z5kfCEA5gCA+gBk9qpwYABxgHaiaGoA/DF6AgCYgMCgkIAJrTHzCCEHvNH++6jjT4QW8kMDIigQELIoEBAUEz9ApvoZQB1wAwkltt4iBukjBw3oEBCwEgbvLQgFADoIEBAfAG3sj4QgHMAQH0AMntVADuIPkBgvAtyxmluJ250zd/xlHG+ba5Lbm+YkBgxipQVyzcl5aGOLqOTjDtRNDUAfhi9AQBMfhBbyQwMiKBAQsigQEBQTP0Cm+hlAHXADCSW23iIG6SMHDegQELASBu8tCAUAOggQEB8AbI+EIBzAEB9ADJ7VTbMeAC9vhBbyQQI18DIcAAjiQxIYEBCyKBAQFBM/QKb6GUAdcAMJJbbeIgbvLQgKdugGSpBAHegQELVHMBgQEBQTP0Cm+hlAHXADCSW23iIG7y0IAjoSIQNQGBAQHwBiCBAQskgQEBQTP0Cm+hlAHXADCSW23iIG7y0IDBAOMAfxALAkBwjQSV2l0aGRyYXcgY29tcGxldGVkg2zwQJBA1bW3bPA4MAfbIcQHKAVAHAcoAcAHKAlAFzxZQA/oCcAHKaCNusyVus7GOTH8BygDIcAHKAHABygAkbrOdfwHKAAQgbvLQgFAEzJY0A3ABygDiJG6znX8BygAEIG7y0IBQBMyWNANwAcoA4nABygACfwHKAALJWMyXMzMBcAHKAOIhbrMNADCcfwHKAAEgbvLQgAHMlTFwAcoA4skB+wABQshwAcsfbwABb4xtb4wB2zxvIgHJkyFus5YBbyJZzMnoMQ8AuiDXSiHXSZcgwgAiwgCxjkoDbyKAfyLPMasCoQWrAlFVtgggwgCcIKoCFdcYUDPPFkAU3llvAlNBocIAmcgBbwJQRKGqAo4SMTPCAJnUMNAg10oh10mScCDi4uhfAwAUgQELI3CBAQHwBpIeRwU=';
let systemCell = Cell.fromBase64(__system); let systemCell = Cell.fromBase64(__system);
let builder = new TupleBuilder(); let builder = new TupleBuilder();
builder.writeCell(systemCell); builder.writeCell(systemCell);
@ -1574,6 +1697,7 @@ const PseudoStaking_errors: { [key: number]: { message: string } } = {
32366: { message: `not enough money for deposit` }, 32366: { message: `not enough money for deposit` },
41207: { message: `invalid sender` }, 41207: { message: `invalid sender` },
44816: { message: `Wallet is blacklisted` }, 44816: { message: `Wallet is blacklisted` },
61265: { message: `Only the owner can trigger un-staking` },
62972: { message: `Invalid balance` }, 62972: { message: `Invalid balance` },
} }

2
sources/output/jetton_TONB.abi

File diff suppressed because one or more lines are too long

BIN
sources/output/jetton_TONB.code.boc

Binary file not shown.

50
sources/output/jetton_TONB.code.fc

@ -212,6 +212,23 @@ cell __gen_writecell_BlacklistWallet((slice) v) inline_ref {
return (sc_0, (v'client)); return (sc_0, (v'client));
} }
builder __gen_write_Unstake(builder build_0, (int) v) inline {
var (v'amount) = v;
build_0 = store_uint(build_0, 3125946401, 32);
build_0 = build_0.store_int(v'amount, 257);
return build_0;
}
cell __gen_writecell_Unstake((int) v) inline_ref {
return __gen_write_Unstake(begin_cell(), v).end_cell();
}
(slice, ((int))) __gen_read_Unstake(slice sc_0) inline {
throw_unless(129, sc_0~load_uint(32) == 3125946401);
var v'amount = sc_0~load_int(257);
return (sc_0, (v'amount));
}
builder __gen_write_WithdrawalRequests(builder build_0, (cell, cell, int) v) inline { builder __gen_write_WithdrawalRequests(builder build_0, (cell, cell, int) v) inline {
var (v'addresses, v'amounts, v'n_requests) = v; var (v'addresses, v'amounts, v'n_requests) = v;
build_0 = build_0.store_dict(v'addresses); build_0 = build_0.store_dict(v'addresses);
@ -589,7 +606,7 @@ _ $__gen_get_owner() method_id(83229) {
int $available = ((__tact_my_balance() - 500000000) - 150000000); int $available = ((__tact_my_balance() - 500000000) - 150000000);
if (($available < $msg'amount)) { if (($available < $msg'amount)) {
int $diff = ($msg'amount - $available); int $diff = ($msg'amount - $available);
$send((false, $msg'owner, (__tact_my_balance() - 500000000), 0, null(), null(), null())); $send((false, $msg'owner, ((__tact_my_balance() - 500000000) - 150000000), 0, null(), null(), null()));
cell $body = __gen_writecell_TokenTransferInternal((0, $diff, my_address(), my_address(), 0, $emptySlice(), null(), null())); cell $body = __gen_writecell_TokenTransferInternal((0, $diff, my_address(), my_address(), 0, $emptySlice(), null(), null()));
slice $walletAddress = $__gen_TONB_get_wallet_address(($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)), $msg'owner); slice $walletAddress = $__gen_TONB_get_wallet_address(($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)), $msg'owner);
$send((false, $walletAddress, 0, 64, $body, null(), null())); $send((false, $walletAddress, 0, 64, $body, null(), null()));
@ -636,10 +653,30 @@ _ $__gen_get_owner() method_id(83229) {
$send((false, $addr, 80000000, 0, __gen_writecell_TokenBurn((0, __tact_not_null(__tact_dict_get_int_int($self'withdrawal_requests'amounts, 257, $i, 257)), $addr, my_address())), null(), null())); $send((false, $addr, 80000000, 0, __gen_writecell_TokenBurn((0, __tact_not_null(__tact_dict_get_int_int($self'withdrawal_requests'amounts, 257, $i, 257)), $addr, my_address())), null(), null()));
$i = ($i + 1); $i = ($i + 1);
} }
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
int $val = $ctx'value;
$self'in_the_pool = ($self'in_the_pool - $val);
if (($self'in_the_pool < 0)) {
int $value = (- $self'in_the_pool);
$send((true, $self'owner, $value, 0, __gen_writecell_Unstake(($value)), null(), null()));
$self'in_the_pool = 0;
}
($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests) = (null(), null(), 0); ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests) = (null(), null(), 0);
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)), ());
} }
(((int, slice, cell, int, slice, slice, int, slice, int, (cell, cell, int))), ()) $__gen_TONB_receive_Unstake((int, slice, cell, int, slice, slice, int, slice, int, (cell, cell, int)) $self, (int) $msg) impure inline {
var ($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)) = $self;
var ($msg'amount) = $msg;
if (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)), ());
}
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
throw_unless(61265, __tact_address_eq($ctx'sender, $self'owner));
$send($stakingWithdrawMessage($msg'amount, __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)), ());
}
() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { () recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure {
@ -730,6 +767,15 @@ _ $__gen_get_owner() method_id(83229) {
return (); return ();
} }
;; Receive Unstake message
if (op == 3125946401) {
var self = __gen_load_TONB();
var msg = in_msg~__gen_read_Unstake();
self~$__gen_TONB_receive_Unstake(msg);
__gen_store_TONB(self);
return ();
}
;; Text Receivers ;; Text Receivers
if (op == 0) { if (op == 0) {
var text_op = slice_hash(in_msg); var text_op = slice_hash(in_msg);
@ -756,5 +802,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmbvAFjnCM5XTJgrgt7t9fPJakhgnHe6UgD1XQ2bUmTLTR"; return "ipfs://QmZei32YRHJRnTCv7qY3WpT16zADJCXJ6BC996CpHaiRqG";
} }

92
sources/output/jetton_TONB.code.fif

@ -30,6 +30,9 @@ PROGRAM{
DECLPROC __gen_read_BlacklistWallet DECLPROC __gen_read_BlacklistWallet
DECLPROC __gen_read_SetStakingPool DECLPROC __gen_read_SetStakingPool
DECLPROC __gen_read_RequestLinker DECLPROC __gen_read_RequestLinker
DECLPROC __gen_write_Unstake
DECLPROC __gen_writecell_Unstake
DECLPROC __gen_read_Unstake
DECLPROC __gen_write_WithdrawalRequests DECLPROC __gen_write_WithdrawalRequests
DECLPROC __gen_read_WithdrawalRequests DECLPROC __gen_read_WithdrawalRequests
DECLPROC __gen_read_Deposit DECLPROC __gen_read_Deposit
@ -76,6 +79,7 @@ PROGRAM{
DECLPROC $__gen_TONB_receive_BlacklistWallet DECLPROC $__gen_TONB_receive_BlacklistWallet
DECLPROC $__gen_TONB_receive_RequestLinker DECLPROC $__gen_TONB_receive_RequestLinker
DECLPROC $__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c DECLPROC $__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c
DECLPROC $__gen_TONB_receive_Unstake
DECLPROC recv_internal DECLPROC recv_internal
113617 DECLMETHOD supported_interfaces 113617 DECLMETHOD supported_interfaces
DECLPROC get_abi_ipfs DECLPROC get_abi_ipfs
@ -378,6 +382,29 @@ PROGRAM{
129 THROWIFNOT 129 THROWIFNOT
__tact_load_address INLINECALLDICT __tact_load_address INLINECALLDICT
}> }>
__gen_write_Unstake PROCINLINE:<{
3125946401 PUSHINT
ROT
32 STU
257 PUSHINT
STIX
}>
__gen_writecell_Unstake PROCREF:<{
NEWC
SWAP
__gen_write_Unstake INLINECALLDICT
ENDC
}>
__gen_read_Unstake PROCINLINE:<{
32 LDU
SWAP
3125946401 PUSHINT
EQUAL
129 THROWIFNOT
257 PUSHINT
LDIX
SWAP
}>
__gen_write_WithdrawalRequests PROCINLINE:<{ __gen_write_WithdrawalRequests PROCINLINE:<{
s2 s3 XCHG2 s2 s3 XCHG2
STDICT STDICT
@ -1026,6 +1053,8 @@ PROGRAM{
__tact_my_balance INLINECALLDICT __tact_my_balance INLINECALLDICT
500000000 PUSHINT 500000000 PUSHINT
SUB SUB
150000000 PUSHINT
SUB
s15 s(-1) PUXC s15 s(-1) PUXC
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
@ -1204,10 +1233,49 @@ PROGRAM{
INC INC
}> }>
4 BLKDROP 4 BLKDROP
__tact_context_get INLINECALLDICT
s1 s3 XCHG
3 BLKDROP
SUB
DUP
0 LESSINT
IF:<{
NEGATE
TRUE
0 PUSHINT
s2 PUSH
__gen_writecell_Unstake INLINECALLDICT
s10 PUSH
s0 s3 XCHG
s4 s4 s4 XCHG3
PUSHNULL
PUSHNULL
$send INLINECALLDICT
0 PUSHINT
}>
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
0 PUSHINT 0 PUSHINT
}> }>
$__gen_TONB_receive_Unstake PROCINLINE:<{
s5 PUSH
ISNULL
IF:<{
DROP
}>ELSE<{
__tact_context_get INLINECALLDICT
2DROP
61265 PUSHINT
s2 POP
s13 PUSH
__tact_address_eq INLINECALLDICT
THROWANYIFNOT
s5 PUSH
__tact_not_null INLINECALLDICT
$stakingWithdrawMessage INLINECALLDICT
$send INLINECALLDICT
}>
}>
recv_internal PROC:<{ recv_internal PROC:<{
c2 SAVE c2 SAVE
SAMEALTSAVE SAMEALTSAVE
@ -1410,6 +1478,28 @@ PROGRAM{
$__gen_TONB_receive_RequestLinker INLINECALLDICT $__gen_TONB_receive_RequestLinker INLINECALLDICT
__gen_store_TONB INLINECALLDICT __gen_store_TONB INLINECALLDICT
}> }>
DUP
3125946401 PUSHINT
EQUAL
IFJMP:<{
DROP
__gen_load_TONB INLINECALLDICT
s0 s12 XCHG
__gen_read_Unstake INLINECALLDICT
NIP
s11 s12 XCHG
s10 s11 XCHG
s9 s10 XCHG
s8 s9 XCHG
s7 s8 XCHG
s6 s7 XCHG
s5 s6 XCHG
s4 s5 XCHG
s3 s4 XCHG
s1 s3 s0 XCHG3
$__gen_TONB_receive_Unstake INLINECALLDICT
__gen_store_TONB INLINECALLDICT
}>
0 EQINT 0 EQINT
IF:<{ IF:<{
HASHSU HASHSU
@ -1433,6 +1523,6 @@ PROGRAM{
86142586315491086060343270784266291122 PUSHINT 86142586315491086060343270784266291122 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d627641466a6e434d3558544a6772677437743966504a616b68676e4865365567443158513262556d544c5452} PUSHSLICE x{697066733a2f2f516d5a656933325952484a526e5443763771593357705431367a41444a43584a3642433939364370486169527147} PUSHSLICE
}> }>
}END>c }END>c

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

@ -170,7 +170,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -207,7 +207,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
10 2 -2 PU2XC 10 2 -2 PU2XC
55 CALLDICT 58 CALLDICT
2DUP 2DUP
<{ <{
0 PUSHINT 0 PUSHINT
@ -1199,7 +1199,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -2077,7 +2077,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
s0 s1 XCHG s0 s1 XCHG
4429 PUSHINT 4429 PUSHINT
@ -2276,6 +2276,8 @@ SETCP0
0 INDEX 0 INDEX
500000000 PUSHINT 500000000 PUSHINT
SUB SUB
150000000 PUSHINT
SUB
s15 s-1 PUXC s15 s-1 PUXC
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
@ -2506,7 +2508,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
12 2 BLKDROP2 12 2 BLKDROP2
<{ <{
@ -3092,7 +3094,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
<{ <{
0 PUSHINT 0 PUSHINT
@ -3482,7 +3484,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
2DUP 2DUP
<{ <{
@ -3529,7 +3531,7 @@ SETCP0
s9 s-1 PUXC s9 s-1 PUXC
s17 PUSH s17 PUSH
s0 s1 XCHG s0 s1 XCHG
55 CALLDICT 58 CALLDICT
2DUP 2DUP
<{ <{
0 PUSHINT 0 PUSHINT
@ -4044,6 +4046,367 @@ SETCP0
c4 POP c4 POP
}> PUSHCONT }> PUSHCONT
IFJMP IFJMP
s0 PUSH
3125946401 PUSHINT
EQUAL
<{
s0 POP
c4 PUSH
CTOS
LDREF
s0 s1 XCHG
2 SETGLOBVAR
LDGRAMS
LDMSGADDR
s0 s1 XCHG
s0 s1 XCHG
1 LDI
s0 s1 XCHG
<{
LDREF
}> PUSHCONT
<{
PUSHNULL
s0 s1 XCHG
}> PUSHCONT
IFELSE
1 LDI
LDMSGADDR
s1 PUSH
2 PLDU
0 NEQINT
<{
s0 s1 XCHG
}> PUSHCONT
<{
s1 POP
PUSHNULL
}> PUSHCONT
IFELSE
s0 s1 XCHG
LDMSGADDR
s1 PUSH
2 PLDU
0 NEQINT
<{
s0 s1 XCHG
}> PUSHCONT
<{
s1 POP
PUSHNULL
}> PUSHCONT
IFELSE
s0 s1 XCHG
LDREF
s0 s1 XCHG
CTOS
257 PUSHINT
LDI
LDMSGADDR
s1 PUSH
2 PLDU
0 NEQINT
<{
s0 s1 XCHG
}> PUSHCONT
<{
s1 POP
PUSHNULL
}> PUSHCONT
IFELSE
s0 s1 XCHG
257 PUSHINT
LDI
LDREF
s0 POP
CTOS
LDDICT
LDDICT
257 PUSHINT
LDI
3 1 BLKSWAP
s3 POP
s6 s12 XCHG
s6 s11 XCHG
s6 s10 XCHG
s6 s9 XCHG
s6 s8 XCHG
s6 s7 XCHG
ROT
1 12 BLKDROP2
s0 s12 XCHG
32 LDU
s0 s1 XCHG
3125946401 PUSHINT
EQUAL
129 THROWIFNOT
257 PUSHINT
LDI
s0 s1 XCHG
s1 POP
s11 s12 XCHG
s10 s11 XCHG
s9 s10 XCHG
s8 s9 XCHG
s7 s8 XCHG
s6 s7 XCHG
s5 s6 XCHG
s4 s5 XCHG
s3 s4 XCHG
s1 s3 s0 XCHG3
s5 PUSH
ISNULL
<{
s0 POP
}> PUSHCONT
<{
1 GETGLOBVAR
4 UNTUPLE
2DROP
61265 PUSHINT
s2 POP
s13 PUSH
SDEQ
THROWANYIFNOT
s5 PUSH
s0 PUSH
ISNULL
128 THROWIF
<{
-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
}> PUSHCONT
IFELSE
NEWC
2 GETGLOBVAR
s0 s1 XCHG
STREF
12 1 BLKSWAP
s12 s11 XCHG2
STGRAMS
s0 s9 XCHG2
STSLICER
s7 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s1 s7 XCHG
STREF
}> PUSHCONT
<{
s7 POP
0 PUSHINT
s0 s7 XCHG2
1 STI
}> PUSHCONT
IFELSE
s1 s5 XCHG
1 STI
s0 s3 XCHG2
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
s0 s1 XCHG
2 STU
}> PUSHCONT
<{
STSLICER
}> PUSHCONT
IFELSE
s0 s1 XCHG
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
s0 s1 XCHG
2 STU
}> PUSHCONT
<{
STSLICER
}> PUSHCONT
IFELSE
s0 s1 XCHG
NEWC
257 PUSHINT
STIX
ROT
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
s0 s1 XCHG
2 STU
}> PUSHCONT
<{
STSLICER
}> PUSHCONT
IFELSE
s1 s2 XCHG
257 PUSHINT
STIX
NEWC
s3 s1 s3 XCHG3
s5 s4 XCHG2
s2 s3 XCHG2
STDICT
STDICT
257 PUSHINT
STIX
ENDC
ROT
STREF
ENDC
s0 s1 XCHG
STREF
ENDC
c4 POP
}> PUSHCONT
IFJMP
0 EQINT 0 EQINT
<{ <{
HASHSU HASHSU
@ -4338,6 +4701,161 @@ SETCP0
}> PUSHCONT }> PUSHCONT
WHILE WHILE
4 BLKDROP 4 BLKDROP
1 GETGLOBVAR
4 UNTUPLE
s1 s3 XCHG
3 BLKDROP
SUB
s0 PUSH
0 LESSINT
<{
NEGATE
-1 PUSHINT
0 PUSHINT
s2 PUSH
<{
NEWC
s0 s1 XCHG
3125946401 PUSHINT
ROT
32 STU
257 PUSHINT
STIX
ENDC
}> CALLREF
s10 PUSH
s0 s3 XCHG
s4 s4 s4 XCHG3
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
0 PUSHINT
}> IFREF
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
0 PUSHINT 0 PUSHINT
@ -4440,7 +4958,7 @@ SETCP0
IFELSE IFELSE
130 THROW 130 THROW
52: 55:
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
@ -4496,7 +5014,7 @@ SETCP0
STREF STREF
ENDC ENDC
53: 56:
s0 s2 XCHG s0 s2 XCHG
CTOS CTOS
LDDICT LDDICT
@ -4519,9 +5037,9 @@ SETCP0
STDICT STDICT
ENDC ENDC
s0 s0 s3 XCHG3 s0 s0 s3 XCHG3
52 CALLDICT 55 CALLDICT
54: 57:
PUSHNULL PUSHNULL
s0 s4 XCHG s0 s4 XCHG
NEWC NEWC
@ -4553,7 +5071,7 @@ SETCP0
STREF STREF
ENDC ENDC
55: 58:
s0 s3 XCHG s0 s3 XCHG
CTOS CTOS
LDDICT LDDICT
@ -4577,7 +5095,7 @@ SETCP0
ENDC ENDC
3 1 BLKSWAP 3 1 BLKSWAP
s0 s4 XCHG s0 s4 XCHG
54 CALLDICT 57 CALLDICT
owner: owner:
c4 PUSH c4 PUSH
@ -4758,7 +5276,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
12 2 BLKDROP2 12 2 BLKDROP2
<{ <{
@ -4884,7 +5402,7 @@ SETCP0
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
53 CALLDICT 56 CALLDICT
}> CALLREF }> CALLREF
8 2 BLKDROP2 8 2 BLKDROP2
s0 POP s0 POP

16
sources/output/jetton_TONB.md

@ -1,9 +1,9 @@
# TACT Compilation Report # TACT Compilation Report
Contract: TONB Contract: TONB
BOC Size: 3825 bytes BOC Size: 4090 bytes
# Types # Types
Total Types: 30 Total Types: 33
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -109,6 +109,18 @@ Signature: `SetStakingPool{staking_pool:Maybe address}`
TLB: `request_linker#5a29431e client:address = RequestLinker` TLB: `request_linker#5a29431e client:address = RequestLinker`
Signature: `RequestLinker{client:address}` Signature: `RequestLinker{client:address}`
## Unstake
TLB: `unstake#ba522821 amount:int257 = Unstake`
Signature: `Unstake{amount:int257}`
## RequestUnstake
TLB: `request_unstake#e9cedf7f founderIndex:int257 = RequestUnstake`
Signature: `RequestUnstake{founderIndex:int257}`
## CollectProfit
TLB: `collect_profit#51912735 adminIndex:int257 = CollectProfit`
Signature: `CollectProfit{adminIndex:int257}`
## WithdrawalRequests ## WithdrawalRequests
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = 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}` Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

133
sources/output/jetton_TONB.ts

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONBWallet.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONBWallet.code.fc

@ -514,5 +514,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmcS4CYiu6xUPu6QvPConc7ut86RgukmohTexGBWmm3HM6"; return "ipfs://QmZ8U23MsSzC5NvLwmc6Wh8LzCefCn61CpNQ81T9a6A8dZ";
} }

2
sources/output/jetton_TONBWallet.code.fif

@ -1008,6 +1008,6 @@ PROGRAM{
209778528950190195973528115415557644819 PUSHINT 209778528950190195973528115415557644819 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d63533443596975367855507536517650436f6e6337757438365267756b6d6f685465784742576d6d33484d36} PUSHSLICE x{697066733a2f2f516d5a385532334d73537a43354e764c776d63365768384c7a436566436e363143704e513831543961364138645a} PUSHSLICE
}> }>
}END>c }END>c

14
sources/output/jetton_TONBWallet.md

@ -3,7 +3,7 @@ Contract: TONBWallet
BOC Size: 2111 bytes BOC Size: 2111 bytes
# Types # Types
Total Types: 30 Total Types: 33
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -109,6 +109,18 @@ Signature: `SetStakingPool{staking_pool:Maybe address}`
TLB: `request_linker#5a29431e client:address = RequestLinker` TLB: `request_linker#5a29431e client:address = RequestLinker`
Signature: `RequestLinker{client:address}` Signature: `RequestLinker{client:address}`
## Unstake
TLB: `unstake#ba522821 amount:int257 = Unstake`
Signature: `Unstake{amount:int257}`
## RequestUnstake
TLB: `request_unstake#e9cedf7f founderIndex:int257 = RequestUnstake`
Signature: `RequestUnstake{founderIndex:int257}`
## CollectProfit
TLB: `collect_profit#51912735 adminIndex:int257 = CollectProfit`
Signature: `CollectProfit{adminIndex:int257}`
## WithdrawalRequests ## WithdrawalRequests
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = 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}` Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`

2
sources/output/jetton_TONBWallet.pkg

File diff suppressed because one or more lines are too long

124
sources/output/jetton_TONBWallet.ts

@ -1345,6 +1345,129 @@ function dictValueParserRequestLinker(): DictionaryValue<RequestLinker> {
} }
} }
} }
export type Unstake = {
$$type: 'Unstake';
amount: bigint;
}
export function storeUnstake(src: Unstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3125946401, 32);
b_0.storeInt(src.amount, 257);
};
}
export function loadUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3125946401) { throw Error('Invalid prefix'); }
let _amount = sc_0.loadIntBig(257);
return { $$type: 'Unstake' as const, amount: _amount };
}
function loadTupleUnstake(source: TupleReader) {
let _amount = source.readBigNumber();
return { $$type: 'Unstake' as const, amount: _amount };
}
function storeTupleUnstake(source: Unstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.amount);
return builder.build();
}
function dictValueParserUnstake(): DictionaryValue<Unstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeUnstake(src)).endCell());
},
parse: (src) => {
return loadUnstake(src.loadRef().beginParse());
}
}
}
export type RequestUnstake = {
$$type: 'RequestUnstake';
founderIndex: bigint;
}
export function storeRequestUnstake(src: RequestUnstake) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3922648959, 32);
b_0.storeInt(src.founderIndex, 257);
};
}
export function loadRequestUnstake(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3922648959) { throw Error('Invalid prefix'); }
let _founderIndex = sc_0.loadIntBig(257);
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function loadTupleRequestUnstake(source: TupleReader) {
let _founderIndex = source.readBigNumber();
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex };
}
function storeTupleRequestUnstake(source: RequestUnstake) {
let builder = new TupleBuilder();
builder.writeNumber(source.founderIndex);
return builder.build();
}
function dictValueParserRequestUnstake(): DictionaryValue<RequestUnstake> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeRequestUnstake(src)).endCell());
},
parse: (src) => {
return loadRequestUnstake(src.loadRef().beginParse());
}
}
}
export type CollectProfit = {
$$type: 'CollectProfit';
adminIndex: bigint;
}
export function storeCollectProfit(src: CollectProfit) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(1368467253, 32);
b_0.storeInt(src.adminIndex, 257);
};
}
export function loadCollectProfit(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 1368467253) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function loadTupleCollectProfit(source: TupleReader) {
let _adminIndex = source.readBigNumber();
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex };
}
function storeTupleCollectProfit(source: CollectProfit) {
let builder = new TupleBuilder();
builder.writeNumber(source.adminIndex);
return builder.build();
}
function dictValueParserCollectProfit(): DictionaryValue<CollectProfit> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeCollectProfit(src)).endCell());
},
parse: (src) => {
return loadCollectProfit(src.loadRef().beginParse());
}
}
}
export type WithdrawalRequests = { export type WithdrawalRequests = {
$$type: 'WithdrawalRequests'; $$type: 'WithdrawalRequests';
addresses: Dictionary<bigint, Address>; addresses: Dictionary<bigint, Address>;
@ -1576,6 +1699,7 @@ const TONBWallet_errors: { [key: number]: { message: string } } = {
32366: { message: `not enough money for deposit` }, 32366: { message: `not enough money for deposit` },
41207: { message: `invalid sender` }, 41207: { message: `invalid sender` },
44816: { message: `Wallet is blacklisted` }, 44816: { message: `Wallet is blacklisted` },
61265: { message: `Only the owner can trigger un-staking` },
62972: { message: `Invalid balance` }, 62972: { message: `Invalid balance` },
} }

4218
sources/output/types.json

File diff suppressed because it is too large Load Diff

10
sources/pseudostaking.tact

@ -17,8 +17,16 @@ contract PseudoStaking {
receive(msg: StakingWithdraw) { receive(msg: StakingWithdraw) {
let ctx: Context = context(); let ctx: Context = context();
let value: Int = msg.value;
if (value == 0) {
value = (self.stakes.get(ctx.sender)!! * 110) / 100;
}
self.stakes.set(ctx.sender, self.stakes.get(ctx.sender)!! - value);
if (self.stakes.get(ctx.sender)!! < 0) {
self.stakes.set(ctx.sender, 0);
}
send(SendParameters { send(SendParameters {
value: msg.value, value: value,
to: ctx.sender, to: ctx.sender,
body: "Withdraw completed".asComment() body: "Withdraw completed".asComment()
}); });

22
sources/staking.tact

@ -38,7 +38,6 @@ trait StakingTrait {
withdrawal_requests: WithdrawalRequests; withdrawal_requests: WithdrawalRequests;
owner: Address; owner: Address;
in_the_pool: Int = 0; in_the_pool: Int = 0;
requested_withdrawal: Int = 0;
fun sendStake() { fun sendStake() {
if(self.staking_pool == null) { if(self.staking_pool == null) {
@ -80,15 +79,30 @@ trait StakingTrait {
let ctx: Context = context(); let ctx: Context = context();
let val: Int = ctx.value; let val: Int = ctx.value;
self.in_the_pool = self.in_the_pool - val; self.in_the_pool = self.in_the_pool - val;
self.requested_withdrawal = self.requested_withdrawal - val; if (self.in_the_pool < 0) {
let profit: Int = self.in_the_pool - self.requested_withdrawal; let value: Int = -self.in_the_pool;
// todo: send profit to the foundation (owner) send(SendParameters{
to: self.owner,
value: value,
body: Unstake{amount: value}.toCell()
});
self.in_the_pool = 0;
}
self.withdrawal_requests = WithdrawalRequests{ self.withdrawal_requests = WithdrawalRequests{
addresses: emptyMap(), addresses: emptyMap(),
amounts: emptyMap() amounts: emptyMap()
}; };
} }
receive(msg: Unstake) {
if(self.staking_pool == null) {
return;
}
let ctx: Context = context();
require(ctx.sender == self.owner, "Only the owner can trigger un-staking");
send(stakingWithdrawMessage(msg.amount /* 0 to unstake all */, self.staking_pool!!));
}
fun requestWithdrawal(address: Address, value: Int) { fun requestWithdrawal(address: Address, value: Int) {
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);

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": "kQDqdXWdE6QCwdIav5vKbWisgRNKQ1foZIJEUAP4WR9CNPfy", "to": "kQABEUn8yLZqJKZAi4TZjnxqafjqNKCwpuE_-kOXim3gA5il",
"type": "internal", "type": "internal",
"value": 100200000000n, "value": 100200000000n,
}, },
"type": "received", "type": "received",
}, },
{ {
"gasUsed": 32790n, "gasUsed": 32815n,
"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": "kQDqdXWdE6QCwdIav5vKbWisgRNKQ1foZIJEUAP4WR9CNPfy", "from": "kQABEUn8yLZqJKZAi4TZjnxqafjqNKCwpuE_-kOXim3gA5il",
"to": "kQCFWdZkHt68RZzf5yLYgur4jRtW4Ns8l6N2S1t8g0MDPRv7", "to": "kQCMEn5NnRirD8pMXczMDKEXDjBM8tPVXYdj6X3b9ySJdCgP",
"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{178D451900000000000000005174876E800801D4EAEB3A27480583A4357F3794DAD15902269486AFD0C90488A007F0B23E846900023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_} "cell": "x{178D451900000000000000005174876E800800022293F9916CD4494C811709B31CF8D4D3F1D46941614DC27FF4872F14DBC00700023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{800000000000000000000000000000000000000000000000000000000000000020042ACEB320F6F5E22CE6FF3916C41757C468DAB706D9E4BD1BB25ADBE41A1819EC_}", x{800000000000000000000000000000000000000000000000000000000000000020046093F26CE8C5587E5262EE66606508B8718267969EAAEC3B1F4BEEDFB9244BA4_}",
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQDqdXWdE6QCwdIav5vKbWisgRNKQ1foZIJEUAP4WR9CNPfy", "from": "kQABEUn8yLZqJKZAi4TZjnxqafjqNKCwpuE_-kOXim3gA5il",
"to": "kQDx8Kg9QTHxou3cHUjl5yisUuHcdW3SO_r2k2KOX9WImtuB", "to": "kQBPWbXsnNaT4jX5J-TIyCfqT9ieWU1c-OxPUejeUisQd5cf",
"type": "internal", "type": "internal",
"value": 41715000n, "value": 41715000n,
}, },
@ -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": "kQC4vZPVA2qqBA7kJfq6yPGv9VBb7MJOvNfJlDxWkagnBO9K", "to": "kQCWdkwB2iVEz4eqkgyEp_trwnITQd4LiGEcLGENymBCqgFX",
"type": "internal", "type": "internal",
"value": 100200000000n, "value": 100200000000n,
}, },
"type": "received", "type": "received",
}, },
{ {
"gasUsed": 36073n, "gasUsed": 36098n,
"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": "kQC4vZPVA2qqBA7kJfq6yPGv9VBb7MJOvNfJlDxWkagnBO9K", "from": "kQCWdkwB2iVEz4eqkgyEp_trwnITQd4LiGEcLGENymBCqgFX",
"to": "kQDTmzk2GN2cZRr-uIAU5a489Ziwu2Y4dAhQJQizU27oGL-G", "to": "kQACkI90BJ8sTu1IlFoOtzChElnpXsotC8lrmFMGJknQ_Flx",
"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{178D451900000000000000005174876E800801717B27AA06D554081DC84BF57591E35FEAA0B7D9849D79AF932878AD23504E0900023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_} "cell": "x{178D451900000000000000005174876E8008012CEC9803B44A899F0F552419094FF6D784E42683BC1710C23858C21B94C0855500023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{800000000000000000000000000000000000000000000000000000000000000020069CD9C9B0C6ECE328D7F5C400A72D71E7ACC585DB31C3A0428128459A9B7740C4_}", x{8000000000000000000000000000000000000000000000000000000000000000200014847BA024F962776A44A2D075B9850892CF4AF651685E4B5CC29831324E87E4_}",
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQC4vZPVA2qqBA7kJfq6yPGv9VBb7MJOvNfJlDxWkagnBO9K", "from": "kQCWdkwB2iVEz4eqkgyEp_trwnITQd4LiGEcLGENymBCqgFX",
"to": "kQC1V2Z4YfN7Y2o-d8DsuDYH2YKYJ2fJpLzmN_yMFf-Efy9L", "to": "kQCO4TveQnMW97esrpa9c9juf5h1ry8gHsxGmUzPjVmBd9Sf",
"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": "kQC4vZPVA2qqBA7kJfq6yPGv9VBb7MJOvNfJlDxWkagnBO9K", "from": "kQCWdkwB2iVEz4eqkgyEp_trwnITQd4LiGEcLGENymBCqgFX",
"to": "kQB6IAwD4Haze61PlYJmyim_0AB0bs-PNhn8XOUwnkMnEcnp", "to": "kQC5Y865mUcSTsSpJYbli0KmSiriJUBFHlKmvNqkS7T5VyUx",
"type": "internal", "type": "internal",
"value": 99491421000n, "value": 99491421000n,
}, },

11
sources/tests/jetton.spec.ts

@ -63,7 +63,7 @@ describe('jetton', () => {
expect((events[4] as any).messages[0].value).toBeGreaterThan(99000000000n); expect((events[4] as any).messages[0].value).toBeGreaterThan(99000000000n);
// Try to withdraw // Try to withdraw
await contract.send(owner, { value: toNano('0.15') }, { $$type: 'Withdraw', amount: toNano('50') }); await contract.send(owner, { value: toNano('0.5') }, { $$type: 'Withdraw', amount: toNano('50') });
let log = await system.run(); let log = await system.run();
events = tracker.events(); events = tracker.events();
// console.log(log) // console.log(log)
@ -86,10 +86,15 @@ describe('jetton', () => {
} }
} }
expect(found_transaction).toBeTruthy(); expect(found_transaction).toBeTruthy();
await contract.send(owner, { value: toNano('0.5') }, { $$type: 'Unstake', amount: toNano('0') });
log = await system.run();
events = tracker.events();
logEvents(events, addressBook);
expect((events[events.length-1] as any).messages[0].value).toBeGreaterThan(toNano('4.9'));
expect((events[events.length-1] as any).messages[0].to).toEqual(addressBook_rev['owner']);
});
// 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 () => {
let system = await ContractSystem.create(); let system = await ContractSystem.create();
let owner = system.treasure('owner'); let owner = system.treasure('owner');

11
sources/utils/compile_types.py

@ -0,0 +1,11 @@
from glob import glob
import json
res = []
for f in glob('sources/output/*.abi'):
with open(f) as fp:
res += json.load(fp)['types']
with open('sources/output/types.json', 'w') as fp:
json.dump({'types': res}, fp, indent=4)
Loading…
Cancel
Save