Skip to content

Commit

Permalink
chore: Update deployment scripts to be configurable for mainnet or te…
Browse files Browse the repository at this point in the history
…stnet chains (#31)
  • Loading branch information
rbajollari authored Apr 10, 2024
1 parent f118304 commit abb3821
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
PRIVATE_KEY=yourprivatekeyhere
CONTRACT_KEY=yourkeyhere
MAINNET=FALSE
OJO_CONTRACT_ADDRESS=0x0
AXELAR_GAS_RECEIVER_ADDRESS=0x2d5d7d31F671F86C782533cc367F14109a082712
CREATE2_DEPLOYER_ADDRESS=0x98b2920d53612483f91f12ed7754e51b4a77919e
OJO_CHAIN=ojo
OJO_ADDRESS=ojo1es9mhmnunh208ucwq8rlrl97hqulxrz8k37dcu
RESOLVE_WINDOW=7200
ASSET_LIMIT=5
23 changes: 23 additions & 0 deletions mainnet_chains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "Abritrum",
"chainId": 42161,
"gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31",
"rpc": "https://arbitrum-mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
"tokenSymbol": "ETH"
},
{
"name": "Optimism",
"chainId": 10,
"gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31",
"rpc": "https://optimism-mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
"tokenSymbol": "ETH"
},
{
"name": "Base",
"chainId": 8453,
"gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31",
"rpc": "https://developer-access-mainnet.base.org",
"tokenSymbol": "ETH"
}
]
22 changes: 14 additions & 8 deletions scripts/deployOjo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ import { Wallet, ethers } from "ethers";
import Ojo from '../artifacts/contracts/Ojo.sol/Ojo.json';
import OjoProxy from '../artifacts/contracts/OjoProxy.sol/OjoProxy.json';
import testnet_chains from '../testnet_chains.json';
import mainnet_chains from '../mainnet_chains.json';
import { deployCreate2InitUpgradable } from './utils/upgradable';

async function main() {
const axelarGasReceiverAddress = "0xbE406F0189A0B4cf3A05C286473D23791Dd44Cc6";
const create2DeployerAddress = "0x98b2920d53612483f91f12ed7754e51b4a77919e";
const ojoChain = "ojo";
const ojoAddress = "ojo1es9mhmnunh208ucwq8rlrl97hqulxrz8k37dcu";
const resolveWindow = 7200;
const assetLimit = 5;
const axelarGasReceiverAddress = process.env.AXELAR_GAS_RECEIVER_ADDRESS;
const create2DeployerAddress = process.env.CREATE2_DEPLOYER_ADDRESS;
const ojoChain = process.env.OJO_CHAIN;
const ojoAddress = process.env.OJO_ADDRESS;
const resolveWindow = Number(process.env.RESOLVE_WINDOW);
const assetLimit = Number(process.env.ASSET_LIMIT);

const privateKey = process.env.PRIVATE_KEY;

if (!privateKey) {
throw new Error('Invalid private key. Make sure the PRIVATE_KEY environment variable is set.');
}

const evmChains = testnet_chains.map((chain) => ({ ...chain }));
const key = Date.now();
const mainnet = Boolean(process.env.MAINNET)
let evmChains = testnet_chains.map((chain) => ({ ...chain }));
if (mainnet === true) {
evmChains = mainnet_chains.map((chain) => ({ ...chain }));
}

const key = Number(process.env.PRIVATE_KEY);

for (const chain of evmChains) {
const provider = new ethers.JsonRpcProvider(chain.rpc)
Expand Down
11 changes: 8 additions & 3 deletions scripts/upgradeOjo.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import { Wallet, ethers } from "ethers";
import Ojo from '../artifacts/contracts/Ojo.sol/Ojo.json';
import testnet_chains from '../testnet_chains.json';
import mainnet_chains from '../mainnet_chains.json';
import { upgradeUpgradable } from './utils/upgradable';

async function main() {
const ojoProxyAddress = "0x4C49Bca23BB402e4938B59Af14f17FA8178c1BA3";
const axelarGasReceiverAddress = "0xbE406F0189A0B4cf3A05C286473D23791Dd44Cc6";
const ojoProxyAddress = process.env.OJO_CONTRACT_ADDRESS;
const axelarGasReceiverAddress = process.env.AXELAR_GAS_RECEIVER_ADDRESS;

const privateKey = process.env.PRIVATE_KEY;

if (!privateKey) {
throw new Error('Invalid private key. Make sure the PRIVATE_KEY environment variable is set.');
}

const evmChains = testnet_chains.map((chain) => ({ ...chain }));
const mainnet = Boolean(process.env.MAINNET)
let evmChains = testnet_chains.map((chain) => ({ ...chain }));
if (mainnet === true) {
evmChains = mainnet_chains.map((chain) => ({ ...chain }));
}

for (const chain of evmChains) {
const provider = new ethers.JsonRpcProvider(chain.rpc)
Expand Down

0 comments on commit abb3821

Please sign in to comment.