Skip to content

Commit 0c19ce4

Browse files
committed
chore(script): as submitted
1 parent 749e764 commit 0c19ce4

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

scripts/init-testnet.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const args = yargs(hideBin(process.argv))
2323
description: "Which default values to use",
2424
choices: ['testnet-kintsugi'],
2525
})
26-
.option("clients-url", {
27-
description: "Url of the clients, without the client-name. E.g. https://github.com/interlay/interbtc-clients/releases/download/1.17.6/",
28-
demandOption: true,
29-
})
26+
// .option("clients-url", {
27+
// description: "Url of the clients, without the client-name. E.g. https://github.com/interlay/interbtc-clients/releases/download/1.17.6/",
28+
// demandOption: true,
29+
// })
3030
.argv;
3131

3232
main().catch((err) => {
@@ -142,7 +142,12 @@ function constructLendingSetup(api: ApiPromise) {
142142
{ForeignAsset: 2}, // movr
143143
];
144144

145-
let addRewards = [api.tx.loans.addReward("100000000000000000000")];
145+
let addRewards = [
146+
api.tx.utility.dispatchAs(
147+
{ system: { Signed: "a3ckVDnZwjdBhkq1KJodZj3iCgYMseWfLA5fpqExuEpMy8Y5q" } }, // root
148+
api.tx.loans.addReward("100000000000000000000")
149+
)
150+
];
146151
let activateMarketWithRewards = underlyingTokens.map((token) => { return [
147152
api.tx.loans.activateMarket(token),
148153
api.tx.loans.updateMarketRewardSpeed(token, 10, 10),
@@ -210,6 +215,24 @@ function constructAnnuitySetup(api: ApiPromise) {
210215
}
211216

212217
async function constructAmmSetup(api: ApiPromise) {
218+
// workaround for broken is_exists check - TODO: remove once fixed.
219+
// see https://github.com/interlay/interbtc/blob/1a1afa90228f37c9ade4acbda8275c2f5cfe85ce/parachain/runtime/testnet-kintsugi/src/zenlink.rs#L43
220+
const isExistsWorkaround = [
221+
{Token: "KBTC" },
222+
{ ForeignAsset: 1 },
223+
{ ForeignAsset: 2 },
224+
{ ForeignAsset: 3 },
225+
{ ForeignAsset: 4 },
226+
{ ForeignAsset: 5 }
227+
].map((token) => {
228+
return api.tx.tokens.setBalance(
229+
"a3ckVDnZwjdBhkq1KJodZj3iCgYMseWfLA5fpqExuEpMy8Y5q", // root
230+
token,
231+
0,
232+
1
233+
)
234+
});
235+
213236
const pools = [
214237
[{ Token: "KBTC" }, { Token: "KSM" }, 45_000],
215238
[{ Token: "KBTC" }, { ForeignAsset: 1 }, 40_000], // usdt
@@ -257,8 +280,8 @@ async function constructAmmSetup(api: ApiPromise) {
257280
const metaPoolSetup = [
258281
api.tx.zenlinkStableAmm.createMetaPool(
259282
[
260-
{ StableLpToken: basePoolId }, // LKSM+VKSM+SKSM
261283
{ Token: "KSM" },
284+
{ StableLpToken: basePoolId }, // LKSM+VKSM+SKSM
262285
],
263286
[12, 12], // decimals
264287
200, // amplification coefficient
@@ -277,7 +300,7 @@ async function constructAmmSetup(api: ApiPromise) {
277300
)
278301
];
279302

280-
return basicPoolSetup.concat(basePoolSetup).concat(metaPoolSetup);
303+
return isExistsWorkaround.concat(basicPoolSetup).concat(basePoolSetup);//.concat(metaPoolSetup);
281304
}
282305

283306
function constructForeignAssetSetup(api: ApiPromise) {

0 commit comments

Comments
 (0)