feature: add madison network

buddies-main-deployment
James Prestwich 4 years ago
parent c3c1c184d9
commit 66b7b95b07
No known key found for this signature in database
GPG Key ID: 75A7F5C06D747046
  1. 6
      .madison.env
  2. 18
      solidity/optics-core/hardhat.config.js
  3. 18
      solidity/optics-core/lib/index.js
  4. 43
      solidity/optics-core/package-lock.json
  5. 3
      solidity/optics-core/package.json
  6. 4
      solidity/optics-core/scripts/deploy.js
  7. 6
      solidity/optics-core/scripts/process.js
  8. 4
      solidity/optics-core/scripts/update.js

@ -0,0 +1,6 @@
MADISON_RPC_USER=witcher
MADISON_RPC_PASS=tossAcelo2Cross
MADISON_RPC_URL=madisonbridge.net
MADISON_PRIVKEY=c06c61f97cd0367dac2fa13ccfbae53cb2728822832682a280f6677be8f52396

@ -4,6 +4,18 @@ require('solidity-coverage');
require('./lib');
require('./scripts');
const path = require('path');
require('dotenv').config({
path: path.resolve(process.cwd(), '../../.madison.env'),
});
const {
MADISON_RPC_USER,
MADISON_RPC_PASS,
MADISON_RPC_URL,
MADISON_PRIVKEY,
} = process.env;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
@ -26,5 +38,11 @@ module.exports = {
localhost: {
url: 'http://localhost:8545',
},
madison: {
gasPrice: 1,
chainId: 29739,
url: `http://${MADISON_RPC_USER}:${MADISON_RPC_PASS}@${MADISON_RPC_URL}`,
accounts: [MADISON_PRIVKEY],
},
},
};

