celo-monorepo icon indicating copy to clipboard operation
celo-monorepo copied to clipboard

FeeCurrency directory

Open pahor167 opened this issue 10 months ago • 4 comments

Description

Introduction of FeeCurrencyDictionary for L2 geth client.

Tested

Unit tests

pahor167 avatar Apr 17 '24 13:04 pahor167

According to https://github.com/celo-org/celo-blockchain-planning/issues/172#issuecomment-2066858102, we should extract an IFeeCurrencyDirectory interface from this contract. I think that should include

  • getCurrencies
  • getCurrencyConfig
  • getExchangeRate
  • CurrencyConfig

If we don't want to expose the CurrencyConfig, we should skip getCurrencyConfig and CurrencyConfig and add a getIntrinsicGas(address token) instead.

karlb avatar Apr 22 '24 08:04 karlb

According to celo-org/celo-blockchain-planning#172 (comment), we should extract an IFeeCurrencyDirectory interface from this contract. I think that should include

  • getCurrencies
  • getCurrencyConfig
  • getExchangeRate
  • CurrencyConfig

If we don't want to expose the CurrencyConfig, we should skip getCurrencyConfig and CurrencyConfig and add a getIntrinsicGas(address token) instead.

According to celo-org/celo-blockchain-planning#172 (comment), we should extract an IFeeCurrencyDirectory interface from this contract. I think that should include

  • getCurrencies
  • getCurrencyConfig
  • getExchangeRate
  • CurrencyConfig

If we don't want to expose the CurrencyConfig, we should skip getCurrencyConfig and CurrencyConfig and add a getIntrinsicGas(address token) instead.

Interface added

pahor167 avatar Apr 24 '24 12:04 pahor167

The currencyIdentifier feels like something that does not belong into the FeeCurrencyDirectory, since it depends on the oracle. I could image oracles having all kind of identifiers:

  • token address
  • some other address
  • string
  • uint id
  • two of the above (one for "from" and one for "to")
  • no id since it only provides values for a single currency

I would suggest not including it and relying on the oracle having an interface that takes the token address. If it doesn't we could add a contract in between to bridge the interfaces. Or would that be too gas expensive or too cumbersome in a different way?

Apart from that, this looks good to me.

The currencyIdentifier feels like something that does not belong into the FeeCurrencyDirectory, since it depends on the oracle. I could image oracles having all kind of identifiers:

  • token address
  • some other address
  • string
  • uint id
  • two of the above (one for "from" and one for "to")
  • no id since it only provides values for a single currency

I would suggest not including it and relying on the oracle having an interface that takes the token address. If it doesn't we could add a contract in between to bridge the interfaces. Or would that be too gas expensive or too cumbersome in a different way?

Apart from that, this looks good to me.

We will have further discussion regarding IOracle interface, for now I'm leaving it as it is

pahor167 avatar Apr 24 '24 12:04 pahor167

FeeCurrency directory

Generated at commit: 5a4987d5f15ec0542de7db4273a2d6ca56c184bf

🚨 Report Summary

Severity Level Results
Contracts Critical High Medium Low Note Total 2 3 0 15 40 60
Dependencies Critical High Medium Low Note Total 0 0 0 0 0 0

For more details view the full report in OpenZeppelin Code Inspector

openzeppelin-code[bot] avatar May 06 '24 13:05 openzeppelin-code[bot]