In the standard truffle migrations contract the purpose of the upgrade function is upgrade the Migrations contract itself by copying the last_completed_migration of the old Migrations contract to the new Migrations contract.

I'm wondering what would actually call this function? Would it need to be called explicitly from the migration .js script that deploys the new Migrations contract? Or does it get called automatically from the truffle migrate command when the new Migrations contract is deployed?

Also I wonder why the upgrade function doesn't call selfdestruct on the old contract after the Migrations contract is upgraded? Or is this also a job for the .js migration script?

This is a follow up to Truffle Migrations contract constructor argument

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.