-
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.
chore(pp-upgrade): create helper core-evals
Refs: #10395
- Loading branch information
1 parent
28cada0
commit 1b6fd5d
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
a3p-integration/proposals/p:upgrade-19/depositUSD-LEMONS/deposit-usd-lemons-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,8 @@ | ||
{ | ||
"consume": { | ||
"contractKits": true, | ||
"namesByAddressAdmin": true, | ||
"agoricNames": true | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
a3p-integration/proposals/p:upgrade-19/depositUSD-LEMONS/deposit-usd-lemons.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,49 @@ | ||
const PROVISIONING_POOL_ADDR = 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346'; | ||
|
||
const depositUsdLemons = async powers => { | ||
const { | ||
consume: { contractKits: contractKitsP, namesByAddressAdmin: namesByAddressAdminP , agoricNames }, | ||
// instance: { consume: { ['psm-IST-USD_LEMONS']: usdLemonsPsmInstanceP }} | ||
} = powers; | ||
|
||
const namesByAddressAdmin = await namesByAddressAdminP; | ||
|
||
const getDepositFacet = async address => { | ||
const admin = await E(namesByAddressAdmin).lookupAdmin(address); | ||
console.log('ADMIN', admin) | ||
|
||
const nameHub = await E(admin).readonly(); | ||
console.log('NAME_HUB', nameHub); | ||
const hub = E(E(namesByAddressAdmin).lookupAdmin(address)).readonly(); | ||
return E(hub).lookup('depositFacet'); | ||
}; | ||
|
||
const [contractKits, usdLemonsIssuer, usdLemonsBrand, ppDepositFacet] = await Promise.all([ | ||
contractKitsP, | ||
E(agoricNames).lookup('issuer', 'USD_LEMONS'), | ||
E(agoricNames).lookup('brand', 'USD_LEMONS'), | ||
getDepositFacet(PROVISIONING_POOL_ADDR), | ||
]); | ||
|
||
console.log('[CONTRACT_KITS]', contractKits); | ||
console.log('[ISSUER]', usdLemonsIssuer); | ||
|
||
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.'); | ||
}; | ||
|
||
depositUsdLemons; |
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,19 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
import { psmProposalBuilder } from '../inter-protocol/add-collateral-core.js'; | ||
|
||
const addUsdLemonsProposalBuilder = async powers => { | ||
return psmProposalBuilder(powers, { | ||
anchorOptions: { | ||
denom: 'ibc/000C0AAAEECAFE000', | ||
keyword: 'USD_LEMONS', | ||
decimalPlaces: 6, | ||
proposedName: 'USD_LEMONS', | ||
} | ||
}); | ||
}; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ | ||
export default async (homeP, endowments) => { | ||
const { writeCoreEval } = await makeHelpers(homeP, endowments); | ||
await writeCoreEval('add-LEMONS-PSM', addUsdLemonsProposalBuilder); | ||
}; |