Skip to content

Commit

Permalink
chore: forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen committed Dec 10, 2024
1 parent 91d4bba commit 8e59292
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion contracts/src/PriceFeeds/WETHPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract WETHPriceFeed is MainnetPriceFeedBase {
// _fetchPricePrimary returns:
// - The price
// - A bool indicating whether a new oracle failure was detected in the call
function _fetchPricePrimary(bool /* _isRedemption */) internal virtual returns (uint256, bool) {
function _fetchPricePrimary(bool /* _isRedemption */ ) internal virtual returns (uint256, bool) {
return _fetchPricePrimary();
}

Expand Down
7 changes: 2 additions & 5 deletions contracts/src/Zappers/GasCompZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,8 @@ contract GasCompZapper is BaseZapper {
function closeTroveFromCollateral(uint256 _troveId, uint256 _flashLoanAmount) external override {
address owner = troveNFT.ownerOf(_troveId);
address payable receiver = payable(_requireSenderIsOwnerOrRemoveManagerAndGetReceiver(_troveId, owner));
CloseTroveParams memory params = CloseTroveParams({
troveId: _troveId,
flashLoanAmount: _flashLoanAmount,
receiver: receiver
});
CloseTroveParams memory params =
CloseTroveParams({troveId: _troveId, flashLoanAmount: _flashLoanAmount, receiver: receiver});

// Set initial balances to make sure there are not lefovers
InitialBalances memory initialBalances;
Expand Down
7 changes: 2 additions & 5 deletions contracts/src/Zappers/WETHZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,8 @@ contract WETHZapper is BaseZapper {
function closeTroveFromCollateral(uint256 _troveId, uint256 _flashLoanAmount) external override {
address owner = troveNFT.ownerOf(_troveId);
address payable receiver = payable(_requireSenderIsOwnerOrRemoveManagerAndGetReceiver(_troveId, owner));
CloseTroveParams memory params = CloseTroveParams({
troveId: _troveId,
flashLoanAmount: _flashLoanAmount,
receiver: receiver
});
CloseTroveParams memory params =
CloseTroveParams({troveId: _troveId, flashLoanAmount: _flashLoanAmount, receiver: receiver});

// Set initial balances to make sure there are not lefovers
InitialBalances memory initialBalances;
Expand Down
23 changes: 17 additions & 6 deletions contracts/src/test/shutdown.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ contract ShutdownTest is DevTestSetup {
assertEq(boldToken.balanceOf(A), boldBalanceBefore - redemptionAmount, "Bold balance mismatch");
assertEq(
contractsArray[0].collToken.balanceOf(A),
collBalanceBefore + redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS) / DECIMAL_PRECISION,
collBalanceBefore
+ redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS)
/ DECIMAL_PRECISION,
"Coll balance mismatch"
);
}
Expand All @@ -440,7 +442,8 @@ contract ShutdownTest is DevTestSetup {

assertEq(
boldToken.balanceOf(A),
boldBalanceBefore - 11e18 * price / DECIMAL_PRECISION * DECIMAL_PRECISION / (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS),
boldBalanceBefore
- 11e18 * price / DECIMAL_PRECISION * DECIMAL_PRECISION / (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS),
"Bold balance mismatch"
);
assertEq(contractsArray[0].collToken.balanceOf(A), collBalanceBefore + 11e18, "Coll balance mismatch");
Expand Down Expand Up @@ -470,7 +473,9 @@ contract ShutdownTest is DevTestSetup {
assertEq(boldToken.balanceOf(A), boldBalanceBefore - redemptionAmount, "Bold balance mismatch");
assertEq(
contractsArray[0].collToken.balanceOf(A),
collBalanceBefore + redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS) / DECIMAL_PRECISION,
collBalanceBefore
+ redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS)
/ DECIMAL_PRECISION,
"Coll balance mismatch"
);
}
Expand Down Expand Up @@ -500,7 +505,9 @@ contract ShutdownTest is DevTestSetup {
// TODO: determine why this is off by 1 wei - it should be exact
assertApproximatelyEqual(
contractsArray[0].collToken.balanceOf(A),
collBalanceBefore + redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS) / DECIMAL_PRECISION,
collBalanceBefore
+ redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS)
/ DECIMAL_PRECISION,
1, // 1 wei tolerance
"Coll balance mismatch"
);
Expand Down Expand Up @@ -529,7 +536,9 @@ contract ShutdownTest is DevTestSetup {
assertEq(boldToken.balanceOf(A), boldBalanceBefore - redemptionAmount, "Bold balance mismatch");
assertEq(
contractsArray[0].collToken.balanceOf(A),
collBalanceBefore + redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS) / DECIMAL_PRECISION,
collBalanceBefore
+ redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS)
/ DECIMAL_PRECISION,
"Coll balance mismatch"
);
}
Expand Down Expand Up @@ -558,7 +567,9 @@ contract ShutdownTest is DevTestSetup {
// TODO: determine why this is off by 1 wei - it should be exact
assertApproximatelyEqual(
contractsArray[0].collToken.balanceOf(A),
collBalanceBefore + redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS) / DECIMAL_PRECISION,
collBalanceBefore
+ redemptionAmount * DECIMAL_PRECISION / price * (DECIMAL_PRECISION + URGENT_REDEMPTION_BONUS)
/ DECIMAL_PRECISION,
1, // 1 wei tolerance
"Coll balance mismatch"
);
Expand Down
3 changes: 2 additions & 1 deletion contracts/src/test/zapperLeverage.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,8 @@ contract ZapperLeverageMainnet is DevTestSetup {
tokens[0] = contractsArray[_branch].collToken;
uint256[] memory amounts = new uint256[](1);
amounts[0] = flashLoanAmount;
bytes memory userData = abi.encode(address(_zapper), IFlashLoanProvider.Operation.CloseTrove, troveId, flashLoanAmount);
bytes memory userData =
abi.encode(address(_zapper), IFlashLoanProvider.Operation.CloseTrove, troveId, flashLoanAmount);
IVault vault = IVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);
vm.startPrank(B);
vm.expectRevert("Flash loan not properly initiated");
Expand Down

0 comments on commit 8e59292

Please sign in to comment.