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

[AHM] Crowdloans #592

Merged
merged 24 commits into from
Feb 21, 2025
Merged

[AHM] Crowdloans #592

merged 24 commits into from
Feb 21, 2025

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Feb 12, 2025

To be merged into the AHM branch

TODO: write user impact and add tests

  • Does not require a CHANGELOG entry

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez changed the base branch from main to dev-asset-hub-migration February 12, 2025 22:18
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez marked this pull request as ready for review February 13, 2025 22:42
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
let period = <T as pallet_slots::Config>::LeasePeriod::get();

let current_period = (now - offset) / period;
(current_period + num_leases) * period + offset
Copy link
Contributor

Choose a reason for hiding this comment

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

may be (current_period + (num_leases - 1)) * period + offset, since num_leases also includes the current lease

Copy link
Member Author

Choose a reason for hiding this comment

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

I think not, since we need to calculate the ending block and the integer division always returns the beginning period.
The current_period * period is the beginning of the current period. So if we have current_period=0, num_leases=0 then we can return that. But if we have current_period=0, num_leases=1 then we need to return period * 1 to get the end of the current one.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>

pub type BalanceOf<T> = <T as pallet_balances::Config>::Balance;

#[frame_support::pallet(dev_mode)]
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO benchmarks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, i removed the dev_mode now so that we get a compiler warning for missing benchmarks.

ggwpez and others added 7 commits February 20, 2025 17:07
@ggwpez ggwpez merged commit adaf7a7 into dev-asset-hub-migration Feb 21, 2025
31 of 48 checks passed
@ggwpez ggwpez deleted the oty-crowdloans branch February 21, 2025 15:05
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