From 8fb21257e09fa5b727122fade5f266e90ba7459c Mon Sep 17 00:00:00 2001 From: mUniKeS Date: Wed, 18 Mar 2026 10:49:29 +0100 Subject: [PATCH] Add Celo blockchain support Add Celo (chain ID 42220) as a supported EVM blockchain: - Add 'celo' to supported blockchains list - Add Uniswap V3 exchange config for Celo with official contract addresses - Add wcelo wrapped token exchange (CELO/WCELO swap) - Add Celo exchange routing (Uniswap V3 + WCELO) --- src/blockchains.js | 8 ++++---- src/exchanges.js | 16 ++++++++++++++++ src/exchanges/uniswap_v3.js | 24 +++++++++++++++++++++++- src/exchanges/wcelo.js | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 src/exchanges/wcelo.js diff --git a/src/blockchains.js b/src/blockchains.js index 2b50a0c..91235b4 100644 --- a/src/blockchains.js +++ b/src/blockchains.js @@ -1,7 +1,7 @@ /*#if _EVM -let supported = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'] -supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'] +let supported = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain', 'celo'] +supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain', 'celo'] supported.svm = [] /*#elif _SVM @@ -12,8 +12,8 @@ supported.svm = ['solana'] //#else */ -let supported = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'] -supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain'] +let supported = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain', 'celo'] +supported.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base', 'worldchain', 'celo'] supported.svm = ['solana'] //#endif diff --git a/src/exchanges.js b/src/exchanges.js index 2092a02..85e1e0d 100644 --- a/src/exchanges.js +++ b/src/exchanges.js @@ -9,6 +9,7 @@ import uniswap_v2 from './exchanges/uniswap_v2' import uniswap_v3 from './exchanges/uniswap_v3' import wavax from './exchanges/wavax' import wbnb from './exchanges/wbnb' +import wcelo from './exchanges/wcelo' import weth from './exchanges/weth' import weth_arbitrum from './exchanges/weth_arbitrum' import weth_base from './exchanges/weth_base' @@ -34,6 +35,7 @@ const exchanges = [ wftm(), wavax(), wxdai(), + wcelo(), ] exchanges.forEach((exchange)=>{ @@ -105,6 +107,12 @@ exchanges.worldchain = [ ] exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange }) +exchanges.celo = [ + uniswap_v3('celo'), + wcelo('celo'), +] +exchanges.celo.forEach((exchange)=>{ exchanges.celo[exchange.name] = exchange }) + /*#elif _SVM @@ -148,6 +156,7 @@ import weth_optimism from './exchanges/weth_optimism' import weth_base from './exchanges/weth_base' import wftm from './exchanges/wftm' import wmatic from './exchanges/wmatic' +import wcelo from './exchanges/wcelo' import wxdai from './exchanges/wxdai' const exchanges = [ @@ -170,6 +179,7 @@ const exchanges = [ wftm(), wavax(), wxdai(), + wcelo(), ] exchanges.forEach((exchange)=>{ exchanges[exchange.name] = exchange @@ -247,6 +257,12 @@ exchanges.worldchain = [ ] exchanges.worldchain.forEach((exchange)=>{ exchanges.worldchain[exchange.name] = exchange }) +exchanges.celo = [ + uniswap_v3('celo'), + wcelo('celo'), +] +exchanges.celo.forEach((exchange)=>{ exchanges.celo[exchange.name] = exchange }) + //#endif export default exchanges diff --git a/src/exchanges/uniswap_v3.js b/src/exchanges/uniswap_v3.js index a1ae8f6..d556b50 100644 --- a/src/exchanges/uniswap_v3.js +++ b/src/exchanges/uniswap_v3.js @@ -11,7 +11,7 @@ const exchange = { slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche', 'worldchain', 'gnosis'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche', 'worldchain', 'gnosis', 'celo'], ethereum: { router: { @@ -211,6 +211,28 @@ const exchange = { } }, + celo: { + router: { + address: '0x5615CDAb10dc425a742d643d949a7F474C01abc4', + api: UniswapV3.ROUTER + }, + factory: { + address: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022D473030F116dDEE9F6B43aC78BA3', + api: UniswapV3.PERMIT2 + } + }, + } export default (scope)=>{ diff --git a/src/exchanges/wcelo.js b/src/exchanges/wcelo.js new file mode 100644 index 0000000..c2094df --- /dev/null +++ b/src/exchanges/wcelo.js @@ -0,0 +1,37 @@ +import Blockchains from '@depay/web3-blockchains' +import Exchange from '../classes/Exchange' +import WETH from '../platforms/evm/weth' + +const exchange = { + + name: 'wcelo', + label: 'Wrapped Celo', + logo: Blockchains.celo.wrapped.logo, + protocol: 'weth', + + slippage: false, + + blockchains: ['celo'], + + celo: { + router: { + address: Blockchains.celo.wrapped.address, + api: WETH.WETH + }, + } +} + +export default (scope)=>{ + + return new Exchange( + + Object.assign(exchange, { + scope, + findPath: (args)=>WETH.findPath({ ...args, exchange }), + pathExists: (args)=>WETH.pathExists({ ...args, exchange }), + getAmounts: (args)=>WETH.getAmounts({ ...args, exchange }), + getPrep: (args)=>{}, + getTransaction: (args)=>WETH.getTransaction({ ...args, exchange }), + }) + ) +}