0

I got to know that there is a size limitation for Ethereum contract, but to avoid this I split up functions of my contract in two sol files and one contract extends other contract and this solve the size limit problem but I just want to confirm is I am doing anything wrong or I am missing anything?

For example
Previously
File A.sol
Contract A {
function f1(){}
function f2(){}
function f3(){}
function f4(){}
}
Now
A.sol
import "./B.sol"
contract A is B{
function f3() public {}
function f4() public {}
}
B.sol
contract B{
function f2(){}
function f3(){}
}

2
  • and one contract extends other contract and this solve the size limit problem - wrong! – goodvibration Dec 4 '20 at 15:36
  • But I am not getting any size warning now on remix. – Shubham Singh Dec 7 '20 at 5:43
0

One contract extends other contract, and this solve the size-limit problem

That's wrong.

When B inherits A, the entire contents of A is included in B.

What you want is for B to take the address of (an instance of) A as input, either in the constructor of B, or in every function of B which needs to call a function of A.

Then, every function of B which needs to call a function of A, should call it via the address of A.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.