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

Refund user tickets functionality #91

Conversation

psorinionut
Copy link
Contributor

@psorinionut psorinionut commented Jan 17, 2025

Uses the blacklist mechanism

Copy link

github-actions bot commented Jan 17, 2025

Coverage Summary

Totals

Count Covered %
Lines 9707 9161 94.38
Regions 2260 1961 86.77
Functions 685 491 71.68
Instantiations 3441 1005 29.21

Files

Expand
File Lines Regions Functions Instantiations
/launchpad-common/src/blacklist.rs 96.88% 93.75% 80.00% 33.87%
/launchpad-common/src/common_events.rs 71.43% 29.41% 29.41% 26.67%
/launchpad-common/src/config.rs 30.00% 22.22% 22.22% 25.00%
/launchpad-common/src/launch_stage.rs 90.38% 80.00% 63.64% 38.33%
/launchpad-common/src/lib.rs 76.92% 50.00% 33.33% 26.92%
/launchpad-common/src/ongoing_operation.rs 61.29% 53.12% 53.85% 39.87%
/launchpad-common/src/permissions.rs 72.73% 60.00% 50.00% 13.64%
/launchpad-common/src/random.rs 55.81% 55.00% 30.00% 28.38%
/launchpad-common/src/setup.rs 46.39% 48.28% 37.50% 17.79%
/launchpad-common/src/tickets.rs 84.62% 67.74% 57.14% 36.61%
/launchpad-common/src/token_send.rs 94.87% 77.78% 60.00% 39.47%
/launchpad-common/src/user_interactions.rs 98.59% 95.65% 83.33% 34.52%
/launchpad-common/src/winner_selection.rs 88.31% 88.46% 80.00% 26.95%
/launchpad-guaranteed-tickets-v2/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-guaranteed-tickets-v2/src/events.rs 89.52% 35.00% 35.00% 23.08%
/launchpad-guaranteed-tickets-v2/src/guaranteed_ticket_winners.rs 94.34% 88.41% 70.00% 35.00%
/launchpad-guaranteed-tickets-v2/src/guaranteed_tickets_init.rs 90.85% 75.47% 42.11% 32.69%
/launchpad-guaranteed-tickets-v2/src/lib.rs 89.39% 87.27% 82.35% 15.56%
/launchpad-guaranteed-tickets-v2/src/token_release.rs 87.10% 76.00% 38.89% 21.43%
/launchpad-guaranteed-tickets-v2/tests/guaranteed_tickets_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-guaranteed-tickets-v2/tests/guaranteed_tickets_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-guaranteed-tickets/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-guaranteed-tickets/src/guaranteed_ticket_winners.rs 89.66% 80.65% 57.14% 32.84%
/launchpad-guaranteed-tickets/src/guaranteed_tickets_init.rs 95.79% 82.50% 66.67% 29.41%
/launchpad-guaranteed-tickets/src/lib.rs 88.40% 85.45% 87.50% 9.93%
/launchpad-guaranteed-tickets/src/token_release.rs 91.11% 70.37% 50.00% 8.33%
/launchpad-guaranteed-tickets/tests/guaranteed_tickets_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-guaranteed-tickets/tests/guaranteed_tickets_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-locked-tokens-and-guaranteed-tickets/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-locked-tokens-and-guaranteed-tickets/src/lib.rs 84.88% 76.19% 72.73% 12.90%
/launchpad-locked-tokens-and-guaranteed-tickets/tests/guaranteed_tickets_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-locked-tokens-and-guaranteed-tickets/tests/guaranteed_tickets_setup/simple_lock_mock.rs 70.89% 50.00% 37.50% 37.50%
/launchpad-locked-tokens-and-guaranteed-tickets/tests/locked_tokens_with_guaranteed_tickets_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-locked-tokens/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-locked-tokens/src/lib.rs 77.14% 50.00% 50.00% 7.69%
/launchpad-locked-tokens/src/locked_launchpad_token_send.rs 95.65% 78.95% 85.71% 40.00%
/launchpad-locked-tokens/tests/launchpad_locked_tokens_test.rs 87.83% 68.00% 61.54% 61.54%
/launchpad-migration-guaranteed-tickets/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-migration-guaranteed-tickets/src/guaranteed_ticket_winners.rs 89.66% 80.65% 57.14% 17.78%
/launchpad-migration-guaranteed-tickets/src/guaranteed_tickets_init.rs 95.79% 82.50% 66.67% 21.74%
/launchpad-migration-guaranteed-tickets/src/lib.rs 77.00% 75.00% 76.92% 8.00%
/launchpad-migration-guaranteed-tickets/tests/migration_guaranteed_tickets_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-migration-guaranteed-tickets/tests/migration_guaranteed_tickets_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-nft-and-guaranteed-tickets/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-nft-and-guaranteed-tickets/src/combined_selection.rs 85.37% 69.23% 60.00% 23.08%
/launchpad-nft-and-guaranteed-tickets/src/lib.rs 88.24% 80.00% 75.00% 11.54%
/launchpad-nft-and-guaranteed-tickets/tests/combined_selection_setup/mod.rs 94.15% 88.68% 88.89% 88.89%
/launchpad-nft-and-guaranteed-tickets/tests/combined_selection_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-with-nft/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad-with-nft/src/claim_nft.rs 91.30% 85.71% 33.33% 12.50%
/launchpad-with-nft/src/confirm_nft.rs 97.56% 81.82% 80.00% 27.27%
/launchpad-with-nft/src/lib.rs 87.14% 73.33% 66.67% 6.06%
/launchpad-with-nft/src/mystery_sft.rs 56.67% 55.56% 40.00% 12.16%
/launchpad-with-nft/src/nft_blacklist.rs 85.71% 62.50% 33.33% 6.25%
/launchpad-with-nft/src/nft_config.rs 60.87% 62.50% 60.00% 13.64%
/launchpad-with-nft/src/nft_winners_selection.rs 81.82% 66.67% 50.00% 12.50%
/launchpad-with-nft/tests/launchpad_v2_test.rs 100.00% 100.00% 100.00% 100.00%
/launchpad-with-nft/tests/launchpad_with_nft_setup/mod.rs 100.00% 93.33% 100.00% 100.00%
/launchpad/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/launchpad/src/lib.rs 0.00% 0.00% 0.00% 0.00%

@@ -95,6 +95,11 @@ pub trait LaunchpadGuaranteedTickets:
self.deposit_launchpad_tokens(total_tickets);
}

#[endpoint(refundUserTickets)]
fn refund_user_tickets(&self, users_list: MultiValueEncoded<ManagedAddress>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

admin

Copy link
Contributor

Choose a reason for hiding this comment

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

Later add_users_to_blacklist call seems to call require_extended_permissions. Should it be enough or should it be better reinforced here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it later checks the caller. I don't think we need a new check here also.

@psorinionut psorinionut marked this pull request as draft January 27, 2025 15:28
@psorinionut
Copy link
Contributor Author

Covered in PR #92

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.

3 participants