Browse Source

Pseudostaking, foundation, started the voting spec

master
Lev 2 years ago
parent
commit
93dbc8e3bb
  1. 98
      sources/cli.js
  2. 17
      sources/foundation.tact
  3. 2
      sources/jetton.tact
  4. 4
      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. 6
      sources/output/jetton_Linker.md
  9. 2
      sources/output/jetton_Linker.pkg
  10. 41
      sources/output/jetton_Linker.ts
  11. 1
      sources/output/jetton_PseudoStaking.abi
  12. BIN
      sources/output/jetton_PseudoStaking.code.boc
  13. 195
      sources/output/jetton_PseudoStaking.code.fc
  14. 311
      sources/output/jetton_PseudoStaking.code.fif
  15. 300
      sources/output/jetton_PseudoStaking.code.rev.fif
  16. BIN
      sources/output/jetton_PseudoStaking.init.boc
  17. 24
      sources/output/jetton_PseudoStaking.init.fc
  18. 24
      sources/output/jetton_PseudoStaking.init.fif
  19. 19
      sources/output/jetton_PseudoStaking.init.rev.fif
  20. 121
      sources/output/jetton_PseudoStaking.md
  21. 1
      sources/output/jetton_PseudoStaking.pkg
  22. 1539
      sources/output/jetton_PseudoStaking.ts
  23. 2
      sources/output/jetton_TONB.abi
  24. 2
      sources/output/jetton_TONB.code.fc
  25. 2
      sources/output/jetton_TONB.code.fif
  26. 6
      sources/output/jetton_TONB.md
  27. 2
      sources/output/jetton_TONB.pkg
  28. 41
      sources/output/jetton_TONB.ts
  29. 2
      sources/output/jetton_TONBWallet.abi
  30. 2
      sources/output/jetton_TONBWallet.code.fc
  31. 2
      sources/output/jetton_TONBWallet.code.fif
  32. 6
      sources/output/jetton_TONBWallet.md
  33. 2
      sources/output/jetton_TONBWallet.pkg
  34. 41
      sources/output/jetton_TONBWallet.ts
  35. 25
      sources/pseudostaking.tact
  36. 4
      sources/staking.tact
  37. 18
      sources/tests/__snapshots__/jetton.spec.ts.snap
  38. 12
      sources/tests/jetton.spec.ts
  39. 20
      sources/tests/voting.spec.ts

98
sources/cli.js

@ -0,0 +1,98 @@
const subcommand = require('subcommand');
const { deployTONB, deposit, withdraw, transfer, blacklistAddress } = require('./utils/interactions');
const { wallet_data, client } = require('./utils/config');
const { randomAddress, TON } = require('./utils/helpers');
const { toNano, Address } = require('ton');
const match = subcommand([
{
name: 'deposit',
options: [
{
name: 'amount',
help: 'Amount of TON to deposit',
default: '0.45'
},
{
name: 'wallet',
abbr: 'w',
default: '0',
required: false
}
],
async command(opts) {
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1]));
let tonb_addr = await deployTONB(undefined, true);
await deposit(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr);
}
},
{
name: 'withdraw',
options: [
{
name: 'amount',
abbr: 'a',
help: 'Amount of TON to withdraw',
default: '0.2'
},
{
name: 'wallet',
abbr: 'w',
default: '0',
required: false
}
],
async command(opts) {
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1]));
let tonb_addr = await deployTONB(undefined, true);
await withdraw(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr);
}
},
{
name: 'transfer',
options: [
{
name: 'amount',
help: 'Amount of TON to transfer',
default: '0.2'
},
{
name: 'address',
help: 'Address to transfer TON to',
default: randomAddress()
}],
async command(opts) {
let {my_wallet, secretKey} = await wallet_data();
let tonb_addr = await deployTONB(undefined, true);
await transfer(my_wallet, secretKey, parseFloat(opts._[0]) * 1000000000, tonb_addr, opts._[1]);
}
},
{
name: 'blacklist',
options: [
{
name: 'address',
},
{
name: 'wallet',
abbr: 'w',
default: '0',
required: false
}
],
async command(opts) {
let {my_wallet, secretKey} = await wallet_data(parseInt(opts._[1]));
let tonb_addr = await deployTONB(undefined, true);
if (!opts._[0]) {
opts._[0] = 'kQD7zbEMaWC2yMgSJXmIF7HbLr1yuBo2GnZF_CJNkUiGSVZ8'// my_wallet.address;
}
let addr = Address.parse(opts._[0]);
await blacklistAddress(my_wallet, secretKey, tonb_addr, addr);
}
}
]);
const argv = process.argv.slice(2);
let opts = match(argv);

17
sources/foundation.tact

