Skip to content

Commit

Permalink
add main config
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalgek committed Oct 23, 2024
1 parent 08d76d4 commit d12e33c
Show file tree
Hide file tree
Showing 7 changed files with 478 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@

#!.yarn/cache
.pnp.*

# npm, typescript
node_modules
dist

# Hardhat files
cache
artifacts

# IDE
.vscode

# MacOS
.DS_store

#
.env
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
70 changes: 70 additions & 0 deletions configs/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
rpcEth: https://mainnet.infura.io/v3/
rpcOpt: https://optimism-mainnet.infura.io/v3/

parameters:
- &agent "0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c"
- &lido "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
- &accountingOracle "0x852deD011285fe67063a08005c71a85690503Cee"
- &wstETH "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
- &stETH "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
- &l1EmergencyBreaksMultisig "0x73b047fe6337183A454c5217241D780a932777bD"
- &l2EmergencyBreaksMultisig "0x4Cf8fE0A4c2539F7EFDD2047d8A5D46F14613088"
- &l1CrossDomainMessenger "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1"
- &l2CrossDomainMessenger "0x4200000000000000000000000000000000000007"
- &l2GovernanceExecutor "0xEfa0dB536d2c8089685630fafe88CF7805966FC3"

deployParameters:
ethereum:
tokenRateNotifier:
lido: *lido
tokenRateNotifierOwner: *agent
opStackTokenRatePusher:
messenger: *l1CrossDomainMessenger
wstETH: *wstETH
accountingOracle: *accountingOracle
l2GasLimitForPushingTokenRate: 300000
tokenBridge:
proxyAdmin: *agent
bridgeAdmin: *agent
depositsEnabled: true
withdrawalsEnabled: true
depositsEnablers: [*agent]
depositsDisablers: [*agent, *l1EmergencyBreaksMultisig]
withdrawalsEnablers: [*agent]
withdrawalsDisablers: [*agent, *l1EmergencyBreaksMultisig]
optimism:
tokenRateOracle:
proxyAdmin: *l2GovernanceExecutor
oracleAdmin: *l2GovernanceExecutor
l2Messenger: *l2CrossDomainMessenger
tokenRateOutdatedDelay: 86400
maxAllowedL2ToL1ClockLag: 86400
maxAllowedTokenRateDeviationPerDayBp: 500
oldestRateAllowedInPauseTimeSpan: 86400
minTimeBetweenTokenRateUpdates: 3600
updateEnabled: true
updateDisablers: [*l2GovernanceExecutor]
updateEnablers: [*l2GovernanceExecutor, *l2EmergencyBreaksMultisig]
initialTokenRateValue:
initialTokenRateL1Timestamp:
nonRebasableToken:
proxyAdmin: *l2GovernanceExecutor
signingDomainVersion: 1
stETH:
proxyAdmin: *l2GovernanceExecutor
signingDomainVersion: 1
tokenBridge:
proxyAdmin: *l2GovernanceExecutor
bridgeAdmin: *l2GovernanceExecutor
depositsEnabled: true
withdrawalsEnabled: true
depositsEnablers: [*l2GovernanceExecutor]
depositsDisablers: [*l2GovernanceExecutor, *l2EmergencyBreaksMultisig]
withdrawalsEnablers: [*l2GovernanceExecutor]
withdrawalsDisablers: [*l2GovernanceExecutor, *l2EmergencyBreaksMultisig]






15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"name": "multichain-automaton",
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"scripts": {
"start": "ts-node src/deploy.ts"
},
"dependencies": {
"dotenv": "^16.4.5",
"ethers": "^6.13.4",
"yaml": "^2.6.0"
},
"devDependencies": {
"@types/node": "^22.7.8",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
}
}
68 changes: 68 additions & 0 deletions src/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import fs from "node:fs";
import path from "node:path";
import * as YAML from "yaml";

const YML = "yml";

const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);

function logError(arg: unknown) {
console.error(`ERROR: ${arg}`);
console.error();
console.trace();
}

function loadYamlConfig(stateFile: string) {
const file = path.resolve(stateFile);
const configContent = fs.readFileSync(file, "utf-8");
const reviver = (_: unknown, v: unknown) => {
return typeof v === "bigint" ? String(v) : v;
};

return YAML.parse(configContent, reviver, { schema: "core", intAsBigInt: true });
}

export async function main() {
console.log("start");


// 1. read master config
const config = loadYamlConfig("./configs/main.yaml");
console.log("config=",config);


const rpcEth = config["rpcEth"];

// 2. run on forks
// a. run forks (what params to use)
runHardhatForks(rpcEth);



// b. run relayer (params)
// c. lidol2.deploy L1
// notifier
// pusher
// l1bridge
// l2calldata:
// l2bridge
// tokenOracle
// wstETH
// stETH
// d. call gov execute

// check state-mate, tests
}

async function runHardhatForks(rpcEth: string) {
const { stdout, stderr } = await exec(`./lido-l2-with-steth/ts-node hardhat node:fork ${rpcEth} 8545`);
console.log('stdout:', stdout);
console.error('stderr:', stderr);
}


main().catch((error) => {
logError(error);
process.exitCode = 1;
});
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"outDir": "dist",
"baseUrl": ".",
"lib": ["es2023", "DOM"],
"module": "node16",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16"
},
"exclude": ["tests", "dist", "**/*spec.ts", "**/*mock.ts"]
}
Loading

0 comments on commit d12e33c

Please sign in to comment.