Skip to content

Commit

Permalink
fix: remove need to upgrade gsm to trigger error
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-man committed Sep 18, 2024
1 parent d0f89f2 commit 8a47c39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 603 deletions.
1 change: 0 additions & 1 deletion src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {MockAclManager} from './mocks/MockAclManager.sol';
import {MockConfigurator} from './mocks/MockConfigurator.sol';
import {MockFlashBorrower} from './mocks/MockFlashBorrower.sol';
import {MockGsmV2} from './mocks/MockGsmV2.sol';
import {MockGsmFailedGetGhoAmountForBuyAsset} from './mocks/MockGsmFailedGetGhoAmountForBuyAsset.sol';
import {MockGsmFailedBuyAssetRemainingGhoBalance} from './mocks/MockGsmFailedBuyAssetRemainingGhoBalance.sol';
import {MockGsmFailedSellAssetRemainingGhoBalance} from './mocks/MockGsmFailedSellAssetRemainingGhoBalance.sol';
import {MockPool} from './mocks/MockPool.sol';
Expand Down
28 changes: 8 additions & 20 deletions src/test/TestGsmConverter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,14 @@ contract TestGsmConverter is TestGhoBase {
}

function testRevertBuyAssetInvalidGhoSold() public {
_upgradeToGsmFailedBuyAssetGhoAmount();
vm.mockCall(
address(GHO_BUIDL_GSM),
abi.encodeWithSelector(
GHO_BUIDL_GSM.getGhoAmountForBuyAsset.selector,
DEFAULT_GSM_BUIDL_AMOUNT
),
abi.encode(100000000, 110000000000000000001, 100000000000000000000, 10000000000000000000)
);

uint256 buyFee = GHO_GSM_FIXED_FEE_STRATEGY.getBuyFee(DEFAULT_GSM_GHO_AMOUNT);
(, uint256 expectedGhoSold, , ) = GHO_BUIDL_GSM.getGhoAmountForBuyAsset(
Expand Down Expand Up @@ -2407,25 +2414,6 @@ contract TestGsmConverter is TestGhoBase {
);
}

function _upgradeToGsmFailedBuyAssetGhoAmount() internal {
address gsmFailed = address(
new MockGsmFailedGetGhoAmountForBuyAsset(
address(GHO_TOKEN),
address(BUIDL_TOKEN),
address(GHO_BUIDL_GSM_FIXED_PRICE_STRATEGY)
)
);
bytes memory data = abi.encodeWithSelector(
MockGsmFailedGetGhoAmountForBuyAsset.initialize.selector,
address(this),
TREASURY,
DEFAULT_GSM_USDC_EXPOSURE
);

vm.prank(SHORT_EXECUTOR);
AdminUpgradeabilityProxy(payable(address(GHO_BUIDL_GSM))).upgradeToAndCall(gsmFailed, data);
}

function _upgradeToGsmFailedBuyAssetRemainingGhoBalance() internal {
address gsmFailed = address(
new MockGsmFailedBuyAssetRemainingGhoBalance(
Expand Down
Loading

0 comments on commit 8a47c39

Please sign in to comment.