Browse Source

Staking

master
Lev 2 years ago
parent
commit
04a1245e25
  1. 3
      sources/constants.tact
  2. 1
      sources/jetton.tact
  3. 36
      sources/jetton_trait.tact
  4. 2
      sources/output/jetton_TONB.abi
  5. BIN
      sources/output/jetton_TONB.code.boc
  6. 108
      sources/output/jetton_TONB.code.fc
  7. 215
      sources/output/jetton_TONB.code.fif
  8. 561
      sources/output/jetton_TONB.code.rev.fif
  9. 2
      sources/output/jetton_TONB.md
  10. 2
      sources/output/jetton_TONB.pkg
  11. 9
      sources/output/jetton_TONB.ts
  12. 49
      sources/staking.tact

3
sources/constants.tact

@ -1,6 +1,7 @@
const gas_consumption: Int = ton("0.01"); const gas_consumption: Int = ton("0.01");
const withdraw_gas_consumption: Int = ton("0.01"); const withdraw_gas_consumption: Int = ton("0.1");
const deposit_gas_consumption: Int = ton("0.01"); // Gas consumption during processing const deposit_gas_consumption: Int = ton("0.01"); // Gas consumption during processing
const linker_credit: Int = ton("0.02"); // TON to send to the linker for the fees const linker_credit: Int = ton("0.02"); // TON to send to the linker for the fees
const wallet_credit: Int = ton("0.05"); // TON to send to the wallet for the fees const wallet_credit: Int = ton("0.05"); // TON to send to the wallet for the fees
const tonb_floor: Int = ton("0.1"); // Minimum amount of TON to keep on TONB

1
sources/jetton.tact

@ -39,6 +39,7 @@ contract TONB with TONBTrait {
let ctx: Context = context(); let ctx: Context = context();
require(ctx.value >= deposit_gas_consumption + msg.amount + linker_credit + wallet_credit, "not enough money for deposit"); require(ctx.value >= deposit_gas_consumption + msg.amount + linker_credit + wallet_credit, "not enough money for deposit");
self.mint(ctx.sender, msg.amount, ctx.sender); self.mint(ctx.sender, msg.amount, ctx.sender);
self.sendStake();
} }
receive() {} receive() {}

36
sources/jetton_trait.tact

