diff --git a/README.md b/README.md index b056c2d7..cc1d3df2 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,32 @@ Humans interact with the TypeScript files & our services pull in the JSON files! ## Testing Locally +### [yalc](https://www.npmjs.com/package/yalc) + +1. `yalc publish` (in package) +2. `yalc add ` (in package consumer repo) + - `yalc link` is another option +3. `yalc remove ` + - `yalc remove --all` another option + +#### `yalc` installation + +Using NPM: +`npm i yalc -g` +Using Yarn: +`yarn global add yalc` + +### `npm link` + 1. `yarn` (Install latest deps) -2. *Update lists as needed* +2. _Update lists as needed_ 3. `yarn build && yarn legacy-build` 4. `npm link` 5. Go to frontend repo locally `npm link @ape.swap/apeswap-lists` ### Updating while linked -1. *Update lists as needed* +1. _Update lists as needed_ 2. `yarn build && yarn legacy-build` 3. The changes should then be reflected on the local linked repo. @@ -33,3 +50,156 @@ Humans interact with the TypeScript files & our services pull in the JSON files! 1. Go to frontend repo locally `npm unlink @ape.swap/apeswap-lists` 2. Still on local frontend: `yarn install` (Reinstall package) 3. `npm unlink` + +## Publishing Test Packages + +Sometimes a package needs to be deployed with test tokens. We suggest using a `--tag=testX` tag scheme +to denote this packages have test tokens included in them + +```bash +yarn build +npm publish --access=public --tag=test0 +``` + +# Config + +## Token + +This is the current interface of Token + +```js +export interface Token { + symbol: string + address: Partial> + active: boolean + decimals?: Partial> + dontFetch?: boolean + lpToken?: boolean + price?: number + liquidityDex?: Partial> + getLpUrl?: Partial> +} +``` + +With more recently added properties `liquidityDex` and `getLpUrl` + +### `LiquidityDex` + +This property was added because of us introducing different non ApeLP bonds. For example QS (Algebra) and PCS. +This is a way of telling FE that the bond is a non ApeLP and the pricing of the LP should be retrieved differently. +Besides that we also have different zapping strategies so this also makes sure the right zap strategy is used. + +```js +liquidityDex: { + [ChainId.BSC]: LiquidityDex.PancakeSwapV2, + [ChainId.Polygon]: LiquidityDex.Algebra, + }, +``` + +### `getLpUrl` + +For some non ApeLP bonds we don't have a working zap strategy and we should send users to an external url to get the right LPs. This is the url the users will be send to. + +Only used and a must when zap version for liquidityDex is `ZapVersion.External`. +Check [dexToZapMapping.ts](./src/constants/dexToZapMapping.ts) for what strategy is used for what LiquidityDex. + +```js +getLpUrl: { + [ChainId.BSC]: "https://www.{url}.com", + [ChainId.Polygon]: "https://www.{url}.com", + }, +``` + +### Example config + +```js + pcsBnbUsdt: { + symbol: 'BNB-USDT', + address: { + [ChainId.BSC]: '0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE', + }, + decimals: { + [ChainId.BSC]: 18, + }, + active: false, + lpToken: true, + liquidityDex: { + [ChainId.BSC]: LiquidityDex.PancakeSwapV2, + }, + getLpUrl: { + [ChainId.BSC]: 'https://pancakeswap.finance/v2/add/0x55d398326f99059fF775485246999027B3197955/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + }, + }, +``` + +## Bills/Bonds + +This is the current interface for Bills + +```js +export interface BillsConfig { + index: number + contractAddress: Partial> + billVersion: BillVersion + billType: 'liquidity' | 'reserve' | 'launch' + token: Token + quoteToken: Token + lpToken: Token + earnToken: Token + billNnftAddress: Partial> + inactive?: boolean + projectLink?: string + twitter?: string + initTime?: Partial> + initPrice?: Partial> + audit?: string + soldOut?: boolean + billArt?: { + collection: BillArtCollection // i.e. BillArtCollection.ApeSwap_Collection1 + } +} +``` + +With more recently added property `billArt` + +### `billArt` + +This property was added to be able to support multiple bond arts. Currently the supported bill arts are ApeSwap and Quickswap with default ApeSwap if nothing is specified. + +``` +export enum BillArtCollection { + ApeSwap_Collection1 = 'ApeSwap_Collection1', + Quickswap_Collection1 = 'Quickswap_Collection1', +} +``` + +``` +billArt: { collection: BillArtCollection.Quickswap_Collection1 } +``` + +# Example + +``` + { + index: 16543, + contractAddress: { + [ChainId.MATIC]: '0xa54d14007bdc29d1d2ff0607efac0bae9ecaf9b9', + }, + billType: 'liquidity', + billVersion: BillVersion.V2, + token: tokens.quick, + quoteToken: tokens.wmatic, + lpToken: tokens.quickMatic, + earnToken: tokens.TTT, + billNnftAddress: { + [ChainId.MATIC]: '0xa1c78af783fb9ea7be790cbbd01abff63beae769', + }, + inactive: false, + projectLink: 'https://www.quickswap.app/', + twitter: 'https://twitter.com/', + audit: 'Add audit link', + initTime: { [ChainId.MATIC]: 1690287710 }, + initPrice: { [ChainId.MATIC]: 0.00123 }, + billArt: { collection: BillArtCollection.Quickswap_Collection1 }, + }, +``` diff --git a/config/bills.json b/config/bills.json index 3ce814b7..813ba76d 100644 --- a/config/bills.json +++ b/config/bills.json @@ -404,6 +404,73 @@ }, "soldOut": false }, + { + "index": 80, + "contractAddress": { + "56": "0xDB728D1503079B5313dD80257580fc5dC476AFd3" + }, + "billType": "liquidity", + "billVersion": "V2", + "token": { + "symbol": "FURFI", + "address": { + "56": "0x6CFf19F714E9f0Ac62412555aa08f313fc343aE4" + }, + "decimals": { + "56": 18 + }, + "active": true + }, + "quoteToken": { + "symbol": "BNB", + "address": { + "56": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + "97": "0xae13d989dac2f0debff460ac112a837c89baa7cd", + "137": "0xa649325aa7c5093d12d6f98eb4378deae68ce23f" + }, + "decimals": { + "56": 18, + "97": 18, + "137": 18 + }, + "active": true + }, + "lpToken": { + "symbol": "FURFI-BNB", + "address": { + "56": "0x4428AC6AD2Be88C59e811F8953dA9Dd603FC2fEA" + }, + "decimals": { + "56": 18 + }, + "active": true, + "lpToken": true + }, + "earnToken": { + "symbol": "FURFI", + "address": { + "56": "0x6CFf19F714E9f0Ac62412555aa08f313fc343aE4" + }, + "decimals": { + "56": 18 + }, + "active": true + }, + "billNnftAddress": { + "56": "0xB75BE16984A27d3023e1cF744E2587e9Aa8750c9" + }, + "inactive": false, + "projectLink": "https://furiofi.com/", + "twitter": "https://twitter.com/furiocrypto", + "audit": "https://solidity.finance/audits/Furio/", + "initTime": { + "56": 1691427600 + }, + "initPrice": { + "56": 4.85872 + }, + "soldOut": false + }, { "index": 79, "contractAddress": { diff --git a/config/tokens.json b/config/tokens.json index 5cb352de..bf334d10 100644 --- a/config/tokens.json +++ b/config/tokens.json @@ -1794,6 +1794,16 @@ }, "active": true }, + "furfi": { + "symbol": "FURFI", + "address": { + "56": "0x6CFf19F714E9f0Ac62412555aa08f313fc343aE4" + }, + "decimals": { + "56": 18 + }, + "active": true + }, "avan": { "symbol": "AVAN", "address": { @@ -2709,6 +2719,17 @@ "active": true, "lpToken": true }, + "furfiBnb": { + "symbol": "FURFI-BNB", + "address": { + "56": "0x4428AC6AD2Be88C59e811F8953dA9Dd603FC2fEA" + }, + "decimals": { + "56": 18 + }, + "active": true, + "lpToken": true + }, "brzBusd": { "symbol": "BRZ-BUSD", "address": { diff --git a/package.json b/package.json index c8541ad6..cd1db0c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ape.swap/apeswap-lists", - "version": "1.4.6", + "version": "1.4.8", "main": "dist/index.js", "typings": "dist/index.d.ts", "publishConfig": { @@ -16,10 +16,9 @@ "license": "MIT", "module": "dist/apeswap-lists.esm.js", "scripts": { - "build:full": "yarn build && yarn legacy-build", - "build": "tsdx build", + "build": "tsdx build && yarn legacy-build", "start": "tsdx watch", - "prepublishOnly": "tsdx build", + "prepublishOnly": "yarn build", "prepare": "husky install", "test": "jest", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", diff --git a/src/constants/bills.ts b/src/constants/bills.ts index fb0f8080..d41e9553 100644 --- a/src/constants/bills.ts +++ b/src/constants/bills.ts @@ -2,7 +2,7 @@ import { ChainId } from '@ape.swap/sdk' import tokens from './tokens' import { BillsConfig, BillVersion } from '../types' -// BNB Largest ID: 79 +// BNB Largest ID: 80 // Polygon Largest ID: 109 // Telos Largest ID: 215 // Arbitrum Largest ID: 2003 @@ -118,6 +118,28 @@ const bills: BillsConfig[] = [ initPrice: { [ChainId.BSC]: 0.0303088 }, soldOut: false, }, + { + index: 80, + contractAddress: { + [ChainId.BSC]: '0xDB728D1503079B5313dD80257580fc5dC476AFd3', + }, + billType: 'liquidity', + billVersion: BillVersion.V2, + token: tokens.furfi, + quoteToken: tokens.wbnb, + lpToken: tokens.furfiBnb, + earnToken: tokens.furfi, + billNnftAddress: { + [ChainId.BSC]: '0xB75BE16984A27d3023e1cF744E2587e9Aa8750c9', + }, + inactive: false, + projectLink: 'https://furiofi.com/', + twitter: 'https://twitter.com/furiocrypto', + audit: 'https://solidity.finance/audits/Furio/', + initTime: { [ChainId.BSC]: 1691427600 }, + initPrice: { [ChainId.BSC]: 4.85872 }, + soldOut: false, + }, { index: 79, contractAddress: { diff --git a/src/constants/dexToZapMapping.ts b/src/constants/dexToZapMapping.ts new file mode 100644 index 00000000..3b99b846 --- /dev/null +++ b/src/constants/dexToZapMapping.ts @@ -0,0 +1,26 @@ +import { ChainId } from '@ape.swap/sdk' +import { LiquidityDex, ZapVersion } from '../types' + +export const dexToZapMapping: Record>> = { + [LiquidityDex.ApeSwapV2]: { + [ChainId.BSC]: ZapVersion.ZapV1, + [ChainId.BSC_TESTNET]: ZapVersion.ZapV1, + [ChainId.MATIC]: ZapVersion.ZapV1, + [ChainId.MATIC_TESTNET]: ZapVersion.ZapV1, + [ChainId.MAINNET]: ZapVersion.ZapV1, + [ChainId.ARBITRUM]: ZapVersion.ZapV1, + [ChainId.TLOS]: ZapVersion.ZapV1, + }, + [LiquidityDex.Algebra]: { + [ChainId.MATIC]: ZapVersion.External, + }, + [LiquidityDex.PancakeSwapV2]: { + [ChainId.BSC]: ZapVersion.External, + [ChainId.MAINNET]: ZapVersion.External, + }, + [LiquidityDex.QuickswapV2]: { + [ChainId.MATIC]: ZapVersion.External, + }, + [LiquidityDex.ApeSwapV3]: {}, + [LiquidityDex.UniswapV3]: {}, +} diff --git a/src/constants/index.ts b/src/constants/index.ts index 3236dd07..e48ebf11 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -10,4 +10,5 @@ export { default as iaos } from './iaos' export { default as zapInputTokens } from './zapInputTokens' export { default as farmsV2 } from './farmsV2' export { default as vaultsV3 } from './vaultsV3' -export { dexFactories, defaultDexFactories } from './dexFactories' +export * from './dexFactories' +export * from './dexToZapMapping' diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 62a8547e..0ba728ef 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -1815,6 +1815,14 @@ const tokens: Record = { decimals: { [ChainId.BSC]: 9 }, active: true, }, + furfi: { + symbol: 'FURFI', + address: { + [ChainId.BSC]: '0x6CFf19F714E9f0Ac62412555aa08f313fc343aE4', + }, + decimals: { [ChainId.BSC]: 18 }, + active: true, + }, avan: { symbol: 'AVAN', address: { @@ -2727,6 +2735,15 @@ const tokens: Record = { active: true, lpToken: true, }, + furfiBnb: { + symbol: 'FURFI-BNB', + address: { + [ChainId.BSC]: '0x4428AC6AD2Be88C59e811F8953dA9Dd603FC2fEA', + }, + decimals: { [ChainId.BSC]: 18 }, + active: true, + lpToken: true, + }, brzBusd: { symbol: 'BRZ-BUSD', address: { diff --git a/src/types/index.ts b/src/types/index.ts index 21559601..fcbc069c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -22,11 +22,24 @@ export enum LiquidityDex { ApeSwapV2 = 'ApeSwapV2', ApeSwapV3 = 'ApeSwapV3', PancakeSwapV2 = 'PancakeSwapV2', + /** + * Initially, LiquidityDex was for the price getter and that checks algebra pricing + * (gamma wraps over it so no pricing there). + * Now we use it for zapVersion as well where Gamma is better. + */ Algebra = 'Algebra', QuickswapV2 = 'QuickswapV2', UniswapV3 = 'UniswapV3', } +export enum ZapVersion { + External = 'External', //This will redirect users to Token.getLpUrl with get lp button on FE + ZapV1 = 'ZapV1', //First original inhouse built non multicall zap + // NOTE: ZapV2 is not yet operational + // ZapV2 = 'ZapV2', //Second inhouse built dynamic multicall zap + Wido = 'Wido', //https://www.joinwido.com/ +} + export enum Protocols { Both = 1, V2 = 2, @@ -50,7 +63,8 @@ export interface Token { dontFetch?: boolean lpToken?: boolean price?: number - liquidityDex?: Partial> + liquidityDex?: Partial> //the dex type where most liquidity/actual lp is + getLpUrl?: Partial> //Needed for ZapVersion.External } // Interfaces used in Vaults @@ -66,6 +80,19 @@ export enum BillVersion { V2 = 'V2', } +/** + * This enum defines the art collection used to generate the art for a bill (bond). + * + * NOTE: Collections start at 1. The collection number provides a method to make new releases around + * the same theme or project. + */ +export enum BillArtCollection { + ApeSwap_Collection1 = 'ApeSwap_Collection1', + Quickswap_Collection1 = 'Quickswap_Collection1', +} + +export const defaultBillArtCollection = BillArtCollection.ApeSwap_Collection1 + // Start of list types export interface BillsConfig { index: number @@ -84,6 +111,9 @@ export interface BillsConfig { initPrice?: Partial> audit?: string soldOut?: boolean + billArt?: { + collection: BillArtCollection // i.e. BillArtCollection.ApeSwap_Collection1 + } } export enum VaultVersion {