File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed
protocols/convex-finance/config/deployments/convex-finance-ethereum Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 11{
22 "graft" : false ,
3- "base" : " " ,
4- "block" : 0
3+ "base" : " QmTZozrLfSy3WtcbFcUFu9iruKYeBMaEdrsw1MnCZjVfLX " ,
4+ "block" : 21510541
55}
Original file line number Diff line number Diff line change @@ -179,3 +179,11 @@ export function averagePrice(prices: CustomPriceType[]): CustomPriceType {
179179 constants . DEFAULT_USDC_DECIMALS
180180 ) ;
181181}
182+
183+ export function safeDiv ( amount0 : BigDecimal , amount1 : BigDecimal ) : BigDecimal {
184+ if ( amount1 . equals ( constants . BIGDECIMAL_ZERO ) ) {
185+ return constants . BIGDECIMAL_ZERO ;
186+ } else {
187+ return amount0 . div ( amount1 ) ;
188+ }
189+ }
Original file line number Diff line number Diff line change @@ -210,13 +210,14 @@ export function cryptoPoolLpPriceUsdc(
210210 const totalSupply = utils . getTokenSupply ( lpAddress ) ;
211211
212212 const totalValueUsdc = cryptoPoolLpTotalValueUsdc ( lpAddress , block ) ;
213- const priceUsdc = totalValueUsdc
214- . times (
213+ const priceUsdc = utils . safeDiv (
214+ totalValueUsdc . times (
215215 constants . BIGINT_TEN . pow (
216216 constants . DEFAULT_DECIMALS . toI32 ( ) as u8
217217 ) . toBigDecimal ( )
218- )
219- . div ( totalSupply . toBigDecimal ( ) ) ;
218+ ) ,
219+ totalSupply . toBigDecimal ( )
220+ ) ;
220221
221222 return CustomPriceType . initialize (
222223 priceUsdc ,
Original file line number Diff line number Diff line change 16401640 " resolved" " https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
16411641 " version" " 1.0.0"
16421642
1643+ " fsevents@~2.3.2 " :
1644+ " integrity" " sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
1645+ " resolved" " https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
1646+ " version" " 2.3.2"
1647+
16431648" get-iterator@^1.0.2 " :
16441649 " integrity" " sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg=="
16451650 " resolved" " https://registry.npmjs.org/get-iterator/-/get-iterator-1.0.2.tgz"
You can’t perform that action at this time.
0 commit comments