Skip to content

Commit 3ed8e69

Browse files
committed
feat(treasury): assert getBootstrapPayment amount
1 parent dd4fbc1 commit 3ed8e69

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/treasury/src/stablecoinMachine.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,27 @@ export async function start(zcf, privateArgs) {
313313
zcfSeat: bootstrapZCFSeat,
314314
userSeat: bootstrapUserSeat,
315315
} = zcf.makeEmptySeatKit();
316+
const bootstrapAmount = AmountMath.make(runBrand, bootstrapPaymentValue);
316317
runMint.mintGains(
317318
{
318-
Bootstrap: AmountMath.make(runBrand, bootstrapPaymentValue),
319+
Bootstrap: bootstrapAmount,
319320
},
320321
bootstrapZCFSeat,
321322
);
322323
bootstrapZCFSeat.exit();
323324
const bootstrapPayment = E(bootstrapUserSeat).getPayout('Bootstrap');
324325

325-
function getBootstrapPayment() {
326+
/**
327+
* @param {Amount=} expectedAmount - if provided, assert that the bootstrap
328+
* payment is at least the expected amount
329+
*/
330+
function getBootstrapPayment(expectedAmount) {
331+
if (expectedAmount) {
332+
assert(
333+
AmountMath.isGTE(bootstrapAmount, expectedAmount),
334+
details`${bootstrapAmount} is not at least ${expectedAmount}`,
335+
);
336+
}
326337
return bootstrapPayment;
327338
}
328339
return getBootstrapPayment;

0 commit comments

Comments
 (0)