2

Using solidity ^4.x, it seems I can use an interface as a parameter type in a function from a different interface.

Example:

interface IERC20 {
    function transfer() external;
}
import "./IERC20.sol";

interface InterfaceB {
    function myOtherFunc(IERC20 tokenAddress) external;
}

Is this good practice? Are there any examples of successful protocols or dapps using this pattern?

  • 2
    Using solidity 0.5.10, it seems I can use an interface as a parameter type in a function from a different interface - also true in Solc 0.4.x. Is this good practice? - depending on your use-case. Are there any examples of successful protocols or dapps using this pattern - this pattern is general, and not related to anything specific about Ethereum. You can find it in many other systems, implemented in many other languages. – goodvibration Jul 17 '19 at 13:37
  • 2
    Thanks @goodvibration – Paul Razvan Berg Jul 17 '19 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.