Skip to content

Commit

Permalink
fix(loadgen): Handle changes to Treasury from PR 4209
Browse files Browse the repository at this point in the history
The name of the Treasury changed to VaultFactory in Agoric/agoric-sdk#4209.
Pick whichever is available for backwards compatibility
  • Loading branch information
mhofman committed Jan 8, 2022
1 parent 7d8ef17 commit 01bf114
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions loadgen/contract/agent-create-vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@ export default async function startAgent([key, home]) {
runPurse,
bldPurse,
treasuryInstance,
vaultFactoryInstance,
} = await allValues({
runBrand: E(agoricNames).lookup('brand', issuerPetnames.RUN),
// bldBrand: E(agoricNames).lookup('brand', issuerPetnames.BLD),
bldBrand: E(E(wallet).getIssuer(issuerPetnames.BLD)).getBrand(),
runPurse: E(wallet).getPurse(pursePetnames.RUN),
bldPurse: E(wallet).getPurse(pursePetnames.BLD),
treasuryInstance: E(home.agoricNames).lookup('instance', 'Treasury'),
treasuryInstance: E(agoricNames)
.lookup('instance', 'Treasury')
.catch(() => {}),
vaultFactoryInstance: E(agoricNames)
.lookup('instance', 'VaultFactory')
.catch(() => {}),
});

const treasuryPublicFacet = E(zoe).getPublicFacet(treasuryInstance);
const treasuryPublicFacet = E(zoe).getPublicFacet(
vaultFactoryInstance || treasuryInstance,
);

const bldBalance = await E(bldPurse).getCurrentAmount();
if (AmountMath.isEmpty(bldBalance)) {
Expand Down

0 comments on commit 01bf114

Please sign in to comment.