From f780c75f450cf81da931edc2c8116ce55e02d59c Mon Sep 17 00:00:00 2001 From: David Asamonye Date: Fri, 26 Apr 2024 07:35:27 +0100 Subject: [PATCH] prepare for mainnet deployment --- package.json | 5 ++++- scripts/deploy_mainnet_v1.js | 28 ++++++++++++++++++++++++++++ scripts/propose_upgrade.js | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d9151ce..4fbeaf9 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,12 @@ "propose-upgrade": "hardhat run --network fuji scripts/propose_upgrade.js" }, "dependencies": { + "@aws-sdk/client-secrets-manager": "^3.556.0", + "@aws-sdk/credential-providers": "^3.556.0", "@openzeppelin/contracts": "5.0.2", "@openzeppelin/contracts-upgradeable": "5.0.2", - "@openzeppelin/defender-admin-client": "^1.54.1" + "@openzeppelin/defender-admin-client": "^1.54.1", + "aws-sdk": "^2.1603.0" }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", diff --git a/scripts/deploy_mainnet_v1.js b/scripts/deploy_mainnet_v1.js index 9a039a1..b408949 100644 --- a/scripts/deploy_mainnet_v1.js +++ b/scripts/deploy_mainnet_v1.js @@ -1,4 +1,12 @@ const { ethers, upgrades } = require("hardhat"); +const { AdminClient } = require('@openzeppelin/defender-admin-client'); + +const client = new AdminClient({ apiKey: process.env.DEFENDER_API_KEY, apiSecret: process.env.DEFENDER_API_SECRET }); + +let ZTokenAbi = require('../contracts/abis/Ztoken.json'); +let OracleAbi = require('../contracts/abis/Oracle.json'); +let VaultAbi = require('../contracts/abis/Vault.json'); +let USDCAbi = require('../contracts/abis/USDC.json'); const datafeed = process.env.MAINNET_DATAFEED; const MULTISIG = process.env.MAINNET_MULTISIG; @@ -39,6 +47,18 @@ async function deployOracle(_admin, _datafeed, _zusd, _zngn, _zzar ,_zxaf) { return oracle.target; } +async function addContract(_address, _name, _abi) { + const success = await client.addContract({ + network: 'fuji', + address: _address, + name: _name, + abi: _abi, + natSpec: '{devdoc:{...}, userdoc: {...}}', + }); + console.log('success'); + return success; +} + async function main() { console.log("deploying mainnet"); @@ -70,6 +90,14 @@ async function main() { await upgrades.admin.transferProxyAdminOwnership(vault.target, MULTISIG); console.log('Transferred ownership of ProxyAdmin to:', MULTISIG); + + addContract(zUSD, 'zUSD', JSON.stringify(ZTokenAbi)); + addContract(zNGN, 'zNGN', JSON.stringify(ZTokenAbi)); + addContract(zZAR, 'zZAR', JSON.stringify(ZTokenAbi)); + addContract(zXAF, 'zXAF', JSON.stringify(ZTokenAbi)); + addContract(Oracle, 'Oracle', JSON.stringify(OracleAbi)); + addContract(vault.target, 'Vault', JSON.stringify(VaultAbi)); + addContract(collateral, 'USDC', JSON.stringify(USDCAbi)); } main().then(() => process.exit(0)) diff --git a/scripts/propose_upgrade.js b/scripts/propose_upgrade.js index 2536ba5..3657f82 100644 --- a/scripts/propose_upgrade.js +++ b/scripts/propose_upgrade.js @@ -3,7 +3,7 @@ const { ethers, upgrades, defender } = require("hardhat"); // const { defender } = require("hardhat"); async function main() { - const proxyAddress = process.env.TESTNET_VAULT; + const proxyAddress = process.env.MAINNET_VAULT; const Vault = await ethers.getContractFactory("Vault"); console.log("Preparing proposal...");