|
|
|
@ -1065,40 +1065,40 @@ function dictValueParserFinishVote(): DictionaryValue<FinishVote> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type Vote = { |
|
|
|
|
$$type: 'Vote'; |
|
|
|
|
export type VoteMsg = { |
|
|
|
|
$$type: 'VoteMsg'; |
|
|
|
|
voteId: bigint; |
|
|
|
|
adminIndex: bigint; |
|
|
|
|
vote: bigint; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function storeVote(src: Vote) { |
|
|
|
|
export function storeVoteMsg(src: VoteMsg) { |
|
|
|
|
return (builder: Builder) => { |
|
|
|
|
let b_0 = builder; |
|
|
|
|
b_0.storeUint(3060856014, 32); |
|
|
|
|
b_0.storeUint(1493035179, 32); |
|
|
|
|
b_0.storeInt(src.voteId, 257); |
|
|
|
|
b_0.storeInt(src.adminIndex, 257); |
|
|
|
|
b_0.storeInt(src.vote, 257); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function loadVote(slice: Slice) { |
|
|
|
|
export function loadVoteMsg(slice: Slice) { |
|
|
|
|
let sc_0 = slice; |
|
|
|
|
if (sc_0.loadUint(32) !== 3060856014) { throw Error('Invalid prefix'); } |
|
|
|
|
if (sc_0.loadUint(32) !== 1493035179) { throw Error('Invalid prefix'); } |
|
|
|
|
let _voteId = sc_0.loadIntBig(257); |
|
|
|
|
let _adminIndex = sc_0.loadIntBig(257); |
|
|
|
|
let _vote = sc_0.loadIntBig(257); |
|
|
|
|
return { $$type: 'Vote' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
|
|
|
return { $$type: 'VoteMsg' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function loadTupleVote(source: TupleReader) { |
|
|
|
|
function loadTupleVoteMsg(source: TupleReader) { |
|
|
|
|
let _voteId = source.readBigNumber(); |
|
|
|
|
let _adminIndex = source.readBigNumber(); |
|
|
|
|
let _vote = source.readBigNumber(); |
|
|
|
|
return { $$type: 'Vote' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
|
|
|
return { $$type: 'VoteMsg' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function storeTupleVote(source: Vote) { |
|
|
|
|
function storeTupleVoteMsg(source: VoteMsg) { |
|
|
|
|
let builder = new TupleBuilder(); |
|
|
|
|
builder.writeNumber(source.voteId); |
|
|
|
|
builder.writeNumber(source.adminIndex); |
|
|
|
@ -1106,13 +1106,13 @@ function storeTupleVote(source: Vote) {
|
|
|
|
|
return builder.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dictValueParserVote(): DictionaryValue<Vote> { |
|
|
|
|
function dictValueParserVoteMsg(): DictionaryValue<VoteMsg> { |
|
|
|
|
return { |
|
|
|
|
serialize: (src, buidler) => { |
|
|
|
|
buidler.storeRef(beginCell().store(storeVote(src)).endCell()); |
|
|
|
|
buidler.storeRef(beginCell().store(storeVoteMsg(src)).endCell()); |
|
|
|
|
}, |
|
|
|
|
parse: (src) => { |
|
|
|
|
return loadVote(src.loadRef().beginParse()); |
|
|
|
|
return loadVoteMsg(src.loadRef().beginParse()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1468,6 +1468,47 @@ function dictValueParserCollectProfit(): DictionaryValue<CollectProfit> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type SetOwner = { |
|
|
|
|
$$type: 'SetOwner'; |
|
|
|
|
owner: Address; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function storeSetOwner(src: SetOwner) { |
|
|
|
|
return (builder: Builder) => { |
|
|
|
|
let b_0 = builder; |
|
|
|
|
b_0.storeUint(3072093686, 32); |
|
|
|
|
b_0.storeAddress(src.owner); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function loadSetOwner(slice: Slice) { |
|
|
|
|
let sc_0 = slice; |
|
|
|
|
if (sc_0.loadUint(32) !== 3072093686) { throw Error('Invalid prefix'); } |
|
|
|
|
let _owner = sc_0.loadAddress(); |
|
|
|
|
return { $$type: 'SetOwner' as const, owner: _owner }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function loadTupleSetOwner(source: TupleReader) { |
|
|
|
|
let _owner = source.readAddress(); |
|
|
|
|
return { $$type: 'SetOwner' as const, owner: _owner }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function storeTupleSetOwner(source: SetOwner) { |
|
|
|
|
let builder = new TupleBuilder(); |
|
|
|
|
builder.writeAddress(source.owner); |
|
|
|
|
return builder.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dictValueParserSetOwner(): DictionaryValue<SetOwner> { |
|
|
|
|
return { |
|
|
|
|
serialize: (src, buidler) => { |
|
|
|
|
buidler.storeRef(beginCell().store(storeSetOwner(src)).endCell()); |
|
|
|
|
}, |
|
|
|
|
parse: (src) => { |
|
|
|
|
return loadSetOwner(src.loadRef().beginParse()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type WithdrawalRequests = { |
|
|
|
|
$$type: 'WithdrawalRequests'; |
|
|
|
|
addresses: Dictionary<bigint, Address>; |
|
|
|
@ -1517,6 +1558,135 @@ function dictValueParserWithdrawalRequests(): DictionaryValue<WithdrawalRequests
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type Proposal = { |
|
|
|
|
$$type: 'Proposal'; |
|
|
|
|
type: bigint; |
|
|
|
|
blacklistAddress: Address | null; |
|
|
|
|
distribution: Distribution | null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function storeProposal(src: Proposal) { |
|
|
|
|
return (builder: Builder) => { |
|
|
|
|
let b_0 = builder; |
|
|
|
|
b_0.storeInt(src.type, 257); |
|
|
|
|
b_0.storeAddress(src.blacklistAddress); |
|
|
|
|
if (src.distribution !== null && src.distribution !== undefined) { b_0.storeBit(true); b_0.store(storeDistribution(src.distribution)); } else { b_0.storeBit(false); } |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function loadProposal(slice: Slice) { |
|
|
|
|
let sc_0 = slice; |
|
|
|
|
let _type = sc_0.loadIntBig(257); |
|
|
|
|
let _blacklistAddress = sc_0.loadMaybeAddress(); |
|
|
|
|
let _distribution = sc_0.loadBit() ? loadDistribution(sc_0) : null; |
|
|
|
|
return { $$type: 'Proposal' as const, type: _type, blacklistAddress: _blacklistAddress, distribution: _distribution }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function loadTupleProposal(source: TupleReader) { |
|
|
|
|
let _type = source.readBigNumber(); |
|
|
|
|
let _blacklistAddress = source.readAddressOpt(); |
|
|
|
|
const _distribution_p = source.readTupleOpt(); |
|
|
|
|
const _distribution = _distribution_p ? loadTupleDistribution(_distribution_p) : null; |
|
|
|
|
return { $$type: 'Proposal' as const, type: _type, blacklistAddress: _blacklistAddress, distribution: _distribution }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function storeTupleProposal(source: Proposal) { |
|
|
|
|
let builder = new TupleBuilder(); |
|
|
|
|
builder.writeNumber(source.type); |
|
|
|
|
builder.writeAddress(source.blacklistAddress); |
|
|
|
|
if (source.distribution !== null && source.distribution !== undefined) { |
|
|
|
|
builder.writeTuple(storeTupleDistribution(source.distribution)); |
|
|
|
|
} else { |
|
|
|
|
builder.writeTuple(null); |
|
|
|
|
} |
|
|
|
|
return builder.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dictValueParserProposal(): DictionaryValue<Proposal> { |
|
|
|
|
return { |
|
|
|
|
serialize: (src, buidler) => { |
|
|
|
|
buidler.storeRef(beginCell().store(storeProposal(src)).endCell()); |
|
|
|
|
}, |
|
|
|
|
parse: (src) => { |
|
|
|
|
return loadProposal(src.loadRef().beginParse()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type Vote = { |
|
|
|
|
$$type: 'Vote'; |
|
|
|
|
id: bigint; |
|
|
|
|
votes: Dictionary<bigint, bigint>; |
|
|
|
|
vote_end: bigint; |
|
|
|
|
proposal: Proposal; |
|
|
|
|
quorum_percent: bigint; |
|
|
|
|
ended: boolean; |
|
|
|
|
result: boolean | null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function storeVote(src: Vote) { |
|
|
|
|
return (builder: Builder) => { |
|
|
|
|
let b_0 = builder; |
|
|
|
|
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()); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function loadVote(slice: Slice) { |
|
|
|
|
let sc_0 = 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 }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function storeTupleVote(source: Vote) { |
|
|
|
|
let builder = new TupleBuilder(); |
|
|
|
|
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); |
|
|
|
|
return builder.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dictValueParserVote(): DictionaryValue<Vote> { |
|
|
|
|
return { |
|
|
|
|
serialize: (src, buidler) => { |
|
|
|
|
buidler.storeRef(beginCell().store(storeVote(src)).endCell()); |
|
|
|
|
}, |
|
|
|
|
parse: (src) => { |
|
|
|
|
return loadVote(src.loadRef().beginParse()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export type ChangeOwner = { |
|
|
|
|
$$type: 'ChangeOwner'; |
|
|
|
|
newOwner: Address; |
|
|
|
@ -1692,11 +1862,26 @@ const PseudoStaking_errors: { [key: number]: { message: string } } = {
|
|
|
|
|
136: { message: `Invalid address` }, |
|
|
|
|
4429: { message: `Invalid sender` }, |
|
|
|
|
6384: { message: `not enough money for withdraw` }, |
|
|
|
|
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` }, |
|
|
|
|
29821: { message: `Voting requires at least 1 ton for the fees` }, |
|
|
|
|
30386: { message: `Vote already ended` }, |
|
|
|
|
32366: { message: `not enough money for deposit` }, |
|
|
|
|
34326: { message: `Vote is not finished yet` }, |
|
|
|
|
37444: { message: `Only a founder can request unstake` }, |
|
|
|
|
41207: { message: `invalid sender` }, |
|
|
|
|
42983: { message: `No profit to collect` }, |
|
|
|
|
44816: { message: `Wallet is blacklisted` }, |
|
|
|
|
46931: { message: `Invalid vote id` }, |
|
|
|
|
49606: { message: `Invalid admin index` }, |
|
|
|
|
53981: { message: `Only an admin can collect profit` }, |
|
|
|
|
56549: { message: `Only an admin can vote` }, |
|
|
|
|
61070: { message: `Invalid vote time` }, |
|
|
|
|
61265: { message: `Only the owner can trigger un-staking` }, |
|
|
|
|
62972: { message: `Invalid balance` }, |
|
|
|
|
} |
|
|
|
|