Browse Source

Voting is working (with tests)

master
Lev 2 years ago
parent
commit
b6fc1196f4
  1. 43
      sources/foundation.tact
  2. 2
      sources/messages.tact
  3. 2
      sources/output/jetton_Linker.abi
  4. 2
      sources/output/jetton_Linker.code.fc
  5. 2
      sources/output/jetton_Linker.code.fif
  6. 16
      sources/output/jetton_Linker.md
  7. 2
      sources/output/jetton_Linker.pkg
  8. 42
      sources/output/jetton_Linker.ts
  9. 2
      sources/output/jetton_PseudoStaking.abi
  10. 2
      sources/output/jetton_PseudoStaking.code.fc
  11. 2
      sources/output/jetton_PseudoStaking.code.fif
  12. 16
      sources/output/jetton_PseudoStaking.md
  13. 2
      sources/output/jetton_PseudoStaking.pkg
  14. 42
      sources/output/jetton_PseudoStaking.ts
  15. 2
      sources/output/jetton_TONB.abi
  16. 2
      sources/output/jetton_TONB.code.fc
  17. 2
      sources/output/jetton_TONB.code.fif
  18. 16
      sources/output/jetton_TONB.md
  19. 2
      sources/output/jetton_TONB.pkg
  20. 44
      sources/output/jetton_TONB.ts
  21. 2
      sources/output/jetton_TONBWallet.abi
  22. BIN
      sources/output/jetton_TONBWallet.code.boc
  23. 6
      sources/output/jetton_TONBWallet.code.fc
  24. 11
      sources/output/jetton_TONBWallet.code.fif
  25. 12
      sources/output/jetton_TONBWallet.code.rev.fif
  26. 18
      sources/output/jetton_TONBWallet.md
  27. 2
      sources/output/jetton_TONBWallet.pkg
  28. 46
      sources/output/jetton_TONBWallet.ts
  29. 34
      sources/tests/__snapshots__/jetton.spec.ts.snap
  30. 47
      sources/tests/foundation.spec.ts
  31. 4
      sources/utils/interactions.ts
  32. 4
      sources/wallet.tact

43
sources/foundation.tact

