celo-monorepo
celo-monorepo copied to clipboard
FeeCurrency directory
Description
Introduction of FeeCurrencyDictionary for L2 geth client.
Tested
Unit tests
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.
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 skipgetCurrencyConfig
andCurrencyConfig
and add agetIntrinsicGas(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 skipgetCurrencyConfig
andCurrencyConfig
and add agetIntrinsicGas(address token)
instead.
Interface added
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
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