Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NETWORK=mainnet
INFURA_KEY=
ETHERSCAN_KEY=
RPC_URL_MAINNET=https://${NETWORK}.infura.io/v3/${INFURA_KEY}
7 changes: 6 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Unit tests
strategy:
matrix:
node: ['10.x', '12.x']
node: ['18.x']

runs-on: ubuntu-latest

Expand All @@ -34,6 +34,11 @@ jobs:
restore-keys: |
yarn-

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn install --frozen-lockfile

Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.env
dist
node_modules
.DS_Store
.DS_Store
out/
cache/
.vscode/settings.json
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/morphous"]
path = lib/morphous
url = https://github.com/morphous-xyz/morphous
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.13.0
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"workbench.colorCustomizations": {
"activityBar.background": "#3D2A06",
"titleBar.activeBackground": "#563B08",
"titleBar.activeForeground": "#FEF9F1"
}
}
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
default:; yarn lint:fix && yarn build
include .env

test:; yarn test
build:; yarn build
default:; forge fmt && forge test

.EXPORT_ALL_VARIABLES:
FOUNDRY_ETH_RPC_URL=$(RPC_URL_MAINNET)

test:; yarn test && forge test
build:; yarn lint:fix && yarn build
15 changes: 15 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[profile.default]
verbosity = 3
solc = "0.8.20"
evm_version = "shanghai"
src = "tests/forge"
libs = ["node_modules", "lib"]
fs_permissions = [{ access = "read", path = "./tests/forge/test-calldata.json"}]

remappings = [
"morphous=lib/morphous/src",
]

[fmt]
tab-width = 4
line-length = 120
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at e8a047
1 change: 1 addition & 0 deletions lib/morphous
Submodule morphous added at 4a1a44
1 change: 1 addition & 0 deletions lib/solmate
Submodule solmate added at 2001af
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,35 @@
"files": [
"dist"
],
"type": "module",
"scripts": {
"lint": "tsdx lint src",
"lint:fix": "tsdx lint src --fix",
"format": "rome format --write . ",
"build": "tsdx build",
"start": "tsdx watch",
"test": "tsdx test --passWithNoTests",
"test": "vitest --run",
"prepublishOnly": "tsdx build"
},
"dependencies": {
"@ethersproject/address": "^5.0.0",
"@ethersproject/solidity": "^5.0.0",
"axios": "^1.2.1",
"ethers": "^5.7.2"
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
"node-fetch": "^3.3.1",
"prettier": "^2.8.8",
"viem": "^0.3.31"
},
"devDependencies": {
"tsdx": "^0.14.1"
"@viem/anvil": "^0.0.5",
"@vitest/coverage-c8": "^0.31.1",
"@vitest/ui": "^0.31.1",
"rome": "12.1.2",
"tsdx": "^0.14.1",
"vite": "^4.3.8",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.31.0"
},
"engines": {
"node": ">=10"
Expand Down
12 changes: 12 additions & 0 deletions rome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://docs.rome.tools/schemas/12.1.2/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
133 changes: 133 additions & 0 deletions src/abi/aggregatorsModule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
[
{
"inputs": [
{
"internalType": "contract Logger",
"name": "logger",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "INVALID_AGGREGATOR",
"type": "error"
},
{
"inputs": [],
"name": "SWAP_FAILED",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "INCH_ROUTER",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ZERO_EX_ROUTER",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "aggregator",
"type": "address"
},
{
"internalType": "address",
"name": "srcToken",
"type": "address"
},
{
"internalType": "address",
"name": "destToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "underlyingAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
}
],
"name": "exchange",
"outputs": [
{
"internalType": "uint256",
"name": "received",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
24 changes: 12 additions & 12 deletions src/abi/dsProxy.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"constant": false,
"inputs": [
{ "name": "_target", "type": "address" },
{ "name": "_data", "type": "bytes" }
],
"name": "execute",
"outputs": [{ "name": "response", "type": "bytes32" }],
"payable": true,
"stateMutability": "payable",
"type": "function"
}
{
"constant": false,
"inputs": [
{ "name": "_target", "type": "address" },
{ "name": "_data", "type": "bytes" }
],
"name": "execute",
"outputs": [{ "name": "response", "type": "bytes32" }],
"payable": true,
"stateMutability": "payable",
"type": "function"
}
]
Loading