-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Relay Chain - Coretime Sale UI #11091
Conversation
import { CoreTimeChainConsts, CoreTimeConsts } from '@polkadot/react-hooks/types'; | ||
import { BN } from '@polkadot/util'; | ||
|
||
type FirstCycleStartType = Record< |
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.
Start of the cycle, aka first sale initialization, starting with the interlude! Sale starts after the interlude.
@@ -0,0 +1,244 @@ | |||
// Copyright 2017-2024 @polkadot/app-coretime authors & contributors |
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.
@filvecchiato you might wanna check out this file. It has a bunch of useful calcs for coretime :) Maybe we can collaborate together and combine our work and make a library of sorts with these functions.
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 think this can be a very good example implementation for Facade as well!
@@ -0,0 +1,139 @@ | |||
// Copyright 2017-2024 @polkadot/app-coretime authors & contributors |
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.
@filvecchiato few more coretime things here :)
Looks awesome!! Great work !! |
@@ -0,0 +1,244 @@ | |||
// Copyright 2017-2024 @polkadot/app-coretime authors & contributors |
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 think this can be a very good example implementation for Facade as well!
packages/react-hooks/src/types.ts
Outdated
@@ -384,5 +385,6 @@ export const CoreTimeConsts = { | |||
}; | |||
|
|||
export const CoreTimeChainConsts = { | |||
BlockTime: 12000, | |||
BlocksPerTimeslice: 40 |
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 think you could get the blocksPerTimeslice value from the api.consts.broker.timeslicePeriod (number of relay chain blocks) on coretime chain, then maybe consts.babe.expectedBlockTime for relay and coretime and calculate the blocks per timeslice dynamically ? But it might not be accurate
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.
Great idea! Thank you :) I will check it out
const progressValues = useMemo(() => getSaleProgress(lastCommittedTimeslice, saleParams.currentRegion.start.ts, saleParams.interlude.ts, saleParams.leadin.ts, regionBegin), | ||
[saleParams, lastCommittedTimeslice, regionBegin]); | ||
|
||
// TODO: uncomment when introducing core purchase functionality |
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.
Should we attach a link to this PR as reference:
ie
ref: https://github.com/polkadot-js/apps/pull/11091
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.
Overall, a really amazing job 🚀 !
Some small nits, I would also like to see those consts be transferred to a more appropriate file.
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.
Looks amazing to me!
…for dynamic functions
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Relay Chain Coretime Sale UI
Simple UI aimed at providing useful information for people interested in an ongoing sale/ coretime cycle.
Functionality
Cool code things
I did a lot of calculations of coretime values in the background, which could be useful to other seeking to work with Coretime pallet.
Implemented calculations: