Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas Metering for Deployment & Token Operation #175

Merged
merged 62 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c6fdba2
Function made exportable
remedcu Nov 29, 2023
1dd751f
Test ERC721 Token Added
remedcu Nov 29, 2023
653aaf9
ERC721 Deployment
remedcu Nov 29, 2023
ff677b9
Gas Metering Script Created
remedcu Nov 29, 2023
dbaa339
Linting issues rectified
remedcu Nov 29, 2023
148d5cb
Linting issues rectified
remedcu Nov 29, 2023
0e0dcc3
Refactored Gas Tests
remedcu Nov 30, 2023
4a53e34
Linting issues rectified
remedcu Nov 30, 2023
99a8599
XanderBlazeNFT introduced
remedcu Nov 30, 2023
0ee2d66
NPM init
remedcu Dec 4, 2023
07397b6
Package Lock Added
remedcu Dec 4, 2023
a2cc50b
Typescript Config Added
remedcu Dec 4, 2023
857265f
gitignore and env example
remedcu Dec 4, 2023
f8e58d7
Added utils files
remedcu Dec 4, 2023
628fdac
package.json refactored
remedcu Dec 4, 2023
2ff95b6
Pimlico Paymaster Analysis Added
remedcu Dec 4, 2023
80d7694
Alchemy Paymaster Analysis Added
remedcu Dec 4, 2023
ffb691d
Timeout module added to ERC721
remedcu Dec 4, 2023
e3ee3d8
README Added
remedcu Dec 4, 2023
fdfb267
prettier added and executed
remedcu Dec 4, 2023
bece65c
Faucet address added
remedcu Dec 4, 2023
3e10d7b
General cleanup
remedcu Dec 4, 2023
12f050a
Prettier changes
remedcu Dec 4, 2023
f1fd9e2
Update paymaster-analysis/README.md
remedcu Dec 14, 2023
77512f2
Typo removed
remedcu Dec 14, 2023
c88260e
Token Operation Values moved in .env
remedcu Dec 14, 2023
f3ea00b
Made package as private
remedcu Dec 14, 2023
d8604bf
Renamed to 4337-gas-metering
remedcu Dec 14, 2023
c356271
Unified ERC20.ts
remedcu Dec 14, 2023
26afc7e
Unified UserOp.ts
remedcu Dec 14, 2023
2883502
Unified safe.ts
remedcu Dec 14, 2023
54d975f
Cleaned up
remedcu Dec 14, 2023
7a80fd1
Code Refactoring
remedcu Dec 14, 2023
9347067
Cleaned up
remedcu Dec 14, 2023
e88bc21
Alchemy Code Redundancy Removed
remedcu Dec 15, 2023
224dce0
Pimlico Code Redundancy Removed
remedcu Dec 15, 2023
9034d2b
signUserOperation was updated
remedcu Dec 15, 2023
a9df612
env file updated
remedcu Dec 18, 2023
e0f87df
npm script updated
remedcu Dec 18, 2023
5657923
npm dependencies locked in a certain version
remedcu Dec 18, 2023
4fd5bfd
package-lock auto updated
remedcu Dec 18, 2023
0f9311f
Native Transfer util added
remedcu Dec 18, 2023
46c8093
utils updated
remedcu Dec 18, 2023
03421bc
Native Transfer, Paymaster, Mumbai Support, etc
remedcu Dec 18, 2023
086a6a4
Module v0.2 compatibility
remedcu Dec 19, 2023
e3d153a
Native Transfer Tests Added
remedcu Dec 19, 2023
97e95d3
Added check for ETH Transfer
remedcu Dec 19, 2023
4cae569
Added Pimlico & Alchemy Gas Usage README
remedcu Dec 19, 2023
83f26d6
Gas Logging in UserOps
remedcu Dec 19, 2023
d72c8f3
Paymaster and Test Gas Results Added
remedcu Dec 19, 2023
391064b
Formatting Changes
remedcu Dec 19, 2023
8a7323a
Lint issue rectified
remedcu Dec 19, 2023
33a4e05
Gelato Based Gas Results Added
remedcu Dec 20, 2023
de3fb3b
env.example updated with Gelato
remedcu Dec 20, 2023
fc338a8
Merge branch 'master' into gas-metering
remedcu Dec 20, 2023
e2f35ba
Updated Gas Spec based on master changes
remedcu Dec 20, 2023
23355ad
Updated Gas Spec based on master changes
remedcu Dec 20, 2023
cdffaa1
Tenderly Gas Profiler Link Added
remedcu Dec 21, 2023
2286ba0
README Updated with Detailed Analysis
remedcu Dec 21, 2023
ce6abc7
Github Workflow and Formatting Issues Rectified
remedcu Dec 21, 2023
783611c
Merge remote-tracking branch 'origin/master' into gas-metering
remedcu Dec 21, 2023
cb0a1fd
Github Workflow for Checks added
remedcu Dec 21, 2023
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
20 changes: 20 additions & 0 deletions .github/workflows/ci_4337_gas_metering.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: safe-modules-4337-gas-metering
on: [push]

