Skip to content

Commit

Permalink
fixes minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yathishram committed Apr 13, 2022
1 parent f760d4e commit b00a3b3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 56 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const R = require('ramda');
const chalk = require('chalk');
const { network, arbitratorContract, arbitrableContract, arbitrationFee, arbitratorAddress } = require('../constants');
const networks = require('../src/utils/networks.js');
const networks = require('../src/utils/networks.json');

const abiEncodeArgs = (deployed, contractArgs) => {
if (!contractArgs || !deployed || !R.hasPath(['interface', 'deploy'], deployed)) return '';
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Arbitrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Contract } from '@ethersproject/contracts';
import { BigNumber } from '@ethersproject/bignumber';
import { formatEther } from '@ethersproject/units';
import { Logger } from '@ethersproject/logger';
import networks from '../utils/networks';
import networks from '../utils/networks.json';
import data from '../abis/AutoAppealableArbitrator.json';
import { JsonRpcProvider } from '@ethersproject/providers';

Expand Down
6 changes: 4 additions & 2 deletions src/contracts/SafientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { BigNumber } from '@ethersproject/bignumber';
import { formatEther, parseEther } from '@ethersproject/units';
import { Logger } from '@ethersproject/logger';
import { Bytes } from 'ethers';
import networks from '../utils/networks';
import networks from '../utils/networks.json';
import {getNetworkUrl} from "../utils/networks"
import data from '../abis/SafientMain.json';

/**
Expand Down Expand Up @@ -55,7 +56,8 @@ export class SafientMain {

const network = Object.values(networks).find((network) => chainId === network.chainId);

this.provider = new JsonRpcProvider(network?.url)
const networkUrl = getNetworkUrl(chainId)
this.provider = new JsonRpcProvider(networkUrl)

network !== undefined && network.addresses.SafientMain !== ''
? (this.safientMainAddress = network.addresses.SafientMain)
Expand Down
65 changes: 21 additions & 44 deletions src/utils/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,31 @@ dotenv.config()


const networks = {
"localhost": {
"chainId": 31337,
"url": "http://localhost:8545",
"addresses": {
"AutoAppealableArbitrator": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"SafientMain": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
}
localhost: {
chainId: 31337,
url: 'http://localhost:8545',
},
"mainnet": {
"chainId": 1,
"url": `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
"addresses": {
"AutoAppealableArbitrator": "",
"SafientMain": ""
}
mainnet: {
chainId: 1,
url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
},
"rinkeby": {
"chainId": 4,
"url": "",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0x2fF492C5D9d071a2bed17e30418aF128f22e42fA"
}
kovan: {
chainId: 42,
url: `https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`,

},
"kovan": {
"chainId": 42,
"url": `https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`,
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xF88915c8762aB973b64086221cDFd20Ec104F732"
}
polygontestnet: {
chainId: 80001,
url: 'https://matic-mumbai.chainstacklabs.com',
},
"ropsten": {
"chainId": 3,
"url": "",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xC0B0591Eac7887F443cef0f28BB818E454eD6637"
}
polygon : {
chainId: 137,
url: 'https://matic-mumbai.chainstacklabs.com',

},
"polygontestnet": {
"chainId": 80001,
"url": `https://matic-mumbai.chainstacklabs.com`,
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xccA53824ce8944a3cB7b21139bd177DEEe6e27C0"
}
}
}

module.exports = networks
export const getNetworkUrl = (chainId) => {
const network = Object.values(networks).find(network => chainId === network.chainId);
return network.url
}
10 changes: 2 additions & 8 deletions src/utils/networks.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,41 @@
{
"localhost": {
"chainId": 31337,
"url": "http://localhost:8545",
"addresses": {
"AutoAppealableArbitrator": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"SafientMain": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
"AutoAppealableArbitrator": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"SafientMain": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"
}
},
"mainnet": {
"chainId": 1,
"url": "https://mainnet.infura.io/v3/undefined",
"addresses": {
"AutoAppealableArbitrator": "",
"SafientMain": ""
}
},
"rinkeby": {
"chainId": 4,
"url": "",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0x2fF492C5D9d071a2bed17e30418aF128f22e42fA"
}
},
"kovan": {
"chainId": 42,
"url": "https://kovan.infura.io/v3/undefined",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xF88915c8762aB973b64086221cDFd20Ec104F732"
}
},
"ropsten": {
"chainId": 3,
"url": "",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xC0B0591Eac7887F443cef0f28BB818E454eD6637"
}
},
"polygontestnet": {
"chainId": 80001,
"url": "https://matic-mumbai.chainstacklabs.com",
"addresses": {
"AutoAppealableArbitrator": "0xf54D6b97749ECD28F9EbF836Ed9cE0C387a2f0A1",
"SafientMain": "0xccA53824ce8944a3cB7b21139bd177DEEe6e27C0"
Expand Down

0 comments on commit b00a3b3

Please sign in to comment.