I had a single contract that was exceeding the 24576 bytes, so after some reading on how to fight contract size, etc I have divided the contract into multiple contracts to import. Here below is the sample of my contract and imports.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "AccessControl.sol"; // Copy/paste OpenZepplin and saved on file
import "ERC20.sol"; // Copy/paste OpenZepplin and saved on file
import "KatoSublime.sol"; // Small file approx 30 lines,not many struct/string
import "KatoSublimeBuy.sol"; // Small file approx 30 lines,not many struct/string
import "KatoSublimeFees.sol"; // Small file approx 30 lines,not many struct/string
contract Kato is ERC20, AccessControl, KatoSublime, KatoSublimeBuy, KatoSublimeFees {
// Code here!
}
- Although I have now divided the contract, it still gives me the error.
- Not only that, but before when the contract was all in one, I just needed to cancel a line like an event/emit/string to get rid of the error, now it does not.
- When I cancel lines from the other contracts imported the error goes away.
What am I doing wrong and how to fix it?
- Shell I import the file differently with the @..... or ../ or shell I just put them in the same file but in separate contracts?
I would like to be able to create many small contract with related functions and not worry about this issue anymore.
How can I fix this?