Skip to content

Commit

Permalink
Merge pull request #175 from safe-global/gas-metering
Browse files Browse the repository at this point in the history
Gas Metering for Deployment & Token Operation
  • Loading branch information
remedcu authored Dec 21, 2023
2 parents 77d04f7 + cb0a1fd commit 1298321
Show file tree
Hide file tree
Showing 23 changed files with 9,574 additions and 0 deletions.
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

0 comments on commit 1298321

Please sign in to comment.