From ada07a1358b215ee13ebf3aeccf5c401a021d23a Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 5 Oct 2023 02:46:38 +0300 Subject: [PATCH] test for lp vesting audit fix --- .../run_in_band/tge.auction_migration.test.ts | 68 ++++++++++++++++--- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/src/testcases/run_in_band/tge.auction_migration.test.ts b/src/testcases/run_in_band/tge.auction_migration.test.ts index cfd09ddf..a8534a55 100644 --- a/src/testcases/run_in_band/tge.auction_migration.test.ts +++ b/src/testcases/run_in_band/tge.auction_migration.test.ts @@ -220,6 +220,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'auctionVesting', 'auctionLockdrop', 'auctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { tgeWallets[v] = new cosmosWrapper.WalletWrapper( neutronChain, @@ -274,6 +275,11 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { tgeWallets['airdropAuctionVesting'].wallet.address.toString(), amount: '1000000', }, + { + address: + tgeWallets['claimVestingBeforeMigration'].wallet.address.toString(), + amount: '1000000', + }, ]; tgeMain.times.airdropStart = tge.getTimestamp(0); tgeMain.times.airdropVestingStart = tge.getTimestamp(300); @@ -302,6 +308,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'airdropAuctionVesting', 'airdropAuctionLockdrop', 'airdropAuctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { const address = tgeWallets[v].wallet.address.toString(); const amount = @@ -387,6 +394,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'auctionVesting', 'auctionLockdrop', 'auctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { const res2 = await tgeWallets[v].executeContract( tgeMain.contracts.auction, @@ -460,6 +468,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'auctionVesting', 'auctionLockdrop', 'auctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { const res2 = await tgeWallets[v].executeContract( tgeMain.contracts.auction, @@ -1001,9 +1010,16 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { }), ); expect(res.code).toEqual(0); + res = await tgeWallets.airdropOnly.executeContract( + tgeMain.contracts.auction, + JSON.stringify({ + migrate_to_vesting: {}, + }), + ); + expect(res.code).toEqual(0); tgeMain.times.vestTimestamp = Date.now(); }); - it('should not vest LP all 7 users have been migrated', async () => { + it('should not vest LP all 8 users have been migrated', async () => { await expect( cmInstantiator.executeContract( tgeMain.contracts.auction, @@ -1067,14 +1083,14 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { expect( parseInt(vestingInfoAtom.info.schedules[0].end_point.amount), - ).toBeCloseTo(89394, -1); + ).toBeCloseTo(75706, -1); claimAtomLP = parseInt( vestingInfoAtom.info.schedules[0].end_point.amount, ); expect( parseInt(vestingInfoUsdc.info.schedules[0].end_point.amount), - ).toBeCloseTo(18087, -1); + ).toBeCloseTo(14197, -1); claimUsdcLP = parseInt( vestingInfoUsdc.info.schedules[0].end_point.amount, ); @@ -1165,6 +1181,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'auctionVesting', 'auctionLockdrop', 'auctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { const member = new dao.DaoMember(tgeWallets[v], daoMain); expect((await member.queryVotingPower()).power | 0).toBe(0); @@ -1214,6 +1231,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'airdropOnly', 'airdropAuctionVesting', 'auctionVesting', + 'claimVestingBeforeMigration', ]) { const member = new dao.DaoMember(tgeWallets[v], daoMain); expect((await member.queryVotingPower()).power | 0).toBe(0); @@ -1252,6 +1270,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'airdropAuctionLockdropVesting', 'auctionLockdrop', 'auctionLockdropVesting', + 'claimVestingBeforeMigration', ]) { const member = new dao.DaoMember(tgeWallets[v], daoMain); vp[v] = (await member.queryVotingPower()).power | 0; @@ -1266,7 +1285,11 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { const tvpNew = await daoMain.queryTotalVotingPower(); expect(tvpNew.power | 0).toBeGreaterThan(tvp.power | 0); // vesting participants get(increase) the voting power - for (const v of ['airdropAuctionVesting', 'auctionVesting']) { + for (const v of [ + 'airdropAuctionVesting', + 'auctionVesting', + 'claimVestingBeforeMigration', + ]) { const member = new dao.DaoMember(tgeWallets[v], daoMain); expect((await member.queryVotingPower()).power | 0).toBeGreaterThan( vp[v] | 0, @@ -1306,6 +1329,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { 'auctionLockdrop', 'auctionLockdropVesting', 'auctionVesting', + 'claimVestingBeforeMigration', ]) { const member = new dao.DaoMember(tgeWallets[v], daoMain); vp[v] = (await member.queryVotingPower()).power | 0; @@ -1401,7 +1425,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { rewardsStateAfterClaim.balanceNtrn + FEE_SIZE - rewardsStateBeforeClaim.balanceNtrn, - ).toEqual(120515); // lockdrop rewards share for the user + ).toEqual(125980); // lockdrop rewards share for the user const expectedGeneratorRewards = +( ( rewardsStateBeforeClaim.userInfo.lockup_infos.find( @@ -1475,6 +1499,26 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { let vestingLpVaultForClAddr: string; describe('Migration of pairs', () => { + it('should claim from last wallet in map', async () => { + const resAtom = await tgeWallets[ + 'claimVestingBeforeMigration' + ].executeContract( + tgeMain.contracts.vestingAtomLp, + JSON.stringify({ + claim: {}, + }), + ); + expect(resAtom.code).toEqual(0); + const resUsdc = await tgeWallets[ + 'claimVestingBeforeMigration' + ].executeContract( + tgeMain.contracts.vestingUsdcLp, + JSON.stringify({ + claim: {}, + }), + ); + expect(resUsdc.code).toEqual(0); + }); it('should unregister old pairs', async () => { { const res = await tge.executeDeregisterPair( @@ -1783,19 +1827,18 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { expect( parseInt(vestingInfoAtom.info.schedules[0].end_point.amount), - ).toBeCloseTo(89394, -1); + ).toBeCloseTo(75706, -1); claimAtomLP = parseInt( vestingInfoAtom.info.schedules[0].end_point.amount, ); expect( parseInt(vestingInfoUsdc.info.schedules[0].end_point.amount), - ).toBeCloseTo(18087, -1); + ).toBeCloseTo(14197, -1); claimUsdcLP = parseInt( vestingInfoUsdc.info.schedules[0].end_point.amount, ); }); - it('should migrate ATOM LP vesing to V2', async () => { const res = await cmInstantiator.migrateContract( tgeMain.contracts.vestingAtomLp, @@ -1866,6 +1909,13 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { }), ); expect(resAtom.code).toEqual(0); + resAtom = await cmInstantiator.executeContract( + tgeMain.contracts.vestingAtomLp, + JSON.stringify({ + migrate_liquidity: {}, + }), + ); + expect(resAtom.code).toEqual(0); await expect( cmInstantiator.executeContract( tgeMain.contracts.vestingAtomLp, @@ -2642,7 +2692,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => { rewardsStateAfterClaim.balanceNtrn + FEE_SIZE - rewardsStateBeforeClaim.balanceNtrn, - ).toBeCloseTo(120212, -3); // lockdrop rewards share for the user + ).toBeCloseTo(125978, -3); // lockdrop rewards share for the user const expectedGeneratorRewards = +( (