From 3f66cbd1f0c3f5220dd340cd59314645df6f57ba Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sun, 17 Nov 2024 17:52:07 -0800 Subject: [PATCH] fixup! aha, stuck at burn --- .../src/mock-orch-ertp/mock-ertp/mock-ertp.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/src/mock-orch-ertp/mock-ertp/mock-ertp.js b/packages/orchestration/src/mock-orch-ertp/mock-ertp/mock-ertp.js index 551cc3fdeff..9123470945a 100644 --- a/packages/orchestration/src/mock-orch-ertp/mock-ertp/mock-ertp.js +++ b/packages/orchestration/src/mock-orch-ertp/mock-ertp/mock-ertp.js @@ -1,4 +1,5 @@ import { Fail } from '@endo/errors'; +import { mustMatch } from '@endo/patterns'; import { AmountMath, BrandI, PaymentShape } from '@agoric/ertp'; import { AnyNatAmountShape } from '../../typeGuards.js'; @@ -250,8 +251,16 @@ export const prepareMockIssuerKit = zone => { getAmountOf(payment) { return this.state.paymentLedger.get(payment); }, - burn(_payment, _optAmountShape = undefined) { - // TODO + burn(payment, optAmountShape = undefined) { + const { paymentLedger, paymentRecoverySets } = this.state; + + const amount = paymentLedger.get(payment); + if (optAmountShape !== undefined) { + mustMatch(amount, optAmountShape); + } + deletePayment(paymentLedger, paymentRecoverySets, payment); + // TODO Aha! Must update the encumberedBalance of the source purse, + // if any! Must decrement it by amount. }, }, mint: { @@ -259,7 +268,7 @@ export const prepareMockIssuerKit = zone => { return this.facets.issuer; }, mintPayment(newAmount) { - // The mock implementation has no mintRecoveryPurse, or any reccovery + // The mock implementation has no mintRecoveryPurse, or any recovery // set associated with minted payments. const { paymentLedger, paymentRecoverySets } = this.state; return makeInitPayment(