Skip to content

Commit

Permalink
feat: update contract configurations and addresses for Taiko support …
Browse files Browse the repository at this point in the history
…in AMM V3
  • Loading branch information
yrjkqq committed Jan 15, 2025
1 parent a9259c7 commit bbdeecc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/dodoex-api/src/chainConfig/contractConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ChainId } from './chain';

const contractMap: {
[key in ChainId]: {
/** MulticallWithValid */
MULTI_CALL: string;
DODO_APPROVE: string;
/** ERC20Helper */
Expand All @@ -19,7 +20,7 @@ const contractMap: {
ROUTE_V1_DATA_FETCH: string;
/** DODOCalleeHelper */
CALLEE_HELPER: string;

/** DODOV2Proxy02 */
DODO_PROXY: string;
/** DODODspProxy */
DODO_DSP_PROXY: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { ChainId, SUPPORTED_CHAINS, SupportedChainsType } from './chains';
type AddressMap = { [chainId: number]: string };

type ChainAddresses = {
/**
* UniswapV3Factory
* @see https://taikoscan.io/address/0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2?tab=contract#code
*/
v3CoreFactoryAddress: string;
/**
* NonfungiblePositionManager
* @see https://taikoscan.io/address/0x2623281DdcC34A73a9e8898f2c57A32A860903f1?tab=contract#code
*/
nonfungiblePositionManagerAddress?: string;
};

Expand All @@ -28,15 +36,20 @@ const SEPOLIA_ADDRESSES: ChainAddresses = {
'0x483E5c0f309577f79b0a19cE65E332DD388aD7A8',
};

const TAIKO_ADDRESSES: ChainAddresses = {
v3CoreFactoryAddress: '0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2',
nonfungiblePositionManagerAddress:
'0x2623281DdcC34A73a9e8898f2c57A32A860903f1',
};

export const CHAIN_TO_ADDRESSES_MAP: Record<
SupportedChainsType,
ChainAddresses
> = {
[ChainId.MAINNET]: MAINNET_ADDRESSES,
[ChainId.ARBITRUM_ONE]: ARBITRUM_ONE_ADDRESSES,
[ChainId.SEPOLIA]: SEPOLIA_ADDRESSES,
// TODO
[ChainId.TAIKO]: SEPOLIA_ADDRESSES,
[ChainId.TAIKO]: TAIKO_ADDRESSES,
};

/* V3 Contract Addresses */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { ChainId } from '../sdk-core';

export const FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984';
/**
* Taiko UniswapV3Factory
* @see https://taikoscan.io/address/0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2?tab=contract#code
*/
export const FACTORY_ADDRESS = '0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2';

export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000';

// @deprecated please use poolInitCodeHash(chainId: ChainId)
export const POOL_INIT_CODE_HASH =
'0x4509fa1e2d1989ac1632a56fe87c53e8d1e9d05847694e00f62b23e28cec98c4';
'0x5ccd5621c1bb9e44ce98cef8b90d31eb2423dec3793b6239232cefae976936ea';

/**
* Taiko POOL_INIT_CODE_HASH
* @see PoolAddress.sol
* @see https://taikoscan.io/address/0x202bEE65B164aEcBb6A2318438bf46bEF14E1072?tab=contract#code#F12#L6
*/
export function poolInitCodeHash(chainId?: ChainId): string {
switch (chainId) {
case ChainId.TAIKO:
return '0x5ccd5621c1bb9e44ce98cef8b90d31eb2423dec3793b6239232cefae976936ea';
default:
return POOL_INIT_CODE_HASH;
}
Expand Down

0 comments on commit bbdeecc

Please sign in to comment.