@ -17,12 +17,15 @@ struct Vote {
result: Bool?; // None - no result, True - passed, False - failed result: Bool?; // None - no result, True - passed, False - failed
} }
fun get_message(prop: Proposal): Cell { fun vote_res(prop: Proposal): Cell? {
if (prop.type == 0) { if (prop.type == 0) {
return BlacklistWallet { return BlacklistWallet {
wallet: prop.data.readAddress() wallet: prop.data.readAddress()
}.asCell(); }.asCell();
} }
if (prop.type == 1) {
// todo
}
} }
contract Foundation { contract Foundation {
@ -71,14 +74,22 @@ contract Foundation {
self.votes.set(msg.vote_id, vote); self.votes.set(msg.vote_id, vote);
if (vote.result == true) { if (vote.result == true) {
let msg: Cell = get_message(vote.proposal); let vres: Cell? = vote_res(vote.proposal);
if (vres != null) {
send(SendParameters{ send(SendParameters{
to: self.tonb, to: self.tonb,
value: 0, value: 0,
mode: SendRemainingValue, mode: SendRemainingValue,
body: msg body: vres!!
}); });
} }
if(vote.proposal.type == 2) {
// self.admins = Distribution {
// addresses: vote.proposal.data.readAddressList(),
// percents: vote.proposal.data.readPercents()
// };
}
}
} }

2
sources/jetton.tact

@ -5,6 +5,7 @@ import "./linker";
import "./jetton_trait"; import "./jetton_trait";
import "./staking"; import "./staking";
import "./constants"; import "./constants";
import "./pseudostaking";
message Deposit { message Deposit {
amount: Int as coins; amount: Int as coins;
@ -26,6 +27,7 @@ contract TONB with TONBTrait {
last_linker: Address?; last_linker: Address?;
n_linkers: Int = 0; n_linkers: Int = 0;
staking_pool: Address?; staking_pool: Address?;
in_the_pool: Int = 0;
withdrawal_requests: WithdrawalRequests; withdrawal_requests: WithdrawalRequests;
init(owner: Address, content: Cell?) { init(owner: Address, content: Cell?) {

4
sources/messages.tact

@ -48,6 +48,10 @@ message TokenUpdateContent {
content: Cell?; content: Cell?;
} }
message(0xda803efd) StakingWithdraw {
value: Int as coins;
}
struct JettonData { struct JettonData {
totalSupply: Int; totalSupply: Int;
mintable: Bool; mintable: Bool;

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://Qmd4VoPiDkKcRnC2NE9UhqMyeg5rwYtt115YFSjLfcoLrb"; return "ipfs://QmcaNamVs7qjMiic6ATCSqKuXsaffQQmXU43UPgK6t2sGc";
} }

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{697066733a2f2f516d6434566f5069446b4b63526e43324e45395568714d7965673572775974743131355946536a4c66636f4c7262} PUSHSLICE x{697066733a2f2f516d63614e616d567337716a4d6969633641544353714b75587361666651516d585534335550674b367432734763} PUSHSLICE
}> }>
}END>c }END>c

6
sources/output/jetton_Linker.md

@ -3,7 +3,7 @@ Contract: Linker
BOC Size: 645 bytes BOC Size: 645 bytes
# Types # Types
Total Types: 27 Total Types: 28
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -45,6 +45,10 @@ Signature: `TokenExcesses{queryId:uint64}`
TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent` TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent`
Signature: `TokenUpdateContent{content:Maybe ^cell}` Signature: `TokenUpdateContent{content:Maybe ^cell}`
## StakingWithdraw
TLB: `staking_withdraw#da803efd value:coins = StakingWithdraw`
Signature: `StakingWithdraw{value:coins}`
## JettonData ## JettonData
TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData` TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData`
Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}` Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}`

2
sources/output/jetton_Linker.pkg

File diff suppressed because one or more lines are too long

41
sources/output/jetton_Linker.ts

