From 8f95618fca35dd32c6e42bfa7408c3898e2edd11 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Thu, 8 Jun 2023 16:26:11 -0700 Subject: [PATCH] refactor(Auciton!): make Auction use zcf.atomicRearrange() --- packages/inter-protocol/src/auction/auctionBook.js | 7 ++----- packages/inter-protocol/src/auction/auctioneer.js | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index df65ba02847..d5536768e8a 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -10,7 +10,6 @@ import { M, prepareExoClassKit } from '@agoric/vat-data'; import { assertAllDefined, makeTracer } from '@agoric/internal'; import { - atomicRearrange, ceilMultiplyBy, makeRatioFromAmounts, makeRecorderTopic, @@ -311,8 +310,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => { seat.exit('unable to satisfy want'); } - atomicRearrange( - zcf, + zcf.atomicRearrange( harden([ [collateralSeat, seat, { Collateral: collateralTarget }], [seat, bidHoldingSeat, { Bid: proceedsTarget }], @@ -569,8 +567,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => { state.startProceedsGoal = nextProceedsGoal; } - atomicRearrange( - zcf, + zcf.atomicRearrange( harden([[sourceSeat, collateralSeat, { Collateral: assetAmount }]]), ); diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index 3b475137f5c..1eed4c9d48a 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -12,7 +12,6 @@ import { mustMatch } from '@agoric/store'; import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js'; import { M, provideDurableMapStore } from '@agoric/vat-data'; import { - atomicRearrange, ceilDivideBy, ceilMultiplyBy, defineERecorderKit, @@ -490,8 +489,7 @@ export const start = async (zcf, privateArgs, baggage) => { // send it all to the one const liqSeat = depositsForBrand[0].seat; - atomicRearrange( - zcf, + zcf.atomicRearrange( harden([ [collateralSeat, liqSeat, collateralSeat.getCurrentAllocation()], [bidHoldingSeat, liqSeat, bidHoldingSeat.getCurrentAllocation()], @@ -514,7 +512,7 @@ export const start = async (zcf, privateArgs, baggage) => { reserveSeat, brand, ); - atomicRearrange(zcf, harden(transfers)); + zcf.atomicRearrange(harden(transfers)); for (const { seat } of depositsForBrand) { seat.exit();