Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
INFURA_API_KEY = "infura_api_key"
ETHERSCAN_API_KEY = "etherscan_api_key"
WALLET_PRIVATE_KEY = "wallet_private_key"
REPORT_GAS=true
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: build
run: npm run compile
- name: upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: artifacts
path: artifacts/contracts
7 changes: 1 addition & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ jobs:
ssh-private-key: ${{ secrets.PRIVATE_SSH }}
- name: install
run: npm ci
- name: test+coverage
run: npm run coverage
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
- name: upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Automated Contract Deployment
name: deploy

on:
workflow_dispatch:
Expand Down
65 changes: 0 additions & 65 deletions .github/workflows/techdocs.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,3 @@ jobs:
ssh-private-key: ${{ secrets.PRIVATE_SSH }}
- name: install
run: npm ci
- name: test
run: npm run test
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
typechain-types/
.idea/
.vscode/
build/
Expand Down
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
balance: '0x56BC75E2D63100000',
},
],
fork: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
fork: `https://rpc.zerion.io/v1/ethereum`,
gasLimit: 0x1fffffffffffff,
},
mocha: {
Expand Down
24 changes: 12 additions & 12 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"extends": "solhint:all",
"plugins": ["prettier"],
"rules": {
"mark-callable-contracts": ["off"],
"reason-string": ["error", { "maxLength": 50 }],
"function-max-lines": ["error", 99],
"max-line-length": ["off"],
"max-line-length": "off",
"compiler-version": ["error", "0.8.12"],
"private-vars-leading-underscore": ["off"],
"const-name-snakecase": ["off"],
"private-vars-leading-underscore": "off",
"const-name-snakecase": "off",
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"prettier/prettier": "warn",
"comprehensive-interface": ["off"],
"foundry-test-functions": ["off"],
"gas-small-strings": ["off"],
"gas-increment-by-one": ["off"],
"func-named-parameters": ["off"],
"gas-custom-errors": ["off"],
"named-parameters-mapping": ["off"],
"gas-indexed-events": ["off"]
"comprehensive-interface": "off",
"foundry-test-functions": "off",
"gas-small-strings": "off",
"gas-increment-by-one": "off",
"func-named-parameters": "off",
"gas-custom-errors": "off",
"named-parameters-mapping": "off",
"gas-indexed-events": "off",
"use-natspec": "off"
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ See the `hardhat.config.ts` file for the details (`etherscan` field of `config`
The **Router** contract and its dependencies is fully covered with tests.

Run `npm run test` and `npm run coverage` to run tests or coverage respectively.
`INFURA_API_KEY` filled in `.env` file is required for this step.
`REPORT_GAS` filled in `.env` file enables/disables gas reports during tests.

### Linting
Expand Down
4 changes: 2 additions & 2 deletions contracts/router/SignatureVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import { UsedHash } from "../shared/Errors.sol";
import { AbsoluteTokenAmount, Fee, Input, Permit, SwapDescription, TokenAmount } from "../shared/Structs.sol";

contract SignatureVerifier is ISignatureVerifier, EIP712 {
mapping(bytes32 => bool) private isHashUsed_;

bytes32 internal constant ACCOUNT_SIGNATURE_TYPEHASH =
keccak256(
abi.encodePacked(
Expand Down Expand Up @@ -105,6 +103,8 @@ contract SignatureVerifier is ISignatureVerifier, EIP712 {
bytes32 internal constant TOKEN_AMOUNT_TYPEHASH =
keccak256(abi.encodePacked("TokenAmount(address token,uint256 amount,uint8 amountType)"));

mapping(bytes32 => bool) private isHashUsed_;

/**
* @param name String with EIP712 name.
* @param version String with EIP712 version.
Expand Down
27 changes: 27 additions & 0 deletions contracts/test/MockCaller.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: LGPL-3.0-only

pragma solidity 0.8.12;

import { ICaller } from "../interfaces/ICaller.sol";
import { TokensHandler } from "../shared/TokensHandler.sol";

contract MockCaller is ICaller, TokensHandler {
function callBytes(bytes calldata) external pure override {
return;
}
}
12 changes: 12 additions & 0 deletions contracts/test/MockERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MockERC20 is ERC20 {
constructor(string memory name, string memory symbol) ERC20(name, symbol) {}

function mint(address to, uint256 amount) external {
_mint(to, amount);
}
}
43 changes: 43 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// ESLint flat config for ESLint v9+

/** @type {import('eslint').Linter.FlatConfig[]} */
module.exports = [
{
ignores: [
'node_modules',
'coverage',
'artifacts',
'build',
'docs',
'typechain-types', // Exclude generated types
],
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: require('@typescript-eslint/parser'),
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
},
rules: {
'indent': ['error', 2],
'no-undef': 'off',
'prefer-const': 'off',
'no-console': 'off',
'linebreak-style': 'off',
'operator-linebreak': 'off',
'object-curly-newline': 'off',
'arrow-body-style': 'off',
...require('@typescript-eslint/eslint-plugin').configs.recommended.rules,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
];
Loading
Loading