-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Work in progress * Add unit tests * More tests * Pull expiry status from validation * Set cron to max timeout * Add comments * Fix lint * Lint fix
- Loading branch information
Showing
8 changed files
with
512 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { CosignedPriorityOrder, CosignedV2DutchOrder, CosignedV3DutchOrder, DutchOrder, UniswapXOrder, OrderType } from '@uniswap/uniswapx-sdk' | ||
import { ChainId } from '../util/chain' | ||
import { UniswapXOrderEntity } from '../entities' | ||
|
||
export function parseOrder(order: UniswapXOrderEntity, chainId: ChainId): UniswapXOrder { | ||
switch (order.type) { | ||
case OrderType.Dutch: | ||
case OrderType.Limit: | ||
return DutchOrder.parse(order.encodedOrder, chainId) | ||
case OrderType.Dutch_V2: | ||
return CosignedV2DutchOrder.parse(order.encodedOrder, chainId) | ||
case OrderType.Dutch_V3: | ||
return CosignedV3DutchOrder.parse(order.encodedOrder, chainId) | ||
case OrderType.Priority: | ||
return CosignedPriorityOrder.parse(order.encodedOrder, chainId) | ||
default: | ||
throw new Error(`Unsupported OrderType ${JSON.stringify(order)}, No Parser Configured`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
import { ChainId } from "./chain" | ||
|
||
export const WEBHOOK_CONFIG_BUCKET = 'order-webhook-notification-config' | ||
export const PRODUCTION_WEBHOOK_CONFIG_KEY = 'production.json' | ||
export const BETA_WEBHOOK_CONFIG_KEY = 'beta.json' | ||
export const NATIVE_ADDRESS = '0x0000000000000000000000000000000000000000' | ||
export const ONE_HOUR_IN_SECONDS = 60 * 60 | ||
export const ONE_DAY_IN_SECONDS = 60 * 60 * 24 | ||
export const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365 | ||
|
||
export const OLDEST_BLOCK_BY_CHAIN = { | ||
[ChainId.MAINNET]: 20120259, | ||
[ChainId.ARBITRUM_ONE]: 253597707, | ||
[ChainId.BASE]: 22335646, | ||
[ChainId.UNICHAIN]: 6747397, | ||
} | ||
export const BLOCK_TIME_MS_BY_CHAIN = { | ||
[ChainId.MAINNET]: 12000, | ||
[ChainId.ARBITRUM_ONE]: 250, | ||
[ChainId.BASE]: 2000, | ||
[ChainId.UNICHAIN]: 1000, | ||
} | ||
export const BLOCK_RANGE = 10000 | ||
export const CRON_MAX_ATTEMPTS = 10 | ||
//Dynamo limits batch write to 25 | ||
export const DYNAMO_BATCH_WRITE_MAX = 25 |
Oops, something went wrong.