Chainboard-Academy / agoric-lecture-content

This repository contains the lecture content for Chainboard Academy Agoric Bootcamp
6 stars 6 forks source link

EC does not choose supported collateral types #2

Closed dckc closed 1 year ago

dckc commented 1 year ago

That choice is reserved to the BLD stakers.

I noticed this at around 10:30 in the recording. I'm not sure how to submit a pull request for youtube videos, though :)

dckc commented 1 year ago

@anilhelvaci please take a look

dckc commented 1 year ago

cc @jeetraut, @hielo777

anilhelvaci commented 1 year ago

@dckc Thanks for correcting. That slipped from my attention.

When you think about I should've caught that new supported PSM tokens approved by the BLD stakers as it requires a core-eval(I believe it does but correct me if I'm wrong here as well).

But I'm surprised that new vault collaterals are approved by BLD Stakers. Does that mean there's now two Electorates governing VaultFactory? One for econ committee one for BLD Stakers. But I've to take a look at vaults code to be sure.

anilhelvaci commented 1 year ago

But merging this anyway. Thanks again for the correction! @dckc

dckc commented 1 year ago

But I'm surprised that new vault collaterals are approved by BLD Stakers. Does that mean there's now two Electorates governing VaultFactory? One for econ committee one for BLD Stakers.

No; note that adding a new vault collateral is not done by changing a governed parameter. It's done by calling a method on the creatorFacet.

The EC can only change those governed parameters (or make governed API calls). They cannot, in general, call methods on the creatorFacet.

anilhelvaci commented 1 year ago

No; note that adding a new vault collateral is not done by changing a governed parameter. It's done by calling a method on the creatorFacet.

This makes total sense, thanks! So how do you call a method on creatorFacet? A core-eval as well?

dckc commented 1 year ago

... So how do you call a method on creatorFacet? A core-eval as well?

Yes; the results of startInstance calls, including creatorFacet are available to core-eval code; for example:

export const addAssetToVault = async (
  {
    consume: { vaultFactoryKit, agoricNamesAdmin, auctioneerKit },

https://github.com/Agoric/agoric-sdk/blob/046eb05f824bddad6e1980c2bfab7b3f57f1e60f/packages/inter-protocol/src/proposals/addAssetToVault.js#L217-L219

The call on the creatorFacet is reasonably straightforward:

  const vaultFactoryCreator = E.get(vaultFactoryKit).creatorFacet;
  await E(vaultFactoryCreator).addVaultType(interchainIssuer, oracleBrand, {

https://github.com/Agoric/agoric-sdk/blob/046eb05f824bddad6e1980c2bfab7b3f57f1e60f/packages/inter-protocol/src/proposals/addAssetToVault.js#L250-L251