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: update unbonding period calculation #1034

Merged
merged 7 commits into from
Sep 3, 2024
Merged

Conversation

euharrison
Copy link
Contributor

@euharrison euharrison commented Aug 21, 2024

Update Unbonding Period calculation

  • Use an unified calculation and save it on chain.unbondingPeriod on the atom layer, removing it from different components and any reference for unbondingPeriodInEpochs which leads to distributed and confused calculations
  • Remove the data transformation from the service, than it'll be used only to execute the indexer request, and all data transformation will happen on the atom layer
  • Update the unbondoing period on the staking page Staking/IncrementBonding.tsx

Closes #1020

Screenshot 2024-08-21 at 13 51 09

Screenshot 2024-08-21 at 13 51 25

Screenshot 2024-08-21 at 13 51 28

Screenshot 2024-08-21 at 13 52 14

queryFn: async () => {
const parameters = await fetchChainParameters(api);

const unbondingPeriodInEpochs =
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 this is good! :) But maybe it's worth moving it to some common/utility space(component?) if it's used in multiple places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I'll move it to a dedicated function. But the idea here is to keep it attached to the atom, then anytime we needed, we pull the value directly from the atom and we don't need to care about the math/parameters anymore

Copy link
Collaborator

@emccorson emccorson left a comment

Choose a reason for hiding this comment

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

I've not reviewed the code, but just on the TODO replacement: I think "a 13 hours unbonding schedule" doesn't read right. It could either be "a 13-hour unbonding schedule" or "an unbonding schedule of 13 hours". Maybe the second is easier since the string formatting doesn't need to change.

const signedTx = await sdk.signing.sign(encodedTx, signingKey);

console.log("Broadcasting transaction...");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lint was complaining about the console.log

@euharrison euharrison merged commit 2e65ae8 into main Sep 3, 2024
8 checks passed
@euharrison euharrison deleted the feat/unbonding-period branch September 3, 2024 12:49
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.

Resolve the word TODO on Staking
3 participants