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

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

Open
kangaroosterus opened this issue Feb 12, 2020 · 0 comments
Open

Comments

@kangaroosterus
Copy link

kangaroosterus commented Feb 12, 2020

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).

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

1 participant