Skip to content

Commit

Permalink
fix: yearly bond & quarterly bond coupon dates (#94)
Browse files Browse the repository at this point in the history
## Summary by Sourcery

Fix coupon calculation for yearly and quarterly bonds.

Bug Fixes:
- Correct the month used to calculate coupon payments for quarterly
bonds.
- Set the correct year and month for yearly bond coupon payments.
  • Loading branch information
bl0up authored Jan 8, 2025
1 parent 74c51f9 commit 5317f42
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions contracts/facets/BondFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ contract BondFacet is BondStorage, OwnershipFacet, IERC1155Receiver, ERC165 {
}
} else if (_bondDetails.__periodicity == Periodicity.Quarterly) {
if (i == 0) {
if (month >= 11) {
if (month >= 10) {
couponYear = year + 1;
} else {
couponYear = year;
Expand All @@ -203,13 +203,8 @@ contract BondFacet is BondStorage, OwnershipFacet, IERC1155Receiver, ERC165 {
}
} else if (_bondDetails.__periodicity == Periodicity.Annual) {
if (i == 0) {
if (month == 12) {
couponYear = year + 1;
}
couponMonth = (month) % 12;
if (couponMonth == 0) {
couponMonth = 12;
}
couponYear = year;
couponMonth = month;
} else {
couponYear = couponYear + 1;
}
Expand Down

0 comments on commit 5317f42

Please sign in to comment.