@ -12,7 +12,6 @@ struct Vote {
id: Int;
votes: map[Int]Int; // -1 - no vote, 0 - abstain, 1 - yes, 2 - no
vote_end: Int;
proposal: Proposal;
quorum_percent: Int;
ended: Bool = false;
result: Bool?; // None - no result, True - passed, False - failed
@ -25,6 +24,7 @@ contract Foundation {
tonb: Address;
votes: map[Int]Vote;
profits: map[Address]Int;
proposals: map[Int]Proposal;
n_votes: Int = 0;
init(admins: Distribution, founders: AddressList, tonb: Address) {
@ -37,7 +37,7 @@ contract Foundation {
require(msg.voteId < self.n_votes, "Invalid vote id");
let vote: Vote = self.votes.get(msg.voteId)!!;
require(vote.ended == false, "Vote already ended");
require(vote.vote_end < now(), "Vote is not finished yet");
require(vote.vote_end >= now(), "Vote is not finished yet");
let n_yes: Int = 0;
let n_no: Int = 0;
let n_abstain: Int = 0;
@ -45,11 +45,11 @@ contract Foundation {
while (i < self.admins.addresses.length) {
let vote_i: Int = vote.votes.get(i)!!;
if (vote_i == 1) {
n_yes = n_yes + 1;
n_yes = n_yes + self.admins.percents.get(i)!!;
} else if (vote_i == 2) {
n_no = n_no + 1;
n_no = n_no + self.admins.percents.get(i)!!;
} else if (vote_i == 0) {
n_abstain = n_abstain + 1;
n_abstain = n_abstain + self.admins.percents.get(i)!!;
}
i = i + 1;
}
@ -66,7 +66,7 @@ contract Foundation {
self.votes.set(msg.voteId, vote);
if (vote.result == true) {
let prop: Proposal = vote.proposal;
let prop: Proposal = self.proposals.get(msg.voteId)!!;
if (prop.type == 0) {
send(SendParameters{
to: self.tonb,
@ -94,7 +94,7 @@ contract Foundation {
require(msg.voteId < self.n_votes, "Invalid vote id");
let vote: Vote = self.votes.get(msg.voteId)!!;
require(vote.ended == false, "Vote already ended");
require(vote.vote_end > now(), "Vote is finished");
// require(vote.vote_end > now(), "Vote is finished");
require(msg.vote >= 0 && msg.vote <= 2, "Invalid vote");
vote.votes.set(msg.adminIndex, msg.vote);
self.votes.set(msg.voteId, vote);
@ -105,7 +105,7 @@ contract Foundation {
require(ctx.sender == self.admins.addresses.addresses.get(msg.adminIndex), "Only an admin can initiate a vote");
require(ctx.value >= ton("1.0"), "Voting requires at least 1 ton for the fees");
require(msg.quorum_percent > 20 && msg.quorum_percent <= 100, "Invalid quorum percent");
require(msg.vote_time > 0 && msg.vote_time < 3 * 24 * 3600, "Invalid vote time");
require(msg.vote_time >= 0 && msg.vote_time < 3 * 24 * 3600, "Invalid vote time");
let proposal: Proposal = Proposal {
type: 0,
blacklistAddress: msg.wallet,
@ -114,7 +114,6 @@ contract Foundation {
let vote: Vote = Vote {
id: self.n_votes,
vote_end: now() + msg.vote_time,
proposal: proposal,
quorum_percent: msg.quorum_percent,
votes: emptyMap(),
result: null
@ -125,6 +124,7 @@ contract Foundation {
i = i + 1;
}
self.votes.set(self.n_votes, vote);
self.proposals.set(self.n_votes, proposal);
self.n_votes = self.n_votes + 1;
}
@ -166,11 +166,6 @@ contract Foundation {
let vote: Vote = Vote {
id: self.n_votes,
vote_end: now() + msg.vote_time,
proposal: Proposal {
type: 1,
blacklistAddress: null,
distribution: null
},
quorum_percent: msg.quorum_percent,
votes: emptyMap(),
result: null
@ -180,7 +175,13 @@ contract Foundation {
vote.votes.set(i, -1);
i = i + 1;
}
let proposal: Proposal = Proposal {
type: 1,
blacklistAddress: null,
distribution: null
};
self.votes.set(self.n_votes, vote);
self.proposals.set(self.n_votes, proposal);
self.n_votes = self.n_votes + 1;
}
@ -192,7 +193,7 @@ contract Foundation {
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.get(addr)!!;
let percent: Int = self.admins.percents.get(i)!!;
let amount: Int = value * percent / 100;
// todo: record the profit
let current_profit: Int = 0;
@ -231,4 +232,16 @@ contract Foundation {
mode: SendRemainingValue
});
}
get fun numVotes(): Int {
return self.n_votes;
}
get fun nthVote(n: Int): Vote? {
return self.votes.get(n);
}
get fun AdminList(): AddressList {
return self.admins.addresses;
}
}

2
sources/messages.tact

@ -118,7 +118,7 @@ struct AddressList {
struct Distribution {
addresses: AddressList;
percents: map[Address]Int;
percents: map[Int]Int;
}
message InitiateDistributionVote {
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() {
return "ipfs://QmPdxwain9Y3xSr42K9ApJ5UsTURQZGtDmdhUSMQqrzYux";
return "ipfs://QmZpCUdLNy4uEWdnT2sawL9SAm8Aqp43rhUTB3gAh22zoz";
}

2
sources/output/jetton_Linker.code.fif

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

16
sources/output/jetton_Linker.md

@ -94,12 +94,12 @@ 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>}`
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<int, int> = Distribution`
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, 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>}}`
TLB: `initiate_distribution_vote#95bd8d46 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = InitiateDistributionVote`
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## SetStakingPool
TLB: `set_staking_pool#0764d148 staking_pool:Maybe address = SetStakingPool`
@ -130,12 +130,12 @@ TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 =
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`
## Proposal
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}`
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## Vote
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}} quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}},quorum_percent:int257,ended:bool,result:Maybe bool}`
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,quorum_percent:int257,ended:bool,result:Maybe bool}`
## ChangeOwner
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner`

2
sources/output/jetton_Linker.pkg

File diff suppressed because one or more lines are too long

42
sources/output/jetton_Linker.ts

@ -1163,34 +1163,34 @@ function dictValueParserAddressList(): DictionaryValue<AddressList> {
export type Distribution = {
$$type: 'Distribution';
addresses: AddressList;
percents: Dictionary<Address, bigint>;
percents: Dictionary<bigint, bigint>;
}
export function storeDistribution(src: Distribution) {
return (builder: Builder) => {
let b_0 = builder;
b_0.store(storeAddressList(src.addresses));
b_0.storeDict(src.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257));
b_0.storeDict(src.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
};
}
export function loadDistribution(slice: Slice) {
let sc_0 = slice;
let _addresses = loadAddressList(sc_0);
let _percents = Dictionary.load(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), sc_0);
let _percents = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function loadTupleDistribution(source: TupleReader) {
const _addresses = loadTupleAddressList(source.readTuple());
let _percents = Dictionary.loadDirect(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), source.readCellOpt());
let _percents = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function storeTupleDistribution(source: Distribution) {
let builder = new TupleBuilder();
builder.writeTuple(storeTupleAddressList(source.addresses));
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
return builder.build();
}
@ -1215,7 +1215,7 @@ export type InitiateDistributionVote = {
export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(276353205, 32);
b_0.storeUint(2512227654, 32);
b_0.storeInt(src.adminIndex, 257);
b_0.storeInt(src.quorum_percent, 257);
b_0.storeInt(src.vote_time, 257);
@ -1227,7 +1227,7 @@ export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
export function loadInitiateDistributionVote(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 276353205) { throw Error('Invalid prefix'); }
if (sc_0.loadUint(32) !== 2512227654) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
let _quorum_percent = sc_0.loadIntBig(257);
let _vote_time = sc_0.loadIntBig(257);
@ -1617,7 +1617,6 @@ export type Vote = {
id: bigint;
votes: Dictionary<bigint, bigint>;
vote_end: bigint;
proposal: Proposal;
quorum_percent: bigint;
ended: boolean;
result: boolean | null;
@ -1629,14 +1628,9 @@ export function storeVote(src: Vote) {
b_0.storeInt(src.id, 257);
b_0.storeDict(src.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
b_0.storeInt(src.vote_end, 257);
let b_1 = new Builder();
b_1.store(storeProposal(src.proposal));
let b_2 = new Builder();
b_2.storeInt(src.quorum_percent, 257);
b_2.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_2.storeBit(true).storeBit(src.result); } else { b_2.storeBit(false); }
b_1.storeRef(b_2.endCell());
b_0.storeRef(b_1.endCell());
b_0.storeInt(src.quorum_percent, 257);
b_0.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_0.storeBit(true).storeBit(src.result); } else { b_0.storeBit(false); }
};
}
@ -1645,24 +1639,20 @@ export function loadVote(slice: Slice) {
let _id = sc_0.loadIntBig(257);
let _votes = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
let _vote_end = sc_0.loadIntBig(257);
let sc_1 = sc_0.loadRef().beginParse();
let _proposal = loadProposal(sc_1);
let sc_2 = sc_1.loadRef().beginParse();
let _quorum_percent = sc_2.loadIntBig(257);
let _ended = sc_2.loadBit();
let _result = sc_2.loadBit() ? sc_2.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
let _quorum_percent = sc_0.loadIntBig(257);
let _ended = sc_0.loadBit();
let _result = sc_0.loadBit() ? sc_0.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function loadTupleVote(source: TupleReader) {
let _id = source.readBigNumber();
let _votes = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
let _vote_end = source.readBigNumber();
const _proposal = loadTupleProposal(source.readTuple());
let _quorum_percent = source.readBigNumber();
let _ended = source.readBoolean();
let _result = source.readBooleanOpt();
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function storeTupleVote(source: Vote) {
@ -1670,7 +1660,6 @@ function storeTupleVote(source: Vote) {
builder.writeNumber(source.id);
builder.writeCell(source.votes.size > 0 ? beginCell().storeDictDirect(source.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeNumber(source.vote_end);
builder.writeTuple(storeTupleProposal(source.proposal));
builder.writeNumber(source.quorum_percent);
builder.writeBoolean(source.ended);
builder.writeBoolean(source.result);
@ -1868,7 +1857,6 @@ const Linker_errors: { [key: number]: { message: string } } = {
6873: { message: `Only an admin can initiate a vote` },
13650: { message: `Invalid bounced message` },
16059: { message: `Invalid value` },
16994: { message: `Vote is finished` },
18474: { message: `only the owner can set a new owner` },
19362: { message: `Invalid quorum percent` },
29720: { message: `Invalid vote` },

2
sources/output/jetton_PseudoStaking.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_PseudoStaking.code.fc

@ -284,5 +284,5 @@ _ supported_interfaces() method_id {
}
_ get_abi_ipfs() {
return "ipfs://QmauXGiekdCW4GNrULhiN8JhMuRfKgUTpLsD9DTSjKjW2f";
return "ipfs://QmYHQGN9gwud65wi4XsLW1FLFnWHo9Rygo9VUzpnpozJ4w";
}

2
sources/output/jetton_PseudoStaking.code.fif

@ -490,6 +490,6 @@ PROGRAM{
209801025412363888721030803524359905849 PUSHINT
}>
get_abi_ipfs PROC:<{
x{697066733a2f2f516d6175584769656b64435734474e72554c68694e384a684d7552664b675554704c7344394454536a4b6a573266} PUSHSLICE
x{697066733a2f2f516d594851474e3967777564363577693458734c5731464c466e57486f395279676f3956557a706e706f7a4a3477} PUSHSLICE
}>
}END>c

16
sources/output/jetton_PseudoStaking.md

@ -94,12 +94,12 @@ 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>}`
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<int, int> = Distribution`
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, 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>}}`
TLB: `initiate_distribution_vote#95bd8d46 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = InitiateDistributionVote`
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## SetStakingPool
TLB: `set_staking_pool#0764d148 staking_pool:Maybe address = SetStakingPool`
@ -130,12 +130,12 @@ TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 =
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`
## Proposal
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}`
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## Vote
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}} quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}},quorum_percent:int257,ended:bool,result:Maybe bool}`
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,quorum_percent:int257,ended:bool,result:Maybe bool}`
## ChangeOwner
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner`

2
sources/output/jetton_PseudoStaking.pkg

File diff suppressed because one or more lines are too long

42
sources/output/jetton_PseudoStaking.ts

@ -1163,34 +1163,34 @@ function dictValueParserAddressList(): DictionaryValue<AddressList> {
export type Distribution = {
$$type: 'Distribution';
addresses: AddressList;
percents: Dictionary<Address, bigint>;
percents: Dictionary<bigint, bigint>;
}
export function storeDistribution(src: Distribution) {
return (builder: Builder) => {
let b_0 = builder;
b_0.store(storeAddressList(src.addresses));
b_0.storeDict(src.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257));
b_0.storeDict(src.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
};
}
export function loadDistribution(slice: Slice) {
let sc_0 = slice;
let _addresses = loadAddressList(sc_0);
let _percents = Dictionary.load(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), sc_0);
let _percents = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function loadTupleDistribution(source: TupleReader) {
const _addresses = loadTupleAddressList(source.readTuple());
let _percents = Dictionary.loadDirect(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), source.readCellOpt());
let _percents = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function storeTupleDistribution(source: Distribution) {
let builder = new TupleBuilder();
builder.writeTuple(storeTupleAddressList(source.addresses));
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
return builder.build();
}
@ -1215,7 +1215,7 @@ export type InitiateDistributionVote = {
export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(276353205, 32);
b_0.storeUint(2512227654, 32);
b_0.storeInt(src.adminIndex, 257);
b_0.storeInt(src.quorum_percent, 257);
b_0.storeInt(src.vote_time, 257);
@ -1227,7 +1227,7 @@ export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
export function loadInitiateDistributionVote(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 276353205) { throw Error('Invalid prefix'); }
if (sc_0.loadUint(32) !== 2512227654) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
let _quorum_percent = sc_0.loadIntBig(257);
let _vote_time = sc_0.loadIntBig(257);
@ -1617,7 +1617,6 @@ export type Vote = {
id: bigint;
votes: Dictionary<bigint, bigint>;
vote_end: bigint;
proposal: Proposal;
quorum_percent: bigint;
ended: boolean;
result: boolean | null;
@ -1629,14 +1628,9 @@ export function storeVote(src: Vote) {
b_0.storeInt(src.id, 257);
b_0.storeDict(src.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
b_0.storeInt(src.vote_end, 257);
let b_1 = new Builder();
b_1.store(storeProposal(src.proposal));
let b_2 = new Builder();
b_2.storeInt(src.quorum_percent, 257);
b_2.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_2.storeBit(true).storeBit(src.result); } else { b_2.storeBit(false); }
b_1.storeRef(b_2.endCell());
b_0.storeRef(b_1.endCell());
b_0.storeInt(src.quorum_percent, 257);
b_0.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_0.storeBit(true).storeBit(src.result); } else { b_0.storeBit(false); }
};
}
@ -1645,24 +1639,20 @@ export function loadVote(slice: Slice) {
let _id = sc_0.loadIntBig(257);
let _votes = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
let _vote_end = sc_0.loadIntBig(257);
let sc_1 = sc_0.loadRef().beginParse();
let _proposal = loadProposal(sc_1);
let sc_2 = sc_1.loadRef().beginParse();
let _quorum_percent = sc_2.loadIntBig(257);
let _ended = sc_2.loadBit();
let _result = sc_2.loadBit() ? sc_2.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
let _quorum_percent = sc_0.loadIntBig(257);
let _ended = sc_0.loadBit();
let _result = sc_0.loadBit() ? sc_0.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function loadTupleVote(source: TupleReader) {
let _id = source.readBigNumber();
let _votes = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
let _vote_end = source.readBigNumber();
const _proposal = loadTupleProposal(source.readTuple());
let _quorum_percent = source.readBigNumber();
let _ended = source.readBoolean();
let _result = source.readBooleanOpt();
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function storeTupleVote(source: Vote) {
@ -1670,7 +1660,6 @@ function storeTupleVote(source: Vote) {
builder.writeNumber(source.id);
builder.writeCell(source.votes.size > 0 ? beginCell().storeDictDirect(source.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeNumber(source.vote_end);
builder.writeTuple(storeTupleProposal(source.proposal));
builder.writeNumber(source.quorum_percent);
builder.writeBoolean(source.ended);
builder.writeBoolean(source.result);
@ -1865,7 +1854,6 @@ const PseudoStaking_errors: { [key: number]: { message: string } } = {
6873: { message: `Only an admin can initiate a vote` },
13650: { message: `Invalid bounced message` },
16059: { message: `Invalid value` },
16994: { message: `Vote is finished` },
18474: { message: `only the owner can set a new owner` },
19362: { message: `Invalid quorum percent` },
29720: { message: `Invalid vote` },

2
sources/output/jetton_TONB.abi

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONB.code.fc

@ -825,5 +825,5 @@ _ supported_interfaces() method_id {
}
_ get_abi_ipfs() {
return "ipfs://QmdViWXtZGNYCoQZNSUs9hgbK9arhozuqfVQidHJKMgjor";
return "ipfs://QmeT98SB67aKiLNmYcvUMbNWL75MuNs6JXZbK3o1ySrLTC";
}

2
sources/output/jetton_TONB.code.fif

@ -1564,6 +1564,6 @@ PROGRAM{
86142586315491086060343270784266291122 PUSHINT
}>
get_abi_ipfs PROC:<{
x{697066733a2f2f516d6456695758745a474e59436f515a4e535573396867624b396172686f7a75716656516964484a4b4d676a6f72} PUSHSLICE
x{697066733a2f2f516d6554393853423637614b694c4e6d596376554d624e574c37354d754e73364a585a624b336f317953724c5443} PUSHSLICE
}>
}END>c

16
sources/output/jetton_TONB.md

@ -94,12 +94,12 @@ 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>}`
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<int, int> = Distribution`
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, 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>}}`
TLB: `initiate_distribution_vote#95bd8d46 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = InitiateDistributionVote`
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## SetStakingPool
TLB: `set_staking_pool#0764d148 staking_pool:Maybe address = SetStakingPool`
@ -130,12 +130,12 @@ TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 =
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`
## Proposal
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}`
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## Vote
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}} quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}},quorum_percent:int257,ended:bool,result:Maybe bool}`
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,quorum_percent:int257,ended:bool,result:Maybe bool}`
## ChangeOwner
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner`

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

44
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

BIN
sources/output/jetton_TONBWallet.code.boc

Binary file not shown.

6
sources/output/jetton_TONBWallet.code.fc

@ -364,11 +364,11 @@ _ $__gen_get_get_wallet_data() method_id(97026) {
(((int, slice, slice, int, int, slice)), ()) $__gen_TONBWallet_receive_TokenTransferInternal((int, slice, slice, int, int, slice) $self, (int, int, slice, slice, int, slice, int, slice) $msg) impure inline {
var ($self'balance, $self'owner, $self'master, $self'blacklisted, $self'linker, $self'linker_address) = $self;
var ($msg'queryId, $msg'amount, $msg'from, $msg'responseAddress, $msg'forwardTonAmount, $msg'forwardPayload, $msg'setLinker, $msg'setLinkerAddress) = $msg;
if ($self'blacklisted) {
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
if (($self'blacklisted & __tact_address_neq($ctx'sender, $self'master))) {
$send((true, $self'master, 0, 64, __gen_writecell_TokenBurnNotification(($msg'queryId, $msg'amount, $self'owner, $self'owner)), null(), null()));
return (($self'balance, $self'owner, $self'master, $self'blacklisted, $self'linker, $self'linker_address), ());
}
var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get();
if (null?($self'linker)) {
if ((~ null?($msg'setLinker))) {
$self'linker = $msg'setLinker;
@ -514,5 +514,5 @@ _ supported_interfaces() method_id {
}
_ get_abi_ipfs() {
return "ipfs://QmWUsMjXBDmUpAiZnwRzPM5E4Q81yVQkRc88XnAJYWif2a";
return "ipfs://QmRxkkCZ4Mtd1np4xEBLzcMDLA1JrQnk7JGaUN72eGuM8h";
}

11
sources/output/jetton_TONBWallet.code.fif

@ -647,9 +647,13 @@ PROGRAM{
$send INLINECALLDICT
}>
$__gen_TONBWallet_receive_TokenTransferInternal PROCINLINE:<{
s10 PUSH
__tact_context_get INLINECALLDICT
s2 s15 PUSH2
__tact_address_neq INLINECALLDICT
s15 s(-1) PUXC
AND
IF:<{
6 BLKDROP
10 BLKDROP
TRUE
0 PUSHINT
s0 s3 XCHG
@ -662,7 +666,6 @@ PROGRAM{
PUSHNULL
$send INLINECALLDICT
}>ELSE<{
__tact_context_get INLINECALLDICT
s13 PUSH
ISNULL
IF:<{
@ -1008,6 +1011,6 @@ PROGRAM{
209778528950190195973528115415557644819 PUSHINT
}>
get_abi_ipfs PROC:<{
x{697066733a2f2f516d5755734d6a5842446d557041695a6e77527a504d3545345138317956516b52633838586e414a595769663261} PUSHSLICE
x{697066733a2f2f516d52786b6b435a344d7464316e70347845424c7a634d444c41314a72516e6b374a4761554e37326547754d3868} PUSHSLICE
}>
}END>c

12
sources/output/jetton_TONBWallet.code.rev.fif

@ -710,9 +710,15 @@ SETCP0
s9 s10 XCHG
s8 s9 XCHG
1 7 BLKSWAP
s10 PUSH
1 GETGLOBVAR
4 UNTUPLE
s2 s15 PUSH2
SDEQ
NOT
s15 s-1 PUXC
AND
<{
6 BLKDROP
10 BLKDROP
-1 PUSHINT
0 PUSHINT
s0 s3 XCHG
@ -877,8 +883,6 @@ SETCP0
}> CALLREF
}> PUSHCONT
<{
1 GETGLOBVAR
4 UNTUPLE
s13 PUSH
ISNULL
<{

18
sources/output/jetton_TONBWallet.md

@ -1,6 +1,6 @@
# TACT Compilation Report
Contract: TONBWallet
BOC Size: 2111 bytes
BOC Size: 2118 bytes
# Types
Total Types: 36
@ -94,12 +94,12 @@ 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>}`
TLB: `_ addresses:AddressList{addresses:dict<int, address>,length:int257} percents:dict<int, int> = Distribution`
Signature: `Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, 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>}}`
TLB: `initiate_distribution_vote#95bd8d46 adminIndex:int257 quorum_percent:int257 vote_time:int257 distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = InitiateDistributionVote`
Signature: `InitiateDistributionVote{adminIndex:int257,quorum_percent:int257,vote_time:int257,distribution:Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## SetStakingPool
TLB: `set_staking_pool#0764d148 staking_pool:Maybe address = SetStakingPool`
@ -130,12 +130,12 @@ TLB: `_ addresses:dict<int, address> amounts:dict<int, int> n_requests:int257 =
Signature: `WithdrawalRequests{addresses:dict<int, address>,amounts:dict<int, int>,n_requests:int257}`
## Proposal
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}}`
TLB: `_ type:int257 blacklistAddress:Maybe address distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>} = Proposal`
Signature: `Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<int, int>}}`
## Vote
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}} quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,proposal:Proposal{type:int257,blacklistAddress:Maybe address,distribution:Maybe Distribution{addresses:AddressList{addresses:dict<int, address>,length:int257},percents:dict<address, int>}},quorum_percent:int257,ended:bool,result:Maybe bool}`
TLB: `_ id:int257 votes:dict<int, int> vote_end:int257 quorum_percent:int257 ended:bool result:Maybe bool = Vote`
Signature: `Vote{id:int257,votes:dict<int, int>,vote_end:int257,quorum_percent:int257,ended:bool,result:Maybe bool}`
## ChangeOwner
TLB: `change_owner#0f474d03 newOwner:address = ChangeOwner`

