-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,16 +26,18 @@ struct RewardDistribution { | |
// * 40% to all token stakers. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
OliverNChalk
|
||
// * 50% to all token holders. | ||
fn calculate_distribution(amount: u64) -> Result<RewardDistribution, ProgramError> { | ||
let treasury_reward = amount | ||
.checked_div(10) | ||
.ok_or(ProgramError::InvalidInstructionData)?; | ||
let stakers_reward = amount | ||
.checked_mul(2) | ||
.and_then(|v| v.checked_div(5)) | ||
.ok_or(ProgramError::InvalidInstructionData)?; | ||
let holders_reward = amount | ||
.checked_div(2) | ||
.ok_or(ProgramError::InvalidInstructionData)?; | ||
let treasury_reward = amount | ||
.checked_sub(holders_reward) | ||
.unwrap() | ||
.checked_sub(stakers_reward) | ||
.unwrap(); | ||
|
||
Ok(RewardDistribution { | ||
treasury_reward, | ||
|
Comment outdated