Skip to content

Commit

Permalink
feat(agops): feedback on missing oracle admin ids
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Aug 28, 2024
1 parent a3c30d1 commit 1fcf43c
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions packages/agoric-cli/src/commands/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const COSMOS_UNIT = 1_000_000n;
const scaleDecimals = num => BigInt(num * Number(COSMOS_UNIT));

/**
* Prints JSON output to stdout and diagnostic info (like logs) to stderr
*
* @param {import('anylogger').Logger} logger
* @param {{
* delay?: (ms: number) => Promise<void>,
Expand Down Expand Up @@ -327,17 +329,30 @@ export const makeOracleCommand = (logger, io = {}) => {
}

const instance = lookupPriceAggregatorInstance(pair);

console.error('pushPrice from each:', keyOrder);
const adminOfferIds = {};
for await (const from of keyOrder) {
const oracleAdminAcceptOfferId = await findOracleCap(
adminOfferIds[from] = await findOracleCap(
instance,
from,
readLatestHead,
);
if (!oracleAdminAcceptOfferId) {
throw Error(`no oracle invitation found: ${from}`);
if (!adminOfferIds[from]) {
console.error(
`Failed to find an offer accepting oracle invitation for ${from}. Accept and try again:`,
);
console.error(
` agops oracle accept > accept.json; agoric wallet send --from ${from} --offer accept.json`,
);
}
}
assert(
Object.values(adminOfferIds).every(x => x),
'Missing oracle admin offer ids',
);

console.error('pushPrice from each:', keyOrder);
for await (const from of keyOrder) {
const oracleAdminAcceptOfferId = adminOfferIds[from];
show({ from, oracleAdminAcceptOfferId });
const offerId = `pushPrice-${Date.now()}`;
const offer = Offers.fluxAggregator.PushPrice(
Expand Down

0 comments on commit 1fcf43c

Please sign in to comment.