-
Notifications
You must be signed in to change notification settings - Fork 2
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: dry ticket length, increase ticket length from 5 to 6, make max holders configurable #55
Conversation
instead of using current_prize_buckets, use lottery_balance to account for the appreciation since the last lottery
this way you can call calculate_lottery_balance from query_lottery_balance
contracts/lotto/src/error.rs
Outdated
|
||
#[error("Insufficient deposit amount for {0} tickets")] | ||
InsufficientDepositAmount(u64), | ||
|
||
#[error("Sequence must be 5 digits between 0-9")] | ||
InvalidSequence {}, | ||
#[error("Sequence must be 5 digits between 0-f but instead it was: {0}")] |
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.
We should remove the hard-coded "5 digits" here
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 ended up hard-codeding it to "6" instead, do you think that works? It seems const formatting is not supported by std: rust-lang/rust#69133. If we wanted we could add const format as a dependency: https://github.com/rodrimati1992/const_format_crates
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.
let's keep with the hard-coded 6 then, didn't know that. It's not a big deal anyway
@@ -1021,8 +1041,11 @@ pub fn execute_claim_lottery( | |||
config.stable_denom.clone(), | |||
)?; | |||
|
|||
if net_send > balance.into() { | |||
return Err(ContractError::InsufficientFunds {}); | |||
if to_send > balance.into() { |
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.
makes sense!
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.
LGTM!
* feat: increase ticket length to 6 * feat: configurable max holders (#59) * feat: make max_holders configurable * test: add test for max_holders configuration * build: build wasm and schema json artifacts * fix: add max holders bounds, make sure that max holders only increases * fix: add tests for max_holders * build: update build artifacts * Trigger actions * build: empty commit to trigger github actions
## What's This Fix unnecessary duplication of `MigrateOldDepositors` and `UpdateConfig` messages. Also update `migrate_old_depositors` function to throw an error if there are no lotteries left to migrate. * fix: unnecessary duplication of execute msgs Unnecessary duplication of MigrateOldDepositors and UpdateConfig messages
What's This
Notable Changes
TICKET_LENGTH
andNUM_PRIZE_BUCKETS
as public consts toglow_protocol::lotto
and import them when relevant.MAX_LIMIT
to10000
from100
.Changes To Error Types
Update
InvalidDepositInstantiation
to take aUint128
which specifies the invalid deposit amount.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Rename
InvalidDepositAmount
toZeroDepositAmount
.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
InvalidSequence
text and to specify the sequence that was invalid.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
InvalidHolder
text and to specify the sequence that was invalid.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Rename
InvalidGift
toGiftToSelf
(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Rename
InvalidGiftAmount
toZeroGiftAmount
(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Rename
InvalidSponsorshipAmount
toZeroSponsorshipAmount
(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
LotteryNotReady
to specify when the lottery will be ready.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
SpecifiedWithdrawAmountTooSmall
,SpecifiedWithdrawAmountTooBig
,WithdrawingTooManyTickets
andInsufficientFunds
to specify the requested value and its corresponding limit that was exceeded.https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L49-R69
Update
InsufficientPoolFunds
with more information.(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update text for
InsufficientLotteryFunds
(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
InvalidClaimLotteryNotAwarded
with more information(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Update
InvalidClaimPrizeAlreadyClaimed
with more information(https://github.com/elevenyellow/glow-protocol/pull/55/files#diff-5163afc26d70ac053dac70e5c837917724f85cbd0091ff376fee9d744cec48b5L9-R12)
Remove
InsufficientSponsorFunds
,InvalidClaimAmount
,InvalidLotteryFundsExecution
,InvalidLotteryTicketsExecution
,InvalidLotteryExecution
.They weren't being used.