@ -3,10 +3,11 @@ import "@stdlib/ownable";
import "./wallet"; import "./wallet";
import "./linker"; import "./linker";
import "./constants"; import "./constants";
import "./staking";
@interface("org.ton.jetton.master") @interface("org.ton.jetton.master")
trait TONBTrait with Ownable { trait TONBTrait with Ownable, StakingTrait {
// //
// Storage // Storage
@ -19,6 +20,8 @@ trait TONBTrait with Ownable {
first_linker: Address?; first_linker: Address?;
last_linker: Address?; last_linker: Address?;
n_linkers: Int = 0; n_linkers: Int = 0;
staking_pool: Address?;
withdrawal_requests: WithdrawalRequests;
// //
@ -41,7 +44,36 @@ trait TONBTrait with Ownable {
// Update supply // Update supply
self.totalSupply = self.totalSupply - msg.amount; self.totalSupply = self.totalSupply - msg.amount;
/* todo: if not enough tokens, withdraw what we have, send some tokens to the owner, add a withdrawal request */ let available: Int = myBalance() - tonb_floor - withdraw_gas_consumption;
if (available < msg.amount) {
/* if not enough tokens, withdraw what we have, send some tokens to the owner, add a withdrawal request (-withdrawal_gas) */
let diff: Int = msg.amount - available;
send(SendParameters{
to: msg.owner,
value: myBalance() - tonb_floor,
bounce: false
});
let body: Cell = TokenTransferInternal{
amount: diff,
queryId: 0,
from: myAddress(),
responseAddress: myAddress(),
forwardTonAmount: 0,
forwardPayload: emptySlice(),
setLinker: null,
setLinkerAddress: null
}.toCell();
let walletAddress: Address = self.get_wallet_address(msg.owner);
send(SendParameters{
to: walletAddress,
value: 0,
bounce: false,
mode: SendRemainingValue,
body: body
});
self.requestWithdrawal(msg.owner, diff);
return;
}
// Withdraw // Withdraw
send(SendParameters{ send(SendParameters{

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.

108
sources/output/jetton_TONB.code.fc

@ -1,3 +1,9 @@
slice __tact_str_to_slice(slice s) asm "NOP";
int __tact_my_balance() inline {
return pair_first(get_balance());
}
forall X -> X __tact_not_null(X x) { throw_if(128, null?(x)); return x; } forall X -> X __tact_not_null(X x) { throw_if(128, null?(x)); return x; }
global (int, slice, int, slice) __tact_context; global (int, slice, int, slice) __tact_context;
@ -65,6 +71,42 @@ slice __tact_compute_contract_address(int chain, cell code, cell data) inline {
return __tact_create_address(chain, hash); return __tact_create_address(chain, hash);
} }
(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl) inline {
if (null?(v)) {
var (r, ok) = idict_delete?(d, kl, k);
return (r, ());
} else {
return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ());
}
}
int __tact_dict_get_int_int(cell d, int kl, int k, int vl) inline {
var (r, ok) = idict_get?(d, kl, k);
if (ok) {
return r~load_int(vl);
} else {
return null();
}
}
(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v) inline {
if (null?(v)) {
var (r, ok) = idict_delete?(d, kl, k);
return (r, ());
} else {
return (idict_set(d, kl, k, v), ());
}
}
slice __tact_dict_get_int_slice(cell d, int kl, int k) inline {
var (r, ok) = idict_get?(d, kl, k);
if (ok) {
return r;
} else {
return null();
}
}
int __tact_address_eq(slice a, slice b) inline { int __tact_address_eq(slice a, slice b) inline {
return equal_slice_bits(a, b); return equal_slice_bits(a, b);
} }
@ -248,6 +290,9 @@ _ __gen_Context_get_sender((int, slice, int, slice) v) inline {
set_data(b.end_cell()); set_data(b.end_cell());
} }
;; String "Deposit"
slice __gen_str_228592480() asm "B{b5ee9c7241010101000900000e4465706f7369749721d513} B>boc <s PUSHSLICE";
cell $emptyCell() impure { cell $emptyCell() impure {
return end_cell(begin_cell()); return end_cell(begin_cell());
} }
@ -309,6 +354,10 @@ slice $contractAddress((cell, cell) $s) impure {
send_raw_message($c, $params'mode); send_raw_message($c, $params'mode);
} }
(int, slice, int, int, cell, cell, cell) $stakingDepositMessage(int $value, slice $pool) impure {
return (true, $pool, $value, 0, end_cell(store_slice(begin_cell(), __tact_str_to_slice(__gen_str_228592480()))), 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;
@ -433,12 +482,34 @@ _ $__gen_get_owner() method_id(83229) {
return res; return res;
} }
((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)), ()) $__gen_TONB_sendStake((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)) $self) impure {
var (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))) = $self;
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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
}
int $value = (__tact_my_balance() - 100000000);
if (($value < 50000000)) {
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
}
$send($stakingDepositMessage($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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
}
((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)), ()) $__gen_TONB_requestWithdrawal((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)) $self, slice $address, int $value) impure {
var (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))) = $self;
$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'n_requests = ($self'withdrawal_requests'n_requests + 1);
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
}
(((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int))), ()) $__gen_TONB_receive_Deposit((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)) $self, (int) $msg) impure { (((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int))), ()) $__gen_TONB_receive_Deposit((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)) $self, (int) $msg) impure {
var ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)) = $self; var ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)) = $self;
var ($msg'amount) = $msg; var ($msg'amount) = $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();
throw_unless(32366, ($ctx'value >= (((10000000 + $msg'amount) + 20000000) + 50000000))); throw_unless(32366, ($ctx'value >= (((10000000 + $msg'amount) + 20000000) + 50000000)));
($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_mint($ctx'sender, $msg'amount, $ctx'sender); ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_mint($ctx'sender, $msg'amount, $ctx'sender);
($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_sendStake();
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
} }
@ -451,7 +522,7 @@ _ $__gen_get_owner() method_id(83229) {
var ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)) = $self; var ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)) = $self;
var ($msg'amount) = $msg; var ($msg'amount) = $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();
throw_unless(6384, ($ctx'value >= 10000000)); throw_unless(6384, ($ctx'value >= 100000000));
($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_burn($ctx'sender, $msg'amount, $ctx'sender); ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_burn($ctx'sender, $msg'amount, $ctx'sender);
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
} }
@ -469,10 +540,30 @@ _ $__gen_get_owner() method_id(83229) {
var ($msg'queryId, $msg'amount, $msg'owner, $msg'responseAddress) = $msg; var ($msg'queryId, $msg'amount, $msg'owner, $msg'responseAddress) = $msg;
($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_requireWallet($msg'owner); ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_requireWallet($msg'owner);
$self'totalSupply = ($self'totalSupply - $msg'amount); $self'totalSupply = ($self'totalSupply - $msg'amount);
int $available = ((__tact_my_balance() - 100000000) - 100000000);
if (($available < $msg'amount)) {
int $diff = ($msg'amount - $available);
$send((false, $msg'owner, (__tact_my_balance() - 100000000), 0, null(), 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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), $msg'owner);
$send((false, $walletAddress, 0, 64, $body, null(), null()));
($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests))~$__gen_TONB_requestWithdrawal($msg'owner, $diff);
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
}
$send((false, $msg'owner, $msg'amount, 0, null(), null(), null())); $send((false, $msg'owner, $msg'amount, 0, null(), null(), null()));
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_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'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)), ());
} }
((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)), ()) $__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c((int, slice, cell, int, slice, slice, int, slice, (cell, cell, int)) $self) impure {
var ($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_pool, ($self'withdrawal_requests'addresses, $self'withdrawal_requests'amounts, $self'withdrawal_requests'n_requests)) = $self;
int $i = 0;
while (($i < $self'withdrawal_requests'n_requests)) {
$send((true, __tact_not_null(__tact_dict_get_int_slice($self'withdrawal_requests'addresses, 257, $i)), __tact_not_null(__tact_dict_get_int_int($self'withdrawal_requests'amounts, 257, $i, 257)), 0, null(), null(), null()));
$i = ($i + 1);
}
return (($self'totalSupply, $self'owner, $self'content, $self'mintable, $self'first_linker, $self'last_linker, $self'n_linkers, $self'staking_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 {
@ -536,6 +627,19 @@ _ $__gen_get_owner() method_id(83229) {
return (); return ();
} }
;; Text Receivers
if (op == 0) {
var text_op = slice_hash(in_msg);
;; Receive "Withdraw completed" message
if (text_op == 0xf7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c) {
var self = __gen_load_TONB();
self~$__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c();
__gen_store_TONB(self);
return ();
}
}
throw(130); throw(130);
} }
@ -549,5 +653,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmYVigftHMYXo1zGVnMx2hxo4jEsJqWmjJJq9AaWYe9gfp"; return "ipfs://QmUMBKY4L4n4GyTq3MSncGQ8X3nLYqomdtcYYcg1dzU2iS";
} }

215
sources/output/jetton_TONB.code.fif

@ -1,4 +1,5 @@
PROGRAM{ PROGRAM{
DECLPROC __tact_my_balance
DECLPROC __tact_not_null DECLPROC __tact_not_null
DECLPROC __tact_context_get DECLPROC __tact_context_get
DECLPROC __tact_verify_address DECLPROC __tact_verify_address
@ -9,6 +10,10 @@ PROGRAM{
DECLPROC __tact_store_address_opt DECLPROC __tact_store_address_opt
DECLPROC __tact_create_address DECLPROC __tact_create_address
DECLPROC __tact_compute_contract_address DECLPROC __tact_compute_contract_address
DECLPROC __tact_dict_set_int_int
DECLPROC __tact_dict_get_int_int
DECLPROC __tact_dict_set_int_slice
DECLPROC __tact_dict_get_int_slice
DECLPROC __tact_address_eq DECLPROC __tact_address_eq
DECLPROC __tact_dict_set_code DECLPROC __tact_dict_set_code
DECLPROC __tact_dict_get_code DECLPROC __tact_dict_get_code
@ -38,6 +43,7 @@ PROGRAM{
DECLPROC $emptySlice DECLPROC $emptySlice
DECLPROC $contractAddress DECLPROC $contractAddress
DECLPROC $send DECLPROC $send
DECLPROC $stakingDepositMessage
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
@ -53,16 +59,23 @@ PROGRAM{
DECLPROC $__gen_TONB_requireOwner DECLPROC $__gen_TONB_requireOwner
DECLPROC $__gen_TONB_owner DECLPROC $__gen_TONB_owner
83229 DECLMETHOD $__gen_get_owner 83229 DECLMETHOD $__gen_get_owner
DECLPROC $__gen_TONB_sendStake
DECLPROC $__gen_TONB_requestWithdrawal
DECLPROC $__gen_TONB_receive_Deposit DECLPROC $__gen_TONB_receive_Deposit
DECLPROC $__gen_TONB_receive DECLPROC $__gen_TONB_receive
DECLPROC $__gen_TONB_receive_Withdraw DECLPROC $__gen_TONB_receive_Withdraw
DECLPROC $__gen_TONB_receive_TokenUpdateContent DECLPROC $__gen_TONB_receive_TokenUpdateContent
DECLPROC $__gen_TONB_receive_TokenBurnNotification DECLPROC $__gen_TONB_receive_TokenBurnNotification
DECLPROC $__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c
DECLPROC recv_internal DECLPROC recv_internal
113617 DECLMETHOD supported_interfaces 113617 DECLMETHOD supported_interfaces
DECLPROC get_abi_ipfs DECLPROC get_abi_ipfs
DECLGLOBVAR __tact_context DECLGLOBVAR __tact_context
DECLGLOBVAR __tact_context_sys DECLGLOBVAR __tact_context_sys
__tact_my_balance PROCINLINE:<{
BALANCE
FIRST
}>
__tact_not_null PROC:<{ __tact_not_null PROC:<{
DUP DUP
ISNULL ISNULL
@ -145,6 +158,58 @@ PROGRAM{
HASHCU HASHCU
__tact_create_address INLINECALLDICT __tact_create_address INLINECALLDICT
}> }>
__tact_dict_set_int_int PROCINLINE:<{
OVER
ISNULL
IF:<{
2DROP
-ROT
DICTIDEL
DROP
}>ELSE<{
NEWC
SWAP
STIX
s1 s3 s3 XCHG3
DICTISETB
}>
}>
__tact_dict_get_int_int PROCINLINE:<{
s1 s3 s3 XCHG3
DICTIGET
NULLSWAPIFNOT
IF:<{
SWAP
LDIX
DROP
}>ELSE<{
2DROP
PUSHNULL
}>
}>
__tact_dict_set_int_slice PROCINLINE:<{
DUP
ISNULL
IF:<{
DROP
-ROT
DICTIDEL
DROP
}>ELSE<{
s1 s3 s3 XCHG3
DICTISET
}>
}>
__tact_dict_get_int_slice PROCINLINE:<{
-ROT
DICTIGET
NULLSWAPIFNOT
IF:<{
}>ELSE<{
DROP
PUSHNULL
}>
}>
__tact_address_eq PROCINLINE:<{ __tact_address_eq PROCINLINE:<{
SDEQ SDEQ
}> }>
@ -562,6 +627,17 @@ PROGRAM{
SWAP SWAP
SENDRAWMSG SENDRAWMSG
}> }>
$stakingDepositMessage PROC:<{
TRUE
0 PUSHINT
NEWC
B{b5ee9c7241010101000900000e4465706f7369749721d513} B>boc <s PUSHSLICE
STSLICER
ENDC
s2 s4 XCHG
PUSHNULL
PUSHNULL
}>
$__gen_TONBWallet_init PROC:<{ $__gen_TONBWallet_init PROC:<{
FALSE FALSE
PUSHNULL PUSHNULL
@ -771,6 +847,39 @@ PROGRAM{
__gen_load_TONB INLINECALLDICT __gen_load_TONB INLINECALLDICT
$__gen_TONB_owner CALLDICT $__gen_TONB_owner CALLDICT
}> }>
$__gen_TONB_sendStake PROC:<{
s3 PUSH
ISNULL
IFJMP:<{
}>
__tact_my_balance INLINECALLDICT
100000000 PUSHINT
SUB
DUP
50000000 PUSHINT
LESS
IFJMP:<{
DROP
}>
s4 PUSH
__tact_not_null CALLDICT
$stakingDepositMessage CALLDICT
$send CALLDICT
}>
$__gen_TONB_requestWithdrawal PROC:<{
s1 s4 XCHG
257 PUSHINT
s0 s3 s5 XCPUXC
__tact_dict_set_int_slice INLINECALLDICT
257 PUSHINT
DUP
s3 s4 XCHG
s4 s0 s2 PUXC2
s6 s6 XCHG2
__tact_dict_set_int_int INLINECALLDICT
SWAP
INC
}>
$__gen_TONB_receive_Deposit PROC:<{ $__gen_TONB_receive_Deposit PROC:<{
__tact_context_get INLINECALLDICT __tact_context_get INLINECALLDICT
DROP DROP
@ -789,6 +898,7 @@ PROGRAM{
THROWANYIFNOT THROWANYIFNOT
TUCK TUCK
$__gen_TONB_mint CALLDICT $__gen_TONB_mint CALLDICT
$__gen_TONB_sendStake CALLDICT
}> }>
$__gen_TONB_receive PROC:<{ $__gen_TONB_receive PROC:<{
}> }>
@ -797,7 +907,7 @@ PROGRAM{
DROP DROP
6384 PUSHINT 6384 PUSHINT
s3 POP s3 POP
10000000 PUSHINT 100000000 PUSHINT
GEQ GEQ
s1 s2 XCHG s1 s2 XCHG
THROWANYIFNOT THROWANYIFNOT
@ -827,6 +937,62 @@ PROGRAM{
$__gen_TONB_requireWallet CALLDICT $__gen_TONB_requireWallet CALLDICT
s10 s12 XCPU s10 s12 XCPU
SUB SUB
__tact_my_balance INLINECALLDICT
100000000 PUSHINT
SUB
100000000 PUSHINT
SUB
s0 s13 PUSH2
LESS
IFJMP:<{
s1 s13 XCHG
SUB
FALSE
__tact_my_balance INLINECALLDICT
100000000 PUSHINT
SUB
s13 s(-1) PUXC
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
$send CALLDICT
0 PUSHINT
MYADDR
MYADDR
s2 PUSH
$emptySlice CALLDICT
s5 PUSH
4 -ROLL
PUSHNULL
PUSHNULL
__gen_writecell_TokenTransferInternal INLINECALLDICT
s13 s10 s9 PUSH3
s11 s10 s9 PUSH3
s11 s10 s9 PUSH3
s11 PUSH
21 s() PUSH
23 s() PUSH
$__gen_TONB_get_wallet_address CALLDICT
FALSE
s0 s2 XCHG
0 PUSHINT
64 PUSHINT
ROT
PUSHNULL
PUSHNULL
$send CALLDICT
s9 s11 XCHG
s8 s10 XCHG
s7 s9 XCHG
s6 s8 XCHG
s5 s7 XCHG
s4 s6 XCHG
s3 s5 XCHG
s4 s3 s0 XCHG3
$__gen_TONB_requestWithdrawal CALLDICT
}>
DROP
FALSE FALSE
s0 s12 s13 XCHG3 s0 s12 s13 XCHG3
0 PUSHINT 0 PUSHINT
@ -837,7 +1003,35 @@ PROGRAM{
s9 s10 XCHG s9 s10 XCHG
2 8 BLKSWAP 2 8 BLKSWAP
}> }>
$__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c PROC:<{
0 PUSHINT
WHILE:<{
s0 s1 PUSH2
LESS
}>DO<{
TRUE
s4 PUSH
257 PUSHINT
s3 PUSH
__tact_dict_get_int_slice INLINECALLDICT
__tact_not_null CALLDICT
257 PUSHINT
s5 s(-1) s(-1) PUXCPU
s5 s(-1) PUXC
__tact_dict_get_int_int INLINECALLDICT
__tact_not_null CALLDICT
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
$send CALLDICT
INC
}>
DROP
}>
recv_internal PROC:<{ recv_internal PROC:<{
c2 SAVE
SAMEALTSAVE
0 PUSHINT 0 PUSHINT
OVER OVER
SBITS SBITS
@ -944,9 +1138,11 @@ PROGRAM{
$__gen_TONB_receive_TokenUpdateContent CALLDICT $__gen_TONB_receive_TokenUpdateContent CALLDICT
__gen_store_TONB INLINECALLDICT __gen_store_TONB INLINECALLDICT
}> }>
DUP
2078119902 PUSHINT 2078119902 PUSHINT
EQUAL EQUAL
IFJMP:<{ IFJMP:<{
DROP
__gen_load_TONB INLINECALLDICT __gen_load_TONB INLINECALLDICT
s0 s11 XCHG s0 s11 XCHG
__gen_read_TokenBurnNotification INLINECALLDICT __gen_read_TokenBurnNotification INLINECALLDICT
@ -965,7 +1161,20 @@ PROGRAM{
$__gen_TONB_receive_TokenBurnNotification CALLDICT $__gen_TONB_receive_TokenBurnNotification CALLDICT
__gen_store_TONB INLINECALLDICT __gen_store_TONB INLINECALLDICT
}> }>
DROP 0 EQINT
IF:<{
HASHSU
112035188329905946142547757571014323481817249017271886940372980664113557830988 PUSHINT
EQUAL
IFJMP:<{
__gen_load_TONB INLINECALLDICT
$__gen_TONB_receive_comment_f7b1ab6077945b37370a1550574675180cf87df4cb047c869746812a83667d4c CALLDICT
__gen_store_TONB INLINECALLDICT
RETALT
}>
}>ELSE<{
DROP
}>
130 THROW 130 THROW
}> }>
supported_interfaces PROC:<{ supported_interfaces PROC:<{
@ -975,6 +1184,6 @@ PROGRAM{
86142586315491086060343270784266291122 PUSHINT 86142586315491086060343270784266291122 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d595669676674484d59586f317a47566e4d783268786f346a45734a71576d6a4a4a7139416157596539676670} PUSHSLICE x{697066733a2f2f516d554d424b59344c346e3447795471334d536e6347513858336e4c59716f6d6474635959636731647a55326953} PUSHSLICE
}> }>
}END>c }END>c

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

@ -1,6 +1,8 @@
SETCP0 SETCP0
(:methods (:methods
recv_internal: recv_internal:
c2 SAVE
SAMEALTSAVE
0 PUSHINT 0 PUSHINT
s1 PUSH s1 PUSH
SBITS SBITS
@ -145,7 +147,7 @@ SETCP0
s4 s5 XCHG s4 s5 XCHG
s3 s4 XCHG s3 s4 XCHG
s1 s3 s0 XCHG3 s1 s3 s0 XCHG3
52 CALLDICT 60 CALLDICT
<{ <{
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -328,7 +330,7 @@ SETCP0
}> CALLREF }> CALLREF
1 11 BLKDROP2 1 11 BLKDROP2
}> CALLREF }> CALLREF
53 CALLDICT 61 CALLDICT
<{ <{
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -529,7 +531,7 @@ SETCP0
s4 s5 XCHG s4 s5 XCHG
s3 s4 XCHG s3 s4 XCHG
s1 s3 s0 XCHG3 s1 s3 s0 XCHG3
54 CALLDICT 62 CALLDICT
<{ <{
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -737,7 +739,7 @@ SETCP0
s4 s5 XCHG s4 s5 XCHG
s3 s4 XCHG s3 s4 XCHG
s1 s3 s0 XCHG3 s1 s3 s0 XCHG3
55 CALLDICT 63 CALLDICT
<{ <{
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -828,9 +830,11 @@ SETCP0
}> CALLREF }> CALLREF
}> PUSHCONT }> PUSHCONT
IFJMP IFJMP
s0 PUSH
2078119902 PUSHINT 2078119902 PUSHINT
EQUAL EQUAL
<{ <{
s0 POP
<{ <{
c4 PUSH c4 PUSH
CTOS CTOS
@ -954,7 +958,7 @@ SETCP0
s5 s6 XCHG s5 s6 XCHG
s4 s5 XCHG s4 s5 XCHG
1 3 BLKSWAP 1 3 BLKSWAP
56 CALLDICT 64 CALLDICT
<{ <{
NEWC NEWC
2 GETGLOBVAR 2 GETGLOBVAR
@ -1045,28 +1049,214 @@ SETCP0
}> CALLREF }> CALLREF
}> PUSHCONT }> PUSHCONT
IFJMP IFJMP
s0 POP 0 EQINT
<{
HASHSU
112035188329905946142547757571014323481817249017271886940372980664113557830988 PUSHINT
EQUAL
<{
<{
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
<{
LDDICT
LDDICT
257 PUSHINT
LDI
3 1 BLKSWAP
}> CALLREF
s3 POP
s5 s11 XCHG
s5 s10 XCHG
s5 s9 XCHG
s5 s8 XCHG
s5 s7 XCHG
s5 s6 XCHG
ROT
}> CALLREF
1 11 BLKDROP2
}> CALLREF
65 CALLDICT
<{
NEWC
2 GETGLOBVAR
s0 s1 XCHG
STREF
11 1 BLKSWAP
<{
s11 s10 XCHG2
STGRAMS
s0 s8 XCHG2
STSLICER
s6 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s1 s6 XCHG
STREF
}> PUSHCONT
<{
s6 POP
0 PUSHINT
s0 s6 XCHG2
1 STI
}> PUSHCONT
IFELSE
s1 s4 XCHG
1 STI
ROT
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
s4 s3 XCHG2
<{
s2 s3 XCHG2
STDICT
STDICT
257 PUSHINT
STIX
}> CALLREF
ENDC
s0 s1 XCHG
STREF
}> CALLREF
ENDC
c4 POP
}> CALLREF
RETALT
}> PUSHCONT
IFJMP
}> PUSHCONT
<{
s0 POP
}> PUSHCONT
IFELSE
130 THROW 130 THROW
1: 2:
s0 PUSH s0 PUSH
ISNULL ISNULL
128 THROWIF 128 THROWIF
32: 37:
35: 40:
NEWC NEWC
ENDC ENDC
36: 41:
CTOS CTOS
37: 42:
35 CALLDICT 40 CALLDICT
36 CALLDICT 41 CALLDICT
38: 43:
0 PUSHINT 0 PUSHINT
ROTREV ROTREV
NEWC NEWC
@ -1097,7 +1287,7 @@ SETCP0
ENDC ENDC
CTOS CTOS
39: 44:
NEWC NEWC
1 PUSHINT 1 PUSHINT
s0 s1 XCHG s0 s1 XCHG
@ -1141,7 +1331,7 @@ SETCP0
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
s0 s4 XCHG s0 s4 XCHG
1 CALLDICT 2 CALLDICT
s0 s4 XCHG2 s0 s4 XCHG2
STREF STREF
}> PUSHCONT }> PUSHCONT
@ -1161,7 +1351,7 @@ SETCP0
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
s0 s4 XCHG s0 s4 XCHG
1 CALLDICT 2 CALLDICT
s0 s4 XCHG2 s0 s4 XCHG2
STREF STREF
}> PUSHCONT }> PUSHCONT
@ -1202,7 +1392,7 @@ SETCP0
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
s0 s1 XCHG s0 s1 XCHG
1 CALLDICT 2 CALLDICT
s0 s1 XCHG s0 s1 XCHG
STREF STREF
}> IFREFELSEREF }> IFREFELSEREF
@ -1214,7 +1404,18 @@ SETCP0
s0 s1 XCHG s0 s1 XCHG
1 STI 1 STI
40: 45:
-1 PUSHINT
0 PUSHINT
NEWC
PUSHSLICE
STSLICER
ENDC
s2 s4 XCHG
PUSHNULL
PUSHNULL
46:
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
@ -1272,7 +1473,7 @@ SETCP0
}> CALLREF }> CALLREF
ENDC ENDC
41: 47:
s0 s2 XCHG s0 s2 XCHG
CTOS CTOS
LDDICT LDDICT
@ -1295,9 +1496,9 @@ SETCP0
STDICT STDICT
ENDC ENDC
s0 s0 s3 XCHG3 s0 s0 s3 XCHG3
40 CALLDICT 46 CALLDICT
42: 48:
PUSHNULL PUSHNULL
s0 s4 XCHG s0 s4 XCHG
NEWC NEWC
@ -1331,7 +1532,7 @@ SETCP0
}> CALLREF }> CALLREF
ENDC ENDC
43: 49:
s0 s3 XCHG s0 s3 XCHG
CTOS CTOS
LDDICT LDDICT
@ -1355,39 +1556,39 @@ SETCP0
ENDC ENDC
3 1 BLKSWAP 3 1 BLKSWAP
s0 s4 XCHG s0 s4 XCHG
42 CALLDICT 48 CALLDICT
44: 50:
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
ROT ROT
41 CALLDICT 47 CALLDICT
45: 51:
44 CALLDICT 50 CALLDICT
11 2 BLKDROP2 11 2 BLKDROP2
38 CALLDICT 43 CALLDICT
46: 52:
MYADDR MYADDR
44 CALLDICT 50 CALLDICT
7 2 BLKDROP2 7 2 BLKDROP2
s0 POP s0 POP
s3 s3 s0 XCHG3 s3 s3 s0 XCHG3
47: 53:
s13 s1 XCPU s13 s1 XCPU
ADD ADD
11 2 BLKSWAP 11 2 BLKSWAP
44 CALLDICT 50 CALLDICT
2DUP 2DUP
38 CALLDICT 43 CALLDICT
2 GETGLOBVAR 2 GETGLOBVAR
MYADDR MYADDR
9 2 -2 PU2XC 9 2 -2 PU2XC
43 CALLDICT 49 CALLDICT
2DUP 2DUP
38 CALLDICT 43 CALLDICT
0 PUSHINT 0 PUSHINT
20000000 PUSHINT 20000000 PUSHINT
0 PUSHINT 0 PUSHINT
@ -1420,14 +1621,14 @@ SETCP0
s4 s1 s5 XCHG3 s4 s1 s5 XCHG3
s3 s15 XCHG s3 s15 XCHG
s1 s15 s0 XCHG3 s1 s15 s0 XCHG3
39 CALLDICT 44 CALLDICT
s8 PUSH s8 PUSH
s0 s8 XCHG s0 s8 XCHG
INC INC
0 PUSHINT 0 PUSHINT
MYADDR MYADDR
s1 PUSH s1 PUSH
37 CALLDICT 42 CALLDICT
s4 PUSH s4 PUSH
DEC DEC
s4 s7 XCHG s4 s7 XCHG
@ -1516,7 +1717,7 @@ SETCP0
0 PUSHINT 0 PUSHINT
s3 s1 s3 XCHG3 s3 s1 s3 XCHG3
s0 s17 XCHG s0 s17 XCHG
39 CALLDICT 44 CALLDICT
s8 s10 XCHG s8 s10 XCHG
s7 s9 XCHG s7 s9 XCHG
s6 s8 XCHG s6 s8 XCHG
@ -1525,7 +1726,7 @@ SETCP0
s0 s3 s5 XCHG3 s0 s3 s5 XCHG3
s1 s4 XCHG s1 s4 XCHG
48: 54:
s10 s13 XCHG s10 s13 XCHG
s9 s12 XCHG s9 s12 XCHG
s8 s11 XCHG s8 s11 XCHG
@ -1536,9 +1737,9 @@ SETCP0
s3 s12 XCHG s3 s12 XCHG
s11 s13 s12 XCHG3 s11 s13 s12 XCHG3
s11 PUSH s11 PUSH
44 CALLDICT 50 CALLDICT
2DUP 2DUP
38 CALLDICT 43 CALLDICT
0 PUSHINT 0 PUSHINT
0 PUSHINT 0 PUSHINT
64 PUSHINT 64 PUSHINT
@ -1588,28 +1789,28 @@ SETCP0
s0 s4 XCHG s0 s4 XCHG
s3 s15 XCHG s3 s15 XCHG
s15 s2 XCHG2 s15 s2 XCHG2
39 CALLDICT 44 CALLDICT
s7 s10 XCHG s7 s10 XCHG
3 7 BLKSWAP 3 7 BLKSWAP
49: 55:
1 GETGLOBVAR 1 GETGLOBVAR
4 UNTUPLE 4 UNTUPLE
s2 s3 XCHG s2 s3 XCHG
3 BLKDROP 3 BLKDROP
12 1 BLKSWAP 12 1 BLKSWAP
44 CALLDICT 50 CALLDICT
s0 s1 XCHG s0 s1 XCHG
4429 PUSHINT 4429 PUSHINT
s0 s2 XCHG s0 s2 XCHG
38 CALLDICT 43 CALLDICT
s0 s13 XCHG2 s0 s13 XCHG2
SDEQ SDEQ
s1 s12 XCHG s1 s12 XCHG
THROWANYIFNOT THROWANYIFNOT
1 10 BLKSWAP 1 10 BLKSWAP
50: 56:
1 GETGLOBVAR 1 GETGLOBVAR
4 UNTUPLE 4 UNTUPLE
s2 s3 XCHG s2 s3 XCHG
@ -1618,11 +1819,72 @@ SETCP0
SDEQ SDEQ
132 THROWIFNOT 132 THROWIFNOT
51: 57:
s9 s10 XCHG s9 s10 XCHG
10 BLKDROP 10 BLKDROP
52: 58:
s3 PUSH
ISNULL
IFRET
BALANCE
0 INDEX
100000000 PUSHINT
SUB
s0 PUSH
50000000 PUSHINT
LESS
<{
s0 POP
}> PUSHCONT
IFJMP
s4 PUSH
2 CALLDICT
45 CALLDICT
44 CALLDICT
59:
s1 s4 XCHG
257 PUSHINT
0 3 5 XCPUXC
s0 PUSH
ISNULL
<{
s0 POP
ROTREV
DICTIDEL
s0 POP
}> PUSHCONT
<{
s1 s3 s3 XCHG3
DICTISET
}> PUSHCONT
IFELSE
257 PUSHINT
s0 PUSH
s3 s4 XCHG
4 0 2 PUXC2
s6 s6 XCHG2
s1 PUSH
ISNULL
<{
2DROP
ROTREV
DICTIDEL
s0 POP
}> PUSHCONT
<{
NEWC
s0 s1 XCHG
STIX
s1 s3 s3 XCHG3
DICTISETB
}> PUSHCONT
IFELSE
s0 s1 XCHG
INC
60:
1 GETGLOBVAR 1 GETGLOBVAR
4 UNTUPLE 4 UNTUPLE
s0 POP s0 POP
@ -1640,32 +1902,33 @@ SETCP0
s1 s2 XCHG s1 s2 XCHG
THROWANYIFNOT THROWANYIFNOT
TUCK TUCK
47 CALLDICT 53 CALLDICT
58 CALLDICT
53: 61:
54: 62:
1 GETGLOBVAR 1 GETGLOBVAR
4 UNTUPLE 4 UNTUPLE
s0 POP s0 POP
6384 PUSHINT 6384 PUSHINT
s3 POP s3 POP
10000000 PUSHINT 100000000 PUSHINT
GEQ GEQ
s1 s2 XCHG s1 s2 XCHG
THROWANYIFNOT THROWANYIFNOT
TUCK TUCK
48 CALLDICT 54 CALLDICT
55: 63:
11 1 BLKSWAP 11 1 BLKSWAP
50 CALLDICT 56 CALLDICT
s8 POP s8 POP
s9 s10 XCHG s9 s10 XCHG
s8 s9 XCHG s8 s9 XCHG
1 7 BLKSWAP 1 7 BLKSWAP
56: 64:
s0 POP s0 POP
s2 POP s2 POP
s10 s12 XCHG s10 s12 XCHG
@ -1677,19 +1940,191 @@ SETCP0
s3 s11 XCHG s3 s11 XCHG
s12 s11 s12 XCHG3 s12 s11 s12 XCHG3
s11 PUSH s11 PUSH
49 CALLDICT 55 CALLDICT
s10 s12 XCPU s10 s12 XCPU
SUB SUB
BALANCE
0 INDEX
100000000 PUSHINT
SUB
100000000 PUSHINT
SUB
s0 s13 PUSH2
LESS
<{
s1 s13 XCHG
SUB
0 PUSHINT
BALANCE
0 INDEX
100000000 PUSHINT
SUB
s13 s-1 PUXC
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
44 CALLDICT
0 PUSHINT
MYADDR
MYADDR
s2 PUSH
42 CALLDICT
s5 PUSH
4 1 BLKSWAP
PUSHNULL
PUSHNULL
<{
NEWC
8 1 BLKSWAP
<{
395134233 PUSHINT
s0 s9 XCHG2
32 STU
s1 s7 XCHG
64 STU
s0 s5 XCHG2
STGRAMS
s0 s3 XCHG2
STSLICER
s0 s1 XCHG
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
s0 s1 XCHG
2 STU
}> PUSHCONT
<{
STSLICER
}> PUSHCONT
IFELSE
s0 s1 XCHG
STGRAMS
s0 s1 XCHG
STSLICER
NEWC
s2 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s1 s2 XCHG
257 PUSHINT
STIX
}> PUSHCONT
<{
s2 POP
0 PUSHINT
ROT
1 STI
}> PUSHCONT
IFELSE
ROT
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
s0 s1 XCHG
2 STU
}> PUSHCONT
<{
STSLICER
}> PUSHCONT
IFELSE
ENDC
s0 s1 XCHG
STREF
}> CALLREF
ENDC
}> CALLREF
13 10 9 PUSH3
11 10 9 PUSH3
11 10 9 PUSH3
s11 PUSH
s21 PUSH
s23 PUSH
51 CALLDICT
0 PUSHINT
s0 s2 XCHG
0 PUSHINT
64 PUSHINT
ROT
PUSHNULL
PUSHNULL
44 CALLDICT
s9 s11 XCHG
s8 s10 XCHG
s7 s9 XCHG
s6 s8 XCHG
s5 s7 XCHG
s4 s6 XCHG
s3 s5 XCHG
s4 s3 s0 XCHG3
59 CALLDICT
}> IFJMPREF
s0 POP
0 PUSHINT 0 PUSHINT
s0 s12 s13 XCHG3 s0 s12 s13 XCHG3
0 PUSHINT 0 PUSHINT
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
PUSHNULL PUSHNULL
39 CALLDICT 44 CALLDICT
s9 s10 XCHG s9 s10 XCHG
2 8 BLKSWAP 2 8 BLKSWAP
65:
0 PUSHINT
<{
s0 s1 PUSH2
LESS
}> PUSHCONT
<{
-1 PUSHINT
s4 PUSH
257 PUSHINT
s3 PUSH
ROTREV
DICTIGET
NULLSWAPIFNOT
<{
s0 POP
PUSHNULL
}> PUSHCONT
IFNOT
2 CALLDICT
257 PUSHINT
5 -1 -1 PUXCPU
s5 s-1 PUXC
s1 s3 s3 XCHG3
DICTIGET
NULLSWAPIFNOT
<{
s0 s1 XCHG
LDI
s0 POP
}> PUSHCONT
<{
2DROP
PUSHNULL
}> PUSHCONT
IFELSE
2 CALLDICT
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
44 CALLDICT
INC
}> PUSHCONT
WHILE
s0 POP
owner: owner:
<{ <{
c4 PUSH c4 PUSH
@ -1775,7 +2210,7 @@ SETCP0
}> CALLREF }> CALLREF
1 11 BLKDROP2 1 11 BLKDROP2
}> CALLREF }> CALLREF
51 CALLDICT 57 CALLDICT
get_wallet_address: get_wallet_address:
<{ <{
@ -1863,7 +2298,7 @@ SETCP0
1 11 BLKDROP2 1 11 BLKDROP2
}> CALLREF }> CALLREF
1 11 BLKSWAP 1 11 BLKSWAP
45 CALLDICT 51 CALLDICT
get_jetton_data: get_jetton_data:
<{ <{
@ -1950,8 +2385,8 @@ SETCP0
}> CALLREF }> CALLREF
1 11 BLKDROP2 1 11 BLKDROP2
}> CALLREF }> CALLREF
46 CALLDICT 52 CALLDICT
32 CALLDICT 37 CALLDICT
113617: 113617:
123515602279859691144772641439386770278 PUSHINT 123515602279859691144772641439386770278 PUSHINT

