Skip to content

Commit

Permalink
potlock: distributePotToProjects: percentage req
Browse files Browse the repository at this point in the history
Modify require_correct_percentages from distributePotToProjects
endpoint. The total may be lower than 100%.
This enables the caller to distribute part of the pot.
  • Loading branch information
CostinCarabas committed Aug 5, 2024
1 parent a1e9c73 commit b6bdb74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contracts/potlock/src/potlock_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ pub trait PotlockStorage {
total_perc += perc;
}
require!(
total_perc == MAX_PERCENTAGE,
"Total percentages different than 100%"
total_perc <= MAX_PERCENTAGE,
"Total percentages more than 100%"
);
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/potlock/tests/potlock_blackbox_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,15 +583,15 @@ fn test_fail_distribute_pot_to_projects2() {

// Distribute Pot donations to projects
let mut percentages = MultiValueVec::new();
percentages.push((project_id, HALF_PERCENTAGE).into());
percentages.push((project_id, 3* HALF_PERCENTAGE).into());
state
.world
.tx()
.from(OWNER_ADDRESS)
.to(POTLOCK_ADDRESS)
.typed(potlock_proxy::PotlockProxy)
.distribute_pot_to_projects(potlock_id, percentages)
.with_result(ExpectError(4, "Total percentages different than 100%"))
.with_result(ExpectError(4, "Total percentages more than 100%"))
.run();
}

Expand Down

0 comments on commit b6bdb74

Please sign in to comment.