Skip to content
Open
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
10 changes: 9 additions & 1 deletion packages/pancake-uikit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@
"ethers": "^5.1.4",
"@web3-react/core": "^6.1.9",
"@ethersproject/experimental": "^5.0.1",
"react-transition-group": "^4.4.1"
"react-transition-group": "^4.4.1",
"@uniswap/token-lists": "^1.0.0-beta.19",
"@uniswap/v2-core": "^1.0.0",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"redux-localstorage-simple": "^2.4.1",
"@web3-react/injected-connector": "^6.0.7",
"@web3-react/walletconnect-connector": "^6.2.4",
"@binance-chain/bsc-connector": "^1.0.0",
"immer": "7.0.15"
},
"publishConfig": {
"access": "public"
Expand Down
222 changes: 222 additions & 0 deletions packages/pancake-uikit/src/config/abi/erc20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]
103 changes: 103 additions & 0 deletions packages/pancake-uikit/src/config/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { ChainId, JSBI, Percent, Token } from "@doodaswap/sdk";
import { mainnetTokens, testnetTokens } from "./tokens";

export const ROUTER_ADDRESS = "0xF4d81360FC84226816c8711E0Cb432484D301BC7";

// a list of tokens by chain
type ChainTokenList = {
readonly [chainId in ChainId]: Token[];
};

// used to construct intermediary pairs for trading
export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
[ChainId.MAINNET]: [
mainnetTokens.wbnb,
mainnetTokens.cake,
mainnetTokens.busd,
mainnetTokens.usdt,
mainnetTokens.btcb,
mainnetTokens.ust,
mainnetTokens.eth,
mainnetTokens.usdc,
],
[ChainId.TESTNET]: [testnetTokens.wbnb, testnetTokens.cake, testnetTokens.busd],
};

/**
* Addittional bases for specific tokens
* @example { [WBTC.address]: [renBTC], [renBTC.address]: [WBTC] }
*/
export const ADDITIONAL_BASES: { [chainId in ChainId]?: { [tokenAddress: string]: Token[] } } = {
[ChainId.MAINNET]: {},
};

/**
* Some tokens can only be swapped via certain pairs, so we override the list of bases that are considered for these
* tokens.
* @example [AMPL.address]: [DAI, WETH[ChainId.MAINNET]]
*/
export const CUSTOM_BASES: { [chainId in ChainId]?: { [tokenAddress: string]: Token[] } } = {
[ChainId.MAINNET]: {},
};

// used for display in the default list when adding liquidity
export const SUGGESTED_BASES: ChainTokenList = {
[ChainId.MAINNET]: [mainnetTokens.busd, mainnetTokens.cake, mainnetTokens.btcb],
[ChainId.TESTNET]: [testnetTokens.wbnb, testnetTokens.cake, testnetTokens.busd],
};

// used to construct the list of all pairs we consider by default in the frontend
export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = {
[ChainId.MAINNET]: [mainnetTokens.wbnb, mainnetTokens.dai, mainnetTokens.busd, mainnetTokens.usdt],
[ChainId.TESTNET]: [testnetTokens.wbnb, testnetTokens.cake, testnetTokens.busd],
};

export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } = {
[ChainId.MAINNET]: [
[mainnetTokens.cake, mainnetTokens.wbnb],
[mainnetTokens.busd, mainnetTokens.usdt],
[mainnetTokens.dai, mainnetTokens.usdt],
],
};

export const NetworkContextName = "NETWORK";

// default allowed slippage, in bips
export const INITIAL_ALLOWED_SLIPPAGE = 50;
// 20 minutes, denominated in seconds
export const DEFAULT_DEADLINE_FROM_NOW = 60 * 20;

export const BIG_INT_ZERO = JSBI.BigInt(0);

// one basis point
export const ONE_BIPS = new Percent(JSBI.BigInt(1), JSBI.BigInt(10000));
export const BIPS_BASE = JSBI.BigInt(10000);
// used for warning states
export const ALLOWED_PRICE_IMPACT_LOW: Percent = new Percent(JSBI.BigInt(100), BIPS_BASE); // 1%
export const ALLOWED_PRICE_IMPACT_MEDIUM: Percent = new Percent(JSBI.BigInt(300), BIPS_BASE); // 3%
export const ALLOWED_PRICE_IMPACT_HIGH: Percent = new Percent(JSBI.BigInt(500), BIPS_BASE); // 5%
// if the price slippage exceeds this number, force the user to type 'confirm' to execute
export const PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN: Percent = new Percent(JSBI.BigInt(1000), BIPS_BASE); // 10%
// for non expert mode disable swaps above this
export const BLOCKED_PRICE_IMPACT_NON_EXPERT: Percent = new Percent(JSBI.BigInt(1500), BIPS_BASE); // 15%

// used to ensure the user doesn't send so much BNB so they end up with <.01
export const MIN_BNB: JSBI = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(16)); // .01 BNB
export const BETTER_TRADE_LESS_HOPS_THRESHOLD = new Percent(JSBI.BigInt(50), JSBI.BigInt(10000));

export const ZERO_PERCENT = new Percent("0");
export const ONE_HUNDRED_PERCENT = new Percent("1");

// SDN OFAC addresses
export const BLOCKED_ADDRESSES: string[] = [
"0x7F367cC41522cE07553e823bf3be79A889DEbe1B",
"0xd882cFc20F52f2599D84b8e8D58C7FB62cfE344b",
"0x901bb9583b24D97e995513C6778dc6888AB6870e",
"0xA7e5d5A720f06526557c513402f2e6B5fA20b008",
"0x8576aCC5C05D6Ce88f4e49bf65BdF0C62F91353C",
];

// export { default as farmsConfig } from "./farms";
// export { default as oldFarmsConfig } from "./oldFarms";
// export { default as poolsConfig } from "./pools";
// export { default as ifosConfig } from "./ifo";
14 changes: 14 additions & 0 deletions packages/pancake-uikit/src/config/constants/lists.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const PANCAKE_EXTENDED = "https://tokens.pancakeswap.finance/pancakeswap-extended.json";
const PANCAKE_TOP100 = "https://tokens.pancakeswap.finance/pancakeswap-top-100.json";

export const UNSUPPORTED_LIST_URLS: string[] = [];

// lower index == higher priority for token import
export const DEFAULT_LIST_OF_LISTS: string[] = [
PANCAKE_TOP100,
PANCAKE_EXTENDED,
...UNSUPPORTED_LIST_URLS, // need to load unsupported tokens as well
];

// default lists to be 'active' aka searched across
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [];
39 changes: 39 additions & 0 deletions packages/pancake-uikit/src/config/constants/nfts/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Address, Images } from "../types";

export enum CollectionKey {
PANCAKE = "pancake",
}

type Collection = {
name: string;
address: Address;
};

export type Collections = {
[key in CollectionKey]: Collection;
};

export type NftImages = {
blur?: string;
} & Images;

export type Nft = {
id?: number | string;
name: string;
description: string;
images: NftImages;
video?: {
webm: string;
mp4: string;
};

// Uniquely identifies the nft.
// Used for matching an NFT from the config with the data from the NFT's tokenURI
identifier: string;

attributes?: any;
};

export type Nfts = {
[key in CollectionKey]: Nft[];
};
Loading