Skip to content
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

TRUST QA-5/10/11: Optimizations on BasketHandler #986

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/p0/BasketHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ contract BasketHandlerP0 is ComponentP0, IBasketHandler {
}
emit BasketSet(nonce, basket.erc20s, refAmts, true);
disabled = true;

trackStatus();
}

/// Switch the basket, only callable directly by governance or after a default
Expand All @@ -199,7 +201,7 @@ contract BasketHandlerP0 is ComponentP0, IBasketHandler {

require(
main.hasRole(OWNER, _msgSender()) ||
(status() == CollateralStatus.DISABLED && !main.tradingPausedOrFrozen()),
(lastStatus == CollateralStatus.DISABLED && !main.tradingPausedOrFrozen()),
"basket unrefreshable"
);
_switchBasket();
Expand Down
6 changes: 4 additions & 2 deletions contracts/p1/BasketHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ contract BasketHandlerP1 is ComponentP1, IBasketHandler {
for (uint256 i = 0; i < len; ++i) refAmts[i] = basket.refAmts[basket.erc20s[i]];
emit BasketSet(nonce, basket.erc20s, refAmts, true);
disabled = true;

trackStatus();
}

/// Switch the basket, only callable directly by governance or after a default
Expand All @@ -137,7 +139,7 @@ contract BasketHandlerP1 is ComponentP1, IBasketHandler {

require(
main.hasRole(OWNER, _msgSender()) ||
(status() == CollateralStatus.DISABLED && !main.tradingPausedOrFrozen()),
(lastStatus == CollateralStatus.DISABLED && !main.tradingPausedOrFrozen()),
"basket unrefreshable"
);
_switchBasket();
Expand Down Expand Up @@ -403,7 +405,7 @@ contract BasketHandlerP1 is ComponentP1, IBasketHandler {
for (uint256 k = 0; k < len; ++k) {
if (b.erc20s[j] == erc20sAll[k]) {
erc20Index = k;
continue;
break;
}
}

Expand Down
Loading