Skip to content

Commit

Permalink
refactor: use named fields in atomicRearrange
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Feb 14, 2024
1 parent d6696da commit f9f0fbc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions contract/src/offer-up.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Far } from '@endo/far';
import { M, getCopyBagEntries } from '@endo/patterns';
import { AssetKind } from '@agoric/ertp/src/amountMath.js';
import { AmountShape } from '@agoric/ertp/src/typeGuards.js';
import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js';
import { atomicRearrange } from './platform-goals/zcfTools.js';
import '@agoric/zoe/exported.js';

const { Fail, quote: q } = assert;
Expand Down Expand Up @@ -107,15 +107,11 @@ export const start = async zcf => {
Fail`max ${q(maxItems)} items allowed: ${q(want.Items)}`;

const newItems = itemMint.mintGains(want);
atomicRearrange(
zcf,
harden([
// price from buyer to proceeds
[buyerSeat, proceeds, { Price: tradePrice }],
// new items to buyer
[newItems, buyerSeat, want],
]),
);
const charge = { Price: tradePrice };
atomicRearrange(zcf, [
{ fromSeat: buyerSeat, toSeat: proceeds, fromAmounts: charge },
{ fromSeat: newItems, toSeat: buyerSeat, fromAmounts: want },
]);

buyerSeat.exit(true);
newItems.exit();
Expand Down

0 comments on commit f9f0fbc

Please sign in to comment.