diff --git a/contracts/interfaces/IUserManager.sol b/contracts/interfaces/IUserManager.sol index 4ff2810..148314f 100644 --- a/contracts/interfaces/IUserManager.sol +++ b/contracts/interfaces/IUserManager.sol @@ -163,11 +163,10 @@ interface IUserManager { * @param account User address * @param token The asset token repaying to * @param lastRepay Last repay block number - * @return Number of frozen stakers, so we know if repay overdue loan works. */ function repayLoanOverdue( address account, address token, uint256 lastRepay - ) external returns (uint8); + ) external; } diff --git a/contracts/tests/ComptrollerMock.sol b/contracts/tests/ComptrollerMock.sol index 69bb984..4920411 100644 --- a/contracts/tests/ComptrollerMock.sol +++ b/contracts/tests/ComptrollerMock.sol @@ -6,6 +6,7 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; contract ComptrollerMock { address public unionToken; uint256 public rewardAmount; + uint256 public frozenCounter; function __ComptrollerMock_init() public {} @@ -38,9 +39,11 @@ contract ComptrollerMock { } function addFrozenCoinAge( - address staker, - address token, - uint256 lockedStake, - uint256 lastRepay - ) external {} + address, + address, + uint256, + uint256 + ) external { + frozenCounter++; + } } diff --git a/contracts/tests/UTokenMock.sol b/contracts/tests/UTokenMock.sol index 09e3a1d..4b5689d 100644 --- a/contracts/tests/UTokenMock.sol +++ b/contracts/tests/UTokenMock.sol @@ -40,7 +40,7 @@ contract UTokenMock is ERC20Upgradeable { address token, uint256 lastRepay ) external { - frozenCounter = IUserManager(userManager).repayLoanOverdue(account, token, lastRepay); + IUserManager(userManager).repayLoanOverdue(account, token, lastRepay); } function updateLockedData( diff --git a/contracts/tests/UserManagerMock.sol b/contracts/tests/UserManagerMock.sol index 9153fb6..1c52fed 100644 --- a/contracts/tests/UserManagerMock.sol +++ b/contracts/tests/UserManagerMock.sol @@ -144,7 +144,7 @@ contract UserManagerMock { address account, address token, uint256 lastRepay - ) external returns (uint8 counter) {} + ) external {} //Only supports sumOfTrust function debtWriteOff(address borrower, uint256 amount) public {} diff --git a/contracts/user/UserManager.sol b/contracts/user/UserManager.sol index 45c1f16..eee39bd 100644 --- a/contracts/user/UserManager.sol +++ b/contracts/user/UserManager.sol @@ -823,13 +823,12 @@ contract UserManager is Controller, IUserManager, ReentrancyGuardUpgradeable { * @param account User address * @param token The asset token repaying to * @param lastRepay Last repay block number - * @return counter Number of frozen stakers, so we know if repay overdue loan works. */ function repayLoanOverdue( address account, address token, uint256 lastRepay - ) external override whenNotPaused onlyMarketOrAdmin returns (uint8 counter) { + ) external override whenNotPaused onlyMarketOrAdmin { address[] memory stakerAddresses = getStakerAddresses(account); uint256 addressesLength = stakerAddresses.length; for (uint256 i = 0; i < addressesLength; i++) { @@ -837,7 +836,6 @@ contract UserManager is Controller, IUserManager, ReentrancyGuardUpgradeable { (, , uint256 lockedStake) = getStakerAsset(account, staker); comptroller.addFrozenCoinAge(staker, token, lockedStake, lastRepay); - ++counter; } } diff --git a/test/unit/testUserManager.js b/test/unit/testUserManager.js index 2228a7c..8a0c4bd 100644 --- a/test/unit/testUserManager.js +++ b/test/unit/testUserManager.js @@ -632,10 +632,10 @@ describe("User Manager Contract", () => { await uToken.updateLockedData(userManager.address, TOM.address, creditLimit); await uToken.updateOverdueInfo(userManager.address, TOM.address, true); - let count = await uToken.frozenCounter(); + let count = await comptroller.frozenCounter(); count.toString().should.eq("0"); await uToken.repayLoanOverdue(userManager.address, TOM.address, erc20.address, 0); - count = await uToken.frozenCounter(); + count = await comptroller.frozenCounter(); count.toString().should.eq("3"); }); });