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

IB Yield APR Service - Adding new tokens and handlers #451

Merged
merged 4 commits into from
Sep 13, 2023

Conversation

lgahdl
Copy link
Contributor

@lgahdl lgahdl commented Sep 8, 2023

Adding new tokens
Creating 2 new apr Handlers: Bloom and Maker;

Adding 2 new apr handlers, bloom and maker;
@lgahdl lgahdl requested a review from franzns September 8, 2023 23:27
tokenAddress: '0xa25eaf2906fa1a3a13edac9b9657108af7b703e3',
sourceUrl: 'https://ceres.gogopool.com',
path: 'ggAVAXMonthlyInterestMonth.value',
scale: -0.8333,
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an explanation for this number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, according with solarcurve, the AVAX Monthly Interest must be multiplied by -12 to represent the APR in normal scale, for example, if the monthly interest is -0,15, the APR would be -0,15 * -12 = 1,8%, my understanding is that this number represents what the owner pays as interest, if he receives, it's negative, but I'll confirm this last statement with him.
Now, how this -12 became -8,333 (sorry, the -0,8333 was wrong, already fixed), it's because the scale parameter is used to divide the number, and the final apr percentage is in decimal format (1,8% = 0,018), so if
M * -12 = A (M is monthly rate and A is APR) => (M/x) = (A/100) => (A / -12x) = (A / 100) [replacing M by A/-12] => x = 100/-12 = -8,33333

Copy link
Contributor

Choose a reason for hiding this comment

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

can you add this as a comment as well please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course

path: 'value',
group: 'OVERNIGHT',
},
overnightstUSDPlus: {
Copy link
Contributor

Choose a reason for hiding this comment

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

same token different address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is the stUSD+, the other one is the USD+

Copy link
Contributor

Choose a reason for hiding this comment

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

ah didn't catch that 👍

continue;
}
const tokenApr = (Number(currentRate) - 10000) / 10000;
aprs[address] = { apr: tokenApr, isIbYield: isIbYield ?? false };
Copy link
Contributor

Choose a reason for hiding this comment

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

why do isIbYield: isIbYield ?? false ? just set it to false

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 made like this because I didn't know if this apr handler would be used for non-ib-yield tokens in the future

@lgahdl lgahdl requested a review from franzns September 12, 2023 13:24
@franzns franzns merged commit 79338cd into v3-canary Sep 13, 2023
1 check passed
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