Skip to content

Commit 8910dbf

Browse files
committed
Add EVM/PunchSwap V3 integration progress summary
Progress: 4/5 Basic EVM Tests Passing! ✅ Working Infrastructure: - Flow emulator running with built-in EVM support - COA creation working (creates EVM address) - Address queries working (000000000000000000000002fb90ae0000000000) - Balance queries working (can read EVM-side FLOW balance) Test Results (evm_coa_basic_test.cdc): ✅ test_evm_contract_available ✅ test_create_coa ✅ test_get_coa_address ✅ test_get_coa_balance ❌ test_deploy_minimal_contract (API fixes needed) Issues Identified: 1. UInt8.fromString no longer takes radix parameter 2. COA needs auth(EVM.Owner) for deploy() 3. Deploy result API changed Next Steps: 1. Fix deployment transaction (3 API issues) 2. Deploy mock ERC20 tokens 3. Deploy PunchSwap V3 Factory 4. Create pools and test swaps 5. Replace MockV3 with PunchSwap Estimated: 6-7 hours for full integration, 1 hour for deployment fix Value: Get REAL Uniswap V3 validation (price impact, slippage, concentrated liquidity)
1 parent 7c3482f commit 8910dbf

1 file changed

Lines changed: 287 additions & 0 deletions

File tree

