Skip to content

Commit

Permalink
Garbage token price (#152)
Browse files Browse the repository at this point in the history
* 0.0.125

* 0.0.126

* 0.0.127

* 0.0.128

* 0.0.129

* 0.0.130

* 0.0.131

* 0.0.132

* 0.0.133

* LMR-wETH vault

* 0.0.134

* 0.0.135

* 0.0.136

* 0.0.137

* Additional RETRO vaults

* 0.0.138

* New retro vaults

* New retro vaults to hidden vaults

* 0.0.139

* Two new retro vaults, one arbitrum vault, one polygon vault

* 0.0.140

* Prices for LMR and OXT

* 0.0.141

* fixed lmr vault address

* 0.0.142

* Follow price strategy

* 0.0.143

* add getRebalancingStrategyFollowPriceV1Contract function

* File import fix

* 0.0.144

* Follow price index files

* 0.0.145

* Move COC vaults to legacy app

* 0.0.146

* WETH-USDC and RETRO-liveRETRO retro vaults

* 0.0.147

* New BSC vaults

* 0.0.148

* Add Ramses and Thena vaults

* 0.0.149

* Subgraphs for Ramses and Thena

* 0.0.150

* Add Algebra pools handling

* 0.0.151

* Retro WBTC-USDC vault

* 0.0.152

* LMR-WBTC vault on Arbitrum

* 0.0.153

* Hide Cake vaults

* 0.0.154

* FBX-wstETH vault

* EURO3-A3A and USDC-EURO3 vaults

* 0.0.156

* wETH-LMR vault

* 0.0.157

* BTCB-THE vault

* 0.0.158

* A3A-EURO3 vault

* 0.0.159

* QuickSwap and Horiza Vaults

* 0.0.160

* MET-wETH vault

* 0.0.161

* USDC-ETH vault

* 0.0.162

* Token table name fix

* 0.0.163

* Add EON chain

* 0.0.164

* Add Abond vaults

* 0.0.165

* Add new PancakeSwap and Abond vaults

* 0.0.166

* add new thena vaults to algebra vaults

* 0.0.167

* Add USDT on mainnet

* 0.0.168

* Fix WBNB-ABOND

* 0.0.169

* Fix pancakeSwap weth-usdt

* 0.0.170

* Add zkSync

* 0.0.171

* Add IMX-ICHI 1%

* 0.0.172

* WETH-GARBAGE and other vaults

* Utils/token import fix

* Token Table Name fix

* tokenNameWithChainPrefix export fix

* 0.0.173

* Garbage token price

---------

Co-authored-by: Tatyana Stemkovski <[email protected]>
  • Loading branch information
tstemko and Tatyana Stemkovski authored Dec 19, 2023
1 parent eab01e3 commit ffbd2e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ichidao/ichi-sdk",
"version": "0.0.172",
"version": "0.0.173",
"description": "",
"main": "dist/index.js",
"module": "index.ts",
Expand Down
21 changes: 20 additions & 1 deletion src/utils/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export async function getTokenMetrics(
// used for WEN and FBX token prices:
let wethPrice: number;
let polygonProvider;
let mainnetProvider;
const wethAddress = TOKENS[TokenName.WETH]![ChainId.Mainnet]?.address?.toLowerCase();

// used for oRETRO & liveRETRO token price:
Expand Down Expand Up @@ -347,7 +348,7 @@ export async function getTokenMetrics(
}
break;
case TokenName.ABOND:
const mainnetProvider = await getProvider(ChainId.Mainnet);
mainnetProvider = await getProvider(ChainId.Mainnet);
if (!mainnetProvider) {
throw new Error('Could not establish Mainnet provider');
}
Expand All @@ -364,6 +365,24 @@ export async function getTokenMetrics(
throw new Error(`Could not lookup token prices for ${token.symbol}`);
}
break;
case TokenName.GARBAGE:
mainnetProvider = await getProvider(ChainId.Mainnet);
if (!mainnetProvider) {
throw new Error('Could not establish Mainnet provider');
}

if (opts.tokenPrices && wethAddress && wethAddress in opts.tokenPrices) {
wethPrice = opts.tokenPrices[wethAddress].usd;
price = await getPriceFromWethVault(
VaultName.WETH_GARBAGE,
mainnetProvider,
ChainId.Mainnet,
wethPrice
)
} else {
throw new Error(`Could not lookup token prices for ${token.symbol}`);
}
break;
case TokenName.ETH:
if (opts.tokenPrices && wethAddress && wethAddress in opts.tokenPrices) {
wethPrice = opts.tokenPrices[wethAddress].usd;
Expand Down

0 comments on commit ffbd2e4

Please sign in to comment.