config-lists
How to Manage this Repo
When you would like to make an edit to one of the lists in this repo, please only edit the .ts files. This is for better type control and to reduce the chance of errors. To apply the changes run yarn build (which also includes yarn legacy-build) in the console.
For example, to edit a bond:
- Open the
constants/bonds.ts file.
- Make the edits & save
- Run
yarn build to apply these changes to the corresponding JSON files
- Run
yarn test to make sure the JSON files are valid
- Commit to the Github repo
Humans interact with the TypeScript files & our services pull in the JSON files! ❤️
Testing Locally
yalc publish (in package)
yalc add <package-name> (in package consumer repo)
yalc link is another option
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
yarn (Install latest deps)
- Update lists as needed
yarn build
npm link
- Go to frontend repo locally
npm link @goodaofi/config-lists
Updating while linked
- Update lists as needed
yarn build
- The changes should then be reflected on the local linked repo.
Unlink
- Go to frontend repo locally
npm unlink @goodaofi/config-lists
- Still on local frontend:
yarn install (Reinstall package)
npm unlink
Publishing Test Packages
Sometimes a package needs to be deployed with test tokens. We suggest using a --tag test tag scheme
to denote this packages have test tokens included in them
yarn publish --tag test
yarn publish command will prompt you for a new version. We suggest using X.X.X-test.0 version scheme.
It will automatically bump the version for you and create a commit with the new version.
Publishing Alpha Packages
We could apply the same logic to deploy alpha packages with --tag alpha and so on.
yarn publish --tag alpha
yarn publish command will prompt you for a new version. We suggest using X.X.X-alpha.0 version scheme.
It will automatically bump the version for you and create a commit with the new version.
Config
Token
This is the current interface of Token
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.
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 for what strategy is used for what LiquidityDex.
getLpUrl: {
[ChainId.BSC]: "https://www.{url}.com",
[ChainId.Polygon]: "https://www.{url}.com",
},
Example config
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',
},
},
Bonds
This is the current interface for Bonds
export interface BondsConfig {
index: number
contractAddress: Partial<Record<ChainId, string>>
bondVersion: BondVersion
bondType: 'liquidity' | 'reserve' | 'launch'
token: Token
quoteToken: Token
lpToken: Token
earnToken: Token
bondNftAddress: Partial<Record<ChainId, string>>
inactive?: boolean
projectLink?: string
twitter?: string
initTime?: Partial<Record<ChainId, number>>
initPrice?: Partial<Record<ChainId, number>>
audit?: string
soldOut?: boolean
bondArt?: {
collection: BondArtCollection
}
}
With more recently added property bondArt
bondArt
This property was added to be able to support multiple bond arts. Currently the supported bond arts are Goodao with default Goodao if nothing is specified.
export enum BondArtCollection {
Goodao_Collection1 = 'Goodao_Collection1',
}
bondArt: {
collection: BondArtCollection.Goodao_Collection1
}