working version, before optimalization
This commit is contained in:
39
florida/tools/debug_ts_mapping.py
Normal file
39
florida/tools/debug_ts_mapping.py
Normal file
@ -0,0 +1,39 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
from web3 import Web3
|
||||
from dotenv import load_dotenv
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from clp_abis import AERODROME_FACTORY_ABI
|
||||
|
||||
load_dotenv()
|
||||
RPC_URL = os.environ.get("BASE_RPC_URL")
|
||||
w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
||||
|
||||
FACTORY_ADDRESS = "0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A" # From previous debug
|
||||
|
||||
def check_mapping():
|
||||
# Try standard V3 factory ABI method: feeAmountTickSpacing(uint24)
|
||||
abi = [{"inputs": [{"internalType": "uint24", "name": "", "type": "uint24"}], "name": "feeAmountTickSpacing", "outputs": [{"internalType": "int24", "name": "", "type": "int24"}], "stateMutability": "view", "type": "function"}]
|
||||
factory = w3.eth.contract(address=FACTORY_ADDRESS, abi=abi)
|
||||
|
||||
candidates = [1, 50, 80, 100, 200, 400, 500, 2000, 3000, 10000]
|
||||
|
||||
print("--- Fee -> TickSpacing Mapping ---")
|
||||
for fee in candidates:
|
||||
try:
|
||||
ts = factory.functions.feeAmountTickSpacing(fee).call()
|
||||
print(f"Fee {fee} -> TS {ts}")
|
||||
except Exception as e:
|
||||
# print(f"Fee {fee} -> Failed")
|
||||
pass
|
||||
|
||||
# Check if there is a 'tickSpacing' method on Factory?
|
||||
# Aerodrome Factory ABI we used has 'getPool(tokenA, tokenB, tickSpacing)'.
|
||||
# This implies Factory doesn't use fee mapping for getPool, it uses TS directly.
|
||||
# BUT NPM 'mint' uses 'fee'.
|
||||
# So NPM MUST have a mapping.
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_mapping()
|
||||
Reference in New Issue
Block a user