Skip to content

Commit cdbc5d8

Browse files
gregdhillsander2
authored andcommitted
chore: add liquidity to uniswap pools
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
1 parent a2df559 commit cdbc5d8

File tree

1 file changed

+58
-22
lines changed

1 file changed

+58
-22
lines changed

scripts/init-testnet.ts

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ function constructLendingSetup(api: ApiPromise) {
144144
const underlyingTokens = [
145145
{ Token: "KBTC" },
146146
{ Token: "KSM" },
147-
{ ForeignAsset: 1 }, // usdt
148-
{ ForeignAsset: 2 }, // movr
147+
{ ForeignAsset: 1 }, // USDT
148+
{ ForeignAsset: 2 }, // MOVR
149149
];
150150

151151
let addRewards = [
@@ -169,25 +169,25 @@ function constructFundingSetup(api: ApiPromise) {
169169
{ Token: "KSM" },
170170
{ Token: "KINT" },
171171
{ Token: "KBTC" }, // NOTE: this is unredeemable
172-
{ ForeignAsset: 1 },
173-
{ ForeignAsset: 2 },
174-
{ ForeignAsset: 3 },
175-
{ ForeignAsset: 4 },
176-
{ ForeignAsset: 5 }
172+
{ ForeignAsset: 1 }, // USDT
173+
{ ForeignAsset: 2 }, // MOVR
174+
{ ForeignAsset: 3 }, // LKSM
175+
{ ForeignAsset: 4 }, // VKSM
176+
{ ForeignAsset: 5 }, // SKSM
177177
];
178178
return tokens.map((token) => {
179179
return [
180180
api.tx.tokens.setBalance(
181181
// faucet account
182182
"5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7",
183183
token,
184-
"1000000000000000000000000000", //1e24 planck
184+
new BN(2).pow(new BN(128)).subn(1),
185185
0
186186
),
187187
api.tx.tokens.setBalance(
188188
treasuryAccount,
189189
token,
190-
"1000000000000000000000000000", //1e15 KINT
190+
new BN(2).pow(new BN(128)).subn(1),
191191
0
192192
)
193193
]
@@ -196,7 +196,7 @@ function constructFundingSetup(api: ApiPromise) {
196196

197197
function constructVaultRegistrySetup(api: ApiPromise) {
198198
const currencyPair = {
199-
collateral: { ForeignAsset: 3 }, // lksm
199+
collateral: { ForeignAsset: 3 }, // LKSM
200200
wrapped: { Token: "KBTC" }
201201
};
202202
return [
@@ -252,20 +252,56 @@ async function constructAmmSetup(api: ApiPromise) {
252252
});
253253

254254
const pools = [
255-
[{ Token: "KBTC" }, { Token: "KSM" }, 45_000],
256-
[{ Token: "KBTC" }, { ForeignAsset: 1 }, 40_000], // usdt
257-
[{ Token: "KBTC" }, { ForeignAsset: 2 }, 20_000], // movr
258-
[{ Token: "KINT" }, { ForeignAsset: 2 }, 35_000], // movr
255+
[
256+
{ Token: "KBTC" },
257+
{ Token: "KSM" },
258+
45_000,
259+
"10000000000", // 100 BTC
260+
"63674740000000000"
261+
],
262+
[
263+
{ Token: "KBTC" },
264+
{ ForeignAsset: 1 }, // USDT
265+
40_000,
266+
"10000000000", // 100 BTC
267+
"2377141310000"
268+
],
269+
[
270+
{ Token: "KBTC" },
271+
{ ForeignAsset: 2 }, // MOVR
272+
20_000,
273+
"10000000000", // 100 BTC
274+
"267818622409032238891008"
275+
],
276+
[
277+
{ Token: "KINT" },
278+
{ ForeignAsset: 2 }, // MOVR
279+
35_000,
280+
"100000000000000000", // 100_000 KINT
281+
"11578645889226521968640"
282+
],
259283
];
260-
const basicPoolSetup = pools.map(([token1, token2, reward]) => {
284+
const basicPoolSetup = pools.map(([token0, token1, reward, amount0, amount1]) => {
261285
return [
262-
api.tx.zenlinkProtocol.createPair(token1, token2),
286+
api.tx.zenlinkProtocol.createPair(token0, token1),
263287
api.tx.farming.updateRewardSchedule(
264-
{ LpToken: [token1, token2] },
288+
{ LpToken: [token0, token1] },
265289
{ Token: "KINT" },
266290
60 * 24 * 7 * 12, // three months, reward period is per minute
267291
new BN(10).pow(new BN(12)).muln(reward as any),
268292
),
293+
api.tx.utility.dispatchAs(
294+
{ system: { Signed: treasuryAccount } },
295+
api.tx.zenlinkProtocol.addLiquidity(
296+
token0,
297+
token1,
298+
amount0, // amount0Desired
299+
amount1, // amount1Desired
300+
0, // amount0Min
301+
0, // amount0Min
302+
new BN(4294967295), // deadline
303+
),
304+
)
269305
];
270306
}).reduce((x, y) => { return x.concat(y); });
271307

@@ -296,9 +332,9 @@ async function constructAmmSetup(api: ApiPromise) {
296332
api.tx.zenlinkStableAmm.addLiquidity(
297333
basePoolId,
298334
[
299-
100_000,
300-
100_000,
301-
100_000,
335+
"20_000_000_000_000", // 20 LKSM
336+
"20_000_000_000_000", // 20 VKSM
337+
"20_000_000_000_000", // 20 SKSM
302338
],
303339
0, // min mint amount
304340
treasuryAccount, // recipient
@@ -332,8 +368,8 @@ async function constructAmmSetup(api: ApiPromise) {
332368
api.tx.zenlinkStableAmm.addLiquidity(
333369
metaPoolId,
334370
[
335-
100_000,
336-
100_000,
371+
"10_000_000_000_000", // 10 KSM
372+
"80_000_000_000_000_000_000", // 80 LKSM
337373
],
338374
0, // min mint amount
339375
treasuryAccount, // recipient

0 commit comments

Comments
 (0)