@@ -21,8 +21,12 @@ const args = yargs(hideBin(process.argv))
2121 } )
2222 . option ( "with-defaults-of" , {
2323 description : "Which default values to use" ,
24- choices : [ 'testnet-kintsugi' , 'testnet-interlay' ] ,
24+ 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+ // })
2630 . argv ;
2731
2832main ( ) . catch ( ( err ) => {
@@ -205,7 +209,7 @@ function constructAnnuitySetup(api: ApiPromise) {
205209 return vaultAnnuity . concat ( escrowAnnuity ) ;
206210}
207211
208- function constructAmmSetup ( api : ApiPromise ) {
212+ async function constructAmmSetup ( api : ApiPromise ) {
209213 const pools = [
210214 [ { Token : "KBTC" } , { Token : "KSM" } , 45_000 ] ,
211215 [ { Token : "KBTC" } , { ForeignAsset : 1 } , 40_000 ] , // usdt
@@ -224,40 +228,56 @@ function constructAmmSetup(api: ApiPromise) {
224228 ] ;
225229 } ) . reduce ( ( x , y ) => { return x . concat ( y ) ; } ) ;
226230
227- const basePoolSetup = api . tx . zenlinkStableAmm . createBasePool (
228- [
229- { ForeignAsset : 3 } , // LKSM
230- { ForeignAsset : 4 } , // VKSM
231- { ForeignAsset : 5 } , // SKSM
232- ] ,
233- [ 12 , 12 , 12 ] , // decimals
234- 200 , // amplification coefficient
235- 100_000_000 , // max fee 1%
236- 0 , // no admin fee
237- Buffer . concat ( [
238- Buffer . from ( "modl" ) , // 4 bytes
239- Buffer . from ( "mod/trsy" ) , // 8 bytes
240- ] , 32 ) , // treasury
241- "LKSM+VKSM+SKSM" // currency symbol
242- ) ;
231+ const basePoolId = ( await api . query . zenlinkStableAmm . nextPoolId ( ) as any ) . toNumber ( ) ; // note: this is before the batch is executed
243232
244- const metaPoolSetup = api . tx . zenlinkStableAmm . createMetaPool (
245- [
246- { StableLpToken : 0 } , // LKSM+VKSM+SKSM
247- { Token : "KSM" } ,
248- ] ,
249- [ 12 , 12 ] , // decimals
250- 200 , // amplification coefficient
251- 100_000_000 , // max fee 1%
252- 0 , // no admin fee
253- Buffer . concat ( [
254- Buffer . from ( "modl" ) , // 4 bytes
255- Buffer . from ( "mod/trsy" ) , // 8 bytes
256- ] , 32 ) , // treasury
257- "(LKSM+VKSM+SKSM)+KSM" // currency symbol
258- ) ;
233+ const basePoolSetup = [
234+ api . tx . zenlinkStableAmm . createBasePool (
235+ [
236+ { ForeignAsset : 3 } , // LKSM
237+ { ForeignAsset : 4 } , // VKSM
238+ { ForeignAsset : 5 } , // SKSM
239+ ] ,
240+ [ 12 , 12 , 12 ] , // decimals
241+ 200 , // amplification coefficient
242+ 100_000_000 , // max fee 1%
243+ 0 , // no admin fee
244+ Buffer . concat ( [
245+ Buffer . from ( "modl" ) , // 4 bytes
246+ Buffer . from ( "mod/trsy" ) , // 8 bytes
247+ ] , 32 ) , // treasury
248+ "LKSM+VKSM+SKSM" // currency symbol
249+ ) , api . tx . farming . updateRewardSchedule (
250+ { StableLpToken : basePoolId } ,
251+ { Token : "KINT" } ,
252+ 60 * 24 * 7 * 12 , // three months, reward period is per minute
253+ new BN ( 10 ) . pow ( new BN ( 12 ) ) . muln ( 15_000 ) ,
254+ )
255+ ] ;
256+
257+ const metaPoolSetup = [
258+ api . tx . zenlinkStableAmm . createMetaPool (
259+ [
260+ { StableLpToken : basePoolId + 1 } , // LKSM+VKSM+SKSM
261+ { Token : "KSM" } ,
262+ ] ,
263+ [ 12 , 12 ] , // decimals
264+ 200 , // amplification coefficient
265+ 100_000_000 , // max fee 1%
266+ 0 , // no admin fee
267+ Buffer . concat ( [
268+ Buffer . from ( "modl" ) , // 4 bytes
269+ Buffer . from ( "mod/trsy" ) , // 8 bytes
270+ ] , 32 ) , // treasury
271+ "(LKSM+VKSM+SKSM)+KSM" // currency symbol
272+ ) , api . tx . farming . updateRewardSchedule (
273+ { StableLpToken : basePoolId + 1 } ,
274+ { Token : "KINT" } ,
275+ 60 * 24 * 7 * 12 , // three months, reward period is per minute
276+ new BN ( 10 ) . pow ( new BN ( 12 ) ) . muln ( 33_000 ) ,
277+ )
278+ ] ;
259279
260- return basicPoolSetup . concat ( [ basePoolSetup , metaPoolSetup ] ) ;
280+ return basicPoolSetup . concat ( basePoolSetup ) . concat ( metaPoolSetup ) ;
261281}
262282
263283function constructForeignAssetSetup ( api : ApiPromise ) {
@@ -362,7 +382,7 @@ async function setupParachain() {
362382 constructLendingSetup ( paraApi ) ,
363383 constructVaultRegistrySetup ( paraApi ) ,
364384 constructAnnuitySetup ( paraApi ) ,
365- constructAmmSetup ( paraApi ) ,
385+ await constructAmmSetup ( paraApi ) ,
366386 ] . reduce ( ( x , y ) => { return x . concat ( y ) ; } ) ;
367387
368388 const batched = paraApi . tx . utility . batchAll ( calls ) ;
@@ -377,11 +397,6 @@ async function main(): Promise<void> {
377397 await cryptoWaitReady ( ) ;
378398
379399 switch ( args [ 'with-defaults-of' ] ) {
380- case 'testnet-interlay' :
381- if ( args [ 'parachain-endpoint' ] === undefined ) {
382- args [ 'parachain-endpoint' ] = "wss://api.interlay.io/parachain" ;
383- }
384- break ;
385400 case 'testnet-kintsugi' :
386401 if ( args [ 'parachain-endpoint' ] === undefined ) {
387402 args [ 'parachain-endpoint' ] = "wss://api-dev-kintsugi.interlay.io/parachain" ;
0 commit comments