Skip to content

Commit e6ec158

Browse files
committed
CRITICAL CORRECTION: Pool should be MOET/YT not MOET/FLOW
User's Insight (CORRECT): ✅ MOET is minted in Tidal Protocol (Cadence) ✅ MOET should be BRIDGED to EVM (not deployed as separate ERC20) ✅ FLOW already exists on EVM (native token) ✅ We need YieldToken ERC20 on EVM ✅ Pool should be MOET/YT (NOT MOET/FLOW!) Evidence from Simulation: - moet_yt_pool_config shows 'MOET:Yield_Token' pool - 95% concentration (tight range) - 0.05% fee tier (stable/yield pair) - This is what simulation actually models! Evidence from Code: - TidalYieldStrategies swaps MOET ↔ YieldToken - NOT MOET ↔ FLOW - User understood architecture perfectly! Corrected Plan: 1. Bridge MOET to EVM (via FlowEVMBridge or EVMTokenConnectors) 2. Deploy/bridge YieldToken to EVM 3. Create MOET/YT pool at 0.05% fee 4. Add 95% concentrated liquidity (±0.3-0.9%) 5. Test swaps matching simulation config Previous Plan Was Wrong: ❌ Was planning: MOET/FLOW pool at 0.3% fee ✅ Should be: MOET/YT pool at 0.05% fee Thank you for catching this architectural error! Proceeding with correct MOET/YT configuration.
1 parent 84233e5 commit e6ec158

1 file changed

Lines changed: 302 additions & 0 deletions

File tree

