Skip to content

Commit

Permalink
fix(reserve): add missing collaterel proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
iomekam committed Dec 16, 2024
1 parent 391d6bf commit f66de07
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"consume": {
"reserveKit": true,
"namesByAddressAdmin": true,
"agoricNames": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// @ts-nocheck
/* eslint-disable no-undef */
const PROVISIONING_POOL_ADDR = 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346';

const addCollateral = async powers => {
const {
consume: {
reserveKit: reserveKitP,
namesByAddressAdmin: namesByAddressAdminP,
agoricNames,
},
} = powers;

const namesByAddressAdmin = await namesByAddressAdminP;

const getDepositFacet = async address => {
const hub = E(E(namesByAddressAdmin).lookupAdmin(address)).readonly();
return E(hub).lookup('depositFacet');
};

const [reserveKit] = await Promise.all([reserveKitP]);

const { adminFacet, instance } = reserveKit;

let usdLemonsMint;
for (const { publicFacet, creatorFacet: mint } of contractKits.values()) {
if (publicFacet === usdLemonsIssuer) {
usdLemonsMint = mint;
console.log('BINGO', mint);
break;
}
}

console.log('Minting USD_LEMONS');
const helloPayment = await E(usdLemonsMint).mintPayment(
harden({ brand: usdLemonsBrand, value: 500000n }),
);

console.log('Funding provision pool...');
await E(ppDepositFacet).receive(helloPayment);

console.log('Done.');
};

addCollateral;

0 comments on commit f66de07

Please sign in to comment.