-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
9,164 additions
and
329 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Address } from "@morpho-org/blue-sdk"; | ||
|
||
export class InvalidSignatureError extends Error { | ||
constructor( | ||
public readonly hash: string, | ||
public readonly signer: Address, | ||
public readonly recovered: Address, | ||
) { | ||
super( | ||
`invalid signature for hash ${hash}: expected ${signer}, recovered ${recovered}`, | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
MAINNET_RPC_URL= | ||
BASE_RPC_URL= |
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,69 @@ | ||
import "dotenv/config"; | ||
import "hardhat-deal"; | ||
import { HardhatUserConfig } from "hardhat/config"; | ||
import { HardhatNetworkUserConfig } from "hardhat/types"; | ||
|
||
import "@nomicfoundation/hardhat-chai-matchers"; | ||
import "@nomicfoundation/hardhat-ethers"; | ||
import "@nomicfoundation/hardhat-network-helpers"; | ||
|
||
import { ChainId, addresses } from "@morpho-org/blue-sdk"; | ||
|
||
const hardhatNetworkConfigs: Record<string, HardhatNetworkUserConfig> = { | ||
ethereum: { | ||
chainId: 1, | ||
forking: { | ||
url: process.env.MAINNET_RPC_URL!, | ||
blockNumber: 19_750_000, | ||
}, | ||
}, | ||
base: { | ||
chainId: 8453, | ||
forking: { | ||
url: process.env.BASE_RPC_URL!, | ||
blockNumber: 16_260_000, | ||
}, | ||
}, | ||
}; | ||
|
||
const network = process.env.NETWORK || "ethereum"; | ||
const hardhatNetworkConfig = hardhatNetworkConfigs[network]; | ||
if (!hardhatNetworkConfig) throw Error(`invalid network: ${network}`); | ||
if (!hardhatNetworkConfig.forking?.url) | ||
throw Error(`no RPC url provided for network: ${network}`); | ||
|
||
const config: HardhatUserConfig = { | ||
networks: { | ||
hardhat: { | ||
gasPrice: 0, | ||
initialBaseFeePerGas: 0, | ||
allowUnlimitedContractSize: true, | ||
allowBlocksWithSameTimestamp: true, | ||
mining: { | ||
mempool: { | ||
order: "fifo", | ||
}, | ||
}, | ||
...hardhatNetworkConfig, | ||
}, | ||
}, | ||
paths: { | ||
tests: "./tests/e2e/", | ||
cache: "./cache", | ||
}, | ||
mocha: { | ||
timeout: 300000, | ||
reporterOptions: { | ||
maxDiffSize: 2 ** 16, | ||
}, | ||
fgrep: network, | ||
}, | ||
tracer: { | ||
nameTags: { | ||
[addresses[ChainId.EthMainnet].bundler]: "EthereumBundler", | ||
[addresses[ChainId.BaseMainnet].bundler]: "BaseBundler", | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
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,82 @@ | ||
{ | ||
"name": "@morpho-org/blue-sdk-viem-bundler", | ||
"version": "1.0.0", | ||
"author": "Morpho Association <contact@morpho.org>", | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "src/index.ts", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"prepublish": "yarn build", | ||
"build": "tsc --build tsconfig.build.json", | ||
"test": "hardhat test", | ||
"test-ethereum": "NETWORK=ethereum yarn test", | ||
"test-base": "NETWORK=base yarn test" | ||
}, | ||
"peerDependencies": { | ||
"@morpho-org/blue-sdk": "workspace:^", | ||
"@morpho-org/blue-sdk-viem": "workspace:^", | ||
"@morpho-org/blue-sdk-viem-simulation": "workspace:^", | ||
"@morpho-org/morpho-ts": "workspace:^", | ||
"mutative": "^1.0.8", | ||
"viem": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@morpho-org/blue-sdk": "workspace:^", | ||
"@morpho-org/blue-sdk-viem": "workspace:^", | ||
"@morpho-org/blue-sdk-viem-simulation": "workspace:^", | ||
"@morpho-org/morpho-test": "workspace:^", | ||
"@morpho-org/morpho-ts": "workspace:^", | ||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.2", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.6", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.9", | ||
"@types/chai": "^4.3.17", | ||
"@types/jest": "^29.5.12", | ||
"@types/lodash": "^4.17.7", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^22.2.0", | ||
"@types/sinon": "^17.0.3", | ||
"@types/sinon-chai": "^3.2.12", | ||
"chai": "^4.5.0", | ||
"dotenv": "^16.3.1", | ||
"ethers": "^6.12.1", | ||
"ethers-types": "^3.17.1", | ||
"hardhat": "^2.22.10", | ||
"hardhat-deal": "^3.1.0", | ||
"jest": "^29.6.2", | ||
"lodash": "^4.17.21", | ||
"mocha": "^10.4.0", | ||
"sinon": "^19.0.2", | ||
"sinon-chai": "^3.7.0", | ||
"ts-jest": "^29.2.4", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.6.2", | ||
"viem": "^2.21.15" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "lib/index.js" | ||
}, | ||
"jest": { | ||
"verbose": true, | ||
"testTimeout": 15000, | ||
"maxWorkers": 1, | ||
"transform": { | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
"tsconfig": "tsconfig.json" | ||
} | ||
] | ||
}, | ||
"testMatch": [ | ||
"**/*.test.ts" | ||
], | ||
"testPathIgnorePatterns": [ | ||
"node_modules/", | ||
"tests/e2e/" | ||
] | ||
} | ||
} |
Oops, something went wrong.