Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Aug 11, 2023
1 parent 70a54af commit 5d03f39
Showing 1 changed file with 70 additions and 3 deletions.
73 changes: 70 additions & 3 deletions src/testcases/run_in_band/tge.auction_migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
executeGeneratorSetupPools,
getTimestamp,
queryAvialableAmount,
queryUnclaimmedAmountAtHeight,
queryFactoryPairs,
queryNtrnCLBalanceAtHeight,
queryTotalUnclaimedAmountAtHeight,
queryUnclaimmedAmountAtHeight,
Tge,
queryNtrnCLBalanceAtHeight,
} from '../../helpers/tge';
import { Dao, DaoMember, getDaoContracts } from '../../helpers/dao';
import Long from 'long';
Expand Down Expand Up @@ -1466,6 +1466,7 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
});
describe('Migration to V2', () => {
let heightDiff;
const votingPowerBeforeLockdrop: Record<string, number> = {};

describe('Migration of pairs', () => {
it('should unregister old pairs', async () => {
Expand Down Expand Up @@ -1601,7 +1602,8 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
let claimAtomLP;
let claimUsdcLP;
const votingPowerBeforeLp: Record<string, number> = {};
const votingPowerBeforeLockdrop: Record<string, number> = {};
let totalUnclaimedAtHeightBeforeMigration: number;
let unclaimedHeightBeforeMigration: number;

it('should save voting power before migration: lp', async () => {
for (const v of [
Expand Down Expand Up @@ -1636,6 +1638,14 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
});

it('should validate numbers & save claim amount before migration', async () => {
unclaimedHeightBeforeMigration = await getHeight(neutronChain.sdk);
totalUnclaimedAtHeightBeforeMigration =
await queryTotalUnclaimedAmountAtHeight(
cmInstantiator.chain,
tge.contracts.vestingAtomLp,
unclaimedHeightBeforeMigration,
);

const [
vestingInfoAtom,
vestingInfoUsdc,
Expand Down Expand Up @@ -1869,6 +1879,16 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
});

it('check queries', async () => {
const totalUnclaimedAmountAfterMigration =
await queryTotalUnclaimedAmountAtHeight(
cmInstantiator.chain,
tge.contracts.vestingAtomLp,
unclaimedHeightBeforeMigration,
);
expect(totalUnclaimedAmountAfterMigration).toEqual(
totalUnclaimedAtHeightBeforeMigration,
);

const total = await queryTotalUnclaimedAmountAtHeight(
cmInstantiator.chain,
tge.contracts.vestingAtomLp,
Expand Down Expand Up @@ -1946,6 +1966,22 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
});

describe('Migration lockdrop to V2', () => {
let userLockUpAtHeightBeforeMigration: number;
let height: number;
it('should save user lock up at height before migration', async () => {
height = await getHeight(neutronChain.sdk);
userLockUpAtHeightBeforeMigration =
await cmInstantiator.chain.queryContract<number>(
tge.contracts.lockdrop,
{
query_user_lockup_total_at_height: {
pool_type: 'ATOM',
user_address: cmInstantiator.wallet.address,
height: height,
},
},
);
});
it('should migrate lockdrop to V2', async () => {
const res = await cmInstantiator.migrateContract(
tge.contracts.lockdrop,
Expand Down Expand Up @@ -2122,6 +2158,37 @@ describe('Neutron / TGE / Auction / Lockdrop migration', () => {
);
expect(res).toEqual('0');
});
it('should check user lock up at height before migration and after at the same height', async () => {
const userLockUpAtHeightAfterMigration =
await cmInstantiator.chain.queryContract<number>(
tge.contracts.lockdrop,
{
query_user_lockup_total_at_height: {
pool_type: 'ATOM',
user_address: cmInstantiator.wallet.address,
height: height,
},
},
);
expect(userLockUpAtHeightAfterMigration).toEqual(
userLockUpAtHeightBeforeMigration,
);
});
it('should compare voting power after migration: lockdrop', async () => {
for (const v of [
'airdropAuctionVesting',
'airdropAuctionLockdrop',
'airdropAuctionLockdropVesting',
'auctionLockdrop',
'auctionLockdropVesting',
'auctionVesting',
]) {
const vp = await tge.lockdropVotingPower(
tgeWallets[v].wallet.address.toString(),
);
expect(+vp.power).toBeCloseTo(votingPowerBeforeLockdrop[v], -3);
}
});
it('should have non-zero liquidity on CL pools', async () => {
const usdcBalance = await neutronChain.queryContract<BalanceResponse>(
tge.pairs.usdc_ntrn.liquidity,
Expand Down

0 comments on commit 5d03f39

Please sign in to comment.