openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Make `IERC20Permit` derive from `IERC20`

Open CodeSandwich opened this issue 3 years ago • 2 comments

When using IERC20Permit all IERC20 functions like transferFrom are not exposed. The address of the ERC-20 token needs to be cast from IERC20Permit to IERC20 to do anything other than permitting. This is awkward and doesn't make much sense, IERC20Permit is a superset of IERC20.

I'm opening an issue and not a one-line PR because it's a breaking change and may be controversial. It also probably can't be published without a major release.

💻 Environment

📝 Details

🔢 Code to reproduce bug

CodeSandwich avatar Aug 24 '22 13:08 CodeSandwich

Hello @CodeSandwich

I think one of the reason we haven't done that so far is that it would possibly be a breaking change when overriding, because it would expend the "dependency tree", and that might require you to specify additional overrides (the IERC20 interfaces) in child contracts.

Still, applying the change to our master branch does not break compilation, so it might not be as breaking as we anticipated. Worst case scenario, we could to that in 5.0 ... but maybe we could do it before.

@frangio anything I'm missing here?

Amxx avatar Aug 24 '22 15:08 Amxx

There was a change to how Solidity treats "overrides" from interfaces in 0.8.8 that might make this change non-breaking from that version on. We should try with 0.8.0 and see what happens?

I think I agree with making this change at least for 5.0.

frangio avatar Aug 24 '22 15:08 frangio