Skip to content

Commit

Permalink
Merge pull request #67 from Gearbox-protocol/pqk-cleanup
Browse files Browse the repository at this point in the history
feat: pqk + quotas cleanup
  • Loading branch information
0xmikko authored Jun 4, 2023
2 parents a1df2d7 + e832d40 commit 07d583d
Show file tree
Hide file tree
Showing 58 changed files with 1,680 additions and 904 deletions.
280 changes: 0 additions & 280 deletions contracts/adapters/LICENSE

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ contract BotListV3 is ACLNonReentrantTrait, IBotListV3 {
/// @param permissions A bit mask of permissions
/// @param fundingAmount Total amount of ETH available to the bot for payments
/// @param weeklyFundingAllowance Amount of ETH available to the bot weekly

function setBotPermissions(
address creditAccount,
address bot,
Expand Down Expand Up @@ -149,6 +148,7 @@ contract BotListV3 is ACLNonReentrantTrait, IBotListV3 {
}
}

/// @dev Removes all permissions and funding for a (credit account, bot) pair
function _eraseBot(address creditAccount, address bot) internal {
delete botPermissions[creditAccount][bot]; // F: [BL-06]
delete botFunding[creditAccount][bot]; // F: [BL-06]
Expand All @@ -164,7 +164,7 @@ contract BotListV3 is ACLNonReentrantTrait, IBotListV3 {
/// @param paymentAmount Amount to pay
function payBot(address payer, address creditAccount, address bot, uint72 paymentAmount)
external
onlyValidCreditFacade
onlyValidCreditFacade // F: [BL-05]
{
if (paymentAmount == 0) return;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions contracts/credit/CreditAccountV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract CreditAccountV3 is ICreditAccountV3 {
}

/// @inheritdoc ICreditAccountV3
function execute(address target, bytes memory data)
function execute(address target, bytes calldata data)
external
override
creditManagerOnly // U:[CA-2]
Expand All @@ -69,7 +69,7 @@ contract CreditAccountV3 is ICreditAccountV3 {
}

/// @inheritdoc ICreditAccountV3
function rescue(address target, bytes memory data)
function rescue(address target, bytes calldata data)
external
override
factoryOnly // U:[CA-2]
Expand Down
2 changes: 1 addition & 1 deletion contracts/credit/CreditConfiguratorV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ contract CreditConfiguratorV3 is ICreditConfiguratorV3, ACLNonReentrantTrait {
function setTotalDebtLimit(uint128 newLimit)
external
override
configuratorOnly // I: [CC-2]
controllerOnly // I: [CC-2]
{
CreditFacadeV3 cf = CreditFacadeV3(creditFacade());
if (!cf.trackTotalDebt()) revert TotalDebtNotTrackedException(); // I:[CC-34]
Expand Down
7 changes: 2 additions & 5 deletions contracts/credit/CreditFacadeV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ contract CreditFacadeV3 is ICreditFacadeV3, ACLNonReentrantTrait {
(address token, bytes memory data) = abi.decode(callData, (address, bytes)); // U:[FA-25]

address priceFeed = IPriceOracleV2(ICreditManagerV3(creditManager).priceOracle()).priceFeeds(token); // U:[FA-25]
if (priceFeed == address(0)) revert PriceFeedNotExistsException(); // U:[FA-25]
if (priceFeed == address(0)) revert PriceFeedDoesNotExistException(); // U:[FA-25]

IPriceFeedOnDemand(priceFeed).updatePrice(data); // U:[FA-25]
}
Expand Down Expand Up @@ -950,17 +950,14 @@ contract CreditFacadeV3 is ICreditFacadeV3, ACLNonReentrantTrait {
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
int96 realQuotaChange;
(address token, int96 quotaChange, uint96 minQuota) = abi.decode(callData, (address, int96, uint96)); // U:[FA-34]
(realQuotaChange, tokensToEnable, tokensToDisable) = ICreditManagerV3(creditManager).updateQuota({
(tokensToEnable, tokensToDisable) = ICreditManagerV3(creditManager).updateQuota({
creditAccount: creditAccount,
token: token,
quotaChange: quotaChange,
minQuota: minQuota,
maxQuota: uint96(Math.min(type(uint96).max, maxQuotaMultiplier * debtLimits.maxDebt))
}); // U:[FA-34]

emit UpdateQuota({creditAccount: creditAccount, token: token, quotaChange: realQuotaChange}); // U:[FA-34]
}

/// @notice Requests the Credit Manager to schedule a withdrawal
Expand Down
Loading

0 comments on commit 07d583d

Please sign in to comment.