Skip to content

Commit e7afdc9

Browse files
authored
Merge pull request #49 from wildcat-finance/remove-repayOutstanding-repayDelinquent
Remove secondary repay functions [issue 47]
2 parents f785c1e + 87b8f01 commit e7afdc9

File tree

3 files changed

+1
-79
lines changed

3 files changed

+1
-79
lines changed

src/market/WildcatMarket.sol

-14
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,6 @@ contract WildcatMarket is
176176
hooks.onRepay(amount, state, baseCalldataSize);
177177
}
178178

179-
function repayOutstandingDebt() external nonReentrant sphereXGuardExternal {
180-
MarketState memory state = _getUpdatedState();
181-
uint256 outstandingDebt = state.totalDebts().satSub(totalAssets());
182-
_repay(state, outstandingDebt, 0x04);
183-
_writeState(state);
184-
}
185-
186-
function repayDelinquentDebt() external nonReentrant sphereXGuardExternal {
187-
MarketState memory state = _getUpdatedState();
188-
uint256 delinquentDebt = state.liquidityRequired().satSub(totalAssets());
189-
_repay(state, delinquentDebt, 0x04);
190-
_writeState(state);
191-
}
192-
193179
/**
194180
* @dev Transfers funds from the caller to the market.
195181
*

test/helpers/fuzz/AccessControlHooksFuzzContext.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ library LibAccessControlHooksFuzzContext {
281281
context.functionKind == FunctionKind.DepositFunction
282282
) {
283283
vm.expectEmit(address(context.hooks));
284-
emit AccessControlHooks.AccountMadeFirstDeposit(context.account);
284+
emit AccessControlHooks.AccountMadeFirstDeposit(context.market, context.account);
285285
}
286286
}
287287
if (context.expectations.expectedError != 0) {

test/market/WildcatMarket.t.sol

-64
Original file line numberDiff line numberDiff line change
@@ -351,70 +351,6 @@ contract WildcatMarketTest is BaseMarketTest {
351351
market.repay(1e18);
352352
}
353353

354-
/* ========================================================================== */
355-
/* repayOutstandingDebt() */
356-
/* ========================================================================== */
357-
358-
function test_repayOutstandingDebt() external {
359-
_depositBorrowWithdraw(alice, 1e18, 8e17, 1e18);
360-
asset.mint(address(this), 8e17);
361-
asset.approve(address(market), 8e17);
362-
vm.expectEmit(address(market));
363-
emit DebtRepaid(address(this), 8e17);
364-
market.repayOutstandingDebt();
365-
}
366-
367-
function test_repayOutstandingDebt_NullRepayAmount() external {
368-
vm.expectRevert(IMarketEventsAndErrors.NullRepayAmount.selector);
369-
market.repayOutstandingDebt();
370-
}
371-
372-
/* ========================================================================== */
373-
/* repayDelinquentDebt() */
374-
/* ========================================================================== */
375-
376-
function test_repayDelinquentDebt() external {
377-
_depositBorrowWithdraw(alice, 1e18, 8e17, 2e17); // 20% of 8e17
378-
asset.mint(address(this), 1.6e17);
379-
asset.approve(address(market), 1.6e17);
380-
vm.expectEmit(address(market));
381-
emit DebtRepaid(address(this), 1.6e17);
382-
market.repayDelinquentDebt();
383-
}
384-
385-
function test_repayDelinquentDebt2() public asAccount(borrower) {
386-
assertEq(market.delinquencyGracePeriod(), 2000);
387-
parameters.delinquencyGracePeriod = 86_400;
388-
parameters.withdrawalBatchDuration = 0;
389-
setUp();
390-
391-
assertEq(market.delinquencyGracePeriod(), 86_400, 'delinquencyGracePeriod');
392-
assertEq(market.delinquencyFeeBips(), 1_000, 'delinquencyFeeBips');
393-
_depositBorrowWithdraw(alice, 1e18, 8e17, 1e18);
394-
395-
assertTrue(market.currentState().isDelinquent, 'should be delinquent');
396-
fastForward(365 days);
397-
398-
MarketState memory state = pendingState();
399-
updateState(state);
400-
market.updateState();
401-
_checkState();
402-
uint delinquentDebt = state.liquidityRequired().satSub(lastTotalAssets);
403-
asset.mint(borrower, delinquentDebt);
404-
asset.approve(address(market), delinquentDebt);
405-
406-
state = pendingState();
407-
_trackRepay(state, borrower, delinquentDebt);
408-
updateState(state);
409-
market.repayDelinquentDebt();
410-
_checkState();
411-
}
412-
413-
function test_repayDelinquentDebt_NullRepayAmount() external {
414-
vm.expectRevert(IMarketEventsAndErrors.NullRepayAmount.selector);
415-
market.repayDelinquentDebt();
416-
}
417-
418354
// ========================================================================== //
419355
// Credentials Provider //
420356
// ========================================================================== //

0 commit comments

Comments
 (0)