-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(reserve): add missing collaterel proposal
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
a3p-integration/proposals/p:upgrade-19/addCollateral/add-collateral-permit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"consume": { | ||
"reserveKit": true, | ||
"namesByAddressAdmin": true, | ||
"agoricNames": true | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
a3p-integration/proposals/p:upgrade-19/addCollateral/add-collateral.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |