Title says it all. I have a contract already deployed on the blockchain. Unfortunately I need to do some changes to it so will need to re-deploy it, and the previous one will become useless. I'd like to call selfdestruct()
on it to save some gas costs on the re-deployment of the new one, but not sure how to do it. Should I code it in the migration file that I will use to deploy the new contract? It currently looks like this:
const MainContract = artifacts.require("MainContract");
const myLibrary = artifacts.require("myLibrary");
async function doDeploy(deployer) {
await deployer.deploy(myLibrary);
await deployer.link(myLibrary, MainContract);
await deployer.deploy(MainContract);
}
module.exports = (deployer, network) => {
deployer.then(async () => {
await doDeploy(deployer);
});
};
Thanks
selfdestruct()
withdelegatecall
in the constructor I think it should work, right? Thanks!