Really my contract has many code lines. I want to know how to fix this issue with keeping my code lines.

Jan 21, 2022, 5:15 PM
nono I mean
did you save the config after you have set optimizer?
Jan 21, 2022, 5:16 PM
of course, I did.
Jan 21, 2022, 5:16 PM
Many people forget to do it many times trust me
ok
then if you set 1 runs?
Jan 21, 2022, 5:16 PM
Sorry, If I try run more one time, there is no issue, But while testing, I faced "Too large contract code" issue.
Jan 21, 2022, 5:18 PM
what do you mean? error is disappeared or no?
Jan 21, 2022, 5:19 PM
Yes. error is not shown. But if I try testing on that time, I faced another issue.
Jan 21, 2022, 5:20 PM
this after you set runs: 1 ?
Jan 21, 2022, 5:20 PM
It is same.
Jan 21, 2022, 5:21 PM
Maybe your contract code exceed the 24kb limit
Jan 21, 2022, 5:21 PM
Yes. right. I want to know how to solve this with keeping my code.
Jan 21, 2022, 5:22 PM
hardhat or truffle?
Jan 21, 2022, 5:22 PM
hardhat
Jan 21, 2022, 5:22 PM
try to add this
Jan 21, 2022, 5:23 PM
hardhat: {
allowUnlimitedContractSize: true
}
Jan 21, 2022, 5:23 PM
allowUnlimitedContractSize
exactly
but I am not sure you will be able to deploy on mainnet then
Jan 21, 2022, 5:23 PM
I will try
Jan 21, 2022, 5:24 PM
this is truth
Jan 21, 2022, 5:24 PM
how many lines is?
Jan 21, 2022, 5:24 PM
772 lines
Jan 21, 2022, 5:26 PM
you are trying to deploy on localhost or testnet?
Jan 21, 2022, 5:26 PM
on localhost
Jan 21, 2022, 5:27 PM
try to change optimization to true and runs to 200
Jan 21, 2022, 5:28 PM
I already did, but I did not fix,
Jan 21, 2022, 5:29 PM
even if you change 1 for 200?
Jan 21, 2022, 5:29 PM
Yes. already tested with 200. But not working.
Jan 21, 2022, 5:30 PM
try npx hardhat clean to clean the artifacts, if that doesnt work for you try to split the code in different contracts
that development network for hardhat is rare, are you using your own provider?
Jan 21, 2022, 5:31 PM
If I split code in several contracts, can I fix this issue?
Jan 21, 2022, 5:31 PM
Always keep this in mind when using this feature
Several libraries and linking them
Jan 21, 2022, 5:33 PM
yes
it would be better for you too
Jan 21, 2022, 5:34 PM

© 2024 Draquery.com All rights reserved.