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

Shade staking query interface and APY calculation for derivatives #118

Merged
merged 9 commits into from
Apr 4, 2024

Conversation

SissonJ
Copy link
Collaborator

@SissonJ SissonJ commented Mar 28, 2024

  • Shade staking query interface
  • APY for stkd-SCRT
  • APY for dSHD

Copy link

changeset-bot bot commented Mar 28, 2024

🦋 Changeset detected

Latest commit: 2d5dc78

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@shadeprotocol/shadejs Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

queryRouterCodeHash?: string,
contractAddress: string,
codeHash: string,
lcdEndpoint: string,
Copy link
Collaborator

Choose a reason for hiding this comment

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

opttional

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not optional since the chain queries require it, I'll add a comment to explain

queryRouterCodeHash?: string,
contractAddress: string,
codeHash: string,
lcdEndpoint: string,
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional

* ex. for daily compounding periodRate=365
* @param {number} apr - Annual Percentage Rate
*/
const calcAPY = (periodRate:number, apr:number):number => (1 + apr / periodRate) ** periodRate - 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's move this function to a file location that is not derivativeScrt specific as it seems likely to be reused elsewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant this single function, but it looks like you moved the whole file which i was not intending in my comment

queryRouterCodeHash?: string,
contractAddress: string,
codeHash: string,
lcdEndpoint: string,
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional

src/types/apy.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@AustinWoetzel AustinWoetzel left a comment

Choose a reason for hiding this comment

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

A few minor issuse, but looks great overall!

Comment on lines 33 to 34
// data returned from the contract in normalized form with
// 18 decimals, in addition to any decimals on the individual token
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you move this comment up to the const definition so it's clear what it is for at the line it is defined?

@SissonJ SissonJ merged commit 34ce7af into develop Apr 4, 2024
4 checks passed
@SissonJ SissonJ deleted the js006_staking-and-apy-queries branch April 4, 2024 17:00
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