Skip to content

Commit

Permalink
Only get Fast Lane contract version on Ethereum mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesigh-3100 committed Nov 29, 2023
1 parent 6b7bf8f commit 8ede243
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions fastlane_bot/config/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def __init__(self, network: ConfigNetwork, **kwargs):
#assert self.network.NETWORK == ConfigNetwork.NETWORK_ETHEREUM, f"Alchemy only supports Ethereum {self.network}"
self.WEB3_ALCHEMY_PROJECT_ID = network.WEB3_ALCHEMY_PROJECT_ID
self.RPC_URL = f"{network.RPC_ENDPOINT}{self.WEB3_ALCHEMY_PROJECT_ID}"

N = self.network
self.connection = EthereumNetwork(
network_id=N.NETWORK_ID,
Expand All @@ -104,11 +103,7 @@ def __init__(self, network: ConfigNetwork, **kwargs):
self.w3 = self.connection.web3
self.LOCAL_ACCOUNT = self.w3.eth.account.from_key(ETH_PRIVATE_KEY_BE_CAREFUL)

if network.NETWORK in N.NETWORK_ETHEREUM:
self.BANCOR_NETWORK_INFO_CONTRACT = self.w3.eth.contract(
address=network.BANCOR_V3_NETWORK_INFO_ADDRESS,
abi=BANCOR_V3_NETWORK_INFO_ABI,
)

if network.NETWORK in [N.NETWORK_BASE, N.NETWORK_ETHEREUM]:
self.CARBON_CONTROLLER_CONTRACT = self.w3.eth.contract(
address=network.CARBON_CONTROLLER_ADDRESS,
Expand All @@ -118,11 +113,19 @@ def __init__(self, network: ConfigNetwork, **kwargs):
address=self.w3.toChecksumAddress(network.FASTLANE_CONTRACT_ADDRESS),
abi=FAST_LANE_CONTRACT_ABI,
)


if network.NETWORK in N.NETWORK_ETHEREUM:
self.BANCOR_NETWORK_INFO_CONTRACT = self.w3.eth.contract(
address=network.BANCOR_V3_NETWORK_INFO_ADDRESS,
abi=BANCOR_V3_NETWORK_INFO_ABI,
)
self.ARB_CONTRACT_VERSION = self.BANCOR_ARBITRAGE_CONTRACT.caller.version()

else:
self.CARBON_CONTROLLER_CONTRACT = None
self.BANCOR_ARBITRAGE_CONTRACT = None
self.ARB_CONTRACT_VERSION = 10

if self.BANCOR_ARBITRAGE_CONTRACT is not None:
try:
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ def run(
w3.provider.make_request(method="evm_increaseBlocks", params=params)
if (
loop_idx % version_check_frequency == 0
and version_check_frequency != -1
and version_check_frequency != -1 and blockchain in "ethereum"
):
# Check the version of the deployed arbitrage contract
mgr.cfg.provider.check_version_of_arb_contract()
Expand Down

0 comments on commit 8ede243

Please sign in to comment.