Skip to content

Commit

Permalink
prepare for mainnet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
David405 committed Apr 26, 2024
1 parent 3f876c2 commit f780c75
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 28 additions & 0 deletions scripts/deploy_mainnet_v1.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion scripts/propose_upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down

0 comments on commit f780c75

Please sign in to comment.