-
Notifications
You must be signed in to change notification settings - Fork 381
Conversation
@kafitz Nice PR! I'll add those base tokens in the next hour. |
// Denormalize big integer values | ||
const supply = Number(supplyRaw) / 10 ** decimals; | ||
const totalLiquidity = Number(totalLiquidityRaw) / 1e18; | ||
const pricePerShare = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pricePerShare
is a bit tricky. It's the ratio between the supply of the token and the underlying reserves. You can use something like:
const reserves = reservesRaw.map((reserveRaw, i) => Number(reserveRaw) / 10 ** tokens[i].decimals);
const pricePerShare = reserves.map(r => r / supply);
You can deconstruct the reservesRaw
from the response from multicall.wrap(contract).liquidity()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix e2764f5
|
||
// Prepare display props | ||
const [, baseToken, quoteToken] = name.split('-'); | ||
const label = `${baseToken.toUpperCase()}/${quoteToken.toUpperCase()} LP`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Uniswap V2, we set the label as UNI-V2 WETH / WBTC
. Perhaps you should label DFX as:
const label = `DFX LP ${baseToken.toUpperCase()} / ${quoteToken.toUpperCase()};`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 024456b
|
||
return presentBalanceFetcherResponse([ | ||
{ | ||
label: 'DfxCurves', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DFX Curves
is probably cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 024456b
@@ -0,0 +1,38 @@ | |||
// Test address: http://localhost:5001/apps/dfx/balances?addresses[]=0x1867608e55a862e96e468b51dc6983bca8688f3d&network=ethereum | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments not needed, you can add this to the PR description if you'd like for future reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix e2764f5
Added Polygon test addresses to original template post
@@ -0,0 +1,103 @@ | |||
// Test address: http://localhost:5001/apps/dfx/tokens?groupIds[]=dfx-curve&network=ethereum | |||
// | |||
import { Inject } from '@nestjs/common'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this file should include the groupId
, so you can instead make it dfx.curve.token-fetcher.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix e25acbf
src/apps/dfx/dfx.definition.ts
Outdated
description: 'DFX.Finance is a decentralized foreign exchange protocol optimized for stablecoins', | ||
url: 'https://app.dfx.finance/', | ||
groups: { | ||
curve: { id: 'dfx-curve', type: GroupType.TOKEN }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to keep the key curve
as the camelcase of the ID dfx-curve
, i.e:
dfxCurve: { id: 'dfx-curve', type: GroupType.TOKEN },
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 9a0983e
// Denormalize big integer values | ||
const supply = Number(supplyRaw) / 10 ** decimals; | ||
const totalLiquidity = Number(totalLiquidityRaw) / 1e18; | ||
const pricePerShare = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as in the Ethereum dfx.amm.token-fetcher.ts
re: pricePerShare
here and label
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
return presentBalanceFetcherResponse([ | ||
{ | ||
label: 'DfxCurves', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DFX Curves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 024456b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assets/dfx.png
should be moved to assets/logo.png
} | ||
|
||
async getBalances(address: string) { | ||
const [curveTokenBalances] = await Promise.all([this.getCurveTokenBalances(address)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably also want to add getStakingBalances
here, and use the ContractPositionBalanceHelper
(on this.appToolkit.helpers.contractPositionBalanceHelper
) to build the staked balances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 3471340
src/apps/dfx/dfx.module.ts
Outdated
import { PolygonDfxCurveTokenFetcher } from './polygon/dfx.curve.token-fetcher'; | ||
import { PolygonDfxStakingContractPositionFetcher } from './polygon/dfx.staking.contract-position-fetcher'; | ||
|
||
@Module({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Register.AppModule
as in the other app modules (this was a recent change on our side)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 4ce53b4
Hello @kafitz ! Looks like you did not provide an address when submitting your PR. I recognize it may have seemed kind of random that we were asking for a wallet address with a PR submission, but we are actually looking for ways to reward Studio contributors in the future. Is there an address you’d want to provide? Could even be an empty address, if you do not have an doxxed address Let me know! Also, if you’d like to privately provide it, feel free to shoot me a TG https://t.me/SamIAm_0x or DM on the Zapper Discord. Thanks! |
Description
Adds integration for DFX's AMM LPs and their staking on Ethereum and Polygon.
Checklist
How to test?
Questions
For underlying tokens not available through
getBaseTokenPrices
, what should be done to resolve these?Edit: Great, thanks for adding! All seem to be working now
Notes
Curve
is a term also used in reference to the DFX's bonding curves and is distinct from CurveFi.