-
Notifications
You must be signed in to change notification settings - Fork 75
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
1 parent
8b2f8c4
commit a6b9675
Showing
13 changed files
with
802 additions
and
153 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
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,33 @@ | ||
module.exports = { | ||
env: { | ||
es2021: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
], | ||
overrides: [ | ||
{ | ||
env: { | ||
node: true, | ||
}, | ||
files: [".eslintrc.{js,cjs}"], | ||
parserOptions: { | ||
sourceType: "script", | ||
}, | ||
}, | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
}, | ||
plugins: ["@typescript-eslint"], | ||
|
||
// Add rule exceptions here if they are too onerous to comply with | ||
rules: { | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
}, | ||
}; |
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,8 @@ | ||
{ | ||
"printWidth": 80, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true | ||
} |
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,52 @@ | ||
export const RichAccounts = { | ||
0: { | ||
Account: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", | ||
PrivateKey: | ||
"0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110", | ||
}, | ||
1: { | ||
Account: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", | ||
PrivateKey: | ||
"0xac1e735be8536c6534bb4f17f06f6afc73b2b5ba84ac2cfb12f7461b20c0bbe3", | ||
}, | ||
2: { | ||
Account: "0x0D43eB5B8a47bA8900d84AA36656c92024e9772e", | ||
PrivateKey: | ||
"0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e", | ||
}, | ||
3: { | ||
Account: "0xA13c10C0D5bd6f79041B9835c63f91de35A15883", | ||
PrivateKey: | ||
"0x850683b40d4a740aa6e745f889a6fdc8327be76e122f5aba645a5b02d0248db8", | ||
}, | ||
4: { | ||
Account: "0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92", | ||
PrivateKey: | ||
"0xf12e28c0eb1ef4ff90478f6805b68d63737b7f33abfa091601140805da450d93", | ||
}, | ||
5: { | ||
Account: "0x4F9133D1d3F50011A6859807C837bdCB31Aaab13", | ||
PrivateKey: | ||
"0xe667e57a9b8aaa6709e51ff7d093f1c5b73b63f9987e4ab4aa9a5c699e024ee8", | ||
}, | ||
6: { | ||
Account: "0xbd29A1B981925B94eEc5c4F1125AF02a2Ec4d1cA", | ||
PrivateKey: | ||
"0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959", | ||
}, | ||
7: { | ||
Account: "0xedB6F5B4aab3dD95C7806Af42881FF12BE7e9daa", | ||
PrivateKey: | ||
"0x74d8b3a188f7260f67698eb44da07397a298df5427df681ef68c45b34b61f998", | ||
}, | ||
8: { | ||
Account: "0xe706e60ab5Dc512C36A4646D719b889F398cbBcB", | ||
PrivateKey: | ||
"0xbe79721778b48bcc679b78edac0ce48306a8578186ffcb9f2ee455ae6efeace1", | ||
}, | ||
9: { | ||
Account: "0xE90E12261CCb0F3F7976Ae611A29e84a6A85f424", | ||
PrivateKey: | ||
"0x3eb15da85647edd9a1159a4a13b9e7c56877c4eb33f614546d4db06a51868b1c", | ||
}, | ||
} as const; |
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,64 @@ | ||
import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; | ||
import { expect } from "chai"; | ||
import { Contract, Provider } from "zksync-web3"; | ||
import * as hre from "hardhat"; | ||
import { HttpNetworkUserConfig } from "hardhat/types"; | ||
|
||
/** | ||
* * Deploy a contract using HardHat Deployer | ||
* | ||
* @param {Deployer} deployer - HardHat Deployer | ||
* @param {string} contractName - Name of the contract, without file extension e.g. "Greeter" | ||
* @param {string[]?} args - Optional arguments to pass to the contract constructor | ||
* | ||
* | ||
* @returns {Promise<Contract>} Returns a promise that resolves to the deployed contract | ||
* @example | ||
* const greeter = await deployContract(deployer, 'Greeter', ['Hi']); | ||
*/ | ||
export async function deployContract( | ||
deployer: Deployer, | ||
contractName: string, | ||
args: string[] = [] | ||
): Promise<Contract> { | ||
const artifact = await deployer.loadArtifact(contractName); | ||
return await deployer.deploy(artifact, args); | ||
} | ||
|
||
export function getTestProvider(): Provider { | ||
const network = hre.userConfig.networks?.zkSyncTestnet; | ||
return new Provider((network as HttpNetworkUserConfig).url); | ||
} | ||
|
||
/** | ||
* * Helper for validating error thrown contains string | ||
* | ||
* @param {any} method - Async function to be executed | ||
* @param {string} errorMessage - String to be searched for in error message | ||
* | ||
* | ||
* @returns {Promise<void>} Returns an empty promise | ||
* @example | ||
* const action = async () => { | ||
* await doSomething(); | ||
* throw new Error("Error: Failure 100"); | ||
* }; | ||
* await expectThrowsAsync(action, "Failure 100"); | ||
*/ | ||
export async function expectThrowsAsync( | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
method: Function, | ||
errorMessage: string | ||
): Promise<void> { | ||
let error = null; | ||
try { | ||
await method(); | ||
} catch (err) { | ||
error = err; | ||
} | ||
|
||
expect(error).to.be.an("Error"); | ||
if (errorMessage) { | ||
expect((error as Error).message).to.include(errorMessage); | ||
} | ||
} |
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,26 +1,39 @@ | ||
{ | ||
"name": "era-test-node-e2e-tests", | ||
"private": true, | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "The Matter Labs Team <hello@matterlabs.dev>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@matterlabs/hardhat-zksync-deploy": "^0.6.5", | ||
"@matterlabs/hardhat-zksync-solc": "^0.4.2", | ||
"@nomiclabs/hardhat-etherscan": "^3.1.7", | ||
"@openzeppelin/contracts": "^4.9.3", | ||
"@types/chai": "^4.3.4", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^18.17.12", | ||
"@typescript-eslint/eslint-plugin": "latest", | ||
"@typescript-eslint/parser": "latest", | ||
"chai": "^4.3.7", | ||
"eslint": "^8.48.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"ethers": "^5.7.2", | ||
"hardhat": "^2.12.4", | ||
"mocha": "^10.2.0", | ||
"mocha-multi": "^1.1.7", | ||
"prettier": "^3.0.3", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.4", | ||
"zksync-web3": "^0.14.3" | ||
}, | ||
"scripts": { | ||
"test": "hardhat test --network zkSyncTestnet" | ||
"build": "hardhat compile", | ||
"clean": "hardhat clean", | ||
"fmt": "prettier --check \"**/*.{js,ts,md}\"", | ||
"fmt:fix": "prettier --write \"**/*.{js,ts,md}\"", | ||
"lint": "eslint . --ext .ts", | ||
"lint:fix": "eslint . --fix --ext .ts", | ||
"test": "hardhat test --network zkSyncTestnet", | ||
"typecheck": "tsc -p . --noEmit" | ||
} | ||
} |
Oops, something went wrong.