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

Add Bttc network #1049

Open
wants to merge 5 commits into
base: dev2
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
add bttc chain
totop716 committed Nov 2, 2023
commit b00164d2c957418348a211ba082e7d5fd0b34ec9
220 changes: 68 additions & 152 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "^5.3.1",
"@uniswap/liquidity-staker": "^1.0.2",
"@uniswap/sdk": "npm:[email protected].23",
"@uniswap/sdk": "npm:[email protected].24",
"@uniswap/sdk-core": "^3.2.2",
"@uniswap/token-lists": "npm:quickswap-token-lists@^1.0.1",
"@uniswap/v2-core": "1.0.0",
72 changes: 72 additions & 0 deletions src/config/bttc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"v3": true,
"v2": false,
"rpc": "https://rpc.bt.io",
"blockExplorer": "https://bttcscan.com",
"networkName": "BitTorrent Chain Mainnet",
"aprAPINetwork": "bttc",
"chainId": 199,
"isMainnet": true,
"nativeCurrencyImage": "/manta.svg",
"nativeCurrency": {
"name": "BitTorrent Token",
"symbol": "BTT",
"decimals": 18
},
"swap": {
"available": true,
"bestTrade": false,
"proMode": false,
"limitOrder": false,
"liquidityHub": false,
"crossChain": false
},
"pools": {
"available": true
},
"farm": {
"available": false
},
"lair": {
"available": false,
"oldLair": false,
"newLair": false,
"syrup": false
},
"convert": {
"available": false
},
"predictions": {
"available": false
},
"analytics": {
"available": true
},
"lending": {
"available": false
},
"migrate": {
"available": false
},
"gamingHub": {
"available": false
},
"leaderboard": {
"available": false
},
"safe": {
"available": false
},
"perps": {
"available": false
},
"bos": {
"available": false
},
"gamma": {
"available": false
},
"unipilot": {
"available": false
}
}
3 changes: 3 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -5,14 +5,17 @@ import zkmainnet from './zkmainnet.json';
import manta from './manta.json';
import zkartana from './zkartana.json';
import qlpmanager from './qlpmanager.json';
import bttc from './bttc.json';
import { ChainId } from '@uniswap/sdk';

const configs: any = {
[ChainId.MATIC]: polygon,
[ChainId.DOGECHAIN]: dogechain,
[ChainId.ZKTESTNET]: zktestnet,
[ChainId.ZKEVM]: zkmainnet,
[ChainId.MANTA]: manta,
[ChainId.ZKATANA]: zkartana,
[ChainId.BTTC]: bttc,
};

export const getConfig = (network: ChainId | undefined) => {
4 changes: 4 additions & 0 deletions src/connectors/index.ts
Original file line number Diff line number Diff line change
@@ -120,6 +120,10 @@ export const networkInfoMap: NetworkInfoChainMap = {
rpcUrl: 'https://rpc.zkatana.gelato.digital',
scanUrl: 'https://zkatana.blockscout.com/',
},
[ChainId.BTTC]: {
rpcUrl: 'https://rpc.bt.io',
scanUrl: 'https://bttcscan.com/',
},
};

const FORMATIC_KEY = process.env.REACT_APP_FORTMATIC_KEY;
7 changes: 7 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ export const CHAIN_IDS_TO_NAMES = {
[ChainId.KAVA]: 'kava',
[ChainId.MANTA]: 'manta',
[ChainId.ZKATANA]: 'zKatana',
[ChainId.BTTC]: 'bttc',
};

