Use contracts instead of interfaces declarations in Base_Test
#1062
Replies: 1 comment 3 replies
-
Interesting proposal.
By using interface as a datatype for a contract variable, it ensures that the public functions exposed by the contract are also included in the interface. This is because a contract can define more public function than the interface it inherits from. Consider the following case: interface IA {}
contract A is IA {
function foo() public {}
} If we only import
I dont know what is ideal but having so many imports is common in testing: https://github.com/aave-dao/aave-v3-origin/blob/main/tests/utils/BatchTestProcedures.sol (our approach is rather cleaner than Aave's). I would not call it "not ideal" since its the base contract for testing so that should be fine imo. |
Beta Was this translation helpful? Give feedback.
-
After the package tethering change, we’ve significantly increased the number of imports in
Base.t.sol
:v2-core/test/Base.t.sol
Lines 4 to 32 in a322ba6
One idea to reduce the number of imports (assuming we agree that having this many imports isn’t ideal) is to declare the testing contracts as contracts instead of interfaces (see the code below). Since the contracts themselves already inherit the interfaces, I don’t see any downside to this approach, as it would reduce the overall number of imports throughout the test files.
instead of:
we could (option 1):
Another alternative to reducing the number of imports would be to import them directly from the contract (option 2):
Personally I chose option 1. wdyt @sablier-labs/solidity?
Beta Was this translation helpful? Give feedback.
All reactions