I have added the compiler options in truffle-config.js -
compilers: {
solc: {
version: "0.8.16",
settings: {
optimizer: {
enabled: false,
runs: 200
}
}
}
}
I am deploying an upgradable erc20 contract using truffle. To do that I am using OpenZeppelin truffle suite.
truffle console --network testnet
truffle(testnet)> compile --all
truffle(testnet)> migrate
for migrate, I have 1_deploy_contracts.js as below
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const Erc20Token = artifacts.require('Erc20Token');
module.exports = async function (deployer) {
const instance = await deployProxy(Erc20Token, [], { deployer, initializer: 'initialize' });
}
This deploys 3 contracts for me:
Erc20Token
proxyAdmin
TransparentUpgradeableProxy
Now, The proxy (TransparentUpgradeableProxy) is verified automatically on the testnet with optimiser shows as "Yes with 200"
Now my aim is to deploy this proxy with NO optimisations since the life cycle of the contract is suppose to last indefinitely.
Then I checked the verified code on bsc scan testnet. I found this:
So I traced back the code where open-zeppelin library adds this settings which turned out to be in
node_modules/@openzeppelin/upgrades-core/artifacts/build-info.json
There I manually edited the build-info.json and set enabled: false.
I could also see the same solc compiler version in build-info.json which matches with the verified proxy contract on testnet, you can see that in first image.
"solcLongVersion": "0.8.2+commit.661d1103",
Still the problem persists. Do let me know or point to any relevant resources
Update
I tried with hardhat as well, and the result is same. On both places I'm using deployProxy module of open-Zeppelin.
So either, the problem is with deployProxy.