Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
2 Answers
Do you have the public GitHub? I can take a look to give you the fastest solutions.
If not. You can try Diamond Standard to split your code. Also, you can do some gas optimizations: move views in another contract if they are complex and name it ContractViews, reorder the variables to fulfill 32 bytes, remove the "public" indicator from variables, use libraries that can be deployed separately, use immutable and constant if is possible, optimize the algorithms from functions.
-
1yes, i deployed with optimiser and with these technique, just now for more functionality in contracts i will follow Diamond Standard to split your code and i will separate the libraries and other contracts. Commented Jan 27, 2023 at 9:03
best to start with reading these downsizing guidlines: https://ethereum.org/en/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit
MaxCodeSize
inparams/protocol_params.go
and work as usual. But if you want to deploy on the Main Net you need to split your code between different contracts and useCall()
s. It is a little bit of gas overhead but you can't do anything about it