Skip to content

Commit

Permalink
feat: update oval node to support oval factory deployments (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
md0x authored Jul 31, 2024
2 parents 0460468 + 35bf78e commit aeb58ae
Show file tree
Hide file tree
Showing 26 changed files with 2,005 additions and 477 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "CI"

on:
workflow_dispatch:
pull_request:
push:
branches:
- "master"

jobs:
test:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
node-version: "20"

- name: "Install Yarn"
run: "npm install --global yarn"

- name: "Install Node.js dependencies"
run: "yarn install"

- name: "Create .env file"
run: |
echo 'PROVIDER_URL="https://mainnet.infura.io/v3/00000000000000000000000000000000"' > .env
echo 'PROVIDER_WSS="wss://mainnet.infura.io/ws/v3/00000000000000000000000000000000"' >> .env
echo 'FORWARD_URL="https://relay.flashbots.net"' >> .env
echo 'OVAL_CONFIGS="{"0x000000000000000000000000000000000000beef":{"unlockerKey":"0x000000000000000000000000000000000000000000000000000000000000beef","refundAddress":"0x000000000000000000000000000000000000beef","refundPercent":90}}"' >> .env
echo 'AUTH_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"' >> .env
echo 'MAINNET_BLOCK_OFFSET=5' >> .env
- name: "Run the tests"
run: "yarn test"

- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ build
*.log
.env
.DS_Store
out
out
src/contract-types
11 changes: 11 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"require": "ts-node/register",
"extension": [
"ts"
],
"spec": "test/**/*.ts",
"watch-files": [
"src/**/*.ts",
"test/**/*.ts"
]
}
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Define a `.env` file and define, at minimum, the following (see [here](./src/lib

```
OVAL_CONFIGS=<oval_configs_json> # JSON string that maps Oval contract addresses to their specific configurations (see below).
OVAL_CONFIGS_SHARED=<oval_configs_shared_json># JSON string for shared unlocker configurations (see below).
OVAL_ADDRESS=0x420 # (Only if not using OVAL_CONFIGS) The address of the Oval contract you want to target with the Oval Node.
REFUND_ADDRESS=0x42069 # (Only if not using OVAL_CONFIGS) The refund address you want to send the OEV kickback to.
REFUND_PERCENT=0.5 # (Only if not using OVAL_CONFIGS) The percentage of the OEV kickback to send to the refund address.
Expand All @@ -48,7 +49,6 @@ CHAIN_ID=<network_chain_id> # Chain ID of the Ethereum network

`OVAL_CONFIGS` is a JSON string that maps Oval contract addresses to their specific configurations. Each entry in this JSON object should have the following format:


```json
{
"<Oval_Contract_Address>": {
Expand All @@ -66,6 +66,19 @@ CHAIN_ID=<network_chain_id> # Chain ID of the Ethereum network
- `Refund_Address`: The Ethereum address where refunds will be sent.
- `Refund_Percentage`: The percentage of the OEV kickback to send to the refund address.

`OVAL_CONFIGS_SHARED` is a JSON string that specifies the shared unlocker configurations for all Oval contracts. Each entry in this JSON object should have the following format:

```json
[
{
"unlockerKey": "<Unlocker_Private_Key>", // Optional: Use either this or gckmsKeyId, not both.
"gckmsKeyId": "<GCKMS_Key_ID>", // Optional: Use either this or unlockerKey, not both.
},...
]
```

Note: If an Oval instance has an instance specific configuration, it will take precedence over the shared configuration.

### 2. Build & run the Oval Node:

Build the JS with:
Expand Down
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@types/uuid": "^9.0.8",
"@uma/logger": "^1.1.0",
"axios": "^1.5.1",
"bluebird": "^3.7.2",
"body-parser": "^1.20.2",
"ethers": "^6.8.0",
"express": "^4.18.2",
Expand All @@ -26,16 +27,27 @@
"typescript": "^5.2.2"
},
"devDependencies": {
"@typechain/ethers-v6": "^0.5.1",
"@types/bluebird": "^3.5.42",
"@types/chai": "^4.3.16",
"@types/eventsource": "^1.1.11",
"@types/mocha": "^10.0.7",
"@types/node": "^18.14.4",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"dotenv": "^16.3.1"
"chai": "^4.4.1",
"dotenv": "^16.3.1",
"mocha": "^10.6.0",
"sinon": "^18.0.0",
"typechain": "^8.3.2"
},
"scripts": {
"dev": "nodemon",
"build": "tsc",
"build": "yarn generate-contract-types && tsc",
"test": "yarn generate-contract-types && mocha",
"start": "node ./out/index.js",
"lint": "prettier './**/*.ts' --write"
"lint": "prettier './**/*.ts' --write",
"generate-contract-types": "rm -rf src/contract-types && mkdir -p src/contract-types && typechain --target ethers-v6 --out-dir src/contract-types 'src/abi/*.json'"
}
}
}
Loading

0 comments on commit aeb58ae

Please sign in to comment.