Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup suggestions post-submission of 9970 #9979

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions a3p-integration/proposals/a:vaults-auctions/agd-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ export const getProvisionPoolMetrics = async () => {
return getQuoteBody(path);
};

export const getAuctionInstance = async price => {
export const getInstanceBoardId = async instanceName => {
const instanceRec = await queryVstorage(`published.agoricNames.instance`);

const value = JSON.parse(instanceRec.value);
const body = JSON.parse(value.values.at(-1));

const feeds = JSON.parse(body.body.substring(1));

const key = Object.keys(feeds).find(k => feeds[k][0] === 'auctioneer');
const key = Object.keys(feeds).find(k => feeds[k][0] === instanceName);
if (key) {
return body.slots[key];
}
Expand Down
5 changes: 1 addition & 4 deletions a3p-integration/proposals/a:vaults-auctions/eval.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# we have an eval.sh so we can run prepare.sh before the rest

echo "[$PROPOSAL] Running prepare.sh"
./prepare.sh
./saveAuctionInstance.js

echo "[$PROPOSAL] Running proposal declared in package.json"
# copy to run in the proposal package so the dependencies can be resolved
Expand Down
8 changes: 0 additions & 8 deletions a3p-integration/proposals/a:vaults-auctions/prepare.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env node

import { writeFile } from 'fs/promises';
import { getAuctionInstance } from './agd-tools.js';
import { getInstanceBoardId } from './agd-tools.js';

const { env } = process;

const oldAuctionInstance = await getAuctionInstance();
const oldAuctionInstance = await getInstanceBoardId('auctioneer');
console.log('old auction instance ', oldAuctionInstance, env.HOME);

await writeFile(
`${env.HOME}/.agoric/previousInstance.json`,
oldAuctionInstance,
);
const filePath = `${env.HOME}/.agoric/tmp/auctionPreviousInstance.json`;

await writeFile(filePath, oldAuctionInstance);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
openVault,
USER1ADDR,
} from '@agoric/synthetic-chain';
import { readFile } from 'fs/promises';
import { readFile, unlink } from 'fs/promises';

import {
bankSend,
Expand All @@ -17,7 +17,7 @@ import {
getVaultPrices,
pushPrices,
addPreexistingOracles,
getAuctionInstance,
getInstanceBoardId,
} from './agd-tools.js';
import { getDetailsMatchingVats } from './vatDetails.js';

Expand Down Expand Up @@ -108,19 +108,15 @@ const verifyVaultPriceUpdate = async t => {
};

const verifyAuctionInstance = async t => {
const newAuctionInstance = await getAuctionInstance();
const oldInstance = await readFile(
`${env.HOME}/.agoric/previousInstance.json`,
'utf-8',
);
const newAuctionInstance = await getInstanceBoardId('auctioneer');
const filePath = `${env.HOME}/.agoric/tmp/auctionPreviousInstance.json`;
const oldInstance = await readFile(filePath, 'utf-8');

console.log(
`new: ${newAuctionInstance} should be different from ${oldInstance}`,
);
t.true(
newAuctionInstance !== oldInstance,
`new: ${newAuctionInstance} should be different from ${oldInstance}`,
);
t.not(newAuctionInstance, oldInstance);
await unlink();
};

// test.serial() isn't guaranteed to run tests in order, so we run the intended tests here
Expand Down
Loading