Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

feat(tenderize): integrate tenderTokens and swapTokens #882

Merged
merged 3 commits into from Jul 18, 2022

Conversation

vmaark
Copy link
Contributor

@vmaark vmaark commented Jul 15, 2022

Description

Initial integration for https://tenderize.me.
Integrate tenderTokens (liquid staking derivatives of MATIC, LPT, GPT, AUDIO), and their corresponding swap/LP tokens, e.g. tGRT-SWAP (paired with their underlying token).

Checklist

How to test?

http://localhost:5001/apps/tenderize/tokens?groupIds[]=swaptokens&network=ethereum
http://localhost:5001/apps/tenderize/tokens?groupIds[]=tendertokens&network=ethereum
http://localhost:5001/apps/tenderize/balances?addresses[]=0xe916b4a5691bd2ad3b4af3b2549fed521f65de35&network=ethereum

@vmaark vmaark changed the title (feat)tenderize integrate tenderTokens and swapTokens (feat)tenderize: integrate tenderTokens and swapTokens Jul 15, 2022
@vmaark vmaark changed the title (feat)tenderize: integrate tenderTokens and swapTokens feat(tenderize): integrate tenderTokens and swapTokens Jul 15, 2022
symbol,
decimals,
supply,
tokens: [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the underlyingToken in this array

symbol,
decimals,
supply,
tokens: [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as mentioned earlier, put the underlyingToken in this array

import { TENDERIZE_DEFINITION } from '../tenderize.definition';

const appId = TENDERIZE_DEFINITION.id;
const groupId = TENDERIZE_DEFINITION.groups.swaptokens.id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename group to swap, and rename the file to tenderize.swap.token-fetcher.ts (the additional tokens is redundant)

const network = Network.ETHEREUM_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
export class EthereumTenderizeSwapTokensTokenFetcher implements PositionFetcher<AppTokenPosition> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the above changes, rename this to EthereumTenderizeSwapTokenFetcher.

import { TENDERIZE_DEFINITION } from '../tenderize.definition';

const appId = TENDERIZE_DEFINITION.id;
const groupId = TENDERIZE_DEFINITION.groups.tendertokens.id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename group to tender, and rename the file to tenderize.tender.token-fetcher.ts

Rename the class below to EthereumTenderizeTenderTokenFetcher

symbol,
decimals,
supply,
tokens: [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add underlying token to this array

supply,
tokens: [],
dataProps: {},
pricePerShare: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Price per share is Number(virtualPrice) / 10 ** decimals as you did above (it's the ratio of the price of your tender token to your underlying token)

displayProps: {
label: symbol,
secondaryLabel: buildDollarDisplayItem(price),
tertiaryLabel: `${apy}% APY`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apy.toFixed(2) will be rendered better in the UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are already doing that in the API endpoint

label: symbol,
secondaryLabel: buildDollarDisplayItem(price),
tertiaryLabel: `${apy}% APY`,
images: [`https://app.tenderize.me/tender${symbol}.svg`],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

images: getImagesFromToken(underlyingToken)

This will use the image of the underlying token. In our UI, we automatically render the Tender logo at the top right of that logo as well, so it'll look nice trust me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case we might as well query here the original logo, because the one we host is a BW version for the underlying assets

displayProps: {
label: symbol,
secondaryLabel: buildDollarDisplayItem(price),
tertiaryLabel: `19.34% APY`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably shouldn't hard code this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file used at all actually? You can probably remove it.

@immasandwich immasandwich merged commit ce21065 into Zapper-fi:main Jul 18, 2022
@vmaark vmaark deleted the tenderize branch July 18, 2022 20:36
volt62 pushed a commit to volt62/zapper-studio that referenced this pull request Aug 2, 2022
@SamIam-0x
Copy link
Contributor

Hello @vmaark !

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!
Sam

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants