-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,199 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
proposals/78:upgrade-17/add-LEMONS/add-STARS-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,41 @@ | ||
{ | ||
"consume": { | ||
"bankManager": true, | ||
"agoricNamesAdmin": "makeCoreProposalBehavior", | ||
"reserveKit": true, | ||
"startUpgradable": true, | ||
"priceAuthorityAdmin": true, | ||
"priceAuthority": true, | ||
"auctioneerKit": "auctioneer", | ||
"vaultFactoryKit": "vaultFactory", | ||
"chainTimerService": true, | ||
"vatAdminSvc": "makeCoreProposalBehavior", | ||
"zoe": "makeCoreProposalBehavior" | ||
}, | ||
"produce": { | ||
"bankMints": true, | ||
"vBankKits": true | ||
}, | ||
"installation": { | ||
"consume": { | ||
"mintHolder": true, | ||
"scaledPriceAuthority": true | ||
}, | ||
"produce": "makeCoreProposalBehavior" | ||
}, | ||
"instance": { | ||
"produce": true, | ||
"consume": true | ||
}, | ||
"brand": { | ||
"consume": { | ||
"IST": true | ||
} | ||
}, | ||
"evaluateBundleCap": "makeCoreProposalBehavior", | ||
"modules": { | ||
"utils": { | ||
"runModuleBehaviors": "makeCoreProposalBehavior" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
proposals/78:upgrade-17/add-LEMONS/add-STARS-collateral-plan.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,17 @@ | ||
{ | ||
"name": "add-STARS-collateral", | ||
"script": "add-STARS-collateral.js", | ||
"permit": "add-STARS-collateral-permit.json", | ||
"bundles": [ | ||
{ | ||
"entrypoint": "@agoric/zoe/src/contracts/scaledPriceAuthority.js", | ||
"bundleID": "b1-4cb589493c17312abe99eea9d38508b76dad397bf7f3dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d", | ||
"fileName": "/home/rgibson/.agoric/cache/b1-4cb589493c17312abe99eea9d38508b76dad397bf7f3dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d.json" | ||
}, | ||
{ | ||
"entrypoint": "@agoric/inter-protocol/src/proposals/addAssetToVault.js", | ||
"bundleID": "b1-e603f280063f3adbe74f32fc54218d9ed490171fc29a31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd", | ||
"fileName": "/home/rgibson/.agoric/cache/b1-e603f280063f3adbe74f32fc54218d9ed490171fc29a31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd.json" | ||
} | ||
] | ||
} |
220 changes: 220 additions & 0 deletions
220
proposals/78:upgrade-17/add-LEMONS/add-STARS-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,220 @@ | ||
// This is generated by writeCoreEval; please edit! | ||
/* eslint-disable */ | ||
|
||
const manifestBundleRef = {bundleID:"b1-e603f280063f3adbe74f32fc54218d9ed490171fc29a31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd"}; | ||
const getManifestCall = harden([ | ||
"getManifestForAddAssetToVault", | ||
{ | ||
debtLimitValue: undefined, | ||
interchainAssetOptions: { | ||
decimalPlaces: 6, | ||
denom: "ibc/000C0FFEECAFE000", | ||
initialPrice: undefined, | ||
issuerBoardId: undefined, | ||
issuerName: "LEMONS", | ||
keyword: "LEMONS", | ||
oracleBrand: "LEMONS", | ||
proposedName: "LEMONS", | ||
}, | ||
interestRateValue: undefined, | ||
scaledPriceAuthorityRef: { | ||
bundleID: "b1-4cb589493c17312abe99eea9d38508b76dad397bf7f3dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d", | ||
}, | ||
}, | ||
]); | ||
const customManifest = { | ||
addAssetToVault: { | ||
brand: { | ||
consume: { | ||
IST: true, | ||
}, | ||
}, | ||
consume: { | ||
agoricNamesAdmin: true, | ||
auctioneerKit: "auctioneer", | ||
chainTimerService: true, | ||
vaultFactoryKit: "vaultFactory", | ||
}, | ||
instance: { | ||
consume: true, | ||
}, | ||
}, | ||
publishInterchainAssetFromBank: { | ||
consume: { | ||
agoricNamesAdmin: true, | ||
bankManager: true, | ||
reserveKit: true, | ||
startUpgradable: true, | ||
}, | ||
installation: { | ||
consume: { | ||
mintHolder: true, | ||
}, | ||
}, | ||
produce: { | ||
bankMints: true, | ||
vBankKits: true, | ||
}, | ||
}, | ||
registerScaledPriceAuthority: { | ||
consume: { | ||
agoricNamesAdmin: true, | ||
priceAuthority: true, | ||
priceAuthorityAdmin: true, | ||
startUpgradable: true, | ||
}, | ||
installation: { | ||
consume: { | ||
scaledPriceAuthority: true, | ||
}, | ||
}, | ||
instance: { | ||
produce: true, | ||
}, | ||
}, | ||
}; | ||
|
||
// Make a behavior function and "export" it by way of script completion value. | ||
// It is constructed by an anonymous invocation to ensure the absence of a global binding | ||
// for makeCoreProposalBehavior, which may not be necessary but preserves behavior pre-dating | ||
// https://github.com/Agoric/agoric-sdk/pull/8712 . | ||
const behavior = (({ | ||
manifestBundleRef, | ||
getManifestCall: [manifestGetterName, ...manifestGetterArgs], | ||
customManifest, | ||
E, | ||
log = console.info, | ||
customRestoreRef, | ||
}) => { | ||
const { entries, fromEntries } = Object; | ||
|
||
/** | ||
* Given an object whose properties may be promise-valued, return a promise | ||
* for an analogous object in which each such value has been replaced with its | ||
* fulfillment. | ||
* This is a non-recursive form of endo `deeplyFulfilled`. | ||
* | ||
* @template T | ||
* @param {{[K in keyof T]: (T[K] | Promise<T[K]>)}} obj | ||
* @returns {Promise<T>} | ||
*/ | ||
const shallowlyFulfilled = async obj => { | ||
if (!obj) { | ||
return obj; | ||
} | ||
const awaitedEntries = await Promise.all( | ||
entries(obj).map(async ([key, valueP]) => { | ||
const value = await valueP; | ||
return [key, value]; | ||
}), | ||
); | ||
return fromEntries(awaitedEntries); | ||
}; | ||
|
||
const makeRestoreRef = (vatAdminSvc, zoe) => { | ||
/** @type {(ref: import\('./externalTypes.js').ManifestBundleRef) => Promise<Installation<unknown>>} */ | ||
const defaultRestoreRef = async bundleRef => { | ||
// extract-proposal.js creates these records, and bundleName is | ||
// the optional name under which the bundle was installed into | ||
// config.bundles | ||
const bundleIdP = | ||
'bundleName' in bundleRef | ||
? E(vatAdminSvc).getBundleIDByName(bundleRef.bundleName) | ||
: bundleRef.bundleID; | ||
const bundleID = await bundleIdP; | ||
const label = bundleID.slice(0, 8); | ||
return E(zoe).installBundleID(bundleID, label); | ||
}; | ||
return defaultRestoreRef; | ||
}; | ||
|
||
/** @param {ChainBootstrapSpace & BootstrapPowers & { evaluateBundleCap: any }} powers */ | ||
const coreProposalBehavior = async powers => { | ||
// NOTE: `powers` is expected to match or be a superset of the above `permits` export, | ||
// which should therefore be kept in sync with this deconstruction code. | ||
// HOWEVER, do note that this function is invoked with at least the *union* of powers | ||
// required by individual moduleBehaviors declared by the manifest getter, which is | ||
// necessary so it can use `runModuleBehaviors` to provide the appropriate subset to | ||
// each one (see ./writeCoreEvalParts.js). | ||
// Handle `powers` with the requisite care. | ||
const { | ||
consume: { vatAdminSvc, zoe, agoricNamesAdmin }, | ||
evaluateBundleCap, | ||
installation: { produce: produceInstallations }, | ||
modules: { | ||
utils: { runModuleBehaviors }, | ||
}, | ||
} = powers; | ||
|
||
// Get the on-chain installation containing the manifest and behaviors. | ||
log('evaluateBundleCap', { | ||
manifestBundleRef, | ||
manifestGetterName, | ||
vatAdminSvc, | ||
}); | ||
let bcapP; | ||
if ('bundleName' in manifestBundleRef) { | ||
bcapP = E(vatAdminSvc).getNamedBundleCap(manifestBundleRef.bundleName); | ||
} else if ('bundleID' in manifestBundleRef) { | ||
bcapP = E(vatAdminSvc).getBundleCap(manifestBundleRef.bundleID); | ||
} else { | ||
const keys = Reflect.ownKeys(manifestBundleRef).map(key => | ||
typeof key === 'string' ? JSON.stringify(key) : String(key), | ||
); | ||
const keysStr = `[${keys.join(', ')}]`; | ||
throw Error( | ||
`bundleRef must have own bundleName or bundleID, missing in ${keysStr}`, | ||
); | ||
} | ||
const bundleCap = await bcapP; | ||
|
||
const proposalNS = await evaluateBundleCap(bundleCap); | ||
|
||
// Get the manifest and its metadata. | ||
log('execute', { | ||
manifestGetterName, | ||
bundleExports: Object.keys(proposalNS), | ||
}); | ||
const restoreRef = customRestoreRef || makeRestoreRef(vatAdminSvc, zoe); | ||
const { | ||
manifest, | ||
options: rawOptions, | ||
installations: rawInstallations, | ||
} = await proposalNS[manifestGetterName]( | ||
harden({ restoreRef }), | ||
...manifestGetterArgs, | ||
); | ||
|
||
// Await promises in the returned options and installations records. | ||
const [options, installations] = await Promise.all( | ||
[rawOptions, rawInstallations].map(shallowlyFulfilled), | ||
); | ||
|
||
// Publish the installations for our dependencies. | ||
const installationEntries = entries(installations || {}); | ||
if (installationEntries.length > 0) { | ||
const installAdmin = E(agoricNamesAdmin).lookupAdmin('installation'); | ||
await Promise.all( | ||
installationEntries.map(([key, value]) => { | ||
produceInstallations[key].resolve(value); | ||
return E(installAdmin).update(key, value); | ||
}), | ||
); | ||
} | ||
|
||
// Evaluate the manifest. | ||
return runModuleBehaviors({ | ||
// Remember that `powers` may be arbitrarily broad. | ||
allPowers: powers, | ||
behaviors: proposalNS, | ||
manifest: customManifest || manifest, | ||
makeConfig: (name, _permit) => { | ||
log('coreProposal:', name); | ||
return { options }; | ||
}, | ||
}); | ||
}; | ||
|
||
return coreProposalBehavior; | ||
})({ manifestBundleRef, getManifestCall, customManifest, E }); | ||
behavior; |
5 changes: 5 additions & 0 deletions
5
...dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d.json
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd.json
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
proposals/78:upgrade-17/add-OLIVES/add-STARS2-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,41 @@ | ||
{ | ||
"consume": { | ||
"bankManager": true, | ||
"agoricNamesAdmin": "makeCoreProposalBehavior", | ||
"reserveKit": true, | ||
"startUpgradable": true, | ||
"priceAuthorityAdmin": true, | ||
"priceAuthority": true, | ||
"auctioneerKit": "auctioneer", | ||
"vaultFactoryKit": "vaultFactory", | ||
"chainTimerService": true, | ||
"vatAdminSvc": "makeCoreProposalBehavior", | ||
"zoe": "makeCoreProposalBehavior" | ||
}, | ||
"produce": { | ||
"bankMints": true, | ||
"vBankKits": true | ||
}, | ||
"installation": { | ||
"consume": { | ||
"mintHolder": true, | ||
"scaledPriceAuthority": true | ||
}, | ||
"produce": "makeCoreProposalBehavior" | ||
}, | ||
"instance": { | ||
"produce": true, | ||
"consume": true | ||
}, | ||
"brand": { | ||
"consume": { | ||
"IST": true | ||
} | ||
}, | ||
"evaluateBundleCap": "makeCoreProposalBehavior", | ||
"modules": { | ||
"utils": { | ||
"runModuleBehaviors": "makeCoreProposalBehavior" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
proposals/78:upgrade-17/add-OLIVES/add-STARS2-collateral-plan.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,17 @@ | ||
{ | ||
"name": "add-STARS2-collateral", | ||
"script": "add-STARS2-collateral.js", | ||
"permit": "add-STARS2-collateral-permit.json", | ||
"bundles": [ | ||
{ | ||
"entrypoint": "@agoric/zoe/src/contracts/scaledPriceAuthority.js", | ||
"bundleID": "b1-4cb589493c17312abe99eea9d38508b76dad397bf7f3dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d", | ||
"fileName": "/home/rgibson/.agoric/cache/b1-4cb589493c17312abe99eea9d38508b76dad397bf7f3dad1fda6078557f6be78ea36b9382b7f4a716adca474c74a355a63d88681e13714687f43b512956ce06d.json" | ||
}, | ||
{ | ||
"entrypoint": "@agoric/inter-protocol/src/proposals/addAssetToVault.js", | ||
"bundleID": "b1-e603f280063f3adbe74f32fc54218d9ed490171fc29a31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd", | ||
"fileName": "/home/rgibson/.agoric/cache/b1-e603f280063f3adbe74f32fc54218d9ed490171fc29a31dadeca056e089ea71ff6fb9e5b9ccd76b0fe51d35cf40420268797f8fc61ce1745dbd6bacd1e88f8bd.json" | ||
} | ||
] | ||
} |
Oops, something went wrong.