-
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(acceptance): add proposal for reserve null upgrade
- Loading branch information
1 parent
6112a8b
commit 463557a
Showing
4 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
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
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
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,24 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async ({ publishRef, install }) => | ||
harden({ | ||
sourceSpec: '@agoric/vats/src/proposals/upgrade-reserve-proposal.js', | ||
getManifestCall: [ | ||
'getManifestForReserveUpgrade', | ||
{ | ||
contractRef: publishRef( | ||
install( | ||
'@agoric/inter-protocol/src/reserve/assetReserve.js', | ||
'../../inter-protocol/bundles/bundle-reserve.js', | ||
), | ||
), | ||
}, | ||
], | ||
}); | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ | ||
export default async (homeP, endowments) => { | ||
const { writeCoreEval } = await makeHelpers(homeP, endowments); | ||
await writeCoreEval('upgrade-reserve', defaultProposalBuilder); | ||
}; |
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,60 @@ | ||
import { E } from '@endo/far'; | ||
import { makeTracer } from '@agoric/internal/src/index.js'; | ||
|
||
const trace = makeTracer('upgrade Vaults proposal'); | ||
|
||
export const upgradeReserve = async (powers, options) => { | ||
trace('Initiate Reserve contract upgrade'); | ||
|
||
const { | ||
consume: { | ||
reserveKit, | ||
economicCommitteeCreatorFacet, | ||
feeMintAccess: feeMintAccessP, | ||
instancePrivateArgs: instancePrivateArgsP, | ||
}, | ||
} = powers; | ||
|
||
const { | ||
options: { contractRef }, | ||
} = options; | ||
|
||
const { adminFacet, instance } = await reserveKit; | ||
|
||
const instancePrivateArgs = await instancePrivateArgsP; | ||
const privateArgs = instancePrivateArgs.get(instance); | ||
|
||
const feeMintAccess = await feeMintAccessP; | ||
|
||
const initialPoserInvitation = await E( | ||
economicCommitteeCreatorFacet, | ||
).getPoserInvitation(); | ||
|
||
const newPrivateArgs = harden({ | ||
...privateArgs, | ||
feeMintAccess, | ||
initialPoserInvitation, | ||
}); | ||
|
||
await E(adminFacet).upgradeContract(contractRef.bundleID, newPrivateArgs); | ||
|
||
trace('Reserve contract upgraded!'); | ||
}; | ||
|
||
export const getManifestForReserveUpgrade = ( | ||
{ restoreRef }, | ||
{ contractRef }, | ||
) => ({ | ||
manifest: { | ||
[upgradeReserve.name]: { | ||
consume: { | ||
reserveKit: true, | ||
instancePrivateArgs: true, | ||
feeMintAccess: true, | ||
economicCommitteeCreatorFacet: true, | ||
}, | ||
}, | ||
}, | ||
installations: { reserve: restoreRef(contractRef) }, | ||
options: { contractRef }, | ||
}); |