@ -1,12 +1,12 @@
require('@nomiclabs/hardhat-waffle');
const { assert } = require('chai');
const ethers = require('ethers');
const { extendEnvironment } = require('hardhat/config');
const HomeAbi = require('../../../abis/Home.abi.json');
const ReplicaAbi = require('../../../abis/ProcessingReplica.abi.json');
extendEnvironment((hre) => {
let { ethers } = hre;
const State = {
ACTIVE: 0,
FAILED: 1,
@ -112,11 +112,6 @@ extendEnvironment((hre) => {
}
}
const getHomeFactory = async (...args) =>
ethers.getContractFactory('Home', ...args);
const getReplicaFactory = async (...args) =>
ethers.getContractFactory('ProcessingReplica', ...args);
const formatMessage = (
originDomain,
senderAddr,
@ -171,15 +166,18 @@ extendEnvironment((hre) => {
messageToLeaf,
ethersAddressToBytes32,
destinationAndSequence,
getHomeFactory,
getReplicaFactory,
deployHome: async (signer, ...args) => {
let contract = await (await getHomeFactory(signer)).deploy(...args);
const factory = await ethers.getContractFactory('Home', signer);
let contract = await factory.deploy(...args);
await contract.deployed();
return new Home(contract.address, signer);
},
deployReplica: async (signer, ...args) => {
let contract = await (await getReplicaFactory(signer)).deploy(...args);
const factory = await ethers.getContractFactory(
'ProcessingReplica',
signer,
);
let contract = await factory.deploy(...args);
await contract.deployed();
return new Replica(contract.address, signer);
},

@ -10,7 +10,8 @@
"license": "MIT OR Apache-2.0",
"dependencies": {
"@openzeppelin/contracts": "^3.4.0",
"@summa-tx/memview-sol": "^1.1.1"
"@summa-tx/memview-sol": "^1.1.1",
"dotenv": "^8.2.0"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.1",
@ -3204,6 +3205,14 @@
"version": "0.1.2",
"dev": true
},
"node_modules/dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
"engines": {
"node": ">=8"
}
},
"node_modules/drbg.js": {
"version": "1.0.1",
"dev": true,
@ -11972,6 +11981,20 @@
"verror": "1.10.0"
}
},
"node_modules/ganache-core/node_modules/keccak": {
"version": "3.0.1",
"dev": true,
"hasInstallScript": true,
"inBundle": true,
"license": "MIT",
"dependencies": {
"node-addon-api": "^2.0.0",
"node-gyp-build": "^4.2.0"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/ganache-core/node_modules/keyv": {
"version": "3.1.0",
"dev": true,
@ -12536,6 +12559,7 @@
"node_modules/ganache-core/node_modules/node-addon-api": {
"version": "2.0.2",
"dev": true,
"inBundle": true,
"license": "MIT"
},
"node_modules/ganache-core/node_modules/node-fetch": {
@ -12549,6 +12573,7 @@
"node_modules/ganache-core/node_modules/node-gyp-build": {
"version": "4.2.3",
"dev": true,
"inBundle": true,
"license": "MIT",
"bin": {
"node-gyp-build": "bin.js",
@ -25119,6 +25144,11 @@
"version": "0.1.2",
"dev": true
},
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
},
"drbg.js": {
"version": "1.0.1",
"dev": true,
@ -31846,6 +31876,15 @@
"verror": "1.10.0"
}
},
"keccak": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"requires": {
"node-addon-api": "^2.0.0",
"node-gyp-build": "^4.2.0"
}
},
"keyv": {
"version": "3.1.0",
"dev": true,
@ -32270,6 +32309,7 @@
},
"node-addon-api": {
"version": "2.0.2",
"bundled": true,
"dev": true
},
"node-fetch": {
@ -32278,6 +32318,7 @@
},
"node-gyp-build": {
"version": "4.2.3",
"bundled": true,
"dev": true
},
"normalize-url": {

@ -33,6 +33,7 @@
"license": "MIT OR Apache-2.0",
"dependencies": {
"@openzeppelin/contracts": "^3.4.0",
"@summa-tx/memview-sol": "^1.1.1"
"@summa-tx/memview-sol": "^1.1.1",
"dotenv": "^8.2.0"
}
}

@ -11,7 +11,7 @@ task('deploy-home', 'Deploy a home.')
)
.setAction(async (args) => {
let address = ethers.utils.getAddress(args.sortition);
let signer = ethers.getSigner();
let [signer] = await ethers.getSigners();
let home = await optics.deployHome(signer, args.domain, address);
console.log(home.address);
});
@ -49,7 +49,7 @@ task('deploy-replica', 'Deploy a replica.')
throw new Error('current must be a 32-byte 0x prefixed hex string');
}
let signer = ethers.getSigner();
let [signer] = await ethers.getSigners();
await optics.deployReplica(
signer,

@ -31,7 +31,7 @@ task('prove', 'Prove a message inclusion to a replica')
throw new Error('newRoot must be a 0x prefixed hex string');
}
let signer = await ethers.getSigner();
let [signer] = await ethers.getSigners();
let replica = new optics.Replica(address, signer);
// preflight
@ -68,7 +68,7 @@ task('process', 'Process a message that has been proven to a replica')
throw new Error('newRoot must be a 0x prefixed hex string');
}
let signer = await ethers.getSigner();
let [signer] = await ethers.getSigners();
let replica = new optics.Replica(address, signer);
try {
@ -111,7 +111,7 @@ task('prove-and-process', 'Prove and process a message')
throw new Error('message must be a 0x prefixed hex string');
}
let signer = await ethers.getSigner();
let [signer] = await ethers.getSigners();
let replica = new optics.Replica(address, signer);
try {

@ -16,7 +16,7 @@ task('submit-update', 'Submit an update to a home or replica contract.')
let { newRoot, oldRoot, signature } = args;
let update = await utils.validateUpdate(newRoot, oldRoot, signature);
let signer = await ethers.getSigner();
let [signer] = await ethers.getSigners();
// we should be able to use home for either. Consider moving this to common?
let contract = new optics.Home(address, signer);
@ -51,7 +51,7 @@ task('submit-double-update', 'Submit a double update to a home or replica.')
let update1 = await utils.validateUpdate(newRoot1, oldRoot1, signature1);
let update2 = await utils.validateUpdate(newRoot2, oldRoot2, signature2);
let signer = await ethers.getSigner();
let [signer] = await ethers.getSigners();
let contract = new optics.Common(address, signer);
let tx = await contract.submitDoubleUpdate(update1, update2);

Loading…
Cancel
Save