Skip to content

Commit

Permalink
fix: replace getOrMake with provide
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jun 27, 2022
1 parent a832ef8 commit 767e937
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions packages/run-protocol/src/runStake/attestation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -21,20 +21,6 @@ const { details: X } = assert;
* }} LienMint
*/

/**
* Find-or-create value in store.
*
* @type {<K, V>(store: Store<K, V>, 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
Expand Down Expand Up @@ -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),
);
},
Expand Down

0 comments on commit 767e937

Please sign in to comment.