Skip to content

Commit

Permalink
feat: sepolia network
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Dec 26, 2023
1 parent 1dfac8d commit 042ffb2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/common/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export enum SupportedChainId {
MAINNET = 1,
GOERLI = 5,
GNOSIS_CHAIN = 100,
SEPOLIA = 11155111,
}
40 changes: 16 additions & 24 deletions src/common/consts.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
import { SupportedChainId } from './chains'
import contractNetworks from '@cowprotocol/contracts/networks.json'

const { GPv2Settlement } = JSON.parse(contractNetworks as unknown as string) as typeof contractNetworks

export const BUY_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
export const EXTENSIBLE_FALLBACK_HANDLER = '0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5'
export const COMPOSABLE_COW = '0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74'

const SETTLEMENT_CONTRACT = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41'

/**
* The list of supported chains.
*/
export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [
SupportedChainId.MAINNET,
SupportedChainId.GOERLI,
SupportedChainId.GNOSIS_CHAIN,
SupportedChainId.SEPOLIA,
]

const mapAddressToNetworks: (address: string) => Record<SupportedChainId, string> = (address: string) => {
return ALL_SUPPORTED_CHAIN_IDS.reduce<Record<number, string>>(
(acc, chainId) => ({
...acc,
[chainId]: address,
}),
{}
)
}

/**
* An object containing the addresses of the CoW Protocol settlement contracts for each supported chain.
*/
export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce<Record<number, string>>(
(acc, chainId) => ({
...acc,
[chainId]: GPv2Settlement[chainId].address,
}),
{}
)
export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = mapAddressToNetworks(SETTLEMENT_CONTRACT)

/**
* An object containing the addresses of the `ExtensibleFallbackHandler` contracts for each supported chain.
*/
export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce<Record<number, string>>(
(acc, chainId) => ({
...acc,
[chainId]: EXTENSIBLE_FALLBACK_HANDLER,
}),
{}
)
export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = mapAddressToNetworks(EXTENSIBLE_FALLBACK_HANDLER)

/**
* An object containing the addresses of the `ComposableCow` contracts for each supported chain.
*/
export const COMPOSABLE_COW_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce<Record<number, string>>(
(acc, chainId) => ({
...acc,
[chainId]: COMPOSABLE_COW,
}),
{}
)
export const COMPOSABLE_COW_CONTRACT_ADDRESS = mapAddressToNetworks(COMPOSABLE_COW)
2 changes: 2 additions & 0 deletions src/order-book/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const ORDER_BOOK_PROD_CONFIG: ApiBaseUrls = {
[SupportedChainId.MAINNET]: 'https://api.cow.fi/mainnet',
[SupportedChainId.GNOSIS_CHAIN]: 'https://api.cow.fi/xdai',
[SupportedChainId.GOERLI]: 'https://api.cow.fi/goerli',
[SupportedChainId.SEPOLIA]: 'https://api.cow.fi/sepolia',
}

/**
Expand All @@ -48,6 +49,7 @@ export const ORDER_BOOK_STAGING_CONFIG: ApiBaseUrls = {
[SupportedChainId.MAINNET]: 'https://barn.api.cow.fi/mainnet',
[SupportedChainId.GNOSIS_CHAIN]: 'https://barn.api.cow.fi/xdai',
[SupportedChainId.GOERLI]: 'https://barn.api.cow.fi/goerli',
[SupportedChainId.SEPOLIA]: 'https://barn.api.cow.fi/sepolia',
}

function cleanObjectFromUndefinedValues(obj: Record<string, string>): typeof obj {
Expand Down
11 changes: 4 additions & 7 deletions src/order-book/generated/models/OrderPostError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@ export namespace OrderPostError {
SELL_AMOUNT_OVERFLOW = 'SellAmountOverflow',
TRANSFER_SIMULATION_FAILED = 'TransferSimulationFailed',
ZERO_AMOUNT = 'ZeroAmount',
INCOMPATIBLE_SIGNING_SCHEME = 'IncompatibleSigningScheme',
UNSUPPORTED_BUY_TOKEN_DESTINATION = 'UnsupportedBuyTokenDestination',
INCOMPATIBLE_SIGNING_SCHEME = 'IncompatibleSigningScheme',
TOO_MANY_LIMIT_ORDERS_UNSUPPORTED_BUY_TOKEN_DESTINATION = 'TooManyLimitOrders UnsupportedBuyTokenDestination',
UNSUPPORTED_SELL_TOKEN_SOURCE = 'UnsupportedSellTokenSource',
UNSUPPORTED_ORDER_TYPE = 'UnsupportedOrderType',
INSUFFICIENT_VALID_TO = 'InsufficientValidTo',
EXCESSIVE_VALID_TO = 'ExcessiveValidTo',
TRANSFER_ETH_TO_CONTRACT = 'TransferEthToContract',
INVALID_NATIVE_SELL_TOKEN = 'InvalidNativeSellToken',
SAME_BUY_AND_SELL_TOKEN = 'SameBuyAndSellToken',
INVALID_NATIVE_SELL_TOKEN_SAME_BUY_AND_SELL_TOKEN = 'InvalidNativeSellToken SameBuyAndSellToken',
UNSUPPORTED_SIGNATURE = 'UnsupportedSignature',
TOO_MANY_LIMIT_ORDERS= 'TooManyLimitOrders',
INVALID_APP_DATA = 'InvalidAppData',
UNSUPPORTED_TOKEN = 'UnsupportedToken',
UNSUPPORTED_CUSTOM_INTERACTION = 'UnsupportedCustomInteraction',
UNSUPPORTED_CUSTOM_INTERACTION_INVALID_APP_DATA = 'UnsupportedCustomInteraction InvalidAppData',
APP_DATA_HASH_MISMATCH = 'AppDataHashMismatch',
}

Expand Down
2 changes: 2 additions & 0 deletions src/subgraph/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const SUBGRAPH_PROD_CONFIG: ApiBaseUrls = {
[SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow',
[SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc',
[SupportedChainId.GOERLI]: SUBGRAPH_BASE_URL + '/cow-goerli',
[SupportedChainId.SEPOLIA]: SUBGRAPH_BASE_URL + '/cow-sepolia',
}

/**
Expand All @@ -30,6 +31,7 @@ export const SUBGRAPH_STAGING_CONFIG: ApiBaseUrls = {
[SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow-staging',
[SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc-staging',
[SupportedChainId.GOERLI]: '',
[SupportedChainId.SEPOLIA]: '',
}

/**
Expand Down

0 comments on commit 042ffb2

Please sign in to comment.