Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pool migration #32

Open
wants to merge 6 commits into
base: more_custom_parameters
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 4 additions & 32 deletions scripts/deployPool.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
import { Address, Cell, toNano, beginCell } from '@ton/core';
import { Pool, dataToFullConfig, poolFullConfigToCell } from '../wrappers/Pool';
import { Pool, dataToFullConfig, poolFullConfigToCell, PoolFullConfig } from '../wrappers/Pool';
import { PoolState } from "../PoolConstants";
import { JettonMinter as DAOJettonMinter, jettonContentToCell } from '../contracts/jetton_dao/wrappers/JettonMinter';
import { compile, NetworkProvider, sleep } from '@ton/blueprint';
import {JettonWallet as PoolJettonWallet } from '../wrappers/JettonWallet';
import { Controller } from '../wrappers/Controller';
import { Librarian, LibrarianConfig } from '../wrappers/Librarian';


const waitForTransaction = async (provider:NetworkProvider, address:Address,
action:string = "transaction",
curTxLt:string | null = null,
maxRetry:number = 15,
interval:number=1000) => {
let done = false;
let count = 0;
const ui = provider.ui();
let blockNum = (await provider.api().getLastBlock()).last.seqno;
if(curTxLt == null) {
let initialState = await provider.api().getAccount(blockNum, address);
let lt = initialState?.account?.last?.lt;
curTxLt = lt ? lt : null;
}
do {
ui.write(`Awaiting ${action} completion (${++count}/${maxRetry})`);
await sleep(interval);
let newBlockNum = (await provider.api().getLastBlock()).last.seqno;
if (blockNum == newBlockNum) {
continue;
}
blockNum = newBlockNum;
const curState = await provider.api().getAccount(blockNum, address);
if(curState?.account?.last !== null){
done = curState?.account?.last?.lt !== curTxLt;
}
} while(!done && count < maxRetry);
return done;
}
import { waitForTransaction } from '../wrappers/ui-utils';

export async function run(provider: NetworkProvider) {

Expand Down Expand Up @@ -111,6 +81,8 @@ export async function run(provider: NetworkProvider) {
pool_jetton_wallet_code : dao_wallet_code,
payout_minter_code : payout_collection,
vote_keeper_code : dao_vote_keeper_code,
disbalanceTolerance: 30,
creditStartPriorElectionsEnd: 0
};

//deploy or use existing librarian
Expand Down
Loading