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

v1.5.0 + Furfi Bond #193

Merged
merged 16 commits into from
Aug 7, 2023
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
174 changes: 172 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <package-name>` (in package consumer repo)
- `yalc link` is another option
3. `yalc remove <package-name>`
- `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.

Expand All @@ -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<Record<ChainId, string>>
active: boolean
decimals?: Partial<Record<ChainId, number | null>>
dontFetch?: boolean
lpToken?: boolean
price?: number
liquidityDex?: Partial<Record<ChainId, LiquidityDex>>
getLpUrl?: Partial<Record<ChainId, string>>
}
```

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<Record<ChainId, string>>
billVersion: BillVersion
billType: 'liquidity' | 'reserve' | 'launch'
token: Token
quoteToken: Token
lpToken: Token
earnToken: Token
billNnftAddress: Partial<Record<ChainId, string>>
inactive?: boolean
projectLink?: string
twitter?: string
initTime?: Partial<Record<ChainId, number>>
initPrice?: Partial<Record<ChainId, number>>
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 },
},
```
67 changes: 67 additions & 0 deletions config/bills.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
21 changes: 21 additions & 0 deletions config/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,16 @@
},
"active": true
},
"furfi": {
"symbol": "FURFI",
"address": {
"56": "0x6CFf19F714E9f0Ac62412555aa08f313fc343aE4"
},
"decimals": {
"56": 18
},
"active": true
},
"avan": {
"symbol": "AVAN",
"address": {
Expand Down Expand Up @@ -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": {
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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}'",
Expand Down
24 changes: 23 additions & 1 deletion src/constants/bills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: {
Expand Down
26 changes: 26 additions & 0 deletions src/constants/dexToZapMapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ChainId } from '@ape.swap/sdk'
import { LiquidityDex, ZapVersion } from '../types'

export const dexToZapMapping: Record<LiquidityDex, Partial<Record<ChainId, ZapVersion>>> = {
[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]: {},
}
3 changes: 2 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Loading