Closed manu0466 closed 1 year ago
Patch coverage: 75.11
% and project coverage change: -5.17
:warning:
Comparison is base (
4683373
) 99.23% compared to head (93febe0
) 94.06%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Hello,
Thank you for your work on this codebase.
I would like to propose a change regarding the handling of the minter
field.
In certain scenarios, it could be desirable to have the ability to set the minter
to None
. For instance, if one wants to ensure that only the admin can mint tokens, it might make sense to not set a third-party minter.
Currently, the update_minter
function
https://github.com/desmos-labs/desmos-contracts/blob/2f6629455090a1418fb5e77ffef5610c0edf50a1/contracts/poap/src/execute.rs#L158-L164
and UpdateMinter
message
https://github.com/desmos-labs/desmos-contracts/blob/2f6629455090a1418fb5e77ffef5610c0edf50a1/contracts/poap/src/msg.rs#L77
does not accept None
as a valid value for the minter
. I propose that this be changed to accept None
values.
This change could include:
update_minter
function to accept None
as a valid value for minter
.UpdateMinter
message to allow for None
as a valid minter
value.In addition, in this scenario, we might consider allowing None
as a minter during the contract instantiation phase.
https://github.com/desmos-labs/desmos-contracts/blob/2f6629455090a1418fb5e77ffef5610c0edf50a1/contracts/poap/src/execute.rs#L44-L49
This change could provide additional flexibility for the management of minting permissions.
Thank you for considering this proposal.
I also noticed that there are currently no checks in place to ensure that the mint_start_time
and mint_end_time
provided are greater than the current time.
A future timestamp for both mint_start_time
and mint_end_time
should be used to ensure logical consistency in the token minting process. Moreover, it seems logical that a token-minting operation should occur in the future, not in the past.
I propose adding a validation step to the relevant functions to check that both mint_start_time
and mint_end_time
are strictly greater than the current time.
While the current implementation is different, in the context of a "proof of participation" system, it would be logical for each user to hold a maximum of one token per event, indicating whether they have participated or not as explained here: https://github.com/desmos-labs/desmos-contracts/pull/190#discussion_r1260969108. If we aim for a more generic implementation where users can hold multiple tokens, we might consider implementing a poap_mint_limit_per_address
variable, which specifies the maximum number of tokens that can be minted per address.
What do you think about this?
Thank you!
@RiccardoM @giorgionocera I update the contract adding the following features:
admin
to perform the same operations as the minter
;minter
to be None
;As for the checks to make sure that the mint_start_time
and mint_end_time
are in the future, I think they are not necessary, also not having such checks can avoid problems. For example, suppose you want to instantiate the contract with mint_start_time
in the next 10 seconds, if the message is not included in the next 2 blocks the transaction will fail, because 12 seconds have elapsed from when the transaction was transmitted to when it is included.
@RiccardoM @giorgionocera I update the contract adding the following features:
- Allow the
admin
to perform the same operations as theminter
;- Allow the
minter
to beNone
;- Limit the POAP that an user can mint to 1.
As for the checks to make sure that the
mint_start_time
andmint_end_time
are in the future, I think they are not necessary, also not having such checks can avoid problems. For example, suppose you want to instantiate the contract withmint_start_time
in the next 10 seconds, if the message is not included in the next 2 blocks the transaction will fail, because 12 seconds have elapsed from when the transaction was transmitted to when it is included.
Yeah, it makes sense. Thank you for your clarification and for the effort!
Overall looks good to me. However, it seems to me that there are some duplicated tests. Particularly:
admin_can_mint_before_start_time
andadmin_can_mint_after_end_time
are duplicates ofadmin_can_mint_outside_mint_time
minter_can_mint_before_start_time
andminter_can_mint_after_end_time
are duplicates ofminter_can_mint_outside_mint_time
user_can_mint_after_start_time
anduser_can_mint_before_end_time
are duplicates ofuser_can_mint_during_mint_time
We could probably delete the single ones and keep only the composite ones (
<xxx>can_mint_outside/during_mint_time
).
@RiccardoM The tests are actualy different since in the xxx_can_mint_during_mint_time
the contract is initialized with bot start and end time while in the xxx_can_mint_after_start_time
and xxx_can_mint_before_end_time
the contract is initialized with only the start time or end time.
Description
This PR updates the POAP contract to make it compliant with the ADR-006.
Closes: #182 Closes: #183 Closes: #184 Closes: #185 Closes: #186 Closes: #187 Closes: #188 Closes: #189
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change