yearn / yearn-sdk

🦧 SDK for the yearn.finance platform. WIP
https://npm.im/@yfi/sdk
MIT License
53 stars 56 forks source link

feat: Provide info if a token is supported to zap in/out of a contract [WEB-1009] #262

Closed karelianpie closed 2 years ago

karelianpie commented 2 years ago

Description

Provide information if a token is supported to zap in/out of a contract. Token interface should include the property supported[customZapContractNameAlias]: boolean if it's supported by a zap contract.

Related Issue

https://linear.app/yearn/issue/WEB-1009/supported-zap-tokens

Motivation and Context

Frontends can display just the supported tokens for a given zap

How Has This Been Tested?

Augmented the src/interfaces/token.spec.ts test cases to:

linear[bot] commented 2 years ago
WEB-1009 Supported Zap Tokens

### Elevator Pitch: **SDK should provide information if a token is supported to zap in/out of a contract** ### Customer Value: **Frontends can display just the supported tokens for a given zap** ### Agreed upon Acceptance Criteria (definition of Done): * Token interface should include the property `supported[customZapContractNameAlias]: boolean` if its supported by a zap contract. supported.zapper will not be deprecated, but new properties will be added: ``` export interface Token extends ERC20 { icon?: string; priceUsdc: Usdc; supported: { zapper?: boolean; zapperZapIn?: boolean; zapperZapOut?: boolean; ftmApeZap?: boolean; ...otherCustomZapContracts; }; metadata?: TokenMetadata; } ``` ### ### Design Approach: Hardcode in SDK all available zap contract addresses by alias. Use zappers api to handle zapperZapIn supported tokens for eth mainnet. Add to yearn meta zapperZapOut contract to ETH, DAI, USDC, USDT, WBTC from eth mainnet, Add to yearn meta other custom contracts like ftmApeZap (`0xfCE6CbeF3867102da383465cc237B49fF4B9d48F`) (Seems done here [https://github.com/yearn/yearn-meta/blob/master/data/tokens/250/0x0000000000000000000000000000000000000000.json](https://github.com/yearn/yearn-meta/blob/master/data/tokens/250/0x0000000000000000000000000000000000000000.json)) ### Assumptions: can be cached since we dont expect changes frequently ### Design review: xgambitox

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 43.99 KB (+1.02% 🔺)
dist/sdk.esm.js 44.31 KB (+1.18% 🔺)