Allow enabling the Cost Model in other networks than mainnet
After the multi-network changes introduced in 668, the Cost Model feature was restricted to Ethereum Mainnet. We should find a way to enable this feature for other networks besides that.
Originally posted by @fordN in https://github.com/graphprotocol/indexer/pull/668#discussion_r1290561614
If the roadblock is the availability of GRT/DAI uniswap pairs on other network, the agent should still allow using cost models when inject-dai=off.
Gathering some notes from a quick brainstorming session with @tilacog
Tasks to do
- [ ] Update code to support cost-models on each network: ensure data models include
protocolNetwork, etc... - [ ] Decide and implement network agnostic approach to fetching GRT/DAI pair price
Some initial ideas for network agnostic approaches to fetching price:
- Create a small, specific subgraph tracking the GRT/DAI or GRT/USD pairs on Uniswap (and maybe other protocols too?)
- Simply use the GRT/DAI price from Mainnet across all networks
- ....
I think that for the purpose of the cost model we could just use the data from Ethereum. What's important is that the oracle we use has enough volume.
Other ones to investigate: https://docs.mean.finance/v/oracles/ and https://docs.oracles.rip/content/what-is-price.html - also this one for offchain oracles https://github.com/mean-finance/sdk
https://github.com/graphprotocol/indexer/pull/899