Warning: Contract code size is 44924 bytes and 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.
1 Answer
It depends a lot on your use case. There are many options. In your case, the size of the contract is huge, so "small" saving tricks will not work. So I propose one of the following.
- You might use external Libraries (You offload some logic there)
- You separate logic into two or more contracts.
- You might resort to using the Dimond proxy pattern (which allows contracts of unlimited size)
NOTE: You should use a solidity optimizer during deployment/compiling contracts (That can lower the contract size by a considerable amount)
-
But if we don't have time to use the diamond proxy pattern for splitting client deadlines, the deadline is approaching. Therefore, I want to compose the smart contract into different contracts based on their size. Commented Mar 8, 2023 at 10:03
-
Quick question... Are you using a solidity optimizer during compilation? It can sometimes drop the size of your contract by 60%– SkyCommented Mar 8, 2023 at 10:50
-
yes i'm using this but i want to slove this for upcoming functions Commented Mar 8, 2023 at 12:46
-
Alright, but just so we are clear, your contract size is 44924 bytes WITH using optimizer in the compiler?– SkyCommented Mar 8, 2023 at 12:53
-