export enum TxnType {
@@ -104,6 +105,7 @@ export const BONUS_CUTOFF_AMOUNT = {
[ChainId.MANTA]: 0,
[ChainId.KAVA]: 0,
[ChainId.ZKATANA]: 0,
[ChainId.BTTC]: 0,
};

export const GlobalConst = {
@@ -223,6 +225,7 @@ export const SUPPORTED_CHAINIDS = [
ChainId.ZKTESTNET,
ChainId.ZKEVM,
ChainId.MANTA,
ChainId.BTTC,
];

export interface GammaPair {
@@ -1563,6 +1566,7 @@ export const GlobalValue = {
[ChainId.KAVA]: [],
[ChainId.MANTA]: [],
[ChainId.ZKATANA]: [],
[ChainId.BTTC]: [],
},
},
marketSDK: {
@@ -1624,6 +1628,7 @@ export const GlobalData = {
DAI[ChainId.MANTA],
],
[ChainId.ZKATANA]: [USDC[ChainId.ZKATANA]],
[ChainId.BTTC]: [],
},
blueChips: {
[ChainId.MATIC]: [
@@ -1661,6 +1666,7 @@ export const GlobalData = {
DAI[ChainId.MANTA],
],
[ChainId.ZKATANA]: [WETH[ChainId.ZKATANA], USDC[ChainId.ZKATANA]],
[ChainId.BTTC]: [],
},
stablePairs: {
[ChainId.MATIC]: [
@@ -1685,6 +1691,7 @@ export const GlobalData = {
[ChainId.KAVA]: [],
[ChainId.MANTA]: [],
[ChainId.ZKATANA]: [],
[ChainId.BTTC]: [],
},
};

2 changes: 2 additions & 0 deletions src/constants/providers.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ export const rpcMap = {
[ChainId.KAVA]: '',
[ChainId.MANTA]: 'https://pacific-rpc.manta.network/http',
[ChainId.ZKATANA]: 'https://rpc.zkatana.gelato.digital',
[ChainId.BTTC]: 'https://rpc.bt.io',
};

class AppJsonRpcProvider extends StaticJsonRpcProvider {
@@ -76,4 +77,5 @@ export const RPC_PROVIDERS: {
[ChainId.KAVA]: new AppJsonRpcProvider(ChainId.KAVA),
[ChainId.MANTA]: new AppJsonRpcProvider(ChainId.MANTA),
[ChainId.ZKATANA]: new AppJsonRpcProvider(ChainId.ZKATANA),
[ChainId.BTTC]: new AppJsonRpcProvider(ChainId.BTTC),
};
22 changes: 22 additions & 0 deletions src/constants/v3/addresses.ts
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ const WETH_ONLY: ChainTokenList = {
[ChainId.MANTA]: [WETH[ChainId.MANTA]],
[ChainId.KAVA]: [WETH[ChainId.KAVA]],
[ChainId.ZKATANA]: [WETH[ChainId.ZKATANA]],
[ChainId.BTTC]: [WETH[ChainId.BTTC]],
};

export const toV3Token = (t: {
@@ -57,6 +58,7 @@ export const MULTICALL_NETWORKS: { [chainId in ChainId]?: string } = {
[ChainId.ZKEVM]: '0x6a1d2eca13222E7ffDDfdf1Df701D41D3E4cC0BE',
[ChainId.MANTA]: '0x55BeE1bD3Eb9986f6d2d963278de09eE92a3eF1D',
[ChainId.ZKATANA]: '0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd',
[ChainId.BTTC]: '0x55BeE1bD3Eb9986f6d2d963278de09eE92a3eF1D',
};

export const V3_CORE_FACTORY_ADDRESSES: AddressMap = {
@@ -84,6 +86,7 @@ export const UNIV3_QUOTER_ADDRESSES: AddressMap = {
[ChainId.ZKEVM]: '0xB18FB423Fb241CE0DE345d74904f97D60792FFd8',
[ChainId.MANTA]: '0x3005827fB92A0cb7D0f65738D6D645d98A4Ad96b',
[ChainId.ZKATANA]: '0x6c28AeF8977c9B773996d0e8376d2EE379446F2f',
[ChainId.BTTC]: '0xE9CC37904875B459Fa5D0FE37680d36F1ED55e38',
};

export const SWAP_ROUTER_ADDRESSES: AddressMap = {
@@ -108,19 +111,22 @@ export const UNI_V3_FACTORY_ADDRESS: AddressMap = {
[ChainId.ZKEVM]: '0xD9a2AD9E927Bd7014116CC5c7328f028D4318178',
[ChainId.MANTA]: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
[ChainId.ZKATANA]: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
[ChainId.BTTC]: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
};

export const UNI_NFT_POSITION_MANAGER_ADDRESS: AddressMap = {
[ChainId.ZKEVM]: '0x331F3a300b7115A45ba31E3428AC002267BB6D77',
[ChainId.MANTA]: '0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff',
[ChainId.ZKATANA]: '0x55BeE1bD3Eb9986f6d2d963278de09eE92a3eF1D',
[ChainId.BTTC]: '0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff',
};

export const UNI_SWAP_ROUTER: AddressMap = {
[ChainId.MATIC]: '0xE592427A0AEce92De3Edee1F18E0157C05861564',
[ChainId.ZKEVM]: '0x1E7E4c855520b2106320952A570a3e5E3E618101',
[ChainId.MANTA]: '0xfdE3eaC61C5Ad5Ed617eB1451cc7C3a0AC197564',
[ChainId.ZKATANA]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
[ChainId.BTTC]: '0x6c28AeF8977c9B773996d0e8376d2EE379446F2f',
};

export const GAMMA_UNIPROXY_ADDRESSES: AddressMap = {
@@ -148,6 +154,7 @@ export const MULTICALL_ADDRESS: AddressMap = {
[ChainId.ZKEVM]: '0x61530d6E1c7A47BBB3e48e8b8EdF7569DcFeE121',
[ChainId.MANTA]: '0x1FD671daC06DF1431E79d772037E93bdB2dfeb48',
[ChainId.ZKATANA]: '0x61211321E272584d6686F79bb205082C4cDa5d5F',
[ChainId.BTTC]: '0xdc55A13b6b61A8fDa5ACDf760D14AF9DA9a38367',
};

export const V3_MIGRATOR_ADDRESSES: AddressMap = {
@@ -320,6 +327,13 @@ export const WMATIC_EXTENDED: { [chainId: number]: TokenV3 } = {
'WETH',
'Wrapped ETHER',
),
[ChainId.BTTC]: new TokenV3(
ChainId.BTTC,
'0x23181F21DEa5936e24163FFABa4Ea3B316B57f3C',
18,
'WBTT',
'Wrapped BTT',
),
};

export const USDC: { [chainId: number]: Token } = {
@@ -365,6 +379,13 @@ export const USDC: { [chainId: number]: Token } = {
'USDC',
'USD Coin',
),
[ChainId.BTTC]: new Token(
ChainId.BTTC,
'0xAE17940943BA9440540940DB0F1877f101D39e8b',
6,
'USDC_e',
'USD Coin_Ethereum',
),
};

export const USDCE: { [chainId: number]: Token } = {
@@ -1033,6 +1054,7 @@ export const SUGGESTED_BASES: {
WBTC[ChainId.MANTA],
],
[ChainId.ZKATANA]: [WETH[ChainId.ZKATANA], USDC[ChainId.ZKATANA]],
[ChainId.BTTC]: [WETH[ChainId.BTTC], USDC[ChainId.BTTC]],
};

export const V2_BASES_TO_TRACK_LIQUIDITY_FOR: {
9 changes: 9 additions & 0 deletions src/constants/v3/chains.ts
Original file line number Diff line number Diff line change
@@ -83,4 +83,13 @@ export const CHAIN_INFO: ChainInfo = {
nativeCurrencyName: 'Ether',
nativeCurrencyDecimals: 18,
},
[ChainId.BTTC]: {
docs: 'https://algebra.finance/',
explorer: 'https://bttcscan.com',
infoLink: 'https://algebra.finance',
label: 'bttc',
nativeCurrencySymbol: 'BTT',
nativeCurrencyName: 'BitTorrent Token',
nativeCurrencyDecimals: 18,
},
};
1 change: 1 addition & 0 deletions src/state/cnt/hooks.ts
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ const EMPTY_LIST: CNTFarmInfoAddressMap = {
[ChainId.KAVA]: {},
[ChainId.MANTA]: {},
[ChainId.ZKATANA]: {},
[ChainId.BTTC]: {},
};

const farmCache: WeakMap<CNTFarmListInfo, CNTFarmInfoAddressMap> | null =
1 change: 1 addition & 0 deletions src/state/dualfarms/hooks.ts
Original file line number Diff line number Diff line change
@@ -110,6 +110,7 @@ const EMPTY_LIST: DualFarmInfoAddressMap = {
[ChainId.MANTA]: {},
[ChainId.KAVA]: {},
[ChainId.ZKATANA]: {},
[ChainId.BTTC]: {},
};

const dualFarmCache: WeakMap<DualFarmListInfo, DualFarmInfoAddressMap> | null =
1 change: 1 addition & 0 deletions src/state/farms/hooks.ts
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ const EMPTY_LIST: StakingInfoAddressMap = {
[ChainId.MANTA]: {},
[ChainId.KAVA]: {},
[ChainId.ZKATANA]: {},
[ChainId.BTTC]: {},
};

const farmCache: WeakMap<FarmListInfo, StakingInfoAddressMap> | null =
1 change: 1 addition & 0 deletions src/state/lists/hooks.ts
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ const EMPTY_LIST: TokenAddressMap = {
[ChainId.MANTA]: {},
[ChainId.KAVA]: {},
[ChainId.ZKATANA]: {},
[ChainId.BTTC]: {},
};

const listCache: WeakMap<TokenList, TokenAddressMap> | null =
1 change: 1 addition & 0 deletions src/state/syrups/hooks.ts
Original file line number Diff line number Diff line change
@@ -84,6 +84,7 @@ const EMPTY_LIST: SyrupInfoAddressMap = {
[ChainId.MANTA]: {},
[ChainId.KAVA]: {},
[ChainId.ZKATANA]: {},
[ChainId.BTTC]: {},
};

const syrupCache: WeakMap<SyrupListInfo, SyrupInfoAddressMap> | null =