Skip to content

Commit ad1203a

Browse files
committed
feat: add eth, ausd and kar pools
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
1 parent e9cb26a commit ad1203a

1 file changed

Lines changed: 65 additions & 9 deletions

File tree

scripts/init-testnet.ts

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,24 @@ async function constructAmmSetup(api: ApiPromise) {
273273
prices.set(JSON.stringify({ Token: "KBTC" }), 22842.91);
274274
prices.set(JSON.stringify({ Token: "KSM" }), 36.05);
275275
prices.set(JSON.stringify({ Token: "KINT" }), 0.982574);
276-
prices.set(JSON.stringify({ ForeignAsset: 1 }), 1); // usdt
277-
prices.set(JSON.stringify({ ForeignAsset: 2 }), 8.94); // movr
276+
prices.set(JSON.stringify({ ForeignAsset: 1 }), 1); // USDT
277+
prices.set(JSON.stringify({ ForeignAsset: 2 }), 8.94); // MOVR
278+
prices.set(JSON.stringify({ ForeignAsset: 6 }), 1536.51); // ETH
279+
prices.set(JSON.stringify({ ForeignAsset: 7 }), 0.768930); // AUSD
280+
prices.set(JSON.stringify({ ForeignAsset: 8 }), 0.208364); // KAR
281+
278282
const decimals: Map<string, number> = new Map();
279283
decimals.set(JSON.stringify({ Token: "KBTC" }), 8);
280284
decimals.set(JSON.stringify({ Token: "KSM" }), 12);
281285
decimals.set(JSON.stringify({ Token: "KINT" }), 12);
282-
decimals.set(JSON.stringify({ ForeignAsset: 1 }), 6); // usdt
283-
decimals.set(JSON.stringify({ ForeignAsset: 2 }), 18); // movr
284-
285-
const pools: [{ Token: any; }, { Token: any; } | { ForeignAsset: any; }, number, number][] = [
286+
decimals.set(JSON.stringify({ ForeignAsset: 1 }), 6); // USDT
287+
decimals.set(JSON.stringify({ ForeignAsset: 2 }), 18); // MOVR
288+
decimals.set(JSON.stringify({ ForeignAsset: 6 }), 18); // ETH
289+
decimals.set(JSON.stringify({ ForeignAsset: 7 }), 12); // AUSD
290+
decimals.set(JSON.stringify({ ForeignAsset: 8 }), 12); // KAR
291+
292+
// NOTE: ordering of tokens must comply with PartialOrd (for now)
293+
const pools: [{ Token: any; } | { ForeignAsset: any; }, { Token: any; } | { ForeignAsset: any; }, number, number][] = [
286294
[
287295
{ Token: "KSM" },
288296
{ Token: "KBTC" },
@@ -299,17 +307,34 @@ async function constructAmmSetup(api: ApiPromise) {
299307
{ Token: "KBTC" },
300308
{ ForeignAsset: 2 }, // MOVR
301309
20_000,
302-
175_000, // liquidity in usd
310+
175_000, // liquidity in usd
303311
],
304312
[
305313
{ Token: "KINT" },
306314
{ ForeignAsset: 2 }, // MOVR
307315
35_000,
308-
150_000, // liquidity in usd
316+
150_000, // liquidity in usd
317+
],
318+
[
319+
{ Token: "KBTC" },
320+
{ ForeignAsset: 6 }, // ETH
321+
0,
322+
300_000, // liquidity in usd
323+
],
324+
[
325+
{ ForeignAsset: 1 }, // USDT
326+
{ ForeignAsset: 7 }, // AUSD
327+
0,
328+
70_000, // liquidity in usd
329+
],
330+
[
331+
{ ForeignAsset: 1 }, // MOVR
332+
{ ForeignAsset: 8 }, // KAR
333+
0,
334+
100_000, // liquidity in usd
309335
],
310336
];
311337

312-
313338
const basicPoolSetup = pools.map(([token0, token1, reward, liquidity]) => {
314339
// calculate liquidity amounts
315340
let decimals0 = new BN(decimals.get(JSON.stringify(token0)) as number);
@@ -321,6 +346,7 @@ async function constructAmmSetup(api: ApiPromise) {
321346
let liquidity1 = new BN(liquidity / 2).mul(new BN(10).pow(decimals1)).divn(price1);
322347

323348
return [
349+
// @ts-ignore
324350
api.tx.dexGeneral.createPair(token0, token1, 30),
325351
api.tx.farming.updateRewardSchedule(
326352
{ LpToken: [token0, token1] },
@@ -509,6 +535,36 @@ function constructForeignAssetSetup(api: ApiPromise) {
509535
additional: { feePerSecond: 233100000000, coingeckoId: "" }
510536
},
511537
5
538+
), api.tx.assetRegistry.registerAsset(
539+
{
540+
decimals: 18,
541+
name: "Ethereum",
542+
symbol: "ETH",
543+
existentialDeposit: 0,
544+
location: null,
545+
additional: { feePerSecond: 0, coingeckoId: "ethereum" }
546+
},
547+
6
548+
), api.tx.assetRegistry.registerAsset(
549+
{
550+
decimals: 12,
551+
name: "Acala Dollar",
552+
symbol: "AUSD",
553+
existentialDeposit: 0,
554+
location: null,
555+
additional: { feePerSecond: 0, coingeckoId: "acala-dollar" }
556+
},
557+
7
558+
), api.tx.assetRegistry.registerAsset(
559+
{
560+
decimals: 12,
561+
name: "Karura",
562+
symbol: "KAR",
563+
existentialDeposit: 0,
564+
location: null,
565+
additional: { feePerSecond: 0, coingeckoId: "karura" }
566+
},
567+
8
512568
)
513569
];
514570
}

0 commit comments

Comments
 (0)