Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Bitlayer Testnet #1

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/check-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Check PR Title

on:
pull_request_target:
types:
- opened
- edited
- synchronize
# pull_request_target:
# types:
# - opened
# - edited
# - synchronize
workflow_dispatch:

jobs:
# Ensures that the PR title adheres to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
Expand All @@ -14,4 +15,4 @@ jobs:
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions .github/workflows/monorepo-checks.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: "Code Quality Checks"

on:
workflow_call:
# workflow_call:

pull_request:
types:
- opened
- synchronize
- reopened
# pull_request:
# types:
# - opened
# - synchronize
# - reopened

workflow_dispatch:

jobs:
build-and-test:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/monorepo-integrity.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: "Monorepo Integrity"

on:
pull_request:
branches:
- "**"
push:
branches:
- main
# pull_request:
# branches:
# - "**"
# push:
# branches:
# - main
workflow_dispatch:

jobs:
monorepo-integrity:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/push-branches-from-main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: "Push changes to beta and alpha branches"

on:
push:
branches:
- main
# push:
# branches:
# - main
workflow_dispatch:

jobs:
dev-branch-push:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Release

on:
push:
branches:
- main
- beta
# push:
# branches:
# - main
# - beta
workflow_dispatch:

jobs:
release:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/semgrep.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Semgrep
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- main
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: "35 11 * * *"
# pull_request: {}
# push:
# branches:
# - main
# schedule:
# # random HH:MM to avoid a load spike on GitHub Actions at 00:00
# - cron: "35 11 * * *"
jobs:
semgrep:
name: semgrep/ci
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"solidity.compileUsingRemoteVersion": "v0.8.17",
"solidity.formatter": "forge",
"files.insertFinalNewline": true,
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"eslint.workingDirectories": [
"./sdks/permit2-sdk",
"./sdks/router-sdk",
Expand All @@ -15,4 +15,4 @@
"./sdks/v3-sdk",
],
"testing.openTesting": "neverOpen"
}
}
6 changes: 3 additions & 3 deletions sdks/router-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
},
"dependencies": {
"@ethersproject/abi": "^5.5.0",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/sdk-core": "workspace:*",
"@uniswap/swap-router-contracts": "^1.3.0",
"@uniswap/v2-sdk": "^4.3.2",
"@uniswap/v3-sdk": "^3.11.2"
"@uniswap/v2-sdk": "workspace:*",
"@uniswap/v3-sdk": "workspace:*"
},
"devDependencies": {
"@types/jest": "^24.0.25",
Expand Down
28 changes: 18 additions & 10 deletions sdks/sdk-core/src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ const ZORA_SEPOLIA_ADDRESSES: ChainAddresses = {
tickLensAddress: '0x23C0F71877a1Fc4e20A78018f9831365c85f3064',
}

const ROOTSTOCK_ADDRESSES: ChainAddresses = {
v3CoreFactoryAddress: '0xaF37EC98A00FD63689CF3060BF3B6784E00caD82',
multicallAddress: '0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386',
quoterAddress: '0xb51727c996C68E60F598A923a5006853cd2fEB31',
v3MigratorAddress: '0x16678977CA4ec3DAD5efc7b15780295FE5f56162',
nonfungiblePositionManagerAddress: '0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1',
tickLensAddress: '0x55B9dF5bF68ADe972191a91980459f48ecA16afC',
swapRouter02Address: '0x0B14ff67f0014046b4b99057Aec4509640b3947A',
}
// const ROOTSTOCK_ADDRESSES: ChainAddresses = {
// v3CoreFactoryAddress: '0xaF37EC98A00FD63689CF3060BF3B6784E00caD82',
// multicallAddress: '0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386',
// quoterAddress: '0xb51727c996C68E60F598A923a5006853cd2fEB31',
// v3MigratorAddress: '0x16678977CA4ec3DAD5efc7b15780295FE5f56162',
// nonfungiblePositionManagerAddress: '0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1',
// tickLensAddress: '0x55B9dF5bF68ADe972191a91980459f48ecA16afC',
// swapRouter02Address: '0x0B14ff67f0014046b4b99057Aec4509640b3947A',
// }

const BLAST_ADDRESSES: ChainAddresses = {
v3CoreFactoryAddress: '0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd',
Expand All @@ -236,6 +236,13 @@ const BLAST_ADDRESSES: ChainAddresses = {
swapRouter02Address: '0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66',
}

const BITLAYER_TESTNET_ADDRESSES: ChainAddresses = {
v3CoreFactoryAddress: '0xc95D939Da72ECe8Bd794d42EaEd28974CDb0ADa2',
multicallAddress: '0x3d33856dcf74f110690f5a2647c7dfb9bb5ff2d0',
quoterAddress: '0x6677D5Bb2Bc48f4F35E2a9b516bb29fBc1d22049',
nonfungiblePositionManagerAddress: '0x6b5622503fe2ca3cd371f7dfe5393df04b63ce22',
}

export const CHAIN_TO_ADDRESSES_MAP: Record<SupportedChainsType, ChainAddresses> = {
[ChainId.MAINNET]: MAINNET_ADDRESSES,
[ChainId.OPTIMISM]: OPTIMISM_ADDRESSES,
Expand All @@ -256,8 +263,9 @@ export const CHAIN_TO_ADDRESSES_MAP: Record<SupportedChainsType, ChainAddresses>
[ChainId.BASE_GOERLI]: BASE_GOERLI_ADDRESSES,
[ChainId.ZORA]: ZORA_ADDRESSES,
[ChainId.ZORA_SEPOLIA]: ZORA_SEPOLIA_ADDRESSES,
[ChainId.ROOTSTOCK]: ROOTSTOCK_ADDRESSES,
// [ChainId.ROOTSTOCK]: ROOTSTOCK_ADDRESSES,
[ChainId.BLAST]: BLAST_ADDRESSES,
[ChainId.BITLAYER_TESTNET]: BITLAYER_TESTNET_ADDRESSES,
}

/* V3 Contract Addresses */
Expand Down
8 changes: 5 additions & 3 deletions sdks/sdk-core/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export enum ChainId {
BASE = 8453,
ZORA = 7777777,
ZORA_SEPOLIA = 999999999,
ROOTSTOCK = 30,
// ROOTSTOCK = 30,
BLAST = 81457,
BITLAYER_TESTNET = 200810,
}

export const SUPPORTED_CHAINS = [
Expand All @@ -44,8 +45,9 @@ export const SUPPORTED_CHAINS = [
ChainId.BASE_GOERLI,
ChainId.ZORA,
ChainId.ZORA_SEPOLIA,
ChainId.ROOTSTOCK,
// ChainId.ROOTSTOCK,
ChainId.BLAST,
ChainId.BITLAYER_TESTNET,
] as const
export type SupportedChainsType = (typeof SUPPORTED_CHAINS)[number]

Expand All @@ -58,5 +60,5 @@ export enum NativeCurrencyName {
MOONBEAM = 'GLMR',
BNB = 'BNB',
AVAX = 'AVAX',
ROOTSTOCK = 'RBTC',
// ROOTSTOCK = 'RBTC',
}
2 changes: 2 additions & 0 deletions sdks/sdk-core/src/entities/weth9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export const WETH9: { [chainId: number]: Token } = {
56: new Token(56, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'),
137: new Token(137, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'),
43114: new Token(43114, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX'),

200810: new Token(200810, '0x5F8D4232367759bCe5d9488D3ade77FCFF6B9b6B', 18, 'WBTC', 'Wrapped BTC'),
}
2 changes: 1 addition & 1 deletion sdks/uniswapx-sdk/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ethersproject/bytes": "^5.7.0",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/sdk-core": "workspace:*",
"ethers": "^5.7.0",
"typechain": "^8.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion sdks/uniswapx-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@uniswap/permit2-sdk": "^1.2.1",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/sdk-core": "workspace:*",
"ethers": "^5.7.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions sdks/universal-router-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
},
"dependencies": {
"@uniswap/permit2-sdk": "^1.2.1",
"@uniswap/router-sdk": "^1.9.2",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/router-sdk": "workspace:*",
"@uniswap/sdk-core": "workspace:*",
"@uniswap/universal-router": "1.6.0",
"@uniswap/v2-sdk": "^4.3.2",
"@uniswap/v3-sdk": "^3.11.2",
"@uniswap/v2-sdk": "workspace:*",
"@uniswap/v3-sdk": "workspace:*",
"bignumber.js": "^9.0.2",
"ethers": "^5.7.0"
},
Expand Down
6 changes: 6 additions & 0 deletions sdks/universal-router-sdk/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ const CHAIN_CONFIGS: { [key: number]: ChainConfig } = {
weth: '0x4200000000000000000000000000000000000006',
creationBlock: 11832155,
},
// bitlayer testnet
[200810]: {
router: '0x9d39bafc6EDd28075f3B369e175B3f014f740864',
weth: '0x5F8D4232367759bCe5d9488D3ade77FCFF6B9b6B',
creationBlock: 3937748,
},
}

export const UNIVERSAL_ROUTER_ADDRESS = (chainId: number): string => {
Expand Down
2 changes: 1 addition & 1 deletion sdks/v2-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@ethersproject/address": "^5.0.2",
"@ethersproject/solidity": "^5.0.9",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/sdk-core": "workspace:*",
"tiny-invariant": "^1.1.0",
"tiny-warning": "^1.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion sdks/v3-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@ethersproject/abi": "^5.5.0",
"@ethersproject/solidity": "^5.0.9",
"@uniswap/sdk-core": "^5.0.0",
"@uniswap/sdk-core": "workspace:*",
"@uniswap/swap-router-contracts": "^1.3.0",
"@uniswap/v3-periphery": "^1.1.1",
"@uniswap/v3-staker": "1.0.0",
Expand Down
11 changes: 9 additions & 2 deletions sdks/v3-sdk/src/utils/computePoolAddress.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { defaultAbiCoder } from '@ethersproject/abi'
import { getCreate2Address } from '@ethersproject/address'
import { keccak256 } from '@ethersproject/solidity'
import { Token } from '@uniswap/sdk-core'
import { ChainId, Token } from '@uniswap/sdk-core'
import { FeeAmount, POOL_INIT_CODE_HASH } from '../constants'

function getInitCodeOfSpecialChain(chainId: ChainId) {
if (chainId === ChainId.BITLAYER_TESTNET) {
return '0x9b06af945a15e497de0a98c56727a90114ae2d082285037c0045493ce98241aa'
}
return POOL_INIT_CODE_HASH
}

/**
* Computes a pool address
* @param factoryAddress The Uniswap V3 factory address
Expand Down Expand Up @@ -33,6 +40,6 @@ export function computePoolAddress({
['bytes'],
[defaultAbiCoder.encode(['address', 'address', 'uint24'], [token0.address, token1.address, fee])]
),
initCodeHashManualOverride ?? POOL_INIT_CODE_HASH
initCodeHashManualOverride ?? getInitCodeOfSpecialChain(token0.chainId)
)
}
5 changes: 3 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"sdks/*/src/**.ts",
"sdks/*/src/**.tsx"
],
"outputs": []
"outputs": [],
"dependsOn": ["^build"]
},
"test": {
"dependsOn": [
Expand All @@ -27,4 +28,4 @@
"dependsOn": []
}
}
}
}
Loading
Loading