2
sources/output/jetton_TONBWallet.pkg

File diff suppressed because one or more lines are too long

46
sources/output/jetton_TONBWallet.ts

@ -1163,34 +1163,34 @@ function dictValueParserAddressList(): DictionaryValue<AddressList> {
export type Distribution = {
$$type: 'Distribution';
addresses: AddressList;
percents: Dictionary<Address, bigint>;
percents: Dictionary<bigint, bigint>;
}
export function storeDistribution(src: Distribution) {
return (builder: Builder) => {
let b_0 = builder;
b_0.store(storeAddressList(src.addresses));
b_0.storeDict(src.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257));
b_0.storeDict(src.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
};
}
export function loadDistribution(slice: Slice) {
let sc_0 = slice;
let _addresses = loadAddressList(sc_0);
let _percents = Dictionary.load(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), sc_0);
let _percents = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function loadTupleDistribution(source: TupleReader) {
const _addresses = loadTupleAddressList(source.readTuple());
let _percents = Dictionary.loadDirect(Dictionary.Keys.Address(), Dictionary.Values.BigInt(257), source.readCellOpt());
let _percents = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents };
}
function storeTupleDistribution(source: Distribution) {
let builder = new TupleBuilder();
builder.writeTuple(storeTupleAddressList(source.addresses));
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.Address(), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
return builder.build();
}
@ -1215,7 +1215,7 @@ export type InitiateDistributionVote = {
export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
return (builder: Builder) => {
let b_0 = builder;
b_0.storeUint(276353205, 32);
b_0.storeUint(2512227654, 32);
b_0.storeInt(src.adminIndex, 257);
b_0.storeInt(src.quorum_percent, 257);
b_0.storeInt(src.vote_time, 257);
@ -1227,7 +1227,7 @@ export function storeInitiateDistributionVote(src: InitiateDistributionVote) {
export function loadInitiateDistributionVote(slice: Slice) {
let sc_0 = slice;
if (sc_0.loadUint(32) !== 276353205) { throw Error('Invalid prefix'); }
if (sc_0.loadUint(32) !== 2512227654) { throw Error('Invalid prefix'); }
let _adminIndex = sc_0.loadIntBig(257);
let _quorum_percent = sc_0.loadIntBig(257);
let _vote_time = sc_0.loadIntBig(257);
@ -1617,7 +1617,6 @@ export type Vote = {
id: bigint;
votes: Dictionary<bigint, bigint>;
vote_end: bigint;
proposal: Proposal;
quorum_percent: bigint;
ended: boolean;
result: boolean | null;
@ -1629,14 +1628,9 @@ export function storeVote(src: Vote) {
b_0.storeInt(src.id, 257);
b_0.storeDict(src.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257));
b_0.storeInt(src.vote_end, 257);
let b_1 = new Builder();
b_1.store(storeProposal(src.proposal));
let b_2 = new Builder();
b_2.storeInt(src.quorum_percent, 257);
b_2.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_2.storeBit(true).storeBit(src.result); } else { b_2.storeBit(false); }
b_1.storeRef(b_2.endCell());
b_0.storeRef(b_1.endCell());
b_0.storeInt(src.quorum_percent, 257);
b_0.storeBit(src.ended);
if (src.result !== null && src.result !== undefined) { b_0.storeBit(true).storeBit(src.result); } else { b_0.storeBit(false); }
};
}
@ -1645,24 +1639,20 @@ export function loadVote(slice: Slice) {
let _id = sc_0.loadIntBig(257);
let _votes = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0);
let _vote_end = sc_0.loadIntBig(257);
let sc_1 = sc_0.loadRef().beginParse();
let _proposal = loadProposal(sc_1);
let sc_2 = sc_1.loadRef().beginParse();
let _quorum_percent = sc_2.loadIntBig(257);
let _ended = sc_2.loadBit();
let _result = sc_2.loadBit() ? sc_2.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
let _quorum_percent = sc_0.loadIntBig(257);
let _ended = sc_0.loadBit();
let _result = sc_0.loadBit() ? sc_0.loadBit() : null;
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function loadTupleVote(source: TupleReader) {
let _id = source.readBigNumber();
let _votes = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt());
let _vote_end = source.readBigNumber();
const _proposal = loadTupleProposal(source.readTuple());
let _quorum_percent = source.readBigNumber();
let _ended = source.readBoolean();
let _result = source.readBooleanOpt();
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, proposal: _proposal, quorum_percent: _quorum_percent, ended: _ended, result: _result };
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result };
}
function storeTupleVote(source: Vote) {
@ -1670,7 +1660,6 @@ function storeTupleVote(source: Vote) {
builder.writeNumber(source.id);
builder.writeCell(source.votes.size > 0 ? beginCell().storeDictDirect(source.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null);
builder.writeNumber(source.vote_end);
builder.writeTuple(storeTupleProposal(source.proposal));
builder.writeNumber(source.quorum_percent);
builder.writeBoolean(source.ended);
builder.writeBoolean(source.result);
@ -1812,8 +1801,8 @@ function dictValueParserWithdraw(): DictionaryValue<Withdraw> {
}
async function TONBWallet_init(master: Address, owner: Address) {
const __init = 'te6ccgEBBgEAZgABFP8A9KQT9LzyyAsBAgFiAgMCAs0EBQAJoUrd4AsAAdQAhWXBtbXAGyMwGBVUgUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMyY=';
const __code = 'te6ccgECJgEACDMAART/APSkE/S88sgLAQIBYgIDAgLKBAUCASAjJASJ1cCHXScIflTAg1wsf3gLQ0wMBcbDAAZF/kXDiAfpAIlBmbwT4YQLjAiCCEA+KfqW64wIgghAXjUUZuuMCIIIQWV8HvLqBgcICQIBSCEiAdIw7UTQ1AH4YoEBAdcA+kABAfpAAQHSANQB0NIAAZWBAQHXAJJtAeL6QCHXCwHDAJEBkjFt4jEQJhAlECQQI2wWVQWAINch0x/TPzH6ADCBNVIighAXjUUZugOCEHvdl966E7ES8vQWoAUcA6Qw7UTQ1AH4YoEBAdcA+kABAfpAAQHSANQB0NIAAZWBAQHXAJJtAeL6QCHXCwHDAJEBkjFt4jEQJhAlECQQI2wWBts8NxC8EKsQmhCJEHhVBds8CgscAqAw7UTQ1AH4YoEBAdcA+kABAfpAAQHSANQB0NIAAZWBAQHXAJJtAeL6QCHXCwHDAJEBkjFt4jEQJhAlECQQI2wWBts8OBDNELwQqxCaEIlVBg8QA/6O9DDtRNDUAfhigQEB1wD6QAEB+kABAdIA1AHQ0gABlYEBAdcAkm0B4vpAIdcLAcMAkQGSMW3iMRAmECUQJBAjbBYG0x8BghBZXwe8uvLggdM/+gD6QAEB+kAh1wsBwwCRAZIxbeIUQzA0EIkQeBBnEFYQRVUC4IIKnIOWuuMCGBkaAGzTHwGCEA+KfqW68uCB0z/6APpAAQH6QCHXCwHDAJEBkjFt4gHSAAGR1JJtAeL6AFFmFhUUQzAEumwiggCvECiz8vT4QW8kgRFNUz7HBfL0Ueeh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AlECQQI2wWBtMfAYIKnIOWuvLggfpAATEQVhBFEDRBMB0ACDDywIIAJGwx+gAxcdch+gAx+gAwpwOrAACAyPhCAcxVUFBWgQEBzwBQA88WAc8WygDIIm6zmn8BygASgQEBzwCVMnBYygDiWCBulTBwAcsBks8W4skBzMntVALeMDL4QW8kECNfA4ERTVMUxwVRJMcFErHy9H9wf1MRgEBUOpnbPCcDBFCqbW3bPALI+EIBzFVQUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMye1UHh8ASMhVMIIQe92X3lAFyx8Tyz8B+gIBzxYBIG6VMHABywGSzxbiyQH2yHEBygFQBwHKAHABygJQBc8WUAP6AnABymgjbrMlbrOxjkx/AcoAyHABygBwAcoAJG6znX8BygAEIG7y0IBQBMyWNANwAcoA4iRus51/AcoABCBu8tCAUATMljQDcAHKAOJwAcoAAn8BygACyVjMlzMzAXABygDiIW6zIAAwnH8BygABIG7y0IABzJUxcAHKAOLJAfsAAIX7g2trgDZGYDAqqQKCtAgIDngCgB54sA54tlAGQRN1nNP4DlAAlAgIDngEqZOCxlAHEsEDdKmDgA5YDJZ4txZIDmZMAE3YFoegIYNoDAsEIAwAh6B7fQ+XBDgMCwQhEBQAh6C+R6AGSgAfgTwBh7/YF2omhqAPwxQICA64B9IACA/SAAgOkAagDoaQAAysCAgOuASTaA8X0gEOuFgOGASIDJGLbxGIgTCBKIEggRtgttnkJQBxvd6ME4LnYerpZXPY9CdhzrJUKNs0E4TusalpWyPlmRadeW/vixHME4TujwAfLZsB5P5B1ZLNZRCcABJfA/hCUxLwKDA=';
const __system = 'te6cckECKAEACD0AAQHAAQEFoMEJAgEU/wD0pBP0vPLICwMCAWIIBAIBIAYFAHG93owTgudh6ullc9j0J2HOslQo2zQThO6xqWlbI+WZFp15b++LEcwThO6PAB8tmwHk/kHVks1lEJwBh7/YF2omhqAPwxQICA64B9IACA/SAAgOkAagDoaQAAysCAgOuASTaA8X0gEOu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QTbPB8B9shxAcoBUAcBygBwAcoCUAXPFlAD+gJwAcpoI26zJW6zsY5MfwHKAMhwAcoAcAHKACRus51/AcoABCBu8tCAUATMljQDcAHKAOIkbrOdfwHKAAQgbvLQgFAEzJY0A3ABygDicAHKAAJ/AcoAAslYzJczMwFwAcoA4iFusyAAMJx/AcoAASBu8tCAAcyVMXABygDiyQH7AAEMyFVw2zzJIgCcghAXjUUZUAnLHxfLP1AF+gJQA88WASBulTBwAcsBks8W4gH6AgHPFsgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMAEpwWchwAcsBcwHLAXABywASzMzJ+QDIcgHLAXABywASygfL/8nQACRsMfoAMXHXIfoAMfoAMKcDqwAAbNMfAYIQD4p+pbry4IHTP/oA+kABAfpAIdcLAcMAkQGSMW3iAdIAAZHUkm0B4voAUWYWFRRDMAHSMO1E0NQB+GKBAQHXAPpAAQH6QAEB0gDUAdDSAAGVgQEB1wCSbQHi+kAh1wsBwwCRAZIxbeIxECYQJRAkECNsFlUFgCDXIdMf0z8x+gAwgTVSIoIQF41FGboDghB73ZfeuhOxEvL0FqAFJwCAyPhCAcxVUFBWgQEBzwBQA88WAc8WygDIIm6zmn8BygASgQEBzwCVMnBYygDiWCBulTBwAcsBks8W4skBzMntVKZwN3U=';
let systemCell = Cell.fromBase64(__system);
let builder = new TupleBuilder();
builder.writeCell(systemCell);
@ -1867,7 +1856,6 @@ const TONBWallet_errors: { [key: number]: { message: string } } = {
6873: { message: `Only an admin can initiate a vote` },
13650: { message: `Invalid bounced message` },
16059: { message: `Invalid value` },
16994: { message: `Vote is finished` },
18474: { message: `only the owner can set a new owner` },
19362: { message: `Invalid quorum percent` },
29720: { message: `Invalid vote` },

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

@ -13,7 +13,7 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
},
"bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQAHUsQxZnU4LMhYKHdaISP9rf-1OcdDAPFWD-bZapIcRtpr",
"to": "kQAbLTduJh6k2Og7nB_0AHNeqN7Pbaf-RE5J8sv6lQ2tRvxL",
"type": "internal",
"value": 100200000000n,
},
@ -31,8 +31,8 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"type": "cell",
},
"bounce": false,
"from": "kQAHUsQxZnU4LMhYKHdaISP9rf-1OcdDAPFWD-bZapIcRtpr",
"to": "kQCFVoQORdkDXw6i10RJiDkJAzm-Kj0oq_ldL66vZpovRblF",
"from": "kQAbLTduJh6k2Og7nB_0AHNeqN7Pbaf-RE5J8sv6lQ2tRvxL",
"to": "kQDjORdN0skAvDKgSj684PFaqVVvairo5dknGetPnqk_Fx7a",
"type": "internal",
"value": 11365000n,
},
@ -43,15 +43,15 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"messages": [
{
"body": {
"cell": "x{178D451900000000000000005174876E8008000EA58862CCEA705990B050EEB44247FB5BFF6A738E8601E2AC1FCDB2D524388D00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{800000000000000000000000000000000000000000000000000000000000000020042AB420722EC81AF87516BA224C41C84819CDF151E9455FCAE97D757B34D17A2C_}",
"cell": "x{178D451900000000000000005174876E800800365A6EDC4C3D49B1D077383FE800E6BD51BD9EDB4FFC889C93E597F52A1B5A8D00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200719C8BA6E964805E1950251F5E7078AD54AAB7B5157472EC938CF5A7CF549F8BC_}",
"type": "cell",
},
"bounce": false,
"from": "kQAHUsQxZnU4LMhYKHdaISP9rf-1OcdDAPFWD-bZapIcRtpr",
"to": "kQDyCsUcb80ZqWzhdTc0Qm-DMCQMp9QyFHBtH0Y2RlTXVSu1",
"from": "kQAbLTduJh6k2Og7nB_0AHNeqN7Pbaf-RE5J8sv6lQ2tRvxL",
"to": "kQDVD58cBbHa2XiTP7dS2OuVuY8tfSrNJAO4l0w0LPqNCXVY",
"type": "internal",
"value": 41715000n,
"value": 41659000n,
},
],
"type": "sent",
@ -69,7 +69,7 @@ exports[`jetton should work correctly with the staking 1`] = `
},
"bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQDwhC8P_RtjQLYFddZ6FFl3wC95KNUcG6s-f7bIe4s6amT_",
"to": "kQCA1fuhNpgeTjvi-8HFcsq4_nr9hukF7ggfdk9LIALrIbS0",
"type": "internal",
"value": 100200000000n,
},
@ -87,8 +87,8 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell",
},
"bounce": false,
"from": "kQDwhC8P_RtjQLYFddZ6FFl3wC95KNUcG6s-f7bIe4s6amT_",
"to": "kQDg1oqtEuoPiStRfbdmM9Bifn4MUekCMD6ufYHXOsuoAizf",
"from": "kQCA1fuhNpgeTjvi-8HFcsq4_nr9hukF7ggfdk9LIALrIbS0",
"to": "kQANNSM4iniaBHpi90JK2d2YEFst4dOJdssqmUajzfRwdZAn",
"type": "internal",
"value": 11365000n,
},
@ -99,15 +99,15 @@ exports[`jetton should work correctly with the staking 1`] = `
"messages": [
{
"body": {
"cell": "x{178D451900000000000000005174876E800801E1085E1FFA36C6816C0AEBACF428B2EF805EF251AA3837567CFF6D90F71674D500023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200706B4556897507C495A8BEDBB319E8313F3F0628F481181F573EC0EB9D65D4014_}",
"cell": "x{178D451900000000000000005174876E80080101ABF7426D303C9C77C5F7838AE59571FCF5FB0DD20BDC103EEC9E964005D64300023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200069A919C453C4D023D317BA1256CEECC082D96F0E9C4BB65954CA351E6FA383AC_}",
"type": "cell",
},
"bounce": false,
"from": "kQDwhC8P_RtjQLYFddZ6FFl3wC95KNUcG6s-f7bIe4s6amT_",
"to": "kQBVdGf16yM9JOGzv062bUvEyZGz2yjeJqOnGU_HMPxJxu2S",
"from": "kQCA1fuhNpgeTjvi-8HFcsq4_nr9hukF7ggfdk9LIALrIbS0",
"to": "kQBI3VBfNDzDEmW2CQVMVgtkYfzNqMRqHzFNPzM5QC5Gho3g",
"type": "internal",
"value": 41715000n,
"value": 41659000n,
},
],
"type": "sent",
@ -120,7 +120,7 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell",
},
"bounce": true,
"from": "kQDwhC8P_RtjQLYFddZ6FFl3wC95KNUcG6s-f7bIe4s6amT_",
"from": "kQCA1fuhNpgeTjvi-8HFcsq4_nr9hukF7ggfdk9LIALrIbS0",
"to": "kQC5Y865mUcSTsSpJYbli0KmSiriJUBFHlKmvNqkS7T5VyUx",
"type": "internal",
"value": 99491421000n,

