Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aavev2 apr and apy #73

Merged
merged 5 commits into from
Oct 10, 2023
Merged

aavev2 apr and apy #73

merged 5 commits into from
Oct 10, 2023

Conversation

bergarces
Copy link
Collaborator

@bergarces bergarces commented Oct 6, 2023

APR and APY calculation for AaveV2 pools.

Removes multiple frozen and inactive protocol tokens from AaveV2 metadata

@bergarces bergarces requested a review from jpsains as a code owner October 6, 2023 13:32
@bergarces bergarces changed the base branch from MMI-3923-finish-aave-v-2 to main October 6, 2023 13:33
@bergarces bergarces force-pushed the MMI-3923-aave-v2-apr branch from 193b57e to 80a32c5 Compare October 6, 2023 14:23
@@ -267,14 +267,14 @@ export interface ProtocolTokenApy extends Erc20Metadata {
/**
* Current apy of protocol pool
*/
apyDecimal: string
apyDecimal: number
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do we think about this change?

Having it as a string would make it tricky to work with it afterwards.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No strong opinion. Dont see an issue atm

@@ -31,6 +33,14 @@ type AaveV2PoolMetadata = Record<
}
>

const protocolDataProviderContractAddresses: Partial<Record<Chain, string>> = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same contracts used for metadata, so I've just moved them as a constant for the whole file.

[Chain.Avalanche]: '0x65285E9dfab318f57051ab2b139ccCf232945451',
}

const RAY = 10 ** 27
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

According to their glossary, A ray is just a unit with 27 decimals of precision.

https://docs.aave.com/developers/v/2.0/glossary


if (
!reserveConfigurationData.isActive ||
reserveConfigurationData.isFrozen
Copy link
Collaborator Author

@bergarces bergarces Oct 9, 2023

Choose a reason for hiding this comment

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

Checks that the protocol token is active and not frozen.

Otherwise, they are not included in the metadata file.

@bergarces bergarces force-pushed the MMI-3923-aave-v2-apr branch from 8b82b81 to aa19efd Compare October 9, 2023 12:39
"name": "Maker",
"symbol": "MKR",
"decimals": 18,
"profitRaw": "7186772652009n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think we are missing profit formatted number, but should do on separate mr

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are not missing them, they are at the bottom.

They get printed like this because we add them at the end of the process (maybe we can apply some order when printing).

@bergarces bergarces merged commit f0dd544 into main Oct 10, 2023
@bergarces bergarces deleted the MMI-3923-aave-v2-apr branch October 10, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants