Skip to content

Commit

Permalink
feat: update addresses (#9717)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates addresses, adjusts order parameters, and refactors
mappings in the `pcsx-sdk`.

### Detailed summary
- Updated addresses in `pcsx-sdk`
- Adjusted order parameters in `ExclusiveDutchOrder.test.ts`
- Refactored mappings in `constants.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chefrabbid committed Apr 30, 2024
1 parent 0f66e07 commit 8c52665
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-cougars-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pancakeswap/pcsx-sdk': patch
---

update address
11 changes: 3 additions & 8 deletions packages/pcsx-sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import { ChainId } from '@pancakeswap/chains'
import type { Address } from 'viem'
import { getPermit2Address } from '@pancakeswap/permit2-sdk'

export const SupportedChainId = [ChainId.ETHEREUM, ChainId.BSC, ChainId.BSC_TESTNET] as const
export const SupportedChainId = [ChainId.BSC, ChainId.BSC_TESTNET] as const

export type XSupportedChainId = (typeof SupportedChainId)[number]

export const PERMIT2_MAPPING = {
[ChainId.ETHEREUM]: getPermit2Address(ChainId.ETHEREUM),
[ChainId.BSC]: getPermit2Address(ChainId.BSC),
[ChainId.BSC_TESTNET]: getPermit2Address(ChainId.BSC_TESTNET),
} as const satisfies Record<XSupportedChainId, Address | undefined>

export const ORDER_QUOTER_MAPPING = {
[ChainId.ETHEREUM]: '0x54539967a06Fc0E3C3ED0ee320Eb67362D13C5fF',
[ChainId.BSC]: '0xF812A85c70b05Df76ff3bC802c0244307033Ccd0',
[ChainId.BSC]: '0x369B57fE0Fab4d5a110e4F02b871979DE0300C18',
[ChainId.BSC_TESTNET]: '0x6f73C295E70Cd87307dD73c4730c685Bb977bB70',
} as const satisfies Record<XSupportedChainId, Address>

Expand All @@ -29,11 +27,8 @@ export type Reactors = {
type ReactorMapping = { readonly [key in XSupportedChainId]: Reactors }

export const REACTOR_ADDRESS_MAPPING = {
[ChainId.ETHEREUM]: {
[OrderType.ExclusiveDutchOrder]: '0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4',
},
[ChainId.BSC]: {
[OrderType.ExclusiveDutchOrder]: '0x003BcEe8ca3e9B94aF07964F45e104FE0D68fD8C',
[OrderType.ExclusiveDutchOrder]: '0xDB9D365b50E62fce747A90515D2bd1254A16EbB9',
},
[ChainId.BSC_TESTNET]: {
[OrderType.ExclusiveDutchOrder]: '0xCfe2a565072f85381775Eb12644d297bf0F66773',
Expand Down
1 change: 1 addition & 0 deletions packages/pcsx-sdk/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ export const KNOWN_ERRORS: { [key: string]: OrderValidation } = {
// "062dec56": OrderValidation.ExclusivityPeriod,
// Exclusive Filler Validation NotExclusiveFiller
'75c1bb14': OrderValidation.ExclusivityPeriod,
// Usually did not approve permit2
TRANSFER_FROM_FAILED: OrderValidation.InsufficientFunds,
}
8 changes: 4 additions & 4 deletions packages/pcsx-sdk/src/orders/ExclusiveDutchOrder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ describe('ExclusiveDutchOrder', () => {

it('parses a encoded order', () => {
const orderInfo = getOrderInfo({})
const order = new ExclusiveDutchOrder(orderInfo, 1)
const order = new ExclusiveDutchOrder(orderInfo, 97)
const encoded = order.encode()
const parsed = ExclusiveDutchOrder.parse(encoded, 1)
const parsed = ExclusiveDutchOrder.parse(encoded, 97)
expect(parsed.info).toEqual(orderInfo)
})

it('valid signature over info', async () => {
const order = new ExclusiveDutchOrder(getOrderInfo({}), 1)
const order = new ExclusiveDutchOrder(getOrderInfo({}), 97)

const privateKey = generatePrivateKey()
const account = privateKeyToAccount(privateKey)
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('ExclusiveDutchOrder', () => {
decayStartTime: 100n,
decayEndTime: 100n,
}),
1,
97,
)

expect(order.hash()).toMatchInlineSnapshot(`"0x7cef8eb26ac11e086c2784eb12d93cb9a4a68b3f04ce56b0858ff59829a13f0a"`)
Expand Down

0 comments on commit 8c52665

Please sign in to comment.