Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 207 forks source link

fetch assetlist info into agoricNames #9752

Open turadg opened 4 months ago

turadg commented 4 months ago

What is the Problem Being Solved?

We have getDenomInfo (introduced in https://github.com/Agoric/agoric-sdk/issues/9211 as getBrandInfo()) whichpulls data from a ChainHub. As a base case, contracts can load into ChainHub they info they need.

We should also save them the work by doing this in agoricNames for already known assets.

Description of the Design

Update fetch-chain-info to also fetch asset list and massage the data into something useful for ChainHub's getBrandInfo.

Update the bootstrap scripts to stick it into agoricNames.

Security Considerations

Scaling Considerations

Test Plan

Upgrade Considerations

0xpatrickdev commented 2 months ago

something useful for ChainHub's getBrandInfo

Is registering well-known denoms as Brands in vbank in scope for this task (i.e. publishInterchainAssetFromBank)? getBrandInfo is not useful until we also have well-known brands registered.

If not, we should create a ticket to track this. There seem to be two goals that could be tracked separately:

0xpatrickdev commented 2 months ago

If not, we should create a ticket to track this. There seem to be two goals that could be tracked separately:

See https://github.com/Agoric/agoric-sdk/issues/9966 for testing environment support, and https://github.com/Agoric/agoric-sdk/issues/9967 for production support

0xpatrickdev commented 2 months ago

With these changes, developers will still need to call registerAsset in every contract start script: https://github.com/Agoric/agoric-sdk/pull/9814/files#diff-54fb24f937c4f534bd01703bb857887a4a8e88ff34c8ba0948694bd69c22e375R63-R74

This seems a little burdensome, is this the intention? Here are some alternatives:

? who should call `registerAsset`
: contract author in start script
  + allows fine-grained control over which chains + assets are registered
  - verbose, lots of boilerplate
: automated via library code (maybe in `withOrchestration`)
  + allows `getAsset` and `getBrand` to continue to be synchronous
  - adds all assets + chains, even if developer is only interested in some
  - contract creators need to call `registerAsset` via `ChainHubAdmin` as new assets appear over time
: lazily query `agoricNames.vbankAsset`, like `getChainInfo` and `getConnectionInfo`
  + consistent behavior with chain and connection info
  + new assets are easily discovered over time
  - makes `getAsset` and `getBrand` calls asynchronous