Skip to content

Commit

Permalink
Chore: claim tests (#305)
Browse files Browse the repository at this point in the history
* βœ… Add claim tests

* πŸ› fix total claimable bug

* πŸ§ͺ update tests on claimables

* πŸ”€ fix conflict
  • Loading branch information
tekkac authored Dec 6, 2023
1 parent 2a2d95e commit 06cd1c8
Show file tree
Hide file tree
Showing 4 changed files with 479 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/offset/module.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ mod Offset {
fn get_total_claimable(self: @ContractState) -> u256 {
let total_absorption = self.get_total_absorption();
let claimed = self._offset_total_claimed.read();
total_absorption + claimed
assert(total_absorption >= claimed, 'Total absorption is too low');
total_absorption - claimed
}

fn get_total_claimed(self: @ContractState) -> u256 {
Expand Down
3 changes: 2 additions & 1 deletion src/components/yield/module.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ mod Yield {
fn get_total_claimable(self: @ContractState) -> u256 {
let total_sale = self.get_total_sale();
let claimed = self._yield_total_claimed.read();
total_sale + claimed
assert(total_sale >= claimed, 'Total absorption is too low');
total_sale - claimed
}

fn get_total_claimed(self: @ContractState) -> u256 {
Expand Down
1 change: 1 addition & 0 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ mod tests {
mod test_yielder;
mod test_apr;
mod scenarios {
mod test_iso_yielder_claims;
mod test_iso_yielder_setting;
mod test_iso_offseter_setting;
mod test_iso_las_delicias;
Expand Down
Loading

0 comments on commit 06cd1c8

Please sign in to comment.