Skip to content

Commit

Permalink
Merge pull request Agoric#188 from Agoric/ta/get-round-id
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg authored Oct 31, 2024
2 parents c9644d6 + 39b9fcf commit d55bfe0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/synthetic-chain/src/lib/econHelpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { executeOffer, waitForBlock } from './commonUpgradeHelpers.js';
import { ATOM_DENOM, CHAINID, VALIDATORADDR } from './constants.js';
import { agd, agops, executeCommand, agopsLocation } from './cliHelper.js';
import {
agd,
agops,
executeCommand,
agopsLocation,
agoric as agoricAmbient,
} from './cliHelper.js';
import { GOV1ADDR, GOV2ADDR, GOV3ADDR } from './constants.js';
import { queryVstorage, getQuoteBody, getInstanceBoardId } from './vstorage.js';

Expand Down Expand Up @@ -198,6 +204,16 @@ export const pushPrices = async (price, brandIn, oraclesByBrand, round) => {
}
};

export const getRoundId = async (price, io = {}) => {
const {
agoric = { follow: agoricAmbient.follow },
prefix = 'published.',
} = io;
const path = `:${prefix}priceFeed.${price}-USD_price_feed.latestRound`;
const round = await agoric.follow('-lF', path);
return parseInt(round.roundId);
};

export const getPriceQuote = async price => {
const path = `published.priceFeed.${price}-USD_price_feed`;
const body = await getQuoteBody(path);
Expand Down
1 change: 1 addition & 0 deletions packages/synthetic-chain/test/snapshots/test-exports.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Generated by [AVA](https://avajs.dev).
getPriceQuote: AsyncFunction {},
getProvisionPoolMetrics: AsyncFunction [],
getQuoteBody: AsyncFunction {},
getRoundId: AsyncFunction {},
getUser: AsyncFunction {},
getVatDetails: AsyncFunction {},
getVaultPrices: AsyncFunction {},
Expand Down
Binary file modified packages/synthetic-chain/test/snapshots/test-exports.ts.snap
Binary file not shown.

0 comments on commit d55bfe0

Please sign in to comment.