-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
Adding 2 new apr handlers, bloom and maker;
modules/network/avalanche.ts
Outdated
tokenAddress: '0xa25eaf2906fa1a3a13edac9b9657108af7b703e3', | ||
sourceUrl: 'https://ceres.gogopool.com', | ||
path: 'ggAVAXMonthlyInterestMonth.value', | ||
scale: -0.8333, |
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.
is there an explanation for this number?
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.
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
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.
can you add this as a comment as well please?
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.
Of course
path: 'value', | ||
group: 'OVERNIGHT', | ||
}, | ||
overnightstUSDPlus: { |
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 token different 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.
No, this is the stUSD+, the other one is the USD+
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.
ah didn't catch that 👍
continue; | ||
} | ||
const tokenApr = (Number(currentRate) - 10000) / 10000; | ||
aprs[address] = { apr: tokenApr, isIbYield: isIbYield ?? false }; |
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.
why do isIbYield: isIbYield ?? false
? just set it to false
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.
I made like this because I didn't know if this apr handler would be used for non-ib-yield tokens in the future
Adding new tokens
Creating 2 new apr Handlers: Bloom and Maker;