From ef42d2015298de66f9e534de58748ab45ad768f4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 12 Dec 2023 14:59:25 -0800 Subject: [PATCH] feat(guard): tighten roundsManager --- .../inter-protocol/src/price/roundsManager.js | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/inter-protocol/src/price/roundsManager.js b/packages/inter-protocol/src/price/roundsManager.js index 8d80b8017ef..32e58536b3b 100644 --- a/packages/inter-protocol/src/price/roundsManager.js +++ b/packages/inter-protocol/src/price/roundsManager.js @@ -1,7 +1,7 @@ import { Fail, q } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; -import { TimeMath } from '@agoric/time'; +import { TimeMath, TimestampShape } from '@agoric/time'; import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data'; import { calculateMedian, @@ -98,21 +98,25 @@ export const prepareRoundsManagerKit = baggage => 'RoundsManager', { helper: UnguardedHelperI, - contract: M.interface( - 'contract', - { - authenticateQuote: M.call().rest(M.any()).returns(M.any()), - makeCreateQuote: M.call().rest(M.any()).returns(M.any()), - eligibleForSpecificRound: M.call().rest(M.any()).returns(M.boolean()), - getRoundData: M.call().rest(M.any()).returns(M.promise()), - getRoundStatus: M.call().rest(M.any()).returns(M.record()), - oracleRoundStateSuggestRound: M.call() - .rest(M.any()) - .returns(M.record()), - }, - // TODO(6571) stop sloppy - { sloppy: true }, - ), + contract: M.interface('contract', { + authenticateQuote: M.call([M.record()]).returns(M.any()), + makeCreateQuote: M.call() + .optional({ + overrideValueOut: M.number(), + timestamp: TimestampShape, + }) + .returns(M.any()), + eligibleForSpecificRound: M.call( + M.any(), + M.bigint(), + TimestampShape, + ).returns(M.boolean()), + getRoundData: M.call(M.any()).returns(M.promise()), + getRoundStatus: M.call(M.bigint()).returns(M.record()), + oracleRoundStateSuggestRound: M.call(M.any(), TimestampShape).returns( + M.record(), + ), + }), oracle: M.interface('oracle', { handlePush: M.call(M.record(), M.record()).returns(M.promise()), }),