2
sources/output/jetton_TONB.md

@ -1,6 +1,6 @@
# TACT Compilation Report # TACT Compilation Report
Contract: TONB Contract: TONB
BOC Size: 1822 bytes BOC Size: 2191 bytes
# Types # Types
Total Types: 27 Total Types: 27

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

9
sources/output/jetton_TONB.ts

File diff suppressed because one or more lines are too long

49
sources/staking.tact

@ -1,3 +1,6 @@
import "constants";
import "messages";
fun stakingDepositMessage(value: Int, pool: Address): SendParameters { fun stakingDepositMessage(value: Int, pool: Address): SendParameters {
return SendParameters{ return SendParameters{
to: pool, to: pool,
@ -28,4 +31,50 @@ fun withdrawalSum(requests: WithdrawalRequests): Int {
i = i + 1; i = i + 1;
} }
return sum; return sum;
}
trait StakingTrait {
staking_pool: Address?;
withdrawal_requests: WithdrawalRequests;
fun sendStake() {
if(self.staking_pool == null) {
return;
}
let value: Int = myBalance() - tonb_floor;
if(value < ton("0.05")) {
return;
}
send(stakingDepositMessage(value, self.staking_pool!!));
}
fun sendWithdrawal() {
if(self.staking_pool == null) {
return;
}
let value: Int = withdrawalSum(self.withdrawal_requests);
send(stakingWithdrawMessage(value, self.staking_pool!!));
}
receive("Withdraw completed") {
let i: Int = 0;
while(i < self.withdrawal_requests.n_requests) {
send(SendParameters{
to: self.withdrawal_requests.addresses.get(i)!!,
value: self.withdrawal_requests.amounts.get(i)!!
});
i = i + 1;
}
// self.withdrawal_requests = WithdrawalRequests{
// addresses: addresses,
// amounts: amounts
// };
// todo: initialize withdrawal_requests
}
fun requestWithdrawal(address: Address, value: Int) {
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.n_requests = self.withdrawal_requests.n_requests + 1;
}
} }
Loading…
Cancel
Save