3

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

1 Answer 1

1

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.

  1. You might use external Libraries (You offload some logic there)
  2. You separate logic into two or more contracts.
  3. 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)

6
  • 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%
    – Sky
    Commented 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?
    – Sky
    Commented Mar 8, 2023 at 12:53
  • yes Share more about it Commented Mar 9, 2023 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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