Skip to content

Commit

Permalink
feat: add upgrade scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lahaye <[email protected]>
  • Loading branch information
ChrisLahaye committed Nov 13, 2023
1 parent 2cd2cf1 commit 1819fbb
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/deploy-base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ethers, upgrades } from 'hardhat';

const { AXELAR_GATEWAY, AXELAR_GAS_SERVICE, AXELAR_NETWORKS, CALL_ADDRESS, MAX_SUPPLY } = process.env;

async function main() {
const contractFactory = await ethers.getContractFactory('BaseV1');

const proxy = await upgrades.deployProxy(contractFactory, [
AXELAR_GATEWAY,
AXELAR_GAS_SERVICE,
AXELAR_NETWORKS && JSON.parse(AXELAR_NETWORKS) || [],
CALL_ADDRESS || ethers.constants.AddressZero,
MAX_SUPPLY,
]);

console.log(proxy.address);
}

main();
15 changes: 15 additions & 0 deletions scripts/deploy-crowdfund.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ethers, upgrades } from 'hardhat';

const { PASSPORT } = process.env;

async function main() {
const contractFactory = await ethers.getContractFactory('CrowdfundV1');

const proxy = await upgrades.deployProxy(contractFactory, [
PASSPORT,
]);

console.log(proxy.address);
}

main();
26 changes: 26 additions & 0 deletions scripts/deploy-passport-axelar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ethers, upgrades } from 'hardhat';

const { AXELAR_GATEWAY, AXELAR_GAS_SERVICE, AXELAR_BASE_NETWORK_CHAIN, AXELAR_BASE_NETWORK_CONTRACT_ADDRESS, NAME, SYMBOL, PRICE_AMOUNT, PRICE_FEED_1, PRICE_FEED_2, TREASURY, DRAWER } = process.env;

const AXELAR_BASE_NETWORK = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('BASE_NETWORK'));

async function main() {
const contractFactory = await ethers.getContractFactory('PassportV1Axelar');

const proxy = await upgrades.deployProxy(contractFactory, [
AXELAR_GATEWAY,
AXELAR_GAS_SERVICE,
[[AXELAR_BASE_NETWORK, [AXELAR_BASE_NETWORK_CHAIN, AXELAR_BASE_NETWORK_CONTRACT_ADDRESS]]],
NAME,
SYMBOL,
PRICE_AMOUNT,
PRICE_FEED_1 || ethers.constants.AddressZero,
PRICE_FEED_2 || ethers.constants.AddressZero,
TREASURY,
DRAWER
]);

console.log(proxy.address);
}

main();
22 changes: 22 additions & 0 deletions scripts/deploy-passport-call.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ethers, upgrades } from 'hardhat';

const { CALL_ADDRESS, NAME, SYMBOL, PRICE_AMOUNT, PRICE_FEED_1, PRICE_FEED_2, TREASURY, DRAWER } = process.env;

async function main() {
const contractFactory = await ethers.getContractFactory('PassportV1Call');

const proxy = await upgrades.deployProxy(contractFactory, [
CALL_ADDRESS,
NAME,
SYMBOL,
PRICE_AMOUNT,
PRICE_FEED_1 || ethers.constants.AddressZero,
PRICE_FEED_2 || ethers.constants.AddressZero,
TREASURY,
DRAWER
]);

console.log(proxy.address);
}

main();
16 changes: 16 additions & 0 deletions scripts/deploy-proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ethers, upgrades } from 'hardhat';
import * as assert from 'assert';

const { NAME } = process.env;

async function main() {
assert.ok(NAME);

const contractFactory = await ethers.getContractFactory(NAME);

const proxy = await upgrades.deployProxy(contractFactory);

console.log(proxy.address);
}

main();
16 changes: 16 additions & 0 deletions scripts/prepare-upgrade-proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ethers, upgrades } from 'hardhat';
import * as assert from 'assert';

const { NAME, PROXY_ADDRESS } = process.env;

async function main() {
assert.ok(NAME && PROXY_ADDRESS);

const contractFactory = await ethers.getContractFactory(NAME);

const upgrade = await upgrades.prepareUpgrade(PROXY_ADDRESS, contractFactory);

console.info(upgrade);
}

main();
14 changes: 14 additions & 0 deletions scripts/upgrade-proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ethers, upgrades } from 'hardhat';
import * as assert from 'assert';

const { NAME, PROXY_ADDRESS } = process.env;

async function main() {
assert.ok(NAME && PROXY_ADDRESS);

const contractFactory = await ethers.getContractFactory(NAME);

await upgrades.upgradeProxy(PROXY_ADDRESS, contractFactory);
}

main();

0 comments on commit 1819fbb

Please sign in to comment.