fix(compilation): resolve type system and interface errors
- Add GetPoolsByToken method to cache interface and implementation - Fix interface pointer types (use interface not *interface) - Fix SwapEvent.TokenIn/TokenOut usage to use GetInputToken/GetOutputToken methods - Fix ethereum.CallMsg import and usage - Fix parser factory and validator initialization in main.go - Remove unused variables and imports WIP: Still fixing main.go config struct field mismatches 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -271,19 +271,13 @@ func (c *Calculator) calculateSwapOutputCurve(pool *types.PoolInfo, tokenIn, tok
|
||||
return nil, 0, fmt.Errorf("pool has nil reserves")
|
||||
}
|
||||
|
||||
// Determine direction
|
||||
var reserveIn, reserveOut *big.Int
|
||||
if tokenIn == pool.Token0 {
|
||||
reserveIn = pool.Reserve0
|
||||
reserveOut = pool.Reserve1
|
||||
} else if tokenIn == pool.Token1 {
|
||||
reserveIn = pool.Reserve1
|
||||
reserveOut = pool.Reserve0
|
||||
} else {
|
||||
// Determine direction (validate token is in pool)
|
||||
if tokenIn != pool.Token0 && tokenIn != pool.Token1 {
|
||||
return nil, 0, fmt.Errorf("token not in pool")
|
||||
}
|
||||
|
||||
// Simplified: assume 1:1 swap with low slippage for stablecoins
|
||||
// TODO: Implement proper Curve StableSwap math using reserves and amp coefficient
|
||||
// This is a rough approximation - actual Curve math is more complex
|
||||
fee := pool.Fee
|
||||
if fee == 0 {
|
||||
|
||||
Reference in New Issue
Block a user