@ -568,6 +568,47 @@ function dictValueParserTokenUpdateContent(): DictionaryValue<TokenUpdateContent
} }
} }
} }
export type StakingWithdraw = {
$$type: 'StakingWithdraw';
value: bigint;
}
export function storeStakingWithdraw(src: StakingWithdraw) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3665837821, 32);
b_0.storeCoins(src.value);
};
}
export function loadStakingWithdraw(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3665837821) { throw Error('Invalid prefix'); }
let _value = sc_0.loadCoins();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function loadTupleStakingWithdraw(source: TupleReader) {
let _value = source.readBigNumber();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function storeTupleStakingWithdraw(source: StakingWithdraw) {
let builder = new TupleBuilder();
builder.writeNumber(source.value);
return builder.build();
}
function dictValueParserStakingWithdraw(): DictionaryValue<StakingWithdraw> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeStakingWithdraw(src)).endCell());
},
parse: (src) => {
return loadStakingWithdraw(src.loadRef().beginParse());
}
}
}
export type JettonData = { export type JettonData = {
$$type: 'JettonData'; $$type: 'JettonData';
totalSupply: bigint; totalSupply: bigint;

1
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.

195
sources/output/jetton_PseudoStaking.code.fc

@ -0,0 +1,195 @@
#pragma version =0.4.1;
#pragma allow-post-modification;
#pragma compute-asm-ltr;
forall X -> X __tact_not_null(X x) inline { throw_if(128, null?(x)); return x; }
(cell, int) __tact_dict_delete(cell dict, int key_len, slice index) asm(index dict key_len) "DICTDEL";
(slice, int) __tact_dict_get(cell dict, int key_len, slice index) asm(index dict key_len) "DICTGET" "NULLSWAPIFNOT";
global (int, slice, int, slice) __tact_context;
global cell __tact_context_sys;
(int, slice, int, slice) __tact_context_get() inline { return __tact_context; }
() __tact_verify_address(slice address) inline {
throw_unless(136, address.slice_bits() != 267);
}
builder __tact_store_bool(builder b, int v) inline {
b = b.store_int(v, 1);
return b;
}
builder __tact_store_address(builder b, slice address) inline {
__tact_verify_address(address);
b = b.store_slice(address);
return b;
}
(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl) {
if (null?(v)) {
var (r, ok) = __tact_dict_delete(d, kl, k);
return (r, ());
} else {
return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ());
}
}
int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl) inline {
var (r, ok) = __tact_dict_get(d, kl, k);
if (ok) {
return r~load_int(vl);
} else {
return null();
}
}
(slice, ((int))) __gen_read_StakingWithdraw(slice sc_0) inline {
throw_unless(129, sc_0~load_uint(32) == 3665837821);
var v'value = sc_0~load_coins();
return (sc_0, (v'value));
}
builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline {
var (v'stakes) = v;
build_0 = build_0.store_dict(v'stakes);
return build_0;
}
(slice, ((cell))) __gen_read_PseudoStaking(slice sc_0) inline {
var v'stakes = sc_0~load_dict();
return (sc_0, (v'stakes));
}
(cell) __gen_load_PseudoStaking() inline {
slice sc = get_data().begin_parse();
__tact_context_sys = sc~load_ref();
return sc~__gen_read_PseudoStaking();
}
() __gen_store_PseudoStaking((cell) v) impure inline {
builder b = begin_cell();
b = b.store_ref(__tact_context_sys);
b = __gen_write_PseudoStaking(b, v);
set_data(b.end_cell());
}
() $send((int, slice, int, int, cell, cell, cell) $params) impure inline_ref {
var (($params'bounce, $params'to, $params'value, $params'mode, $params'body, $params'code, $params'data)) = $params;
builder $b = begin_cell();
$b = store_int($b, 1, 2);
$b = __tact_store_bool($b, $params'bounce);
$b = store_int($b, 0, 3);
$b = __tact_store_address($b, $params'to);
$b = store_coins($b, $params'value);
$b = store_int($b, 0, ((((1 + 4) + 4) + 64) + 32));
if (((~ null?($params'code)) | (~ null?($params'data)))) {
$b = __tact_store_bool($b, true);
builder $bc = begin_cell();
$bc = __tact_store_bool($bc, false);
$bc = __tact_store_bool($bc, false);
if ((~ null?($params'code))) {
$bc = __tact_store_bool($bc, true);
$bc = store_ref($bc, __tact_not_null($params'code));
} else {
$bc = __tact_store_bool($bc, false);
}
if ((~ null?($params'data))) {
$bc = __tact_store_bool($bc, true);
$bc = store_ref($bc, __tact_not_null($params'data));
} else {
$bc = __tact_store_bool($bc, false);
}
$bc = __tact_store_bool($bc, false);
$b = __tact_store_bool($b, true);
$b = store_ref($b, end_cell($bc));
} else {
$b = __tact_store_bool($b, false);
}
cell $body = $params'body;
if ((~ null?($body))) {
$b = __tact_store_bool($b, true);
$b = store_ref($b, __tact_not_null($body));
} else {
$b = __tact_store_bool($b, false);
}
cell $c = end_cell($b);
send_raw_message($c, $params'mode);
}
((cell), ()) $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638((cell) $self) impure inline {
var ($self'stakes) = $self;
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
slice $sender = $ctx'sender;
int $ex_stake = __tact_dict_get_slice_int($self'stakes, 267, $sender, 257);
if (null?($ex_stake)) {
$ex_stake = 0;
}
$self'stakes~__tact_dict_set_slice_int(267, $sender, (__tact_not_null($ex_stake) + $ctx'value), 257);
return (($self'stakes), ());
}
(((cell)), ()) $__gen_PseudoStaking_receive_StakingWithdraw((cell) $self, (int) $msg) impure inline {
var ($self'stakes) = $self;
var ($msg'value) = $msg;
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
$send((true, $ctx'sender, $msg'value, 0, null(), null(), null()));
return (($self'stakes), ());
}
() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure {
;; Parse incoming message
int op = 0;
if (slice_bits(in_msg) >= 32) {
op = in_msg.preload_uint(32);
}
var cs = in_msg_cell.begin_parse();
var msg_flags = cs~load_uint(4);
var msg_bounced = ((msg_flags & 1) == 1 ? true : false);
slice msg_sender_addr = cs~load_msg_addr();
__tact_context = (msg_bounced, msg_sender_addr, msg_value, cs);
;; Handle bounced messages
if (msg_bounced) {
return ();
}
;; Receive StakingWithdraw message
if (op == 3665837821) {
var self = __gen_load_PseudoStaking();
var msg = in_msg~__gen_read_StakingWithdraw();
self~$__gen_PseudoStaking_receive_StakingWithdraw(msg);
__gen_store_PseudoStaking(self);
return ();
}
;; Text Receivers
if (op == 0) {
var text_op = slice_hash(in_msg);
;; Receive "Deposit" message
if (text_op == 0x2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638) {
var self = __gen_load_PseudoStaking();
self~$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638();
__gen_store_PseudoStaking(self);
return ();
}
}
throw(130);
}
_ supported_interfaces() method_id {
return (
"org.ton.introspection.v0"H >> 128,
"org.ton.abi.ipfs.v0"H >> 128
);
}
_ get_abi_ipfs() {
return "ipfs://QmWUgDgfWMDJUh9Ga3MPmqtyhuJnxvzjwT6b4Ka3UuutJg";
}

311
sources/output/jetton_PseudoStaking.code.fif

@ -0,0 +1,311 @@
PROGRAM{
DECLPROC __tact_not_null
DECLPROC __tact_context_get
DECLPROC __tact_verify_address
DECLPROC __tact_store_bool
DECLPROC __tact_store_address
DECLPROC __tact_dict_set_slice_int
DECLPROC __tact_dict_get_slice_int
DECLPROC __gen_read_StakingWithdraw
DECLPROC __gen_write_PseudoStaking
DECLPROC __gen_read_PseudoStaking
DECLPROC __gen_load_PseudoStaking
DECLPROC __gen_store_PseudoStaking
DECLPROC $send
DECLPROC $__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638
DECLPROC $__gen_PseudoStaking_receive_StakingWithdraw
DECLPROC recv_internal
113617 DECLMETHOD supported_interfaces
DECLPROC get_abi_ipfs
DECLGLOBVAR __tact_context
DECLGLOBVAR __tact_context_sys
__tact_not_null PROCINLINE:<{
DUP
ISNULL
128 THROWIF
}>
__tact_context_get PROCINLINE:<{
__tact_context GETGLOB
4 UNTUPLE
}>
__tact_verify_address PROCINLINE:<{
SBITS
267 PUSHINT
NEQ
136 THROWIFNOT
}>
__tact_store_bool PROCINLINE:<{
SWAP
1 STI
}>
__tact_store_address PROCINLINE:<{
STSLICER
}>
__tact_dict_set_slice_int PROC:<{
OVER
ISNULL
IFJMP:<{
2DROP
-ROT
DICTDEL
DROP
}>
NEWC
SWAP
STIX
s1 s3 s3 XCHG3
DICTSETB
}>
__tact_dict_get_slice_int PROCINLINE:<{
s1 s3 s3 XCHG3
DICTGET
NULLSWAPIFNOT
IF:<{
SWAP
LDIX
DROP
}>ELSE<{
2DROP
PUSHNULL
}>
}>
__gen_read_StakingWithdraw PROCINLINE:<{
32 LDU
SWAP
3665837821 PUSHINT
EQUAL
129 THROWIFNOT
LDGRAMS
SWAP
}>
__gen_write_PseudoStaking PROCINLINE:<{
SWAP
STDICT
}>
__gen_read_PseudoStaking PROCINLINE:<{
LDDICT
SWAP
}>
__gen_load_PseudoStaking PROCINLINE:<{
c4 PUSH
CTOS
LDREF
SWAP
__tact_context_sys SETGLOB
__gen_read_PseudoStaking INLINECALLDICT
NIP
}>
__gen_store_PseudoStaking PROCINLINE:<{
NEWC
__tact_context_sys GETGLOB
SWAP
STREF
SWAP
__gen_write_PseudoStaking INLINECALLDICT
ENDC
c4 POP
}>
$send PROCREF:<{
NEWC
1 PUSHINT
SWAP
2 STI
s0 s7 XCHG2
__tact_store_bool INLINECALLDICT
0 PUSHINT
SWAP
3 STI
s0 s5 XCHG2
__tact_store_address INLINECALLDICT
s0 s3 XCHG2
STGRAMS
0 PUSHINT
SWAP
105 STI
s3 PUSH
ISNULL
NOT
s5 PUSH
ISNULL
NOT
OR
IF:<{
TRUE
__tact_store_bool INLINECALLDICT
NEWC
FALSE
__tact_store_bool INLINECALLDICT
FALSE
__tact_store_bool INLINECALLDICT
s4 PUSH
ISNULL
NOT
IF:<{
TRUE
__tact_store_bool INLINECALLDICT
s0 s4 XCHG
__tact_not_null INLINECALLDICT
s0 s4 XCHG2
STREF
}>ELSE<{
s4 POP
s0 s3 XCHG
FALSE
__tact_store_bool INLINECALLDICT
}>
s4 PUSH
ISNULL
NOT
IF:<{
TRUE
__tact_store_bool INLINECALLDICT
s0 s4 XCHG
__tact_not_null INLINECALLDICT
s0 s4 XCHG2
STREF
}>ELSE<{
s4 POP
s0 s3 XCHG
FALSE
__tact_store_bool INLINECALLDICT
}>
FALSE
__tact_store_bool INLINECALLDICT
s0 s2 XCHG
TRUE
__tact_store_bool INLINECALLDICT
s0 s2 XCHG
ENDC
ROT
STREF
}>ELSE<{
s3 POP
s3 POP
SWAP
FALSE
__tact_store_bool INLINECALLDICT
}>
OVER
ISNULL
NOT
IF:<{
TRUE
__tact_store_bool INLINECALLDICT
SWAP
__tact_not_null INLINECALLDICT
SWAP
STREF
}>ELSE<{
NIP
FALSE
__tact_store_bool INLINECALLDICT
}>
ENDC
SWAP
SENDRAWMSG
}>
$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 PROCINLINE:<{
__tact_context_get INLINECALLDICT
DROP
s2 POP
s2 PUSH
267 PUSHINT
s2 PUSH
257 PUSHINT
__tact_dict_get_slice_int INLINECALLDICT
DUP
ISNULL
IF:<{
DROP
0 PUSHINT
}>
267 PUSHINT
SWAP
__tact_not_null INLINECALLDICT
s0 s3 XCHG2
ADD
257 PUSHINT
__tact_dict_set_slice_int CALLDICT
}>
$__gen_PseudoStaking_receive_StakingWithdraw PROCINLINE:<{
__tact_context_get INLINECALLDICT
s2 s3 XCHG
3 BLKDROP
TRUE
s0 s2 XCHG
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
$send INLINECALLDICT
}>
recv_internal PROC:<{
c2 SAVE
SAMEALTSAVE
0 PUSHINT
OVER
SBITS
31 GTINT
IF:<{
DROP
DUP
32 PLDU
}>
s0 s2 XCHG
CTOS
4 LDU
SWAP
1 PUSHINT
AND
1 EQINT
IF:<{
TRUE
}>ELSE<{
FALSE
}>
SWAP
LDMSGADDR
s2 PUSH
s6 s6 XCHG2
4 TUPLE
__tact_context SETGLOB
s0 s2 XCHG
IFJMP:<{
2DROP
}>
DUP
3665837821 PUSHINT
EQUAL
IFJMP:<{
DROP
__gen_load_PseudoStaking INLINECALLDICT
SWAP
__gen_read_StakingWithdraw INLINECALLDICT
NIP
$__gen_PseudoStaking_receive_StakingWithdraw INLINECALLDICT
__gen_store_PseudoStaking INLINECALLDICT
}>
0 EQINT
IF:<{
HASHSU
20712925151889215669912116818955575927875783670988084319049521716100301489720 PUSHINT
EQUAL
IFJMP:<{
__gen_load_PseudoStaking INLINECALLDICT
$__gen_PseudoStaking_receive_comment_2dcb19a5b89db9d3377fc651c6f9b6b92db9be624060c62a50572cdc97968638 INLINECALLDICT
__gen_store_PseudoStaking INLINECALLDICT
RETALT
}>
}>ELSE<{
DROP
}>
130 THROW
}>
supported_interfaces PROC:<{
123515602279859691144772641439386770278 PUSHINT
209801025412363888721030803524359905849 PUSHINT
}>
get_abi_ipfs PROC:<{
x{697066733a2f2f516d575567446766574d444a5568394761334d506d71747968754a6e78767a6a77543662344b6133557575744a67} PUSHSLICE
}>
}END>c

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

@ -0,0 +1,300 @@
SETCP0
(:methods
recv_internal:
c2 SAVE
SAMEALTSAVE
0 PUSHINT
s1 PUSH
SBITS
31 GTINT
<{
s0 POP
s0 PUSH
32 PLDU
}> PUSHCONT
IF
s0 s2 XCHG
CTOS
4 LDU
s0 s1 XCHG
1 PUSHINT
AND
1 EQINT
<{
-1 PUSHINT
}> PUSHCONT
<{
0 PUSHINT
}> PUSHCONT
IFELSE
s0 s1 XCHG
LDMSGADDR
s2 PUSH
s6 s6 XCHG2
4 TUPLE
1 SETGLOBVAR
s0 s2 XCHG
<{
2DROP
}> PUSHCONT
IFJMP
s0 PUSH
3665837821 PUSHINT
EQUAL
<{
s0 POP
c4 PUSH
CTOS
LDREF
s0 s1 XCHG
2 SETGLOBVAR
LDDICT
s0 s1 XCHG
s1 POP
s0 s1 XCHG
32 LDU
s0 s1 XCHG
3665837821 PUSHINT
EQUAL
129 THROWIFNOT
LDGRAMS
s0 s1 XCHG
s1 POP
1 GETGLOBVAR
4 UNTUPLE
s2 s3 XCHG
3 BLKDROP
-1 PUSHINT
s0 s2 XCHG
0 PUSHINT
PUSHNULL
PUSHNULL
PUSHNULL
<{
NEWC
1 PUSHINT
s0 s1 XCHG
2 STI
s0 s7 XCHG2
s0 s1 XCHG
1 STI
0 PUSHINT
s0 s1 XCHG
3 STI
s0 s5 XCHG2
STSLICER
s0 s3 XCHG2
STGRAMS
0 PUSHINT
s0 s1 XCHG
105 STI
s3 PUSH
ISNULL
NOT
s5 PUSH
ISNULL
NOT
OR
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
NEWC
0 PUSHINT
s0 s1 XCHG
1 STI
0 PUSHINT
s0 s1 XCHG
1 STI
s4 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s0 s4 XCHG
s0 PUSH
ISNULL
128 THROWIF
s0 s4 XCHG2
STREF
}> PUSHCONT
<{
s4 POP
s0 s3 XCHG
0 PUSHINT
s0 s1 XCHG
1 STI
}> PUSHCONT
IFELSE
s4 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s0 s4 XCHG
s0 PUSH
ISNULL
128 THROWIF
s0 s4 XCHG2
STREF
}> PUSHCONT
<{
s4 POP
s0 s3 XCHG
0 PUSHINT
s0 s1 XCHG
1 STI
}> PUSHCONT
IFELSE
0 PUSHINT
s0 s1 XCHG
1 STI
s0 s2 XCHG
-1 PUSHINT
s0 s1 XCHG
1 STI
s0 s2 XCHG
ENDC
ROT
STREF
}> PUSHCONT
<{
s3 POP
s3 POP
s0 s1 XCHG
0 PUSHINT
s0 s1 XCHG
1 STI
}> PUSHCONT
IFELSE
s1 PUSH
ISNULL
NOT
<{
-1 PUSHINT
s0 s1 XCHG
1 STI
s0 s1 XCHG
s0 PUSH
ISNULL
128 THROWIF
s0 s1 XCHG
STREF
}> PUSHCONT
<{
s1 POP
0 PUSHINT
s0 s1 XCHG
1 STI
}> PUSHCONT
IFELSE
ENDC
s0 s1 XCHG
SENDRAWMSG
}> CALLREF
NEWC
2 GETGLOBVAR
s0 s1 XCHG
STREF
s0 s1 XCHG
s0 s1 XCHG
STDICT
ENDC
c4 POP
}> PUSHCONT
IFJMP
0 EQINT
<{
s0 POP
}> PUSHCONT
<{
HASHSU
20712925151889215669912116818955575927875783670988084319049521716100301489720 PUSHINT
EQUAL
<{
c4 PUSH
CTOS
LDREF
s0 s1 XCHG
2 SETGLOBVAR
LDDICT
s0 s1 XCHG
s1 POP
1 GETGLOBVAR
4 UNTUPLE
s0 POP
s2 POP
s2 PUSH
267 PUSHINT
s2 PUSH
257 PUSHINT
s1 s3 s3 XCHG3
DICTGET
NULLSWAPIFNOT
<{
s0 s1 XCHG
LDI
s0 POP
}> PUSHCONT
<{
2DROP
PUSHNULL
}> PUSHCONT
IFELSE
s0 PUSH
ISNULL
<{
s0 POP
0 PUSHINT
}> PUSHCONT
IF
267 PUSHINT
s0 s1 XCHG
s0 PUSH
ISNULL
128 THROWIF
s0 s3 XCHG2
ADD
257 PUSHINT
6 CALLDICT
NEWC
2 GETGLOBVAR
s0 s1 XCHG
STREF
s0 s1 XCHG
s0 s1 XCHG
STDICT
ENDC
c4 POP
RETALT
}> PUSHCONT
IFJMP
}> IFREFELSE
130 THROW
6:
s1 PUSH
ISNULL
<{
2DROP
ROTREV
DICTDEL
s0 POP
}> PUSHCONT
IFJMP
NEWC
s0 s1 XCHG
STIX
s1 s3 s3 XCHG3
DICTSETB
113617:
123515602279859691144772641439386770278 PUSHINT
209801025412363888721030803524359905849 PUSHINT
) 19 DICTPUSHCONST
DICTIGETJMPZ
11 THROWARG

BIN
sources/output/jetton_PseudoStaking.init.boc

Binary file not shown.

24
sources/output/jetton_PseudoStaking.init.fc

@ -0,0 +1,24 @@
#pragma version =0.4.1;
#pragma allow-post-modification;
#pragma compute-asm-ltr;
builder __gen_write_PseudoStaking(builder build_0, (cell) v) inline {
var (v'stakes) = v;
build_0 = build_0.store_dict(v'stakes);
return build_0;
}
cell $__gen_PseudoStaking_init(cell sys') {
var (($self'stakes)) = (null());
var b' = begin_cell();
b' = b'.store_ref(sys');
b' = __gen_write_PseudoStaking(b', ($self'stakes));
return b'.end_cell();
}
cell init(cell sys') method_id {
return $__gen_PseudoStaking_init(sys');
}
() main() {
}

24
sources/output/jetton_PseudoStaking.init.fif

@ -0,0 +1,24 @@
PROGRAM{
DECLPROC __gen_write_PseudoStaking
DECLPROC $__gen_PseudoStaking_init
107886 DECLMETHOD init
DECLPROC main
__gen_write_PseudoStaking PROCINLINE:<{
SWAP
STDICT
}>
$__gen_PseudoStaking_init PROC:<{
PUSHNULL
SWAP
NEWC
STREF
SWAP
__gen_write_PseudoStaking INLINECALLDICT
ENDC
}>
init PROC:<{
$__gen_PseudoStaking_init CALLDICT
}>
main PROC:<{
}>
}END>c

19
sources/output/jetton_PseudoStaking.init.rev.fif

@ -0,0 +1,19 @@
SETCP0
(:methods
recv_internal:
2:
PUSHNULL
s0 s1 XCHG
NEWC
STREF
s0 s1 XCHG
s0 s1 XCHG
STDICT
ENDC
107886:
2 CALLDICT
) 19 DICTPUSHCONST
DICTIGETJMPZ
11 THROWARG

121
sources/output/jetton_PseudoStaking.md

@ -0,0 +1,121 @@
# TACT Compilation Report
Contract: PseudoStaking
BOC Size: 495 bytes
# Types
Total Types: 28
## StateInit
TLB: `_ code:^cell data:^cell = StateInit`
Signature: `StateInit{code:^cell,data:^cell}`
## Context
TLB: `_ bounced:bool sender:address value:int257 raw:^slice = Context`
Signature: `Context{bounced:bool,sender:address,value:int257,raw:^slice}`
## SendParameters
TLB: `_ bounce:bool to:address value:int257 mode:int257 body:Maybe ^cell code:Maybe ^cell data:Maybe ^cell = SendParameters`
Signature: `SendParameters{bounce:bool,to:address,value:int257,mode:int257,body:Maybe ^cell,code:Maybe ^cell,data:Maybe ^cell}`
## TokenTransfer
TLB: `token_transfer#0f8a7ea5 queryId:uint64 amount:coins destination:address responseDestination:Maybe address customPayload:Maybe ^cell forwardTonAmount:coins forwardPayload:remainder<slice> = TokenTransfer`
Signature: `TokenTransfer{queryId:uint64,amount:coins,destination:address,responseDestination:Maybe address,customPayload:Maybe ^cell,forwardTonAmount:coins,forwardPayload:remainder<slice>}`
## TokenTransferInternal
TLB: `token_transfer_internal#178d4519 queryId:uint64 amount:coins from:address responseAddress:Maybe address forwardTonAmount:coins forwardPayload:remainder<slice> setLinker:Maybe int257 setLinkerAddress:Maybe address = TokenTransferInternal`
Signature: `TokenTransferInternal{queryId:uint64,amount:coins,from:address,responseAddress:Maybe address,forwardTonAmount:coins,forwardPayload:remainder<slice>,setLinker:Maybe int257,setLinkerAddress:Maybe address}`
## TokenNotification
TLB: `token_notification#7362d09c queryId:uint64 amount:coins from:address forwardPayload:remainder<slice> = TokenNotification`
Signature: `TokenNotification{queryId:uint64,amount:coins,from:address,forwardPayload:remainder<slice>}`
## TokenBurn
TLB: `token_burn#595f07bc queryId:uint64 amount:coins owner:address responseAddress:Maybe address = TokenBurn`
Signature: `TokenBurn{queryId:uint64,amount:coins,owner:address,responseAddress:Maybe address}`
## TokenBurnNotification
TLB: `token_burn_notification#7bdd97de queryId:uint64 amount:coins owner:address responseAddress:Maybe address = TokenBurnNotification`
Signature: `TokenBurnNotification{queryId:uint64,amount:coins,owner:address,responseAddress:Maybe address}`
## TokenExcesses
TLB: `token_excesses#d53276db queryId:uint64 = TokenExcesses`
Signature: `TokenExcesses{queryId:uint64}`
## TokenUpdateContent
TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent`
Signature: `TokenUpdateContent{content:Maybe ^cell}`
## StakingWithdraw
TLB: `staking_withdraw#da803efd value:coins = StakingWithdraw`
Signature: `StakingWithdraw{value:coins}`
## JettonData
TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData`
Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}`
## JettonWalletData
TLB: `_ balance:int257 owner:address master:address walletCode:^cell = JettonWalletData`
Signature: `JettonWalletData{balance:int257,owner:address,master:address,walletCode:^cell}`
## SetLinkerNeighbor
TLB: `set_linker_neighbor#b3fcf4c1 neighbor:Maybe address = SetLinkerNeighbor`
Signature: `SetLinkerNeighbor{neighbor:Maybe address}`
## InitLinker
TLB: `init_linker#67c08154 neighbor:Maybe address walletAmount:int257 walletCode:^cell walletData:^cell walletAddress:address responseAddress:Maybe address = InitLinker`
Signature: `InitLinker{neighbor:Maybe address,walletAmount:int257,walletCode:^cell,walletData:^cell,walletAddress:address,responseAddress:Maybe address}`
## ForwardToWallet
TLB: `forward_to_wallet#5d1da2bb body:^cell = ForwardToWallet`
Signature: `ForwardToWallet{body:^cell}`
## BlacklistWallet
TLB: `blacklist_wallet#029c8396 wallet:address = BlacklistWallet`
Signature: `BlacklistWallet{wallet:address}`
## InitiateBlacklistVote
TLB: `initiate_blacklist_vote#e8fffb0b adminIndex:int257 wallet:address quorum_percent:int257 vote_time:int257 = InitiateBlacklistVote`
Signature: `InitiateBlacklistVote{adminIndex:int257,wallet:address,quorum_percent:int257,vote_time:int257}`
## InitiateLiquidationVote
TLB: `initiate_liquidation_vote#11fb862f adminIndex:int257 quorum_percent:int257 vote_time:int257 = InitiateLiquidationVote`
Signature: `InitiateLiquidationVote{adminIndex:int257,quorum_percent:int257,vote_time:int257}`
## FinishVote
TLB: `finish_vote#2a574443 voteId:int257 = FinishVote`
Signature: `FinishVote{voteId:int257}`
## Vote
TLB: `vote#b670f4ce voteId:int257 adminIndex:int257 vote:int257 = Vote`
Signature: `Vote{voteId:int257,adminIndex:int257,vote:int257}`
## AddressList
TLB: `_ addresses:dict<int, address> length:int257 = AddressList`
Signature: `AddressList{addresses:dict<int, address>,length:int257}`
## Distribution
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<address, int> = Distribution`
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}`
## InitiateDistributionVote
TLB: `initiate_distribution_vote#1078d0b5 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = InitiateDistributionVote`
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}`
## WithdrawalRequests
TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 = WithdrawalRequests`
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`
## ChangeOwner
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner`
Signature: `ChangeOwner{newOwner:address}`
## Deposit
TLB: `deposit#21eeb607 amount:coins = Deposit`
Signature: `Deposit{amount:coins}`
## Withdraw
TLB: `withdraw#60591510 amount:int257 = Withdraw`
Signature: `Withdraw{amount:int257}`
# Get Methods
Total Get Methods: 0

1
sources/output/jetton_PseudoStaking.pkg

File diff suppressed because one or more lines are too long

1539
sources/output/jetton_PseudoStaking.ts

File diff suppressed because it is too large Load Diff

2
sources/output/jetton_TONB.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONB.code.fc

@ -694,5 +694,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmdLbHDcwcbEDecCvHvgj8D5v6twD5qHGPzRoJxrQn4XEr"; return "ipfs://QmS8xdbR6Ba79t2bLFssxSLGyPcHmTcGF5v9qMFJyN2nrb";
} }

2
sources/output/jetton_TONB.code.fif

@ -1252,6 +1252,6 @@ PROGRAM{
86142586315491086060343270784266291122 PUSHINT 86142586315491086060343270784266291122 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d644c624844637763624544656343764876676a384435763674774435714847507a526f4a7872516e34584572} PUSHSLICE x{697066733a2f2f516d53387864625236426137397432624c46737378534c47795063486d54634746357639714d464a794e326e7262} PUSHSLICE
}> }>
}END>c }END>c

6
sources/output/jetton_TONB.md

@ -3,7 +3,7 @@ Contract: TONB
BOC Size: 3240 bytes BOC Size: 3240 bytes
# Types # Types
Total Types: 27 Total Types: 28
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -45,6 +45,10 @@ Signature: `TokenExcesses{queryId:uint64}`
TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent` TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent`
Signature: `TokenUpdateContent{content:Maybe ^cell}` Signature: `TokenUpdateContent{content:Maybe ^cell}`
## StakingWithdraw
TLB: `staking_withdraw#da803efd value:coins = StakingWithdraw`
Signature: `StakingWithdraw{value:coins}`
## JettonData ## JettonData
TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData` TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData`
Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}` Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}`

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

41
sources/output/jetton_TONB.ts

@ -568,6 +568,47 @@ function dictValueParserTokenUpdateContent(): DictionaryValue<TokenUpdateContent
} }
} }
} }
export type StakingWithdraw = {
$$type: 'StakingWithdraw';
value: bigint;
}
export function storeStakingWithdraw(src: StakingWithdraw) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3665837821, 32);
b_0.storeCoins(src.value);
};
}
export function loadStakingWithdraw(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3665837821) { throw Error('Invalid prefix'); }
let _value = sc_0.loadCoins();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function loadTupleStakingWithdraw(source: TupleReader) {
let _value = source.readBigNumber();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function storeTupleStakingWithdraw(source: StakingWithdraw) {
let builder = new TupleBuilder();
builder.writeNumber(source.value);
return builder.build();
}
function dictValueParserStakingWithdraw(): DictionaryValue<StakingWithdraw> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeStakingWithdraw(src)).endCell());
},
parse: (src) => {
return loadStakingWithdraw(src.loadRef().beginParse());
}
}
}
export type JettonData = { export type JettonData = {
$$type: 'JettonData'; $$type: 'JettonData';
totalSupply: bigint; totalSupply: bigint;

2
sources/output/jetton_TONBWallet.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONBWallet.code.fc

@ -491,5 +491,5 @@ _ supported_interfaces() method_id {
} }
_ get_abi_ipfs() { _ get_abi_ipfs() {
return "ipfs://QmPUAFaC5zcamYhWHG5KeLoZhES1TbT25fgkJq3JKn4sEV"; return "ipfs://QmcxTwUyhdWnVtTQofwhidFsnnH8J6cMrdWwQR5o9oNWav";
} }

2
sources/output/jetton_TONBWallet.code.fif

@ -962,6 +962,6 @@ PROGRAM{
209778528950190195973528115415557644819 PUSHINT 209778528950190195973528115415557644819 PUSHINT
}> }>
get_abi_ipfs PROC:<{ get_abi_ipfs PROC:<{
x{697066733a2f2f516d505541466143357a63616d5968574847354b654c6f5a68455331546254323566676b4a71334a4b6e34734556} PUSHSLICE x{697066733a2f2f516d6378547755796864576e567454516f667768696446736e6e48384a36634d726457775152356f396f4e576176} PUSHSLICE
}> }>
}END>c }END>c

6
sources/output/jetton_TONBWallet.md

@ -3,7 +3,7 @@ Contract: TONBWallet
BOC Size: 2048 bytes BOC Size: 2048 bytes
# Types # Types
Total Types: 27 Total Types: 28
## StateInit ## StateInit
TLB: `_ code:^cell data:^cell = StateInit` TLB: `_ code:^cell data:^cell = StateInit`
@ -45,6 +45,10 @@ Signature: `TokenExcesses{queryId:uint64}`
TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent` TLB: `token_update_content#0c087a9e content:Maybe ^cell = TokenUpdateContent`
Signature: `TokenUpdateContent{content:Maybe ^cell}` Signature: `TokenUpdateContent{content:Maybe ^cell}`
## StakingWithdraw
TLB: `staking_withdraw#da803efd value:coins = StakingWithdraw`
Signature: `StakingWithdraw{value:coins}`
## JettonData ## JettonData
TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData` TLB: `_ totalSupply:int257 mintable:bool owner:address content:Maybe ^cell walletCode:^cell = JettonData`
Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}` Signature: `JettonData{totalSupply:int257,mintable:bool,owner:address,content:Maybe ^cell,walletCode:^cell}`

2
sources/output/jetton_TONBWallet.pkg

File diff suppressed because one or more lines are too long

41
sources/output/jetton_TONBWallet.ts

@ -568,6 +568,47 @@ function dictValueParserTokenUpdateContent(): DictionaryValue<TokenUpdateContent
} }
} }
} }
export type StakingWithdraw = {
$$type: 'StakingWithdraw';
value: bigint;
}
export function storeStakingWithdraw(src: StakingWithdraw) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(3665837821, 32);
b_0.storeCoins(src.value);
};
}
export function loadStakingWithdraw(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 3665837821) { throw Error('Invalid prefix'); }
let _value = sc_0.loadCoins();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function loadTupleStakingWithdraw(source: TupleReader) {
let _value = source.readBigNumber();
return { $$type: 'StakingWithdraw' as const, value: _value };
}
function storeTupleStakingWithdraw(source: StakingWithdraw) {
let builder = new TupleBuilder();
builder.writeNumber(source.value);
return builder.build();
}
function dictValueParserStakingWithdraw(): DictionaryValue<StakingWithdraw> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(storeStakingWithdraw(src)).endCell());
},
parse: (src) => {
return loadStakingWithdraw(src.loadRef().beginParse());
}
}
}
export type JettonData = { export type JettonData = {
$$type: 'JettonData'; $$type: 'JettonData';
totalSupply: bigint; totalSupply: bigint;

25
sources/pseudostaking.tact

@ -0,0 +1,25 @@
// Pseudo staking contract for the tests
import "./messages";
contract PseudoStaking {
stakes: map[Address]Int;
init() {}
receive("Deposit") {
let ctx: Context = context();
let sender: Address = ctx.sender;
let ex_stake: Int? = self.stakes.get(sender);
if (ex_stake == null) {
ex_stake = 0;
}
self.stakes.set(sender, ex_stake!! + ctx.value);
}
receive(msg: StakingWithdraw) {
let ctx: Context = context();
send(SendParameters {
value: msg.value,
to: ctx.sender
});
}
}

4
sources/staking.tact

@ -36,6 +36,8 @@ fun withdrawalSum(requests: WithdrawalRequests): Int {
trait StakingTrait { trait StakingTrait {
staking_pool: Address?; staking_pool: Address?;
withdrawal_requests: WithdrawalRequests; withdrawal_requests: WithdrawalRequests;
owner: Address;
in_the_pool: Int = 0;
fun sendStake() { fun sendStake() {
if(self.staking_pool == null) { if(self.staking_pool == null) {
@ -45,6 +47,7 @@ trait StakingTrait {
if(value < ton("0.05")) { if(value < ton("0.05")) {
return; return;
} }
self.in_the_pool = self.in_the_pool + value;
send(stakingDepositMessage(value, self.staking_pool!!)); send(stakingDepositMessage(value, self.staking_pool!!));
} }
@ -65,6 +68,7 @@ trait StakingTrait {
}); });
i = i + 1; i = i + 1;
} }
// todo: send profit to the foundation (owner)
self.withdrawal_requests = WithdrawalRequests{ self.withdrawal_requests = WithdrawalRequests{
addresses: emptyMap(), addresses: emptyMap(),
amounts: emptyMap() amounts: emptyMap()

18
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": "kQBvwIQdhyi7sgezjikEBunv00MZvrP3rVPifHhOJqmJAvYq", "to": "kQAvIKE3SXqBVFVm7n-B_dWCiJEMzGsZubdM6KSjmKUjfdqx",
"type": "internal", "type": "internal",
"value": 1200000000n, "value": 1200000000n,
}, },
"type": "received", "type": "received",
}, },
{ {
"gasUsed": 31768n, "gasUsed": 31793n,
"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": "kQBvwIQdhyi7sgezjikEBunv00MZvrP3rVPifHhOJqmJAvYq", "from": "kQAvIKE3SXqBVFVm7n-B_dWCiJEMzGsZubdM6KSjmKUjfdqx",
"to": "kQAXvQx5G-trrAjtFVR0nXB8G-6sbR4B5dYUe7tCPrx4A3CO", "to": "kQDZZaNqE7XxaQofxheKTzH3r_5VsKq0v-AacCBfKJpVnhV6",
"type": "internal", "type": "internal",
"value": 11365000n, "value": 11365000n,
}, },
@ -43,15 +43,15 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"messages": [ "messages": [
{ {
"body": { "body": {
"cell": "x{178D4519000000000000000043B9ACA00800DF81083B0E5177640F671C52080DD3DFA686337D67EF5AA7C4F8F09C4D53120500023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_} "cell": "x{178D4519000000000000000043B9ACA008005E41426E92F502A8AACDDCFF03FBAB0511221998D633736E99D14947314A46FB00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{80000000000000000000000000000000000000000000000000000000000000002000BDE863C8DF5B5D604768AAA3A4EB83E0DF756368F00F2EB0A3DDDA11F5E3C01C_}", x{80000000000000000000000000000000000000000000000000000000000000002006CB2D1B509DAF8B4850FE30BC52798FBD7FF2AD8555A5FF00D38102F944D2ACF4_}",
"type": "cell", "type": "cell",
}, },
"bounce": false, "bounce": false,
"from": "kQBvwIQdhyi7sgezjikEBunv00MZvrP3rVPifHhOJqmJAvYq", "from": "kQAvIKE3SXqBVFVm7n-B_dWCiJEMzGsZubdM6KSjmKUjfdqx",
"to": "kQAKmw3UOWRVLND774ZJhBWT20MKLWdpluTN3dv7Q2tYdaFp", "to": "kQCYHPl_7VmiHpjZoVX0zEce5MDyg6VkYw-1HxUVzAFjOKZZ",
"type": "internal", "type": "internal",
"value": 28081000n, "value": 42293000n,
}, },
], ],
"type": "sent", "type": "sent",

12
sources/tests/jetton.spec.ts

@ -4,6 +4,7 @@ import {TONB} from '../output/jetton_TONB';
import { default_content } from '../utils/config'; import { default_content } from '../utils/config';
import { TONBWallet } from '../output/jetton_TONBWallet'; import { TONBWallet } from '../output/jetton_TONBWallet';
import { beginCell } from 'ton-core'; import { beginCell } from 'ton-core';
import { PseudoStaking } from '../output/jetton_PseudoStaking';
@ -41,5 +42,16 @@ describe('jetton', () => {
expect((events[5] as any).messages[0].value).toBeGreaterThan(toNano('0.29')); expect((events[5] as any).messages[0].value).toBeGreaterThan(toNano('0.29'));
});
it('should work correctly with the staking', async () => {
// Create jetton
let system = await ContractSystem.create();
let owner = system.treasure('owner');
let contract = system.open(await TONB.fromInit(owner.address, default_content));
let tracker = system.track(contract.address);
let pseudostaking_contract = system.open(await PseudoStaking.fromInit());
await pseudostaking_contract.send(owner, { value: toNano('10000')}, "Deposit");
await system.run();
}); });
}); });

20
sources/tests/voting.spec.ts

@ -0,0 +1,20 @@
import { toNano, Address } from "ton";
import { ContractSystem } from "ton-emulator";
import {TONB} from '../output/jetton_TONB';
import { default_content } from '../utils/config';
import { TONBWallet } from '../output/jetton_TONBWallet';
import { beginCell } from 'ton-core';
import { PseudoStaking } from '../output/jetton_PseudoStaking';
describe('jetton', () => {
it('should be able to create a vote', async () => {
// Create jetton
let system = await ContractSystem.create();
let owner = system.treasure('owner');
let contract = system.open(await TONB.fromInit(owner.address, default_content));
let tracker = system.track(contract.address);
});
});
Loading…
Cancel
Save