how to grant chainStorage access to a contract? #6839
-
As noted in #5687 (comment) , we discussed this in Dec 14 office hours. Someone who watched that recording asked how to write their own version of chainStorage-proposal.js (along with bakeSale-permit.json ) is a quick sketch. It's un-tested. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Looks like it works on local testnet, I've put together a document with the steps here for anyone interested. Thanks for the example! |
Beta Was this translation helpful? Give feedback.
-
agoricNames beyond reserved namesAs we discussed, testing showed that not only does this idiom result in a static error, it doesn't actually work at runtime for names that aren't in a hard-coded "reserved" list: instance: {
// @ts-expect-error bakeSaleKit isn't declared in vats/src/core/types.js
produce: { [contractInfo.instanceName]: produceInstance }, To register arbitrary names... // Add agoricNamesAdmin to the consume
const {
consume: { agoricNamesAdmin, board, chainStorage, zoe },
// @ts-expect-error bakeSaleKit isn't declared in vats/src/core/types.js
produce: { bakeSaleKit },
instance: {
// @ts-expect-error bakeSaleKit isn't declared in vats/src/core/types.js
produce: { [contractInfo.instanceName]: produceInstance },
},
} = powers; And the "Share instance widely" code becomes...
You asked about constraints/conventions in this area... whether sharing the publicFacet directly would work... the AgoricContractInvitationSpec type documentation doesn't say so, but the smartWallet makeInvitationsHelper calls So for use with the smart wallet, it has to be an instance that goes into agoricNames. |
Beta Was this translation helpful? Give feedback.
-
I'm fixing this, btw... ref p.s. landed in mainnet1B: |
Beta Was this translation helpful? Give feedback.
-
What does extending the bakeSale example to I added Looking at the Inter econ-behaviors as a reference, it seems we need to resolve chainTimerService with |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
Looks like it works on local testnet, I've put together a document with the steps here for anyone interested.
Thanks for the example!