feat(core): implement core MEV bot functionality with market scanning and Uniswap V3 pricing
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
// TestMockDEXInteraction tests mock DEX interaction creation
|
||||
func TestMockDEXInteraction(t *testing.T) {
|
||||
dexInteraction := CreateMockDEXInteraction()
|
||||
|
||||
|
||||
assert.Equal(t, "UniswapV3", dexInteraction.Protocol)
|
||||
assert.Equal(t, common.HexToAddress("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"), dexInteraction.Pool)
|
||||
assert.Equal(t, common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), dexInteraction.TokenIn)
|
||||
@@ -23,10 +23,10 @@ func TestMockDEXInteraction(t *testing.T) {
|
||||
func TestMockTransaction(t *testing.T) {
|
||||
to := common.HexToAddress("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640")
|
||||
data := []byte("test_data")
|
||||
|
||||
|
||||
tx := CreateMockTransaction(to, data)
|
||||
|
||||
|
||||
assert.Equal(t, to, *tx.To())
|
||||
assert.Equal(t, data, tx.Data())
|
||||
assert.Equal(t, uint64(1), tx.Nonce())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ func CreateMockL2Message() *arbitrum.L2Message {
|
||||
// CreateMockDEXInteraction creates a realistic DEX interaction for testing
|
||||
func CreateMockDEXInteraction() *arbitrum.DEXInteraction {
|
||||
return &arbitrum.DEXInteraction{
|
||||
Protocol: "UniswapV3",
|
||||
Pool: common.HexToAddress("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"),
|
||||
TokenIn: common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), // USDC
|
||||
TokenOut: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), // WETH
|
||||
AmountIn: big.NewInt(1000000000), // 1000 USDC
|
||||
AmountOut: big.NewInt(500000000000000000), // 0.5 ETH
|
||||
Protocol: "UniswapV3",
|
||||
Pool: common.HexToAddress("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"),
|
||||
TokenIn: common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), // USDC
|
||||
TokenOut: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), // WETH
|
||||
AmountIn: big.NewInt(1000000000), // 1000 USDC
|
||||
AmountOut: big.NewInt(500000000000000000), // 0.5 ETH
|
||||
MessageNumber: big.NewInt(12345),
|
||||
Timestamp: uint64(1234567890),
|
||||
Timestamp: uint64(1234567890),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,4 +53,4 @@ func CreateMockTransaction(to common.Address, data []byte) *types.Transaction {
|
||||
big.NewInt(20000000000), // gas price (20 gwei)
|
||||
data, // data
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user