Point Network Upgradable Zapps
Welcome to the Upgradable Zapps Developers Guide!
Overview
This document outlines developing upgradable Zapps using the Open Zeppelin Proxy Upgrade Pattern.
Example
For an example of an existing Upgradable Zapp take a look at social.point.
Steps
To ensure that your Zapp follows the Upgradable pattern you need to do the following:
Familiarize yourself with the Open Zeppelin Smart Contract Proxy Upgrade Pattern here.
In
point.deploy.json
setupgradable
key totrue
like this:{
"version": 0.1,
"target": "mynewzapp.point",
"keyvalue": {},
"contracts": [
"MyNewZapp"
]
"upgradable": true
}In your Smart Contract, import the required Open Zeppelin Smart Contract Proxy Upgrade Pattern libraries like so:
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";Extend your Smart Contract with the required contracts like so:
contract MyNewZapp is Initializable, UUPSUpgradeable, OwnableUpgradeable
Declare a
initialize
function in your Smart Contract that calls__Ownable_init()
and__UUPSUpgradeable_init()
like so:function initialize() public initializer {
__Ownable_init();
__UUPSUpgradeable_init();
}Install the dependencies:
npm i @openzeppelin/contracts
npm i @openzeppelin/contracts-upgradeableBuild and deploy your Zapp as per the instructions outlined here