From 50c9fe49d0fe890a08c0c28a00780f4924f7928c Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 17 Apr 2023 23:07:15 -0700 Subject: [PATCH] fix: some stateShapes --- .../inter-protocol/src/auction/auctionBook.js | 20 +++++++++++++++++++ .../inter-protocol/src/auction/offerBook.js | 18 +++++++++++++++++ .../inter-protocol/src/vaultFactory/vault.js | 14 +++++++++++++ packages/notifier/src/publish-kit.js | 11 ++++++++++ packages/zoe/src/contractFacet/exit.js | 5 +++++ packages/zoe/src/zoeService/startInstance.js | 10 ++++++++++ 6 files changed, 78 insertions(+) diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index 7b9f4726692..f1eed9cfdb8 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -114,6 +114,25 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => { const makeScaledBidBook = prepareScaledBidBook(baggage); const makePriceBook = preparePriceBook(baggage); + const AuctionBookStateShape = harden({ + collateralBrand: M.any(), + collateralSeat: M.any(), + collateralAmountShape: M.any(), + currencyBrand: M.any(), + currencySeat: M.any(), + currencyAmountShape: M.any(), + priceAuthority: M.any(), + updatingOracleQuote: M.any(), + bookDataKit: M.any(), + priceBook: M.any(), + scaledBidBook: M.any(), + startCollateral: M.any(), + startProceedsGoal: M.any(), + lockedPriceForRound: M.any(), + curAuctionPrice: M.any(), + remainingProceedsGoal: M.any(), + }); + const makeAuctionBookKit = prepareExoClassKit( baggage, 'AuctionBook', @@ -732,6 +751,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => { }, ); }, + stateShape: AuctionBookStateShape, }, ); diff --git a/packages/inter-protocol/src/auction/offerBook.js b/packages/inter-protocol/src/auction/offerBook.js index efec916c9fb..5504480a509 100644 --- a/packages/inter-protocol/src/auction/offerBook.js +++ b/packages/inter-protocol/src/auction/offerBook.js @@ -33,6 +33,12 @@ const nextSequenceNumber = () => { * } BidderRecord */ +const ScaledBidBookStateShape = harden({ + bidScalingPattern: M.any(), + collateralBrand: M.any(), + records: M.any(), +}); + /** * Prices in this book are expressed as percentage of the full oracle price * snapshot taken when the auction started. .4 is 60% off. 1.1 is 10% above par. @@ -116,8 +122,17 @@ export const prepareScaledBidBook = baggage => } }, }, + { + stateShape: ScaledBidBookStateShape, + }, ); +const PriceBookStateShape = harden({ + priceRatioPattern: M.any(), + collateralBrand: M.any(), + records: M.any(), +}); + /** * Prices in this book are actual prices expressed in terms of currency amount * and collateral amount. @@ -200,4 +215,7 @@ export const preparePriceBook = baggage => } }, }, + { + stateShape: PriceBookStateShape, + }, ); diff --git a/packages/inter-protocol/src/vaultFactory/vault.js b/packages/inter-protocol/src/vaultFactory/vault.js index bc49c9898db..710cada5214 100644 --- a/packages/inter-protocol/src/vaultFactory/vault.js +++ b/packages/inter-protocol/src/vaultFactory/vault.js @@ -174,6 +174,17 @@ export const VaultI = M.interface('Vault', { abortLiquidation: M.call().returns(M.string()), }); +const VaultStateShape = harden({ + idInManager: M.any(), + manager: M.any(), + outerUpdater: M.any(), + phase: M.any(), + storageNode: M.any(), + vaultSeat: M.any(), + interestSnapshot: M.any(), + debtSnapshot: M.any(), +}); + /** * @param {import('@agoric/ertp').Baggage} baggage * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit @@ -944,6 +955,9 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => { }, }, }, + { + stateShape: VaultStateShape, + }, ); return maker; }; diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js index d4ef7109292..d99afb8b8e0 100644 --- a/packages/notifier/src/publish-kit.js +++ b/packages/notifier/src/publish-kit.js @@ -173,6 +173,14 @@ export const makePublishKit = () => { }; harden(makePublishKit); +const DurablePublishKitStateShape = harden({ + valueDurability: M.any(), + publishCount: M.any(), + status: M.any(), + hasValue: M.any(), + value: M.any(), +}); + // TODO: Move durable publish kit to a new file? /** @@ -416,6 +424,9 @@ export const prepareDurablePublishKit = (baggage, kindName) => { }, }, }, + { + stateShape: DurablePublishKitStateShape, + }, ); }; harden(prepareDurablePublishKit); diff --git a/packages/zoe/src/contractFacet/exit.js b/packages/zoe/src/contractFacet/exit.js index ea064f55cbb..bbbcc835d76 100644 --- a/packages/zoe/src/contractFacet/exit.js +++ b/packages/zoe/src/contractFacet/exit.js @@ -36,6 +36,11 @@ export const makeMakeExiter = baggage => { state.zcfSeat.exit(); }, }, + { + stateShape: harden({ + zcfSeat: M.any(), + }), + }, ); const makeWaived = prepareExoClass( baggage, diff --git a/packages/zoe/src/zoeService/startInstance.js b/packages/zoe/src/zoeService/startInstance.js index 15b55244854..6442cb46467 100644 --- a/packages/zoe/src/zoeService/startInstance.js +++ b/packages/zoe/src/zoeService/startInstance.js @@ -43,6 +43,13 @@ export const makeStartInstance = ( seatHandleToZoeSeatAdmin, ); + const InstanceAdminStateShape = harden({ + instanceStorage: M.any(), + instanceAdmin: M.any(), + seatHandleToSeatAdmin: M.any(), + adminNode: M.any(), + }); + const makeZoeInstanceAdmin = prepareExoClass( zoeBaggage, 'zoeInstanceAdmin', @@ -147,6 +154,9 @@ export const makeStartInstance = ( return state.instanceAdmin.isBlocked(string); }, }, + { + stateShape: InstanceAdminStateShape, + }, ); const prepareEmptyFacet = facetName =>