Skip to content

Commit

Permalink
Merge pull request #563 from bancorprotocol/add-xfai-v0-again
Browse files Browse the repository at this point in the history
Add support for XfaiV0 as a fork of SolidlyV2
  • Loading branch information
barakman authored Apr 24, 2024
2 parents 33c5bca + 72ce4a2 commit dd284b5
Show file tree
Hide file tree
Showing 26 changed files with 551 additions and 33,575 deletions.
1 change: 0 additions & 1 deletion fastlane_bot/config/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def connect_network(self, inject_poa_middleware):

if inject_poa_middleware:
self.web3.middleware_onion.inject(geth_poa_middleware, layer=0)
self.w3_async.middleware_onion.inject(geth_poa_middleware, layer=0)

logger.info(f"Connected to {self.network_id} network")
logger.info(f"Connected to {self.web3.provider.endpoint_uri} network")
28 changes: 11 additions & 17 deletions fastlane_bot/config/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,9 @@ class ConfigNetwork(ConfigBase):
PANCAKESWAP_V3_NAME = "pancakeswap_v3"
SOLIDLY_V2_NAME = "solidly_v2"
VELODROME_V2_NAME = "velodrome_v2"
SHIBA_V2_NAME = "shiba_v2"
# Base Exchanges
AERODROME_V2_NAME = "aerodrome_v2"
AERODROME_V3_NAME = "aerodrome_v3"
ALIENBASE_V2_NAME = "alienbase_v2"
ALIENBASE_V3_NAME = "alienbase_v3"
BASESWAP_V2_NAME = "baseswap_v2"
BASESWAP_V3_NAME = "baseswap_v3"
SWAPBASED_V2_NAME = "swap_based_v2"
# SWAPBASED_V3_NAME = "swap_based_v3" # This uses Algebra DEX
SYNTHSWAP_V2_NAME = "synthswap_v2"
SYNTHSWAP_V3_NAME = "synthswap_v3"
SMARDEX_V2_NAME = "smardex_v2"
# SMARDEX_V3_NAME = "smardex_v3" # This uses Algebra DEX
VELOCIMETER_V1_NAME = "velocimeter_v1"
VELOCIMETER_V2_NAME = "velocimeter_v2"
XFAI_V0_NAME = "xfai_v0"

WRAP_UNWRAP_NAME = "wrap_or_unwrap"

Expand Down Expand Up @@ -397,6 +384,7 @@ def __post_init__(self):
self.UNISWAP_V3_NAME: 4,
self.SOLIDLY_V2_NAME: 11,
self.AERODROME_V2_NAME: 12,
self.XFAI_V0_NAME: 13,
self.CARBON_V1_NAME: 6,
}
for ex in self.UNI_V2_FORKS:
Expand All @@ -406,10 +394,12 @@ def __post_init__(self):
for ex in self.CARBON_V1_FORKS:
self.EXCHANGE_IDS[ex] = 6
for ex in self.SOLIDLY_V2_FORKS:
if ex not in [self.AERODROME_V2_NAME, self.VELODROME_V2_NAME]:
self.EXCHANGE_IDS[ex] = 11
else:
if ex in [self.AERODROME_V2_NAME, self.VELODROME_V2_NAME]:
self.EXCHANGE_IDS[ex] = 12
elif ex == self.XFAI_V0_NAME:
self.EXCHANGE_IDS[ex] = 13
else:
self.EXCHANGE_IDS[ex] = 11
self.SUPPORTED_EXCHANGES = list(self.EXCHANGE_IDS)


Expand Down Expand Up @@ -772,6 +762,10 @@ class _ConfigNetworkLinea(ConfigNetwork):
WRAPPED_GAS_TOKEN_SYMBOL = "WETH"
STABLECOIN_ADDRESS = "0x176211869ca2b568f2a7d4ee941e073a821ee1ff"

TAX_TOKENS = [
"0x1bE3735Dd0C0Eb229fB11094B6c277192349EBbf", # LUBE
]

IS_INJECT_POA_MIDDLEWARE = True
# Balancer
BALANCER_VAULT_ADDRESS = "0x1d0188c4B276A09366D05d6Be06aF61a73bC7535" # velocore
Expand Down
49 changes: 48 additions & 1 deletion fastlane_bot/data/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,31 @@
}
]

PANCAKESWAP_V2_FACTORY_ABI = [{"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"token0","type":"address"},{"indexed":True,"internalType":"address","name":"token1","type":"address"},{"indexed":False,"internalType":"address","name":"pair","type":"address"},{"indexed":False,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"constant":True,"inputs":[],"name":"INIT_CODE_PAIR_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[],"name":"feeToSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"internalType":"address","name":"_feeTo","type":"address"}],"name":"setFeeTo","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"name":"setFeeToSetter","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"}]
XFAI_V0_FACTORY_ABI = [
{
"type": "event",
"name": "PoolCreated",
"anonymous": False,
"inputs": [{"indexed": True, "internalType": "address", "name": "token", "type": "address"}, {"indexed": True, "internalType": "address", "name": "pool", "type": "address"}, {"indexed": False, "internalType": "uint256", "name": "allPoolsSize", "type": "uint256"}]
},
{
"type": "function",
"name": "getXfaiCore",
"stateMutability": "view",
"inputs": [],
"outputs": [{"internalType": "address", "name": "", "type": "address"}]
}
]

XFAI_V0_CORE_ABI = [
{
"type": "function",
"name": "getTotalFee",
"stateMutability": "view",
"inputs": [],
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}]
}
]

UNISWAP_V2_POOL_ABI = [
{
Expand Down Expand Up @@ -443,6 +467,29 @@
}
]

XFAI_V0_POOL_ABI = [
{
"type": "event",
"name": "Sync",
"anonymous": False,
"inputs": [{"indexed": False, "internalType": "uint256", "name": "reserve0", "type": "uint256"}, {"indexed": False, "internalType": "uint256", "name": "reserve1", "type": "uint256"}]
},
{
"type": "function",
"name": "getStates",
"stateMutability": "view",
"inputs": [],
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}, {"internalType": "uint256", "name": "", "type": "uint256"}]
},
{
"type": "function",
"name": "poolToken",
"stateMutability": "view",
"inputs": [],
"outputs": [{"internalType": "address", "name": "", "type": "address"}]
}
]

BANCOR_V2_CONVERTER_ABI = [
{
"type": "event",
Expand Down
Loading

0 comments on commit dd284b5

Please sign in to comment.