Skip to content

Commit 7d2fb48

Browse files
committed
chore(script): script fixes - tried on-chain
1 parent fec111b commit 7d2fb48

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

scripts/init-testnet.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ function constructFundingSetup(api: ApiPromise) {
189189
// faucet account
190190
"5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7",
191191
token,
192-
new BN(2).pow(new BN(128)).subn(1),
192+
new BN(2).pow(new BN(100)), // note: we can't set 2^128 - 1 because that would overflow total issuance
193193
0
194194
),
195195
api.tx.tokens.setBalance(
196196
treasuryAccount,
197197
token,
198-
new BN(2).pow(new BN(128)).subn(1),
198+
new BN(2).pow(new BN(100)),
199199
0
200200
)
201201
]
@@ -259,7 +259,7 @@ async function constructAmmSetup(api: ApiPromise) {
259259
)
260260
});
261261

262-
const pools = [
262+
const pools: [{ Token: any; }, { Token: any; } | { ForeignAsset: any; }, number, string, string][] = [
263263
[
264264
{ Token: "KBTC" },
265265
{ Token: "KSM" },
@@ -291,7 +291,7 @@ async function constructAmmSetup(api: ApiPromise) {
291291
];
292292
const basicPoolSetup = pools.map(([token0, token1, reward, amount0, amount1]) => {
293293
return [
294-
api.tx.zenlinkProtocol.createPair(token0, token1),
294+
api.tx.dexGeneral.createPair(token0, token1),
295295
api.tx.farming.updateRewardSchedule(
296296
{ LpToken: [token0, token1] },
297297
{ Token: "KINT" },
@@ -300,7 +300,7 @@ async function constructAmmSetup(api: ApiPromise) {
300300
),
301301
api.tx.utility.dispatchAs(
302302
{ system: { Signed: treasuryAccount } },
303-
api.tx.zenlinkProtocol.addLiquidity(
303+
api.tx.dexGeneral.addLiquidity(
304304
token0,
305305
token1,
306306
amount0, // amount0Desired
@@ -314,9 +314,9 @@ async function constructAmmSetup(api: ApiPromise) {
314314
}).flat();
315315

316316
// note: this is before the batch is executed
317-
const basePoolId = (await api.query.zenlinkStableAmm.nextPoolId() as any).toNumber();
317+
const basePoolId = (await api.query.dexStable.nextPoolId() as any).toNumber();
318318
const basePoolSetup = [
319-
api.tx.zenlinkStableAmm.createBasePool(
319+
api.tx.dexStable.createBasePool(
320320
[
321321
{ ForeignAsset: 3 }, // LKSM
322322
{ ForeignAsset: 4 }, // VKSM
@@ -337,12 +337,12 @@ async function constructAmmSetup(api: ApiPromise) {
337337
),
338338
api.tx.utility.dispatchAs(
339339
{ system: { Signed: treasuryAccount } },
340-
api.tx.zenlinkStableAmm.addLiquidity(
340+
api.tx.dexStable.addLiquidity(
341341
basePoolId,
342342
[
343-
"20_000_000_000_000", // 20 LKSM
344-
"20_000_000_000_000", // 20 VKSM
345-
"20_000_000_000_000", // 20 SKSM
343+
"20000000000000", // 20 LKSM
344+
"20000000000000", // 20 VKSM
345+
"20000000000000", // 20 SKSM
346346
],
347347
0, // min mint amount
348348
treasuryAccount, // recipient
@@ -353,7 +353,7 @@ async function constructAmmSetup(api: ApiPromise) {
353353

354354
const metaPoolId = basePoolId + 1;
355355
const metaPoolSetup = [
356-
api.tx.zenlinkStableAmm.createMetaPool(
356+
api.tx.dexStable.createMetaPool(
357357
[
358358
{ Token: "KSM" },
359359
{ StableLpToken: basePoolId }, // LKSM+VKSM+SKSM
@@ -373,11 +373,11 @@ async function constructAmmSetup(api: ApiPromise) {
373373
),
374374
api.tx.utility.dispatchAs(
375375
{ system: { Signed: treasuryAccount } },
376-
api.tx.zenlinkStableAmm.addLiquidity(
376+
api.tx.dexStable.addLiquidity(
377377
metaPoolId,
378378
[
379-
"10_000_000_000_000", // 10 KSM
380-
"80_000_000_000_000_000_000", // 80 LKSM
379+
"10000000000000", // 10 KSM
380+
"80000000000000000000", // 80 LKSM
381381
],
382382
0, // min mint amount
383383
treasuryAccount, // recipient

0 commit comments

Comments
 (0)