jobs:
checks:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./4337-gas-metering
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: npm
cache-dependency-path: 4337-gas-metering/package-lock.json
- run: npm ci
- run: npm run fmt:check
- run: npm run lint
- run: npm run build
57 changes: 57 additions & 0 deletions 4337-gas-metering/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Dummy ETH Address Private Key
PRIVATE_KEY = "0x..." # Add "0x" to Private Key if not already added.

# Pimlico Values
PIMLICO_CHAIN = "mumbai" # or "goerli"
PIMLICO_CHAIN_ID = "80001"
PIMLICO_RPC_URL = "https://rpc.ankr.com/polygon_mumbai"
PIMLICO_API_KEY = "" # https://dashboard.pimlico.io/apikeys
PIMLICO_GAS_POLICY = "" # https://dashboard.pimlico.io/sponsorship-policies
PIMLICO_ENTRYPOINT_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
PIMLICO_MULTISEND_ADDRESS = "0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526" # https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.4.1/multi_send.json
PIMLICO_ERC20_PAYMASTER_ADDRESS = "0x32aCDFeA07a614E52403d2c1feB747aa8079A353" # https://docs.pimlico.io/erc20-paymaster/reference/contracts
PIMLICO_USDC_TOKEN_ADDRESS = "0x0FA8781a83E46826621b3BC094Ea2A0212e71B23" # Mumbai USDC Address used by Pimlico
# Make sure all nonce are unique for it to deploy account when run initially.
PIMLICO_NONCE = "1"
# Pimlico Token Operation Values (Based on the chain selected, these values should also change accordingly.)
PIMLICO_ERC20_TOKEN_CONTRACT = "0x255de08fb52fde17a3aab145de8e2ffb7fd0310f"
PIMLICO_ERC721_TOKEN_CONTRACT = "0x16bc5fba06f3f5875e915c0ba6963377eb6651e1"

# Alchemy Values
ALCHEMY_CHAIN = "sepolia" # or "goerli"
ALCHEMY_CHAIN_ID = "11155111"
ALCHEMY_RPC_URL = "https://eth-sepolia.g.alchemy.com/v2/Your_API_Key"
ALCHEMY_API_KEY = "" # https://dashboard.alchemy.com/apps
ALCHEMY_GAS_POLICY = "" # https://dashboard.alchemy.com/gas-manager
ALCHEMY_ENTRYPOINT_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
ALCHEMY_MULTISEND_ADDRESS = "0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526" # https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.4.1/multi_send.json
# Make sure all nonce are unique for it to deploy account when run initially.
ALCHEMY_NONCE = "2"
# Alchemy Token Operation Values (Based on the chain selected, these values should also change accordingly.)
ALCHEMY_ERC20_TOKEN_CONTRACT = "0x255de08fb52fde17a3aab145de8e2ffb7fd0310f"
ALCHEMY_ERC721_TOKEN_CONTRACT = "0x16bc5fba06f3f5875e915c0ba6963377eb6651e1"

# Gelato Values
GELATO_CHAIN = "sepolia"
GELATO_CHAIN_ID = "11155111"
GELATO_RPC_URL = "https://rpc.ankr.com/eth_sepolia"
GELATO_API_KEY = "" # Sponsor API Key
GELATO_GAS_POLICY = ""
GELATO_ENTRYPOINT_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
GELATO_MULTISEND_ADDRESS = "0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526" # https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.4.1/multi_send.json
# Make sure all nonce are unique for it to deploy account when run initially.
GELATO_NONCE = "3"
# Gelato Token Operation Values (Based on the chain selected, these values should also change accordingly.)
GELATO_ERC20_TOKEN_CONTRACT = "0x255de08fb52fde17a3aab145de8e2ffb7fd0310f"
GELATO_ERC721_TOKEN_CONTRACT = "0x16bc5fba06f3f5875e915c0ba6963377eb6651e1"

# Safe Values
SAFE_VERSION = "1.4.1"

# Publicly Mintable ERC20 and ERC721 Token for easier testing. Can be used for Token Operation Values.
# ERC20 Token Goerli: https://goerli.etherscan.io/token/0x3Aa475E24F7c076632467444b593E332Bc3355F9
# ERC721 Token Goerli: https://goerli.etherscan.io/token/0xf190c05f968c53962604454ebfa380e5cda600d7
# ERC20 Token Sepolia: https://sepolia.etherscan.io/token/0x255de08fb52fde17a3aab145de8e2ffb7fd0310f
# ERC721 Token Sepolia: https://sepolia.etherscan.io/token/0x16bc5fba06f3f5875e915c0ba6963377eb6651e1
# ERC20 Token Mumbai: https://mumbai.polygonscan.com/address/0x255de08fb52fde17a3aab145de8e2ffb7fd0310f
# ERC721 Token Mumbai: https://mumbai.polygonscan.com/address/0x16bc5fba06f3f5875e915c0ba6963377eb6651e1
30 changes: 30 additions & 0 deletions 4337-gas-metering/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-explicit-any": "warn",
},
};
16 changes: 16 additions & 0 deletions 4337-gas-metering/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

/dist
Loading
Loading