Upgrade
Last updated
Last updated
After deploying the Payment Registry
contract, you can perform to it. As mentioned previously, this is done via a . So, to upgrade Payment Registry, another smart contract must be deployed, and the address stored inside the Proxy must be changed.
To do this you must:
Configure the contracts/solidity/.env
file.
NOTE: This is a very similar configuration than the mentioned before, but MM_ETHEREUM_WALLET_ADDRESS is not necessary
Configure the address of the proxy to be upgraded:
Use the Makefile command to upgrade Payment Registry
contract
Note
You must be the owner of the contract to upgrade it.
This command will:
Rebuild Payment Registry.sol
Deploy the new contract to the network
Utilize Foundry to upgrade the previous contract, changing the proxy's pointing address to the newly deployed contract
Our Escrow contract is also upgradeable, but it's method and process of upgrading is different from Payment Registry's upgrade. Starknet implemented the replace_class
syscall, allowing a contract to update its source code by replacing its class hash once deployed. So, to upgrade Escrow, a new class hash must be declared, and the contract's class hash must be replaced.
We will perform the upgrade using the starkli
tool, so the same configuration used for deployment is necessary:
Configure contracts/cairo/.env
file.
Configure the address of the contract to be upgraded:
Use the Makefile command to upgrade Escrow
contract
Note
You must be the owner of the contract to upgrade it.
This command will:
rebuild Escrow.cairo
declare it on Starknet
[comment]: TODO, add when ZKSync is Upgradeable
Call the external upgrade() function, from , with the new class hash