From 767e9371ffc53a40e9c7474b44897a8ed6fda0d3 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 22 Jun 2022 13:12:34 -0700 Subject: [PATCH] fix: replace getOrMake with provide --- .../run-protocol/src/runStake/attestation.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/run-protocol/src/runStake/attestation.js b/packages/run-protocol/src/runStake/attestation.js index 9bf6e2ed9e61..072a9ffcd1b1 100644 --- a/packages/run-protocol/src/runStake/attestation.js +++ b/packages/run-protocol/src/runStake/attestation.js @@ -3,7 +3,7 @@ import { AmountMath, AssetKind } from '@agoric/ertp'; import { E, Far } from '@endo/far'; -import { fit, M, makeCopyBag, makeStore } from '@agoric/store'; +import { fit, M, makeCopyBag, makeStore, provide } from '@agoric/store'; import { assertProposalShape } from '@agoric/zoe/src/contractSupport/index.js'; import { AttKW as KW } from './constants.js'; import { makeAttestationTool } from './attestationTool.js'; @@ -21,20 +21,6 @@ const { details: X } = assert; * }} LienMint */ -/** - * Find-or-create value in store. - * - * @type {(store: Store, key: K, thunk: () => V) => V} - */ -const getOrElse = (store, key, make) => { - if (store.has(key)) { - return store.get(key); - } - const value = make(); - store.init(key, value); - return value; -}; - /** * To support `makeAttestation`, we directly mint attestation payments. * We still use a ZCFMint because returning attestations is done @@ -263,7 +249,7 @@ export const makeAttestationFacets = async (zcf, stakeBrand, lienBridge) => { */ provideAttestationTool: address => { assert.typeof(address, 'string'); - return getOrElse(attMakerByAddress, address, () => + return provide(attMakerByAddress, address, () => makeAttestationTool(address, lienMint, stakeBrand, zcf), ); },