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

feat: aave stata v2 #856

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

sakulstra
Copy link
Contributor

@sakulstra sakulstra commented Dec 11, 2024

The aave DAO has recently released the next revision of 4626 aToken wrappers: https://x.com/MixBytes/status/1866840081362784603

The new version is not an upgrade but a new deployment and thus needs a new integration.
While the implementations are very similar on the surface there are some small details that changed:

  • factory. getStaticATokens() is now factory.getStataTokens()
  • deposit and redeem are no longer overloaded, but instead a new redeemATokens and depositATokens was added

I did not manage to run the tests.

@@ -1,13 +1,13 @@
import { DexParams } from './types';
import { DexConfigMap } from '../../types';
import { Network } from '../../constants';
import { AaveV3Ethereum, MiscEthereum } from '@bgd-labs/aave-address-book';
import { AaveV3Ethereum, GhoEthereum } from '@bgd-labs/aave-address-book';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gho addresses are now in a separated library.

@@ -1,6 +1,6 @@
import { aToken, Token } from '../../types';
import { Network } from '../../constants';
import { tokenlist } from '@bgd-labs/aave-address-book';
import tokenlist from '@bgd-labs/aave-address-book/dist/tokenlist';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't manage to make typescript accept this.
On other projects ppl import @bgd-labs/aave-address-book/tokenlist just fine, but here i didn't figure out why it does not work. As on v2 for sure no more assets are added could make sense to just copy the list to the repo and drop the import.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't mind copying the list to the repo, not worth spending time trying to make it work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, updated with a copy (filtered to only the relevant v2 addresses)

AaveV3Stata: {
[Network.MAINNET]: {
factoryAddresses: [
AaveV3Ethereum.STATA_FACTORY,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is one factory per pool, so can be multiple per network (prev implementation did not support that)

@@ -65,12 +64,12 @@ export const Config: DexConfigMap<DexParam> = {
poolAddress: AaveV3BNB.POOL,
wethGatewayAddress: AaveV3BNB.WETH_GATEWAY,
},
[Network.ZKEVM]: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

zkEVM was never activated.

@@ -2,13 +2,13 @@ import { DexParams } from './types';
import { DexConfigMap } from '../../types';
import { Network } from '../../constants';

import { MiscEthereum } from '@bgd-labs/aave-address-book';
import { GhoEthereum, AaveSafetyModule } from '@bgd-labs/aave-address-book';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

safetymodule now has it's own lib

@0xNazarii
Copy link
Contributor

@sakulstra It seems like the new stata tokens don't have rate like the v1 tokens do, and there appear to be some small differences in the preview math, so the current pricing logic won't work.

@sakulstra
Copy link
Contributor Author

@0xNazarii thanks for having a look.

The rate is no longer exposed - didn't see that the contract manually replicated the rate logic.
Refactored to use reserveNormalizedIncome (which is the rate). How can i reproduce the "small differences in preview" math? From checking the code i don't see why it would be different on this version - perhaps it was related to not fetching the correct rate?

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