with "imports" at the top? I noticed a lot of contracts include the interfaces or libraries and it turns out to be a 4000 line contract and some just import on top
those are called flattened, i don't think there is a real gain. If you split the contracts, it's more readable and sometimes is necessary to avoid contract size limits
Cool man thanks for the reply
Imports can help with the contract size
imports are pretty fair practices, splitting up large codebases into chunks of easily readable files. one benefit of flattening contracts is they're easier to verify and share. regardless, all embedded libraries/files (aka imports) will count towards the 24.576 kb hard limit, it's here to prevent Denial-Of-Service (DOS) attacks. 24.576 kb is your bytecode size limit, not source files. as the contract size increases (reading the code from disk, pre-processing the code, adding data to the Merkle proof) increases drastically as well.
Обсуждают сегодня