-
Notifications
You must be signed in to change notification settings - Fork 24
Airdrop | completion flags #127
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
Conversation
if count > Uint128(100) { | ||
return Err(StdError::GenericErr { msg: "tasks above 100%".to_string(), backtrace: None }) | ||
} |
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.
If you switch to decimal this can be
if count > Decimal::one() {
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.
You would need to convert everything to decimal for that since Uint128 and Decimal dont match when comparing
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.
But for the purposes of a percentage, integer precision is entirely inadequate and is guaranteed to introduce error into the calculation. It also disallows having any kind of resolution when setting/using these values.
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.
Considering the amount is already in uShade, any "decimal" value will still be ignored when claiming so it wouldn't make a difference
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 see no reason for this to be integers, the calculation will be inaccurate and there will be lots of error. But if that doesn't matter I will approve.
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.
It does matter but decimals doesn't provide a solution for when the number is inevitably converted back into Uint128. Maybe a final calculation once that user's airdrop completion is 100% could give him the possible 1-2 uToken loss
# Conflicts: # contracts/airdrop/src/contract.rs # contracts/airdrop/src/handle.rs # contracts/airdrop/src/state.rs # packages/network_integration/src/contract_helpers/initializer.rs # packages/network_integration/src/contract_helpers/minter.rs # packages/network_integration/src/contract_helpers/stake.rs
Added completion flags for airdrop
The flags can be added before and after deployment, each flag points to an address which will be the contracts that notify the airdrop contract when a user is eligible for that portion of the airdrop