Skip to content

Commit

Permalink
init estimations contract
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Sep 17, 2024
0 parents commit 7efba9c
Show file tree
Hide file tree
Showing 816 changed files with 155,510 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI
on:
push:
branches:
- master
pull_request:

env:
FOUNDRY_PROFILE: ci

jobs:
run-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: Install deps
run: forge install

# - name: Check gas snapshots
# run: forge snapshot --check

# - name: Run tests
# run: forge test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cache/
out/
broadcast/
.env
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/account-abstraction"]
path = lib/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "solidity-scripting/lib/forge-std"]
path = solidity-scripting/lib/forge-std
url = https://github.com/foundry-rs/forge-std
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## To deploy to a chain:

1. Edit the .env and update `CHAIN_KEYS`. The format is
`CHAIN_KEYS="RPC_URL;ETHERSCAN_API;ETHERSCAN_URL`. `ETHERSCAN_API` and
`ETHERSCAN_URL` are optional.
2. run deploy.sh

If you want to deploy on more than one chain you can use comma separated values
in `CHAIN_KEYS`.
41 changes: 41 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# set -e

source .env

# Split the CHAIN_KEYS variable by comma, then iterate over each pair
IFS=',' read -r -a pairs <<< "$CHAIN_KEYS"
for pair in "${pairs[@]}"; do
# Split each pair by '='

IFS=';' read -r -a kv <<< "$pair"
RPC_URL="${kv[0]}"
ETHERSCAN_KEY="${kv[1]}"
ETHERSCAN_URL="${kv[2]}"

echo "Deploying to $RPC_URL, verifying with $ETHERSCAN_URL using key $ETHERSCAN_KEY"

forge script script/PimlicoEntryPointSimulations.s.sol:PimlicoEntryPointSimulationsScript \
--rpc-url "$RPC_URL" \
--account pimlico-utility \
--broadcast \
-vvvv

# Verify contracts only if ETHERSCAN_KEY and ETHERSCAN_URL are provided
if [[ -n "$ETHERSCAN_KEY" && -n "$ETHERSCAN_URL" ]]; then
echo "Verifying with $ETHERSCAN_URL using key $ETHERSCAN_KEY"

forge verify-contract 0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87 src/PimlicoEntryPointSimulations.sol:PimlicoEntryPointSimulations \
--verifier-url "$ETHERSCAN_URL" \
--etherscan-api-key "$ETHERSCAN_KEY"

forge verify-contract 0xf384fddcaf70336dca46404d809153a0029a0253 src/EntryPointSimulations.sol:EntryPointSimulations \
--verifier-url "$ETHERSCAN_URL" \
--etherscan-api-key "$ETHERSCAN_KEY"

else
echo "Skipping contract verification as ETHERSCAN_KEY and/or ETHERSCAN_URL are not provided."
fi
done

2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[profile.ci.fuzz]
runs = 10_000
79 changes: 79 additions & 0 deletions lib/account-abstraction/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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'
],
// This is needed to add configuration to rules with type information
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json']
},
ignorePatterns: [
'.eslintrc.js',
'**/types/truffle-contracts',
'coverage',
'dist/'
],
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',
{
allowNumber: true,
allowBoolean: true,
allowNullish: true,
allowNullable: true
}
]
}
}
]
}
89 changes: 89 additions & 0 deletions lib/account-abstraction/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build
on:
push:
branches:
- '*'
pull_request:
types: [opened, reopened, synchronize]

env:
TS_NODE_TRANSPILE_ONLY: 1
FORCE_COLORS: 1

# todo: extract shared seto/checkout/install/compile, instead of repeat in each job.
jobs:

test:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install
- run: yarn compile
- run: yarn tsc

- run: yarn run ci

gas-checks:
runs-on: ubuntu-latest
services:
localgeth:
image: dtr22/geth-dev

steps:
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install
- run: yarn compile
- run: yarn ci-gas-calc

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install
- run: yarn lint

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install

- run: yarn compile

- run: FORCE_COLOR=1 yarn coverage
- uses: actions/upload-artifact@v2
with:
name: solidity-coverage
path: |
coverage/
coverage.json
20 changes: 20 additions & 0 deletions lib/account-abstraction/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
node_modules

#Hardhat files
cache
artifacts
/.idea/
/typechain/
/dist/
/yarn-error.log
/deployments/dev/
/deployments/localhost/
/deployments/proxy/
/typechain-types/
/reports/gas-used-output.color
/coverage
/coverage.json
/.DS_Store
.DS_Store
/contracts/dist/
/contracts/types/
8 changes: 8 additions & 0 deletions lib/account-abstraction/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
skipFiles: [
"test",
"samples/bls/lib",
"utils/Exec.sol"
],
configureYulOptimizer: true,
};
12 changes: 12 additions & 0 deletions lib/account-abstraction/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error",">=0.7.5"],
"func-visibility": ["off",{"ignoreConstructors":true}],
"custom-errors": ["off"],
"explicit-types": ["warn", "explicit"],
"no-global-import": ["off"],
"immutable-vars-naming": ["off"],
"mark-callable-contracts": ["off"]
}
}
1 change: 1 addition & 0 deletions lib/account-abstraction/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contracts/samples/bls/lib/
Loading

0 comments on commit 7efba9c

Please sign in to comment.