-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back incomplete compiler settings
- Loading branch information
1 parent
1136734
commit b6fde96
Showing
23 changed files
with
3,311 additions
and
2,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
import { ethers } from 'hardhat' | ||
import { ethers, upgrades } from 'hardhat' | ||
|
||
async function deployContract(name: string) { | ||
async function deployContract(name: string, proxy?: boolean, args?: Record<string, any>, options?: Record<string, any>) { | ||
if (!args) args = {} | ||
if (!options) options = {} | ||
const inputs = [] | ||
const factory = await ethers.getContractFactory(name) | ||
const contract = await factory.deploy() | ||
return await contract.deployed() | ||
if (proxy) { | ||
if (Object.keys(args).length) inputs.push([...Object.values(args)]) | ||
if (Object.keys(options).length) inputs.push(options) | ||
const proxy = await upgrades.deployProxy(factory, ...inputs) | ||
return await proxy.deployed() | ||
} else { | ||
if (Object.keys(args).length) inputs.push(...Object.values(args)) | ||
if (Object.keys(options).length) inputs.push(options) | ||
const contract = await factory.deploy(...inputs) | ||
return await contract.deployed() | ||
} | ||
} | ||
|
||
export { deployContract } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@casimir/zx-helpers", | ||
"private": true, | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"dev": "npx esno src/index.ts", | ||
"build": "esbuild src/index.ts --bundle --minify --sourcemap --platform=node --target=esnext --outfile=dist/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.38", | ||
"esbuild": "^0.15.9", | ||
"esno": "^0.16.3", | ||
"zx": "^7.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { $, ProcessOutput } from 'zx' | ||
|
||
async function getContainerPort(image: string, port: string) { | ||
const output = await $`docker port $(docker ps -a -q --filter ancestor=${image} --filter expose=${port} --format="{{.ID}}") ${port}` | ||
const path = parseStdout(output) | ||
return path.split(':')[1] | ||
} | ||
|
||
function parseStdout(output: ProcessOutput) { | ||
const { stdout } = output | ||
return stdout.replace('\n', '') | ||
} | ||
|
||
export { getContainerPort, parseStdout } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"strict": true, | ||
"preserveConstEnums": true, | ||
"noEmit": true, | ||
"sourceMap": false, | ||
"module": "CommonJS", | ||
"moduleResolution": "Node", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"include": [ | ||
"./src/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
import { deployContract } from '@casimir/hardhat-helpers' | ||
|
||
void async function () { | ||
|
||
process.env.MINIMUM_BLOCKS_BEFORE_LIQUIDATION = '100' | ||
process.env.OPERATOR_MAX_FEE_INCREASE = '3' | ||
process.env.SET_OPERATOR_FEE_PERIOD = '259200' // 3 days | ||
process.env.APPROVE_OPERATOR_FEE_PERIOD = '345600' // 4 days | ||
process.env.VALIDATORS_PER_OPERATOR_LIMIT = '2000' | ||
process.env.REGISTERED_OPERATORS_PER_ACCOUNT_LIMIT = '10' | ||
process.env.DECLARE_OPERATOR_FEE_PERIOD = '0' | ||
process.env.EXECUTE_OPERATOR_FEE_PERIOD = '86400' | ||
|
||
const ssvContractNames = ['SSVRegistry', 'SSVToken', 'SSVNetwork', 'SSVManager'] | ||
|
||
for (const name of ssvContractNames) { | ||
console.log(`Deploying ${name} contract...`) | ||
const { address, deployTransaction } = await deployContract(name) | ||
const { hash } = deployTransaction | ||
process.env[`${name.toUpperCase()}_ADDRESS`] = address | ||
console.log(`${name} contract deployed to ${address} (see hash ${hash})`) | ||
} | ||
process.exit(0) | ||
const name = 'SSVManager' | ||
const args = { | ||
linkTokenAddress: process.env.LINK_TOKEN_ADDRESS, | ||
ssvTokenAddress: process.env.SSV_TOKEN_ADDRESS, | ||
wethTokenAddress: process.env.WETH_TOKEN_ADDRESS | ||
} | ||
const options = {} | ||
const proxy = false | ||
const { address } = await deployContract(name, proxy, args, options) | ||
console.log(`${name} contract deployed to ${address}`) | ||
process.exit(0) | ||
}() |
Oops, something went wrong.