Skip to content

Commit

Permalink
Add support for Celo blockchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesigh-3100 committed Jul 25, 2024
1 parent e308f7e commit 2770e2c
Show file tree
Hide file tree
Showing 14 changed files with 3,623 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export WEB3_FANTOM="FANTOM-API-KEY-HERE" // "public" can be used in place of a p
export WEB3_MANTLE="MANTLE-API-KEY-HERE"
export WEB3_LINEA="LINEA-API-KEY-HERE" //
export WEB3_SEI="SEI-API-KEY-HERE" //
export WEB3_CELO="CELO-API-KEY-HERE" //

#******** For Development - not required to run bot ********#
export ETHERSCAN_TOKEN="ONLY_REQUIRED_IN_DEV"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export WEB3_FANTOM="api_key_here"
export WEB3_MANTLE="api_key_here"
export WEB3_LINEA="api_key_here"
export WEB3_SEI="api_key_here"
export WEB3_CELO="api_key_here"
```
**Note:** To use the Fantom public RPC, write "public" in place of the API key.

Expand Down
16 changes: 10 additions & 6 deletions fastlane_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,16 @@ def _handle_trade_instructions(
)
]

route_struct_processed = add_wrap_or_unwrap_trades_to_route(
cfg=self.ConfigObj,
flashloans=flashloan_struct,
routes=route_struct,
trade_instructions=split_calculated_trade_instructions,
)
# Do not add wrap/unwrap transactions on Celo
if self.ConfigObj.NETWORK == "celo":
route_struct_processed = route_struct
else:
route_struct_processed = add_wrap_or_unwrap_trades_to_route(
cfg=self.ConfigObj,
flashloans=flashloan_struct,
routes=route_struct,
trade_instructions=split_calculated_trade_instructions,
)

maximize_last_trade_per_tkn(route_struct=route_struct_processed)

Expand Down
1 change: 1 addition & 0 deletions fastlane_bot/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@
"mantle": 0,
"linea": 0,
"sei": 2000,
"celo": 0,
}
46 changes: 45 additions & 1 deletion fastlane_bot/config/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class ConfigNetwork(ConfigBase):
NETWORK_MANTLE = S.NETWORK_MANTLE
NETWORK_LINEA = S.NETWORK_LINEA
NETWORK_SEI = S.NETWORK_SEI
NETWORK_CELO = S.NETWORK_CELO

# FLAGS
#######################################################################################
Expand Down Expand Up @@ -319,7 +320,9 @@ def new(cls, network=None):
elif network == cls.NETWORK_LINEA:
return _ConfigNetworkLinea(_direct=False)
elif network == cls.NETWORK_SEI:
return _ConfigNetworkSei(_direct=False)
return _ConfigNetworkSei(_direct=False)
elif network == cls.NETWORK_CELO:
return _ConfigNetworkCelo(_direct=False)
elif network == cls.NETWORK_TENDERLY:
return _ConfigNetworkTenderly(_direct=False)
else:
Expand Down Expand Up @@ -821,6 +824,47 @@ class _ConfigNetworkSei(ConfigNetwork):
# Add any exchanges unique to the chain here
CHAIN_SPECIFIC_EXCHANGES = []

class _ConfigNetworkCelo(ConfigNetwork):
"""
Fastlane bot config -- network [Base Mainnet]
"""

NETWORK = S.NETWORK_CELO
NETWORK_ID = "42220" #
NETWORK_NAME = "celo"
DEFAULT_PROVIDER = S.PROVIDER_ALCHEMY

RPC_ENDPOINT = "https://lb.drpc.org/ogrpc?network=celo&dkey="
WEB3_ALCHEMY_PROJECT_ID = os.environ.get("WEB3_CELO")

network_df = get_multichain_addresses(network=NETWORK_NAME)
FASTLANE_CONTRACT_ADDRESS = "0x8c05EA305235a67c7095a32Ad4a2Ee2688aDe636"
MULTICALL_CONTRACT_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11"

CARBON_CONTROLLER_ADDRESS = "0x6619871118D144c1c28eC3b23036FC1f0829ed3a"
CARBON_CONTROLLER_VOUCHER = "0x5E994Ac7d65d81f51a76e0bB5a236C6fDA8dBF9A"

NATIVE_GAS_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
WRAPPED_GAS_TOKEN_ADDRESS = "0x471EcE3750Da237f93B8E339c536989b8978a438"
NATIVE_GAS_TOKEN_SYMBOL = "CELO"
WRAPPED_GAS_TOKEN_SYMBOL = "WCELO"
STABLECOIN_ADDRESS = "0xcebA9300f2b948710d2653dD7B07f33A8B32118C"

IS_INJECT_POA_MIDDLEWARE = True
# No Balancer fork with significant liquidity
BALANCER_VAULT_ADDRESS = "0x0000000000000000000000000000000000000000"

CHAIN_FLASHLOAN_TOKENS = {
WRAPPED_GAS_TOKEN_ADDRESS: "WCELO",
"0xcebA9300f2b948710d2653dD7B07f33A8B32118C": "USDC",
}
# Add any exchanges unique to the chain here
CHAIN_SPECIFIC_EXCHANGES = []

TAX_TOKENS = set([
])


class _ConfigNetworkTenderly(ConfigNetwork):
"""
Fastlane bot config -- network [Ethereum Tenderly]
Expand Down
1 change: 1 addition & 0 deletions fastlane_bot/config/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
NETWORK_BSC = "binance_smart_chain"
NETWORK_POLYGON = "polygon"
NETWORK_POLYGON_ZKEVM = "polygon_zkevm"
NETWORK_CELO = "celo"

DATABASE_SQLITE = "sqlite"
DATABASE_POSTGRES = "postgres"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exchange,address
1,466 changes: 1,466 additions & 0 deletions fastlane_bot/data/blockchain_data/celo/static_pool_data.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 2770e2c

Please sign in to comment.