feat: Yield+ domain model and pure utilities#5504
feat: Yield+ domain model and pure utilities#5504therealemjy wants to merge 1 commit intofeat/yield-plus-pr03-yieldplus-infrafrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8fbae39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
164381d to
10e42f9
Compare
1c047df to
ba51643
Compare
10e42f9 to
0aae713
Compare
ba51643 to
6eeb050
Compare
570be16 to
9f54af2
Compare
6eeb050 to
8fbae39
Compare
Coverage Report for ./apps/evm
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@greptile |
Greptile SummaryThis PR introduces the Yield+ domain model ( Confidence Score: 5/5Safe to merge — all findings are P2 style/polish suggestions with no blocking correctness issues on the changed path. All four inline comments are P2: a precision concern in No files require special attention before merge. Important Files Changed
Reviews (1): Last reviewed commit: "feat: yield+ domain model and pure utili..." | Re-trigger Greptile |
| new BigNumber( | ||
| dsaTokenCollateralFactor / | ||
| (1 - longTokenCollateralFactor * (1 - proportionalCloseTolerancePercentage / 100)), | ||
| ) |
There was a problem hiding this comment.
Native floating-point arithmetic before BigNumber wrapping
The denominator is computed entirely in native JS floating-point before being passed to BigNumber. This discards BigNumber's precision guarantees — for deeply fractional inputs, the intermediate result can already be slightly off before rounding. Additionally, if longTokenCollateralFactor === 1 and proportionalCloseTolerancePercentage === 0, the denominator is exactly 0, giving Infinity (which propagates through .dp(2).toNumber() as Infinity). Callers would need to guard against this.
Prefer computing entirely in BigNumber:
| new BigNumber( | |
| dsaTokenCollateralFactor / | |
| (1 - longTokenCollateralFactor * (1 - proportionalCloseTolerancePercentage / 100)), | |
| ) | |
| const denominator = new BigNumber(1).minus( | |
| new BigNumber(longTokenCollateralFactor).multipliedBy( | |
| new BigNumber(1).minus(new BigNumber(proportionalCloseTolerancePercentage).dividedBy(100)), | |
| ), | |
| ); | |
| if (denominator.isZero()) { | |
| return Infinity; | |
| } | |
| return new BigNumber(dsaTokenCollateralFactor) | |
| .dividedBy(denominator) | |
| .dp(2, BigNumber.ROUND_DOWN) | |
| .toNumber(); |
Jira ticket(s)
VPD-634
VPD-632
VPD-629
VPD-640
VPD-633
VPD-638
VPD-637
VPD-643
VPD-635
VPD-639
Changes