Skip to content

Commit

Permalink
Hebao v3 4337 audit (#2723)
Browse files Browse the repository at this point in the history
* first upload for hebao_v3

* add more tests

* fix testcases eip4337

* add proxy and create2

* add testcase of deplayed implementation manager

* add migration test

* add gas cost script on-chain

* add testcase of executing tx with paymaster

* fix bugs

* reversion

* add ut of walletfactory and eip4337

* add more ut

* add guardians ut

* add inheritor and quota

* multisign for userophash

* add gastank

* add ["fail without waiting period", "inherit with a owner in guardians group"] test cases

* add ut for smart wallet contract as signer

* add super guardian

* fix ut of guardian as smart wallet

* add "smart wallet guardians approval" testcase

* fix owner guardians conflict after inherit

* clean code

* fix bug

* add price oracle test

* remove execute and executeBatch api

* add ut for quota check

* remove ut at the same block

* add quota tests

* add testcase for core module of eip4337

* fix bug in inheritancelib

* fix bug

* add eip712 for guardian signature

* fix bug of deploy script

* add eip712

* remove super guardian feature

* fix deploy script

* fix bug of deploy scripts

* add more output comments in deploy script

* fix bug of deploy script and testcase

* fix deploy script

* add reentry attack testcases

* add etherum rpc

* fix bug of wallet proxy

* add license

* fix signature for wa

* fix user op hash (#2712)

* add event for paymaster

* fix bug of verification gaslimit estimation

* verify contracts code

* allow empty calldata

* add simulation

* entrypoint in wallet can be changed

* migrating to v0.6

* fix all bugs of uts

* skip nonce ut

* allowed to change entrypoint in paymaster

* add more admin operation for paymaster owner

* add salt for approvalhash and clean code

* clean code

* prettier code

* remove useless code

* add more helpful scripts

* verify contracts

* resolve dependences conflicts

* prettier code

* fix bug of contract verification

* fix bug of hardhat config

* save deployments as json file

* break deploy script to sperate files

* deploy sepolia successfully

* add gas tank test script

* add ut for wallet with empty guardians

* deploy to taiko6

* merge from trade agent

* add connectors and uts

* add prepare scripts

* add ut for flashloan

* fix bug of flashloan

* balancerv2 flashloanworks

* fix gasprice in taiko6

* optimize prepare scripts

* push tmp files

* optimize approval for connectors

* fix bug signature validation

* add ut for connectorRegistry

* add lido connector

* add eth leverage staking using flashloan

* add signature check for userop

* fix bug of verifymessage

* fix bug of eth leveraging staking

* reomve allowance check in paymaster

* fix bug of ut

* add script to estimate costofpost

* add test coverage

* fix solhint error

* fix solhint

* add loopring error codes

* fix some solhints errors

* fix all errors of solhint

* fix error codes

* fix bug

* add more uts

* deploy to goerli

* fix bug of contract verification

* update prettier tool

* deploy to sepolia

* fix bug of prepare script

* fix prepare script

* add taiko6 deployments info

* add typechain

* add event and test case

* unApproveExecutor rm require

* remove salt

* fix deployments

* support executor to be a contract

* add uts to use contract as a executor

* fix bug of reset guardian

* remove trash files

* add uniswapv3

* add 1inch connector

* fix audit bugs

* add zero address checks

* use calldata to avoid copy

* add more test

---------

Co-authored-by: liang xiong <liangxiong@okg.com>
Co-authored-by: breakpoint <kl456123@outlook.com>
Co-authored-by: john.li <john.li@loopring.io>
  • Loading branch information
4 people committed May 27, 2024
1 parent af9b28f commit 410571e
Show file tree
Hide file tree
Showing 206 changed files with 42,235 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ transpiled/
*.log
ganache_account_keys.txt
deployedAddresses.json
yarn.lock
.idea/
dist/
.env
8,971 changes: 8,971 additions & 0 deletions packages/hebao_v2/yarn.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/hebao_v3/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PRIVATE_KEY=
TEST_ACCOUNT_PRIVATE_KEY=
PAYMASTER_OWNER_PRIVATE_KEY=
BLANK_OWNER=
ETHERSCAN_API_KEY=
INFURA_API_KEY=
5 changes: 5 additions & 0 deletions packages/hebao_v3/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
artifacts
cache
coverage
typechain-types
67 changes: 67 additions & 0 deletions packages/hebao_v3/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
mocha: true,
node: true
},
globals: {
artifacts: false,
assert: false,
contract: false,
web3: false
},
extends: ['standard-with-typescript', 'prettier'],
// This is needed to add configuration to rules with type information
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json']
},
ignorePatterns: [
'.eslintrc.js',
'coverage',
'dist/',
'typechain-types'
],
rules: {
'no-console': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/require-array-sort-compare': [
'error',
{
ignoreStringArrays: true
}
]
},
overrides: [
{
files: '*',
rules: {
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/restrict-template-expressions': 'off'
}
},
{
files: ['**/test/**/*.ts'],
rules: {
'no-unused-expressions': 'off',
// chai assertions trigger this rule
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
}
},
{
// otherwise it will raise an error in every JavaScript file
files: ['*.ts'],
rules: {
'@typescript-eslint/prefer-ts-expect-error': 'off',
// allow using '${val}' with numbers, bool and null types
'@typescript-eslint/restrict-template-expressions': ['error']
}
}
]
}
13 changes: 13 additions & 0 deletions packages/hebao_v3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Packages
node_modules/

# Hardhat build outputs
artifacts/
cache/
build/
ABI/
typechain-types/
libraries.js
.env
/coverage
/coverage.json
1 change: 1 addition & 0 deletions packages/hebao_v3/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
7 changes: 7 additions & 0 deletions packages/hebao_v3/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json
typechain-types
contracts/account-abstraction
20 changes: 20 additions & 0 deletions packages/hebao_v3/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 70,
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
}
]
}
4 changes: 4 additions & 0 deletions packages/hebao_v3/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
skipFiles: ['account-abstraction', 'test', 'thirdparty'],
configureYulOptimizer: true
}
12 changes: 12 additions & 0 deletions packages/hebao_v3/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "warning",
"compiler-version": ["error", "^0.8.12"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"no-global-import": "off",
"no-empty-blocks": ["off", { "ignoreConstructors": true }],
"not-rely-on-time": "off"
}
}
4 changes: 4 additions & 0 deletions packages/hebao_v3/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
account-abstraction
test
BytesUtil.sol
Loading

0 comments on commit 410571e

Please sign in to comment.