From 239bebcb71308fc9a265993e4b1eb7f1860e8ae1 Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Thu, 17 Oct 2024 12:07:37 +0200 Subject: [PATCH] docs(contracts): upgrading documenation --- bolt-contracts/docs/upgrading.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bolt-contracts/docs/upgrading.md b/bolt-contracts/docs/upgrading.md index e69de29bb..2eae7f209 100644 --- a/bolt-contracts/docs/upgrading.md +++ b/bolt-contracts/docs/upgrading.md @@ -0,0 +1,15 @@ +# Upgrading + +When upgrading contracts, always keep the old implementation of the contracts around and increment the version number. +For example, when upgrading `BoltManagerV1`, copy it into a new file called `BoltManagerV2` and make your changes. + +This is needed to reference check the new contracts with the old contracts so that the OpenZeppelin Upgrades library can +validate the safety of the upgrade. You MUST add this reference when upgrading a contract: + +```sol +Options memory opts; +opts.referenceContract = "BoltManagerV1.sol"; +Upgrades.upgradeProxy(proxy, "BoltManagerV2.sol", "", opts); +``` + +Before an upgrade, update the [`Upgrade.s.sol`](../script/holesky/Upgrade.s.sol) script to include the correct contracts, references and configurations. \ No newline at end of file