Skip to content

Commit 96000d9

Browse files
authored
merge fix/paymaster into develop (#78)
2 parents 64ad7df + 79094f6 commit 96000d9

24 files changed

+1163
-526
lines changed
+43-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
11
# Deployment Guidelines
22

3-
(TBC)
3+
## Paymaster Deployment
4+
5+
### Post-Deployment
6+
7+
After deploying a new Paymaster contract, you **MUST** perform the staking process to deposit ETH into the StakeManager of the EntryPoint. This step is essential for security purposes and is validated by the bundler to ensure the proper operation of the Paymaster contract. 🛡️
8+
9+
This is a critical step that you **cannot skip** after deployment. Failure to stake the required ETH will result in the bundler failing to validate the contract, and your transactions may not work correctly! 🚨
10+
11+
#### **How to Stake:**
12+
13+
1. **Run the following command to stake ETH in the Paymaster contract:**
14+
15+
```sh
16+
cast send paymaster_contract_address "addStake(uint32)" 100000 --value 100000000000000000 --from backend_signer_wallet_address --rpc-url https://arb-sepolia.g.alchemy.com/v2/API_KEY_ALCHEMY --private-key _backend_signer_wallet_private_key
17+
```
18+
19+
- `100000` represents the amount of seconds of unstake time.
20+
- `100000000000000000` equals **0.1 ETH** to be staked.
21+
22+
**Important Notes:**
23+
- Make sure you have enough ETH in the backend signer wallet to cover the stake.
24+
- The staking process is required for security validation and interaction with the EntryPoint.
25+
26+
2. **To check the balance and verify the stake:**
27+
28+
```sh
29+
cast call entrypoint_contract_address "getDepositInfo(address)(uint112,bool,uint112,uint32,uint48)" paymaster_contract_address --rpc-url https://arb-sepolia.g.alchemy.com/v2/API_KEY_ALCHEMY
30+
```
31+
32+
This will return the deposit information, including the amount of staked ETH and other relevant details.
33+
34+
#### **Why Is This Important?**
35+
36+
- **Security:** The bundler validates this stake to ensure that the Paymaster contract can be used safely and securely within the ecosystem. 🛡️
37+
- **Smooth Operations:** Without this staking, the contract will not pass bundler validation and operations will fail. ⚠️
38+
39+
#### **Additional Notes on StakeManager & Bundler**
40+
41+
The **StakeManager** within the EntryPoint is responsible for managing the ETH deposits that cover gas costs for Paymaster operations. By staking ETH in the StakeManager, you are essentially providing a guarantee that there are sufficient funds to pay for transaction fees. This step is critical for the bundler to validate and process transactions that the Paymaster is handling.
42+
43+
The **bundler** is a service that aggregates multiple transactions and ensures that gas is paid in an efficient manner. Without proper staking, the bundler will not validate the transactions, and the system will fail to function as intended.
44+
45+
Make sure you complete this step right after the Paymaster deployment, as it is a necessary part of the contract initialization. ✅

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,19 @@ deploy_arbitrum_sepolia_only_chatterpay :; $(BUILD) && \
3131
FOUNDRY_PROFILE=local forge script script/DeployChatterPay.s.sol \
3232
--rpc-url $(ARBITRUM_SEPOLIA_RPC_URL) \
3333
--private-key $(PRIVATE_KEY) \
34+
--broadcast
35+
36+
# Deploy only Paymaster contract
37+
deploy_verify_arbitrum_sepolia_only_paymaster :; $(BUILD) && \
38+
FOUNDRY_PROFILE=local forge script script/DeployPaymaster.s.sol \
39+
--rpc-url $(ARBITRUM_SEPOLIA_RPC_URL) \
40+
--private-key $(PRIVATE_KEY) \
41+
--verify \
42+
--etherscan-api-key $(ARBISCAN_API_KEY) \
43+
--broadcast
44+
45+
deploy_arbitrum_sepolia_only_paymaster :; $(BUILD) && \
46+
FOUNDRY_PROFILE=local forge script script/DeployPaymaster.s.sol \
47+
--rpc-url $(ARBITRUM_SEPOLIA_RPC_URL) \
48+
--private-key $(PRIVATE_KEY) \
3449
--broadcast

example_env

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ ETHERSCAN_API_KEY=Your etherscan api key, if you want to verify contracts
88
ROUTER_ADDRESS=Uniswap SwapRouter02 address
99
ARBISCAN_API_KEY=Your Aribtrum api key, if you want to verify contracts
1010
NFT_BASE_URI=https://dev.back.chatterpay.net/nft/metadata/opensea/
11+
DEPLOYED_PAYMASTER_ADDRESS=Address of an existing Paymaster to avoid creating a new one in the deployment script
1112

12-
# Uniswap V3 Addresses
13-
UNISWAP_FACTORY=0x1F98431c8aD98523631AE4a59f267346ea31F984
14-
POSITION_MANAGER=0xC36442b4a4522E871399CD717aBDD847Ab11FE88
13+
# Uniswap V3 Addresses (arbitrum)
14+
# https://docs.uniswap.org/contracts/v3/reference/deployments/arbitrum-deployments
15+
# UNISWAP_FACTORY=0x1F98431c8aD98523631AE4a59f267346ea31F984
16+
# POSITION_MANAGER=0xC36442b4a4522E871399CD717aBDD847Ab11FE88
17+
18+
# Uniswap V3 Addresses (arbitrum-sepolia)
19+
# https://docs.uniswap.org/contracts/v3/reference/deployments/arbitrum-deployments
20+
UNISWAP_FACTORY=0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e
21+
POSITION_MANAGER=0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65
1522

1623
# Tokens and their respective Price Feeds (ensure the order matches between tokens[i] and price_feeds[i])
1724
TOKENS=0xe6B817E31421929403040c3e42A6a5C5D2958b4A,0xE9C723D01393a437bac13CE8f925A5bc8E1c335c

lib/openzeppelin-contracts

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"test:prod": "FOUNDRY_PROFILE=production bash test/run_all_tests.sh",
1010
"test:gas": "REPORT_GAS=true FOUNDRY_PROFILE=production bash test/run_all_tests.sh",
1111
"test:coverage:local": "FOUNDRY_PROFILE=local bash test/run_tests_coverage.sh",
12+
"test:one:local": "FOUNDRY_PROFILE=local bash test/run_one_contract_tests.sh",
1213
"clean": "forge clean",
1314
"clean:full": "forge clean && rm -rf cache .forge-cache",
1415
"deploy:arbitrum-sepolia": "make deploy_arbitrum_sepolia_all",

0 commit comments

Comments
 (0)