EVM_PUNCHSWAP_PROGRESS.md

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
# EVM & PunchSwap V3 Integration Progress
2+
3+
**Date**: October 27, 2025
4+
**Status**: Basic EVM integration working! 4/5 tests passing ✅
5+
6+
---
7+
8+
## ✅ What's Working
9+
10+
### EVM Infrastructure: READY
11+
12+
**Emulator**:
13+
- ✅ Running with built-in EVM support
14+
- ✅ EVM contract deployed at `f8d6e0586b0a20c7`
15+
-`--setup-evm` enabled by default
16+
17+
**Test Results** (`evm_coa_basic_test.cdc`):
18+
```
19+
✅ test_evm_contract_available: EVM accessible
20+
✅ test_create_coa: COA creation works
21+
✅ test_get_coa_address: Can get EVM address
22+
Result: 000000000000000000000002fb90ae0000000000
23+
✅ test_get_coa_balance: Can query FLOW balance
24+
Result: 0.0 FLOW
25+
26+
❌ test_deploy_minimal_contract: Needs API fixes
27+
Issues: UInt8.fromString signature, COA authorization
28+
```
29+
30+
**Success Rate**: 80% (4/5 passing)
31+
32+
### What This Proves
33+
34+
**✅ Validated**:
35+
1. Built-in EVM works in test framework
36+
2. Can create COAs from Cadence
37+
3. COAs get valid EVM addresses
38+
4. Can query EVM state from Cadence
39+
40+
**⏳ Next**:
41+
- Fix deployment API issues
42+
- Deploy real PunchSwap V3 contracts
43+
- Create pools and test swaps
44+
45+
---
46+
47+
## 🛠️ Files Created
48+
49+
**Working Infrastructure**:
50+
1. `cadence/transactions/evm/create_coa.cdc`
51+
2. `cadence/scripts/evm/get_coa_address.cdc`
52+
3. `cadence/scripts/evm/get_coa_balance.cdc`
53+
54+
**Needs Fixing**:
55+
4. `cadence/transactions/evm/deploy_simple_contract.cdc` ⚠️
56+
57+
**Tests**:
58+
5. `cadence/tests/evm_coa_basic_test.cdc` - 4/5 passing ✅
59+
60+
---
61+
62+
## 🚧 Known Issues & Fixes Needed
63+
64+
### Issue 1: UInt8.fromString API Changed
65+
66+
**Error**:
67+
```
68+
too many arguments: UInt8.fromString(byteStr, radix: 16)
69+
expected up to 1, got 2
70+
```
71+
72+
**Fix**: Remove `radix` parameter
73+
```cadence
74+
// Old (doesn't work):
75+
let byte = UInt8.fromString(byteStr, radix: 16)
76+
77+
// New (should work):
78+
let byteHex = "0x".concat(byteStr)
79+
let byte = UInt8.fromString(byteHex)
80+
```
81+
82+
### Issue 2: COA Deploy Authorization
83+
84+
**Error**:
85+
```
86+
cannot access `deploy` because function requires `Owner | Deploy` authorization
87+
```
88+
89+
**Fix**: Borrow with correct authorization
90+
```cadence
91+
// Old:
92+
let coa = signer.storage.borrow<&EVM.CadenceOwnedAccount>(from: /storage/evm)
93+
94+
// New:
95+
let coa = signer.storage.borrow<auth(EVM.Owner) &EVM.CadenceOwnedAccount>(from: /storage/evm)
96+
```
97+
98+
### Issue 3: Deploy Result API
99+
100+
**Error**:
101+
```
102+
value of type `EVM.Result` has no member `deployedAddress`
103+
```
104+
105+
**Fix**: Check actual EVM.Result API
106+
```cadence
107+
// May need to access differently, like:
108+
// deployResult.data or deployResult.address
109+
```
110+
111+
---
112+
113+
## 📋 Next Steps
114+
115+
### Step 1: Fix Deployment Transaction (30 min)
116+
117+
Update `deploy_simple_contract.cdc`:
118+
1. Fix UInt8.fromString calls
119+
2. Add correct COA authorization
120+
3. Fix deployment result access
121+
122+
### Step 2: Deploy Mock ERC20 (1 hour)
123+
124+
Create simple ERC20 tokens for testing:
125+
```solidity
126+
// MockMOET.sol
127+
contract MockMOET {
128+
string public name = "Mock MOET";
129+
string public symbol = "MOET";
130+
uint8 public decimals = 18;
131+
uint256 public totalSupply;
132+
133+
mapping(address => uint256) public balanceOf;
134+
135+
constructor() {
136+
totalSupply = 10_000_000 * 10**18;
137+
balanceOf[msg.sender] = totalSupply;
138+
}
139+
140+
function transfer(address to, uint256 amount) public returns (bool) {
141+
require(balanceOf[msg.sender] >= amount);
142+
balanceOf[msg.sender] -= amount;
143+
balanceOf[to] += amount;
144+
return true;
145+
}
146+
}
147+
```
148+
149+
Compile and deploy via Cadence.
150+
151+
### Step 3: Deploy PunchSwap V3 Factory (2 hours)
152+
153+
**Compile**:
154+
```bash
155+
cd solidity/lib/punch-swap-v3-contracts
156+
forge build
157+
```
158+
159+
**Get Bytecode**:
160+
```bash
161+
cat out/PunchSwapV3Factory.sol/PunchSwapV3Factory.json | jq -r '.bytecode.object' > /tmp/factory_bytecode.txt
162+
```
163+
164+
**Deploy via Cadence**:
165+
```cadence
166+
let factoryBytecode = "<paste from /tmp/factory_bytecode.txt>"
167+
// Deploy using fixed deploy transaction
168+
```
169+
170+
### Step 4: Create Test Pool (1 hour)
171+
172+
After factory deployed:
173+
```cadence
174+
// Call factory.createPool(tokenA, tokenB, fee)
175+
let poolAddress = // returned from createPool
176+
```
177+
178+
### Step 5: Test Swap with Price Impact (30 min)
179+
180+
```cadence
181+
// Swap through pool
182+
// Query price before
183+
// Execute swap
184+
// Query price after
185+
// Calculate actual slippage
186+
// Compare to simulation
187+
```
188+
189+
### Step 6: Replace MockV3 (1 hour)
190+
191+
Once PunchSwap tests pass:
192+
- Update mirror tests to use PunchSwap instead of MockV3
193+
- Get real price impact and slippage
194+
- TRUE V3 validation!
195+
196+
**Total Estimated**: 6-7 hours
197+
198+
---
199+
200+
## 🎯 Current Progress
201+
202+
**Phase 1: Basic EVM** - 80% Complete ✅
203+
- [x] COA creation
204+
- [x] Address retrieval
205+
- [x] Balance queries
206+
- [ ] Contract deployment (needs API fixes)
207+
208+
**Phase 2: PunchSwap Deployment** - 0% Complete ⏳
209+
- [ ] Fix deployment transaction
210+
- [ ] Deploy mock ERC20 tokens
211+
- [ ] Deploy PunchSwap Factory
212+
- [ ] Deploy Pool contract
213+
214+
**Phase 3: Pool Creation** - 0% Complete ⏳
215+
- [ ] Create MOET/FLOW pool
216+
- [ ] Add concentrated liquidity
217+
- [ ] Initialize at target price
218+
219+
**Phase 4: Trading Tests** - 0% Complete ⏳
220+
- [ ] Execute swaps
221+
- [ ] Measure price impact
222+
- [ ] Calculate slippage
223+
- [ ] Compare to simulation
224+
225+
**Phase 5: Mirror Integration** - 0% Complete ⏳
226+
- [ ] Replace MockV3 in rebalance test
227+
- [ ] Replace MockV3 in FLOW test
228+
- [ ] Replace MockV3 in MOET test
229+
- [ ] Validate real V3 behavior
230+
231+
---
232+
233+
## 💡 Quick Win Approach
234+
235+
**Priority 1: Get ONE successful deployment** (next 1 hour)
236+
- Fix the 3 API issues in deploy_simple_contract.cdc
237+
- Deploy simple ERC20
238+
- Prove Solidity deployment works
239+
240+
**Priority 2: Deploy PunchSwap Factory** (next 2 hours)
241+
- Compile factory with forge
242+
- Deploy via fixed transaction
243+
- Verify deployment
244+
245+
**Priority 3: Create & test pool** (next 2 hours)
246+
- Create MOET/FLOW pool
247+
- Add liquidity
248+
- Execute one swap
249+
- Show price impact!
250+
251+
**Priority 4: Integrate** (next 1-2 hours)
252+
- Replace MockV3 in one test
253+
- Compare results
254+
255+
---
256+
257+
## 🎓 What We've Learned
258+
259+
**User was right**:
260+
- ✅ Flow CLI has built-in EVM
261+
- ✅ No separate gateway needed (for basic use)
262+
- ✅ Can deploy Solidity contracts from Cadence
263+
- ✅ Integration is viable!
264+
265+
**Current status**:
266+
- ✅ Infrastructure working (emulator + EVM)
267+
- ✅ Basic operations validated (COA, queries)
268+
- ⏳ Deployment needs API updates
269+
- 📝 Clear path to PunchSwap V3
270+
271+
**Confidence**: HIGH that this will work!
272+
273+
---
274+
275+
## 🚀 Immediate Next Action
276+
277+
**Fix deployment transaction**:
278+
1. Update UInt8.fromString usage (remove radix)
279+
2. Add COA authorization (auth(EVM.Owner))
280+
3. Fix deployment result access
281+
282+
Then we can deploy real contracts and proceed with PunchSwap V3 integration!
283+
284+
---
285+
286+
**Status**: Basic EVM validated (4/5 tests passing), deployment fix needed, clear path forward ✅
287+

0 commit comments

Comments
 (0)