ConvexityProtocol icon indicating copy to clipboard operation
ConvexityProtocol copied to clipboard

Looking up token["ETH"] and checking for supportsAsset("ETH")

Open kangaroosterus opened this issue 5 years ago • 0 comments

This is a low priority issue but something you may want to fix at some point.

There should be consistency when looking for the existence of a supported asset and returning the value for that supported asset.

The code below does an explicit check to see if "ETH" is a supported asset:

https://github.com/aparnakr/OptionsProtocol/blob/9363067b23278cd6d919cc0dad8ae0d4b489491f/contracts/OptionsFactory.sol#L154

However in the below code, it's assume that the lack of existence in the token[] is the value for the "ETH" token.

https://github.com/aparnakr/OptionsProtocol/blob/9363067b23278cd6d919cc0dad8ae0d4b489491f/contracts/OptionsFactory.sol#L75

This would be an issue in situations as follows:

  1. Someone accidentally calls addAsset("ETH", 123) - with a non-zero _addr).
  2. Solidity implementation change where token["ETH"] doesn't return 0. Perhap they change it to -1. This is unlikely to happen.

In both of the above situations, the rest of the system will break down since isETH() is expected to be ERC20(0).

kangaroosterus avatar Feb 12 '20 00:02 kangaroosterus