Skip to content

Commit

Permalink
test: add test during upgradeVaults; vaults detect new prices
Browse files Browse the repository at this point in the history
This test fails, and will be fixed in the subsequent commit
  • Loading branch information
Chris-Hibbert authored and mhofman committed Jun 26, 2024
1 parent 23e1921 commit bce49e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions a3p-integration/proposals/a:upgrade-next/agd-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ export const getAuctionCollateral = async index => {
return body.collateralAvailable.value;
};

export const getVaultPrices = async index => {
const path = `published.vaultFactory.managers.manager${index}.quotes`;
const body = await getQuoteBody(path);
return body.quoteAmount;
};

export const bankSend = (addr, wanted) => {
const chain = ['--chain-id', CHAINID];
const from = ['--from', VALIDATORADDR];
Expand Down
13 changes: 13 additions & 0 deletions a3p-integration/proposals/a:upgrade-next/upgradeVaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
generateOracleMap,
getLiveOffers,
getPriceQuote,
getVaultPrices,
pushPrices,
} from './agd-tools.js';
import { getDetailsMatchingVats } from './vatDetails.js';
Expand Down Expand Up @@ -95,6 +96,15 @@ const checkAuctionVat = async t => {
t.true(Object.keys(details).length > 2);
};

const verifyVaultPriceUpdate = async t => {
const quote = await getVaultPrices(0);

t.true(quote.value[0].amountIn.brand.includes(' ATOM '));

// FAIL, should be +5200000
t.is(quote.value[0].amountOut.value, '12010000');
};

// test.serial() isn't guaranteed to run tests in order, so we run the intended tests here
test('liquidation post upgrade', async t => {
t.log('starting upgrade vaults test');
Expand All @@ -114,4 +124,7 @@ test('liquidation post upgrade', async t => {

t.log('make new auction');
await checkAuctionVat(t);

t.log('vault price updated');
await verifyVaultPriceUpdate(t);
});

0 comments on commit bce49e3

Please sign in to comment.