bgd-labs / aave-address-book

Solidity registry for all smart contracts' addresses of the Aave ecosystem
https://search.onaave.com
MIT License
93 stars 45 forks source link

Code snippets / Usage example #450

Open sakulstra opened 5 months ago

sakulstra commented 5 months ago

Would be nice if selecting/hovering an item, would show how to actually use it in code via address-book. This can be useful especially as imports are wildly different on solc vs js:

js: AaveV3Ethereum.ASSETS.FRAX.A_TOKEN
solc: AaveV3EthereumAssets.FRAX_A_TOKEN
pegahcarter commented 5 months ago

It probably would be best to instead normalize naming so that imports are consistent.

sakulstra commented 5 months ago

@pegahcarter it's not really possible in a reasonable way.

In practice accessing Pool.Asset.UNDERLYING(how it is on ts part of the library) would be more comfortable then Pool.Asset_UNDERLYING. Originally we replicated a similar behavior in solidity via Pool.Asset().Underlying(), but this has code-size and compile-time implications which were not worth the tradeoff. On js side, it's quite nice to be able to just iterate over the objects, so eventually it's a tradeoff we settled on.