-
Notifications
You must be signed in to change notification settings - Fork 36
Fix: validate eliminate deficit #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -358,9 +358,8 @@ contract Hub is IHub, AccessManaged { | |
| SpokeData storage coveredSpoke = _spokes[assetId][spoke]; | ||
|
|
||
| asset.accrue(); | ||
| _validateEliminateDeficit(callerSpoke, amount); | ||
|
|
||
| uint256 deficitRay = coveredSpoke.deficitRay; | ||
| _validateEliminateDeficit(callerSpoke, amount, deficitRay); | ||
| uint256 deficitAmountRay = (amount < deficitRay.fromRayUp()) ? amount.toRay() : deficitRay; | ||
|
|
||
| uint120 shares = asset.toAddedSharesUp(deficitAmountRay.fromRayUp()).toUint120(); | ||
|
|
@@ -894,9 +893,14 @@ contract Hub is IHub, AccessManaged { | |
| require(premiumAmountRay <= premiumRay, SurplusPremiumRayDeficitReported(premiumRay)); | ||
| } | ||
|
|
||
| function _validateEliminateDeficit(SpokeData storage spoke, uint256 amount) internal view { | ||
| function _validateEliminateDeficit( | ||
| SpokeData storage spoke, | ||
DhairyaSethi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| uint256 amount, | ||
| uint256 deficitRay | ||
| ) internal view { | ||
| require(spoke.active, SpokeNotActive()); | ||
|
||
| require(amount > 0, InvalidAmount()); | ||
| require(deficitRay > 0, InsufficientDeficit()); | ||
DhairyaSethi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| function _validatePayFeeShares(SpokeData storage senderSpoke, uint256 feeShares) internal view { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.