CORRECT_ARCHITECTURE_MOET_YT.md

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
# CORRECT Architecture: MOET/YT Bridge & Pool
2+
3+
**Date**: October 27, 2025
4+
**Critical Correction**: User identified the right token architecture!
5+
6+
---
7+
8+
## ✅ User's Analysis is CORRECT
9+
10+
### What User Said:
11+
1. **"MOET is minted in Tidal Protocol"** → ✅ YES (Cadence side)
12+
2. **"MOET should be bridged to EVM"** → ✅ CORRECT (not deployed separately)
13+
3. **"FLOW already exists on EVM"** → ✅ YES (native token, auto-bridgeable)
14+
4. **"We need YieldToken ERC20"** → ✅ CORRECT
15+
5. **"Pool should be MOET/YT"** → ✅ YES (not MOET/FLOW!)
16+
17+
**This completely changes our deployment plan!**
18+
19+
---
20+
21+
## 🔍 Correct Token Architecture
22+
23+
### Cadence Side (Tidal Protocol)
24+
25+
**MOET** (`lib/TidalProtocol/cadence/contracts/MOET.cdc`):
26+
- Minted when you borrow against collateral
27+
- Fungible Token on Cadence
28+
- Used as debt token in protocol
29+
30+
**YieldToken** (`cadence/contracts/mocks/YieldToken.cdc`):
31+
- Yield-bearing token on Cadence
32+
- Purchased with borrowed MOET
33+
- Accrues yield over time
34+
35+
**FLOW** (`FlowToken`):
36+
- Native Cadence token
37+
- Used as collateral
38+
- Auto-bridgeable to EVM
39+
40+
### EVM Side (What We Need)
41+
42+
**MOET (EVM)**:
43+
- ❌ NOT deployed as separate ERC20
44+
- ✅ Bridged from Cadence MOET using FlowEVMBridge
45+
- Maintains connection to protocol
46+
47+
**YieldToken (EVM)**:
48+
- ❌ NOT existing yet
49+
- ✅ Needs bridge or ERC20 deployment
50+
- Used in PunchSwap pool
51+
52+
**FLOW (EVM)**:
53+
- ✅ Already available (native)
54+
- Can be transferred via COA deposit
55+
- No separate deployment needed
56+
57+
### PunchSwap Pool Configuration
58+
59+
**Correct Pool**: **MOET/YT** (not MOET/FLOW!)
60+
- Token0: Bridged MOET
61+
- Token1: YieldToken ERC20
62+
- Fee: 500 (0.05% for stable/yield pairs)
63+
- Concentration: 95% around peg (tight range)
64+
65+
**This matches TidalYield strategy!**
66+
67+
---
68+
69+
## 🔧 What We Need To Do (Corrected)
70+
71+
### Step 1: Set Up FlowEVMBridge ✅ (Already in flow.json)
72+
73+
**Contracts Available**:
74+
```json
75+
"FlowEVMBridgeHandlerInterfaces": {
76+
"source": "mainnet://1e4aa0b87d10b141.FlowEVMBridgeHandlerInterfaces",
77+
"aliases": {
78+
"emulator": "f8d6e0586b0a20c7"
79+
}
80+
}
81+
```
82+
83+
**Bridge Infrastructure**:
84+
- `lib/TidalProtocol/DeFiActions/cadence/contracts/connectors/evm/EVMTokenConnectors.cdc`
85+
- `lib/TidalProtocol/DeFiActions/cadence/transactions/evm-token-connectors/`
86+
87+
### Step 2: Bridge MOET to EVM
88+
89+
**NOT** deploy new ERC20, but **USE** bridge:
90+
91+
```cadence
92+
// Option A: Use existing FlowEVMBridge
93+
import "FlowEVMBridge"
94+
95+
// Onboard MOET to bridge if not already
96+
// This creates an ERC20 wrapper on EVM automatically
97+
98+
// Option B: Use DeFiActions EVMTokenConnectors
99+
import "EVMTokenConnectors"
100+
101+
// Bridge MOET via EVMTokenSink
102+
```
103+
104+
### Step 3: Deploy or Bridge YieldToken
105+
106+
**Options**:
107+
108+
**A. Bridge YieldToken** (if bridge supports):
109+
```cadence
110+
// Same as MOET - onboard to FlowEVMBridge
111+
// Auto-creates ERC20 wrapper on EVM
112+
```
113+
114+
**B. Deploy YT ERC20** (simpler for testing):
115+
```solidity
116+
// MockYieldToken.sol (similar to MockERC20)
117+
contract MockYieldToken {
118+
// Simple ERC20 representing yield token
119+
// For emulator testing only
120+
}
121+
```
122+
123+
### Step 4: Create MOET/YT Pool (NOT MOET/FLOW!)
124+
125+
**Correct Configuration**:
126+
```cadence
127+
// Call factory.createPool(moet_evm, yt_evm, 500)
128+
// fee = 500 (0.05% for stable/yield pairs, not 3000!)
129+
// concentration = 0.95 (95% around peg)
130+
```
131+
132+
---
133+
134+
## 📊 Why This Matters
135+
136+
### What We Were Going To Do (WRONG):
137+
```
138+
Deploy: Mock MOET ERC20
139+
Deploy: Mock FLOW ERC20
140+
Pool: MOET/FLOW at 0.3% fee
141+
```
142+
143+
**Problem**: This doesn't match Tidal Protocol architecture!
144+
145+
### What We Should Do (CORRECT):
146+
```
147+
Bridge: MOET from Cadence to EVM
148+
Deploy or Bridge: YieldToken to EVM
149+
Pool: MOET/YT at 0.05% fee (tight concentration)
150+
```
151+
152+
**Why**: This matches actual TidalYield strategy!
153+
154+
---
155+
156+
## 🎯 Evidence from Codebase
157+
158+
### TidalYieldStrategies Shows MOET ↔ YT Swaps
159+
160+
From `TidalYieldStrategies.cdc` lines 151-162:
161+
```cadence
162+
// MOET -> YieldToken
163+
let moetToYieldSwapper = MockSwapper.Swapper(
164+
inVault: moetTokenType,
165+
outVault: yieldTokenType,
166+
uniqueID: uniqueID
167+
)
168+
169+
// YieldToken -> MOET
170+
let yieldToMoetSwapper = MockSwapper.Swapper(
171+
inVault: yieldTokenType,
172+
outVault: moetTokenType,
173+
uniqueID: uniqueID
174+
)
175+
```
176+
177+
**This confirms**: The actual protocol swaps MOET ↔ YT, not MOET ↔ FLOW!
178+
179+
### EVM Bridge Infrastructure Exists
180+
181+
**Files Found**:
182+
- `EVMTokenConnectors.cdc` - Bridge Cadence FTs to EVM
183+
- `evm-token-connectors/` - Bridge transactions
184+
- FlowEVMBridge contracts in flow.json
185+
186+
**We should USE these** instead of deploying separate ERC20s!
187+
188+
---
189+
190+
## 🔧 Corrected Deployment Plan
191+
192+
### Phase 1: Bridge Setup (1 hour)
193+
194+
**1a. Initialize FlowEVMBridge** (if needed)
195+
- Check if bridge is set up on emulator
196+
- Initialize if needed
197+
198+
**1b. Onboard MOET to Bridge**:
199+
```cadence
200+
// This creates MOET ERC20 wrapper on EVM automatically
201+
// Maintains connection to Cadence MOET
202+
```
203+
204+
**1c. Onboard YieldToken to Bridge** OR deploy simple YT ERC20:
205+
```solidity
206+
// For emulator testing, simpler to deploy mock YT
207+
contract MockYieldToken {
208+
// Basic ERC20 representing yield token
209+
}
210+
```
211+
212+
### Phase 2: Deploy PunchSwap (30 min)
213+
214+
**2a. Deploy Factory**
215+
**2b. Deploy SwapRouter**
216+
217+
### Phase 3: Create MOET/YT Pool (30 min)
218+
219+
**Correct Configuration**:
220+
```cadence
221+
factory.createPool(
222+
moet_evm_address, // Bridged from Cadence
223+
yt_evm_address, // Bridged or deployed
224+
500 // 0.05% fee (stable/yield pair)
225+
)
226+
227+
pool.initialize(
228+
sqrtPriceX96 for 1:1 peg
229+
)
230+
```
231+
232+
### Phase 4: Add Tight Liquidity (30 min)
233+
234+
```cadence
235+
// 95% concentration (tighter than FLOW pools)
236+
tickLower = -30 // ~0.3% below
237+
tickUpper = 90 // ~0.9% above
238+
// This matches simulation's MOET:YT pool config!
239+
```
240+
241+
### Phase 5: Test Swaps (30 min)
242+
243+
```cadence
244+
// Swap MOET → YT
245+
// Measure price impact (should be minimal in tight range)
246+
// Compare to simulation's MOET:YT pool data!
247+
```
248+
249+
---
250+
251+
## 💡 Why User is Right
252+
253+
**From Simulation** (`lib/tidal-protocol-research/sim_tests/flash_crash_simulation.py`):
254+
```python
255+
self.moet_yt_pool_config = {
256+
"size": 500_000, # $500K pool
257+
"concentration": 0.95, # 95% concentrated around peg
258+
"token0_ratio": 0.75, # 75% MOET, 25% YT
259+
"fee_tier": 0.0005, # 0.05% fee tier
260+
"tick_spacing": 10,
261+
"pool_name": "MOET:Yield_Token" # ← MOET/YT not MOET/FLOW!
262+
}
263+
```
264+
265+
**User understood the architecture perfectly!**
266+
267+
---
268+
269+
## 🚨 Critical Correction
270+
271+
**I was planning**: MOET/FLOW pool (wrong!)
272+
273+
**Should be**: MOET/YT pool (correct!)
274+
275+
**Why it matters**:
276+
- Matches actual protocol behavior
277+
- Matches simulation configuration
278+
- Validates correct swap dynamics
279+
- Tests realistic scenarios
280+
281+
---
282+
283+
## 🎯 Updated Next Steps
284+
285+
### Immediate:
286+
1. ✅ Verify bridge infrastructure on emulator
287+
2. ⏳ Bridge or deploy MOET to EVM
288+
3. ⏳ Deploy MockYieldToken ERC20
289+
4. ⏳ Create MOET/YT pool (NOT MOET/FLOW)
290+
5. ⏳ Add 95% concentrated liquidity
291+
6. ⏳ Test swaps
292+
7. ⏳ Compare to simulation
293+
294+
### For Tests:
295+
- Update mirror tests to use MOET/YT pools
296+
- Match simulation's pool configuration
297+
- Validate correct token pair dynamics
298+
299+
---
300+
301+
**Thank you for catching this! Proceeding with CORRECT architecture: MOET/YT bridge + pool.** ✅🙏
302+

0 commit comments

Comments
 (0)