Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arbitrary metadata for contracts in the config #78

Open
krzkaczor opened this issue Jan 25, 2022 · 2 comments
Open

Allow arbitrary metadata for contracts in the config #78

krzkaczor opened this issue Jan 25, 2022 · 2 comments

Comments

@krzkaczor
Copy link
Member

It's so nice to store everything in one place. It could be useful to enable arbitrary metadata stored for each contract.

@krzkaczor
Copy link
Member Author

CC: @Padraic-O-Mhuiris

@Padraic-O-Mhuiris
Copy link

Padraic-O-Mhuiris commented Jan 25, 2022

The general idea is that it would be useful to generate contract metadata statically as opposed to making numerous calls at runtime. The simplest example of this is for a frontend that is dependent on N amount of ERC20 contracts and would require 3N requests for getting the name, symbol and decimals for each. Where an application may have a small number of tokens, it would not be any significant gain, but where there are a large number of request to contract data which specifically never changes like in the ERC20 case, it is more performant for the application to have them stored statically.
It can also be remediated somewhat using multicall but that does complicate the methodology in how you fetch async contract data

mainnet: {
  dai: {
    address: '0x0',
    meta: {
      decimals: "decimals()"
    }
}
...

const sdk = getMainnetSDK()
sdk.dai.meta.decimals === 18 // true

Another way we could do it that would be cleaner but maybe more obfuscating is by replacing the async call to decimals with a static one if we know we have it. This would mean we would reference the contract information intuitively as opposed to the meta tag.

mainnet: {
  dai: {
    address: '0x0',
    meta: {
      decimals: "decimals()"
    }
}
...

const sdk = getMainnetSDK()
sdk.dai.decimals === 18 // true - changed from Promise<BigNumberish> to BigNumberish

That may be opinionated and the meta or a static key could be also used.

Another idea would be to include a label or tagging scheme for each contract which could make categorisation easier - say tagging a number of tokens to the name of a pool contract for easier lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants