Skip to content

Commit

Permalink
refactor(Auciton!): make Auction use zcf.atomicRearrange()
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Sep 4, 2024
1 parent 8787ee6 commit 8f95618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions packages/inter-protocol/src/auction/auctionBook.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { M, prepareExoClassKit } from '@agoric/vat-data';

import { assertAllDefined, makeTracer } from '@agoric/internal';
import {
atomicRearrange,
ceilMultiplyBy,
makeRatioFromAmounts,
makeRecorderTopic,
Expand Down Expand Up @@ -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 }],
Expand Down Expand Up @@ -569,8 +567,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
state.startProceedsGoal = nextProceedsGoal;
}

atomicRearrange(
zcf,
zcf.atomicRearrange(
harden([[sourceSeat, collateralSeat, { Collateral: assetAmount }]]),
);

Expand Down
6 changes: 2 additions & 4 deletions packages/inter-protocol/src/auction/auctioneer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()],
Expand All @@ -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();
Expand Down

0 comments on commit 8f95618

Please sign in to comment.