Skip to content

Commit

Permalink
fix: minor fix in quota keeper
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhovitsky committed Nov 3, 2023
1 parent ed09885 commit d48effc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/interfaces/ICreditFacadeV3Multicall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ interface ICreditFacadeV3Multicall {

/// @notice Updates account's quota for a token
/// @param token Token to update the quota for
/// @param quotaChange Desired quota change in underlying token units
/// @param quotaChange Desired quota change in underlying token units (`type(int96).min` to disable quota)
/// @param minQuota Minimum resulting account's quota for token required not to revert
/// @dev Enables token as collateral if quota is increased from zero, disables if decreased to zero
/// @dev Quota increase is prohibited if there are forbidden tokens enabled as collateral on the account
Expand Down
2 changes: 1 addition & 1 deletion contracts/pool/PoolQuotaKeeperV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ contract PoolQuotaKeeperV3 is IPoolQuotaKeeperV3, ACLNonReentrantTrait, Contract

tokenQuotaParams.totalQuoted = totalQuoted + uint96(quotaChange); // U:[PQK-15]
} else {
if (quotaChange == -type(int96).max) {
if (quotaChange == type(int96).min) {
unchecked {
quotaChange = (quoted == 0) ? int96(0) : -int96(quoted - 1);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/integration/credit/Quotas.int.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ contract QuotasIntegrationTest is IntegrationTestHelper, ICreditManagerV3Events
MultiCall({
target: address(creditFacade),
callData: abi.encodeCall(
ICreditFacadeV3Multicall.updateQuota, (tokenTestSuite.addressOf(Tokens.LINK), -type(int96).max, 0)
ICreditFacadeV3Multicall.updateQuota, (tokenTestSuite.addressOf(Tokens.LINK), type(int96).min, 0)
)
}),
MultiCall({
target: address(creditFacade),
callData: abi.encodeCall(
ICreditFacadeV3Multicall.updateQuota, (tokenTestSuite.addressOf(Tokens.USDT), -type(int96).max, 0)
ICreditFacadeV3Multicall.updateQuota, (tokenTestSuite.addressOf(Tokens.USDT), type(int96).min, 0)
)
}),
MultiCall({
Expand Down

0 comments on commit d48effc

Please sign in to comment.