47
sources/tests/foundation.spec.ts

@ -29,7 +29,6 @@ describe('jetton', () => {
await system.run();
let tonb_events = tonb_tracker.events();
let addressBook = { 'tonb': (tonb_events[1] as any).message.to, 'owner': (tonb_events[1] as any).message.from, 'staking': (tonb_events[9] as any).messages[0].to, 'someadmin': 'unknown' as any, 'foundation': 'unknown' as any };
logEvents(tonb_events, addressBook);
let tracker = system.track(foundation.address);
await foundation.send(owner, { value: toNano('0.1') }, { $$type: 'RequestUnstake', founderIndex: 0n });
await system.run();
@ -38,11 +37,55 @@ describe('jetton', () => {
await system.run();
let foundation_events = tracker.events();
addressBook['foundation'] = (foundation_events[1] as any).message.to;
logEvents(foundation_events, addressBook);
expect((foundation_events[11] as any).messages[0].value).toBeGreaterThan(toNano('3.9'));
expect((foundation_events[11] as any).messages[0].value).toBeLessThan(toNano('4.1'));
expect((foundation_events[11] as any).messages[0].to).toEqual(addressBook['owner']);
expect((foundation_events[8] as any).messages[0].value).toBeGreaterThan(toNano('5.9'));
expect((foundation_events[8] as any).messages[0].value).toBeLessThan(toNano('6.1'));
});
it('should be able to create a vote for blacklisting', async () => {
let system = await ContractSystem.create();
let owner = system.treasure('owner');
let someadmin = system.treasure('someadmin');
let pseudostaking_contract = system.open(await PseudoStaking.fromInit());
let tonb = system.open(await TONB.fromInit(owner.address, default_content, pseudostaking_contract.address));
let foundation = system.open(await Foundation.fromInit(
createDistribution([owner.address, someadmin.address], [60n, 40n]),
createAddressList([owner.address]), tonb.address));
let tonb_tracker = system.track(tonb.address);
let foundation_tracker = system.track(foundation.address);
tonb.send(owner, { value: toNano('1') }, { $$type: 'SetOwner', owner: foundation.address });
await tonb.send(owner, { value: toNano('100.2') }, { $$type: 'Deposit', amount: toNano('100') });
await system.run();
let tonb_events = tonb_tracker.events();
await foundation.send(someadmin, { value: toNano('1.1') }, {
$$type: "InitiateBlacklistVote", wallet: owner.address,
adminIndex: 1n, quorum_percent: 50n, vote_time: 0n
});
await system.run();
let addressBook = { 'tonb': (tonb_events[1] as any).message.to, 'owner': (tonb_events[1] as any).message.from, 'someadmin': 'unknown' as any, 'foundation': 'unknown' as any };
let foundation_events = foundation_tracker.events();
addressBook['foundation'] = (foundation_events[1] as any).message.to;
addressBook['someadmin'] = (foundation_events[1] as any).message.from;
let v = await foundation.getNthVote(0n) as any;
expect(v.votes.get(0n)).toEqual(-1n);
expect(v.votes.get(1n)).toEqual(-1n);
expect(v.ended).toBeFalsy();
expect(v.quorum_percent).toEqual(50n);
await foundation.send(someadmin, { value: toNano('1.1') }, { $$type: "VoteMsg", vote: 2n, adminIndex: 1n, voteId: 0n });
await foundation.send(owner, { value: toNano('1.1') }, { $$type: "VoteMsg", vote: 1n, adminIndex: 0n, voteId: 0n });
await system.run();
await foundation.send(someadmin, { value: toNano('1.1') }, { $$type: "FinishVote", voteId: 0n });
await system.run();
v = await foundation.getNthVote(0n) as any;
foundation_events = foundation_tracker.events();
expect(v.votes.get(0n)).toEqual(1n);
expect(v.votes.get(1n)).toEqual(2n);
expect(v.ended).toBeTruthy();
expect(v.result).toBeTruthy();
await system.run();
tonb_events = tonb_tracker.events();
expect((tonb_events[5] as any).messages[0].to).toEqual(addressBook['owner']);
expect((tonb_events[5] as any).messages[0].value).toBeGreaterThan(toNano('99'));
});
});

4
sources/utils/interactions.ts

@ -92,9 +92,9 @@ export function createAddressList(addresses: Address[]): AddressList {
};
}
export function createDistribution(addresses: Address[], percents: bigint[]): Distribution {
let dict: Dictionary<Address, bigint> = Dictionary.empty();
let dict: Dictionary<bigint, bigint> = Dictionary.empty();
for (let i = 0; i < addresses.length; i++) {
dict.set(addresses[i], percents[i]);
dict.set(BigInt(i), percents[i]);
}
return {
$$type: 'Distribution',

4
sources/wallet.tact

@ -67,7 +67,8 @@ contract TONBWallet {
}
receive(msg: TokenTransferInternal) {
if(self.blacklisted){
let ctx: Context = context();
if(self.blacklisted && ctx.sender != self.master){
send(SendParameters{
to: self.master,
value: 0,
@ -83,7 +84,6 @@ contract TONBWallet {
}
// Check sender
let ctx: Context = context();
if (self.linker == null) {
if (msg.setLinker != null) {
self.linker = msg.setLinker;

Loading…
Cancel
Save