diff --git a/README.md b/README.md index c0a269295..f726d5365 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Most of the `/Dependency` files are copy-pastes, but the following are custom or `/packages/contracts/contracts/Dependencies/Auth.sol` `/packages/contracts/contracts/Dependencies/AuthNoOwner.sol` `/packages/contracts/contracts/Dependencies/ERC3156FlashLender.sol` -`/packages/contracts/contracts/Dependencies/LiquityBase.sol` -`/packages/contracts/contracts/Dependencies/LiquityMath.sol` +`/packages/contracts/contracts/Dependencies/EbtcBase.sol` +`/packages/contracts/contracts/Dependencies/EbtcMath.sol` `/packages/contracts/contracts/Dependencies/ReentrancyGuard.sol` `/packages/contracts/contracts/Dependencies/RolesAuthority.sol` @@ -239,7 +239,7 @@ The two main contracts - `BorrowerOperations.sol` and `CdpManager.sol` - hold th `CdpManager.sol` - contains functionality for liquidations and redemptions. It sends redemption fees to the `FeeRecipient` contract. Also contains the state of each CDP - i.e. a record of the CDP’s collateral and debt. CdpManager does not hold value (i.e. Ether / other tokens). CdpManager functions call in to the various Pools to tell them to move Ether/tokens between Pools, where necessary. -`LiquityBase.sol` - Both CdpManager and BorrowerOperations inherit from the parent contract LiquityBase, which contains global constants and some common functions. +`EbtcBase.sol` - Both CdpManager and BorrowerOperations inherit from the parent contract EbtcBase, which contains global constants and some common functions. `EBTCToken.sol` - the eBTC token contract, which implements the ERC20 fungible token standard in conjunction with EIP-2612 and a mechanism that blocks (accidental) transfers to contracts and addresses like address(0) that are not supposed to receive funds through direct transfers. The contract mints, burns and transfers eBTC tokens. @@ -394,8 +394,8 @@ Redemptions burn eBTC from the redeemer’s balance, and reduce the debt of the | Function | eBTC Quantity | ERC20 Operation | |-------------------------------|---------------|--------------------------------------| | openCdp | Drawn eBTC | eBTC._mint(msg.sender, _EBTCAmount) | -| withdrawEBTC | Drawn eBTC | eBTC._mint(msg.sender, _EBTCAmount) | -| repayEBTC | Repaid eBTC | eBTC._burn(msg.sender, _EBTCAmount) | +| withdrawDebt | Drawn eBTC | eBTC._mint(msg.sender, _EBTCAmount) | +| repayDebt | Repaid eBTC | eBTC._burn(msg.sender, _EBTCAmount) | | adjustCdp: withdrawing eBTC | Drawn eBTC | eBTC._mint(msg.sender, _EBTCAmount) | | adjustCdp: repaying eBTC | Repaid eBTC | eBTC._burn(msg.sender, _EBTCAmount) | | closeCdp | Repaid eBTC | eBTC._burn(msg.sender, _EBTCAmount) | @@ -505,8 +505,8 @@ All data structures with the ‘public’ visibility specifier are ‘gettable - `openCdp` - `addColl` - `withdrawColl` -- `withdrawEBTC` -- `repayEBTC` +- `withdrawDebt` +- `repayDebt` - `_adjustCdp` - `closeCdp()` - `claimCollateral` @@ -738,7 +738,7 @@ If the redemption causes a CDP's full debt to be cancelled, the CDP is then clos ### Gas compensation helper functions -Gas compensation functions are found in the parent _LiquityBase.sol_ contract: +Gas compensation functions are found in the parent _EbtcBase.sol_ contract: `_getCompositeDebt(uint _debt)` returns the composite debt (drawn debt + gas compensation) of a CDP, for the purpose of ICR calculation. diff --git a/client/src/contracts/CDPManager.json b/client/src/contracts/CDPManager.json index 7f508e5b3..9e3aa7eb9 100644 --- a/client/src/contracts/CDPManager.json +++ b/client/src/contracts/CDPManager.json @@ -684,7 +684,7 @@ "type": "address" } ], - "name": "debtRedistributionIndex", + "name": "cdpDebtRedistributionIndex", "outputs": [ { "internalType": "uint256", diff --git a/packages/contracts/contracts/BorrowerOperations.sol b/packages/contracts/contracts/BorrowerOperations.sol index 54796fd25..afbf8a9cb 100644 --- a/packages/contracts/contracts/BorrowerOperations.sol +++ b/packages/contracts/contracts/BorrowerOperations.sol @@ -8,7 +8,7 @@ import "./Interfaces/ICdpManagerData.sol"; import "./Interfaces/IEBTCToken.sol"; import "./Interfaces/ICollSurplusPool.sol"; import "./Interfaces/ISortedCdps.sol"; -import "./Dependencies/LiquityBase.sol"; +import "./Dependencies/EbtcBase.sol"; import "./Dependencies/ReentrancyGuard.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/AuthNoOwner.sol"; @@ -16,7 +16,7 @@ import "./Dependencies/ERC3156FlashLender.sol"; import "./Dependencies/PermitNonce.sol"; contract BorrowerOperations is - LiquityBase, + EbtcBase, ReentrancyGuard, IBorrowerOperations, ERC3156FlashLender, @@ -112,10 +112,7 @@ contract BorrowerOperations is address _ebtcTokenAddress, address _feeRecipientAddress, address _collTokenAddress - ) LiquityBase(_activePoolAddress, _priceFeedAddress, _collTokenAddress) { - // This makes impossible to open a cdp with zero withdrawn EBTC - // TODO: Re-evaluate this - + ) EbtcBase(_activePoolAddress, _priceFeedAddress, _collTokenAddress) { cdpManager = ICdpManager(_cdpManagerAddress); collSurplusPool = ICollSurplusPool(_collSurplusPoolAddress); sortedCdps = ISortedCdps(_sortedCdpsAddress); @@ -165,22 +162,22 @@ contract BorrowerOperations is @notice In addition to the requested debt, extra debt is issued to cover the gas compensation. */ function openCdp( - uint256 _EBTCAmount, + uint256 _debt, bytes32 _upperHint, bytes32 _lowerHint, uint256 _stEthBalance ) external override nonReentrantSelfAndCdpM returns (bytes32) { - return _openCdp(_EBTCAmount, _upperHint, _lowerHint, _stEthBalance, msg.sender); + return _openCdp(_debt, _upperHint, _lowerHint, _stEthBalance, msg.sender); } function openCdpFor( - uint256 _EBTCAmount, + uint256 _debt, bytes32 _upperHint, bytes32 _lowerHint, uint256 _collAmount, address _borrower ) external override nonReentrantSelfAndCdpM returns (bytes32) { - return _openCdp(_EBTCAmount, _upperHint, _lowerHint, _collAmount, _borrower); + return _openCdp(_debt, _upperHint, _lowerHint, _collAmount, _borrower); } // Function that adds the received stETH to the caller's specified Cdp. @@ -209,32 +206,32 @@ contract BorrowerOperations is /** Issues `_amount` of eBTC from the caller’s Cdp to the caller. Executes only if the Cdp's collateralization ratio would remain above the minimum, and the resulting total collateralization ratio is above 150%. */ - function withdrawEBTC( + function withdrawDebt( bytes32 _cdpId, - uint256 _EBTCAmount, + uint256 _debt, bytes32 _upperHint, bytes32 _lowerHint ) external override nonReentrantSelfAndCdpM { - _adjustCdpInternal(_cdpId, 0, _EBTCAmount, true, _upperHint, _lowerHint, 0); + _adjustCdpInternal(_cdpId, 0, _debt, true, _upperHint, _lowerHint, 0); } // Repay EBTC tokens to a Cdp: Burn the repaid EBTC tokens, and reduce the cdp's debt accordingly /** repay `_amount` of eBTC to the caller’s Cdp, subject to leaving 50 debt in the Cdp (which corresponds to the 50 eBTC gas compensation). */ - function repayEBTC( + function repayDebt( bytes32 _cdpId, - uint256 _EBTCAmount, + uint256 _debt, bytes32 _upperHint, bytes32 _lowerHint ) external override nonReentrantSelfAndCdpM { - _adjustCdpInternal(_cdpId, 0, _EBTCAmount, false, _upperHint, _lowerHint, 0); + _adjustCdpInternal(_cdpId, 0, _debt, false, _upperHint, _lowerHint, 0); } function adjustCdp( bytes32 _cdpId, uint256 _stEthBalanceDecrease, - uint256 _EBTCChange, + uint256 _debtChange, bool _isDebtIncrease, bytes32 _upperHint, bytes32 _lowerHint @@ -242,7 +239,7 @@ contract BorrowerOperations is _adjustCdpInternal( _cdpId, _stEthBalanceDecrease, - _EBTCChange, + _debtChange, _isDebtIncrease, _upperHint, _lowerHint, @@ -257,7 +254,7 @@ contract BorrowerOperations is function adjustCdpWithColl( bytes32 _cdpId, uint256 _stEthBalanceDecrease, - uint256 _EBTCChange, + uint256 _debtChange, bool _isDebtIncrease, bytes32 _upperHint, bytes32 _lowerHint, @@ -266,7 +263,7 @@ contract BorrowerOperations is _adjustCdpInternal( _cdpId, _stEthBalanceDecrease, - _EBTCChange, + _debtChange, _isDebtIncrease, _upperHint, _lowerHint, @@ -285,7 +282,7 @@ contract BorrowerOperations is function _adjustCdpInternal( bytes32 _cdpId, uint256 _stEthBalanceDecrease, - uint256 _EBTCChange, + uint256 _debtChange, bool _isDebtIncrease, bytes32 _upperHint, bytes32 _lowerHint, @@ -305,10 +302,10 @@ contract BorrowerOperations is bool isRecoveryMode = _checkRecoveryModeForTCR(_getTCR(vars.price)); if (_isDebtIncrease) { - _requireNonZeroDebtChange(_EBTCChange); + _requireNonZeroDebtChange(_debtChange); } _requireSingularCollChange(_stEthBalanceIncrease, _stEthBalanceDecrease); - _requireNonZeroAdjustment(_stEthBalanceIncrease, _stEthBalanceDecrease, _EBTCChange); + _requireNonZeroAdjustment(_stEthBalanceIncrease, _stEthBalanceDecrease, _debtChange); // Get the collChange based on the collateral value transferred in the transaction (vars.collChange, vars.isCollIncrease) = _getCollSharesChangeFromStEthChange( @@ -316,7 +313,7 @@ contract BorrowerOperations is _stEthBalanceDecrease ); - vars.netDebtChange = _EBTCChange; + vars.netDebtChange = _debtChange; vars.debt = cdpManager.getCdpDebt(_cdpId); vars.coll = cdpManager.getCdpCollShares(_cdpId); @@ -327,7 +324,7 @@ contract BorrowerOperations is _stEthBalanceDecrease <= _cdpStEthBalance, "BorrowerOperations: withdraw more collateral than CDP has!" ); - vars.oldICR = LiquityMath._computeCR(_cdpStEthBalance, vars.debt, vars.price); + vars.oldICR = EbtcMath._computeCR(_cdpStEthBalance, vars.debt, vars.price); vars.newICR = _getNewICRFromCdpChange( vars.coll, vars.debt, @@ -347,9 +344,9 @@ contract BorrowerOperations is ); // When the adjustment is a debt repayment, check it's a valid amount, that the caller has enough EBTC, and that the resulting debt is >0 - if (!_isDebtIncrease && _EBTCChange > 0) { - _requireValidEBTCRepayment(vars.debt, vars.netDebtChange); - _requireSufficientEBTCBalance(ebtcToken, msg.sender, vars.netDebtChange); + if (!_isDebtIncrease && _debtChange > 0) { + _requireValidDebtRepayment(vars.debt, vars.netDebtChange); + _requireSufficientEbtcBalance(msg.sender, vars.netDebtChange); _requireNonZeroDebt(vars.debt - vars.netDebtChange); } @@ -372,14 +369,14 @@ contract BorrowerOperations is sortedCdps.reInsert(_cdpId, newNICR, _upperHint, _lowerHint); } - // Use the unmodified _EBTCChange here, as we don't send the fee to the user + // Use the unmodified _debtChange here, as we don't send the fee to the user { LocalVariables_moveTokens memory _varMvTokens = LocalVariables_moveTokens( msg.sender, vars.collChange, (vars.isCollIncrease ? _stEthBalanceIncrease : 0), vars.isCollIncrease, - _EBTCChange, + _debtChange, _isDebtIncrease, vars.netDebtChange ); @@ -388,13 +385,13 @@ contract BorrowerOperations is } function _openCdp( - uint256 _EBTCAmount, + uint256 _debt, bytes32 _upperHint, bytes32 _lowerHint, uint256 _stEthBalance, address _borrower ) internal returns (bytes32) { - _requireNonZeroDebt(_EBTCAmount); + _requireNonZeroDebt(_debt); _requireBorrowerOrPositionManagerAndUpdate(_borrower); LocalVariables_openCdp memory vars; @@ -411,7 +408,7 @@ contract BorrowerOperations is vars.price = priceFeed.fetchPrice(); bool isRecoveryMode = _checkRecoveryModeForTCR(_getTCR(vars.price)); - vars.debt = _EBTCAmount; + vars.debt = _debt; // Sanity check require(vars.netColl > 0, "BorrowerOperations: zero collateral for openCdp()!"); @@ -420,10 +417,10 @@ contract BorrowerOperations is uint256 _liquidatorRewardShares = collateral.getSharesByPooledEth(LIQUIDATOR_REWARD); // ICR is based on the net coll, i.e. the requested coll amount - fixed liquidator incentive gas comp. - vars.ICR = LiquityMath._computeCR(vars.netColl, vars.debt, vars.price); + vars.ICR = EbtcMath._computeCR(vars.netColl, vars.debt, vars.price); // NICR uses shares to normalize NICR across CDPs opened at different pooled ETH / shares ratios - vars.NICR = LiquityMath._computeNominalCR(_netCollAsShares, vars.debt); + vars.NICR = EbtcMath._computeNominalCR(_netCollAsShares, vars.debt); /** In recovery move, ICR must be greater than CCR @@ -434,7 +431,7 @@ contract BorrowerOperations is */ uint256 newTCR = _getNewTCRFromCdpChange(vars.netColl, true, vars.debt, true, vars.price); if (isRecoveryMode) { - _requireICRisAboveCCR(vars.ICR); + _requireICRisNotBelowCCR(vars.ICR); // == Grace Period == // // We are in RM, Edge case is Depositing Coll could exit RM @@ -447,8 +444,8 @@ contract BorrowerOperations is cdpManager.notifyEndGracePeriod(newTCR); } } else { - _requireICRisAboveMCR(vars.ICR); - _requireNewTCRisAboveCCR(newTCR); + _requireICRisNotBelowMCR(vars.ICR); + _requireNewTCRisNotBelowCCR(newTCR); // == Grace Period == // // We are not in RM, no edge case, we always stay above RM @@ -472,8 +469,8 @@ contract BorrowerOperations is _borrower ); - // Mint the full EBTCAmount to the caller - _withdrawEBTC(msg.sender, _EBTCAmount, _EBTCAmount); + // Mint the full debt amount, in eBTC tokens, to the caller + _withdrawDebt(msg.sender, _debt, _debt); /** Note that only NET coll (as shares) is considered part of the CDP. @@ -511,7 +508,7 @@ contract BorrowerOperations is uint256 debt = cdpManager.getCdpDebt(_cdpId); uint256 liquidatorRewardShares = cdpManager.getCdpLiquidatorRewardShares(_cdpId); - _requireSufficientEBTCBalance(ebtcToken, msg.sender, debt); + _requireSufficientEbtcBalance(msg.sender, debt); uint256 newTCR = _getNewTCRFromCdpChange( collateral.getPooledEthByShares(coll), @@ -520,19 +517,17 @@ contract BorrowerOperations is false, price ); - _requireNewTCRisAboveCCR(newTCR); + _requireNewTCRisNotBelowCCR(newTCR); // == Grace Period == // // By definition we are not in RM, notify CDPManager to ensure "Glass is on" cdpManager.notifyEndGracePeriod(newTCR); - cdpManager.removeStake(_cdpId); - // We already verified msg.sender is the borrower cdpManager.closeCdp(_cdpId, msg.sender, debt, coll); // Burn the repaid EBTC from the user's balance - _repayEBTC(msg.sender, debt); + _repayDebt(msg.sender, debt); // CEI: Send the collateral and liquidator reward shares back to the user activePool.transferSystemCollSharesAndLiquidatorReward( @@ -689,10 +684,10 @@ contract BorrowerOperations is ) internal { // Debt increase: mint change value of new eBTC to user, increment ActivePool eBTC internal accounting if (_varMvTokens.isDebtIncrease) { - _withdrawEBTC(_varMvTokens.user, _varMvTokens.EBTCChange, _varMvTokens.netDebtChange); + _withdrawDebt(_varMvTokens.user, _varMvTokens.EBTCChange, _varMvTokens.netDebtChange); } else { // Debt decrease: burn change value of eBTC from user, decrement ActivePool eBTC internal accounting - _repayEBTC(_varMvTokens.user, _varMvTokens.EBTCChange); + _repayDebt(_varMvTokens.user, _varMvTokens.EBTCChange); } if (_varMvTokens.isCollIncrease) { @@ -715,21 +710,16 @@ contract BorrowerOperations is activePool.increaseSystemCollShares(_sharesToTrack); } - // Issue the specified amount of EBTC to _account and increases - // the total active debt - function _withdrawEBTC( - address _account, - uint256 _EBTCAmount, - uint256 _netDebtIncrease - ) internal { + /// @dev Mint specified debt tokens to account and change global debt accounting accordingly + function _withdrawDebt(address _account, uint256 _debt, uint256 _netDebtIncrease) internal { activePool.increaseSystemDebt(_netDebtIncrease); - ebtcToken.mint(_account, _EBTCAmount); + ebtcToken.mint(_account, _debt); } // Burn the specified amount of EBTC from _account and decreases the total active debt - function _repayEBTC(address _account, uint256 _EBTC) internal { - activePool.decreaseSystemDebt(_EBTC); - ebtcToken.burn(_account, _EBTC); + function _repayDebt(address _account, uint256 _debt) internal { + activePool.decreaseSystemDebt(_debt); + ebtcToken.burn(_account, _debt); } // --- 'Require' wrapper functions --- @@ -746,11 +736,11 @@ contract BorrowerOperations is function _requireNonZeroAdjustment( uint256 _stEthBalanceIncrease, - uint256 _EBTCChange, + uint256 _debtChange, uint256 _stEthBalanceDecrease ) internal pure { require( - _stEthBalanceIncrease != 0 || _stEthBalanceDecrease != 0 || _EBTCChange != 0, + _stEthBalanceIncrease != 0 || _stEthBalanceDecrease != 0 || _debtChange != 0, "BorrowerOperations: There must be either a collateral change or a debt change" ); } @@ -765,8 +755,8 @@ contract BorrowerOperations is require(status == 0, "BorrowerOperations: Cdp is active or has been previously closed"); } - function _requireNonZeroDebtChange(uint _EBTCChange) internal pure { - require(_EBTCChange > 0, "BorrowerOperations: Debt increase requires non-zero debtChange"); + function _requireNonZeroDebtChange(uint _debtChange) internal pure { + require(_debtChange > 0, "BorrowerOperations: Debt increase requires non-zero debtChange"); } function _requireNotInRecoveryMode(uint256 _tcr) internal view { @@ -779,7 +769,7 @@ contract BorrowerOperations is function _requireNoStEthBalanceDecrease(uint256 _stEthBalanceDecrease) internal pure { require( _stEthBalanceDecrease == 0, - "BorrowerOperations: Collateral withdrawal not permitted Recovery Mode" + "BorrowerOperations: Collateral withdrawal not permitted during Recovery Mode" ); } @@ -815,8 +805,8 @@ contract BorrowerOperations is if (_isRecoveryMode) { _requireNoStEthBalanceDecrease(_stEthBalanceDecrease); if (_isDebtIncrease) { - _requireICRisAboveCCR(_vars.newICR); - _requireNewICRisAboveOldICR(_vars.newICR, _vars.oldICR); + _requireICRisNotBelowCCR(_vars.newICR); + _requireNoDecreaseOfICR(_vars.newICR, _vars.oldICR); } // == Grace Period == // @@ -831,8 +821,8 @@ contract BorrowerOperations is } } else { // if Normal Mode - _requireICRisAboveMCR(_vars.newICR); - _requireNewTCRisAboveCCR(_vars.newTCR); + _requireICRisNotBelowMCR(_vars.newICR); + _requireNewTCRisNotBelowCCR(_vars.newTCR); // == Grace Period == // // We are not in RM, no edge case, we always stay above RM @@ -841,25 +831,25 @@ contract BorrowerOperations is } } - function _requireICRisAboveMCR(uint256 _newICR) internal pure { + function _requireICRisNotBelowMCR(uint256 _newICR) internal pure { require( _newICR >= MCR, "BorrowerOperations: An operation that would result in ICR < MCR is not permitted" ); } - function _requireICRisAboveCCR(uint256 _newICR) internal pure { + function _requireICRisNotBelowCCR(uint256 _newICR) internal pure { require(_newICR >= CCR, "BorrowerOperations: Operation must leave cdp with ICR >= CCR"); } - function _requireNewICRisAboveOldICR(uint256 _newICR, uint256 _oldICR) internal pure { + function _requireNoDecreaseOfICR(uint256 _newICR, uint256 _oldICR) internal pure { require( _newICR >= _oldICR, "BorrowerOperations: Cannot decrease your Cdp's ICR in Recovery Mode" ); } - function _requireNewTCRisAboveCCR(uint256 _newTCR) internal pure { + function _requireNewTCRisNotBelowCCR(uint256 _newTCR) internal pure { require( _newTCR >= CCR, "BorrowerOperations: An operation that would result in TCR < CCR is not permitted" @@ -873,25 +863,21 @@ contract BorrowerOperations is function _requireAtLeastMinNetStEthBalance(uint256 _coll) internal pure { require( _coll >= MIN_NET_COLL, - "BorrowerOperations: Cdp's net coll must be greater than minimum" + "BorrowerOperations: Cdp's net coll must not fall below minimum" ); } - function _requireValidEBTCRepayment(uint256 _currentDebt, uint256 _debtRepayment) internal pure { + function _requireValidDebtRepayment(uint256 _currentDebt, uint256 _debtRepayment) internal pure { require( _debtRepayment <= _currentDebt, "BorrowerOperations: Amount repaid must not be larger than the Cdp's debt" ); } - function _requireSufficientEBTCBalance( - IEBTCToken _ebtcToken, - address _account, - uint256 _debtRepayment - ) internal view { + function _requireSufficientEbtcBalance(address _account, uint256 _debtRepayment) internal view { require( - _ebtcToken.balanceOf(_account) >= _debtRepayment, - "BorrowerOperations: Caller doesnt have enough EBTC to make repayment" + ebtcToken.balanceOf(_account) >= _debtRepayment, + "BorrowerOperations: Caller doesnt have enough eBTC to make repayment" ); } @@ -931,7 +917,7 @@ contract BorrowerOperations is _isDebtIncrease ); - uint256 newNICR = LiquityMath._computeNominalCR(newColl, newDebt); + uint256 newNICR = EbtcMath._computeNominalCR(newColl, newDebt); return newNICR; } @@ -954,7 +940,7 @@ contract BorrowerOperations is _isDebtIncrease ); - uint256 newICR = LiquityMath._computeCR( + uint256 newICR = EbtcMath._computeCR( collateral.getPooledEthByShares(newColl), newDebt, _price @@ -993,7 +979,7 @@ contract BorrowerOperations is totalColl = _isCollIncrease ? totalColl + _collChange : totalColl - _collChange; totalDebt = _isDebtIncrease ? totalDebt + _debtChange : totalDebt - _debtChange; - uint256 newTCR = LiquityMath._computeCR(totalColl, totalDebt, _price); + uint256 newTCR = EbtcMath._computeCR(totalColl, totalDebt, _price); return newTCR; } diff --git a/packages/contracts/contracts/CdpManager.sol b/packages/contracts/contracts/CdpManager.sol index b17802809..963a1515f 100644 --- a/packages/contracts/contracts/CdpManager.sol +++ b/packages/contracts/contracts/CdpManager.sol @@ -141,14 +141,13 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { ) internal returns (SingleRedemptionValues memory singleRedemption) { // Determine the remaining amount (lot) to be redeemed, // capped by the entire debt of the Cdp minus the liquidation reserve - singleRedemption.eBtcToRedeem = LiquityMath._min( + singleRedemption.debtToRedeem = EbtcMath._min( _redeemColFromCdp.maxEBTCamount, Cdps[_redeemColFromCdp.cdpId].debt ); - // Get the stEthToRecieve of equivalent value in USD - singleRedemption.stEthToRecieve = collateral.getSharesByPooledEth( - (singleRedemption.eBtcToRedeem * DECIMAL_PRECISION) / _redeemColFromCdp.price + singleRedemption.collSharesDrawn = collateral.getSharesByPooledEth( + (singleRedemption.debtToRedeem * DECIMAL_PRECISION) / _redeemColFromCdp.price ); // Repurposing this struct here to avoid stack too deep. @@ -159,8 +158,8 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { ); // Decrease the debt and collateral of the current Cdp according to the EBTC lot and corresponding ETH to send - uint256 newDebt = _oldDebtAndColl.entireDebt - singleRedemption.eBtcToRedeem; - uint256 newColl = _oldDebtAndColl.entireColl - singleRedemption.stEthToRecieve; + uint256 newDebt = _oldDebtAndColl.entireDebt - singleRedemption.debtToRedeem; + uint256 newColl = _oldDebtAndColl.entireColl - singleRedemption.collSharesDrawn; if (newDebt == 0) { // No debt remains, close CDP @@ -195,7 +194,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { } } else { // Debt remains, reinsert CDP - uint256 newNICR = LiquityMath._computeNominalCR(newColl, newDebt); + uint256 newNICR = EbtcMath._computeNominalCR(newColl, newDebt); /* * If the provided hint is out of date, we bail since trying to reinsert without a good hint will almost @@ -253,7 +252,6 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { uint256 _liquidatorRewardShares, address _borrower ) internal { - _removeStake(_cdpId); _closeCdpWithoutRemovingSortedCdps(_cdpId, Status.closedByRedemption); // Update Active Pool EBTC, and send ETH to account @@ -292,10 +290,10 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { } /** - redeems `_EBTCamount` of eBTC for stETH from the system. Decreases the caller’s eBTC balance, and sends them the corresponding amount of stETH. Executes successfully if the caller has sufficient eBTC to redeem. The number of Cdps redeemed from is capped by `_maxIterations`. The borrower has to provide a `_maxFeePercentage` that he/she is willing to accept in case of a fee slippage, i.e. when another redemption transaction is processed first, driving up the redemption fee. + redeems `_debt` of eBTC for stETH from the system. Decreases the caller’s eBTC balance, and sends them the corresponding amount of stETH. Executes successfully if the caller has sufficient eBTC to redeem. The number of Cdps redeemed from is capped by `_maxIterations`. The borrower has to provide a `_maxFeePercentage` that he/she is willing to accept in case of a fee slippage, i.e. when another redemption transaction is processed first, driving up the redemption fee. */ - /* Send _EBTCamount EBTC to the system and redeem the corresponding amount of collateral + /* Send _debt EBTC to the system and redeem the corresponding amount of collateral * from as many Cdps as are needed to fill the redemption * request. Applies pending rewards to a Cdp before reducing its debt and coll. * @@ -325,7 +323,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { * remaining EBTC amount, which they can attempt to redeem later. */ function redeemCollateral( - uint256 _EBTCamount, + uint256 _debt, bytes32 _firstRedemptionHint, bytes32 _upperPartialRedemptionHint, bytes32 _lowerPartialRedemptionHint, @@ -335,6 +333,9 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { ) external override nonReentrantSelfAndBOps { RedemptionTotals memory totals; + // early check to ensure redemption is not paused + require(redemptionsPaused == false, "CdpManager: Redemptions Paused"); + _requireValidMaxFeePercentage(_maxFeePercentage); _syncGlobalAccounting(); // Apply state, we will syncGracePeriod at end of function @@ -343,27 +344,24 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { { ( uint256 tcrAtStart, - uint256 totalCollSharesAtStart, - uint256 totalEBTCSupplyAtStart + uint256 systemCollSharesAtStart, + uint256 systemDebtAtStart ) = _getTCRWithSystemDebtAndCollShares(totals.price); totals.tcrAtStart = tcrAtStart; - totals.totalCollSharesAtStart = totalCollSharesAtStart; - totals.totalEBTCSupplyAtStart = totalEBTCSupplyAtStart; + totals.systemCollSharesAtStart = systemCollSharesAtStart; + totals.systemDebtAtStart = systemDebtAtStart; } - _requireTCRoverMCR(totals.price, totals.tcrAtStart); - _requireAmountGreaterThanZero(_EBTCamount); + _requireTCRisNotBelowMCR(totals.price, totals.tcrAtStart); + _requireAmountGreaterThanZero(_debt); - require(redemptionsPaused == false, "CdpManager: Redemptions Paused"); - - _requireEBTCBalanceCoversRedemptionAndWithinSupply( - ebtcToken, + _requireEbtcBalanceCoversRedemptionAndWithinSupply( msg.sender, - _EBTCamount, - totals.totalEBTCSupplyAtStart + _debt, + totals.systemDebtAtStart ); - totals.remainingEBTC = _EBTCamount; + totals.remainingDebtToRedeem = _debt; address currentBorrower; bytes32 _cId = _firstRedemptionHint; @@ -392,14 +390,16 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { /** Core Redemption Loop */ - while (currentBorrower != address(0) && totals.remainingEBTC > 0 && _maxIterations > 0) { + while ( + currentBorrower != address(0) && totals.remainingDebtToRedeem > 0 && _maxIterations > 0 + ) { // Save the address of the Cdp preceding the current one, before potentially modifying the list { _syncAccounting(_cId); SingleRedemptionInputs memory _redeemColFromCdp = SingleRedemptionInputs( _cId, - totals.remainingEBTC, + totals.remainingDebtToRedeem, totals.price, _upperPartialRedemptionHint, _lowerPartialRedemptionHint, @@ -412,9 +412,11 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { // therefore we could not redeem from the last Cdp if (singleRedemption.cancelledPartial) break; - totals.totalEBTCToRedeem = totals.totalEBTCToRedeem + singleRedemption.eBtcToRedeem; - totals.totalETHDrawn = totals.totalETHDrawn + singleRedemption.stEthToRecieve; - totals.remainingEBTC = totals.remainingEBTC - singleRedemption.eBtcToRedeem; + totals.debtToRedeem = totals.debtToRedeem + singleRedemption.debtToRedeem; + totals.collSharesDrawn = totals.collSharesDrawn + singleRedemption.collSharesDrawn; + totals.remainingDebtToRedeem = + totals.remainingDebtToRedeem - + singleRedemption.debtToRedeem; totals.totalCollSharesSurplus = totals.totalCollSharesSurplus + singleRedemption.collSurplus; @@ -431,7 +433,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { } _maxIterations--; } - require(totals.totalETHDrawn > 0, "CdpManager: Unable to redeem any amount"); + require(totals.collSharesDrawn > 0, "CdpManager: Unable to redeem any amount"); // remove from sortedCdps if (_numCdpsFullyRedeemed == 1) { @@ -448,43 +450,43 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { // Decay the baseRate due to time passed, and then increase it according to the size of this redemption. // Use the saved total EBTC supply value, from before it was reduced by the redemption. _updateBaseRateFromRedemption( - totals.totalETHDrawn, + totals.collSharesDrawn, totals.price, - totals.totalEBTCSupplyAtStart + totals.systemDebtAtStart ); // Calculate the ETH fee - totals.ETHFee = _getRedemptionFee(totals.totalETHDrawn); + totals.feeCollShares = _getRedemptionFee(totals.collSharesDrawn); - _requireUserAcceptsFee(totals.ETHFee, totals.totalETHDrawn, _maxFeePercentage); + _requireUserAcceptsFee(totals.feeCollShares, totals.collSharesDrawn, _maxFeePercentage); - totals.ETHToSendToRedeemer = totals.totalETHDrawn - totals.ETHFee; + totals.collSharesToRedeemer = totals.collSharesDrawn - totals.feeCollShares; _syncGracePeriodForGivenValues( - totals.totalCollSharesAtStart - totals.totalETHDrawn - totals.totalCollSharesSurplus, - totals.totalEBTCSupplyAtStart - totals.totalEBTCToRedeem, + totals.systemCollSharesAtStart - totals.collSharesDrawn - totals.totalCollSharesSurplus, + totals.systemDebtAtStart - totals.debtToRedeem, totals.price ); emit Redemption( - _EBTCamount, - totals.totalEBTCToRedeem, - totals.totalETHDrawn, - totals.ETHFee, + _debt, + totals.debtToRedeem, + totals.collSharesDrawn, + totals.feeCollShares, msg.sender ); // Burn the total eBTC that is redeemed - ebtcToken.burn(msg.sender, totals.totalEBTCToRedeem); + ebtcToken.burn(msg.sender, totals.debtToRedeem); // Update Active Pool eBTC debt internal accounting - activePool.decreaseSystemDebt(totals.totalEBTCToRedeem); + activePool.decreaseSystemDebt(totals.debtToRedeem); // Allocate the stETH fee to the FeeRecipient - activePool.allocateSystemCollSharesToFeeRecipient(totals.ETHFee); + activePool.allocateSystemCollSharesToFeeRecipient(totals.feeCollShares); // CEI: Send the stETH drawn to the redeemer - activePool.transferSystemCollShares(msg.sender, totals.ETHToSendToRedeemer); + activePool.transferSystemCollShares(msg.sender, totals.collSharesToRedeemer); } // --- Helper functions --- @@ -515,11 +517,6 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { return _syncAccounting(_cdpId); } - function removeStake(bytes32 _cdpId) external override { - _requireCallerIsBorrowerOperations(); - return _removeStake(_cdpId); - } - // get totalStakes after split fee taken removed function getTotalStakeForFeeTaken( uint256 _feeTaken @@ -615,7 +612,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { _totalEBTCSupply; uint256 newBaseRate = decayedBaseRate + (redeemedEBTCFraction / beta); - newBaseRate = LiquityMath._min(newBaseRate, DECIMAL_PRECISION); // cap baseRate at a maximum of 100% + newBaseRate = EbtcMath._min(newBaseRate, DECIMAL_PRECISION); // cap baseRate at a maximum of 100% require(newBaseRate > 0, "CdpManager: new baseRate is zero!"); // Base rate is always non-zero after redemption // Update the baseRate state variable @@ -637,7 +634,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { function _calcRedemptionRate(uint256 _baseRate) internal view returns (uint256) { return - LiquityMath._min( + EbtcMath._min( redemptionFeeFloor + _baseRate, DECIMAL_PRECISION // cap at a maximum of 100% ); @@ -695,7 +692,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { function _calcDecayedBaseRate() internal view returns (uint256) { uint256 minutesPassed = _minutesPassedSinceLastRedemption(); - uint256 decayFactor = LiquityMath._decPow(minuteDecayFactor, minutesPassed); + uint256 decayFactor = EbtcMath._decPow(minuteDecayFactor, minutesPassed); return (baseRate * decayFactor) / DECIMAL_PRECISION; } @@ -723,13 +720,12 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { // --- 'require' wrapper functions --- - function _requireEBTCBalanceCoversRedemptionAndWithinSupply( - IEBTCToken _ebtcToken, + function _requireEbtcBalanceCoversRedemptionAndWithinSupply( address _redeemer, uint256 _amount, uint256 _totalSupply ) internal view { - uint256 callerBalance = _ebtcToken.balanceOf(_redeemer); + uint256 callerBalance = ebtcToken.balanceOf(_redeemer); require( callerBalance >= _amount, "CdpManager: Requested redemption amount must be <= user's EBTC token balance" @@ -744,7 +740,7 @@ contract CdpManager is CdpManagerStorage, ICdpManager, Proxy { require(_amount > 0, "CdpManager: Amount must be greater than zero"); } - function _requireTCRoverMCR(uint256 _price, uint256 _TCR) internal view { + function _requireTCRisNotBelowMCR(uint256 _price, uint256 _TCR) internal view { require(_TCR >= MCR, "CdpManager: Cannot redeem when TCR < MCR"); } diff --git a/packages/contracts/contracts/CdpManagerStorage.sol b/packages/contracts/contracts/CdpManagerStorage.sol index f5b3c983b..eb56350c4 100644 --- a/packages/contracts/contracts/CdpManagerStorage.sol +++ b/packages/contracts/contracts/CdpManagerStorage.sol @@ -6,7 +6,7 @@ import "./Interfaces/ICdpManager.sol"; import "./Interfaces/ICollSurplusPool.sol"; import "./Interfaces/IEBTCToken.sol"; import "./Interfaces/ISortedCdps.sol"; -import "./Dependencies/LiquityBase.sol"; +import "./Dependencies/EbtcBase.sol"; import "./Dependencies/ReentrancyGuard.sol"; import "./Dependencies/ICollateralTokenOracle.sol"; import "./Dependencies/AuthNoOwner.sol"; @@ -17,7 +17,7 @@ import "./Dependencies/AuthNoOwner.sol"; @dev Both must maintain the same storage layout, so shared storage components where placed here @dev Shared functions were also added here to de-dup code */ -contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, AuthNoOwner { +contract CdpManagerStorage is EbtcBase, ReentrancyGuard, ICdpManagerData, AuthNoOwner { // TODO: IMPROVE // NOTE: No packing cause it's the last var, no need for u64 uint128 public constant UNSET_TIMESTAMP = type(uint128).max; @@ -25,7 +25,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut // TODO: IMPROVE THIS!!! uint128 public lastGracePeriodStartTimestamp = UNSET_TIMESTAMP; // use max to signify - uint128 public recoveryModeGracePeriod = MINIMUM_GRACE_PERIOD; + uint128 public recoveryModeGracePeriodDuration = MINIMUM_GRACE_PERIOD; // TODO: Pitfal is fee split // NOTE: Solved by calling `syncGracePeriod` on external operations from BO @@ -93,7 +93,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut uint256 price ) internal { // Compute TCR with specified values - uint256 newTCR = LiquityMath._computeCR( + uint256 newTCR = EbtcMath._computeCR( collateral.getPooledEthByShares(systemCollShares), systemDebt, price @@ -118,8 +118,8 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut ); syncGlobalAccountingAndGracePeriod(); - recoveryModeGracePeriod = _gracePeriod; - emit GracePeriodSet(_gracePeriod); + recoveryModeGracePeriodDuration = _gracePeriod; + emit GracePeriodDurationSet(_gracePeriod); } string public constant NAME = "CdpManager"; @@ -196,11 +196,11 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut /* Global Fee accumulator calculation error due to integer division, similar to redistribution calculation */ uint256 public override systemStEthFeePerUnitIndexError; /* Individual CDP Fee accumulator tracker, used to calculate fee split distribution */ - mapping(bytes32 => uint256) public stEthFeePerUnitIndex; + mapping(bytes32 => uint256) public cdpStEthFeePerUnitIndex; /* Update timestamp for global index */ uint256 lastIndexTimestamp; // Map active cdps to their RewardSnapshot (eBTC debt redistributed) - mapping(bytes32 => uint256) public debtRedistributionIndex; + mapping(bytes32 => uint256) public cdpDebtRedistributionIndex; // Array of all active cdp Ids - used to to compute an approximate hint off-chain, for the sorted list insertion bytes32[] public CdpIds; @@ -218,7 +218,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut address _activePool, address _priceFeed, address _collateral - ) LiquityBase(_activePool, _priceFeed, _collateral) { + ) EbtcBase(_activePool, _priceFeed, _collateral) { // TODO: Move to setAddresses or _tickInterest? deploymentStartTime = block.timestamp; liquidationLibrary = _liquidationLibraryAddress; @@ -260,18 +260,20 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut "CdpManagerStorage: close non-exist or non-active CDP!" ); - uint256 CdpIdsArrayLength = CdpIds.length; - _requireMoreThanOneCdpInSystem(CdpIdsArrayLength); + uint256 cdpIdsArrayLength = CdpIds.length; + _requireMoreThanOneCdpInSystem(cdpIdsArrayLength); + + _removeStake(_cdpId); Cdps[_cdpId].status = closedStatus; Cdps[_cdpId].coll = 0; Cdps[_cdpId].debt = 0; Cdps[_cdpId].liquidatorRewardShares = 0; - debtRedistributionIndex[_cdpId] = 0; - stEthFeePerUnitIndex[_cdpId] = 0; + cdpDebtRedistributionIndex[_cdpId] = 0; + cdpStEthFeePerUnitIndex[_cdpId] = 0; - _removeCdp(_cdpId, CdpIdsArrayLength); + _removeCdp(_cdpId, cdpIdsArrayLength); } /* @@ -308,10 +310,12 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut } uint256 rewardPerUnitStaked = systemDebtRedistributionIndex - - debtRedistributionIndex[_cdpId]; + cdpDebtRedistributionIndex[_cdpId]; if (rewardPerUnitStaked > 0) { pendingEBTCDebtReward = (cdp.stake * rewardPerUnitStaked) / DECIMAL_PRECISION; + } else { + return 0; } } @@ -326,13 +330,13 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut } // Returns true if there have been any redemptions - return (debtRedistributionIndex[_cdpId] < systemDebtRedistributionIndex); + return (cdpDebtRedistributionIndex[_cdpId] < systemDebtRedistributionIndex); } function _updateRedistributedDebtSnapshot(bytes32 _cdpId) internal { uint256 _L_EBTCDebt = systemDebtRedistributionIndex; - debtRedistributionIndex[_cdpId] = _L_EBTCDebt; + cdpDebtRedistributionIndex[_cdpId] = _L_EBTCDebt; emit CdpDebtRedistributionIndexUpdated(_cdpId, _L_EBTCDebt); } @@ -418,7 +422,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut * Remove a Cdp owner from the CdpOwners array, not preserving array order. Removing owner 'B' does the following: * [A B C D E] => [A E C D], and updates E's Cdp struct to point to its new array index. */ - function _removeCdp(bytes32 _cdpId, uint256 CdpIdsArrayLength) internal { + function _removeCdp(bytes32 _cdpId, uint256 cdpIdsArrayLength) internal { Status cdpStatus = Cdps[_cdpId].status; // It’s set in caller function `_closeCdp` require( @@ -427,7 +431,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut ); uint128 index = Cdps[_cdpId].arrayIndex; - uint256 length = CdpIdsArrayLength; + uint256 length = cdpIdsArrayLength; uint256 idxLast = length - 1; require(index <= idxLast, "CdpManagerStorage: CDP indexing overflow!"); @@ -450,7 +454,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut uint256 _price ) internal view returns (uint256) { uint256 _totalColl = collateral.getPooledEthByShares(_systemCollShares); - return LiquityMath._computeCR(_totalColl, _systemDebt, _price); + return EbtcMath._computeCR(_totalColl, _systemDebt, _price); } // --- Staking-Reward Fee split functions --- @@ -552,7 +556,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut // OR Should we utilize some bot-keeper to work the routine job at fixed interval? _syncGlobalAccounting(); - uint256 _oldPerUnitCdp = stEthFeePerUnitIndex[_cdpId]; + uint256 _oldPerUnitCdp = cdpStEthFeePerUnitIndex[_cdpId]; uint256 _systemStEthFeePerUnitIndex = systemStEthFeePerUnitIndex; ( @@ -577,7 +581,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut // sync per stake index for given CDP if (_oldPerUnitCdp != _systemStEthFeePerUnitIndex) { - stEthFeePerUnitIndex[_cdpId] = _systemStEthFeePerUnitIndex; + cdpStEthFeePerUnitIndex[_cdpId] = _systemStEthFeePerUnitIndex; } return (_newColl, _newDebt, _feeSplitDistributed, _pendingDebt); @@ -588,19 +592,19 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut bytes32 _cdpId, uint256 _systemStEthFeePerUnitIndex ) public view returns (uint256, uint256) { - uint256 _stEthFeePerUnitIndex = stEthFeePerUnitIndex[_cdpId]; + uint256 _cdpStEthFeePerUnitIndex = cdpStEthFeePerUnitIndex[_cdpId]; uint256 _cdpCol = Cdps[_cdpId].coll; if ( - _stEthFeePerUnitIndex == 0 || + _cdpStEthFeePerUnitIndex == 0 || _cdpCol == 0 || - _stEthFeePerUnitIndex == _systemStEthFeePerUnitIndex + _cdpStEthFeePerUnitIndex == _systemStEthFeePerUnitIndex ) { return (0, _cdpCol); } uint256 _feeSplitDistributed = Cdps[_cdpId].stake * - (_systemStEthFeePerUnitIndex - _stEthFeePerUnitIndex); + (_systemStEthFeePerUnitIndex - _cdpStEthFeePerUnitIndex); uint256 _scaledCdpColl = _cdpCol * DECIMAL_PRECISION; @@ -639,17 +643,17 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut // Return the nominal collateral ratio (ICR) of a given Cdp, without the price. // Takes a cdp's pending coll and debt rewards from redistributions into account. function getNominalICR(bytes32 _cdpId) external view returns (uint256) { - (uint256 currentEBTCDebt, uint256 currentETH, ) = getDebtAndCollShares(_cdpId); + (uint256 currentEBTCDebt, uint256 currentCollShares, ) = getDebtAndCollShares(_cdpId); - uint256 NICR = LiquityMath._computeNominalCR(currentETH, currentEBTCDebt); + uint256 NICR = EbtcMath._computeNominalCR(currentCollShares, currentEBTCDebt); return NICR; } // Return the current collateral ratio (ICR) of a given Cdp. //Takes a cdp's pending coll and debt rewards from redistributions into account. function getICR(bytes32 _cdpId, uint256 _price) public view returns (uint256) { - (uint256 currentEBTCDebt, uint256 currentETH, ) = getDebtAndCollShares(_cdpId); - uint256 ICR = _calculateCR(currentETH, currentEBTCDebt, _price); + (uint256 currentEBTCDebt, uint256 currentCollShares, ) = getDebtAndCollShares(_cdpId); + uint256 ICR = _calculateCR(currentCollShares, currentEBTCDebt, _price); return ICR; } @@ -659,7 +663,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut uint256 _price ) internal view returns (uint256) { uint256 _underlyingCollateral = collateral.getPooledEthByShares(currentCollShare); - return LiquityMath._computeCR(_underlyingCollateral, currentDebt, _price); + return EbtcMath._computeCR(_underlyingCollateral, currentDebt, _price); } /** @@ -692,7 +696,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut ) public view returns (uint256 debt, uint256 coll, uint256 pendingEBTCDebtReward) { (uint256 _newColl, uint256 _newDebt, , uint256 _pendingDebt) = _calcSyncedAccounting( _cdpId, - stEthFeePerUnitIndex[_cdpId], + cdpStEthFeePerUnitIndex[_cdpId], systemStEthFeePerUnitIndex ); coll = _newColl; @@ -779,7 +783,7 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut (, uint256 _newGlobalSplitIdx, ) = _calcSyncedGlobalAccounting(_newIndex, _oldIndex); (uint256 _newColl, , , ) = _calcSyncedAccounting( _cdpId, - stEthFeePerUnitIndex[_cdpId], + cdpStEthFeePerUnitIndex[_cdpId], _newGlobalSplitIdx ); return _newColl; @@ -816,6 +820,6 @@ contract CdpManagerStorage is LiquityBase, ReentrancyGuard, ICdpManagerData, Aut uint128 cachedLastGracePeriodStartTimestamp = lastGracePeriodStartTimestamp; return cachedLastGracePeriodStartTimestamp != UNSET_TIMESTAMP && - block.timestamp > cachedLastGracePeriodStartTimestamp + recoveryModeGracePeriod; + block.timestamp > cachedLastGracePeriodStartTimestamp + recoveryModeGracePeriodDuration; } } diff --git a/packages/contracts/contracts/Dependencies/LiquityBase.sol b/packages/contracts/contracts/Dependencies/EbtcBase.sol similarity index 91% rename from packages/contracts/contracts/Dependencies/LiquityBase.sol rename to packages/contracts/contracts/Dependencies/EbtcBase.sol index 7a90d1c6b..834bae69c 100644 --- a/packages/contracts/contracts/Dependencies/LiquityBase.sol +++ b/packages/contracts/contracts/Dependencies/EbtcBase.sol @@ -3,17 +3,17 @@ pragma solidity 0.8.17; import "./BaseMath.sol"; -import "./LiquityMath.sol"; +import "./EbtcMath.sol"; import "../Interfaces/IActivePool.sol"; import "../Interfaces/IPriceFeed.sol"; -import "../Interfaces/ILiquityBase.sol"; +import "../Interfaces/IEbtcBase.sol"; import "../Dependencies/ICollateralToken.sol"; /* * Base contract for CdpManager, BorrowerOperations. Contains global system constants and * common functions. */ -contract LiquityBase is BaseMath, ILiquityBase { +contract EbtcBase is BaseMath, IEbtcBase { // Collateral Ratio applied for Liquidation Incentive // i.e., liquidator repay $1 worth of debt to get back $1.03 worth of collateral uint256 public constant LICR = 1030000000000000000; // 103% @@ -81,13 +81,13 @@ contract LiquityBase is BaseMath, ILiquityBase { function _getTCRWithSystemDebtAndCollShares( uint256 _price ) internal view returns (uint256 TCR, uint256 _coll, uint256 _debt) { - uint256 entireSystemColl = getSystemCollShares(); - uint256 entireSystemDebt = _getSystemDebt(); + uint256 systemCollShares = getSystemCollShares(); + uint256 systemDebt = _getSystemDebt(); - uint256 _underlyingCollateral = collateral.getPooledEthByShares(entireSystemColl); - TCR = LiquityMath._computeCR(_underlyingCollateral, entireSystemDebt, _price); + uint256 _systemStEthBalance = collateral.getPooledEthByShares(systemCollShares); + TCR = EbtcMath._computeCR(_systemStEthBalance, systemDebt, _price); - return (TCR, entireSystemColl, entireSystemDebt); + return (TCR, systemCollShares, systemDebt); } function _checkRecoveryMode(uint256 _price) internal view returns (bool) { diff --git a/packages/contracts/contracts/Dependencies/LiquityMath.sol b/packages/contracts/contracts/Dependencies/EbtcMath.sol similarity index 91% rename from packages/contracts/contracts/Dependencies/LiquityMath.sol rename to packages/contracts/contracts/Dependencies/EbtcMath.sol index 1e9acd7f4..6e8178453 100644 --- a/packages/contracts/contracts/Dependencies/LiquityMath.sol +++ b/packages/contracts/contracts/Dependencies/EbtcMath.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; -library LiquityMath { +library EbtcMath { uint256 internal constant DECIMAL_PRECISION = 1e18; uint256 public constant MAX_TCR = type(uint256).max; @@ -89,9 +89,9 @@ library LiquityMath { return (_a >= _b) ? (_a - _b) : (_b - _a); } - function _computeNominalCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) { + function _computeNominalCR(uint256 _collShares, uint256 _debt) internal pure returns (uint256) { if (_debt > 0) { - return (_coll * NICR_PRECISION) / _debt; + return (_collShares * NICR_PRECISION) / _debt; } // Return the maximal value for uint256 if the Cdp has a debt of 0. Represents "infinite" CR. else { @@ -100,13 +100,14 @@ library LiquityMath { } } + /// @dev Compute collateralization ratio, given stETH balance, price, and debt balance function _computeCR( - uint256 _coll, + uint256 _stEthBalance, uint256 _debt, uint256 _price ) internal pure returns (uint256) { if (_debt > 0) { - uint256 newCollRatio = (_coll * _price) / _debt; + uint256 newCollRatio = (_stEthBalance * _price) / _debt; return newCollRatio; } diff --git a/packages/contracts/contracts/HintHelpers.sol b/packages/contracts/contracts/HintHelpers.sol index fd6b6eca1..c942dde71 100644 --- a/packages/contracts/contracts/HintHelpers.sol +++ b/packages/contracts/contracts/HintHelpers.sol @@ -4,9 +4,9 @@ pragma solidity 0.8.17; import "./Interfaces/ICdpManager.sol"; import "./Interfaces/ISortedCdps.sol"; -import "./Dependencies/LiquityBase.sol"; +import "./Dependencies/EbtcBase.sol"; -contract HintHelpers is LiquityBase { +contract HintHelpers is EbtcBase { string public constant NAME = "HintHelpers"; ISortedCdps public immutable sortedCdps; @@ -28,7 +28,7 @@ contract HintHelpers is LiquityBase { address _collateralAddress, address _activePoolAddress, address _priceFeedAddress - ) LiquityBase(_activePoolAddress, _priceFeedAddress, _collateralAddress) { + ) EbtcBase(_activePoolAddress, _priceFeedAddress, _collateralAddress) { sortedCdps = ISortedCdps(_sortedCdpsAddress); cdpManager = ICdpManager(_cdpManagerAddress); } @@ -126,7 +126,7 @@ contract HintHelpers is LiquityBase { * @param vars The local variables of the getRedemptionHints function. * @param currentCdpDebt The net eBTC debt of the CDP. * @param _price The current price of the asset. - * @return newColl The new collateral amount after partial redemption. + * @return newCollShare The new collateral share amount after partial redemption. * @return newNICR The new Nominal Collateral Ratio (NICR) of the CDP after partial redemption. */ function _calculateCdpStateAfterPartialRedemption( @@ -135,27 +135,31 @@ contract HintHelpers is LiquityBase { uint256 _price ) internal view returns (uint256, uint256) { // maxReemable = min(remainingToRedeem, currentDebt) - uint256 maxRedeemableEBTC = LiquityMath._min(vars.remainingEbtcToRedeem, currentCdpDebt); + uint256 maxRedeemableEBTC = EbtcMath._min(vars.remainingEbtcToRedeem, currentCdpDebt); - uint256 newColl; + uint256 newCollShare; uint256 _oldIndex = cdpManager.stEthIndex(); uint256 _newIndex = collateral.getPooledEthByShares(DECIMAL_PRECISION); if (_oldIndex < _newIndex) { - newColl = _getCollateralWithSplitFeeApplied(vars.currentCdpId, _newIndex, _oldIndex); + newCollShare = _getCollateralWithSplitFeeApplied( + vars.currentCdpId, + _newIndex, + _oldIndex + ); } else { - (, newColl, ) = cdpManager.getDebtAndCollShares(vars.currentCdpId); + (, newCollShare, ) = cdpManager.getDebtAndCollShares(vars.currentCdpId); } vars.remainingEbtcToRedeem = vars.remainingEbtcToRedeem - maxRedeemableEBTC; - uint256 collToReceive = collateral.getSharesByPooledEth( + uint256 collShareToReceive = collateral.getSharesByPooledEth( (maxRedeemableEBTC * DECIMAL_PRECISION) / _price ); - uint256 _newCollAfter = newColl - collToReceive; + uint256 _newCollShareAfter = newCollShare - collShareToReceive; return ( - _newCollAfter, - LiquityMath._computeNominalCR(_newCollAfter, currentCdpDebt - maxRedeemableEBTC) + _newCollShareAfter, + EbtcMath._computeNominalCR(_newCollShareAfter, currentCdpDebt - maxRedeemableEBTC) ); } @@ -165,7 +169,7 @@ contract HintHelpers is LiquityBase { * @param _cdpId The identifier of the CDP. * @param _newIndex The new index after the split fee is applied. * @param _oldIndex The old index before the split fee is applied. - * @return newColl The new collateral amount after applying split fee. + * @return newCollShare The new collateral share amount of the CDP after applying split fee. */ function _getCollateralWithSplitFeeApplied( bytes32 _cdpId, @@ -182,8 +186,11 @@ contract HintHelpers is LiquityBase { _oldIndex ); _newStFeePerUnit = _deltaFeePerUnit + cdpManager.systemStEthFeePerUnitIndex(); - (, uint256 newColl) = cdpManager.getAccumulatedFeeSplitApplied(_cdpId, _newStFeePerUnit); - return newColl; + (, uint256 newCollShare) = cdpManager.getAccumulatedFeeSplitApplied( + _cdpId, + _newStFeePerUnit + ); + return newCollShare; } /* getApproxHint() - return address of a Cdp that is, on average, (length / numTrials) positions away in the @@ -207,7 +214,7 @@ contract HintHelpers is LiquityBase { } hint = sortedCdps.getLast(); - diff = LiquityMath._getAbsoluteDifference(_CR, cdpManager.getNominalICR(hint)); + diff = EbtcMath._getAbsoluteDifference(_CR, cdpManager.getNominalICR(hint)); latestRandomSeed = _inputRandomSeed; uint256 i = 1; @@ -220,7 +227,7 @@ contract HintHelpers is LiquityBase { uint256 currentNICR = cdpManager.getNominalICR(_cId); // check if abs(current - CR) > abs(closest - CR), and update closest if current is closer - uint256 currentDiff = LiquityMath._getAbsoluteDifference(currentNICR, _CR); + uint256 currentDiff = EbtcMath._getAbsoluteDifference(currentNICR, _CR); if (currentDiff < diff) { diff = currentDiff; @@ -232,7 +239,7 @@ contract HintHelpers is LiquityBase { /// @notice Compute nominal CR for a specified collateral and debt amount function computeNominalCR(uint256 _coll, uint256 _debt) external pure returns (uint256) { - return LiquityMath._computeNominalCR(_coll, _debt); + return EbtcMath._computeNominalCR(_coll, _debt); } /// @notice Compute CR for a specified collateral and debt amount @@ -241,6 +248,6 @@ contract HintHelpers is LiquityBase { uint256 _debt, uint256 _price ) external pure returns (uint256) { - return LiquityMath._computeCR(_coll, _debt, _price); + return EbtcMath._computeCR(_coll, _debt, _price); } } diff --git a/packages/contracts/contracts/Interfaces/IBorrowerOperations.sol b/packages/contracts/contracts/Interfaces/IBorrowerOperations.sol index 518d02b55..e331a707d 100644 --- a/packages/contracts/contracts/Interfaces/IBorrowerOperations.sol +++ b/packages/contracts/contracts/Interfaces/IBorrowerOperations.sol @@ -41,14 +41,14 @@ interface IBorrowerOperations is IPositionManagers { bytes32 _lowerHint ) external; - function withdrawEBTC( + function withdrawDebt( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, bytes32 _lowerHint ) external; - function repayEBTC( + function repayDebt( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, diff --git a/packages/contracts/contracts/Interfaces/ICdpManager.sol b/packages/contracts/contracts/Interfaces/ICdpManager.sol index 273220256..f535acd8d 100644 --- a/packages/contracts/contracts/Interfaces/ICdpManager.sol +++ b/packages/contracts/contracts/Interfaces/ICdpManager.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.17; -import "./ILiquityBase.sol"; +import "./IEbtcBase.sol"; import "./ICdpManagerData.sol"; // Common interface for the Cdp Manager. -interface ICdpManager is ILiquityBase, ICdpManagerData { +interface ICdpManager is IEbtcBase, ICdpManagerData { // --- Functions --- function getActiveCdpsCount() external view returns (uint256); @@ -41,8 +41,6 @@ interface ICdpManager is ILiquityBase, ICdpManagerData { function closeCdp(bytes32 _cdpId, address _borrower, uint256 _debt, uint256 _coll) external; - function removeStake(bytes32 _cdpId) external; - function getRedemptionRate() external view returns (uint256); function getRedemptionRateWithDecay() external view returns (uint256); diff --git a/packages/contracts/contracts/Interfaces/ICdpManagerData.sol b/packages/contracts/contracts/Interfaces/ICdpManagerData.sol index 6dbbccec7..7048641f6 100644 --- a/packages/contracts/contracts/Interfaces/ICdpManagerData.sol +++ b/packages/contracts/contracts/Interfaces/ICdpManagerData.sol @@ -22,19 +22,19 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { event Liquidation(uint256 _liquidatedDebt, uint256 _liquidatedColl, uint256 _liqReward); event Redemption( - uint256 _attemptedEBTCAmount, - uint256 _actualEBTCAmount, - uint256 _ETHSent, - uint256 _ETHFee, + uint256 _debtToRedeemExpected, + uint256 _debtToRedeemActual, + uint256 _collSharesSent, + uint256 _feeCollShares, address _redeemer ); event CdpUpdated( bytes32 indexed _cdpId, address indexed _borrower, uint256 _oldDebt, - uint256 _oldColl, + uint256 _oldCollShares, uint256 _debt, - uint256 _coll, + uint256 _collShares, uint256 _stake, CdpOperation _operation ); @@ -42,7 +42,7 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { bytes32 indexed _cdpId, address indexed _borrower, uint _debt, - uint _coll, + uint _collShares, CdpOperation _operation, address _liquidator, uint _premiumToLiquidator @@ -51,7 +51,7 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { bytes32 indexed _cdpId, address indexed _borrower, uint256 _debt, - uint256 _coll, + uint256 _collShares, CdpOperation operation, address _liquidator, uint _premiumToLiquidator @@ -61,7 +61,7 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { event TotalStakesUpdated(uint256 _newTotalStakes); event SystemSnapshotsUpdated(uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot); event SystemDebtRedistributionIndexUpdated(uint256 _systemDebtRedistributionIndex); - event CdpDebtRedistributionIndexUpdated(bytes32 _cdpId, uint256 _debtRedistributionIndex); + event CdpDebtRedistributionIndexUpdated(bytes32 _cdpId, uint256 _cdpDebtRedistributionIndex); event CdpArrayIndexUpdated(bytes32 _cdpId, uint256 _newIndex); event StEthIndexUpdated(uint256 _oldIndex, uint256 _newIndex, uint256 _updTimestamp); event CollateralFeePerUnitUpdated(uint256 _oldPerUnit, uint256 _newPerUnit, uint256 _feeTaken); @@ -124,26 +124,24 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { bytes32 lowerPartialHint; bool recoveryModeAtStart; uint256 TCR; - uint256 totalColSurplus; - uint256 totalColToSend; + uint256 totalSurplusCollShares; + uint256 totalCollSharesToSend; uint256 totalDebtToBurn; uint256 totalDebtToRedistribute; - uint256 totalColReward; - bool sequenceLiq; + uint256 totalLiquidatorRewardCollShares; } struct LiquidationRecoveryModeLocals { uint256 entireSystemDebt; uint256 entireSystemColl; uint256 totalDebtToBurn; - uint256 totalColToSend; - uint256 totalColSurplus; + uint256 totalCollSharesToSend; + uint256 totalSurplusCollShares; bytes32 cdpId; uint256 price; uint256 ICR; uint256 totalDebtToRedistribute; - uint256 totalColReward; - bool sequenceLiq; + uint256 totalLiquidatorRewardCollShares; } struct LocalVariables_OuterLiquidationFunction { @@ -175,16 +173,16 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { struct LiquidationValues { uint256 entireCdpDebt; - uint256 debtToOffset; + uint256 debtToBurn; uint256 totalCollToSendToLiquidator; uint256 debtToRedistribute; uint256 collSurplus; - uint256 collReward; + uint256 liquidatorCollSharesReward; } struct LiquidationTotals { uint256 totalDebtInSequence; - uint256 totalDebtToOffset; + uint256 totalDebtToBurn; uint256 totalCollToSendToLiquidator; uint256 totalDebtToRedistribute; uint256 totalCollSurplus; @@ -194,22 +192,22 @@ interface ICdpManagerData is IRecoveryModeGracePeriod { // --- Variable container structs for redemptions --- struct RedemptionTotals { - uint256 remainingEBTC; - uint256 totalEBTCToRedeem; - uint256 totalETHDrawn; + uint256 remainingDebtToRedeem; + uint256 debtToRedeem; + uint256 collSharesDrawn; uint256 totalCollSharesSurplus; - uint256 ETHFee; - uint256 ETHToSendToRedeemer; + uint256 feeCollShares; + uint256 collSharesToRedeemer; uint256 decayedBaseRate; uint256 price; - uint256 totalEBTCSupplyAtStart; - uint256 totalCollSharesAtStart; + uint256 systemDebtAtStart; + uint256 systemCollSharesAtStart; uint256 tcrAtStart; } struct SingleRedemptionValues { - uint256 eBtcToRedeem; - uint256 stEthToRecieve; + uint256 debtToRedeem; + uint256 collSharesDrawn; uint256 collSurplus; uint256 liquidatorRewardShares; bool cancelledPartial; diff --git a/packages/contracts/contracts/Interfaces/IEBTCToken.sol b/packages/contracts/contracts/Interfaces/IEBTCToken.sol index 0572df042..05a5e79e4 100644 --- a/packages/contracts/contracts/Interfaces/IEBTCToken.sol +++ b/packages/contracts/contracts/Interfaces/IEBTCToken.sol @@ -6,9 +6,6 @@ import "../Dependencies/IERC20.sol"; import "../Dependencies/IERC2612.sol"; interface IEBTCToken is IERC20, IERC2612 { - // --- Events --- - event EBTCTokenBalanceUpdated(address _user, uint _amount); - // --- Functions --- function mint(address _account, uint256 _amount) external; diff --git a/packages/contracts/contracts/Interfaces/ILiquityBase.sol b/packages/contracts/contracts/Interfaces/IEbtcBase.sol similarity index 85% rename from packages/contracts/contracts/Interfaces/ILiquityBase.sol rename to packages/contracts/contracts/Interfaces/IEbtcBase.sol index 929220c0a..f10d9d42d 100644 --- a/packages/contracts/contracts/Interfaces/ILiquityBase.sol +++ b/packages/contracts/contracts/Interfaces/IEbtcBase.sol @@ -4,6 +4,6 @@ pragma solidity 0.8.17; import "./IPriceFeed.sol"; -interface ILiquityBase { +interface IEbtcBase { function priceFeed() external view returns (IPriceFeed); } diff --git a/packages/contracts/contracts/Interfaces/IRecoveryModeGracePeriod.sol b/packages/contracts/contracts/Interfaces/IRecoveryModeGracePeriod.sol index b6c347e83..99c6d923a 100644 --- a/packages/contracts/contracts/Interfaces/IRecoveryModeGracePeriod.sol +++ b/packages/contracts/contracts/Interfaces/IRecoveryModeGracePeriod.sol @@ -8,7 +8,7 @@ interface IRecoveryModeGracePeriod { // NOTE: Ts is implicit in events (it's added by GETH) event GracePeriodStart(); event GracePeriodEnd(); - event GracePeriodSet(uint256 _recoveryModeGracePeriod); + event GracePeriodDurationSet(uint256 _recoveryModeGracePeriodDuration); function notifyStartGracePeriod(uint256 tcr) external; diff --git a/packages/contracts/contracts/LiquidationLibrary.sol b/packages/contracts/contracts/LiquidationLibrary.sol index ba3b90505..118773900 100644 --- a/packages/contracts/contracts/LiquidationLibrary.sol +++ b/packages/contracts/contracts/LiquidationLibrary.sol @@ -78,11 +78,12 @@ contract LiquidationLibrary is CdpManagerStorage { uint128 cachedLastGracePeriodStartTimestamp = lastGracePeriodStartTimestamp; require( cachedLastGracePeriodStartTimestamp != UNSET_TIMESTAMP, - "CdpManager: Recovery Mode grace period not started" + "LiquidationLibrary: Recovery Mode grace period not started" ); require( - block.timestamp > cachedLastGracePeriodStartTimestamp + recoveryModeGracePeriod, - "CdpManager: Recovery mode grace period still in effect" + block.timestamp > + cachedLastGracePeriodStartTimestamp + recoveryModeGracePeriodDuration, + "LiquidationLibrary: Recovery mode grace period still in effect" ); } // Implicit Else Case, Implies ICR < MRC, meaning the CDP is liquidatable @@ -100,8 +101,7 @@ contract LiquidationLibrary is CdpManagerStorage { 0, 0, 0, - 0, - false + 0 ); LiquidationRecoveryModeLocals memory _rs = LiquidationRecoveryModeLocals( @@ -114,8 +114,7 @@ contract LiquidationLibrary is CdpManagerStorage { _price, _ICR, 0, - 0, - false + 0 ); _liquidateIndividualCdpSetupCDP(_liqState, _rs); @@ -134,37 +133,37 @@ contract LiquidationLibrary is CdpManagerStorage { if (_liqState.partialAmount == 0) { ( - liquidationValues.debtToOffset, + liquidationValues.debtToBurn, liquidationValues.totalCollToSendToLiquidator, liquidationValues.debtToRedistribute, - liquidationValues.collReward, + liquidationValues.liquidatorCollSharesReward, liquidationValues.collSurplus ) = _liquidateCdpInGivenMode(_liqState, _recoveryState); } else { ( - liquidationValues.debtToOffset, + liquidationValues.debtToBurn, liquidationValues.totalCollToSendToLiquidator ) = _liquidateCDPPartially(_liqState); if ( liquidationValues.totalCollToSendToLiquidator == 0 && - liquidationValues.debtToOffset == 0 + liquidationValues.debtToBurn == 0 ) { // retry with fully liquidation ( - liquidationValues.debtToOffset, + liquidationValues.debtToBurn, liquidationValues.totalCollToSendToLiquidator, liquidationValues.debtToRedistribute, - liquidationValues.collReward, + liquidationValues.liquidatorCollSharesReward, liquidationValues.collSurplus ) = _liquidateCdpInGivenMode(_liqState, _recoveryState); } } _finalizeLiquidation( - liquidationValues.debtToOffset, + liquidationValues.debtToBurn, liquidationValues.totalCollToSendToLiquidator, liquidationValues.debtToRedistribute, - liquidationValues.collReward, + liquidationValues.liquidatorCollSharesReward, liquidationValues.collSurplus, startingSystemColl, startingSystemDebt, @@ -183,19 +182,19 @@ contract LiquidationLibrary is CdpManagerStorage { memory _outputState = _liquidateIndividualCdpSetupCDPInRecoveryMode(_recoveryState); // housekeeping leftover collateral for liquidated CDP - if (_outputState.totalColSurplus > 0) { + if (_outputState.totalSurplusCollShares > 0) { activePool.transferSystemCollShares( address(collSurplusPool), - _outputState.totalColSurplus + _outputState.totalSurplusCollShares ); } return ( _outputState.totalDebtToBurn, - _outputState.totalColToSend, + _outputState.totalCollSharesToSend, _outputState.totalDebtToRedistribute, - _outputState.totalColReward, - _outputState.totalColSurplus + _outputState.totalLiquidatorRewardCollShares, + _outputState.totalSurplusCollShares ); } else { LiquidationLocals memory _outputState = _liquidateIndividualCdpSetupCDPInNormalMode( @@ -203,10 +202,10 @@ contract LiquidationLibrary is CdpManagerStorage { ); return ( _outputState.totalDebtToBurn, - _outputState.totalColToSend, + _outputState.totalCollSharesToSend, _outputState.totalDebtToRedistribute, - _outputState.totalColReward, - _outputState.totalColSurplus + _outputState.totalLiquidatorRewardCollShares, + _outputState.totalSurplusCollShares ); } } @@ -219,7 +218,7 @@ contract LiquidationLibrary is CdpManagerStorage { uint256 _totalDebtToBurn, uint256 _totalColToSend, uint256 _liquidatorReward - ) = _closeCdpByLiquidation(_liqState.cdpId, _liqState.sequenceLiq); + ) = _closeCdpByLiquidation(_liqState.cdpId); uint256 _cappedColPortion; uint256 _collSurplus; uint256 _debtToRedistribute; @@ -255,18 +254,21 @@ contract LiquidationLibrary is CdpManagerStorage { } } _liqState.totalDebtToBurn = _liqState.totalDebtToBurn + _totalDebtToBurn; - _liqState.totalColToSend = _liqState.totalColToSend + _cappedColPortion; + _liqState.totalCollSharesToSend = _liqState.totalCollSharesToSend + _cappedColPortion; _liqState.totalDebtToRedistribute = _liqState.totalDebtToRedistribute + _debtToRedistribute; - _liqState.totalColReward = _liqState.totalColReward + _liquidatorReward; + _liqState.totalLiquidatorRewardCollShares = + _liqState.totalLiquidatorRewardCollShares + + _liquidatorReward; // Emit events - uint _debtToColl = (_totalDebtToBurn * 1e18) / _liqState.price; + uint _debtToColl = (_totalDebtToBurn * DECIMAL_PRECISION) / _liqState.price; uint _cappedColl = collateral.getPooledEthByShares(_cappedColPortion + _liquidatorReward); emit CdpLiquidated( _liqState.cdpId, _borrower, _totalDebtToBurn, + // please note this is the collateral share of the liquidated CDP _cappedColPortion, CdpOperation.liquidateInNormalMode, msg.sender, @@ -284,7 +286,7 @@ contract LiquidationLibrary is CdpManagerStorage { uint256 _totalDebtToBurn, uint256 _totalColToSend, uint256 _liquidatorReward - ) = _closeCdpByLiquidation(_recoveryState.cdpId, _recoveryState.sequenceLiq); + ) = _closeCdpByLiquidation(_recoveryState.cdpId); // cap the liquidated collateral if required uint256 _cappedColPortion; @@ -315,18 +317,24 @@ contract LiquidationLibrary is CdpManagerStorage { ); if (_collSurplus > 0) { collSurplusPool.increaseSurplusCollShares(_borrower, _collSurplus); - _recoveryState.totalColSurplus = _recoveryState.totalColSurplus + _collSurplus; + _recoveryState.totalSurplusCollShares = + _recoveryState.totalSurplusCollShares + + _collSurplus; } if (_debtToRedistribute > 0) { _totalDebtToBurn = _totalDebtToBurn - _debtToRedistribute; } } _recoveryState.totalDebtToBurn = _recoveryState.totalDebtToBurn + _totalDebtToBurn; - _recoveryState.totalColToSend = _recoveryState.totalColToSend + _cappedColPortion; + _recoveryState.totalCollSharesToSend = + _recoveryState.totalCollSharesToSend + + _cappedColPortion; _recoveryState.totalDebtToRedistribute = _recoveryState.totalDebtToRedistribute + _debtToRedistribute; - _recoveryState.totalColReward = _recoveryState.totalColReward + _liquidatorReward; + _recoveryState.totalLiquidatorRewardCollShares = + _recoveryState.totalLiquidatorRewardCollShares + + _liquidatorReward; // check if system back to normal mode _recoveryState.entireSystemDebt = _recoveryState.entireSystemDebt > _totalDebtToBurn @@ -336,12 +344,13 @@ contract LiquidationLibrary is CdpManagerStorage { ? _recoveryState.entireSystemColl - _totalColToSend : 0; - uint _debtToColl = (_totalDebtToBurn * 1e18) / _recoveryState.price; + uint _debtToColl = (_totalDebtToBurn * DECIMAL_PRECISION) / _recoveryState.price; uint _cappedColl = collateral.getPooledEthByShares(_cappedColPortion + _liquidatorReward); emit CdpLiquidated( _recoveryState.cdpId, _borrower, _totalDebtToBurn, + // please note this is the collateral share of the liquidated CDP _cappedColPortion, CdpOperation.liquidateInRecoveryMode, msg.sender, @@ -354,21 +363,14 @@ contract LiquidationLibrary is CdpManagerStorage { // liquidate (and close) the CDP from an external liquidator // this function would return the liquidated debt and collateral of the given CDP // without emmiting events - function _closeCdpByLiquidation( - bytes32 _cdpId, - bool _sequenceLiq - ) private returns (uint256, uint256, uint256) { + function _closeCdpByLiquidation(bytes32 _cdpId) private returns (uint256, uint256, uint256) { // calculate entire debt to repay (uint256 entireDebt, uint256 entireColl, ) = getDebtAndCollShares(_cdpId); // housekeeping after liquidation by closing the CDP _removeStake(_cdpId); uint256 _liquidatorReward = Cdps[_cdpId].liquidatorRewardShares; - if (_sequenceLiq) { - _closeCdpWithoutRemovingSortedCdps(_cdpId, Status.closedByLiquidation); - } else { - _closeCdp(_cdpId, Status.closedByLiquidation); - } + _closeCdp(_cdpId, Status.closedByLiquidation); return (entireDebt, entireColl, _liquidatorReward); } @@ -410,11 +412,11 @@ contract LiquidationLibrary is CdpManagerStorage { { _reInsertPartialLiquidation( _partialState, - LiquityMath._computeNominalCR(newColl, newDebt), + EbtcMath._computeNominalCR(newColl, newDebt), _debtAndColl.entireDebt, _debtAndColl.entireColl ); - uint _debtToColl = (_partialDebt * 1e18) / _partialState.price; + uint _debtToColl = (_partialDebt * DECIMAL_PRECISION) / _partialState.price; uint _cappedColl = collateral.getPooledEthByShares(_partialColl); emit CdpPartiallyLiquidated( _cdpId, @@ -458,7 +460,10 @@ contract LiquidationLibrary is CdpManagerStorage { // ensure new ICR does NOT decrease due to partial liquidation // if original ICR is above LICR if (_partialState.ICR > LICR) { - require(getICR(_cdpId, _partialState.price) >= _partialState.ICR, "!_newICR>=_ICR"); + require( + getICR(_cdpId, _partialState.price) >= _partialState.ICR, + "LiquidationLibrary: !_newICR>=_ICR" + ); } // reInsert into sorted CDP list @@ -482,21 +487,21 @@ contract LiquidationLibrary is CdpManagerStorage { function _finalizeLiquidation( uint256 totalDebtToBurn, - uint256 totalColToSend, + uint256 totalCollSharesToSend, uint256 totalDebtToRedistribute, - uint256 totalColReward, - uint256 totalColSurplus, + uint256 totalLiquidatorRewardCollShares, + uint256 totalSurplusCollShares, uint256 systemInitialCollShares, uint256 systemInitialDebt, uint256 price ) internal { // update the staking and collateral snapshots - _updateSystemSnapshotsExcludeCollRemainder(totalColToSend); + _updateSystemSnapshotsExcludeCollRemainder(totalCollSharesToSend); - emit Liquidation(totalDebtToBurn, totalColToSend, totalColReward); + emit Liquidation(totalDebtToBurn, totalCollSharesToSend, totalLiquidatorRewardCollShares); _syncGracePeriodForGivenValues( - systemInitialCollShares - totalColToSend - totalColSurplus, + systemInitialCollShares - totalCollSharesToSend - totalSurplusCollShares, systemInitialDebt - totalDebtToBurn, price ); @@ -515,8 +520,8 @@ contract LiquidationLibrary is CdpManagerStorage { // CEI: ensure sending back collateral to liquidator is last thing to do activePool.transferSystemCollSharesAndLiquidatorReward( msg.sender, - totalColToSend, - totalColReward + totalCollSharesToSend, + totalLiquidatorRewardCollShares ); } @@ -567,8 +572,7 @@ contract LiquidationLibrary is CdpManagerStorage { uint256 _price, uint256 _TCR, LocalVariables_LiquidationSequence memory vars, - LiquidationValues memory singleLiquidation, - bool sequenceLiq + LiquidationValues memory singleLiquidation ) internal { LiquidationLocals memory _liqState = LiquidationLocals( vars.cdpId, @@ -583,8 +587,7 @@ contract LiquidationLibrary is CdpManagerStorage { 0, 0, 0, - 0, - sequenceLiq + 0 ); LiquidationLocals memory _outputState = _liquidateIndividualCdpSetupCDPInNormalMode( @@ -592,11 +595,11 @@ contract LiquidationLibrary is CdpManagerStorage { ); singleLiquidation.entireCdpDebt = _outputState.totalDebtToBurn; - singleLiquidation.debtToOffset = _outputState.totalDebtToBurn; - singleLiquidation.totalCollToSendToLiquidator = _outputState.totalColToSend; - singleLiquidation.collSurplus = _outputState.totalColSurplus; + singleLiquidation.debtToBurn = _outputState.totalDebtToBurn; + singleLiquidation.totalCollToSendToLiquidator = _outputState.totalCollSharesToSend; + singleLiquidation.collSurplus = _outputState.totalSurplusCollShares; singleLiquidation.debtToRedistribute = _outputState.totalDebtToRedistribute; - singleLiquidation.collReward = _outputState.totalColReward; + singleLiquidation.liquidatorCollSharesReward = _outputState.totalLiquidatorRewardCollShares; } function _getLiquidationValuesRecoveryMode( @@ -604,8 +607,7 @@ contract LiquidationLibrary is CdpManagerStorage { uint256 _systemDebt, uint256 _systemCollShares, LocalVariables_LiquidationSequence memory vars, - LiquidationValues memory singleLiquidation, - bool sequenceLiq + LiquidationValues memory singleLiquidation ) internal { LiquidationRecoveryModeLocals memory _recState = LiquidationRecoveryModeLocals( _systemDebt, @@ -617,19 +619,18 @@ contract LiquidationLibrary is CdpManagerStorage { _price, vars.ICR, 0, - 0, - sequenceLiq + 0 ); LiquidationRecoveryModeLocals memory _outputState = _liquidateIndividualCdpSetupCDPInRecoveryMode(_recState); singleLiquidation.entireCdpDebt = _outputState.totalDebtToBurn; - singleLiquidation.debtToOffset = _outputState.totalDebtToBurn; - singleLiquidation.totalCollToSendToLiquidator = _outputState.totalColToSend; - singleLiquidation.collSurplus = _outputState.totalColSurplus; + singleLiquidation.debtToBurn = _outputState.totalDebtToBurn; + singleLiquidation.totalCollToSendToLiquidator = _outputState.totalCollSharesToSend; + singleLiquidation.collSurplus = _outputState.totalSurplusCollShares; singleLiquidation.debtToRedistribute = _outputState.totalDebtToRedistribute; - singleLiquidation.collReward = _outputState.totalColReward; + singleLiquidation.liquidatorCollSharesReward = _outputState.totalLiquidatorRewardCollShares; } /* @@ -655,18 +656,17 @@ contract LiquidationLibrary is CdpManagerStorage { ); vars.recoveryModeAtStart = _TCR < CCR ? true : false; - // Perform the appropriate liquidation sequence - tally values and obtain their totals. + // Perform the appropriate batch liquidation - tally values and obtain their totals. if (vars.recoveryModeAtStart) { totals = _getTotalFromBatchLiquidate_RecoveryMode( vars.price, systemColl, systemDebt, - _cdpArray, - false + _cdpArray ); } else { // if !vars.recoveryModeAtStart - totals = _getTotalsFromBatchLiquidate_NormalMode(vars.price, _TCR, _cdpArray, false); + totals = _getTotalsFromBatchLiquidate_NormalMode(vars.price, _TCR, _cdpArray); } require(totals.totalDebtInSequence > 0, "LiquidationLibrary: nothing to liquidate"); @@ -677,7 +677,7 @@ contract LiquidationLibrary is CdpManagerStorage { } _finalizeLiquidation( - totals.totalDebtToOffset, + totals.totalDebtToBurn, totals.totalCollToSendToLiquidator, totals.totalDebtToRedistribute, totals.totalCollReward, @@ -689,15 +689,14 @@ contract LiquidationLibrary is CdpManagerStorage { } /* - * This function is used when the batch liquidation sequence starts during Recovery Mode. However, it - * handle the case where the system *leaves* Recovery Mode, part way through the liquidation sequence + * This function is used when the batch liquidation starts during Recovery Mode. However, it + * handle the case where the system *leaves* Recovery Mode, part way through the liquidation processing */ function _getTotalFromBatchLiquidate_RecoveryMode( uint256 _price, uint256 _systemCollShares, uint256 _systemDebt, - bytes32[] memory _cdpArray, - bool sequenceLiq + bytes32[] memory _cdpArray ) internal returns (LiquidationTotals memory totals) { LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; @@ -712,8 +711,7 @@ contract LiquidationLibrary is CdpManagerStorage { ); uint256 _cnt = _cdpArray.length; bool[] memory _liqFlags = new bool[](_cnt); - uint256 _liqCnt; - uint256 _start = sequenceLiq ? _cnt - 1 : 0; + uint256 _start; for (vars.i = _start; ; ) { vars.cdpId = _cdpArray[vars.i]; // only for active cdps @@ -731,12 +729,11 @@ contract LiquidationLibrary is CdpManagerStorage { vars.entireSystemDebt, vars.entireSystemColl, vars, - singleLiquidation, - sequenceLiq + singleLiquidation ); // Update aggregate trackers - vars.entireSystemDebt = vars.entireSystemDebt - singleLiquidation.debtToOffset; + vars.entireSystemDebt = vars.entireSystemDebt - singleLiquidation.debtToBurn; vars.entireSystemColl = vars.entireSystemColl - singleLiquidation.totalCollToSendToLiquidator - @@ -755,55 +752,17 @@ contract LiquidationLibrary is CdpManagerStorage { _liqCnt += 1; } else if (vars.backToNormalMode && _checkICRAgainstMCR(vars.ICR)) { _syncAccounting(vars.cdpId); - _getLiquidationValuesNormalMode( - _price, - _TCR, - vars, - singleLiquidation, - sequenceLiq - ); + _getLiquidationValuesNormalMode(_price, _TCR, vars, singleLiquidation); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); _liqFlags[vars.i] = true; - _liqCnt += 1; } // In Normal Mode skip cdps with ICR >= MCR } - if (sequenceLiq) { - if (vars.i == 0) { - break; - } - --vars.i; - } else { - ++vars.i; - if (vars.i == _cnt) { - break; - } - } - } - - // remove from sortedCdps for sequence liquidation - if (sequenceLiq) { - bytes32[] memory _toRemoveIds = _cdpArray; - if (_liqCnt > 0 && _liqCnt != _cnt) { - _toRemoveIds = new bytes32[](_liqCnt); - uint256 _j; - for (uint256 i = 0; i < _cnt; ++i) { - if (_liqFlags[i]) { - _toRemoveIds[_j] = _cdpArray[i]; - _j += 1; - } - } - require( - _j == _liqCnt, - "LiquidationLibrary: sequence liquidation (recovery mode) count error!" - ); - } - if (_liqCnt > 1) { - sortedCdps.batchRemove(_toRemoveIds); - } else if (_liqCnt == 1) { - sortedCdps.remove(_toRemoveIds[0]); + ++vars.i; + if (vars.i == _cnt) { + break; } } } @@ -811,14 +770,12 @@ contract LiquidationLibrary is CdpManagerStorage { function _getTotalsFromBatchLiquidate_NormalMode( uint256 _price, uint256 _TCR, - bytes32[] memory _cdpArray, - bool sequenceLiq + bytes32[] memory _cdpArray ) internal returns (LiquidationTotals memory totals) { LocalVariables_LiquidationSequence memory vars; LiquidationValues memory singleLiquidation; uint256 _cnt = _cdpArray.length; - uint256 _liqCnt; - uint256 _start = sequenceLiq ? _cnt - 1 : 0; + uint256 _start; for (vars.i = _start; ; ) { vars.cdpId = _cdpArray[vars.i]; // only for active cdps @@ -827,42 +784,15 @@ contract LiquidationLibrary is CdpManagerStorage { if (_checkICRAgainstMCR(vars.ICR)) { _syncAccounting(vars.cdpId); - _getLiquidationValuesNormalMode( - _price, - _TCR, - vars, - singleLiquidation, - sequenceLiq - ); + _getLiquidationValuesNormalMode(_price, _TCR, vars, singleLiquidation); // Add liquidation values to their respective running totals totals = _addLiquidationValuesToTotals(totals, singleLiquidation); - _liqCnt += 1; - } - } - if (sequenceLiq) { - if (vars.i == 0) { - break; - } - --vars.i; - } else { - ++vars.i; - if (vars.i == _cnt) { - break; } } - } - - // remove from sortedCdps for sequence liquidation - if (sequenceLiq) { - require( - _liqCnt == _cnt, - "LiquidationLibrary: sequence liquidation (normal mode) count error!" - ); - if (_cnt > 1) { - sortedCdps.batchRemove(_cdpArray); - } else if (_cnt == 1) { - sortedCdps.remove(_cdpArray[0]); + ++vars.i; + if (vars.i == _cnt) { + break; } } } @@ -877,7 +807,7 @@ contract LiquidationLibrary is CdpManagerStorage { newTotals.totalDebtInSequence = oldTotals.totalDebtInSequence + singleLiquidation.entireCdpDebt; - newTotals.totalDebtToOffset = oldTotals.totalDebtToOffset + singleLiquidation.debtToOffset; + newTotals.totalDebtToBurn = oldTotals.totalDebtToBurn + singleLiquidation.debtToBurn; newTotals.totalCollToSendToLiquidator = oldTotals.totalCollToSendToLiquidator + singleLiquidation.totalCollToSendToLiquidator; @@ -885,7 +815,9 @@ contract LiquidationLibrary is CdpManagerStorage { oldTotals.totalDebtToRedistribute + singleLiquidation.debtToRedistribute; newTotals.totalCollSurplus = oldTotals.totalCollSurplus + singleLiquidation.collSurplus; - newTotals.totalCollReward = oldTotals.totalCollReward + singleLiquidation.collReward; + newTotals.totalCollReward = + oldTotals.totalCollReward + + singleLiquidation.liquidatorCollSharesReward; return newTotals; } diff --git a/packages/contracts/contracts/LiquidationSequencer.sol b/packages/contracts/contracts/LiquidationSequencer.sol index 8c6cda786..050a8cf0f 100644 --- a/packages/contracts/contracts/LiquidationSequencer.sol +++ b/packages/contracts/contracts/LiquidationSequencer.sol @@ -6,7 +6,7 @@ import "./Interfaces/IPriceFeed.sol"; import "./Interfaces/ICdpManager.sol"; import "./Interfaces/ISortedCdps.sol"; import "./Interfaces/ICdpManagerData.sol"; -import "./Dependencies/LiquityBase.sol"; +import "./Dependencies/EbtcBase.sol"; /// @notice Helper to turn a sequence into CDP id array for batch liquidation /// @dev Note this sequencer only serves as an approximation tool to provide "best-effort" @@ -14,7 +14,7 @@ import "./Dependencies/LiquityBase.sol"; /// @dev It is possible that some of the returned CDPs might be skipped (not liquidatable any more) /// @dev during liquidation execution due to change of the system states /// @dev e.g., TCR brought back from Recovery Mode to Normal Mode -contract LiquidationSequencer is LiquityBase { +contract LiquidationSequencer is EbtcBase { ICdpManager public immutable cdpManager; ISortedCdps public immutable sortedCdps; @@ -24,7 +24,7 @@ contract LiquidationSequencer is LiquityBase { address _priceFeedAddress, address _activePoolAddress, address _collateralAddress - ) LiquityBase(_activePoolAddress, _priceFeedAddress, _collateralAddress) { + ) EbtcBase(_activePoolAddress, _priceFeedAddress, _collateralAddress) { cdpManager = ICdpManager(_cdpManagerAddress); sortedCdps = ISortedCdps(_sortedCdpsAddress); } diff --git a/packages/contracts/contracts/MultiCdpGetter.sol b/packages/contracts/contracts/MultiCdpGetter.sol index e8f381fc6..04a023e87 100644 --- a/packages/contracts/contracts/MultiCdpGetter.sol +++ b/packages/contracts/contracts/MultiCdpGetter.sol @@ -21,7 +21,7 @@ contract MultiCdpGetter { /// @notice Creates a new MultiCdpGetter contract /// @param _cdpManager The CdpManager contract /// @param _sortedCdps The ISortedCdps contract - constructor(CdpManager _cdpManager, ISortedCdps _sortedCdps) public { + constructor(CdpManager _cdpManager, ISortedCdps _sortedCdps) { cdpManager = _cdpManager; sortedCdps = _sortedCdps; } @@ -94,7 +94,7 @@ contract MultiCdpGetter { ) = cdpManager.Cdps(currentCdpId); - (_cdps[idx].snapshotEBTCDebt) = cdpManager.debtRedistributionIndex(currentCdpId); + (_cdps[idx].snapshotEBTCDebt) = cdpManager.cdpDebtRedistributionIndex(currentCdpId); currentCdpId = sortedCdps.getNext(currentCdpId); } @@ -129,7 +129,7 @@ contract MultiCdpGetter { ) = cdpManager.Cdps(currentCdpId); - (_cdps[idx].snapshotEBTCDebt) = cdpManager.debtRedistributionIndex(currentCdpId); + (_cdps[idx].snapshotEBTCDebt) = cdpManager.cdpDebtRedistributionIndex(currentCdpId); currentCdpId = sortedCdps.getPrev(currentCdpId); } diff --git a/packages/contracts/contracts/PriceFeed.sol b/packages/contracts/contracts/PriceFeed.sol index ae89d42aa..592ea63c3 100644 --- a/packages/contracts/contracts/PriceFeed.sol +++ b/packages/contracts/contracts/PriceFeed.sol @@ -6,7 +6,7 @@ import "./Interfaces/IPriceFeed.sol"; import "./Interfaces/IFallbackCaller.sol"; import "./Dependencies/AggregatorV3Interface.sol"; import "./Dependencies/BaseMath.sol"; -import "./Dependencies/LiquityMath.sol"; +import "./Dependencies/EbtcMath.sol"; import "./Dependencies/AuthNoOwner.sol"; /* @@ -445,8 +445,8 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner { ChainlinkResponse memory _currentResponse, ChainlinkResponse memory _prevResponse ) internal pure returns (bool) { - uint256 minPrice = LiquityMath._min(_currentResponse.answer, _prevResponse.answer); - uint256 maxPrice = LiquityMath._max(_currentResponse.answer, _prevResponse.answer); + uint256 minPrice = EbtcMath._min(_currentResponse.answer, _prevResponse.answer); + uint256 maxPrice = EbtcMath._max(_currentResponse.answer, _prevResponse.answer); /* * Use the larger price as the denominator: @@ -454,7 +454,7 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner { * - If price increased, the percentage deviation is in relation to the current price. */ uint256 percentDeviation = maxPrice > 0 - ? ((maxPrice - minPrice) * LiquityMath.DECIMAL_PRECISION) / maxPrice + ? ((maxPrice - minPrice) * EbtcMath.DECIMAL_PRECISION) / maxPrice : 0; // Return true if price has more than doubled, or more than halved. @@ -527,10 +527,10 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner { FallbackResponse memory _fallbackResponse ) internal pure returns (bool) { // Get the relative price difference between the oracles. Use the lower price as the denominator, i.e. the reference for the calculation. - uint256 minPrice = LiquityMath._min(_fallbackResponse.answer, _chainlinkResponse.answer); + uint256 minPrice = EbtcMath._min(_fallbackResponse.answer, _chainlinkResponse.answer); if (minPrice == 0) return false; - uint256 maxPrice = LiquityMath._max(_fallbackResponse.answer, _chainlinkResponse.answer); - uint256 percentPriceDifference = ((maxPrice - minPrice) * LiquityMath.DECIMAL_PRECISION) / + uint256 maxPrice = EbtcMath._max(_fallbackResponse.answer, _chainlinkResponse.answer); + uint256 percentPriceDifference = ((maxPrice - minPrice) * EbtcMath.DECIMAL_PRECISION) / minPrice; /* @@ -802,6 +802,6 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner { (_scaledDecimal * uint256(_ethBtcAnswer) * uint256(_stEthEthAnswer) * - LiquityMath.DECIMAL_PRECISION) / 10 ** (_decimalDenominator * 2); + EbtcMath.DECIMAL_PRECISION) / 10 ** (_decimalDenominator * 2); } } diff --git a/packages/contracts/contracts/Proxy/BorrowerOperationsScript.sol b/packages/contracts/contracts/Proxy/BorrowerOperationsScript.sol index 1ead24330..8aec1d28b 100644 --- a/packages/contracts/contracts/Proxy/BorrowerOperationsScript.sol +++ b/packages/contracts/contracts/Proxy/BorrowerOperationsScript.sol @@ -38,22 +38,22 @@ contract BorrowerOperationsScript { borrowerOperations.withdrawColl(_cdpId, _stEthBalanceDecrease, _upperHint, _lowerHint); } - function withdrawEBTC( + function withdrawDebt( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, bytes32 _lowerHint ) external { - borrowerOperations.withdrawEBTC(_cdpId, _amount, _upperHint, _lowerHint); + borrowerOperations.withdrawDebt(_cdpId, _amount, _upperHint, _lowerHint); } - function repayEBTC( + function repayDebt( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, bytes32 _lowerHint ) external { - borrowerOperations.repayEBTC(_cdpId, _amount, _upperHint, _lowerHint); + borrowerOperations.repayDebt(_cdpId, _amount, _upperHint, _lowerHint); } function closeCdp(bytes32 _cdpId) external { diff --git a/packages/contracts/contracts/Proxy/BorrowerWrappersScript.sol b/packages/contracts/contracts/Proxy/BorrowerWrappersScript.sol index a3bc5444a..0f63b9671 100644 --- a/packages/contracts/contracts/Proxy/BorrowerWrappersScript.sol +++ b/packages/contracts/contracts/Proxy/BorrowerWrappersScript.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import "../Dependencies/SafeMath.sol"; -import "../Dependencies/LiquityMath.sol"; +import "../Dependencies/EbtcMath.sol"; import "../Dependencies/IERC20.sol"; import "../Interfaces/IBorrowerOperations.sol"; import "../Interfaces/ICdpManager.sol"; @@ -116,9 +116,7 @@ contract BorrowerWrappersScript is BorrowerOperationsScript, ETHTransferScript, uint256 ICR = cdpManager.getICR(_cdpId, price); uint256 EBTCAmount = _collateral.mul(price).div(ICR); - uint256 netDebt = EBTCAmount.mul(LiquityMath.DECIMAL_PRECISION).div( - LiquityMath.DECIMAL_PRECISION - ); + uint256 netDebt = EBTCAmount.mul(EbtcMath.DECIMAL_PRECISION).div(EbtcMath.DECIMAL_PRECISION); return netDebt; } diff --git a/packages/contracts/contracts/TestContracts/CDPManagerTester.sol b/packages/contracts/contracts/TestContracts/CDPManagerTester.sol index a0da9de5a..ad6d7c4f2 100644 --- a/packages/contracts/contracts/TestContracts/CDPManagerTester.sol +++ b/packages/contracts/contracts/TestContracts/CDPManagerTester.sol @@ -44,7 +44,7 @@ contract CdpManagerTester is CdpManager { uint256 _debt, uint256 _price ) external pure returns (uint256) { - return LiquityMath._computeCR(_coll, _debt, _price); + return EbtcMath._computeCR(_coll, _debt, _price); } function getDeltaIndexToTriggerRM( @@ -55,7 +55,7 @@ contract CdpManagerTester is CdpManager { uint256 _tcr = _getTCR(_price); if (_tcr <= CCR) { return 0; - } else if (_tcr == LiquityMath.MAX_TCR) { + } else if (_tcr == EbtcMath.MAX_TCR) { return type(uint256).max; } else { uint256 _splitIndex = (_currentIndex * MAX_REWARD_SPLIT) / _stakingRewardSplit; @@ -85,7 +85,7 @@ contract CdpManagerTester is CdpManager { function getDecayedBaseRate() external view returns (uint256) { uint256 minutesPassed = _minutesPassedSinceLastRedemption(); - uint256 _mulFactor = LiquityMath._decPow(minuteDecayFactor, minutesPassed); + uint256 _mulFactor = EbtcMath._decPow(minuteDecayFactor, minutesPassed); return (baseRate * _mulFactor) / DECIMAL_PRECISION; } @@ -111,7 +111,7 @@ contract CdpManagerTester is CdpManager { uint256 redeemedEBTCFraction = (collateral.getPooledEthByShares(_ETHDrawn) * _price) / _totalEBTCSupply; uint256 newBaseRate = decayedBaseRate + (redeemedEBTCFraction / beta); - return LiquityMath._min(newBaseRate, DECIMAL_PRECISION); // cap baseRate at a maximum of 100% + return EbtcMath._min(newBaseRate, DECIMAL_PRECISION); // cap baseRate at a maximum of 100% } function activePoolIncreaseSystemDebt(uint256 _amount) external { diff --git a/packages/contracts/contracts/TestContracts/LiquityMathTester.sol b/packages/contracts/contracts/TestContracts/EbtcMathTester.sol similarity index 68% rename from packages/contracts/contracts/TestContracts/LiquityMathTester.sol rename to packages/contracts/contracts/TestContracts/EbtcMathTester.sol index 45ee7b970..b2263f17b 100644 --- a/packages/contracts/contracts/TestContracts/LiquityMathTester.sol +++ b/packages/contracts/contracts/TestContracts/EbtcMathTester.sol @@ -2,22 +2,22 @@ pragma solidity 0.8.17; -import "../Dependencies/LiquityMath.sol"; +import "../Dependencies/EbtcMath.sol"; /* Tester contract for math functions in Math.sol library. */ -contract LiquityMathTester { +contract EbtcMathTester { function callMax(uint256 _a, uint256 _b) external pure returns (uint256) { - return LiquityMath._max(_a, _b); + return EbtcMath._max(_a, _b); } // Non-view wrapper for gas test function callDecPowTx(uint256 _base, uint256 _n) external returns (uint256) { - return LiquityMath._decPow(_base, _n); + return EbtcMath._decPow(_base, _n); } // External wrapper function callDecPow(uint256 _base, uint256 _n) external pure returns (uint256) { - return LiquityMath._decPow(_base, _n); + return EbtcMath._decPow(_base, _n); } } diff --git a/packages/contracts/contracts/TestContracts/EchidnaProxy.sol b/packages/contracts/contracts/TestContracts/EchidnaProxy.sol index d7d439e7a..92267add9 100644 --- a/packages/contracts/contracts/TestContracts/EchidnaProxy.sol +++ b/packages/contracts/contracts/TestContracts/EchidnaProxy.sol @@ -193,18 +193,18 @@ contract EchidnaProxy is IERC3156FlashBorrower { _ensureNoRecoveryModeTriggered(); } - function withdrawEBTCPrx( + function withdrawDebtPrx( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, bytes32 _lowerHint ) external { - borrowerOperations.withdrawEBTC(_cdpId, _amount, _upperHint, _lowerHint); + borrowerOperations.withdrawDebt(_cdpId, _amount, _upperHint, _lowerHint); _ensureNoLiquidationTriggered(_cdpId); _ensureNoRecoveryModeTriggered(); } - function repayEBTCPrx( + function repayDebtPrx( bytes32 _cdpId, uint256 _amount, bytes32 _upperHint, @@ -213,7 +213,7 @@ contract EchidnaProxy is IERC3156FlashBorrower { if (_amount > 0) { uint256 _price = priceFeed.fetchPrice(); uint256 _tcrBefore = cdpManager.getTCR(_price); - borrowerOperations.repayEBTC(_cdpId, _amount, _upperHint, _lowerHint); + borrowerOperations.repayDebt(_cdpId, _amount, _upperHint, _lowerHint); uint256 _tcrAfter = cdpManager.getTCR(_price); require(_tcrAfter > _tcrBefore, "!tcrAfterRepay"); } diff --git a/packages/contracts/contracts/TestContracts/FunctionCaller.sol b/packages/contracts/contracts/TestContracts/FunctionCaller.sol index 4c11e667a..ddbc4e90e 100644 --- a/packages/contracts/contracts/TestContracts/FunctionCaller.sol +++ b/packages/contracts/contracts/TestContracts/FunctionCaller.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.17; import "../Interfaces/ICdpManager.sol"; import "../Interfaces/ISortedCdps.sol"; import "../Interfaces/IPriceFeed.sol"; -import "../Dependencies/LiquityMath.sol"; +import "../Dependencies/EbtcMath.sol"; /* Wrapper contract - used for calculating gas of read-only and internal functions. Not part of the Liquity application. */ diff --git a/packages/contracts/contracts/TestContracts/invariants/BeforeAfter.sol b/packages/contracts/contracts/TestContracts/invariants/BeforeAfter.sol index 64d079f9a..83e366fb5 100644 --- a/packages/contracts/contracts/TestContracts/invariants/BeforeAfter.sol +++ b/packages/contracts/contracts/TestContracts/invariants/BeforeAfter.sol @@ -111,7 +111,8 @@ abstract contract BeforeAfter is BaseStorageVariables { vars.hasGracePeriodPassedBefore = cdpManager.lastGracePeriodStartTimestamp() != cdpManager.UNSET_TIMESTAMP() && block.timestamp > - cdpManager.lastGracePeriodStartTimestamp() + cdpManager.recoveryModeGracePeriod(); + cdpManager.lastGracePeriodStartTimestamp() + + cdpManager.recoveryModeGracePeriodDuration(); vars.systemDebtRedistributionIndexBefore = cdpManager.systemDebtRedistributionIndex(); vars.newTcrBefore = crLens.quoteRealTCR(); @@ -157,7 +158,8 @@ abstract contract BeforeAfter is BaseStorageVariables { vars.hasGracePeriodPassedAfter = cdpManager.lastGracePeriodStartTimestamp() != cdpManager.UNSET_TIMESTAMP() && block.timestamp > - cdpManager.lastGracePeriodStartTimestamp() + cdpManager.recoveryModeGracePeriod(); + cdpManager.lastGracePeriodStartTimestamp() + + cdpManager.recoveryModeGracePeriodDuration(); vars.systemDebtRedistributionIndexAfter = cdpManager.systemDebtRedistributionIndex(); vars.newTcrAfter = crLens.quoteRealTCR(); diff --git a/packages/contracts/contracts/TestContracts/invariants/Properties.sol b/packages/contracts/contracts/TestContracts/invariants/Properties.sol index 051cf36ac..af912cb15 100644 --- a/packages/contracts/contracts/TestContracts/invariants/Properties.sol +++ b/packages/contracts/contracts/TestContracts/invariants/Properties.sol @@ -91,7 +91,9 @@ abstract contract Properties is AssertionHelper, BeforeAfter, PropertiesDescript uint256 _cdpCount = cdpManager.getActiveCdpsCount(); uint256 systemStEthFeePerUnitIndex = cdpManager.systemStEthFeePerUnitIndex(); for (uint256 i = 0; i < _cdpCount; ++i) { - if (systemStEthFeePerUnitIndex < cdpManager.stEthFeePerUnitIndex(cdpManager.CdpIds(i))) { + if ( + systemStEthFeePerUnitIndex < cdpManager.cdpStEthFeePerUnitIndex(cdpManager.CdpIds(i)) + ) { return false; } } diff --git a/packages/contracts/contracts/TestContracts/invariants/echidna/EchidnaTester.sol b/packages/contracts/contracts/TestContracts/invariants/echidna/EchidnaTester.sol index 54d8499e0..a526c6066 100644 --- a/packages/contracts/contracts/TestContracts/invariants/echidna/EchidnaTester.sol +++ b/packages/contracts/contracts/TestContracts/invariants/echidna/EchidnaTester.sol @@ -143,7 +143,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper _allTargets[4] = address(borrowerOperations); _allCalldatas[4] = abi.encodeWithSelector( - BorrowerOperations.withdrawEBTC.selector, + BorrowerOperations.withdrawDebt.selector, _cdpId, _EBTCAmount, _cdpId, @@ -152,7 +152,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper _allTargets[5] = address(borrowerOperations); _allCalldatas[5] = abi.encodeWithSelector( - BorrowerOperations.repayEBTC.selector, + BorrowerOperations.repayDebt.selector, _cdpId, _EBTCAmount, _cdpId, @@ -816,7 +816,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper emit L3( block.timestamp, cdpManager.lastGracePeriodStartTimestamp(), - cdpManager.recoveryModeGracePeriod() + cdpManager.recoveryModeGracePeriodDuration() ); assertEq(vars.newTcrAfter, vars.tcrAfter, GENERAL_11); @@ -939,7 +939,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper } } - function withdrawEBTC(uint _amount, uint256 _i) external { + function withdrawDebt(uint _amount, uint256 _i) external { actor = actors[msg.sender]; bool success; @@ -961,7 +961,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper (success, returnData) = actor.proxy( address(borrowerOperations), abi.encodeWithSelector( - BorrowerOperations.withdrawEBTC.selector, + BorrowerOperations.withdrawDebt.selector, _cdpId, _amount, _cdpId, @@ -974,11 +974,11 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper _after(_cdpId); assertEq(vars.newTcrAfter, vars.tcrAfter, GENERAL_11); - assertGte(vars.cdpDebtAfter, vars.cdpDebtBefore, "withdrawEBTC must not decrease debt"); + assertGte(vars.cdpDebtAfter, vars.cdpDebtBefore, "withdrawDebt must not decrease debt"); assertEq( vars.actorEbtcAfter, vars.actorEbtcBefore + _amount, - "withdrawEBTC must increase debt by requested amount" + "withdrawDebt must increase debt by requested amount" ); // https://github.com/Badger-Finance/ebtc-fuzz-review/issues/4 assertGte( @@ -1012,7 +1012,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper } } - function repayEBTC(uint _amount, uint256 _i) external { + function repayDebt(uint _amount, uint256 _i) external { actor = actors[msg.sender]; bool success; @@ -1033,7 +1033,7 @@ contract EchidnaTester is BeforeAfter, EchidnaProperties, EchidnaAssertionHelper (success, returnData) = actor.proxy( address(borrowerOperations), abi.encodeWithSelector( - BorrowerOperations.repayEBTC.selector, + BorrowerOperations.repayDebt.selector, _cdpId, _amount, _cdpId, diff --git a/packages/contracts/errorAccumulationTest/errorAccumulationTest.js b/packages/contracts/errorAccumulationTest/errorAccumulationTest.js index 897dfce3f..0e142d1e6 100644 --- a/packages/contracts/errorAccumulationTest/errorAccumulationTest.js +++ b/packages/contracts/errorAccumulationTest/errorAccumulationTest.js @@ -467,7 +467,7 @@ contract('CdpManager', async accounts => { it("11 accounts. 10 liquidations, partial offsets. Check (DefaultPool - totalRewards) differences", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[99], { from: accounts[99], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[99], {from: accounts[99]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[99], {from: accounts[99]}) await th.openCdp_allAccounts(accounts.slice(0, 11), contracts, dec(1, 'ether'), dec(170, 18)) @@ -515,7 +515,7 @@ contract('CdpManager', async accounts => { it("101 accounts. 100 liquidations, partial offsets. Check (DefaultPool - totalRewards) differences", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) await th.openCdp_allAccounts(accounts.slice(0, 101), contracts, dec(1, 'ether'), dec(170, 18)) @@ -565,7 +565,7 @@ contract('CdpManager', async accounts => { it("11 accounts. 10 Borrowers add to SP. 1 liquidation, 10 Borrowers withdraw all their SP funds", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) // Account 0 (to be liquidated) opens a cdp await borrowerOperations.openCdp(0, dec(100, 18), accounts[0],{from: accounts[0], value: dec(1, 'ether')}) @@ -618,7 +618,7 @@ contract('CdpManager', async accounts => { it("101 accounts. 100 Borrowers add to SP. 1 liquidation, 100 Borrowers withdraw all their SP funds", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) // Account 0 (to be liquidated) opens a cdp await borrowerOperations.openCdp(0, dec(100, 18), accounts[0],{from: accounts[0], value: dec(1, 'ether')}) @@ -667,7 +667,7 @@ contract('CdpManager', async accounts => { it("11 accounts. 10 Borrowers add to SP, random EBTC amounts. 1 liquidation, 10 Borrowers withdraw all their SP funds", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) // Account 0 (to be liquidated) opens a cdp await borrowerOperations.openCdp(0, dec(100, 18), accounts[0],{from: accounts[0], value: dec(1, 'ether')}) @@ -727,7 +727,7 @@ contract('CdpManager', async accounts => { it("101 accounts. 100 Borrowers add to SP, random EBTC amounts. 1 liquidation, 100 Borrowers withdraw all their SP funds", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) // Account 0 (to be liquidated) opens a cdp await borrowerOperations.openCdp(0, dec(100, 18), accounts[0],{from: accounts[0], value: dec(1, 'ether')}) @@ -784,7 +784,7 @@ contract('CdpManager', async accounts => { it("501 accounts. 500 Borrowers add to SP, random EBTC amounts. 1 liquidation, 500 Borrowers withdraw all their SP funds", async () => { // Acct 99 opens cdp with 100 EBTC await borrowerOperations.openCdp(0, 0, accounts[999], { from: accounts[999], value: dec(100, 'ether') }) - await borrowerOperations.withdrawEBTC(0, dec(100, 18), accounts[999], {from: accounts[999]}) + await borrowerOperations.withdrawDebt(0, dec(100, 18), accounts[999], {from: accounts[999]}) // Account 0 (to be liquidated) opens a cdp await borrowerOperations.openCdp(0, dec(100, 18), accounts[0],{from: accounts[0], value: dec(1, 'ether')}) diff --git a/packages/contracts/foundry_test/BaseFixture.sol b/packages/contracts/foundry_test/BaseFixture.sol index 3bb6cda28..c8da27ddf 100644 --- a/packages/contracts/foundry_test/BaseFixture.sol +++ b/packages/contracts/foundry_test/BaseFixture.sol @@ -477,8 +477,8 @@ contract eBTCBaseFixture is Test, BaseStorageVariables, BeforeAfter, BytecodeRea assertTrue(_liquidatorRewardShares == 0); assertTrue(_status == expectedStatus); - assertTrue(cdpManager.debtRedistributionIndex(cdpId) == 0); - assertTrue(cdpManager.stEthFeePerUnitIndex(cdpId) == 0); + assertTrue(cdpManager.cdpDebtRedistributionIndex(cdpId) == 0); + assertTrue(cdpManager.cdpStEthFeePerUnitIndex(cdpId) == 0); } function _printSystemState() internal { @@ -557,7 +557,7 @@ contract eBTCBaseFixture is Test, BaseStorageVariables, BeforeAfter, BytecodeRea // Grace Period, check never reverts so it's safe to use function _waitUntilRMColldown() internal { cdpManager.syncGlobalAccountingAndGracePeriod(); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); } function _getCdpStEthBalance(bytes32 _cdpId) public view returns (uint) { diff --git a/packages/contracts/foundry_test/BorrowerOperations.collOps.t.sol b/packages/contracts/foundry_test/BorrowerOperations.collOps.t.sol index ed643d628..5029327ce 100644 --- a/packages/contracts/foundry_test/BorrowerOperations.collOps.t.sol +++ b/packages/contracts/foundry_test/BorrowerOperations.collOps.t.sol @@ -107,9 +107,7 @@ contract CDPOpsTest is eBTCBaseFixture { // In case borrowedAmount is less than MIN_NET_DEBT - expect revert if (collAmount < borrowerOperations.MIN_NET_COLL()) { - vm.expectRevert( - bytes("BorrowerOperations: Cdp's net coll must be greater than minimum") - ); + vm.expectRevert(bytes("BorrowerOperations: Cdp's net coll must not fall below minimum")); borrowerOperations.openCdp(borrowedAmount, "hint", "hint", collAmount); return; } diff --git a/packages/contracts/foundry_test/BorrowerOperations.eBTCOps.t.sol b/packages/contracts/foundry_test/BorrowerOperations.eBTCOps.t.sol index 419477cb9..cc5b0c297 100644 --- a/packages/contracts/foundry_test/BorrowerOperations.eBTCOps.t.sol +++ b/packages/contracts/foundry_test/BorrowerOperations.eBTCOps.t.sol @@ -3,12 +3,12 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; import "forge-std/console2.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; import {Properties} from "../contracts/TestContracts/invariants/Properties.sol"; /* - * Test suite that tests opened CDPs with two different operations: repayEBTC and withdrawEBTC + * Test suite that tests opened CDPs with two different operations: repayDebt and withdrawDebt * Test include testing different metrics such as each CDP ICR, also TCR changes after operations are executed */ contract CDPOpsTest is eBTCBaseFixture, Properties { @@ -24,7 +24,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { // -------- Repay eBTC Test cases -------- // Happy case for borrowing and repaying back eBTC which should result in increasing ICR - function testRepayEBTCHappy() public { + function testrepayDebtHappy() public { uint256 collAmount = 30 ether; address user = _utils.getNextUserAddress(); vm.startPrank(user); @@ -41,7 +41,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { uint256 initialIcr = cdpManager.getICR(cdpId, priceFeedMock.fetchPrice()); uint256 balanceSnapshot = eBTCToken.balanceOf(user); // Repay eBTC - borrowerOperations.repayEBTC( + borrowerOperations.repayDebt( cdpId, // Repay 10% of eBTC borrowedAmount / 10, @@ -75,12 +75,12 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { vm.expectRevert( bytes("BorrowerOperations: There must be either a collateral change or a debt change") ); - borrowerOperations.repayEBTC(cdpId, 0, HINT, HINT); + borrowerOperations.repayDebt(cdpId, 0, HINT, HINT); vm.stopPrank(); } // Fuzzing different amounts of eBTC repaid - function testRepayEBTCFuzz(uint88 repayAmnt) public { + function testrepayDebtFuzz(uint88 repayAmnt) public { repayAmnt = uint88(bound(repayAmnt, 1e10, type(uint88).max)); // Coll amount will always be max of uint96 uint256 collAmount = type(uint96).max; @@ -99,7 +99,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { uint256 initialIcr = cdpManager.getICR(cdpId, priceFeedMock.fetchPrice()); uint256 balanceSnapshot = eBTCToken.balanceOf(user); // Repay eBTC - borrowerOperations.repayEBTC(cdpId, repayAmnt, HINT, HINT); + borrowerOperations.repayDebt(cdpId, repayAmnt, HINT, HINT); // Make sure eBTC balance decreased assertLt(eBTCToken.balanceOf(user), balanceSnapshot); // Make sure eBTC balance decreased by repayAmnt precisely @@ -111,7 +111,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { } // Repaying eBTC by multiple users for many CDPs with randomized collateral - function testRepayEbtcManyUsersManyCdps() public { + function testrepayDebtManyUsersManyCdps() public { for (uint256 userIx = 0; userIx < AMOUNT_OF_USERS; userIx++) { address user = _utils.getNextUserAddress(); vm.startPrank(user); @@ -156,7 +156,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { uint256 initialIcr = cdpManager.getICR(cdpIds[cdpIx], priceFeedMock.fetchPrice()); vm.prank(user); // Repay eBTC for each CDP - borrowerOperations.repayEBTC(cdpIds[cdpIx], randRepayAmnt, HINT, HINT); + borrowerOperations.repayDebt(cdpIds[cdpIx], randRepayAmnt, HINT, HINT); uint256 newIcr = cdpManager.getICR(cdpIds[cdpIx], priceFeedMock.fetchPrice()); // Make sure ICR for CDP increased assertGt(newIcr, initialIcr); @@ -170,7 +170,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { // -------- Withdraw eBTC Test cases -------- // Simple Happy case for borrowing and withdrawing eBTC from CDP - function testWithdrawEBTCHappy() public { + function testwithdrawDebtHappy() public { uint256 collAmount = 30 ether; address user = _utils.getNextUserAddress(); vm.startPrank(user); @@ -191,7 +191,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { // Get initial Debt after opened CDP uint256 initialDebt = cdpManager.getCdpDebt(cdpId); // Withdraw 1 eBTC - borrowerOperations.withdrawEBTC(cdpId, 1e17, "hint", "hint"); + borrowerOperations.withdrawDebt(cdpId, 1e17, "hint", "hint"); // Make sure ICR decreased assertLt(cdpManager.getICR(cdpId, priceFeedMock.fetchPrice()), initialIcr); // Make sure debt increased @@ -217,13 +217,13 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { borrowerOperations.openCdp(borrowedAmount, HINT, HINT, collAmount); bytes32 cdpId = sortedCdps.cdpOfOwnerByIndex(user, 0); vm.expectRevert(bytes("BorrowerOperations: Debt increase requires non-zero debtChange")); - borrowerOperations.withdrawEBTC(cdpId, 0, "hint", "hint"); + borrowerOperations.withdrawDebt(cdpId, 0, "hint", "hint"); vm.stopPrank(); } // Fuzz for borrowing and withdrawing eBTC from CDP // Handle scenarios when users try to withdraw too much eBTC resulting in either ICR < MCR or TCR < CCR - function testWithdrawEBTCFuzz(uint96 withdrawAmnt, uint96 collAmount) public { + function testwithdrawDebtFuzz(uint96 withdrawAmnt, uint96 collAmount) public { withdrawAmnt = uint96(bound(withdrawAmnt, 1e13, type(uint96).max)); collAmount = uint96(bound(collAmount, 30e18, type(uint96).max)); @@ -246,14 +246,14 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { uint256 initialDebt = cdpManager.getCdpDebt(cdpId); // Calculate projected ICR change - uint256 projectedIcr = LiquityMath._computeCR( + uint256 projectedIcr = EbtcMath._computeCR( collAmount, initialDebt + withdrawAmnt, priceFeedMock.fetchPrice() ); // Calculate projected TCR change with new debt added on top uint256 projectedSystemDebt = cdpManager.getSystemDebt() + withdrawAmnt; - uint256 projectedTcr = LiquityMath._computeCR( + uint256 projectedTcr = EbtcMath._computeCR( borrowerOperations.getSystemCollShares(), projectedSystemDebt, priceFeedMock.fetchPrice() @@ -261,11 +261,11 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { // Make sure tx is reverted if user tries to make withdraw resulting in either TCR < CCR or ICR < MCR if (projectedTcr <= CCR || projectedIcr <= MINIMAL_COLLATERAL_RATIO) { vm.expectRevert(); - borrowerOperations.withdrawEBTC(cdpId, withdrawAmnt, "hint", "hint"); + borrowerOperations.withdrawDebt(cdpId, withdrawAmnt, "hint", "hint"); return; } // Withdraw - borrowerOperations.withdrawEBTC(cdpId, withdrawAmnt, "hint", "hint"); + borrowerOperations.withdrawDebt(cdpId, withdrawAmnt, "hint", "hint"); // Make sure ICR decreased uint256 newIcr = cdpManager.getICR(cdpId, priceFeedMock.fetchPrice()); assertLt(newIcr, initialIcr); @@ -277,7 +277,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { } // Test case for multiple users with random amount of CDPs, withdrawing eBTC - function testWithdrawEBTCManyUsersManyCdps() public { + function testwithdrawDebtManyUsersManyCdps() public { for (uint256 userIx = 0; userIx < AMOUNT_OF_USERS; userIx++) { address user = _utils.getNextUserAddress(); vm.startPrank(user); @@ -323,7 +323,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { uint256 initialIcr = cdpManager.getICR(cdpIds[cdpIx], priceFeedMock.fetchPrice()); vm.prank(user); // Withdraw - borrowerOperations.withdrawEBTC(cdpIds[cdpIx], randCollWithdraw, "hint", "hint"); + borrowerOperations.withdrawDebt(cdpIds[cdpIx], randCollWithdraw, "hint", "hint"); uint256 newIcr = cdpManager.getICR(cdpIds[cdpIx], priceFeedMock.fetchPrice()); // Make sure ICR for CDP decreased assertGt(initialIcr, newIcr); @@ -334,7 +334,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { assertGt(initialTcr, newTcr); } - function testRepayEBTCMustImproveTCR() public { + function testrepayDebtMustImproveTCR() public { uint collAmount = 2000000000000000016 + borrowerOperations.LIQUIDATOR_REWARD(); uint borrowedAmount = 1; uint debtAmount = 28; @@ -346,7 +346,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { collateral.deposit{value: 10 ether}(); bytes32 _cdpId = borrowerOperations.openCdp(borrowedAmount, HINT, HINT, collAmount); - borrowerOperations.withdrawEBTC(_cdpId, debtAmount, _cdpId, _cdpId); + borrowerOperations.withdrawDebt(_cdpId, debtAmount, _cdpId, _cdpId); collateral.setEthPerShare(1.099408949270679030e18); uint256 _price = priceFeedMock.getPrice(); @@ -360,7 +360,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { emit log_named_uint("D", entireSystemDebt); emit log_named_uint("U", underlyingCollateral); - borrowerOperations.repayEBTC(_cdpId, repayAmount, HINT, HINT); + borrowerOperations.repayDebt(_cdpId, repayAmount, HINT, HINT); entireSystemColl = cdpManager.getSystemCollShares(); entireSystemDebt = activePool.getSystemDebt(); @@ -376,7 +376,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { // assertGt(tcrAfter, tcrBefore, "TCR must increase after a repayment"); } - function testRepayEBTCMustBurn() public { + function testrepayDebtMustBurn() public { uint collAmount = 2000000000000000033 + borrowerOperations.LIQUIDATOR_REWARD(); uint borrowedAmount = 2; uint repayAmount = 1; @@ -392,7 +392,7 @@ contract CDPOpsTest is eBTCBaseFixture, Properties { emit log_named_uint("eBTC balance before", userEbtcBefore); emit log_named_uint("Repay amount", repayAmount); - borrowerOperations.repayEBTC(_cdpId, repayAmount, _cdpId, _cdpId); + borrowerOperations.repayDebt(_cdpId, repayAmount, _cdpId, _cdpId); uint256 userEbtcAfter = eBTCToken.balanceOf((address(user))); emit log_named_uint("eBTC balance after", userEbtcAfter); diff --git a/packages/contracts/foundry_test/BorrowerOperations.openCloseCdp.t.sol b/packages/contracts/foundry_test/BorrowerOperations.openCloseCdp.t.sol index 201be7700..40fb0e018 100644 --- a/packages/contracts/foundry_test/BorrowerOperations.openCloseCdp.t.sol +++ b/packages/contracts/foundry_test/BorrowerOperations.openCloseCdp.t.sol @@ -130,7 +130,7 @@ contract OpenCloseCdpTest is eBTCBaseInvariants { assert(sortedCdps.getLast() == ""); vm.startPrank(user); - vm.expectRevert(bytes("BorrowerOperations: Cdp's net coll must be greater than minimum")); + vm.expectRevert(bytes("BorrowerOperations: Cdp's net coll must not fall below minimum")); borrowerOperations.openCdp(1, "hint", "hint", collPlusLiquidatorReward); vm.stopPrank(); } diff --git a/packages/contracts/foundry_test/CDPManager.governance.t.sol b/packages/contracts/foundry_test/CDPManager.governance.t.sol index be3f7f1b4..432cc3364 100644 --- a/packages/contracts/foundry_test/CDPManager.governance.t.sol +++ b/packages/contracts/foundry_test/CDPManager.governance.t.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; /* - * Test suite that tests opened CDPs with two different operations: repayEBTC and withdrawEBTC + * Test suite that tests opened CDPs with two different operations: repayDebt and withdrawDebt * Test include testing different metrics such as each CDP ICR, also TCR changes after operations are executed */ contract CDPManagerGovernanceTest is eBTCBaseFixture { @@ -239,7 +239,7 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { ); (bytes32 whaleCdpId, bytes32 toLiquidateCdpId, address whale) = _initSystemInRecoveryMode(); - uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriod(); + uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriodDuration(); address noPermissionsUser = _utils.getNextUserAddress(); vm.prank(noPermissionsUser); @@ -253,12 +253,12 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { ); (bytes32 whaleCdpId, bytes32 toLiquidateCdpId, address whale) = _initSystemInRecoveryMode(); - uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriod(); + uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriodDuration(); vm.prank(defaultGovernance); cdpManager.setGracePeriod(newGracePeriod); - assertEq(cdpManager.recoveryModeGracePeriod(), newGracePeriod); + assertEq(cdpManager.recoveryModeGracePeriodDuration(), newGracePeriod); } /// @dev Confirm extending the grace period works @@ -271,12 +271,12 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { (bytes32 whaleCdpId, bytes32 toLiquidateCdpId, address whale) = _initSystemInRecoveryMode(); - uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriod(); + uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriodDuration(); vm.prank(defaultGovernance); cdpManager.setGracePeriod(newGracePeriod); - assertEq(cdpManager.recoveryModeGracePeriod(), newGracePeriod); + assertEq(cdpManager.recoveryModeGracePeriodDuration(), newGracePeriod); _confirmGracePeriodNewDurationEnforced( oldGracePeriod, @@ -290,13 +290,13 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { newGracePeriod = uint128(bound(newGracePeriod, 0, cdpManager.MINIMUM_GRACE_PERIOD() - 1)); (bytes32 whaleCdpId, bytes32 toLiquidateCdpId, address whale) = _initSystemInRecoveryMode(); - uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriod(); + uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriodDuration(); vm.prank(defaultGovernance); vm.expectRevert("CdpManager: Grace period below minimum duration"); cdpManager.setGracePeriod(newGracePeriod); - assertEq(cdpManager.recoveryModeGracePeriod(), oldGracePeriod); + assertEq(cdpManager.recoveryModeGracePeriodDuration(), oldGracePeriod); } function test_CdpManagerSetGracePeriodInvalid_RevertsAndIsNotEnforcedForUnsetGracePeriod( @@ -305,13 +305,13 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { newGracePeriod = uint128(bound(newGracePeriod, 0, cdpManager.MINIMUM_GRACE_PERIOD() - 1)); (bytes32 whaleCdpId, bytes32 toLiquidateCdpId, address whale) = _initSystemInRecoveryMode(); - uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriod(); + uint256 oldGracePeriod = cdpManager.recoveryModeGracePeriodDuration(); vm.prank(defaultGovernance); vm.expectRevert("CdpManager: Grace period below minimum duration"); cdpManager.setGracePeriod(newGracePeriod); - assertEq(cdpManager.recoveryModeGracePeriod(), oldGracePeriod); + assertEq(cdpManager.recoveryModeGracePeriodDuration(), oldGracePeriod); } /// @dev Assumes newGracePeriod > oldGracePeriod @@ -324,7 +324,7 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { vm.startPrank(actor); cdpManager.syncGlobalAccountingAndGracePeriod(); uint256 startTimestamp = block.timestamp; - uint256 expectedGracePeriodExpiration = cdpManager.recoveryModeGracePeriod() + + uint256 expectedGracePeriodExpiration = cdpManager.recoveryModeGracePeriodDuration() + cdpManager.lastGracePeriodStartTimestamp(); assertEq(startTimestamp, cdpManager.lastGracePeriodStartTimestamp()); @@ -335,7 +335,7 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { console.log(1); - vm.expectRevert("CdpManager: Recovery mode grace period still in effect"); + vm.expectRevert("LiquidationLibrary: Recovery mode grace period still in effect"); cdpManager.liquidate(toLiquidateCdpId); // Attempt between previous duration and new duration, should fail @@ -344,7 +344,7 @@ contract CDPManagerGovernanceTest is eBTCBaseFixture { console.log(2); - vm.expectRevert("CdpManager: Recovery mode grace period still in effect"); + vm.expectRevert("LiquidationLibrary: Recovery mode grace period still in effect"); cdpManager.liquidate(toLiquidateCdpId); // Attempt after new duration, should succeed diff --git a/packages/contracts/foundry_test/CDPManager.redemptions.t.sol b/packages/contracts/foundry_test/CDPManager.redemptions.t.sol index 46cfb32a7..9173e93c9 100644 --- a/packages/contracts/foundry_test/CDPManager.redemptions.t.sol +++ b/packages/contracts/foundry_test/CDPManager.redemptions.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseInvariants} from "./BaseInvariants.sol"; contract CDPManagerRedemptionsTest is eBTCBaseInvariants { diff --git a/packages/contracts/foundry_test/CdpManager.Liquidation.t.sol b/packages/contracts/foundry_test/CdpManager.Liquidation.t.sol index ae4c8ef7e..7e1873127 100644 --- a/packages/contracts/foundry_test/CdpManager.Liquidation.t.sol +++ b/packages/contracts/foundry_test/CdpManager.Liquidation.t.sol @@ -667,10 +667,14 @@ contract CdpManagerLiquidationTest is eBTCBaseInvariants { vm.startPrank(users[0]); // Show it cannot be liquidated - vm.expectRevert("CdpManager: ICR is not below liquidation threshold in current mode"); + vm.expectRevert( + "LiquidationLibrary: ICR is not below liquidation threshold in current mode" + ); cdpManager.liquidate(safeCdpId); - vm.expectRevert("CdpManager: ICR is not below liquidation threshold in current mode"); + vm.expectRevert( + "LiquidationLibrary: ICR is not below liquidation threshold in current mode" + ); cdpManager.partiallyLiquidate(safeCdpId, 123, bytes32(0), bytes32(0)); } @@ -712,10 +716,14 @@ contract CdpManagerLiquidationTest is eBTCBaseInvariants { vm.startPrank(users[0]); // Show it cannot be liquidated - vm.expectRevert("CdpManager: ICR is not below liquidation threshold in current mode"); + vm.expectRevert( + "LiquidationLibrary: ICR is not below liquidation threshold in current mode" + ); cdpManager.liquidate(safeCdpId); - vm.expectRevert("CdpManager: ICR is not below liquidation threshold in current mode"); + vm.expectRevert( + "LiquidationLibrary: ICR is not below liquidation threshold in current mode" + ); cdpManager.partiallyLiquidate(safeCdpId, 123, bytes32(0), bytes32(0)); uint256 liquidationCheckpoint = vm.snapshot(); diff --git a/packages/contracts/foundry_test/CdpManager.StakingSplitFee.t.sol b/packages/contracts/foundry_test/CdpManager.StakingSplitFee.t.sol index b7baff72f..798afcef7 100644 --- a/packages/contracts/foundry_test/CdpManager.StakingSplitFee.t.sol +++ b/packages/contracts/foundry_test/CdpManager.StakingSplitFee.t.sol @@ -105,7 +105,7 @@ contract CdpManagerLiquidationTest is eBTCBaseInvariants { _targetCdpPrevFeeApplied[_cdpId] = _feeSplitDistributed / 1e18; vm.startPrank(_user); - borrowerOperations.withdrawEBTC(_cdpId, 1, _cdpId, _cdpId); + borrowerOperations.withdrawDebt(_cdpId, 1, _cdpId, _cdpId); vm.stopPrank(); } diff --git a/packages/contracts/foundry_test/EBTCDeployer.t.sol b/packages/contracts/foundry_test/EBTCDeployer.t.sol index d7433f4a0..c8450fa7b 100644 --- a/packages/contracts/foundry_test/EBTCDeployer.t.sol +++ b/packages/contracts/foundry_test/EBTCDeployer.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; import {WETH9} from "../contracts/TestContracts/WETH9.sol"; import {BorrowerOperations} from "../contracts/BorrowerOperations.sol"; diff --git a/packages/contracts/foundry_test/EBTCToken.erc20.t.sol b/packages/contracts/foundry_test/EBTCToken.erc20.t.sol index e9823bdc7..2cfdf435e 100644 --- a/packages/contracts/foundry_test/EBTCToken.erc20.t.sol +++ b/packages/contracts/foundry_test/EBTCToken.erc20.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {SigUtils} from "./utils/SigUtils.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; diff --git a/packages/contracts/foundry_test/EBTCToken.governance.t.sol b/packages/contracts/foundry_test/EBTCToken.governance.t.sol index 05bff00e3..765d4fee6 100644 --- a/packages/contracts/foundry_test/EBTCToken.governance.t.sol +++ b/packages/contracts/foundry_test/EBTCToken.governance.t.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; /* - * Test suite that tests opened CDPs with two different operations: repayEBTC and withdrawEBTC + * Test suite that tests opened CDPs with two different operations: repayDebt and withdrawDebt * Test include testing different metrics such as each CDP ICR, also TCR changes after operations are executed */ contract EBTCTokenGovernanceTest is eBTCBaseFixture { diff --git a/packages/contracts/foundry_test/EchidnaToFoundry.t.sol b/packages/contracts/foundry_test/EchidnaToFoundry.t.sol index ae44f819b..b47560787 100644 --- a/packages/contracts/foundry_test/EchidnaToFoundry.t.sol +++ b/packages/contracts/foundry_test/EchidnaToFoundry.t.sol @@ -88,46 +88,46 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { */ function testBrokenLiquidationLoc() public { setEthPerShare(645326474426547203313410069153905908525362434357); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setPrice(200); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); bytes32 randomCdp = openCdp( 15271506168544636618683946165347184908672584999956201311530805028234774281247, 525600000 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setEthPerShare( 34490286643335581993866445125615501807464041659106654042251963443032165120461 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setPrice(72100039377333553285200231852034304471788766724978643708968246258805481443120); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); openCdp(2, 999999999999999999); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setPrice(53613208255846312190970113690532613198662175001504036140235273976036627984403); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setEthPerShare( 53885036727293763953039497818137962919540408473654007727202467955943039934842 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); withdrawColl( 64613413140793438003392705322981884782961011222878036826703269533463170986176, 9999999999744 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setEthPerShare( 38654105012746982034204530442925091332196750429568734891400199507115192250853 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); partialLiquidate( 51745835282927565687010251523416875790034155913406312339604760725754223914917, 19 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); setEthPerShare( 79832022615203712424393490440177025697015516400034287083326403000335384151815 ); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); bytes32 cdpToTrack = _getRandomCdp(257); // Accrue here (will trigger recovery mode due to index change) // cdpManager.syncGlobalAccountingAndGracePeriod(); /// @audit: Issue with invariants is we need this to change @@ -331,9 +331,9 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { setPrice(115792089237316195423570985008687907853269984665640564039455484007913129639937); openCdp(115221720474780537866491969647886078644641607235938297017113192275671201037351, 13); setEthPerShare(10); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); liquidateCdps(81474231948216353665336502151292255308693665505215124358133307261506484044001); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); uint256 valueBeforeRedeem = _getValue(); _before(firstCdp); redeemCollateral( @@ -462,7 +462,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { ); setPrice(115792089237316195423570985008687907853269984665640564039456584970154295856934); setEthPerShare(2); - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); console.log("B4 Liquidation"); console.log("B4 Liquidation"); console.log("B4 Liquidation"); @@ -539,7 +539,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { _before(targetCdpId); // // Trigger RM // cdpManager.syncGlobalAccountingAndGracePeriod(); - // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); partialLiquidate(1, 73813787571110962545934699418512877744225252688696); _after(targetCdpId); @@ -571,7 +571,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { _before(targetCdpId); // // Trigger RM // cdpManager.syncGlobalAccountingAndGracePeriod(); - // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); partialLiquidate(1, 77); _after(targetCdpId); @@ -661,7 +661,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { * 9) EchidnaTester.setEthPerShare(12) (block=220143, time=2920424, gas=12500000, gasprice=1, value=0, sender=0x0000000000000000000000000000000000020000) * 10) EchidnaTester.setEthPerShare(12) (block=221483, time=3082487, gas=12500000, gasprice=1, value=0, sender=0x0000000000000000000000000000000000020000) * 11) EchidnaTester.liquidate(115792089237316195423570985008687907853269984665640564039457334248473421194186) (block=277923, time=3372993, gas=12500000, gasprice=1, value=0, sender=0x0000000000000000000000000000000000010000) - * 12) EchidnaTester.repayEBTC(9999999999993599, 48) + * 12) EchidnaTester.repayDebt(9999999999993599, 48) */ // GENERAL-09: @@ -693,7 +693,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { liquidate(115792089237316195423570985008687907853269984665640564039457334248473421194186); bytes32 cdpId = get_cdp(48); _before(cdpId); - repayEBTC(9999999999993599, 48); + repayDebt(9999999999993599, 48); _after(cdpId); console2.log("vars.isRecoveryModeBefore", vars.isRecoveryModeBefore); @@ -735,7 +735,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { bytes32 cdpId = get_cdp(1); _before(cdpId); - repayEBTC(1, 3664654876686139248533669277245093923727466555308247984199766471982047307); + repayDebt(1, 3664654876686139248533669277245093923727466555308247984199766471982047307); _after(cdpId); console2.log("vars.isRecoveryModeBefore", vars.isRecoveryModeBefore); @@ -761,7 +761,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { console2.log("tcr after sync", cdpManager.getTCR(currentPrice)); - repayEBTC( + repayDebt( 65721117470445406076343058077880221223501416620988368611416146266508, 158540941122585656115423420542823120113261891967556325033385077539052280 ); @@ -781,7 +781,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { // setPrice 71041372806687933 // tcr before sync 6458306618789813285695815385206145 // tcr after sync 6458306618789813285695815385206145 - // repayEBTC 1 0 + // repayDebt 1 0 // tcr after repay 6765845029208375823109901832120724 // tcr after sync 6765845029208375823109901832120724 @@ -817,7 +817,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { function testTcrMustIncreaseAfterRepayment() public { openCdp(13981380896748761892053706028661380888937876551972584966356379645, 23); setEthPerShare(55516200804822679866310029419499170992281118179349982013988952907); - repayEBTC(1, 509846657665200610349434642309205663062); + repayDebt(1, 509846657665200610349434642309205663062); } function testCDPM04Again() public { @@ -891,7 +891,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { // setEthPerShare(445556188509986934837462424); // openCdp(12181230440821352134148880356120823470441483581757, 1); // setEthPerShare(612268882000635712391494911936034158156169162782123690926313314401353750575); - // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + // vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); // bytes32 currentCdp = sortedCdps.getFirst(); // uint256 i = 0; // uint256 _price = priceFeedMock.getPrice(); @@ -925,7 +925,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { openCdp(4875031885513970860143576544506802817390763544834983767953988765, 2); setEthPerShare(165751067651587426758928329439401399262641793); openCdp(0, 1); - repayEBTC(365894549068404535662610420582951074074566619457568347292095201808, 22293884342); + repayDebt(365894549068404535662610420582951074074566619457568347292095201808, 22293884342); _before(bytes32(0)); console2.log( "CSP", @@ -1067,7 +1067,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { borrowerOperations.addColl(_cdpId, _cdpId, _cdpId, _coll); } - function withdrawEBTC(uint256 _amount, uint256 _i) internal { + function withdrawDebt(uint256 _amount, uint256 _i) internal { uint256 numberOfCdps = sortedCdps.cdpCountOf(user); _i = clampBetween(_i, 0, numberOfCdps - 1); @@ -1075,8 +1075,8 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { _amount = clampBetween(_amount, 0, type(uint128).max); - console2.log("withdrawEBTC", _amount, _i); - borrowerOperations.withdrawEBTC(_cdpId, _amount, _cdpId, _cdpId); + console2.log("withdrawDebt", _amount, _i); + borrowerOperations.withdrawDebt(_cdpId, _amount, _cdpId, _cdpId); } function withdrawColl(uint256 _amount, uint256 _i) internal { @@ -1104,7 +1104,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { return _cdpId; } - function repayEBTC(uint256 _amount, uint256 _i) internal { + function repayDebt(uint256 _amount, uint256 _i) internal { uint256 numberOfCdps = sortedCdps.cdpCountOf(user); _i = clampBetween(_i, 0, numberOfCdps - 1); @@ -1113,8 +1113,8 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { (uint256 entireDebt, , ) = cdpManager.getDebtAndCollShares(_cdpId); _amount = clampBetween(_amount, 0, entireDebt); - console2.log("repayEBTC", _amount, _i); - borrowerOperations.repayEBTC(_cdpId, _amount, _cdpId, _cdpId); + console2.log("repayDebt", _amount, _i); + borrowerOperations.repayDebt(_cdpId, _amount, _cdpId, _cdpId); } function redeemCollateral( @@ -1264,7 +1264,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { _allTargets[4] = address(borrowerOperations); _allCalldatas[4] = abi.encodeWithSelector( - borrowerOperations.withdrawEBTC.selector, + borrowerOperations.withdrawDebt.selector, _cdpId, _EBTCAmount, _cdpId, @@ -1273,7 +1273,7 @@ contract EToFoundry is eBTCBaseFixture, Properties, IERC3156FlashBorrower { _allTargets[5] = address(borrowerOperations); _allCalldatas[5] = abi.encodeWithSelector( - borrowerOperations.repayEBTC.selector, + borrowerOperations.repayDebt.selector, _cdpId, _EBTCAmount, _cdpId, diff --git a/packages/contracts/foundry_test/GracePeriod.Sync.t.sol b/packages/contracts/foundry_test/GracePeriod.Sync.t.sol index a25a09bea..5df0bd5ea 100644 --- a/packages/contracts/foundry_test/GracePeriod.Sync.t.sol +++ b/packages/contracts/foundry_test/GracePeriod.Sync.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; import "forge-std/console2.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; /* diff --git a/packages/contracts/foundry_test/GracePeriod.t.sol b/packages/contracts/foundry_test/GracePeriod.t.sol index b433476fe..f28b14707 100644 --- a/packages/contracts/foundry_test/GracePeriod.t.sol +++ b/packages/contracts/foundry_test/GracePeriod.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; import "forge-std/console2.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; /* @@ -197,7 +197,7 @@ contract GracePeriodBaseTests is eBTCBaseFixture { _assertSuccessOnAllLiquidationsDegen(cdp); // Grace Period Ended, liquidations work - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); _assertSuccessOnAllLiquidationsDegen(cdp); return degenSnapshot; } @@ -212,7 +212,7 @@ contract GracePeriodBaseTests is eBTCBaseFixture { _assertRevertOnAllLiquidations(cdps); // Grace Period Ended, liquidations work - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); _assertAllLiquidationSuccess(cdps); } @@ -360,9 +360,9 @@ contract GracePeriodBaseTests is eBTCBaseFixture { vm.prank(borrower); borrowerOperations.addColl(cdps[0], ZERO_ID, ZERO_ID, 1); } else if (action == 2) { - //adjustCdp: repayEBTC + //adjustCdp: repayDebt vm.prank(borrower); - borrowerOperations.repayEBTC(cdps[0], 1, ZERO_ID, ZERO_ID); + borrowerOperations.repayDebt(cdps[0], 1, ZERO_ID, ZERO_ID); } else if (action == 3) { uint256 toRedeem = 5e17; //redemption @@ -409,12 +409,12 @@ contract GracePeriodBaseTests is eBTCBaseFixture { vm.prank(borrower); borrowerOperations.addColl(cdps[0], ZERO_ID, ZERO_ID, coll); } else if (action == 2) { - //adjustCdp: withdrawEBTC (reduce debt) + //adjustCdp: withdrawDebt (reduce debt) debt = cdpManager.getCdpDebt(cdps[0]); console.log(debt); vm.prank(borrower); - borrowerOperations.repayEBTC(cdps[0], debt - 1, ZERO_ID, ZERO_ID); + borrowerOperations.repayDebt(cdps[0], debt - 1, ZERO_ID, ZERO_ID); } else if (action == 3) { //adjustCdp: adjustCdpWithColl (reduce debt + increase coll) debt = cdpManager.getCdpDebt(cdps[0]); @@ -472,7 +472,7 @@ contract GracePeriodBaseTests is eBTCBaseFixture { _assertRevertOnAllLiquidations(cdps); // Grace Period Ended - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); // Grace period timestamp hasn't changed assertEq( @@ -497,7 +497,7 @@ contract GracePeriodBaseTests is eBTCBaseFixture { _assertRevertOnAllLiquidations(cdps); // Grace Period Ended - vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriod() + 1); + vm.warp(block.timestamp + cdpManager.recoveryModeGracePeriodDuration() + 1); // Grace period timestamp hasn't changed assertEq( diff --git a/packages/contracts/foundry_test/NICRSorting.t.sol b/packages/contracts/foundry_test/NICRSorting.t.sol index cbf6a10e7..753d897e8 100644 --- a/packages/contracts/foundry_test/NICRSorting.t.sol +++ b/packages/contracts/foundry_test/NICRSorting.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseInvariants} from "./BaseInvariants.sol"; contract NICRSortingTest is eBTCBaseInvariants { diff --git a/packages/contracts/foundry_test/PositionManagers.t.sol b/packages/contracts/foundry_test/PositionManagers.t.sol index 88c42b03c..a4ad7b8c1 100644 --- a/packages/contracts/foundry_test/PositionManagers.t.sol +++ b/packages/contracts/foundry_test/PositionManagers.t.sol @@ -263,18 +263,18 @@ contract PositionManagersTest is eBTCBaseInvariants { /// @dev PositionManager should be able to increase debt of Cdp /// @dev eBTC should go to positionManager's account - function test_PositionManagerCanWithdrawEBTC() public { + function test_PositionManagerCanwithdrawDebt() public { (address user, address positionManager, bytes32 userCdpId) = _testPreconditions(); // FIXME? debt withdrawn to positionManager instead CDP owner? uint _balBefore = eBTCToken.balanceOf(positionManager); uint _debtChange = 1e17; vm.prank(positionManager); - borrowerOperations.withdrawEBTC(userCdpId, _debtChange, bytes32(0), bytes32(0)); + borrowerOperations.withdrawDebt(userCdpId, _debtChange, bytes32(0), bytes32(0)); assertEq( eBTCToken.balanceOf(positionManager), _balBefore + _debtChange, - "debt not sent to correct recipient after withdrawEBTC()" + "debt not sent to correct recipient after withdrawDebt()" ); assertTrue( borrowerOperations.getPositionManagerApproval(user, positionManager) == @@ -282,14 +282,14 @@ contract PositionManagersTest is eBTCBaseInvariants { ); } - function test_PositionManagerCanRepayEBTC() public { + function test_PositionManagerCanrepayDebt() public { (address user, address positionManager, bytes32 userCdpId) = _testPreconditions(); uint positionManagerBalanceBefore = eBTCToken.balanceOf(positionManager); uint userBalanceBefore = eBTCToken.balanceOf(user); vm.prank(positionManager); - borrowerOperations.repayEBTC(userCdpId, 1e17, bytes32(0), bytes32(0)); + borrowerOperations.repayDebt(userCdpId, 1e17, bytes32(0), bytes32(0)); assertEq( positionManagerBalanceBefore - eBTCToken.balanceOf(positionManager), diff --git a/packages/contracts/foundry_test/PriceFeed.governance.t.sol b/packages/contracts/foundry_test/PriceFeed.governance.t.sol index 131cd92b1..4a9ea7b52 100644 --- a/packages/contracts/foundry_test/PriceFeed.governance.t.sol +++ b/packages/contracts/foundry_test/PriceFeed.governance.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import "../contracts/Dependencies/LiquityMath.sol"; +import "../contracts/Dependencies/EbtcMath.sol"; import {eBTCBaseFixture} from "./BaseFixture.sol"; /* diff --git a/packages/contracts/foundry_test/SandwhichSniper.t.sol b/packages/contracts/foundry_test/SandwhichSniper.t.sol index ee7bff149..3ee6d2a20 100644 --- a/packages/contracts/foundry_test/SandwhichSniper.t.sol +++ b/packages/contracts/foundry_test/SandwhichSniper.t.sol @@ -95,7 +95,7 @@ contract SandWhichSniperTest is eBTCBaseFixture { // We can now liquidate victim /** SANDWHICH 3 */ vm.startPrank(users[0]); - vm.expectRevert("CdpManager: Recovery Mode grace period not started"); + vm.expectRevert("LiquidationLibrary: Recovery Mode grace period not started"); cdpManager.liquidate(cdpIdVictim); uint256 tcrEnd = cdpManager.getTCR(_newPrice); console.log("tcrEnd liquidation", tcrEnd); diff --git a/packages/contracts/gasTest/gasCalc.js b/packages/contracts/gasTest/gasCalc.js index 0a956fb74..70ee9c077 100644 --- a/packages/contracts/gasTest/gasCalc.js +++ b/packages/contracts/gasTest/gasCalc.js @@ -469,13 +469,13 @@ contract('Gas cost tests', async accounts => { th.appendData(gasResults, message, data) }) - // --- withdrawEBTC() --- + // --- withdrawDebt() --- // it("", async () => { - // const message = 'withdrawEBTC(), first withdrawal, 10 accounts, each account withdraws 100 EBTC' + // const message = 'withdrawDebt(), first withdrawal, 10 accounts, each account withdraws 100 EBTC' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // const gasResults = await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // const gasResults = await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) // th.logGasMetrics(gasResults, message) // th.logAllGasCosts(gasResults) @@ -483,11 +483,11 @@ contract('Gas cost tests', async accounts => { // }) // it("", async () => { - // const message = 'withdrawEBTC(), second withdrawal, 10 accounts, each account withdraws 100 EBTC' + // const message = 'withdrawDebt(), second withdrawal, 10 accounts, each account withdraws 100 EBTC' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) - // const gasResults = await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // const gasResults = await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) // th.logGasMetrics(gasResults, message) // th.logAllGasCosts(gasResults) @@ -495,7 +495,7 @@ contract('Gas cost tests', async accounts => { // }) it("", async () => { - const message = 'withdrawEBTC(), first withdrawal, 30 accounts, each account withdraws a random EBTC amount' + const message = 'withdrawDebt(), first withdrawal, 30 accounts, each account withdraws a random EBTC amount' await th.openCdp_allAccounts(_30_Accounts, contracts, dec(10, 'ether'), dec(1, 18)) let _allCdpIds = []; @@ -506,7 +506,7 @@ contract('Gas cost tests', async accounts => { _allCdpIds.push(_cdpId); } - const gasResults = await th.withdrawEBTC_allAccounts_randomAmount(1, 1.8, _30_Accounts, contracts, _allCdpIds) + const gasResults = await th.withdrawDebt_allAccounts_randomAmount(1, 1.8, _30_Accounts, contracts, _allCdpIds) th.logGasMetrics(gasResults, message) th.logAllGasCosts(gasResults) @@ -514,7 +514,7 @@ contract('Gas cost tests', async accounts => { }) it("", async () => { - const message = 'withdrawEBTC(), second withdrawal, 30 accounts, each account withdraws a random EBTC amount' + const message = 'withdrawDebt(), second withdrawal, 30 accounts, each account withdraws a random EBTC amount' await th.openCdp_allAccounts(_30_Accounts, contracts, dec(100, 'ether'), dec(1, 18)) let _allCdpIds = []; @@ -524,23 +524,23 @@ contract('Gas cost tests', async accounts => { assert.isTrue(await sortedCdps.contains(_cdpId)) _allCdpIds.push(_cdpId); } - await th.withdrawEBTC_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) + await th.withdrawDebt_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) - const gasResults = await th.withdrawEBTC_allAccounts_randomAmount(1, 1.5, _30_Accounts, contracts, _allCdpIds) + const gasResults = await th.withdrawDebt_allAccounts_randomAmount(1, 1.5, _30_Accounts, contracts, _allCdpIds) th.logGasMetrics(gasResults, message) th.logAllGasCosts(gasResults) th.appendData(gasResults, message, data) }) - // --- repayEBTC() --- + // --- repayDebt() --- // it("", async () => { - // const message = 'repayEBTC(), partial repayment, 10 accounts, repay 30 EBTC (of 100 EBTC)' + // const message = 'repayDebt(), partial repayment, 10 accounts, repay 30 EBTC (of 100 EBTC)' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) - // const gasResults = await th.repayEBTC_allAccounts(_10_Accounts, contracts, dec(30, 18)) + // const gasResults = await th.repayDebt_allAccounts(_10_Accounts, contracts, dec(30, 18)) // th.logGasMetrics(gasResults, message) // th.logAllGasCosts(gasResults) @@ -548,12 +548,12 @@ contract('Gas cost tests', async accounts => { // }) // it("", async () => { - // const message = 'repayEBTC(), second partial repayment, 10 accounts, repay 30 EBTC (of 70 EBTC)' + // const message = 'repayDebt(), second partial repayment, 10 accounts, repay 30 EBTC (of 70 EBTC)' // await th.openCdp_allAccounts(_30_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_30_Accounts, contracts, dec(100, 18)) - // await th.repayEBTC_allAccounts(_30_Accounts, contracts, dec(30, 18)) + // await th.withdrawDebt_allAccounts(_30_Accounts, contracts, dec(100, 18)) + // await th.repayDebt_allAccounts(_30_Accounts, contracts, dec(30, 18)) - // const gasResults = await th.repayEBTC_allAccounts(_30_Accounts, contracts, dec(30, 18)) + // const gasResults = await th.repayDebt_allAccounts(_30_Accounts, contracts, dec(30, 18)) // th.logGasMetrics(gasResults, message) // th.logAllGasCosts(gasResults) @@ -561,7 +561,7 @@ contract('Gas cost tests', async accounts => { // }) it("", async () => { - const message = 'repayEBTC(), partial repayment, 30 accounts, repay random amount of EBTC' + const message = 'repayDebt(), partial repayment, 30 accounts, repay random amount of EBTC' await th.openCdp_allAccounts(_30_Accounts, contracts, dec(100, 'ether'), dec(1, 18)) let _allCdpIds = []; @@ -571,9 +571,9 @@ contract('Gas cost tests', async accounts => { assert.isTrue(await sortedCdps.contains(_cdpId)) _allCdpIds.push(_cdpId); } - await th.withdrawEBTC_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) + await th.withdrawDebt_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) - const gasResults = await th.repayEBTC_allAccounts_randomAmount(1, 1.5, _30_Accounts, contracts, _allCdpIds) + const gasResults = await th.repayDebt_allAccounts_randomAmount(1, 1.5, _30_Accounts, contracts, _allCdpIds) th.logGasMetrics(gasResults, message) th.logAllGasCosts(gasResults) @@ -581,11 +581,11 @@ contract('Gas cost tests', async accounts => { }) // it("", async () => { - // const message = 'repayEBTC(), first repayment, 10 accounts, repay in full (100 of 100 EBTC)' + // const message = 'repayDebt(), first repayment, 10 accounts, repay in full (100 of 100 EBTC)' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) - // const gasResults = await th.repayEBTC_allAccounts(_10_Accounts, contracts, dec(100, 18)) + // const gasResults = await th.repayDebt_allAccounts(_10_Accounts, contracts, dec(100, 18)) // th.logGasMetrics(gasResults, message) // th.logAllGasCosts(gasResults) @@ -593,7 +593,7 @@ contract('Gas cost tests', async accounts => { // }) it("", async () => { - const message = 'repayEBTC(), first repayment, 30 accounts, repay in full' + const message = 'repayDebt(), first repayment, 30 accounts, repay in full' await th.openCdp_allAccounts(_30_Accounts, contracts, dec(100, 'ether'), dec(1, 18)) let _allCdpIds = []; @@ -604,9 +604,9 @@ contract('Gas cost tests', async accounts => { _allCdpIds.push(_cdpId); } - await th.withdrawEBTC_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) + await th.withdrawDebt_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) - const gasResults = await th.repayEBTC_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) + const gasResults = await th.repayDebt_allAccounts(_30_Accounts, contracts, dec(1, 18), _allCdpIds) th.logGasMetrics(gasResults, message) th.logAllGasCosts(gasResults) @@ -621,7 +621,7 @@ contract('Gas cost tests', async accounts => { await th.openCdp_allAccounts([accounts[1]], contracts, dec(200, 'ether'), dec(1, 18)) let _cdpId = await sortedCdps.cdpOfOwnerByIndex(accounts[1], 0); const randEBTCAmount = th.randAmountInWei(1, 10) - await borrowerOperations.withdrawEBTC(_cdpId, randEBTCAmount, accounts[1], accounts[1], { from: accounts[1] }) + await borrowerOperations.withdrawDebt(_cdpId, randEBTCAmount, accounts[1], accounts[1], { from: accounts[1] }) const price = await priceFeed.getPrice() const tx = await functionCaller.cdpManager_getICR(accounts[1], price) @@ -652,7 +652,7 @@ contract('Gas cost tests', async accounts => { assert.isTrue(await sortedCdps.contains(_cdpId)) _allCdpIds.push(_cdpId); } - await th.withdrawEBTC_allAccounts_randomAmount(1, 10, _10_Accounts, contracts, _allCdpIds) + await th.withdrawDebt_allAccounts_randomAmount(1, 10, _10_Accounts, contracts, _allCdpIds) const gasResults = await th.getICR_allAccounts(_10_Accounts, contracts, functionCaller) th.logGasMetrics(gasResults, message) @@ -910,7 +910,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'redeemCollateral(), EBTC, each redemption only hits the first Cdp, never closes it' // await th.addColl_allAccounts(_20_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts(_20_Accounts, cdpManager, dec(100, 18)) + // await th.withdrawDebt_allAccounts(_20_Accounts, cdpManager, dec(100, 18)) // const gasResults = await th.redeemCollateral_allAccounts_randomAmount( 1, 10, _10_Accounts, cdpManager) // th.logGasMetrics(gasResults, message) @@ -1076,11 +1076,11 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'redeemCollateral(), EBTC, each redemption only hits the first Cdp, never closes it, WITH pending rewards' // await th.addColl_allAccounts(_20_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts(_20_Accounts, cdpManager, dec(100, 18)) + // await th.withdrawDebt_allAccounts(_20_Accounts, cdpManager, dec(100, 18)) // // acct 999 adds coll, withdraws EBTC, sits at 111% ICR // await borrowerOperations.addColl(accounts[999], {from: accounts[999], value:dec(1, 'ether')}) - // await borrowerOperations.withdrawEBTC(_100pct, dec(130, 18), accounts[999], ZERO_ADDRESS, { from: accounts[999]}) + // await borrowerOperations.withdrawDebt(_100pct, dec(130, 18), accounts[999], ZERO_ADDRESS, { from: accounts[999]}) // // Price drops, account[999]'s ICR falls below MCR, and gets liquidated // await priceFeed.setPrice(dec(100, 18)) @@ -1099,7 +1099,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'getApproxHint(), numTrials = 10, 10 calls, each with random CR' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0 ) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) // gasCostList = [] @@ -1120,7 +1120,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'getApproxHint(), numTrials = 10: i.e. k = 1, list size = 1' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0 ) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 10) @@ -1133,7 +1133,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'getApproxHint(), numTrials = 32: i.e. k = 10, list size = 10' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0 ) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) // const CR = '200000000000000000000' @@ -1147,7 +1147,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'getApproxHint(), numTrials = 100: i.e. k = 10, list size = 100' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0 ) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, borrowerOperations) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 100) @@ -1162,7 +1162,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { //8mil. gas // const message = 'getApproxHint(), numTrials = 320: i.e. k = 10, list size = 1000' // await th.addColl_allAccounts(_10_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 320) @@ -1175,7 +1175,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // 25mil. gas // const message = 'getApproxHint(), numTrials = 1000: i.e. k = 10, list size = 10000' // await th.addColl_allAccounts(_10_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 1000) @@ -1188,7 +1188,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // 81mil. gas // const message = 'getApproxHint(), numTrials = 3200: i.e. k = 10, list size = 100000' // await th.addColl_allAccounts(_10_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 3200) @@ -1204,7 +1204,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'getApproxHint(), numTrials = 10000: i.e. k = 10, list size = 1000000' // await th.addColl_allAccounts(_10_Accounts, cdpManager, dec(10, 'ether')) - // await th.withdrawEBTC_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) + // await th.withdrawDebt_allAccounts_randomAmount(1, 180, _10_Accounts, cdpManager) // const CR = '200000000000000000000' // tx = await functionCaller.cdpManager_getApproxHint(CR, 10000) @@ -1221,7 +1221,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'provideToSP(), No pending rewards, part of issued EBTC: all accounts withdraw 180 EBTC, all make first deposit, provide 100 EBTC' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(130, 18)) + // await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(130, 18)) // // first funds provided // const gasResults = await th.provideToSP_allAccounts(_10_Accounts, stabilityPool, dec(100, 18)) @@ -1234,7 +1234,7 @@ contract('Gas cost tests', async accounts => { // it("", async () => { // const message = 'provideToSP(), No pending rewards, all issued EBTC: all accounts withdraw 180 EBTC, all make first deposit, 180 EBTC' // await th.openCdp_allAccounts(_10_Accounts, contracts, dec(10, 'ether'), 0) - // await th.withdrawEBTC_allAccounts(_10_Accounts, contracts, dec(130, 18)) + // await th.withdrawDebt_allAccounts(_10_Accounts, contracts, dec(130, 18)) // // first funds provided // const gasResults = await th.provideToSP_allAccounts(_10_Accounts, stabilityPool, dec(130, 18)) @@ -1255,7 +1255,7 @@ contract('Gas cost tests', async accounts => { // //1 acct open Cdp with 1 ether and withdraws 170 EBTC // await borrowerOperations.openCdp(0, accounts[1], ZERO_ADDRESS, { from: accounts[1], value: dec(1, 'ether') }) - // await borrowerOperations.withdrawEBTC(_100pct, dec(130, 18), accounts[1], ZERO_ADDRESS, { from: accounts[1] }) + // await borrowerOperations.withdrawDebt(_100pct, dec(130, 18), accounts[1], ZERO_ADDRESS, { from: accounts[1] }) // await th.fastForwardTime(timeValues.SECONDS_IN_ONE_HOUR, web3.currentProvider) diff --git a/packages/contracts/gasTest/gasCalc_Math.js b/packages/contracts/gasTest/gasCalc_Math.js index 278f7086f..c93a7df2e 100644 --- a/packages/contracts/gasTest/gasCalc_Math.js +++ b/packages/contracts/gasTest/gasCalc_Math.js @@ -2,7 +2,7 @@ const fs = require('fs') const deploymentHelper = require("../utils/deploymentHelpers.js") const testHelpers = require("../utils/testHelpers.js") const CdpManagerTester = artifacts.require("./CdpManagerTester.sol") -const LiquityMathTester = artifacts.require("./LiquityMathTester.sol") +const EbtcMathTester = artifacts.require("./EbtcMathTester.sol") const LiquidationLibrary = artifacts.require("./LiquidationLibrary.sol") const th = testHelpers.TestHelper @@ -23,8 +23,8 @@ contract('Gas costs for math functions', async accounts => { cdpManagerTester = await CdpManagerTester.new(liquidationLibrary.address) CdpManagerTester.setAsDeployed(cdpManagerTester) - mathTester = await LiquityMathTester.new() - LiquityMathTester.setAsDeployed(mathTester) + mathTester = await EbtcMathTester.new() + EbtcMathTester.setAsDeployed(mathTester) }) beforeEach(async () => { diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718892575000-55b4ea04-b2e9-4ae9-bf95-aa83f549bbcf.json b/packages/contracts/medusa/call_sequences/immutable/1694595718892575000-55b4ea04-b2e9-4ae9-bf95-aa83f549bbcf.json index 5383961e2..a12638fd8 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718892575000-55b4ea04-b2e9-4ae9-bf95-aa83f549bbcf.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718892575000-55b4ea04-b2e9-4ae9-bf95-aa83f549bbcf.json @@ -55,7 +55,7 @@ "gasTipCap": "0x0", "data": "0x98551a162613b07888ef023f7f1f0a287bc3dc0e6571793ce96611e8f1bcb1b0b49b741886678bf461ec935ae3e0dbd228062f82df0fba481533d501ca5150fce9c52aed", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "17222676297366341434425985865852592911743259466306281467976769414820427166744", "60792872889111674152246301947203767905059694383793307417896623081689994046189" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718894472000-f10b4826-bff7-487c-abf9-7cb8b6ade9e7.json b/packages/contracts/medusa/call_sequences/immutable/1694595718894472000-f10b4826-bff7-487c-abf9-7cb8b6ade9e7.json index 4d63cf8fa..195104b14 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718894472000-f10b4826-bff7-487c-abf9-7cb8b6ade9e7.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718894472000-f10b4826-bff7-487c-abf9-7cb8b6ade9e7.json @@ -55,7 +55,7 @@ "gasTipCap": "0x0", "data": "0x98551a162613b07888ef023f7f1f0a287bc3dc0e6571793ce96611e8f1bcb1b0b49b741886678bf461ec935ae3e0dbd228062f82df0fba481533d501ca5150fce9c52aed", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "17222676297366341434425985865852592911743259466306281467976769414820427166744", "60792872889111674152246301947203767905059694383793307417896623081689994046189" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718895956000-a936977d-04ef-4a37-a612-1c0e5604eeed.json b/packages/contracts/medusa/call_sequences/immutable/1694595718895956000-a936977d-04ef-4a37-a612-1c0e5604eeed.json index 597673e8c..4002897c6 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718895956000-a936977d-04ef-4a37-a612-1c0e5604eeed.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718895956000-a936977d-04ef-4a37-a612-1c0e5604eeed.json @@ -55,7 +55,7 @@ "gasTipCap": "0x0", "data": "0x98551a162613b07888ef023f7f1f0a287bc3dc0e6571793ce96611e8f1bcb1b0b49b741886678bf461ec935ae3e0dbd228062f82df0fba481533d501ca5150fce9c52aed", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "17222676297366341434425985865852592911743259466306281467976769414820427166744", "60792872889111674152246301947203767905059694383793307417896623081689994046189" @@ -103,7 +103,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f8de25dba91a974fc89bf6143d9fb54c71375b32baf5af030dce144b101c19fec0000000000000000000000000000000000000000000000000000000000000003", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "64176065979180800081083710231409799794628750237886731506114814800614465314796", "3" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718898241000-0e8fcd18-6932-40ac-b188-4de595b928f2.json b/packages/contracts/medusa/call_sequences/immutable/1694595718898241000-0e8fcd18-6932-40ac-b188-4de595b928f2.json index 0755a3667..d5668e58d 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718898241000-0e8fcd18-6932-40ac-b188-4de595b928f2.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718898241000-0e8fcd18-6932-40ac-b188-4de595b928f2.json @@ -55,7 +55,7 @@ "gasTipCap": "0x0", "data": "0x98551a162613b07888ef023f7f1f0a287bc3dc0e6571793ce96611e8f1bcb1b0b49b741886678bf461ec935ae3e0dbd228062f82df0fba481533d501ca5150fce9c52aed", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "17222676297366341434425985865852592911743259466306281467976769414820427166744", "60792872889111674152246301947203767905059694383793307417896623081689994046189" @@ -103,7 +103,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f8de25dba91a974fc89bf6143d9fb54c71375b32baf5af030dce144b101c19fec0000000000000000000000000000000000000000000000000000000000000003", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "64176065979180800081083710231409799794628750237886731506114814800614465314796", "3" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718940013000-63b53698-c951-4bc1-986b-c0e894999c65.json b/packages/contracts/medusa/call_sequences/immutable/1694595718940013000-63b53698-c951-4bc1-986b-c0e894999c65.json index 3dea88a52..76474b4b4 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718940013000-63b53698-c951-4bc1-986b-c0e894999c65.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718940013000-63b53698-c951-4bc1-986b-c0e894999c65.json @@ -76,7 +76,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fd2c2c214f39f5bc329d04c6a9bd2887b6a6c419004494301650aa4e49220da762cd89841d8d035ff65654d1a19b16eceaf521a4b949a80d3fe1cbea6db173972", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "95329806036699601968759839974972470833555450202078805545603852226059116272246", "20284455144330205642356090855213293814867946652316437381667763868678959348082" @@ -330,7 +330,7 @@ "gasTipCap": "0x0", "data": "0x98551a16f516a7d0680552753f7c1f7d6a1027ec08a535cb8d401c0c8f5f5f6442e180ab626af48ee56faa109bfe0c387a926babcfa07ce30fac88572d5f90663eafb8b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "110856676748588878117324606015565482727254289937725288804586772713508335354027", "44515632828610109259767915053225924215798231629363589440186439963781125617843" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595718949728000-0a14308b-7d3c-4cf0-934e-8a36a6b37093.json b/packages/contracts/medusa/call_sequences/immutable/1694595718949728000-0a14308b-7d3c-4cf0-934e-8a36a6b37093.json index cba18c42b..b4625e792 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595718949728000-0a14308b-7d3c-4cf0-934e-8a36a6b37093.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595718949728000-0a14308b-7d3c-4cf0-934e-8a36a6b37093.json @@ -190,7 +190,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffff2c3de43133125efffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640563039457584007913129639931", "115792089237316195423570985008687907853269984665640564039457584007913129574400" @@ -609,7 +609,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000008aeaa9f6f9a9000033e95795b8d9185baa1454a0192cecf910c405e40736155c1c88d92a26533579", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "10010000000000000000", "23480235132270942971476129785372794749866794499479382824522950910600490988921" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719031697000-c92db5ce-f92a-4d78-88f0-ba1599f83f37.json b/packages/contracts/medusa/call_sequences/immutable/1694595719031697000-c92db5ce-f92a-4d78-88f0-ba1599f83f37.json index 8457c9dfb..28b067cd4 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719031697000-c92db5ce-f92a-4d78-88f0-ba1599f83f37.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719031697000-c92db5ce-f92a-4d78-88f0-ba1599f83f37.json @@ -76,7 +76,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fd2c2c214f39f5bc329d04c6a9bd2887b6a6c419004494301650aa4e49220da762cd89841d8d035ff65654d1a19b16eceaf521a4b949a80d3fe1cbea6db173972", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "95329806036699601968759839974972470833555450202078805545603852226059116272246", "20284455144330205642356090855213293814867946652316437381667763868678959348082" @@ -330,7 +330,7 @@ "gasTipCap": "0x0", "data": "0x98551a16f516a7d0680552753f7c1f7d6a1027ec08a535cb8d401c0c8f5f5f6442e180ab626af48ee56faa109bfe0c387a926babcfa07ce30fac88572d5f90663eafb8b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "110856676748588878117324606015565482727254289937725288804586772713508335354027", "44515632828610109259767915053225924215798231629363589440186439963781125617843" @@ -935,7 +935,7 @@ "gasTipCap": "0x0", "data": "0x98551a163ca3877e0556bd43188eb6c67d79ccd378cbb5ace5fb757a4b26d606b1a254357c2abb238b3ea7b8abe550bb7899d334381af949111ab7fa88d4ae0226402e6d", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "27427702119827200673996965577578879945339812405902435977201729566030103204917", "56162292385874890866258247526276028690853718207089632446609637684098979868269" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719039545000-70891520-9789-4509-b1b4-e916bb38937b.json b/packages/contracts/medusa/call_sequences/immutable/1694595719039545000-70891520-9789-4509-b1b4-e916bb38937b.json index 40023bbd2..e54f1c099 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719039545000-70891520-9789-4509-b1b4-e916bb38937b.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719039545000-70891520-9789-4509-b1b4-e916bb38937b.json @@ -190,7 +190,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffff2c3de43133125efffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640563039457584007913129639931", "115792089237316195423570985008687907853269984665640564039457584007913129574400" @@ -609,7 +609,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000008aeaa9f6f9a9000033e95795b8d9185baa1454a0192cecf910c405e40736155c1c88d92a26533579", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "10010000000000000000", "23480235132270942971476129785372794749866794499479382824522950910600490988921" @@ -837,7 +837,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000034ee06989ed1452b2bed758c08473300a1257d554f63ff3b00cb55be8a3e0df6b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "52", "107662112392361079600741429989772811992945793345035049622396247239855168157363" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719055286000-30d512c3-48e2-4d99-9c5a-1435d0b0e5c0.json b/packages/contracts/medusa/call_sequences/immutable/1694595719055286000-30d512c3-48e2-4d99-9c5a-1435d0b0e5c0.json index c5fabb7c9..767d76b0f 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719055286000-30d512c3-48e2-4d99-9c5a-1435d0b0e5c0.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719055286000-30d512c3-48e2-4d99-9c5a-1435d0b0e5c0.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719141828000-e88a1b8f-09a1-4271-a58a-c374218fae0d.json b/packages/contracts/medusa/call_sequences/immutable/1694595719141828000-e88a1b8f-09a1-4271-a58a-c374218fae0d.json index d93e2d2d3..0896571d8 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719141828000-e88a1b8f-09a1-4271-a58a-c374218fae0d.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719141828000-e88a1b8f-09a1-4271-a58a-c374218fae0d.json @@ -250,7 +250,7 @@ "gasTipCap": "0x0", "data": "0x98551a163f65300f6bdda92a819a5f5e6619ed498dab0826b7c267127ee36501734e0cb7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe2fc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "28674492713871846413801953941558787706538060308794786021967026177018273074359", "115792089237316195423570985008687907853269984665640564039457584007913129632508" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a160ef047ad8cb9cde36710b77e8238ca0a1ba60588dff6342172e3fe46ae95424f0000000000000000000000000000000000000000000000000000000000000023", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "6756917878594093492518554731051160772413939856498668734271539827725342949967", "35" @@ -1566,7 +1566,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa13baf2025e6476b30f4e02eea812c621b3a30f9e79e5022f0b30eecf203f4da0000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "72927821271048080970267903194016584338548120675306443794234612030399221855450", "0" @@ -1613,7 +1613,7 @@ "gasTipCap": "0x0", "data": "0x98551a16b7f717237966be15cd94bd75ae4a8b090686118863e70d436853c329c6007544000000000000000000000000000000000000000000000000002386f26fc10010", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "83209822212287172648160387449092853871820916940507191456377183228725628532036", "10000000000000016" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719145189000-28dd5357-7e01-45c0-986e-93fc787965c7.json b/packages/contracts/medusa/call_sequences/immutable/1694595719145189000-28dd5357-7e01-45c0-986e-93fc787965c7.json index 33bc09af0..fe4dbddca 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719145189000-28dd5357-7e01-45c0-986e-93fc787965c7.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719145189000-28dd5357-7e01-45c0-986e-93fc787965c7.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719228651000-bfced43e-b858-496c-89e0-41b6adec043e.json b/packages/contracts/medusa/call_sequences/immutable/1694595719228651000-bfced43e-b858-496c-89e0-41b6adec043e.json index aadd2a24a..990711bb3 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719228651000-bfced43e-b858-496c-89e0-41b6adec043e.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719228651000-bfced43e-b858-496c-89e0-41b6adec043e.json @@ -208,7 +208,7 @@ "gasTipCap": "0x0", "data": "0x98551a16000000000000000000000000000000000000000000000000000000000010eb000000000000000000000000000000000000000000000000000e4b4b8af6a70008", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1108736", "1030000000000000008" @@ -408,7 +408,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fe724427eae410a0879012e785483b0550cd9a10f8627f108d3865672ef64f758de3ca241e4cbb5db7730ccde2931abd07160cfaabb00f61b66c59dce65b683e1", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "104548333447629820110243165627103376882509792896980436967071189841356607780696", "100520583068771558804887038843340722944597399665684362727926778979678355358689" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719265024000-d6793511-9968-4b04-a784-4d3bbcf2138a.json b/packages/contracts/medusa/call_sequences/immutable/1694595719265024000-d6793511-9968-4b04-a784-4d3bbcf2138a.json index 88e469377..2dfca90e5 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719265024000-d6793511-9968-4b04-a784-4d3bbcf2138a.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719265024000-d6793511-9968-4b04-a784-4d3bbcf2138a.json @@ -409,7 +409,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffe2db4d2053ae00000bcc9cf6876513c27189e910e605baa6dd85d0e35fc28282d69288467dab6afff", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039423984007913129639936", "85391383271463043840670514178553076993791938230668852583500750031943743483903" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719313876000-209d407e-35cb-4c58-bd89-88aa0fa9caec.json b/packages/contracts/medusa/call_sequences/immutable/1694595719313876000-209d407e-35cb-4c58-bd89-88aa0fa9caec.json index 864ad48e1..1bbe62d20 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719313876000-209d407e-35cb-4c58-bd89-88aa0fa9caec.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719313876000-209d407e-35cb-4c58-bd89-88aa0fa9caec.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719385073000-890bab8b-6d6f-4c94-ba9f-1358bc41fcc9.json b/packages/contracts/medusa/call_sequences/immutable/1694595719385073000-890bab8b-6d6f-4c94-ba9f-1358bc41fcc9.json index 6cfea5f77..b5c5680b9 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719385073000-890bab8b-6d6f-4c94-ba9f-1358bc41fcc9.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719385073000-890bab8b-6d6f-4c94-ba9f-1358bc41fcc9.json @@ -186,7 +186,7 @@ "gasTipCap": "0x0", "data": "0x98551a16701453696cc8433f9754e0e41fc1b5543af76cfda33536f30069d2d85ade1ba93f8e2d0d62fc26c600555539e0d1986ffffdd0558b1d712891c73b168cb26fd9", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "50694951669818697644102757533356312435122799277954222952931437366841786112937", "28746912683433558967798841226442834205919455761084628105357607430062725033945" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719555742000-2746654d-1634-4936-9155-2a86fff326f2.json b/packages/contracts/medusa/call_sequences/immutable/1694595719555742000-2746654d-1634-4936-9155-2a86fff326f2.json index a117845b9..0ab1b1779 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719555742000-2746654d-1634-4936-9155-2a86fff326f2.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719555742000-2746654d-1634-4936-9155-2a86fff326f2.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595719626082000-ef5645e3-4aac-4a55-9549-9765daa4b608.json b/packages/contracts/medusa/call_sequences/immutable/1694595719626082000-ef5645e3-4aac-4a55-9549-9765daa4b608.json index 749436e33..80e227f8d 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595719626082000-ef5645e3-4aac-4a55-9549-9765daa4b608.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595719626082000-ef5645e3-4aac-4a55-9549-9765daa4b608.json @@ -186,7 +186,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fc6c994f77a77c65906486887f7346eece6e3b9b98c247d817bb983104fe99adac7dfee1357dcdc2cb36903dfb465839e8f388d4bf6e402ef6ad28e5bb01870f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "89914108409970724014506151439906604036033993304564351646602949798018683607770", "90405906900638139754610629381398227699304427738138990529322280161326296232180" @@ -321,7 +321,7 @@ "gasTipCap": "0x0", "data": "0x98551a16db8ea8e87d5ee3ca5e11986cebb422fb37d542bec6c8d69dd4dbca6b2a73e3a7334aaf670d9278c0eb5cf3365000bfa492b58d77b36213522b01a47e8f634dfd", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "99308571884230829083107393345735283900200191096953973825949826774532753712039", "23199912544454696064180793917907735403418987784550057685641531444403137367549" @@ -783,7 +783,7 @@ "gasTipCap": "0x0", "data": "0x98551a16fe372c3638ac3f7cb3749c4d22e07d8ddad0a23821f07003fe3a556f1d5521571ed599a3678bae5f3778ea823a5a392f3fae6173199962714db426b084b6a9a4", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "114984945267357199645154268212332305960520766588598603232396954059155506012503", "13946784254862780745347576820268207709309031277100338119166900542015236647332" @@ -1058,7 +1058,7 @@ "gasTipCap": "0x0", "data": "0x98551a16c189d9794380fcb0b6d93eae82bd35ca1e214c70e33da73f5b4abb257d8d70240000000000000000000000000000000000000000000000000000000000000018", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "87539938772664837632041866904529678300392226494762365008278100805880944357412", "24" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000020", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "200", "32" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595720052373000-33d4beab-6514-47e1-90cd-c1ae1fdf4259.json b/packages/contracts/medusa/call_sequences/immutable/1694595720052373000-33d4beab-6514-47e1-90cd-c1ae1fdf4259.json index 40aa40ba1..8898916aa 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595720052373000-33d4beab-6514-47e1-90cd-c1ae1fdf4259.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595720052373000-33d4beab-6514-47e1-90cd-c1ae1fdf4259.json @@ -414,7 +414,7 @@ "gasTipCap": "0x0", "data": "0x98551a16d7f2974223b74656407a17630683764c4746f086fdb1c7b7d5df1a69cf8bc18fc97de4e1b73a88473f9036bc8412376e5584557403f26d6ba3edaacc95eaa925", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "97675883381894812984069745078051036343440322505366692202664030049888304349583", "91137318131785138643907490843073072038006792717682170870534179853879877478693" @@ -570,7 +570,7 @@ "gasTipCap": "0x0", "data": "0x98551a16c879642ef67cfef37901b0679cac2a004e49dcf59208c3ef15e6512130a11e4ed566321ad7939f2897d40752afc29d92f0e8c8d44f06974225a686a36ed9ea60", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "90677049652241932006160647012318842102864074951900873421179140745780319559246", "96523200959821959558418822454249699751662960458129016660794165544991122385504" @@ -680,7 +680,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f698614d102ad20c28622060a91a599bf203eaa5be189a7594bf60cc2f7bb5e78fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "47729750277760908823628003205970357231282532751157851008731956293859379207800", "115792089237316195423570985008687907853269984665640564039457584007913129639924" @@ -1005,7 +1005,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f03135a0d83c58d712cb0947c28b27f6beb0b5b75a4c85d758417b3a4470d4f252907fdd706251dea5e1368b30a795d1d1618111d67f5df4f6c56b8264f006327", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1391130161508284887782828929662338543872341314625859767149837350172852309797", "18558946660228784803157536668828260929310789294343126555621823515620695630631" @@ -1157,7 +1157,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd80000000000000000000000007109709ecfa91a80626ff3989d68f67f5b1dd12d", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639896", "645326474426547203313410069153905908525362434349" @@ -1273,7 +1273,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000bd35f76ce28599280f21d5f1a821bb76d1a67ddf714ed958c1e79d6f27f2829cc4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "189", "24409743695536319383870479280483548857521214606215380713600082706558508768452" @@ -1339,7 +1339,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f544d3f96aa83311a8ba8aca10a8b4ff3e1e7c2a48d0959aed258e7351e650d6e007618f1e6bdb60fbab49dcdcf8804491b9b91e4034de0a1edff1dce319be739", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "38130765376951218859351951874575236253191520085295016852541199351846761991534", "208660117203188843286085492940387873817323167971076673742800977020550113081" @@ -1582,7 +1582,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f9941efaef4480b6e95ffa0fc6622a2bdf05dfd74effa0d457dc71f50f68f7be2fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "69320365126583792051135398778932730949541442042478042490130183237605973261282", "115792089237316195423570985008687907853269984665640564039457584007913129443328" @@ -1695,7 +1695,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f99f8ca5fad1357f5fdf12df7605011782babe7694c32b8f4fd5957b997e1fb14fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "69643440637488765761085183694213329346939004137418267773029988140344487836436", "115792089237316195423570985008687907853269984665640564039457584007913129639927" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595720072899000-e2018438-530c-450b-af6e-fb2d3b029e6b.json b/packages/contracts/medusa/call_sequences/immutable/1694595720072899000-e2018438-530c-450b-af6e-fb2d3b029e6b.json index 44dadb6ba..b28800efd 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595720072899000-e2018438-530c-450b-af6e-fb2d3b029e6b.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595720072899000-e2018438-530c-450b-af6e-fb2d3b029e6b.json @@ -432,7 +432,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffffffffffdc790d903efff6858ca6a93935a77c5aa2c7c330bbc8bb91ac41ef3bd78b13f66df78181959a13", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457574007913129639926", "60406117702792830141569271320970494883004642146123385648802843262490728831507" @@ -718,7 +718,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffff8ef68f613056e57f9d900c6762970980a4e22ed38244c7be9fc45c74fbab6fb1b911d6bc6b84c8b030e44241bfca8ca4305b7194", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008042581378843437462327153970303678099387767205587", "58922194502967871374983192898902475840986719399678258599389554336450112876948" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595720930065000-a7ddae77-7143-430d-9ac9-49e593296bb7.json b/packages/contracts/medusa/call_sequences/immutable/1694595720930065000-a7ddae77-7143-430d-9ac9-49e593296bb7.json index fd48507de..2e64e272b 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595720930065000-a7ddae77-7143-430d-9ac9-49e593296bb7.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595720930065000-a7ddae77-7143-430d-9ac9-49e593296bb7.json @@ -482,7 +482,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000007ce66c50e28400008512c0f7f998eb82a4c7e04947fc3786042b00bbf4717205e8faa01e0928f386", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "9000000000000000000", "60190743929431519395192813824525360679588770563540161802315084007916391953286" @@ -618,7 +618,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f1725a6ad2dd0dd02cee57e0b8e4ba6461540fbf3f6e029a9c53ed8a9b971e6e0fffffffffffffffffffffffffffffffffffffffffffffffff16da6900a82fb00", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "10469719217601242316431283466199474388964377328842729803268209883363604031200", "115792089237316195423570985008687907853269984665640564039456534007912604039936" @@ -689,7 +689,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa744c0969f589a1329cdc502e3737d97958582b2e5c0cb7ff266e30e1412b1ab70a5f3e39c9fe63b53c904bcef1e91acc592c589bedc8c3d2b57fda22857c251", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "75657720509882103917910389614332795658456950474741377159114527781610740429227", "50952252067778928736991158910846054457203167457418186520910582312477268623953" @@ -1117,7 +1117,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000000139beb9a09974f3a2f3beeda2347c28bd18be22d3ae055416466e92e5e62813cea", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "19", "70524763718140884522355473718681068677903299978292706499533780078540970081514" @@ -1576,7 +1576,7 @@ "gasTipCap": "0x0", "data": "0x98551a160368cb62c50358e017f4276135f7148a17cb950d74534a4356c7dcf892020d53ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1542094357817821404937968404980496604295339591971658825907957853335058517331", "115792089237316195423570985008687907853269984665640564039457584007913129639888" @@ -1947,7 +1947,7 @@ "gasTipCap": "0x0", "data": "0x98551a16a3b3f541072972f05eab6768fb4908b575334cef65933c30b0a48ce9a1d768b300000000000000000000000000000000000000000000000000000000000000c8", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "74044952624673486315921951748549264352797274122316128015710894438320906397875", "200" @@ -2169,7 +2169,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000007109709ecfa91a80626ff3989d68f67f5b1dd12d", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "0", "645326474426547203313410069153905908525362434349" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595721631939000-0c57e9a0-0736-4a75-8b2d-841d79cd9be7.json b/packages/contracts/medusa/call_sequences/immutable/1694595721631939000-0c57e9a0-0736-4a75-8b2d-841d79cd9be7.json index 9f18135c7..209cc9f23 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595721631939000-0c57e9a0-0736-4a75-8b2d-841d79cd9be7.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595721631939000-0c57e9a0-0736-4a75-8b2d-841d79cd9be7.json @@ -97,7 +97,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f000000000000000000000000000000000000000000000000000000000000001438f0f63625faeac05d4ecab9249ebd46ce655ada1ca7ce47d5ff78e695a9c277", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "20", "25755262105647936550395383444544251272927225535435178940503090176846971126391" @@ -435,7 +435,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639919" @@ -985,7 +985,7 @@ "gasTipCap": "0x0", "data": "0x98551a163b9048559de3f8ee4937d4e198183ade9705ad7c6f9490d91d01450a1acc2974fbf4f144d5da45271779c2ac32386b1ce6364e130e410eb3d5f61f3c90d0ebbf", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "26941383277701052077855146540006290163837319286111741803054781507878494415220", "113963300854873048398123295350050377971758827978890615024860451441291736181695" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595722554721000-fa9d728e-125d-456e-9934-431cea610ef1.json b/packages/contracts/medusa/call_sequences/immutable/1694595722554721000-fa9d728e-125d-456e-9934-431cea610ef1.json index 1c26a29ab..d722454bb 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595722554721000-fa9d728e-125d-456e-9934-431cea610ef1.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595722554721000-fa9d728e-125d-456e-9934-431cea610ef1.json @@ -185,7 +185,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "246", "36" @@ -301,7 +301,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f45de87b6ae099b314e1b244f4db4a1fb16727f5ff806c606dbbda65a5e12ed830000000000000000000000000000000000000000000000000000000000000010", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "31602763261421582786927527902525825747226883651739563418109920848191128006019", "16" @@ -1394,7 +1394,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffc9ca36523a21600028bcd76a1562cca853c4d2912513d1e3275654b646c14bdfb6838bcef41e91df27", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564038457584007913129639976", "85415419814257869262329194527809074615774700079608112840064273344812337454887" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595722589485000-8a046182-5e26-4247-9af8-e930884c68be.json b/packages/contracts/medusa/call_sequences/immutable/1694595722589485000-8a046182-5e26-4247-9af8-e930884c68be.json index 711037f18..a6b2020f9 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595722589485000-8a046182-5e26-4247-9af8-e930884c68be.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595722589485000-8a046182-5e26-4247-9af8-e930884c68be.json @@ -185,7 +185,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "246", "36" @@ -301,7 +301,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f45de87b6ae099b314e1b244f4db4a1fb16727f5ff806c606dbbda65a5e12ed830000000000000000000000000000000000000000000000000000000000000010", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "31602763261421582786927527902525825747226883651739563418109920848191128006019", "16" @@ -1394,7 +1394,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffc9ca36523a21600028bcd76a1562cca853c4d2912513d1e3275654b646c14bdfb6838bcef41e91df27", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564038457584007913129639976", "85415419814257869262329194527809074615774700079608112840064273344812337454887" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595722663799000-76eebf0b-39a5-4c0d-9907-aad8b9bf4f19.json b/packages/contracts/medusa/call_sequences/immutable/1694595722663799000-76eebf0b-39a5-4c0d-9907-aad8b9bf4f19.json index dea230378..82f422b97 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595722663799000-76eebf0b-39a5-4c0d-9907-aad8b9bf4f19.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595722663799000-76eebf0b-39a5-4c0d-9907-aad8b9bf4f19.json @@ -185,7 +185,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "246", "36" @@ -301,7 +301,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f45de87b6ae099b314e1b244f4db4a1fb16727f5ff806c606dbbda65a5e12ed830000000000000000000000000000000000000000000000000000000000000010", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "31602763261421582786927527902525825747226883651739563418109920848191128006019", "16" @@ -1394,7 +1394,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffc9ca36523a21600028bcd76a1562cca853c4d2912513d1e3275654b646c14bdfb6838bcef41e91df27", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564038457584007913129639976", "85415419814257869262329194527809074615774700079608112840064273344812337454887" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595723297822000-540a6ef2-1423-4869-a773-5b28d200c3a9.json b/packages/contracts/medusa/call_sequences/immutable/1694595723297822000-540a6ef2-1423-4869-a773-5b28d200c3a9.json index 7654a136d..28b97f538 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595723297822000-540a6ef2-1423-4869-a773-5b28d200c3a9.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595723297822000-540a6ef2-1423-4869-a773-5b28d200c3a9.json @@ -99,7 +99,7 @@ "gasTipCap": "0x0", "data": "0x98551a160b884ad48223b2dda0ec96eb7774c7dd6718216b24ef75afe670bfd92ebafc80ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "5216248993669429986532006667499977079302153480430101965376448462733641972864", "115792089237316195423570985008687907853269984665640564039457584007913129639895" @@ -275,7 +275,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe17b5c", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639680", "115792089237316195423570985008687907853269984665640564039457584007913127639900" @@ -493,7 +493,7 @@ "gasTipCap": "0x0", "data": "0x98551a167b7601cfb4040be83371c8fba71f2e06fd1564a253da43a5fe6252e7b58ebed10000000000000000000000000000000000000000000000000000000000000003", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "55842980830798799150321044817357805777202455015975031973685767549017668894417", "3" @@ -1116,7 +1116,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f7496ffba7343f7a0aaed75d0a08405ca8308f806e8888ce79a07634fca3bb3fecf8813a4956eefa937ca53f0ab5e66dc3e2969cff4bf3e3080a5daede891f7c9", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "52735082467383044049971443223076541145973629565160792608111285037794384917502", "93869186427895013049850417606286523499052772376429432417442212849408550238153" @@ -1161,7 +1161,7 @@ "gasTipCap": "0x0", "data": "0x98551a164770199e065fa9d7cbece818595be61dd9d2c13195886e4ffc98d7f25f5ff44b77ee6e5971ede4645edca3292550fa5d0dfacd94a97a8a1b674ba7cca6a8116f", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "32312275924668563203669429424104666110603437011747655197176362080862721799243", "54246500186357508140768473712455727510869649586821508104332700218126577963375" diff --git a/packages/contracts/medusa/call_sequences/immutable/1694595723706320000-6ac0e668-a15b-4fd6-98ec-75c10d509e7f.json b/packages/contracts/medusa/call_sequences/immutable/1694595723706320000-6ac0e668-a15b-4fd6-98ec-75c10d509e7f.json index 376765469..7f2c899dd 100755 --- a/packages/contracts/medusa/call_sequences/immutable/1694595723706320000-6ac0e668-a15b-4fd6-98ec-75c10d509e7f.json +++ b/packages/contracts/medusa/call_sequences/immutable/1694595723706320000-6ac0e668-a15b-4fd6-98ec-75c10d509e7f.json @@ -942,7 +942,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000020000165ef7899f6b0093221f42493ae2d1091f374ec32e04d86fe8921c41993401bd", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "131072", "10118674734570051885866671376670619589198457555520815414168808085590499393981" @@ -1139,7 +1139,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000001913dbeb33c3318e47740167f36bb375df0e4b51767cb7005079cf350f490a9b6480", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "6419", "99472080151430378308661610225998751088982628347338185377826526620619007288448" @@ -1643,7 +1643,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0e4f707d44c2a5e41411477c2fb829bc7380bae03364d0023aa48634afce3afa0000000000000000000000000000000000000000000000000000000000127500", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "6472737171108705117178304956658039030115095742702003259477092688404945976058", "1209600" @@ -1793,7 +1793,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fad7de3dcdd4581ccb20fcbc52718c12bb9b81451c0f0cc264ee10b839d64b73074957c4d8bb53572aec6a07fbe818a4472b45a9afbb0f8b0d3b6ca080c229826", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "78472551338913981453170947164326501436100826533449107070130516417304018073392", "52732408555486729227662089361638036219825012078817798208177763936318110472230" @@ -1925,7 +1925,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fde3ca241e4cbb5db7730ccde2931abd07160cfaabb00f61b66c59dce65d508616802dd9b137f550bd02850f920fdbbee319efc6e754f2ba70fe9285da64f807d", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "100520583068771558804887038843340722944597399665684362727926778979678357358689", "47045599413576950257714493146249251618899086665250700479285773733847360307325" @@ -2012,7 +2012,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffd446f4034fdd14845b4bf4debc095c8f5c34566d5a65492fe8783cf10ec4ebb7d832b45012336752db2cf6e773d407c0bbe4e75ddc0855558949885cf51d32", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115714837667285999489398506643734942418428255352634083397343072749176801379563", "83155240205270090409218731674712711073687447714924269040846534770734639947058" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719033692000-2152e1d1-f6d7-4964-91bd-c8e966a75d08.json b/packages/contracts/medusa/call_sequences/mutable/1694595719033692000-2152e1d1-f6d7-4964-91bd-c8e966a75d08.json index 67e14b79f..16f487d60 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719033692000-2152e1d1-f6d7-4964-91bd-c8e966a75d08.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719033692000-2152e1d1-f6d7-4964-91bd-c8e966a75d08.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719058809000-b81349fe-d53d-4d29-84ba-519165b61805.json b/packages/contracts/medusa/call_sequences/mutable/1694595719058809000-b81349fe-d53d-4d29-84ba-519165b61805.json index 037e9ba97..95f8eaeb8 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719058809000-b81349fe-d53d-4d29-84ba-519165b61805.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719058809000-b81349fe-d53d-4d29-84ba-519165b61805.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719063299000-18683961-e4dd-4374-a4ff-509e851d8385.json b/packages/contracts/medusa/call_sequences/mutable/1694595719063299000-18683961-e4dd-4374-a4ff-509e851d8385.json index 79e946c48..628e89f43 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719063299000-18683961-e4dd-4374-a4ff-509e851d8385.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719063299000-18683961-e4dd-4374-a4ff-509e851d8385.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719070268000-27dedb13-afe6-44f0-8686-eafc25584897.json b/packages/contracts/medusa/call_sequences/mutable/1694595719070268000-27dedb13-afe6-44f0-8686-eafc25584897.json index d802fd2c5..7882b3934 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719070268000-27dedb13-afe6-44f0-8686-eafc25584897.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719070268000-27dedb13-afe6-44f0-8686-eafc25584897.json @@ -412,7 +412,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffaab0f06b9c5ee7da1362958210be94fc99f7f92e0a981221b091c737f2f4a7c0000000000000000000000000000000000000000000e0fe3d8bb9bc7b1000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "113380446701412780973026729863668434489088524792744580157103168523524159523452", "17000000000000000000000000" @@ -898,7 +898,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f3355e4812806615be84527189e498c06cceea88c63c419ae878dadef727bc06a0000000006bd926a82642e0ecb68f52a7617b5fb34b34f138ca26cb92bd60000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "23219714358468053159510248375195078934152975207515916273366576021261938049130", "709859121869201923644751076069296499377898677783900000000000000000" @@ -1159,7 +1159,7 @@ "gasTipCap": "0x0", "data": "0x98551a16e4d1e07cff0fa04d199aae41f88f5ec48fc769eace96416c42b27429c32a13cd138a5a28d3d4b7337a0f69d2df94c0781c4162a0493f0289e9ce84527e7e1bcd", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "103498149874599549298592303502359398859845541936405214773522694856652299572173", "8838391275898955929732900830555901506956879853182800691952488033228792142797" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719117084000-48f48656-9f4b-444a-b6be-5edba5623057.json b/packages/contracts/medusa/call_sequences/mutable/1694595719117084000-48f48656-9f4b-444a-b6be-5edba5623057.json index fa190d009..5a591ba28 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719117084000-48f48656-9f4b-444a-b6be-5edba5623057.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719117084000-48f48656-9f4b-444a-b6be-5edba5623057.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719120312000-a9d47103-5f6b-4e3c-853a-b9c6a6d4c0e1.json b/packages/contracts/medusa/call_sequences/mutable/1694595719120312000-a9d47103-5f6b-4e3c-853a-b9c6a6d4c0e1.json index a56206cce..82cc0eb82 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719120312000-a9d47103-5f6b-4e3c-853a-b9c6a6d4c0e1.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719120312000-a9d47103-5f6b-4e3c-853a-b9c6a6d4c0e1.json @@ -250,7 +250,7 @@ "gasTipCap": "0x0", "data": "0x98551a163f65300f6bdda92a819a5f5e6619ed498dab0826b7c267127ee36501734e0cb7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe2fc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "28674492713871846413801953941558787706538060308794786021967026177018273074359", "115792089237316195423570985008687907853269984665640564039457584007913129632508" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a160ef047ad8cb9cde36710b77e8238ca0a1ba60588dff6342172e3fe46ae95424f0000000000000000000000000000000000000000000000000000000000000023", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "6756917878594093492518554731051160772413939856498668734271539827725342949967", "35" @@ -1566,7 +1566,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa13baf2025e6476b30f4e02eea812c621b3a30f9e79e5022f0b30eecf203f4da0000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "72927821271048080970267903194016584338548120675306443794234612030399221855450", "0" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719152397000-b6387c56-5d3e-4a13-81f5-94232b122fe8.json b/packages/contracts/medusa/call_sequences/mutable/1694595719152397000-b6387c56-5d3e-4a13-81f5-94232b122fe8.json index b3b1f85c6..0ff5f3bd6 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719152397000-b6387c56-5d3e-4a13-81f5-94232b122fe8.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719152397000-b6387c56-5d3e-4a13-81f5-94232b122fe8.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719160378000-344cb836-65f3-4e94-b6da-ff4459aeb221.json b/packages/contracts/medusa/call_sequences/mutable/1694595719160378000-344cb836-65f3-4e94-b6da-ff4459aeb221.json index 70dd87adc..72e1116dc 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719160378000-344cb836-65f3-4e94-b6da-ff4459aeb221.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719160378000-344cb836-65f3-4e94-b6da-ff4459aeb221.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719171804000-1f43ea3a-a068-4a87-9850-b0c145b1976a.json b/packages/contracts/medusa/call_sequences/mutable/1694595719171804000-1f43ea3a-a068-4a87-9850-b0c145b1976a.json index 69b1ccf8f..162b5b05a 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719171804000-1f43ea3a-a068-4a87-9850-b0c145b1976a.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719171804000-1f43ea3a-a068-4a87-9850-b0c145b1976a.json @@ -250,7 +250,7 @@ "gasTipCap": "0x0", "data": "0x98551a163f65300f6bdda92a819a5f5e6619ed498dab0826b7c267127ee36501734e0cb7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe2fc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "28674492713871846413801953941558787706538060308794786021967026177018273074359", "115792089237316195423570985008687907853269984665640564039457584007913129632508" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a160ef047ad8cb9cde36710b77e8238ca0a1ba60588dff6342172e3fe46ae95424f0000000000000000000000000000000000000000000000000000000000000023", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "6756917878594093492518554731051160772413939856498668734271539827725342949967", "35" @@ -1566,7 +1566,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa13baf2025e6476b30f4e02eea812c621b3a30f9e79e5022f0b30eecf203f4da0000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "72927821271048080970267903194016584338548120675306443794234612030399221855450", "0" @@ -1613,7 +1613,7 @@ "gasTipCap": "0x0", "data": "0x98551a16b7f717237966be15cd94bd75ae4a8b090686118863e70d436853c329c6007544000000000000000000000000000000000000000000000000002386f26fc10010", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "83209822212287172648160387449092853871820916940507191456377183228725628532036", "10000000000000016" @@ -1637,7 +1637,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f64c7585021c39b91abdaf623301bec0eb798d0e46c05d23936a987e01ab8e584bbd91c88ac4241e180830888a205f94eb8394787e0320a1ddc97920529af4179", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "45583496938247562222606257926199105301482829715413975662570341883942939452804", "84966105431719151752263758436991689446685675083904804534245187542418201723257" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719183919000-f7821480-f417-4a84-b130-07b597833689.json b/packages/contracts/medusa/call_sequences/mutable/1694595719183919000-f7821480-f417-4a84-b130-07b597833689.json index f7ef53de4..bdc2b7ac7 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719183919000-f7821480-f417-4a84-b130-07b597833689.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719183919000-f7821480-f417-4a84-b130-07b597833689.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" @@ -1584,7 +1584,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fb3d7fb41197f772fb4e086a48b73c98f6e147f3663ce113fab6b83be8b6d5b28ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "81345606108746857532482685227184243836124496234502633106605428630302573288232", "115792089237316195423570985008687907853269984665640564039457584007913129639916" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719201743000-b10cdce5-e9dc-4747-b710-86857a8c2be3.json b/packages/contracts/medusa/call_sequences/mutable/1694595719201743000-b10cdce5-e9dc-4747-b710-86857a8c2be3.json index 4e0ed88df..66c4368d2 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719201743000-b10cdce5-e9dc-4747-b710-86857a8c2be3.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719201743000-b10cdce5-e9dc-4747-b710-86857a8c2be3.json @@ -250,7 +250,7 @@ "gasTipCap": "0x0", "data": "0x98551a163f65300f6bdda92a819a5f5e6619ed498dab0826b7c267127ee36501734e0cb7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe2fc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "28674492713871846413801953941558787706538060308794786021967026177018273074359", "115792089237316195423570985008687907853269984665640564039457584007913129632508" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a160ef047ad8cb9cde36710b77e8238ca0a1ba60588dff6342172e3fe46ae95424f0000000000000000000000000000000000000000000000000000000000000023", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "6756917878594093492518554731051160772413939856498668734271539827725342949967", "35" @@ -1566,7 +1566,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa13baf2025e6476b30f4e02eea812c621b3a30f9e79e5022f0b30eecf203f4da0000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "72927821271048080970267903194016584338548120675306443794234612030399221855450", "0" @@ -1613,7 +1613,7 @@ "gasTipCap": "0x0", "data": "0x98551a16b7f717237966be15cd94bd75ae4a8b090686118863e70d436853c329c6007544000000000000000000000000000000000000000000000000002386f26fc10010", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "83209822212287172648160387449092853871820916940507191456377183228725628532036", "10000000000000016" @@ -1637,7 +1637,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f64c7585021c39b91abdaf623301bec0eb798d0e46c05d23936a987e01ab8e584bbd91c88ac4241e180830888a205f94eb8394787e0320a1ddc97920529af4179", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "45583496938247562222606257926199105301482829715413975662570341883942939452804", "84966105431719151752263758436991689446685675083904804534245187542418201723257" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719206200000-bae60ab9-a0a7-4342-ac01-08ebb718bc57.json b/packages/contracts/medusa/call_sequences/mutable/1694595719206200000-bae60ab9-a0a7-4342-ac01-08ebb718bc57.json index 50f406640..f2d95558d 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719206200000-bae60ab9-a0a7-4342-ac01-08ebb718bc57.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719206200000-bae60ab9-a0a7-4342-ac01-08ebb718bc57.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" @@ -1584,7 +1584,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fb3d7fb41197f772fb4e086a48b73c98f6e147f3663ce113fab6b83be8b6d5b28ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "81345606108746857532482685227184243836124496234502633106605428630302573288232", "115792089237316195423570985008687907853269984665640564039457584007913129639916" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719219409000-21c87091-efd1-406e-8dbd-e8868055eea4.json b/packages/contracts/medusa/call_sequences/mutable/1694595719219409000-21c87091-efd1-406e-8dbd-e8868055eea4.json index 195e1d362..1c31b1e29 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719219409000-21c87091-efd1-406e-8dbd-e8868055eea4.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719219409000-21c87091-efd1-406e-8dbd-e8868055eea4.json @@ -273,7 +273,7 @@ "gasTipCap": "0x0", "data": "0x98551a160a7bf5b4e3aac6ceb4e2631db2ce69e02230542b3418c7cc39669a4d03aef6326d75ac62a5f2c99a4133214b7248bbf6b831c33cdea86886782dcab1c58d6dc7", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "4742146479421912555214695897602335168825644465621653950455767600530774226482", "49510011362077933770836842650062118056940276402767877606749816014373804404167" @@ -949,7 +949,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f93335be05eceda9465f84f2efcb13877f599b6db09071cc4e7bb8fd17a955703096b789bdb9d20b63a0e993270c0a7a9909679cb64ad96a1b96f87443256b2f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "66580732049973918220286789347577846039309824303960048311988475729956870379267", "4260700684662063389791358083782053908317247221479265657199378726967991251700" @@ -1015,7 +1015,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00a3d4c0c994e177b0333b7f5200ebd4f9d8dc39ed54661bdae67eb6976f7044535806a5afc020295b370c128ed4f9775aaeb73776102b58483ae7892caf8c51", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "289464439323172944524212703813509437269169822308190557530300471825539231812", "37697494851489575821591625182923340701769159439896374910002276875674661653585" @@ -1312,7 +1312,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa18ec87cb3744b62fb39ad802aeb57dae932f39408e610f38113bd9147adf571bb1a16bae89f774f106be15024b64ce1199e50c47b49cdef9574374312ff33c7", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "73074644616305904924846206933706645752218933264817769406956903431355834955121", "84628597586222814295982849954776538161918068087234385541681351724992437367751" @@ -1378,7 +1378,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639840" @@ -1584,7 +1584,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fb3d7fb41197f772fb4e086a48b73c98f6e147f3663ce113fab6b83be8b6d5b28ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "81345606108746857532482685227184243836124496234502633106605428630302573288232", "115792089237316195423570985008687907853269984665640564039457584007913129639916" @@ -1959,7 +1959,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffffffffe43e9298b1380000087c271f0d10dc5f94e1e367b05fe69ad284f28dbcd5060d0a19c4039c284760", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039455584007913129639936", "3837861829940518213777981094245151182801293183573063620023327345385266497376" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719224749000-1caaae8a-8309-4782-b2f7-c1a1fc56f045.json b/packages/contracts/medusa/call_sequences/mutable/1694595719224749000-1caaae8a-8309-4782-b2f7-c1a1fc56f045.json index edc86261b..cb345dc4d 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719224749000-1caaae8a-8309-4782-b2f7-c1a1fc56f045.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719224749000-1caaae8a-8309-4782-b2f7-c1a1fc56f045.json @@ -250,7 +250,7 @@ "gasTipCap": "0x0", "data": "0x98551a163f65300f6bdda92a819a5f5e6619ed498dab0826b7c267127ee36501734e0cb7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe2fc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "28674492713871846413801953941558787706538060308794786021967026177018273074359", "115792089237316195423570985008687907853269984665640564039457584007913129632508" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a160ef047ad8cb9cde36710b77e8238ca0a1ba60588dff6342172e3fe46ae95424f0000000000000000000000000000000000000000000000000000000000000023", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "6756917878594093492518554731051160772413939856498668734271539827725342949967", "35" @@ -1566,7 +1566,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fa13baf2025e6476b30f4e02eea812c621b3a30f9e79e5022f0b30eecf203f4da0000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "72927821271048080970267903194016584338548120675306443794234612030399221855450", "0" @@ -1613,7 +1613,7 @@ "gasTipCap": "0x0", "data": "0x98551a16b7f717237966be15cd94bd75ae4a8b090686118863e70d436853c329c6007544000000000000000000000000000000000000000000000000002386f26fc10010", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "83209822212287172648160387449092853871820916940507191456377183228725628532036", "10000000000000016" @@ -1637,7 +1637,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f64c7585021c39b91abdaf623301bec0eb798d0e46c05d23936a987e01ab8e584bbd91c88ac4241e180830888a205f94eb8394787e0320a1ddc97920529af4179", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "45583496938247562222606257926199105301482829715413975662570341883942939452804", "84966105431719151752263758436991689446685675083904804534245187542418201723257" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719247069000-7b49242b-6cfc-4dcd-87d4-12abe7007d9c.json b/packages/contracts/medusa/call_sequences/mutable/1694595719247069000-7b49242b-6cfc-4dcd-87d4-12abe7007d9c.json index c225eb82d..1833818e7 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719247069000-7b49242b-6cfc-4dcd-87d4-12abe7007d9c.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719247069000-7b49242b-6cfc-4dcd-87d4-12abe7007d9c.json @@ -409,7 +409,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffe2db4d2053ae00000bcc9cf6876513c27189e910e605baa6dd85d0e35fc28282d69288467dab6afff", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039423984007913129639936", "85391383271463043840670514178553076993791938230668852583500750031943743483903" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719410627000-adde6f73-f722-4ffd-94ee-346d1ba1d4e0.json b/packages/contracts/medusa/call_sequences/mutable/1694595719410627000-adde6f73-f722-4ffd-94ee-346d1ba1d4e0.json index f07fc362e..d3c93fbc1 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719410627000-adde6f73-f722-4ffd-94ee-346d1ba1d4e0.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719410627000-adde6f73-f722-4ffd-94ee-346d1ba1d4e0.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719444449000-bd75c5ca-5552-49b9-a3bf-0932381f0ef8.json b/packages/contracts/medusa/call_sequences/mutable/1694595719444449000-bd75c5ca-5552-49b9-a3bf-0932381f0ef8.json index 6b0b1bf50..abcc299be 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719444449000-bd75c5ca-5552-49b9-a3bf-0932381f0ef8.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719444449000-bd75c5ca-5552-49b9-a3bf-0932381f0ef8.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719451144000-4af3900a-1307-4a69-b44a-9279d38013ca.json b/packages/contracts/medusa/call_sequences/mutable/1694595719451144000-4af3900a-1307-4a69-b44a-9279d38013ca.json index 3dd8909fa..4550963ef 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719451144000-4af3900a-1307-4a69-b44a-9279d38013ca.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719451144000-4af3900a-1307-4a69-b44a-9279d38013ca.json @@ -593,7 +593,7 @@ "gasTipCap": "0x0", "data": "0x98551a16fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70000000000000000000000000000000000000000000000000000000000000028", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639927", "40" @@ -990,7 +990,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f3d12aeff374daf1ea929d01edb940adfd887a6cbffb6ba53191f0c0b0c981ed8fffffffffffff8cb535a09dd90f5259e8a0cbc33b2b26204749f2916c07bd746", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "27624094795220135701335183113281925372127014489435664548193145633893808348888", "115792089237316183844362061277068365496171483796849778712459117443856725694278" @@ -1268,7 +1268,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1b4b47509590040", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639935", "115792089237316195423570985008687907853269984665640564039456554007913129640000" @@ -1597,7 +1597,7 @@ "gasTipCap": "0x0", "data": "0x98551a167bf2a77afd6fe55b7999e5a78fe77738c23c3e3c44874fe04fef9f7043397869f998c962f1b04f03b9a5154888fb5d3ea8758cad90ee7249447275016d6ee948", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "56063213272861583300829262963071954155160101793196855422920411026347852920937", "112895849969622914871271566721481350152654939044225377938614528657084411472200" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719461937000-963e412c-3b74-4668-9e6b-d2eb47939bda.json b/packages/contracts/medusa/call_sequences/mutable/1694595719461937000-963e412c-3b74-4668-9e6b-d2eb47939bda.json index b7041270c..bbbebc716 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719461937000-963e412c-3b74-4668-9e6b-d2eb47939bda.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719461937000-963e412c-3b74-4668-9e6b-d2eb47939bda.json @@ -409,7 +409,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffe2db4d2053ae00000bcc9cf6876513c27189e910e605baa6dd85d0e35fc28282d69288467dab6afff", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039423984007913129639936", "85391383271463043840670514178553076993791938230668852583500750031943743483903" @@ -812,7 +812,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f840bb682a912e75d4fe3429aa9ea239815b40789cca05cb3592bb58ad6af93020000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "59725990971137461956008328610458051313899456193622467526686955641623158952706", "36" @@ -836,7 +836,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000001f8480253bfefb94be12f4d0dcc11263d5c3fe72597e6391759342d89b297b8ace3d7a", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "2065536", "16841579200585890398309135593898324873493913231017197964225863433532174384506" @@ -1053,7 +1053,7 @@ "gasTipCap": "0x0", "data": "0x98551a16cf1b3adb57cd94f5146f090bde976b3495ebc1e03b2b567d86e9d63f2dc2b15c0000000000000000000000000000000000000000000000000000000000000003", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "93676870742248333577815332638020895506902410515203984838986019557306032894300", "3" @@ -1166,7 +1166,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18c10974b279f02c47d78583c7e1347054e8971008f40caebf95313f551b8ecf12", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129638936", "87313086814441741594798473872430884579996550423045040924119553459523412741906" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719484707000-a83da3b0-5e29-4d68-990d-c8d233fd0946.json b/packages/contracts/medusa/call_sequences/mutable/1694595719484707000-a83da3b0-5e29-4d68-990d-c8d233fd0946.json index e3dc65bef..9903dfe28 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719484707000-a83da3b0-5e29-4d68-990d-c8d233fd0946.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719484707000-a83da3b0-5e29-4d68-990d-c8d233fd0946.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719533231000-d8e8b616-a0a4-4940-8815-2d9001581b1c.json b/packages/contracts/medusa/call_sequences/mutable/1694595719533231000-d8e8b616-a0a4-4940-8815-2d9001581b1c.json index a70d605ac..06e997e3f 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719533231000-d8e8b616-a0a4-4940-8815-2d9001581b1c.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719533231000-d8e8b616-a0a4-4940-8815-2d9001581b1c.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719645063000-aa7112c7-a645-4425-86a8-7090cbb2cf38.json b/packages/contracts/medusa/call_sequences/mutable/1694595719645063000-aa7112c7-a645-4425-86a8-7090cbb2cf38.json index 2aaeab229..c20e5af5a 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719645063000-aa7112c7-a645-4425-86a8-7090cbb2cf38.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719645063000-aa7112c7-a645-4425-86a8-7090cbb2cf38.json @@ -354,7 +354,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f765a78594ebdf78ef45ba654eeb1538e8f689925259659fe2efc3be3ca4f48370b0d71c5e00028abb3965724e4f6409f4c81fb211cd58e6791af32214fd4e4a8", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "53532762985944863313294088409044433672809387969177172742375121469747506399287", "4999195578294748719841612216704386908192464302864903721412205908284925076648" @@ -404,7 +404,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000008ac7230489e8000063da4b6966385c5bb49ca85ca6facf7ec65751c60980968501b9502fd59385b3", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "10000000000000000000", "45164665142400508803849738416678902797407422394760467755046416845852908946867" @@ -1578,7 +1578,7 @@ "gasTipCap": "0x0", "data": "0x98551a163708d663cc4597e56dc58f516fb70295dd89b58790e9ea20d97290119af2f49529624f21391ab2f39fd0a02e12ba1e9d6440077b4f3d049c31de9e29dab6f074", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "24892821112863148205525377998227582266104014863629937760119353212612050613397", "18718523937915624027072372601320034113575302091783214388057171791911109193844" @@ -2116,7 +2116,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fe3f4599ba256f8f74775929d07c5e424457e91e658ae48548dc84d22bc86d4eb00000000000000000000000000000000000000000000003635c9adc5dea00028", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "103106745763520363376809110027731931001449819615279491872094060608081256436971", "1000000000000000000040" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719694680000-2d8c5215-0490-4be6-a9ac-0bf47549a70a.json b/packages/contracts/medusa/call_sequences/mutable/1694595719694680000-2d8c5215-0490-4be6-a9ac-0bf47549a70a.json index d5a906e18..d7c90a2ba 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719694680000-2d8c5215-0490-4be6-a9ac-0bf47549a70a.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719694680000-2d8c5215-0490-4be6-a9ac-0bf47549a70a.json @@ -186,7 +186,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fc6c994f77a77c65906486887f7346eece6e3b9b98c247d817bb983104fe99adac7dfee1357dcdc2cb36903dfb465839e8f388d4bf6e402ef6ad28e5bb01870f4", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "89914108409970724014506151439906604036033993304564351646602949798018683607770", "90405906900638139754610629381398227699304427738138990529322280161326296232180" @@ -321,7 +321,7 @@ "gasTipCap": "0x0", "data": "0x98551a16db8ea8e87d5ee3ca5e11986cebb422fb37d542bec6c8d69dd4dbca6b2a73e3a7334aaf670d9278c0eb5cf3365000bfa492b58d77b36213522b01a47e8f634dfd", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "99308571884230829083107393345735283900200191096953973825949826774532753712039", "23199912544454696064180793917907735403418987784550057685641531444403137367549" @@ -783,7 +783,7 @@ "gasTipCap": "0x0", "data": "0x98551a16fe372c3638ac3f7cb3749c4d22e07d8ddad0a23821f07003fe3a556f1d5521571ed599a3678bae5f3778ea823a5a392f3fae6173199962714db426b084b6a9a4", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "114984945267357199645154268212332305960520766588598603232396954059155506012503", "13946784254862780745347576820268207709309031277100338119166900542015236647332" @@ -1058,7 +1058,7 @@ "gasTipCap": "0x0", "data": "0x98551a16c189d9794380fcb0b6d93eae82bd35ca1e214c70e33da73f5b4abb257d8d70240000000000000000000000000000000000000000000000000000000000000018", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "87539938772664837632041866904529678300392226494762365008278100805880944357412", "24" @@ -1106,7 +1106,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000020", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "200", "32" @@ -1240,7 +1240,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f444445f37e0212ec6672f57991ac3e7e8fe3a0b419162bb03a1c1c8398bcfe274a2def19cbec94630823b0cfb2168a7b00047a0b0040c4a4d35ea54470a84a07", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "30877902089102215121614226161740612656624380489755396232265170793429196406311", "33552309125928008084030688121132211164668333228606711566684222186271667669511" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719745462000-ffba8dd3-cd78-4cbf-86e2-c246381039c4.json b/packages/contracts/medusa/call_sequences/mutable/1694595719745462000-ffba8dd3-cd78-4cbf-86e2-c246381039c4.json index b1f05d25e..bb6beefcc 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719745462000-ffba8dd3-cd78-4cbf-86e2-c246381039c4.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719745462000-ffba8dd3-cd78-4cbf-86e2-c246381039c4.json @@ -423,7 +423,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000000e92596fd629000000000000000000000001357c299a88ea76a58924d52ce4f26a85af186c2b9e74", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "1050000000000000000", "115792089237316195423570985008687907853269984665640564" @@ -534,7 +534,7 @@ "gasTipCap": "0x0", "data": "0x98551a16655e585fc2bea17fa6e96c87ca0e724b0921ec962a28d5171a73a338eb1e8d17f3460db28669159b2c0fa6a0eb0fb6ea65975264f1a399883aca40d338682368", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "45850291266381529870093208223009515381922096044777270908387055675086764674327", "110035796035996310605878140872176215636537049621332330052659847400365085959016" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719836404000-d3255efc-17c7-42c7-b29b-8e04ab1d156e.json b/packages/contracts/medusa/call_sequences/mutable/1694595719836404000-d3255efc-17c7-42c7-b29b-8e04ab1d156e.json index f3386d808..1e76f7c97 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719836404000-d3255efc-17c7-42c7-b29b-8e04ab1d156e.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719836404000-d3255efc-17c7-42c7-b29b-8e04ab1d156e.json @@ -255,7 +255,7 @@ "gasTipCap": "0x0", "data": "0x98551a165e98810c7dcb6607a70062ea18f7ff259e2e97875be4cf75a1deb487f534719ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa00", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "42786859182719160684294180099575580144909446002517748832462365526975101301151", "115792089237316195423570985008687907853269984665640564039457584007913129638400" @@ -279,7 +279,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000008ac7230489e80012", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "131072", "10000000000000000018" @@ -303,7 +303,7 @@ "gasTipCap": "0x0", "data": "0x98551a1673638c2f7cdb8daea21f15a897da2b377f6420a72f6d73398ec3d3492f235b650000000000000000000000000000000000000000000000000000000000000000", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "52191862971243781962440911501343434108731079786509633650589635399931020925797", "0" @@ -738,7 +738,7 @@ "gasTipCap": "0x0", "data": "0x98551a1668a0ef4c239e4520cde0b2075e315b980a036a19738f1b2423ba5c1ce0f5a7c34dcb009950ebc7c3439d40aa6775c52457b07fc8d495103fbce4b455f1b1ddec", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "47324883353108114254806967057124714543526819991503570915985704836100871530435", "35186763428455341730289997068217895185731861045884789835280919073798793321964" @@ -827,7 +827,7 @@ "gasTipCap": "0x0", "data": "0x98551a16e46f685a95de91fc067062cabb36cf1baf9c63ee3d9f7941741801dbeff27b742bd16513972f74f0586eb7854ba7fef9da2d7061b8f7b5ca4dbf6ad9ffb86e52", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "103324169724973495021443415908103457722105126298826391400799045359633565907828", "19819421130160828181727103264527951566722677147621155338453735198340576472658" @@ -960,7 +960,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f56ca2acf7e632adc242e13370c5f3d412db90155546199605a66f41a043576e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "39256103552611812199822490208882777254145870753707935696562448225335145494245", "115792089237316195423570985008687907853269984665640564039457584007913129574436" @@ -1356,7 +1356,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000001bc16d674ec80000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "2000000000000000000", "115792089237316195423570985008687907853269984665640564039457584007913129639917" @@ -1650,7 +1650,7 @@ "gasTipCap": "0x0", "data": "0x96038a9fffffffffffffffffffffffffffffffffffffffffffffffffeea71b9f6ec2fffcfffffffffffffffffffffffffffffffffffffffffffffffff222b47393828f28", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039456334007913129639932", "115792089237316195423570985008687907853269984665640564039456584970154295856936" @@ -1716,7 +1716,7 @@ "gasTipCap": "0x0", "data": "0x98551a16856a55ca0dcd4d86e1a24df1485a1aeeeb1587f267f895ea69c9ad50de51307125883ade93a264db47199d1c03d53ed9ac9fa1c4cd0d75f7c15f103710fd94bd", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "60345486746243158836086638664382489157344568854595335732774107374138602631281", "16976272900334702478860517497391178932968814334109041759249980537774389695677" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595719963895000-44f0d91c-526b-408a-b98a-aba41e93add8.json b/packages/contracts/medusa/call_sequences/mutable/1694595719963895000-44f0d91c-526b-408a-b98a-aba41e93add8.json index ebb9784a3..cc9296057 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595719963895000-44f0d91c-526b-408a-b98a-aba41e93add8.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595719963895000-44f0d91c-526b-408a-b98a-aba41e93add8.json @@ -372,7 +372,7 @@ "gasTipCap": "0x0", "data": "0x98551a166f51ac603519badf9e1ed4cbfc6e8c105e078034440d12c0f6854eeecba817740000000000000000000000000000000000000000000000000000000000000100", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "50351030499108282419631897314077809246738681009121017529612797525304581560180", "256" @@ -663,7 +663,7 @@ "gasTipCap": "0x0", "data": "0x98551a16aaf1477e752885c10a36770ef8e6116f7816b1ded0e3eee4887557069d6dd0120000000000000000000000000000000000000000000000000de0b6b3a7640000", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "77319487835048986943189544209191800801381004826870116500687017915982346571794", "1000000000000000000" @@ -732,7 +732,7 @@ "gasTipCap": "0x0", "data": "0x98551a160008d2a527037248833d58a45343f6a030868c5692f48ed1d16787c9f5cb5ca33a415fb2984cef484926aec887ba96846c39c21da72b50902d8d367ac3a17f73", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "15588595750850322485671915052327397395432146562417954232560256328475040931", "26349650757852614795596763383361149992044399756205276157310296796130822946675" @@ -804,7 +804,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd7717d1f28d8171f0796523931bbd87ffc2b83cbbd26b1cdc99d2cff5d655355dc", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639895", "51332422828297983635204442727737290395443045614675583004806683979915736602076" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595721661156000-7b088acc-ebb2-4815-b3bf-0eca0a8028c4.json b/packages/contracts/medusa/call_sequences/mutable/1694595721661156000-7b088acc-ebb2-4815-b3bf-0eca0a8028c4.json index e55ddab6e..273cc2617 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595721661156000-7b088acc-ebb2-4815-b3bf-0eca0a8028c4.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595721661156000-7b088acc-ebb2-4815-b3bf-0eca0a8028c4.json @@ -97,7 +97,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f000000000000000000000000000000000000000000000000000000000000001438f0f63625faeac05d4ecab9249ebd46ce655ada1ca7ce47d5ff78e695a9c277", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "20", "25755262105647936550395383444544251272927225535435178940503090176846971126391" @@ -435,7 +435,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639919" @@ -985,7 +985,7 @@ "gasTipCap": "0x0", "data": "0x98551a163b9048559de3f8ee4937d4e198183ade9705ad7c6f9490d91d01450a1acc2974fbf4f144d5da45271779c2ac32386b1ce6364e130e410eb3d5f61f3c90d0ebbf", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "26941383277701052077855146540006290163837319286111741803054781507878494415220", "113963300854873048398123295350050377971758827978890615024860451441291736181695" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595721696902000-bf6b0478-2500-47e1-b41d-3b16d5581b8a.json b/packages/contracts/medusa/call_sequences/mutable/1694595721696902000-bf6b0478-2500-47e1-b41d-3b16d5581b8a.json index 4a8d47b07..2f038f1ff 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595721696902000-bf6b0478-2500-47e1-b41d-3b16d5581b8a.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595721696902000-bf6b0478-2500-47e1-b41d-3b16d5581b8a.json @@ -97,7 +97,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f000000000000000000000000000000000000000000000000000000000000001438f0f63625faeac05d4ecab9249ebd46ce655ada1ca7ce47d5ff78e695a9c277", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "20", "25755262105647936550395383444544251272927225535435178940503090176846971126391" @@ -435,7 +435,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639919" @@ -985,7 +985,7 @@ "gasTipCap": "0x0", "data": "0x98551a163b9048559de3f8ee4937d4e198183ade9705ad7c6f9490d91d01450a1acc2974fbf4f144d5da45271779c2ac32386b1ce6364e130e410eb3d5f61f3c90d0ebbf", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "26941383277701052077855146540006290163837319286111741803054781507878494415220", "113963300854873048398123295350050377971758827978890615024860451441291736181695" @@ -1032,7 +1032,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffff3be98b2b5d57db68e29e527294940c2e5ffcd50d1c168ddded80000d34b81e086392e08f3745e3f0450f0064feba6a3688ec29b19a1fbd0f961473c", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089236025542474717890602061087714962172848589839170759584007913129639936", "95571420959369745694826866719103162119721698779245449771307988634382398211900" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595721875418000-872f7d51-0648-4788-a8ec-e18ccdd21abc.json b/packages/contracts/medusa/call_sequences/mutable/1694595721875418000-872f7d51-0648-4788-a8ec-e18ccdd21abc.json index 7adabaa3a..069026a12 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595721875418000-872f7d51-0648-4788-a8ec-e18ccdd21abc.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595721875418000-872f7d51-0648-4788-a8ec-e18ccdd21abc.json @@ -32,7 +32,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000000005973e5323cc4fb82b4a4ba094ba9fec039be887a8ea9015514eb0898e075493b", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "0", "40460612790670742545091111508158720848650665504597506332399609821554328029499" @@ -620,7 +620,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564039457584007913129639934", "63076024560530113402979550242307453568063438748328787417531900361828837441551" @@ -1351,7 +1351,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f6d05df6903f7558c9a9a067dc0899b11ec1f9256c7fdc01173d58c49bd3d82750000000000000000000000000000000000000000000000000000000000010000", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "49312476651547346854621109051261335078308431927824191669499443504894523048565", "65536" @@ -1776,7 +1776,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000000f3333333333333333333333333333333333333333333333333e4d5ef61f83334", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "0", "110002484775450385652392435758253512460606485432358535837484754807517473157940" @@ -1972,7 +1972,7 @@ "gasTipCap": "0x0", "data": "0x98551a162d911bccb6665b1d0ddfc8415c2585f4f0a4b41be6e226f343efe96ba10e455c8744607a5b85064bdf90ce1188e8f0de6f51609923eaca0758a62ca6feecc4c8", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "20610462876829280512169213977578777866201943283775048269025904295168225199452", "61183046025546819537574417989074081424730120420759334959490332898374160532680" @@ -2043,7 +2043,7 @@ "gasTipCap": "0x0", "data": "0x98551a1652fb03b95ca710c730a893b4bba944b065964f297bf0b2e4f8229e387d8cc9a898bea77f49ddfb0ce6383ea6c74bf01c90e0db057ff0ad90479cbb85e025a4c9", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "37533157899673849718018191182144866462492192591568040438540403847781252123048", "69088409950296639648665826260446468146125729639412788020992814121767506650313" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595721901530000-40d5c2c5-38ef-430a-9e11-aa31b1c960f4.json b/packages/contracts/medusa/call_sequences/mutable/1694595721901530000-40d5c2c5-38ef-430a-9e11-aa31b1c960f4.json index 899e97027..ed243ed32 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595721901530000-40d5c2c5-38ef-430a-9e11-aa31b1c960f4.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595721901530000-40d5c2c5-38ef-430a-9e11-aa31b1c960f4.json @@ -97,7 +97,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f000000000000000000000000000000000000000000000000000000000000001438f0f63625faeac05d4ecab9249ebd46ce655ada1ca7ce47d5ff78e695a9c277", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "20", "25755262105647936550395383444544251272927225535435178940503090176846971126391" @@ -435,7 +435,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639919" @@ -985,7 +985,7 @@ "gasTipCap": "0x0", "data": "0x98551a163b9048559de3f8ee4937d4e198183ade9705ad7c6f9490d91d01450a1acc2974fbf4f144d5da45271779c2ac32386b1ce6364e130e410eb3d5f61f3c90d0ebbf", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "26941383277701052077855146540006290163837319286111741803054781507878494415220", "113963300854873048398123295350050377971758827978890615024860451441291736181695" @@ -1032,7 +1032,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffff3be98b2b5d57db68e29e527294940c2e5ffcd50d1c168ddded80000d34b81e086392e08f3745e3f0450f0064feba6a3688ec29b19a1fbd0f961473c", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089236025542474717890602061087714962172848589839170759584007913129639936", "95571420959369745694826866719103162119721698779245449771307988634382398211900" @@ -1103,7 +1103,7 @@ "gasTipCap": "0x0", "data": "0x96038a9faf7eb817296ef0e775a1f002ecac933af0b6c183f949101bdc3bfe1bbf41a281fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "79378641778003719650823469831375328731192734612333880580637028101900703212161", "115792089237316195423570985008687907853269984665640564039457584007913129639933" @@ -1479,7 +1479,7 @@ "gasTipCap": "0x0", "data": "0x98551a1600000000000000000000000000000000000000000000000000000000000016dc6ba696a5ac271821c300b047100c2fe838807e7e69504dfbdd4be7752fb0d244", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "5852", "48691811139635730633944783254167746000330893894611907451103385028910247891524" @@ -1727,7 +1727,7 @@ "gasTipCap": "0x0", "data": "0x98551a16004084ddc938ca9e41d98d4e8397155a091be30116b34e15a96704d951bb102bfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "113995222002939675868805669619608780996758604094178834289818640591961657387", "115792089237316195423570985008687907853269984665640564039457584007913129639922" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595722121674000-8d3ee9da-76ba-4629-ae57-d232b2ced34a.json b/packages/contracts/medusa/call_sequences/mutable/1694595722121674000-8d3ee9da-76ba-4629-ae57-d232b2ced34a.json index f3138029b..7c9e60234 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595722121674000-8d3ee9da-76ba-4629-ae57-d232b2ced34a.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595722121674000-8d3ee9da-76ba-4629-ae57-d232b2ced34a.json @@ -683,7 +683,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f50d8e461745f72e72b0cdf7f8666d0fd44e1722d9de8290324a50dfa2ecb0a92da9ab77d17c63e2cf9e44bd2fc4d7696f25630775d19f5794c4f6af7b6fcbb45", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "36568243078190828256003668906441702649054223684408542031170061014174192568978", "98877561831206475015586333703278925260533768595375519921631309598887274920773" @@ -775,7 +775,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f48b3f380922f52203f7139c9db677748b2d01040f97dffd502724d8b11139bd2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "32884471313221015493657348724043131459110887489544539643217192560816186170322", "115792089237316195423570985008687907853269984665640564039457584007913129639872" @@ -1068,7 +1068,7 @@ "gasTipCap": "0x0", "data": "0x98551a160000000000000000000000000000000000000000000000001d2147b8716b70d80000000000000000000000000000000000000000000000000000000000127503", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "2099037758833783000", "1209603" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595722510388000-c0ed918e-6230-4009-af30-a83c410106bc.json b/packages/contracts/medusa/call_sequences/mutable/1694595722510388000-c0ed918e-6230-4009-af30-a83c410106bc.json index 5040f653a..1d8ccd807 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595722510388000-c0ed918e-6230-4009-af30-a83c410106bc.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595722510388000-c0ed918e-6230-4009-af30-a83c410106bc.json @@ -185,7 +185,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "246", "36" @@ -301,7 +301,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f45de87b6ae099b314e1b244f4db4a1fb16727f5ff806c606dbbda65a5e12ed830000000000000000000000000000000000000000000000000000000000000010", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "31602763261421582786927527902525825747226883651739563418109920848191128006019", "16" @@ -1394,7 +1394,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffc9ca36523a21600028bcd76a1562cca853c4d2912513d1e3275654b646c14bdfb6838bcef41e91df27", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564038457584007913129639976", "85415419814257869262329194527809074615774700079608112840064273344812337454887" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595722650312000-98fe5ea0-0a43-4330-8ea2-7925d5727b3d.json b/packages/contracts/medusa/call_sequences/mutable/1694595722650312000-98fe5ea0-0a43-4330-8ea2-7925d5727b3d.json index 008ffb43b..19cb05d7a 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595722650312000-98fe5ea0-0a43-4330-8ea2-7925d5727b3d.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595722650312000-98fe5ea0-0a43-4330-8ea2-7925d5727b3d.json @@ -185,7 +185,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f00000000000000000000000000000000000000000000000000000000000000f60000000000000000000000000000000000000000000000000000000000000024", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "246", "36" @@ -301,7 +301,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f45de87b6ae099b314e1b244f4db4a1fb16727f5ff806c606dbbda65a5e12ed830000000000000000000000000000000000000000000000000000000000000010", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "31602763261421582786927527902525825747226883651739563418109920848191128006019", "16" @@ -1394,7 +1394,7 @@ "gasTipCap": "0x0", "data": "0x98551a16ffffffffffffffffffffffffffffffffffffffffffffffc9ca36523a21600028bcd76a1562cca853c4d2912513d1e3275654b646c14bdfb6838bcef41e91df27", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "115792089237316195423570985008687907853269984665640564038457584007913129639976", "85415419814257869262329194527809074615774700079608112840064273344812337454887" diff --git a/packages/contracts/medusa/call_sequences/mutable/1694595723812309000-3b07c087-866d-4b67-b2a7-8b2dae944325.json b/packages/contracts/medusa/call_sequences/mutable/1694595723812309000-3b07c087-866d-4b67-b2a7-8b2dae944325.json index a0dcc00a3..8394845a1 100755 --- a/packages/contracts/medusa/call_sequences/mutable/1694595723812309000-3b07c087-866d-4b67-b2a7-8b2dae944325.json +++ b/packages/contracts/medusa/call_sequences/mutable/1694595723812309000-3b07c087-866d-4b67-b2a7-8b2dae944325.json @@ -97,7 +97,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f000000000000000000000000000000000000000000000000000000000000001438f0f63625faeac05d4ecab9249ebd46ce655ada1ca7ce47d5ff78e695a9c277", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "20", "25755262105647936550395383444544251272927225535435178940503090176846971126391" @@ -435,7 +435,7 @@ "gasTipCap": "0x0", "data": "0x96038a9f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "1", "115792089237316195423570985008687907853269984665640564039457584007913129639919" @@ -985,7 +985,7 @@ "gasTipCap": "0x0", "data": "0x98551a163b9048559de3f8ee4937d4e198183ade9705ad7c6f9490d91d01450a1acc2974fbf4f144d5da45271779c2ac32386b1ce6364e130e410eb3d5f61f3c90d0ebbf", "dataAbiValues": { - "methodName": "withdrawEBTC", + "methodName": "withdrawDebt", "inputValues": [ "26941383277701052077855146540006290163837319286111741803054781507878494415220", "113963300854873048398123295350050377971758827978890615024860451441291736181695" @@ -1032,7 +1032,7 @@ "gasTipCap": "0x0", "data": "0x96038a9ffffffffff3be98b2b5d57db68e29e527294940c2e5ffcd50d1c168ddded80000d34b81e086392e08f3745e3f0450f0064feba6a3688ec29b19a1fbd0f961473c", "dataAbiValues": { - "methodName": "repayEBTC", + "methodName": "repayDebt", "inputValues": [ "115792089236025542474717890602061087714962172848589839170759584007913129639936", "95571420959369745694826866719103162119721698779245449771307988634382398211900" diff --git a/packages/contracts/test-report.md b/packages/contracts/test-report.md deleted file mode 100644 index 5cd3b9ba5..000000000 --- a/packages/contracts/test-report.md +++ /dev/null @@ -1,1233 +0,0 @@ -# Test coverage - -To check test coverage you can run: -``` -yarn coverage -``` - -You can see the coverage status at mainnet deployment [here](https://codecov.io/gh/liquity/dev/tree/8f52f2906f99414c0b1c3a84c95c74c319b7a8c6). - -![Impacted file tree graph](https://codecov.io/gh/liquity/dev/pull/707/graphs/tree.svg?width=650&height=150&src=pr&token=7AJPQ3TW0O&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=liquity) - -There’s also a [pull request](https://github.com/liquity/dev/pull/515) to increase the coverage, but it hasn’t been merged yet because it modifies some smart contracts (mostly removing unnecessary checks). - -# Test output -The following is the output of a complete test run, made on commit [`a1824dd8`](https://github.com/liquity/dev/tree/a1824dd88f4928b424cae372d59c4455d5c9a2c2), from April 16th, 2021. - -``` -yarn run v1.22.11 -$ hardhat test - - - Contract: Access Control: Liquity functions with the caller restricted to Liquity contract(s) - BorrowerOperations - ✓ moveETHGainToCdp(): reverts when called by an account that is not StabilityPool - CdpManager - ✓ syncAccounting(): reverts when called by an account that is not BorrowerOperations - ✓ updatedebtRedistributionIndex(): reverts when called by an account that is not BorrowerOperations - ✓ removeStake(): reverts when called by an account that is not BorrowerOperations - ✓ updateStakeAndTotalStakes(): reverts when called by an account that is not BorrowerOperations - ✓ closeCdp(): reverts when called by an account that is not BorrowerOperations - ✓ addCdpOwnerToArray(): reverts when called by an account that is not BorrowerOperations - ✓ setCdpStatus(): reverts when called by an account that is not BorrowerOperations - ✓ increaseCdpColl(): reverts when called by an account that is not BorrowerOperations - ✓ decreaseCdpColl(): reverts when called by an account that is not BorrowerOperations - ✓ increaseCdpDebt(): reverts when called by an account that is not BorrowerOperations - ✓ decreaseCdpDebt(): reverts when called by an account that is not BorrowerOperations - ActivePool - ✓ transferSystemCollShares(): reverts when called by an account that is not BO nor CdpM nor SP - ✓ increaseSystemDebt(): reverts when called by an account that is not BO nor CdpM - ✓ decreaseSystemDebt(): reverts when called by an account that is not BO nor CdpM nor SP - ✓ fallback(): reverts when called by an account that is not Borrower Operations nor Default Pool - DefaultPool - ✓ sendETHToActivePool(): reverts when called by an account that is not CdpManager - ✓ increaseSystemDebt(): reverts when called by an account that is not CdpManager - ✓ decreaseEBTC(): reverts when called by an account that is not CdpManager - ✓ fallback(): reverts when called by an account that is not the Active Pool - StabilityPool - ✓ offset(): reverts when called by an account that is not CdpManager - ✓ fallback(): reverts when called by an account that is not the Active Pool - EBTCToken - ✓ mint(): reverts when called by an account that is not BorrowerOperations - ✓ burn(): reverts when called by an account that is not BO nor CdpM nor SP - ✓ sendToPool(): reverts when called by an account that is not StabilityPool - ✓ returnFromPool(): reverts when called by an account that is not CdpManager nor StabilityPool - SortedCdps - ✓ insert(): reverts when called by an account that is not BorrowerOps or CdpM - ✓ remove(): reverts when called by an account that is not CdpManager - ✓ reinsert(): reverts when called by an account that is neither BorrowerOps nor CdpManager - LockupContract - ✓ withdrawLQTY(): reverts when caller is not beneficiary (68ms) - FeeRecipient - ✓ increaseF_EBTC(): reverts when caller is not CdpManager - LQTYToken - ✓ sendToLQTYStaking(): reverts when caller is not the LQTYSstaking (49ms) - CommunityIssuance - ✓ sendLQTY(): reverts when caller is not the StabilityPool - ✓ issueLQTY(): reverts when caller is not the StabilityPool - - Contract: BorrowerOperations - Without proxy - ✓ addColl(): reverts when top-up would leave cdp with ICR < MCR (278ms) - ✓ addColl(): Increases the activePool ETH and raw ether balance by correct amount (203ms) - ✓ addColl(), active Cdp: adds the correct collateral amount to the Cdp (194ms) - ✓ addColl(), active Cdp: Cdp is in sortedList before and after (213ms) - ✓ addColl(), active Cdp: updates the stake and updates the total stakes (225ms) - ✓ addColl(), active Cdp: applies pending rewards and updates user's L_STETHColl, systemDebtRedistributionIndex snapshots (736ms) - ✓ addColl(), reverts if cdp is non-existent or closed (831ms) - ✓ addColl(): can add collateral in Recovery Mode (252ms) - ✓ withdrawColl(): reverts when withdrawal would leave cdp with ICR < MCR (349ms) - ✓ withdrawColl(): reverts when calling address does not have active cdp (328ms) - ✓ withdrawColl(): reverts when system is in Recovery Mode (420ms) - ✓ withdrawColl(): reverts when requested ETH withdrawal is > the cdp's collateral (508ms) - ✓ withdrawColl(): reverts when withdrawal would bring the user's ICR < MCR (313ms) - ✓ withdrawColl(): reverts if system is in Recovery Mode (323ms) - ✓ withdrawColl(): doesn’t allow a user to completely withdraw all collateral from their Cdp (due to gas compensation) (352ms) - ✓ withdrawColl(): leaves the Cdp active when the user withdraws less than all the collateral (263ms) - ✓ withdrawColl(): reduces the Cdp's collateral by the correct amount (316ms) - ✓ withdrawColl(): reduces ActivePool ETH and raw ether by correct amount (291ms) - ✓ withdrawColl(): updates the stake and updates the total stakes (342ms) - ✓ withdrawColl(): sends the correct amount of ETH to the user (289ms) - ✓ withdrawColl(): applies pending rewards and updates user's L_STETHColl, systemDebtRedistributionIndex snapshots (1205ms) - ✓ withdrawEBTC(): reverts when withdrawal would leave cdp with ICR < MCR (516ms) - ✓ withdrawEBTC(): decays a non-zero base rate (1192ms) - ✓ withdrawEBTC(): reverts if max fee > 100% (668ms) - ✓ withdrawEBTC(): reverts if max fee < 0.5% in Normal mode (639ms) - ✓ withdrawEBTC(): reverts if fee exceeds max fee percentage (938ms) - ✓ withdrawEBTC(): succeeds when fee is less than max fee percentage (1272ms) - ✓ withdrawEBTC(): doesn't change base rate if it is already zero (1044ms) - ✓ withdrawEBTC(): lastFeeOpTime doesn't update if less time than decay interval has passed since the last fee operation (899ms) - ✓ withdrawEBTC(): borrower can't grief the baseRate and stop it decaying by issuing debt at higher frequency than the decay granularity (852ms) - ✓ withdrawEBTC(): borrowing at non-zero base rate sends EBTC fee to LQTY staking contract (1004ms) - ✓ withdrawEBTC(): borrowing at non-zero base records the (drawn debt + fee) on the Cdp struct (923ms) - ✓ withdrawEBTC(): Borrowing at non-zero base rate increases the LQTY staking contract EBTC fees-per-unit-staked (986ms) - ✓ withdrawEBTC(): Borrowing at non-zero base rate sends requested amount to the user (1562ms) - ✓ withdrawEBTC(): Borrowing at zero base rate changes EBTC fees-per-unit-staked (839ms) - ✓ withdrawEBTC(): Borrowing at zero base rate sends debt request to user (790ms) - ✓ withdrawEBTC(): reverts when calling address does not have active cdp (370ms) - ✓ withdrawEBTC(): reverts when requested withdrawal amount is zero EBTC (459ms) - ✓ withdrawEBTC(): reverts when system is in Recovery Mode (649ms) - ✓ withdrawEBTC(): reverts when withdrawal would bring the cdp's ICR < MCR (347ms) - ✓ withdrawEBTC(): reverts when a withdrawal would cause the TCR of the system to fall below the CCR (439ms) - ✓ withdrawEBTC(): reverts if system is in Recovery Mode (312ms) - ✓ withdrawEBTC(): increases the Cdp's EBTC debt by the correct amount (208ms) - ✓ withdrawEBTC(): increases EBTC debt in ActivePool by correct amount (230ms) - ✓ withdrawEBTC(): increases user EBTCToken balance by correct amount (243ms) - ✓ repayEBTC(): reverts when repayment would leave cdp with ICR < MCR (392ms) - ✓ repayEBTC(): Succeeds when it would leave cdp with net debt >= minimum net debt (435ms) - ✓ repayEBTC(): reverts when it would leave cdp with net debt < minimum net debt (256ms) - ✓ repayEBTC(): reverts when calling address does not have active cdp (431ms) - ✓ repayEBTC(): reverts when attempted repayment is > the debt of the cdp (418ms) - ✓ repayEBTC(): reduces the Cdp's EBTC debt by the correct amount (403ms) - ✓ repayEBTC(): decreases EBTC debt in ActivePool by correct amount (406ms) - ✓ repayEBTC(): decreases user EBTCToken balance by correct amount (404ms) - ✓ repayEBTC(): can repay debt in Recovery Mode (557ms) - ✓ repayEBTC(): Reverts if borrower has insufficient EBTC balance to cover his debt repayment (1122ms) - ✓ adjustCdp(): reverts when adjustment would leave cdp with ICR < MCR (572ms) - ✓ adjustCdp(): reverts if max fee < 0.5% in Normal mode (313ms) - ✓ adjustCdp(): allows max fee < 0.5% in Recovery mode (577ms) - ✓ adjustCdp(): decays a non-zero base rate (1218ms) - ✓ adjustCdp(): doesn't decay a non-zero base rate when user issues 0 debt (935ms) - ✓ adjustCdp(): doesn't change base rate if it is already zero (545ms) - ✓ adjustCdp(): lastFeeOpTime doesn't update if less time than decay interval has passed since the last fee operation (819ms) - ✓ adjustCdp(): borrower can't grief the baseRate and stop it decaying by issuing debt at higher frequency than the decay granularity (866ms) - ✓ adjustCdp(): borrowing at non-zero base rate sends EBTC fee to LQTY staking contract (889ms) - ✓ adjustCdp(): borrowing at non-zero base records the (drawn debt + fee) on the Cdp struct (1013ms) - ✓ adjustCdp(): Borrowing at non-zero base rate increases the LQTY staking contract EBTC fees-per-unit-staked (837ms) - ✓ adjustCdp(): Borrowing at non-zero base rate sends requested amount to the user (895ms) - ✓ adjustCdp(): Borrowing at zero base rate changes EBTC balance of LQTY staking contract (783ms) - ✓ adjustCdp(): Borrowing at zero base rate changes LQTY staking contract EBTC fees-per-unit-staked (881ms) - ✓ adjustCdp(): Borrowing at zero base rate sends total requested EBTC to the user (783ms) - ✓ adjustCdp(): reverts when calling address has no active cdp (416ms) - ✓ adjustCdp(): reverts in Recovery Mode when the adjustment would reduce the TCR (654ms) - ✓ adjustCdp(): collateral withdrawal reverts in Recovery Mode (370ms) - ✓ adjustCdp(): debt increase that would leave ICR < 150% reverts in Recovery Mode (497ms) - ✓ adjustCdp(): debt increase that would reduce the ICR reverts in Recovery Mode (596ms) - ✓ adjustCdp(): A cdp with ICR < CCR in Recovery Mode can adjust their cdp to ICR > CCR (599ms) - ✓ adjustCdp(): A cdp with ICR > CCR in Recovery Mode can improve their ICR (524ms) - ✓ adjustCdp(): debt increase in Recovery Mode charges no fee (543ms) - ✓ adjustCdp(): reverts when change would cause the TCR of the system to fall below the CCR (587ms) - ✓ adjustCdp(): reverts when EBTC repaid is > debt of the cdp (451ms) - ✓ adjustCdp(): reverts when attempted ETH withdrawal is >= the cdp's collateral (683ms) - ✓ adjustCdp(): reverts when change would cause the ICR of the cdp to fall below the MCR (521ms) - ✓ adjustCdp(): With 0 coll change, doesnt change borrower's coll or ActivePool coll (289ms) - ✓ adjustCdp(): With 0 debt change, doesnt change borrower's debt or ActivePool debt (354ms) - ✓ adjustCdp(): updates borrower's debt and coll with an increase in both (558ms) - ✓ adjustCdp(): updates borrower's debt and coll with a decrease in both (553ms) - ✓ adjustCdp(): updates borrower's debt and coll with coll increase, debt decrease (375ms) - ✓ adjustCdp(): updates borrower's debt and coll with coll decrease, debt increase (346ms) - ✓ adjustCdp(): updates borrower's stake and totalStakes with a coll increase (385ms) - ✓ adjustCdp(): updates borrower's stake and totalStakes with a coll decrease (553ms) - ✓ adjustCdp(): changes EBTCToken balance by the requested decrease (529ms) - ✓ adjustCdp(): changes EBTCToken balance by the requested increase (577ms) - ✓ adjustCdp(): Changes the activePool ETH and raw ether balance by the requested decrease (1371ms) - ✓ adjustCdp(): Changes the activePool ETH and raw ether balance by the amount of ETH sent (548ms) - ✓ adjustCdp(): Changes the EBTC debt in ActivePool by requested decrease (541ms) - ✓ adjustCdp(): Changes the EBTC debt in ActivePool by requested increase (397ms) - ✓ adjustCdp(): new coll = 0 and new debt = 0 is not allowed, as gas compensation still counts toward ICR (385ms) - ✓ adjustCdp(): Reverts if requested debt increase and amount is zero (292ms) - ✓ adjustCdp(): Reverts if requested coll withdrawal and ether is sent (288ms) - ✓ adjustCdp(): Reverts if it’s zero adjustment (137ms) - ✓ adjustCdp(): Reverts if requested coll withdrawal is greater than cdp's collateral (402ms) - ✓ adjustCdp(): Reverts if borrower has insufficient EBTC balance to cover his debt repayment (496ms) - ✓ Internal _adjustCdp(): reverts when op is a withdrawal and _borrower param is not the msg.sender (475ms) - ✓ closeCdp(): reverts when it would lower the TCR below CCR (471ms) - ✓ closeCdp(): reverts when calling address does not have active cdp (221ms) - ✓ closeCdp(): reverts when system is in Recovery Mode (746ms) - ✓ closeCdp(): reverts when cdp is the only one in the system (497ms) - ✓ closeCdp(): reduces a Cdp's collateral to zero (582ms) - ✓ closeCdp(): reduces a Cdp's debt to zero (398ms) - ✓ closeCdp(): sets Cdp's stake to zero (504ms) - ✓ closeCdp(): zero's the cdps reward snapshots (1002ms) - ✓ closeCdp(): sets cdp's status to closed and removes it from sorted cdps list (526ms) - ✓ closeCdp(): reduces ActivePool ETH and raw ether by correct amount (466ms) - ✓ closeCdp(): reduces ActivePool debt by correct amount (522ms) - ✓ closeCdp(): updates the the total stakes (790ms) - ✓ closeCdp(): sends the correct amount of ETH to the user (390ms) - ✓ closeCdp(): subtracts the debt of the closed Cdp from the Borrower's EBTCToken balance (405ms) - ✓ closeCdp(): applies pending rewards (1267ms) - ✓ closeCdp(): reverts if borrower has insufficient EBTC balance to repay his entire debt (347ms) - ✓ openCdp(): emits a CdpUpdated event with the correct collateral and debt (820ms) - ✓ openCdp(): Opens a cdp with net debt >= minimum net debt (235ms) - ✓ openCdp(): reverts if net debt < minimum net debt (294ms) - ✓ openCdp(): decays a non-zero base rate (959ms) - ✓ openCdp(): doesn't change base rate if it is already zero (911ms) - ✓ openCdp(): lastFeeOpTime doesn't update if less time than decay interval has passed since the last fee operation (953ms) - ✓ openCdp(): reverts if max fee > 100% (56ms) - ✓ openCdp(): reverts if max fee < 0.5% in Normal mode (85ms) - ✓ openCdp(): allows max fee < 0.5% in Recovery Mode (409ms) - ✓ openCdp(): reverts if fee exceeds max fee percentage (747ms) - ✓ openCdp(): succeeds when fee is less than max fee percentage (930ms) - ✓ openCdp(): borrower can't grief the baseRate and stop it decaying by issuing debt at higher frequency than the decay granularity (965ms) - ✓ openCdp(): borrowing at non-zero base rate sends EBTC fee to LQTY staking contract (923ms) - ✓ openCdp(): borrowing at non-zero base records the (drawn debt + fee + liq. reserve) on the Cdp struct (865ms) - ✓ openCdp(): Borrowing at non-zero base rate increases the LQTY staking contract EBTC fees-per-unit-staked (794ms) - ✓ openCdp(): Borrowing at non-zero base rate sends requested amount to the user (832ms) - ✓ openCdp(): Borrowing at zero base rate changes the LQTY staking contract EBTC fees-per-unit-staked (602ms) - ✓ openCdp(): Borrowing at zero base rate charges minimum fee (316ms) - ✓ openCdp(): reverts when system is in Recovery Mode and ICR < CCR (320ms) - ✓ openCdp(): reverts when cdp ICR < MCR (536ms) - ✓ openCdp(): reverts when opening the cdp would cause the TCR of the system to fall below the CCR (367ms) - ✓ openCdp(): reverts if cdp is already active (679ms) - ✓ openCdp(): Can open a cdp with ICR >= CCR when system is in Recovery Mode (499ms) - ✓ openCdp(): Reverts opening a cdp with min debt when system is in Recovery Mode (324ms) - ✓ openCdp(): creates a new Cdp and assigns the correct collateral and debt amount (127ms) - ✓ openCdp(): adds Cdp owner to CdpOwners array (136ms) - ✓ openCdp(): creates a stake and adds it to total stakes (281ms) - ✓ openCdp(): inserts Cdp to Sorted Cdps list (370ms) - ✓ openCdp(): Increases the activePool ETH and raw ether balance by correct amount (294ms) - ✓ openCdp(): records up-to-date initial snapshots of L_STETHColl and systemDebtRedistributionIndex (639ms) - ✓ openCdp(): allows a user to open a Cdp, then close it, then re-open it (687ms) - ✓ openCdp(): increases the Cdp's EBTC debt by the correct amount (129ms) - ✓ openCdp(): increases EBTC debt in ActivePool by the debt of the cdp (162ms) - ✓ openCdp(): increases user EBTCToken balance by correct amount (85ms) - ✓ getCompositeDebt(): returns debt + gas comp - ✓ closeCdp(): fails if owner cannot receive ETH (440ms) - getNewICRFromCdpChange() returns the correct ICR - ✓ collChange = 0, debtChange = 0 - ✓ collChange = 0, debtChange is positive - ✓ collChange = 0, debtChange is negative - ✓ collChange is positive, debtChange is 0 - ✓ collChange is negative, debtChange is 0 - ✓ collChange is negative, debtChange is negative - ✓ collChange is positive, debtChange is positive - ✓ collChange is positive, debtChange is negative - ✓ collChange is negative, debtChange is positive - getNewTCRFromCdpChange() returns the correct TCR - ✓ collChange = 0, debtChange = 0 (248ms) - ✓ collChange = 0, debtChange is positive (630ms) - ✓ collChange = 0, debtChange is negative (327ms) - ✓ collChange is positive, debtChange is 0 (328ms) - ✓ collChange is negative, debtChange is 0 (407ms) - ✓ collChange is negative, debtChange is negative (605ms) - ✓ collChange is positive, debtChange is positive (601ms) - ✓ collChange is positive, debtChange is negative (609ms) - ✓ collChange is negative, debtChange is positive (381ms) - - Contract: CollSurplusPool - ✓ CollSurplusPool::getSystemCollShares(): Returns the ETH balance of the CollSurplusPool after redemption (2203ms) - ✓ CollSurplusPool: claimSurplusCollShares(): Reverts if caller is not Borrower Operations - ✓ CollSurplusPool: claimSurplusCollShares(): Reverts if nothing to claim - ✓ CollSurplusPool: claimSurplusCollShares(): Reverts if owner cannot receive ETH surplus (723ms) - ✓ CollSurplusPool: reverts trying to send ETH to it - ✓ CollSurplusPool: increaseSurplusCollShares: reverts if caller is not Cdp Manager - - Contract: Deployment script - Sets correct contract addresses dependencies after deployment - ✓ Sets the correct PriceFeed address in CdpManager - ✓ Sets the correct EBTCToken address in CdpManager - ✓ Sets the correct SortedCdps address in CdpManager - ✓ Sets the correct BorrowerOperations address in CdpManager - ✓ Sets the correct ActivePool address in CdpManager - ✓ Sets the correct DefaultPool address in CdpManager - ✓ Sets the correct StabilityPool address in CdpManager - ✓ Sets the correct FeeRecipient address in CdpManager - ✓ Sets the correct StabilityPool address in ActivePool - ✓ Sets the correct DefaultPool address in ActivePool (133ms) - ✓ Sets the correct BorrowerOperations address in ActivePool - ✓ Sets the correct CdpManager address in ActivePool - ✓ Sets the correct ActivePool address in StabilityPool - ✓ Sets the correct BorrowerOperations address in StabilityPool - ✓ Sets the correct EBTCToken address in StabilityPool - ✓ Sets the correct CdpManager address in StabilityPool - ✓ Sets the correct CdpManager address in DefaultPool - ✓ Sets the correct ActivePool address in DefaultPool - ✓ Sets the correct CdpManager address in SortedCdps - ✓ Sets the correct BorrowerOperations address in SortedCdps - ✓ Sets the correct CdpManager address in BorrowerOperations - ✓ Sets the correct PriceFeed address in BorrowerOperations - ✓ Sets the correct SortedCdps address in BorrowerOperations - ✓ Sets the correct ActivePool address in BorrowerOperations - ✓ Sets the correct DefaultPool address in BorrowerOperations - ✓ Sets the correct FeeRecipient address in BorrowerOperations - ✓ Sets the correct LQTYToken address in FeeRecipient - ✓ Sets the correct ActivePool address in FeeRecipient - ✓ Sets the correct ActivePool address in FeeRecipient - ✓ Sets the correct ActivePool address in FeeRecipient - ✓ Sets the correct BorrowerOperations address in FeeRecipient - ✓ Sets the correct CommunityIssuance address in LQTYToken - ✓ Sets the correct FeeRecipient address in LQTYToken - ✓ Sets the correct LockupContractFactory address in LQTYToken - ✓ Sets the correct LQTYToken address in LockupContractFactory - ✓ Sets the correct LQTYToken address in CommunityIssuance - ✓ Sets the correct StabilityPool address in CommunityIssuance - - Contract: DefaultPool - ✓ sendETHToActivePool(): fails if receiver cannot receive ETH - - Contract: Fee arithmetic tests - ✓ minutesPassedSinceLastRedemption(): returns minutes passed for no time increase (197ms) - ✓ minutesPassedSinceLastRedemption(): returns minutes passed between time of last fee operation and current block.timestamp, rounded down to nearest minutes (982ms) - ✓ decayBaseRateFromBorrowing(): returns the initial base rate for no time increase - ✓ decayBaseRateFromBorrowing(): returns the initial base rate for less than one minute passed (386ms) - ✓ decayBaseRateFromBorrowing(): returns correctly decayed base rate, for various durations. Initial baseRate = 0.01 (2908ms) - ✓ decayBaseRateFromBorrowing(): returns correctly decayed base rate, for various durations. Initial baseRate = 0.1 (3951ms) - ✓ decayBaseRateFromBorrowing(): returns correctly decayed base rate, for various durations. Initial baseRate = 0.34539284 (3651ms) - ✓ decayBaseRateFromBorrowing(): returns correctly decayed base rate, for various durations. Initial baseRate = 0.9976 (4377ms) - Basic exponentiation - ✓ decPow(): for exponent = 0, returns 1, regardless of base (42ms) - ✓ decPow(): for exponent = 1, returns base, regardless of base (86ms) - ✓ decPow(): for base = 0, returns 0 for any exponent other than 0 (238ms) - ✓ decPow(): for base = 1, returns 1 for any exponent (179ms) - ✓ decPow(): for exponent = 2, returns the square of the base (86ms) - ✓ decPow(): correct output for various bases and exponents (2032ms) - ✓ decPow(): abs. error < 1e-9 for exponent = 7776000 (seconds in three months) (8459ms) - ✓ decPow(): abs. error < 1e-9 for exponent = 2592000 (seconds in one month) (4815ms) - ✓ decPow(): abs. error < 1e-9 for exponent = 43200 (minutes in one month) (4387ms) - ✓ decPow(): abs. error < 1e-9 for exponent = 525600 (minutes in one year) (4454ms) - ✓ decPow(): abs. error < 1e-9 for exponent = 2628000 (minutes in five years) (4724ms) - ✓ decPow(): abs. error < 1e-9 for exponent = minutes in ten years (3847ms) - ✓ decPow(): abs. error < 1e-9 for exponent = minutes in one hundred years (5802ms) - - decPow(): overflow test: doesn't overflow for exponent = minutes in 1000 years - - Contract: Gas compensation tests - ✓ _getCollGasCompensation(): returns the 0.5% of collaterall if it is < $10 in value - ✓ _getCollGasCompensation(): returns 0.5% of collaterall when 0.5% of collateral < $10 in value - ✓ getCollGasCompensation(): returns 0.5% of collaterall when 0.5% of collateral = $10 in value - ✓ getCollGasCompensation(): returns 0.5% of collaterall when 0.5% of collateral = $10 in value (72ms) - ✓ _getCompositeDebt(): returns (debt + 50) when collateral < $10 in value - ✓ getCompositeDebt(): returns (debt + 50) collateral = $10 in value - ✓ getCompositeDebt(): returns (debt + 50) when 0.5% of collateral > $10 in value (52ms) - ✓ getICR(): Incorporates virtual debt, and returns the correct ICR for new cdps (1147ms) - ✓ Gas compensation from pool-offset liquidations. All collateral paid as compensation (1340ms) - ✓ gas compensation from pool-offset liquidations: 0.5% collateral < $10 in value. Compensates $10 worth of collateral, liquidates the remainder (1199ms) - ✓ gas compensation from pool-offset liquidations: 0.5% collateral > $10 in value. Compensates 0.5% of collateral, liquidates the remainder (1333ms) -TCR: 238.086389539884110295 -TCR: 11.892415157517211309 - ✓ Gas compensation from pool-offset liquidations. Liquidation event emits the correct gas compensation and total liquidated coll and debt (1541ms) - ✓ gas compensation from pool-offset liquidations. Liquidation event emits the correct gas compensation and total liquidated coll and debt (1498ms) - ✓ gas compensation from pool-offset liquidations: 0.5% collateral > $10 in value. Liquidation event emits the correct gas compensation and total liquidated coll and debt (1547ms) - ✓ liquidateCdps(): full offset. Compensates the correct amount, and liquidates the remainder (1810ms) - ✓ liquidateCdps(): full redistribution. Compensates the correct amount, and liquidates the remainder (1312ms) - ✓ liquidateCdps(): full offset. Liquidation event emits the correct gas compensation and total liquidated coll and debt (1551ms) - ✓ liquidateCdps(): full redistribution. Liquidation event emits the correct gas compensation and total liquidated coll and debt (1790ms) - ✓ Cdp ordering: same collateral, decreasing debt. Price successively increases. Cdps should maintain ordering by ICR (1647ms) - ✓ Cdp ordering: increasing collateral, constant debt. Price successively increases. Cdps should maintain ordering by ICR (3885ms) - ✓ Cdp ordering: Constant raw collateral ratio (excluding virtual debt). Price successively increases. Cdps should maintain ordering by ICR (2042ms) - - Contract: LQTY Token - ✓ balanceOf(): gets the balance of the account (43ms) - ✓ totalSupply(): gets the total supply - ✓ name(): returns the token's name - ✓ symbol(): returns the token's symbol - ✓ version(): returns the token contract's version - ✓ decimal(): returns the number of decimal digits used - ✓ allowance(): returns an account's spending allowance for another account's balance (48ms) - ✓ approve(): approves an account to spend the specified ammount (47ms) - ✓ approve(): reverts when spender param is address(0) (52ms) - ✓ approve(): reverts when owner param is address(0) (60ms) - ✓ transferFrom(): successfully transfers from an account which it is approved to transfer from (123ms) - ✓ transfer(): increases the recipient's balance by the correct amount (42ms) - ✓ transfer(): reverts when amount exceeds sender's balance (56ms) - ✓ transfer(): transfer to a blacklisted address reverts (204ms) - ✓ transfer(): transfer to or from the zero-address reverts (49ms) - ✓ mint(): issues correct amount of tokens to the given address - ✓ mint(): reverts when beneficiary is address(0) - ✓ increaseAllowance(): increases an account's allowance by the correct amount - ✓ decreaseAllowance(): decreases an account's allowance by the correct amount - ✓ sendToLQTYStaking(): changes balances of FeeRecipient and calling account by the correct amounts (48ms) - ✓ Initializes PERMIT_TYPEHASH correctly - ✓ Initializes DOMAIN_SEPARATOR correctly - ✓ Initial nonce for a given address is 0 - ✓ permit(): permits and emits an Approval event (replay protected) (88ms) - ✓ permit(): fails with expired deadline - ✓ permit(): fails with the wrong signature (46ms) - - Contract: HintHelpers - ✓ setup: makes accounts with nominal ICRs increasing by 1% consecutively (76ms) - ✓ getApproxHint(): returns the address of a Cdp within sqrt(length) positions of the correct insert position (1441ms) - ✓ getApproxHint(): returns the head of the list if the CR is the max uint256 value (270ms) - ✓ getApproxHint(): returns the tail of the list if the CR is lower than ICR of any Cdp (321ms) - ✓ computeNominalCR() - - Contract: Deploying and funding One Year Lockup Contracts - Deploying LCs - ✓ LQTY Deployer can deploy LCs through the Factory (121ms) - ✓ Anyone can deploy LCs through the Factory (71ms) - ✓ LQTY Deployer can deploy LCs directly (43ms) - ✓ Anyone can deploy LCs directly (43ms) - ✓ LC deployment stores the beneficiary's address in the LC (1806ms) - ✓ LC deployment through the Factory registers the LC in the Factory (99ms) - ✓ LC deployment through the Factory records the LC contract address and deployer as a k-v pair in the Factory (90ms) - ✓ LC deployment through the Factory sets the unlockTime in the LC (52ms) - ✓ Direct deployment of LC sets the unlockTime in the LC (55ms) - ✓ LC deployment through the Factory reverts when the unlockTime is < 1 year from system deployment (50ms) - ✓ Direct deployment of LC reverts when the unlockTime is < 1 year from system deployment (54ms) - Funding LCs - ✓ LQTY transfer from LQTY deployer to their deployed LC increases the LQTY balance of the LC (397ms) - ✓ LQTY Multisig can transfer LQTY to LCs deployed through the factory by anyone (168ms) - Withdrawal attempts on funded, inactive LCs immediately after funding - ✓ Beneficiary can't withdraw from their funded LC (346ms) - ✓ LQTY multisig can't withraw from a LC which it funded (271ms) - ✓ No one can withraw from a LC (78ms) - - Contract: Deploying the LQTY contracts: LCF, CI, FeeRecipient, and LQTYToken - CommunityIssuance deployment - ✓ Stores the deployer's address - FeeRecipient deployment - ✓ Stores the deployer's address - LQTYToken deployment - ✓ Stores the multisig's address - ✓ Stores the CommunityIssuance address - ✓ Stores the LockupContractFactory address - ✓ Mints the correct LQTY amount to the multisig's address: (64.66 million) - ✓ Mints the correct LQTY amount to the CommunityIssuance contract address: 32 million - ✓ Mints the correct LQTY amount to the bountyAddress EOA: 2 million - ✓ Mints the correct LQTY amount to the lpRewardsAddress EOA: 1.33 million - Community Issuance deployment - ✓ Stores the deployer's address - ✓ Has a supply cap of 32 million - ✓ Liquity AG can set addresses if CI's LQTY balance is equal or greater than 32 million (393ms) - ✓ Liquity AG can't set addresses if CI's LQTY balance is < 32 million (367ms) - Connecting LQTYToken to LCF, CI and FeeRecipient - ✓ sets the correct LQTYToken address in FeeRecipient (1866ms) - ✓ sets the correct LQTYToken address in LockupContractFactory - ✓ sets the correct LQTYToken address in CommunityIssuance (203ms) - - Contract: During the initial lockup period - LQTY transfer during first year after LQTY deployment - ✓ Liquity multisig can not transfer LQTY to a LC that was deployed directly (105ms) - ✓ Liquity multisig can not transfer to an EOA or Liquity system contracts (302ms) - ✓ Liquity multisig can not approve any EOA or Liquity system contract to spend their LQTY (546ms) - ✓ Liquity multisig can not increaseAllowance for any EOA or Liquity contract (285ms) - ✓ Liquity multisig can not decreaseAllowance for any EOA or Liquity contract (338ms) - ✓ Liquity multisig can not be the sender in a transferFrom() call - ✓ Liquity multisig can not stake their LQTY in the staking contract - ✓ Anyone (other than Liquity multisig) can transfer LQTY to LCs deployed by anyone through the Factory (359ms) - ✓ Anyone (other than Liquity multisig) can transfer LQTY to LCs deployed by anyone directly (141ms) - ✓ Anyone (other than liquity multisig) can transfer to an EOA (106ms) - ✓ Anyone (other than liquity multisig) can approve any EOA or to spend their LQTY - ✓ Anyone (other than liquity multisig) can increaseAllowance for any EOA or Liquity contract (244ms) - ✓ Anyone (other than liquity multisig) can decreaseAllowance for any EOA or Liquity contract (693ms) - ✓ Anyone (other than liquity multisig) can be the sender in a transferFrom() call (62ms) - ✓ Anyone (other than liquity AG) can stake their LQTY in the staking contract - Lockup Contract Factory negative tests - ✓ deployLockupContract(): reverts when LQTY token address is not set (197ms) - Transferring LQTY to LCs - ✓ Liquity multisig can transfer LQTY (vesting) to lockup contracts they deployed (198ms) - ✓ Liquity multisig can transfer LQTY to lockup contracts deployed by anyone (1798ms) - Deploying new LCs - ✓ LQTY Deployer can deploy LCs through the Factory (46ms) - ✓ Liquity multisig can deploy LCs through the Factory - ✓ Anyone can deploy LCs through the Factory (80ms) - ✓ LQTY Deployer can deploy LCs directly (44ms) - ✓ Liquity multisig can deploy LCs directly (45ms) - ✓ Anyone can deploy LCs directly (46ms) - ✓ Anyone can deploy LCs with unlockTime = one year from deployment, directly and through factory (102ms) - ✓ Anyone can deploy LCs with unlockTime > one year from deployment, directly and through factory (187ms) - ✓ No one can deploy LCs with unlockTime < one year from deployment, directly or through factory (100ms) - Withdrawal Attempts on LCs before unlockTime has passed - ✓ Liquity multisig can't withdraw from a funded LC they deployed for another beneficiary through the Factory before the unlockTime - ✓ Liquity multisig can't withdraw from a funded LC that someone else deployed before the unlockTime (52ms) - ✓ Beneficiary can't withdraw from their funded LC before the unlockTime (219ms) - ✓ No one can withdraw from a beneficiary's funded LC before the unlockTime (475ms) - - Contract: After the initial lockup period has passed - Deploying new LCs - ✓ LQTY Deployer can deploy new LCs - ✓ Anyone can deploy new LCs (42ms) - ✓ Anyone can deploy new LCs with unlockTime in the past (65ms) - ✓ Anyone can deploy new LCs with unlockTime in the future (46ms) - Beneficiary withdrawal from initial LC - ✓ A beneficiary can withdraw their full entitlement from their LC (256ms) - ✓ A beneficiary on a vesting schedule can withdraw their total vested amount from their LC (155ms) - ✓ Beneficiaries can withraw full LQTY balance of LC if it has increased since lockup period ended (234ms) - Withdrawal attempts from LCs by non-beneficiaries - ✓ LQTY Multisig can't withdraw from a LC they deployed through the Factory - ✓ LQTY Multisig can't withdraw from a LC that someone else deployed - ✓ Non-beneficiaries cannot withdraw from a LC (189ms) - Transferring LQTY - ✓ LQTY multisig can transfer LQTY to LCs they deployed (176ms) - ✓ LQTY multisig can transfer tokens to LCs deployed by anyone (104ms) - ✓ LQTY multisig can transfer LQTY directly to any externally owned account (141ms) - ✓ Anyone can transfer LQTY to LCs deployed by anyone (179ms) - ✓ Anyone can transfer to an EOA (421ms) - ✓ Anyone can approve any EOA to spend their LQTY - ✓ Anyone can increaseAllowance for any EOA or Liquity contract (2441ms) - ✓ Anyone can decreaseAllowance for any EOA or Liquity contract (1034ms) - ✓ Anyone can be the sender in a transferFrom() call (101ms) - ✓ Anyone can stake their LQTY in the staking contract (55ms) - Withdrawal Attempts on new LCs before unlockTime has passed - ✓ LQTY Deployer can't withdraw from a funded LC they deployed for another beneficiary through the Factory, before the unlockTime (44ms) - ✓ LQTY Deployer can't withdraw from a funded LC that someone else deployed, before the unlockTime (448ms) - ✓ Beneficiary can't withdraw from their funded LC, before the unlockTime (284ms) - ✓ No one can withdraw from a beneficiary's funded LC, before the unlockTime (443ms) - Withdrawals from new LCs after unlockTime has passed - ✓ LQTY Deployer can't withdraw from a funded LC they deployed for another beneficiary through the Factory, after the unlockTime (100ms) - ✓ LQTY multisig can't withdraw from a funded LC when they are not the beneficiary, after the unlockTime (529ms) - ✓ Beneficiary can withdraw from their funded LC, after the unlockTime (97ms) - ✓ Non-beneficiaries can't withdraw from a beneficiary's funded LC, after the unlockTime (226ms) - - Contract: LiquityMath - ✓ max works if a > b - ✓ max works if a = b - ✓ max works if a < b - - Contract: LiquitySafeMath128Tester - ✓ add(): reverts if overflows - ✓ sub(): reverts if underflows - - Contract: LQTY community issuance arithmetic tests -issuance fraction before: 949066037374286 -issuance fraction after: 949066037374286 - ✓ getCumulativeIssuanceFraction(): fraction doesn't increase if less than a minute has passed (45ms) - ✓ Cumulative issuance fraction is 0.0000013 after a minute - ✓ Cumulative issuance fraction is 0.000079 after an hour - ✓ Cumulative issuance fraction is 0.0019 after a day - ✓ Cumulative issuance fraction is 0.013 after a week (283ms) - ✓ Cumulative issuance fraction is 0.055 after a month (38ms) - ✓ Cumulative issuance fraction is 0.16 after 3 months - ✓ Cumulative issuance fraction is 0.29 after 6 months (38ms) - ✓ Cumulative issuance fraction is 0.5 after a year - ✓ Cumulative issuance fraction is 0.75 after 2 years - ✓ Cumulative issuance fraction is 0.875 after 3 years (44ms) - ✓ Cumulative issuance fraction is 0.9375 after 4 years (50ms) - ✓ Cumulative issuance fraction is 0.999 after 10 years - ✓ Cumulative issuance fraction is 0.999999 after 20 years (78ms) - ✓ Cumulative issuance fraction is 0.999999999 after 30 years (55ms) - ✓ Total LQTY tokens issued is 42.20 after a minute (38ms) - ✓ Total LQTY tokens issued is 2,531.94 after an hour (41ms) - ✓ Total LQTY tokens issued is 60,711.40 after a day (136ms) - ✓ Total LQTY tokens issued is 422,568.60 after a week (331ms) - ✓ Total LQTY tokens issued is 1,772,113.21 after a month - ✓ Total LQTY tokens issued is 5,027,363.22 after 3 months (40ms) - ✓ Total LQTY tokens issued is 9,264,902.04 after 6 months (47ms) - ✓ Total LQTY tokens issued is 16,000,000 after a year (47ms) - ✓ Total LQTY tokens issued is 24,000,000 after 2 years (47ms) - ✓ Total LQTY tokens issued is 28,000,000 after 3 years (75ms) - ✓ Total LQTY tokens issued is 30,000,000 after 4 years (40ms) - ✓ Total LQTY tokens issued is 31,968,750 after 10 years (69ms) - ✓ Total LQTY tokens issued is 31,999,969.48 after 20 years (68ms) - ✓ Total LQTY tokens issued is 31,999,999.97 after 30 years (87ms) - - Frequent token issuance: issuance event every year, for 30 years - - Frequent token issuance: issuance event every day, for 30 years - - Frequent token issuance: issuance event every minute, for 1 month - - Frequent token issuance: issuance event every minute, for 1 year - - Contract: FeeRecipient revenue share tests - ✓ stake(): reverts if amount is zero (74ms) - ✓ ETH fee per LQTY staked increases when a redemption fee is triggered and totalStakes > 0 (1562ms) - ✓ ETH fee per LQTY staked doesn't change when a redemption fee is triggered and totalStakes == 0 (3540ms) - ✓ EBTC fee per LQTY staked increases when a redemption fee is triggered and totalStakes > 0 (1757ms) - ✓ EBTC fee per LQTY staked doesn't change when a redemption fee is triggered and totalStakes == 0 (1705ms) - ✓ LQTY Staking: A single staker earns all ETH and LQTY fees that occur (2143ms) - ✓ stake(): Top-up sends out all accumulated ETH and EBTC gains to the staker (2138ms) - ✓ getPendingETHGain(): Returns the staker's correct pending ETH gain (1856ms) - ✓ getPendingEBTCGain(): Returns the staker's correct pending EBTC gain (1965ms) - ✓ LQTY Staking: Multiple stakers earn the correct share of all ETH and LQTY fees, based on their stake size (3133ms) - ✓ unstake(): reverts if caller has ETH gains and can't receive ETH (1149ms) - ✓ receive(): reverts when it receives ETH from an address that is not the Active Pool - ✓ unstake(): reverts if user has no stake - ✓ Test requireCallerIsCdpManager - - Contract: EBTCToken - Basic token functions, without Proxy - ✓ balanceOf(): gets the balance of the account - ✓ totalSupply(): gets the total supply - ✓ name(): returns the token's name - ✓ symbol(): returns the token's symbol - ✓ decimal(): returns the number of decimal digits used - ✓ allowance(): returns an account's spending allowance for another account's balance (77ms) - ✓ approve(): approves an account to spend the specified amount - ✓ approve(): reverts when spender param is address(0) - ✓ approve(): reverts when owner param is address(0) - ✓ transferFrom(): successfully transfers from an account which is it approved to transfer from (272ms) - ✓ transfer(): increases the recipient's balance by the correct amount - ✓ transfer(): reverts if amount exceeds sender's balance - ✓ transfer(): transferring to a blacklisted address reverts (79ms) - ✓ increaseAllowance(): increases an account's allowance by the correct amount (94ms) - ✓ mint(): issues correct amount of tokens to the given address - ✓ burn(): burns correct amount of tokens from the given address - ✓ sendToPool(): changes balances of Stability pool and user by the correct amounts - ✓ returnFromPool(): changes balances of Stability pool and user by the correct amounts (39ms) - ✓ transfer(): transferring to a blacklisted address reverts (76ms) - ✓ decreaseAllowance(): decreases allowance by the expected amount (38ms) - ✓ decreaseAllowance(): fails trying to decrease more than previously allowed (39ms) - ✓ version(): returns the token contract's version - ✓ Initializes PERMIT_TYPEHASH correctly - ✓ Initializes DOMAIN_SEPARATOR correctly - ✓ Initial nonce for a given address is 0 - ✓ permits and emits an Approval event (replay protected) (69ms) - ✓ permits(): fails with expired deadline (59ms) - ✓ permits(): fails with the wrong signature (51ms) - Basic token functions, with Proxy - ✓ balanceOf(): gets the balance of the account (92ms) - ✓ totalSupply(): gets the total supply (51ms) - ✓ name(): returns the token's name - ✓ symbol(): returns the token's symbol - ✓ decimal(): returns the number of decimal digits used - ✓ allowance(): returns an account's spending allowance for another account's balance - ✓ approve(): approves an account to spend the specified amount - ✓ transferFrom(): successfully transfers from an account which is it approved to transfer from (90ms) - ✓ transfer(): increases the recipient's balance by the correct amount - ✓ transfer(): reverts if amount exceeds sender's balance - ✓ transfer(): transferring to a blacklisted address reverts (213ms) - ✓ increaseAllowance(): increases an account's allowance by the correct amount (39ms) - ✓ transfer(): transferring to a blacklisted address reverts (112ms) - ✓ decreaseAllowance(): decreases allowance by the expected amount - ✓ decreaseAllowance(): fails trying to decrease more than previously allowed (49ms) - - Contract: All Liquity functions with onlyOwner modifier - CdpManager - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (857ms) - BorrowerOperations - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (765ms) - DefaultPool - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (154ms) - StabilityPool - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (441ms) - ActivePool - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (468ms) - SortedCdps - ✓ setParams(): reverts when called by non-owner, with wrong addresses, or twice (157ms) - CommunityIssuance - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (136ms) - FeeRecipient - ✓ setAddresses(): reverts when called by non-owner, with wrong addresses, or twice (261ms) - LockupContractFactory - ✓ setLQTYAddress(): reverts when called by non-owner, with wrong address, or twice (216ms) - - Contract: StabilityPool - ✓ getSystemCollShares(): gets the recorded ETH balance - ✓ getTotalEBTCDeposits(): gets the recorded EBTC balance - - Contract: ActivePool - ✓ getSystemCollShares(): gets the recorded ETH balance - ✓ getSystemDebt(): gets the recorded EBTC balance - ✓ increaseEBTC(): increases the recorded EBTC balance by the correct amount - ✓ decreaseEBTC(): decreases the recorded EBTC balance by the correct amount - ✓ transferSystemCollShares(): decreases the recorded ETH balance by the correct amount - - Contract: DefaultPool - ✓ getSystemCollShares(): gets the recorded EBTC balance - ✓ getSystemDebt(): gets the recorded EBTC balance - ✓ increaseEBTC(): increases the recorded EBTC balance by the correct amount - ✓ decreaseEBTC(): decreases the recorded EBTC balance by the correct amount (57ms) - ✓ sendETHToActivePool(): decreases the recorded ETH balance by the correct amount (50ms) - - Contract: PriceFeed - ✓ C1 Chainlink working: fetchPrice should return the correct price, taking into account the number of decimal digits on the aggregator (286ms) - ✓ C1 Chainlink breaks, Tellor working: fetchPrice should return the correct Tellor price, taking into account Tellor's 6-digit granularity (2595ms) - ✓ C1 chainlinkWorking: Chainlink broken by zero latest roundId, Tellor working: switch to usingChainlinkTellorUntrusted (87ms) - ✓ C1 chainlinkWorking: Chainlink broken by zero latest roundId, Tellor working: use Tellor price (93ms) - ✓ C1 chainlinkWorking: Chainlink broken by zero timestamp, Tellor working, switch to usingChainlinkTellorUntrusted (97ms) - ✓ C1 chainlinkWorking: Chainlink broken by zero timestamp, Tellor working, return Tellor price (97ms) - ✓ C1 chainlinkWorking: Chainlink broken by future timestamp, Tellor working, switch to usingChainlinkTellorUntrusted (94ms) - ✓ C1 chainlinkWorking: Chainlink broken by future timestamp, Tellor working, return Tellor price (99ms) - ✓ C1 chainlinkWorking: Chainlink broken by negative price, Tellor working, switch to usingChainlinkTellorUntrusted (85ms) - ✓ C1 chainlinkWorking: Chainlink broken by negative price, Tellor working, return Tellor price (82ms) - ✓ C1 chainlinkWorking: Chainlink broken - decimals call reverted, Tellor working, switch to usingChainlinkTellorUntrusted (117ms) - ✓ C1 chainlinkWorking: Chainlink broken - decimals call reverted, Tellor working, return Tellor price (99ms) - ✓ C1 chainlinkWorking: Chainlink broken - latest round call reverted, Tellor working, switch to usingChainlinkTellorUntrusted (92ms) - ✓ C1 chainlinkWorking: latest round call reverted, Tellor working, return the Tellor price (100ms) - ✓ C1 chainlinkWorking: previous round call reverted, Tellor working, switch to usingChainlinkTellorUntrusted (101ms) - ✓ C1 chainlinkWorking: previous round call reverted, Tellor working, return Tellor Price (102ms) - ✓ C1 chainlinkWorking: Chainlink frozen, Tellor working: switch to usingTellorChainlinkFrozen (112ms) - ✓ C1 chainlinkWorking: Chainlink frozen, Tellor working: return Tellor price (123ms) - ✓ C1 chainlinkWorking: Chainlink frozen, Tellor frozen: switch to usingTellorChainlinkFrozen (119ms) - ✓ C1 chainlinkWorking: Chainlink frozen, Tellor frozen: return last good price (127ms) - ✓ C1 chainlinkWorking: Chainlink times out, Tellor broken by 0 price: switch to usingChainlinkTellorUntrusted (320ms) - ✓ C1 chainlinkWorking: Chainlink times out, Tellor broken by 0 price: return last good price (146ms) - ✓ C1 chainlinkWorking: Chainlink is out of date by <3hrs: remain chainlinkWorking (92ms) - ✓ C1 chainlinkWorking: Chainlink is out of date by <3hrs: return Chainklink price (132ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50%, switch to usingChainlinkTellorUntrusted (117ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50%, return the Tellor price (132ms) - ✓ C1 chainlinkWorking: Chainlink price drop of 50%, remain chainlinkWorking (83ms) - ✓ C1 chainlinkWorking: Chainlink price drop of 50%, return the Chainlink price (376ms) - ✓ C1 chainlinkWorking: Chainlink price drop of <50%, remain chainlinkWorking (89ms) - ✓ C1 chainlinkWorking: Chainlink price drop of <50%, return Chainlink price (99ms) - ✓ C1 chainlinkWorking: Chainlink price increase of >100%, switch to usingChainlinkTellorUntrusted (473ms) - ✓ C1 chainlinkWorking: Chainlink price increase of >100%, return Tellor price (117ms) - ✓ C1 chainlinkWorking: Chainlink price increase of 100%, remain chainlinkWorking (82ms) - ✓ C1 chainlinkWorking: Chainlink price increase of 100%, return Chainlink price (350ms) - ✓ C1 chainlinkWorking: Chainlink price increase of <100%, remain chainlinkWorking (136ms) - ✓ C1 chainlinkWorking: Chainlink price increase of <100%, return Chainlink price (87ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor price matches: remain chainlinkWorking (154ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor price matches: return Chainlink price (135ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor price within 5% of Chainlink: remain chainlinkWorking (109ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor price within 5% of Chainlink: return Chainlink price (101ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor live but not within 5% of Chainlink: switch to usingChainlinkTellorUntrusted (116ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor live but not within 5% of Chainlink: return Tellor price (276ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor frozen: switch to usingChainlinkTellorUntrusted (145ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor frozen: return last good price (2730ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by 0 price: switch to bothOracleSuspect (68ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by 0 price: return last good price (451ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by 0 timestamp: switch to bothOracleSuspect (121ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by 0 timestamp: return last good price (87ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by future timestamp: Pricefeed switches to bothOracleSuspect (81ms) - ✓ C1 chainlinkWorking: Chainlink price drop of >50% and Tellor is broken by future timestamp: return last good price (119ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor is working - remain on chainlinkWorking (77ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor is working - return Chainlink price (168ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor freezes - remain on chainlinkWorking (469ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor freezes - return Chainlink price (167ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor breaks: switch to usingChainlinkTellorUntrusted (206ms) - ✓ C1 chainlinkWorking: Chainlink is working and Tellor breaks: return Chainlink price (105ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by zero price: switch to bothOraclesSuspect (202ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by zero price: return last good price (107ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by call reverted: switch to bothOraclesSuspect (296ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by call reverted: return last good price (112ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by zero timestamp: switch to bothOraclesSuspect (2577ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor breaks by zero timestamp: return last good price (82ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor freezes - remain usingChainlinkTellorUntrusted (534ms) - ✓ C2 usingTellorChainlinkUntrusted: Tellor freezes - return last good price (123ms) - ✓ C2 usingTellorChainlinkUntrusted: both Tellor and Chainlink are live and <= 5% price difference - switch to chainlinkWorking (68ms) - ✓ C2 usingTellorChainlinkUntrusted: both Tellor and Chainlink are live and <= 5% price difference - return Chainlink price (65ms) - ✓ C2 usingTellorChainlinkUntrusted: both Tellor and Chainlink are live and > 5% price difference - remain usingChainlinkTellorUntrusted (86ms) - ✓ C2 usingTellorChainlinkUntrusted: both Tellor and Chainlink are live and > 5% price difference - return Tellor price (569ms) - ✓ C3 bothOraclesUntrusted: both Tellor and Chainlink are live and > 5% price difference remain bothOraclesSuspect (56ms) - ✓ C3 bothOraclesUntrusted: both Tellor and Chainlink are live and > 5% price difference, return last good price (82ms) - ✓ C3 bothOraclesUntrusted: both Tellor and Chainlink are live and <= 5% price difference, switch to chainlinkWorking (72ms) - ✓ C3 bothOraclesUntrusted: both Tellor and Chainlink are live and <= 5% price difference, return Chainlink price (84ms) - ✓ C4 usingTellorChainlinkFrozen: when both Chainlink and Tellor break, switch to bothOraclesSuspect (459ms) - ✓ C4 usingTellorChainlinkFrozen: when both Chainlink and Tellor break, return last good price (112ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink breaks and Tellor freezes, switch to usingChainlinkTellorUntrusted (112ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink breaks and Tellor freezes, return last good price (99ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink breaks and Tellor live, switch to usingChainlinkTellorUntrusted (106ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink breaks and Tellor live, return Tellor price (102ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with <5% price difference, switch back to chainlinkWorking (113ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with <5% price difference, return Chainlink current price (138ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with >5% price difference, switch back to usingChainlinkTellorUntrusted (2467ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with >5% price difference, return Chainlink current price (85ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with similar price, switch back to chainlinkWorking (537ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor is live with similar price, return Chainlink current price (82ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor breaks, switch to usingChainlinkTellorUntrusted (187ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink is live and Tellor breaks, return Chainlink current price (81ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor breaks, switch to usingChainlinkTellorUntrusted (176ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor broken, return last good price (213ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor live, remain usingTellorChainlinkFrozen (140ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor live, return Tellor price (236ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor freezes, remain usingTellorChainlinkFrozen (107ms) - ✓ C4 usingTellorChainlinkFrozen: when Chainlink still frozen and Tellor freezes, return last good price (261ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live and Tellor price >5% - no status change (109ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live and Tellor price >5% - return Chainlink price (96ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live and Tellor price within <5%, switch to chainlinkWorking (171ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, Tellor price not within 5%, return Chainlink price (111ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, <50% price deviation from previous, Tellor price not within 5%, remain on usingChainlinkTellorUntrusted (161ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, <50% price deviation from previous, Tellor price not within 5%, return Chainlink price (223ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, >50% price deviation from previous, Tellor price not within 5%, remain on usingChainlinkTellorUntrusted (124ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, >50% price deviation from previous, Tellor price not within 5%, return Chainlink price (182ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, <50% price deviation from previous, and Tellor is frozen, remain on usingChainlinkTellorUntrusted (552ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, <50% price deviation from previous, Tellor is frozen, return Chainlink price (103ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, >50% price deviation from previous, Tellor is frozen, remain on usingChainlinkTellorUntrusted (121ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink is live, >50% price deviation from previous, Tellor is frozen, return Chainlink price (105ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink frozen, remain on usingChainlinkTellorUntrusted (107ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink frozen, return last good price (531ms) - ✓ C5 usingChainlinkTellorUntrusted: when Chainlink breaks too, switch to bothOraclesSuspect (87ms) - ✓ C5 usingChainlinkTellorUntrusted: Chainlink breaks too, return last good price (99ms) - PriceFeed internal testing contract - ✓ fetchPrice before setPrice should return the default price - ✓ should be able to fetchPrice after setPrice, output of former matching input of latter - Mainnet PriceFeed setup - ✓ fetchPrice should fail on contract with no chainlink address set - ✓ fetchPrice should fail on contract with no tellor address set - ✓ setAddresses should fail whe called by nonOwner - ✓ setAddresses should fail after address has already been set (42ms) - - Contract: BorrowerWrappers - ✓ proxy owner can recover ETH (85ms) - ✓ non proxy owner cannot recover ETH - ✓ claimCollateralAndOpenCdp(): reverts if nothing to claim (388ms) - ✓ claimCollateralAndOpenCdp(): without sending any value (1227ms) - ✓ claimCollateralAndOpenCdp(): sending value in the transaction (3969ms) - ✓ claimSPRewardsAndRecycle(): only owner can call it (598ms) - ✓ claimSPRewardsAndRecycle(): (1272ms) - ✓ claimStakingGainsAndRecycle(): only owner can call it (1384ms) - ✓ claimStakingGainsAndRecycle(): reverts if user has no cdp (1253ms) - ✓ claimStakingGainsAndRecycle(): with only ETH gain (1595ms) - ✓ claimStakingGainsAndRecycle(): with only EBTC gain (821ms) - ✓ claimStakingGainsAndRecycle(): with both ETH and EBTC gains (1593ms) - - Contract: SortedCdps - SortedCdps - ✓ contains(): returns true for addresses that have opened cdps (552ms) - ✓ contains(): returns false for addresses that have not opened cdps (518ms) - ✓ contains(): returns false for addresses that opened and then closed a cdp (1009ms) - ✓ contains(): returns true for addresses that opened, closed and then re-opened a cdp (1399ms) - ✓ contains(): returns false when there are no cdps in the system - ✓ contains(): true when list size is 1 and the cdp the only one in system (208ms) - ✓ contains(): false when list size is 1 and cdp is not in the system (158ms) - ✓ getMaxSize(): Returns the maximum list size - ✓ Finds the correct insert position given two addresses that loosely bound the correct position (1135ms) - - stays ordered after cdps with 'infinite' ICR receive a redistribution - SortedCdps with mock dependencies - when params are wrongly set - ✓ setParams(): reverts if size is zero - when params are properly set - ✓ insert(): fails if list is full (131ms) - ✓ insert(): fails if list already contains the node (54ms) - ✓ insert(): fails if id is zero - ✓ insert(): fails if NICR is zero - ✓ remove(): fails if id is not in the list - ✓ reInsert(): fails if list doesn’t contain the node - ✓ reInsert(): fails if new NICR is zero (43ms) - ✓ findInsertPosition(): No prevId for hint - ascend list starting from nextId, result is after the tail - - Contract: StabilityPool - LQTY Rewards - LQTY Rewards -totalLQTYIssued_1: 30370113195977152000000 -totalLQTYIssued_2: 30370113195977152000000 - ✓ liquidation < 1 minute after a deposit does not change totalLQTYIssued (743ms) - ✓ withdrawFromSP(): reward term G does not update when no LQTY is issued (634ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct LQTY gain. No liquidations. No front end. (1479ms) - ✓ withdrawFromSP(): Depositors with varying initial deposit withdraw correct LQTY gain. No liquidations. No front end. (1345ms) - ✓ withdrawFromSP(): Depositors with varying initial deposit withdraw correct LQTY gain. No liquidations. No front end. (1925ms) - ✓ withdrawFromSP(): Depositor withdraws correct LQTY gain after serial pool-emptying liquidations. No front-ends. (5752ms) - ✓ LQTY issuance for a given period is not obtainable if the SP was empty during the period (551ms) - ✓ withdrawFromSP(): Several deposits of 100 EBTC span one scale factor change. Depositors withdraw correct LQTY gains (6075ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct LQTY gain. No liquidations. Front ends and kickback rates. (1660ms) - ✓ withdrawFromSP(): Depositors with varying initial deposit withdraw correct LQTY gain. Front ends and kickback rates (2813ms) - ✓ withdrawFromSP(): Several deposits of 10k EBTC span one scale factor change. Depositors withdraw correct LQTY gains (4788ms) - - Contract: Pool Manager: Sum-Product rounding errors - - Rounding errors: 100 deposits of 100EBTC into SP, then 200 liquidations of 49EBTC - - Contract: StabilityPool - Withdrawal of stability deposit - Reward calculations - Stability Pool Withdrawal - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after one liquidation (757ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after two identical liquidations (868ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after three identical liquidations (1051ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after two liquidations of increasing EBTC (965ms) - ✓ withdrawFromSP(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after three liquidations of increasing EBTC (1152ms) - ✓ withdrawFromSP(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after two identical liquidations (934ms) - ✓ withdrawFromSP(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after three identical liquidations (1130ms) - ✓ withdrawFromSP(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after three varying liquidations (1193ms) - - ✓ withdrawFromSP(): A, B, C Deposit -> 2 liquidations -> D deposits -> 1 liquidation. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1512ms) - ✓ withdrawFromSP(): A, B, C Deposit -> 2 liquidations -> D deposits -> 2 liquidations. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1637ms) - ✓ withdrawFromSP(): A, B, C Deposit -> 2 liquidations -> D deposits -> 2 liquidations. Various deposit and liquidation vals. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1645ms) - ✓ withdrawFromSP(): A, B, C, D deposit -> 2 liquidations -> D withdraws -> 2 liquidations. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1704ms) - ✓ withdrawFromSP(): A, B, C, D deposit -> 2 liquidations -> D withdraws -> 2 liquidations. Various deposit and liquidation vals. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1753ms) - ✓ withdrawFromSP(): A, B, D deposit -> 2 liquidations -> C makes deposit -> 1 liquidation -> D withdraws -> 1 liquidation. All deposits: 100 EBTC. Liquidations: 100,100,100,50. A, B, C, D withdraw correct EBTC deposit and ETH Gain (1537ms) - ✓ withdrawFromSP(): Depositor withdraws correct compounded deposit after liquidation empties the pool (3424ms) - ✓ withdrawFromSP(): Pool-emptying liquidation increases epoch by one, resets scaleFactor to 0, and resets P to 1e18 (1678ms) - ✓ withdrawFromSP(): Depositors withdraw correct compounded deposit after liquidation empties the pool (1100ms) - ✓ withdrawFromSP(): single deposit fully offset. After subsequent liquidations, depositor withdraws 0 deposit and *only* the ETH Gain from one liquidation (1049ms) - ✓ withdrawFromSP(): Depositor withdraws correct compounded deposit after liquidation empties the pool (4540ms) - ✓ withdrawFromSP(): deposit spans one scale factor change: Single depositor withdraws correct compounded deposit and ETH Gain after one liquidation (918ms) - ✓ withdrawFromSP(): Several deposits of varying amounts span one scale factor change. Depositors withdraw correct compounded deposit and ETH Gain after one liquidation (1187ms) - ✓ withdrawFromSP(): deposit spans one scale factor change: Single depositor withdraws correct compounded deposit and ETH Gain after one liquidation (778ms) - ✓ withdrawFromSP(): Several deposits of varying amounts span one scale factor change. Depositors withdraws correct compounded deposit and ETH Gain after one liquidation (3494ms) -alice deposit: 0 - ✓ withdrawFromSP(): Deposit that decreases to less than 1e-9 of it's original value is reduced to 0 (365ms) - ✓ withdrawFromSP(): Several deposits of 10000 EBTC span one scale factor change. Depositors withdraws correct compounded deposit and ETH Gain after one liquidation (1676ms) - ✓ withdrawFromSP(): 2 depositors can withdraw after each receiving half of a pool-emptying liquidation (1848ms) - ✓ withdrawFromSP(): Depositor's ETH gain stops increasing after two scale changes (4134ms) - ✓ withdrawFromSP(): Large liquidated coll/debt, deposits and ETH price (932ms) - ✓ withdrawFromSP(): Small liquidated coll/debt, large deposits and ETH price (832ms) - - Contract: StabilityPool - Withdrawal of stability deposit - Reward calculations - Stability Pool Withdrawal - ✓ withdrawETHGainToCdp(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after one liquidation (1227ms) - ✓ withdrawETHGainToCdp(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after two identical liquidations (1400ms) - ✓ withdrawETHGainToCdp(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after three identical liquidations (1827ms) - ✓ withdrawETHGainToCdp(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after two liquidations of increasing EBTC (1597ms) - ✓ withdrawETHGainToCdp(): Depositors with equal initial deposit withdraw correct compounded deposit and ETH Gain after three liquidations of increasing EBTC (1711ms) - ✓ withdrawETHGainToCdp(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after two identical liquidations (1782ms) - ✓ withdrawETHGainToCdp(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after three identical liquidations (1798ms) - ✓ withdrawETHGainToCdp(): Depositors with varying deposits withdraw correct compounded deposit and ETH Gain after three varying liquidations (4488ms) - - ✓ withdrawETHGainToCdp(): A, B, C Deposit -> 2 liquidations -> D deposits -> 1 liquidation. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (2168ms) - ✓ withdrawETHGainToCdp(): A, B, C Deposit -> 2 liquidations -> D deposits -> 2 liquidations. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (5085ms) - ✓ withdrawETHGainToCdp(): A, B, C Deposit -> 2 liquidations -> D deposits -> 2 liquidations. Various deposit and liquidation vals. A, B, C, D withdraw correct EBTC deposit and ETH Gain (2304ms) - ✓ withdrawETHGainToCdp(): A, B, C, D deposit -> 2 liquidations -> D withdraws -> 2 liquidations. All deposits and liquidations = 100 EBTC. A, B, C, D withdraw correct EBTC deposit and ETH Gain (2335ms) - ✓ withdrawETHGainToCdp(): A, B, C, D deposit -> 2 liquidations -> D withdraws -> 2 liquidations. Various deposit and liquidation vals. A, B, C, D withdraw correct EBTC deposit and ETH Gain (2145ms) - ✓ withdrawETHGainToCdp(): A, B, D deposit -> 2 liquidations -> C makes deposit -> 1 liquidation -> D withdraws -> 1 liquidation. All deposits: 100 EBTC. Liquidations: 100,100,100,50. A, B, C, D withdraw correct EBTC deposit and ETH Gain (2543ms) - ✓ withdrawETHGainToCdp(): Depositor withdraws correct compounded deposit after liquidation empties the pool (1889ms) - ✓ withdrawETHGainToCdp(): Pool-emptying liquidation increases epoch by one, resets scaleFactor to 0, and resets P to 1e18 (1891ms) - ✓ withdrawETHGainToCdp(): Depositors withdraw correct compounded deposit after liquidation empties the pool (2324ms) - ✓ withdrawETHGainToCdp(): single deposit fully offset. After subsequent liquidations, depositor withdraws 0 deposit and *only* the ETH Gain from one liquidation (1719ms) - ✓ withdrawETHGainToCdp(): Depositor withdraws correct compounded deposit after liquidation empties the pool (3958ms) - ✓ withdrawETHGainToCdp(): deposit spans one scale factor change: Single depositor withdraws correct compounded deposit and ETH Gain after one liquidation (1276ms) - ✓ withdrawETHGainToCdp(): Several deposits of varying amounts span one scale factor change. Depositors withdraw correct compounded deposit and ETH Gain after one liquidation (4690ms) - ✓ withdrawETHGainToCdp(): deposit spans one scale factor change: Single depositor withdraws correct compounded deposit and ETH Gain after one liquidation (1460ms) - ✓ withdrawETHGainToCdp(): Several deposits of varying amounts span one scale factor change. Depositors withdraws correct compounded deposit and ETH Gain after one liquidation (1986ms) -alice deposit: 0 - ✓ withdrawETHGainToCdp(): Deposit that decreases to less than 1e-9 of it's original value is reduced to 0 (3725ms) - ✓ withdrawETHGainToCdp(): Several deposits of 10000 EBTC span one scale factor change. Depositors withdraws correct compounded deposit and ETH Gain after one liquidation (2361ms) - ✓ withdrawETHGainToCdp(): 2 depositors can withdraw after each receiving half of a pool-emptying liquidation (3814ms) - ✓ withdrawETHGainToCdp(): Large liquidated coll/debt, deposits and ETH price (959ms) - ✓ withdrawETHGainToCdp(): Small liquidated coll/debt, large deposits and ETH price (784ms) - - Contract: StabilityPool - Stability Pool Mechanisms - ✓ provideToSP(): increases the Stability Pool EBTC balance (354ms) - ✓ provideToSP(): updates the user's deposit record in StabilityPool (355ms) - ✓ provideToSP(): reduces the user's EBTC balance by the correct amount (321ms) - ✓ provideToSP(): increases totalEBTCDeposits by correct amount (283ms) - ✓ provideToSP(): Correctly updates user snapshots of accumulated rewards per unit staked (4003ms) - ✓ provideToSP(), multiple deposits: updates user's deposit and snapshots (2543ms) - ✓ provideToSP(): reverts if user tries to provide more than their EBTC balance (1030ms) - ✓ provideToSP(): reverts if user tries to provide 2^256-1 EBTC, which exceeds their balance (508ms) - ✓ provideToSP(): reverts if cannot receive ETH Gain (1073ms) - ✓ provideToSP(): doesn't impact other users' deposits or ETH gains (1906ms) - ✓ provideToSP(): doesn't impact system debt, collateral or TCR (2287ms) - ✓ provideToSP(): doesn't impact any cdps, including the caller's cdp (1810ms) - ✓ provideToSP(): doesn't protect the depositor's cdp from liquidation (1082ms) - ✓ provideToSP(): providing 0 EBTC reverts (1091ms) - ✓ provideToSP(), new deposit: when SP > 0, triggers LQTY reward event - increases the sum G (1072ms) - ✓ provideToSP(), new deposit: when SP is empty, doesn't update G (4734ms) - ✓ provideToSP(), new deposit: sets the correct front end tag (1128ms) - ✓ provideToSP(), new deposit: depositor does not receive any LQTY rewards (671ms) - ✓ provideToSP(), new deposit after past full withdrawal: depositor does not receive any LQTY rewards (1679ms) - ✓ provideToSP(), new eligible deposit: tagged front end receives LQTY rewards (1605ms) - ✓ provideToSP(), new eligible deposit: tagged front end's stake increases (848ms) - ✓ provideToSP(), new eligible deposit: tagged front end's snapshots update (1913ms) - ✓ provideToSP(), new deposit: depositor does not receive ETH gains (957ms) - ✓ provideToSP(), new deposit after past full withdrawal: depositor does not receive ETH gains (1928ms) - ✓ provideToSP(), topup: triggers LQTY reward event - increases the sum G (1007ms) - ✓ provideToSP(), topup from different front end: doesn't change the front end tag (1511ms) - ✓ provideToSP(), topup: depositor receives LQTY rewards (1487ms) - ✓ provideToSP(), topup: tagged front end receives LQTY rewards (1036ms) - ✓ provideToSP(), topup: tagged front end's stake increases (1816ms) - ✓ provideToSP(), topup: tagged front end's snapshots update (1816ms) - ✓ provideToSP(): reverts when amount is zero (686ms) - ✓ provideToSP(): reverts if user is a registered front end (802ms) - ✓ provideToSP(): reverts if provided tag is not a registered front end (587ms) - ✓ withdrawFromSP(): reverts when user has no active deposit (597ms) - ✓ withdrawFromSP(): reverts when amount > 0 and system has an undercollateralized cdp (453ms) - ✓ withdrawFromSP(): partial retrieval - retrieves correct EBTC amount and the entire ETH Gain, and updates deposit (1102ms) - ✓ withdrawFromSP(): partial retrieval - leaves the correct amount of EBTC in the Stability Pool (1128ms) - ✓ withdrawFromSP(): full retrieval - leaves the correct amount of EBTC in the Stability Pool (1091ms) - ✓ withdrawFromSP(): Subsequent deposit and withdrawal attempt from same account, with no intermediate liquidations, withdraws zero ETH (1494ms) - ✓ withdrawFromSP(): it correctly updates the user's EBTC and ETH snapshots of entitled reward per unit staked (1049ms) - ✓ withdrawFromSP(): decreases StabilityPool ETH (3952ms) - ✓ withdrawFromSP(): All depositors are able to withdraw from the SP to their account (2393ms) - ✓ withdrawFromSP(): increases depositor's EBTC token balance by the expected amount (2098ms) - ✓ withdrawFromSP(): doesn't impact other users Stability deposits or ETH gains (4954ms) - ✓ withdrawFromSP(): doesn't impact system debt, collateral or TCR (1500ms) - ✓ withdrawFromSP(): doesn't impact any cdps, including the caller's cdp (1085ms) - ✓ withdrawFromSP(): succeeds when amount is 0 and system has an undercollateralized cdp (933ms) - ✓ withdrawFromSP(): withdrawing 0 EBTC doesn't alter the caller's deposit or the total EBTC in the Stability Pool (993ms) - ✓ withdrawFromSP(): withdrawing 0 ETH Gain does not alter the caller's ETH balance, their cdp collateral, or the ETH in the Stability Pool (1139ms) - ✓ withdrawFromSP(): Request to withdraw > caller's deposit only withdraws the caller's compounded deposit (1260ms) - ✓ withdrawFromSP(): Request to withdraw 2^256-1 EBTC only withdraws the caller's compounded deposit (1229ms) - ✓ withdrawFromSP(): caller can withdraw full deposit and ETH gain during Recovery Mode (4371ms) - ✓ getDepositorETHGain(): depositor does not earn further ETH gains from liquidations while their compounded deposit == 0: (1831ms) - ✓ withdrawFromSP(): triggers LQTY reward event - increases the sum G (982ms) - ✓ withdrawFromSP(), partial withdrawal: doesn't change the front end tag (1421ms) - ✓ withdrawFromSP(), partial withdrawal: depositor receives LQTY rewards (1155ms) - ✓ withdrawFromSP(), partial withdrawal: tagged front end receives LQTY rewards (1245ms) - ✓ withdrawFromSP(), partial withdrawal: tagged front end's stake decreases (1803ms) - ✓ withdrawFromSP(), partial withdrawal: tagged front end's snapshots update (1713ms) - ✓ withdrawFromSP(), full withdrawal: removes deposit's front end tag (970ms) - ✓ withdrawFromSP(), full withdrawal: zero's depositor's snapshots (1434ms) - ✓ withdrawFromSP(), full withdrawal that reduces front end stake to 0: zero’s the front end’s snapshots (1248ms) - ✓ withdrawFromSP(), reverts when initial deposit value is 0 (1037ms) - ✓ withdrawETHGainToCdp(): reverts when user has no active deposit (1043ms) - ✓ withdrawETHGainToCdp(): Applies EBTCLoss to user's deposit, and redirects ETH reward to user's Cdp (932ms) - ✓ withdrawETHGainToCdp(): reverts if it would leave cdp with ICR < MCR (3920ms) - ✓ withdrawETHGainToCdp(): Subsequent deposit and withdrawal attempt from same account, with no intermediate liquidations, withdraws zero ETH (976ms) - ✓ withdrawETHGainToCdp(): decreases StabilityPool ETH and increases activePool ETH (976ms) - ✓ withdrawETHGainToCdp(): All depositors are able to withdraw their ETH gain from the SP to their Cdp (5974ms) - ✓ withdrawETHGainToCdp(): All depositors withdraw, each withdraw their correct ETH gain (2591ms) - ✓ withdrawETHGainToCdp(): caller can withdraw full deposit and ETH gain to their cdp during Recovery Mode (1629ms) - ✓ withdrawETHGainToCdp(): reverts if user has no cdp (967ms) - ✓ withdrawETHGainToCdp(): triggers LQTY reward event - increases the sum G (1298ms) - ✓ withdrawETHGainToCdp(), partial withdrawal: doesn't change the front end tag (4778ms) - ✓ withdrawETHGainToCdp(), eligible deposit: depositor receives LQTY rewards (1607ms) - ✓ withdrawETHGainToCdp(), eligible deposit: tagged front end receives LQTY rewards (1701ms) - ✓ withdrawETHGainToCdp(), eligible deposit: tagged front end's stake decreases (5345ms) - ✓ withdrawETHGainToCdp(), eligible deposit: tagged front end's snapshots update (1984ms) - ✓ withdrawETHGainToCdp(): reverts when depositor has no ETH gain (1172ms) - ✓ registerFrontEnd(): registers the front end and chosen kickback rate (173ms) - ✓ registerFrontEnd(): reverts if the front end is already registered (196ms) - ✓ registerFrontEnd(): reverts if the kickback rate >1 (57ms) - ✓ registerFrontEnd(): reverts if address has a non-zero deposit already (702ms) - - Contract: CdpManager -totalStakesSnapshot after L1: 200000002000000000000000000000 -totalCollateralSnapshot after L1: 399000002000000000000000000000 -Snapshots ratio after L1: 501253135332064484 -B pending ETH reward after L1: 39799999602000003960000000000 -B stake after L1: 40000000000000000000000000000 -B stake after A1: 39999999999999999989974957243 -Snapshots ratio after A1: 501253135332064484 -B stake after L2: 39999999999999999989974957243 -Snapshots ratio after L2: 501253134833317619 -B stake after A2: 39999999999999999983267686056 -B stake after L3: 39999999999999999983267686056 -Snapshots ratio after L3: 501253134334570755 -B stake after A3: 39999999999999999978023472178 -B stake after L4: 39999999999999999978023472178 -Snapshots ratio after L4: 501253133835823890 -B stake after A4: 39999999999999999993921497875 -B stake after L5: 39999999999999999993921497875 -Snapshots ratio after L5: 501253133337077025 -B stake after A5: 39999999999999999994797348633 -B stake after L6: 39999999999999999994797348633 -Snapshots ratio after L6: 501253132838330161 -B stake after A6: 39999999999999999993468266716 -B stake after L7: 39999999999999999993468266716 -Snapshots ratio after L7: 501253132339583296 -B stake after A7: 39999999999999999992497700314 -B stake after L8: 39999999999999999992497700314 -Snapshots ratio after L8: 501253131840836431 -B stake after A8: 39999999999999999992398338824 -B stake after L9: 39999999999999999992398338824 -Snapshots ratio after L9: 501253131342089567 -B stake after A9: 39999999999999999993272719884 -B stake after L10: 39999999999999999993272719884 -Snapshots ratio after L10: 501253130843342702 -B stake after A10: 39999999999999999995141350785 -B stake after L11: 39999999999999999995141350785 -Snapshots ratio after L11: 501253130344595837 -B stake after A11: 39999999999999999998008332745 - ✓ A given cdp's stake decline is negligible with adjustments and tiny liquidations (4988ms) - - Contract: CdpManager - Redistribution reward calculations - ✓ redistribution: A, B Open. B Liquidated. C, D Open. D Liquidated. Distributes correct rewards (1514ms) - ✓ redistribution: A, B, C Open. C Liquidated. D, E, F Open. F Liquidated. Distributes correct rewards (1537ms) - ✓ redistribution: Sequence of alternate opening/liquidation: final surviving cdp has ETH from all previously liquidated cdps (1667ms) - ✓ redistribution: A,B,C,D,E open. Liq(A). B adds coll. Liq(C). B and D have correct coll and debt (1915ms) - ✓ redistribution: A,B,C,D open. Liq(A). B adds coll. Liq(C). B and D have correct coll and debt (1962ms) - ✓ redistribution: A,B,C Open. Liq(C). B adds coll. Liq(A). B acquires all coll and debt (1102ms) - ✓ redistribution: A,B,C Open. Liq(C). B tops up coll. D Opens. Liq(D). Distributes correct rewards. (1133ms) - ✓ redistribution: Cdp with the majority stake tops up. A,B,C, D open. Liq(D). C tops up. E Enters, Liq(E). Distributes correct rewards (1217ms) - ✓ redistribution: Cdp with the majority stake tops up. A,B,C, D open. Liq(D). A, B, C top up. E Enters, Liq(E). Distributes correct rewards (1627ms) - ✓ redistribution: A,B,C Open. Liq(C). B withdraws coll. Liq(A). B acquires all coll and debt (1062ms) - ✓ redistribution: A,B,C Open. Liq(C). B withdraws coll. D Opens. Liq(D). Distributes correct rewards. (1050ms) - ✓ redistribution: Cdp with the majority stake withdraws. A,B,C,D open. Liq(D). C withdraws some coll. E Enters, Liq(E). Distributes correct rewards (1254ms) - ✓ redistribution: Cdp with the majority stake withdraws. A,B,C,D open. Liq(D). A, B, C withdraw. E Enters, Liq(E). Distributes correct rewards (2218ms) - ✓ redistribution, all operations: A,B,C open. Liq(A). D opens. B adds, C withdraws. Liq(B). E & F open. D adds. Liq(F). Distributes correct rewards (1990ms) - ✓ redistribution, all operations: A,B,C open. Liq(A). D opens. B adds, C withdraws. Liq(B). E & F open. D adds. Liq(F). Varying coll. Distributes correct rewards (2513ms) - - Contract: CdpManager - in Recovery Mode - ✓ checkRecoveryMode(): Returns true if TCR falls below CCR (555ms) - ✓ checkRecoveryMode(): Returns true if TCR stays less than CCR (783ms) - ✓ checkRecoveryMode(): returns false if TCR stays above CCR (775ms) - ✓ checkRecoveryMode(): returns false if TCR rises above CCR (517ms) - ✓ liquidate(), with ICR < 100%: removes stake and updates totalStakes (958ms) - ✓ liquidate(), with ICR < 100%: updates system snapshots correctly (1181ms) - ✓ liquidate(), with ICR < 100%: closes the Cdp and removes it from the Cdp array (808ms) - ✓ liquidate(), with ICR < 100%: only redistributes to active Cdps - no offset to Stability Pool (1527ms) - ✓ liquidate(), with 100 < ICR < 110%: removes stake and updates totalStakes (969ms) - ✓ liquidate(), with 100% < ICR < 110%: updates system snapshots correctly (1292ms) - ✓ liquidate(), with 100% < ICR < 110%: closes the Cdp and removes it from the Cdp array (965ms) - ✓ liquidate(), with 100% < ICR < 110%: offsets as much debt as possible with the Stability Pool, then redistributes the remainder coll and debt (1034ms) - ✓ liquidate(), with ICR > 110%, cdp has lowest ICR, and StabilityPool is empty: does nothing (1245ms) - ✓ liquidate(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: offsets the cdp entirely with the pool (1265ms) - ✓ liquidate(), with ICR% = 110 < TCR, and StabilityPool EBTC > debt to liquidate: offsets the cdp entirely with the pool, there’s no collateral surplus (1382ms) - ✓ liquidate(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: removes stake and updates totalStakes (1361ms) - ✓ liquidate(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: updates system snapshots (1287ms) - ✓ liquidate(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: closes the Cdp (6532ms) - ✓ liquidate(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: can liquidate cdps out of order (2667ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: Cdp remains active (985ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: Cdp remains in CdpOwners array (1134ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: nothing happens (1146ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: updates system shapshots (1284ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: causes correct Pool offset and ETH gain, and doesn't redistribute to active cdps (1266ms) - ✓ liquidate(), with ICR > 110%, and StabilityPool EBTC < liquidated debt: ICR of non liquidated cdp does not change (2161ms) - ✓ liquidate() with ICR > 110%, and StabilityPool EBTC < liquidated debt: total liquidated coll and debt is correct (1912ms) - ✓ liquidate(): Doesn't liquidate undercollateralized cdp if it is the only cdp in the system (652ms) - ✓ liquidate(): Liquidates undercollateralized cdp if there are two cdps in the system (997ms) - ✓ liquidate(): does nothing if cdp has >= 110% ICR and the Stability Pool is empty (1019ms) - ✓ liquidate(): does nothing if cdp ICR >= TCR, and SP covers cdp's debt (1391ms) - ✓ liquidate(): reverts if cdp is non-existent (815ms) - ✓ liquidate(): reverts if cdp has been closed (1044ms) - ✓ liquidate(): liquidates based on entire/collateral debt (including pending rewards), not raw collateral/debt (1878ms) - ✓ liquidate(): does not affect the SP deposit or ETH gain when called on an SP depositor's address that has no cdp (708ms) - ✓ liquidate(): does not alter the liquidated user's token balance (1312ms) - ✓ liquidate(), with 110% < ICR < TCR, can claim collateral, re-open, be reedemed and claim again (2055ms) - ✓ liquidate(), with 110% < ICR < TCR, can claim collateral, after another claim from a redemption (2300ms) - ✓ liquidateCdps(): With all ICRs > 110%, Liquidates Cdps until system leaves recovery mode (3129ms) - ✓ liquidateCdps(): Liquidates Cdps until 1) system has left recovery mode AND 2) it reaches a Cdp with ICR >= 110% (2467ms) - ✓ liquidateCdps(): liquidates only up to the requested number of undercollateralized cdps (7021ms) - ✓ liquidateCdps(): does nothing if n = 0 (952ms) - ✓ liquidateCdps(): closes every Cdp with ICR < MCR, when n > number of undercollateralized cdps (2065ms) - ✓ liquidateCdps(): a liquidation sequence containing Pool offsets increases the TCR (2024ms) - ✓ liquidateCdps(): A liquidation sequence of pure redistributions decreases the TCR, due to gas compensation, but up to 0.5% (6805ms) - ✓ liquidateCdps(): liquidates based on entire/collateral debt (including pending rewards), not raw collateral/debt (945ms) - ✓ liquidateCdps(): does nothing if all cdps have ICR > 110% and Stability Pool is empty (692ms) - ✓ liquidateCdps(): emits liquidation event with correct values when all cdps have ICR > 110% and Stability Pool covers a subset of cdps (1300ms) - ✓ liquidateCdps(): emits liquidation event with correct values when all cdps have ICR > 110% and Stability Pool covers a subset of cdps, including a partial (1362ms) - ✓ liquidateCdps(): does not affect the liquidated user's token balances (4805ms) - ✓ liquidateCdps(): Liquidating cdps at 100 < ICR < 110 with SP deposits correctly impacts their SP deposit and ETH gain (1556ms) - ✓ liquidateCdps(): Liquidating cdps at ICR <=100% with SP deposits does not alter their deposit or ETH gain (1391ms) - ✓ liquidateCdps() with a non fullfilled liquidation: non liquidated cdp remains active (1140ms) - ✓ liquidateCdps() with a non fullfilled liquidation: non liquidated cdp remains in CdpOwners Array (1378ms) -gasUsed: 609826 -true - ✓ liquidateCdps() with a non fullfilled liquidation: still can liquidate further cdps after the non-liquidated, emptied pool (4864ms) -gasUsed: 609826 - ✓ liquidateCdps() with a non fullfilled liquidation: still can liquidate further cdps after the non-liquidated, non emptied pool (1286ms) - ✓ liquidateCdps() with a non fullfilled liquidation: total liquidated coll and debt is correct (1175ms) - ✓ liquidateCdps() with a non fullfilled liquidation: emits correct liquidation event values (1364ms) - ✓ liquidateCdps() with a non fullfilled liquidation: ICR of non liquidated cdp does not change (1387ms) - ✓ batchLiquidateCdps(): Liquidates all cdps with ICR < 110%, transitioning Normal -> Recovery Mode (4957ms) - ✓ batchLiquidateCdps(): Liquidates all cdps with ICR < 110%, transitioning Recovery -> Normal Mode (1492ms) - ✓ batchLiquidateCdps(): Liquidates all cdps with ICR < 110%, transitioning Normal -> Recovery Mode (1922ms) - ✓ batchLiquidateCdps() with a non fullfilled liquidation: non liquidated cdp remains active (1286ms) - ✓ batchLiquidateCdps() with a non fullfilled liquidation: non liquidated cdp remains in Cdp Owners array (1555ms) -gasUsed: 636956 - ✓ batchLiquidateCdps() with a non fullfilled liquidation: still can liquidate further cdps after the non-liquidated, emptied pool (1465ms) -gasUsed: 636956 - ✓ batchLiquidateCdps() with a non fullfilled liquidation: still can liquidate further cdps after the non-liquidated, non emptied pool (1521ms) - ✓ batchLiquidateCdps() with a non fullfilled liquidation: total liquidated coll and debt is correct (1320ms) - ✓ batchLiquidateCdps() with a non fullfilled liquidation: emits correct liquidation event values (1238ms) - ✓ batchLiquidateCdps() with a non fullfilled liquidation: ICR of non liquidated cdp does not change (1416ms) - ✓ batchLiquidateCdps(), with 110% < ICR < TCR, and StabilityPool EBTC > debt to liquidate: can liquidate cdps out of order (1357ms) - ✓ batchLiquidateCdps(), with 110% < ICR < TCR, and StabilityPool empty: doesn't liquidate any cdps (1161ms) - ✓ batchLiquidateCdps(): skips liquidation of cdps with ICR > TCR, regardless of Stability Pool size (2686ms) - ✓ batchLiquidateCdps(): emits liquidation event with correct values when all cdps have ICR > 110% and Stability Pool covers a subset of cdps (1530ms) - ✓ batchLiquidateCdps(): emits liquidation event with correct values when all cdps have ICR > 110% and Stability Pool covers a subset of cdps, including a partial (4965ms) - - Contract: CdpManager - ✓ liquidate(): closes a Cdp that has ICR < MCR (573ms) - ✓ liquidate(): decreases ActivePool ETH and EBTCDebt by correct amounts (567ms) - ✓ liquidate(): increases DefaultPool ETH and EBTC debt by correct amounts (553ms) - ✓ liquidate(): removes the Cdp's stake from the total stakes (608ms) - ✓ liquidate(): Removes the correct cdp from the CdpOwners array, and moves the last array element to the new empty slot (1276ms) - ✓ liquidate(): updates the snapshots of total stakes and total collateral (422ms) - ✓ liquidate(): updates the L_STETHColl and systemDebtRedistributionIndex reward-per-unit-staked totals (984ms) - ✓ liquidate(): Liquidates undercollateralized cdp if there are two cdps in the system (503ms) - ✓ liquidate(): reverts if cdp is non-existent (303ms) - ✓ liquidate(): reverts if cdp has been closed (745ms) - ✓ liquidate(): does nothing if cdp has >= 110% ICR (597ms) - ✓ liquidate(): Given the same price and no other cdp changes, complete Pool offsets restore the TCR to its value prior to the defaulters opening cdps (2590ms) - ✓ liquidate(): Pool offsets increase the TCR (6140ms) - ✓ liquidate(): a pure redistribution reduces the TCR only as a result of compensation (2570ms) - ✓ liquidate(): does not affect the SP deposit or ETH gain when called on an SP depositor's address that has no cdp (964ms) - ✓ liquidate(): does not liquidate a SP depositor's cdp with ICR > 110%, and does not affect their SP deposit or ETH gain (892ms) - ✓ liquidate(): liquidates a SP depositor's cdp with ICR < 110%, and the liquidation correctly impacts their SP deposit and ETH gain (1141ms) - ✓ liquidate(): does not alter the liquidated user's token balance (1104ms) - ✓ liquidate(): liquidates based on entire/collateral debt (including pending rewards), not raw collateral/debt (1573ms) - ✓ liquidate(): when SP > 0, triggers LQTY reward event - increases the sum G (1081ms) - ✓ liquidate(): when SP is empty, doesn't update G (1127ms) - ✓ liquidateCdps(): liquidates a Cdp that a) was skipped in a previous liquidation and b) has pending rewards (5574ms) - ✓ liquidateCdps(): closes every Cdp with ICR < MCR, when n > number of undercollateralized cdps (2003ms) - ✓ liquidateCdps(): liquidates up to the requested number of undercollateralized cdps (1230ms) - ✓ liquidateCdps(): does nothing if all cdps have ICR > 110% (1021ms) - ✓ liquidateCdps(): liquidates based on entire/collateral debt (including pending rewards), not raw collateral/debt (1246ms) - ✓ liquidateCdps(): reverts if n = 0 (764ms) - ✓ liquidateCdps(): liquidates cdps with ICR < MCR (1751ms) - ✓ liquidateCdps(): does not affect the liquidated user's token balances (999ms) - ✓ liquidateCdps(): A liquidation sequence containing Pool offsets increases the TCR (6204ms) - ✓ liquidateCdps(): A liquidation sequence of pure redistributions decreases the TCR, due to gas compensation, but up to 0.5% (1929ms) - ✓ liquidateCdps(): Liquidating cdps with SP deposits correctly impacts their SP deposit and ETH gain (1214ms) - ✓ liquidateCdps(): when SP > 0, triggers LQTY reward event - increases the sum G (5057ms) - ✓ liquidateCdps(): when SP is empty, doesn't update G (1722ms) - ✓ batchLiquidateCdps(): liquidates a Cdp that a) was skipped in a previous liquidation and b) has pending rewards (1912ms) - ✓ batchLiquidateCdps(): closes every cdp with ICR < MCR in the given array (1351ms) - ✓ batchLiquidateCdps(): does not liquidate cdps that are not in the given array (5228ms) - ✓ batchLiquidateCdps(): does not close cdps with ICR >= MCR in the given array (1442ms) - ✓ batchLiquidateCdps(): reverts if array is empty (978ms) - ✓ batchLiquidateCdps(): skips if cdp is non-existent (1295ms) - ✓ batchLiquidateCdps(): skips if a cdp has been closed (5183ms) - ✓ batchLiquidateCdps: when SP > 0, triggers LQTY reward event - increases the sum G (1428ms) - ✓ batchLiquidateCdps(): when SP is empty, doesn't update G (1655ms) - ✓ getRedemptionHints(): gets the address of the first Cdp and the final ICR of the last Cdp involved in a redemption (621ms) - ✓ getRedemptionHints(): returns 0 as partialRedemptionHintNICR when reaching _maxIterations (715ms) - ✓ redeemCollateral(): cancels the provided EBTC with debt from Cdps with the lowest ICRs and sends an equivalent amount of Ether (838ms) - ✓ redeemCollateral(): with invalid first hint, zero address (991ms) - ✓ redeemCollateral(): with invalid first hint, non-existent cdp (1003ms) - ✓ redeemCollateral(): with invalid first hint, cdp below MCR (1392ms) - ✓ redeemCollateral(): ends the redemption sequence when the token redemption request has been filled (1583ms) - ✓ redeemCollateral(): ends the redemption sequence when max iterations have been reached (1038ms) - ✓ redeemCollateral(): performs partial redemption if resultant debt is > minimum net debt (1411ms) - ✓ redeemCollateral(): doesn't perform partial redemption if resultant debt would be < minimum net debt (1487ms) - ✓ redeemCollateral(): doesnt perform the final partial redemption in the sequence if the hint is out-of-date (1583ms) - - redeemCollateral(): can redeem if there is zero active debt but non-zero debt in DefaultPool - ✓ redeemCollateral(): doesn't touch Cdps with ICR < 110% (4743ms) - ✓ redeemCollateral(): finds the last Cdp with ICR == 110% even if there is more than one (1124ms) - ✓ redeemCollateral(): reverts when TCR < MCR (1238ms) - ✓ redeemCollateral(): reverts when argument _amount is 0 (1038ms) - ✓ redeemCollateral(): reverts if max fee > 100% (1918ms) - ✓ redeemCollateral(): reverts if max fee < 0.5% (2011ms) - ✓ redeemCollateral(): reverts if fee exceeds max fee percentage (2899ms) - ✓ redeemCollateral(): succeeds if fee is less than max fee percentage (3127ms) - ✓ redeemCollateral(): doesn't affect the Stability Pool deposits or ETH gain of redeemed-from cdps (2311ms) - ✓ redeemCollateral(): caller can redeem their entire EBTCToken balance (1086ms) - ✓ redeemCollateral(): reverts when requested redemption amount exceeds caller's EBTC token balance (1320ms) - ✓ redeemCollateral(): value of issued ETH == face value of redeemed EBTC (assuming 1 EBTC has value of $1) (1353ms) - ✓ redeemCollateral(): reverts if there is zero outstanding system debt (66ms) - ✓ redeemCollateral(): reverts if caller's tries to redeem more than the outstanding system debt (367ms) - ✓ redeemCollateral(): a redemption made when base rate is zero increases the base rate (1187ms) - ✓ redeemCollateral(): a redemption made when base rate is non-zero increases the base rate, for negligible time passed (1987ms) - ✓ redeemCollateral(): lastFeeOpTime doesn't update if less time than decay interval has passed since the last fee operation [ @skip-on-coverage ] (2515ms) - ✓ redeemCollateral(): a redemption made at zero base rate send a non-zero ETHFee to LQTY staking contract (5136ms) - ✓ redeemCollateral(): a redemption made at zero base increases the ETH-fees-per-LQTY-staked in LQTY Staking contract (1207ms) - ✓ redeemCollateral(): a redemption made at a non-zero base rate send a non-zero ETHFee to LQTY staking contract (1730ms) - ✓ redeemCollateral(): a redemption made at a non-zero base rate increases ETH-per-LQTY-staked in the staking contract (5971ms) - ✓ redeemCollateral(): a redemption sends the ETH remainder (ETHDrawn - ETHFee) to the redeemer (1113ms) - ✓ redeemCollateral(): a full redemption (leaving cdp with 0 debt), closes the cdp (1553ms) - ✓ redeemCollateral(): emits correct debt and coll values in each redeemed cdp's CdpUpdated event (1416ms) - ✓ redeemCollateral(): a redemption that closes a cdp leaves the cdp's ETH surplus (collateral - ETH drawn) available for the cdp owner to claim (5373ms) - ✓ redeemCollateral(): a redemption that closes a cdp leaves the cdp's ETH surplus (collateral - ETH drawn) available for the cdp owner after re-opening cdp (2154ms) - ✓ redeemCollateral(): reverts if fee eats up all returned collateral (1412ms) - ✓ getPendingRedistributedDebt(): Returns 0 if there is no pending EBTCDebt reward (618ms) - ✓ getPendingETHReward(): Returns 0 if there is no pending ETH reward (620ms) - ✓ computeICR(): Returns 0 if cdp's coll is worth 0 - ✓ computeICR(): Returns 2^256-1 for ETH:USD = 100, coll = 1 ETH, debt = 100 EBTC - ✓ computeICR(): returns correct ICR for ETH:USD = 100, coll = 200 ETH, debt = 30 EBTC - ✓ computeICR(): returns correct ICR for ETH:USD = 250, coll = 1350 ETH, debt = 127 EBTC - ✓ computeICR(): returns correct ICR for ETH:USD = 100, coll = 1 ETH, debt = 54321 EBTC - ✓ computeICR(): Returns 2^256-1 if cdp has non-zero coll and zero debt - ✓ checkRecoveryMode(): Returns true when TCR < 150% (351ms) - ✓ checkRecoveryMode(): Returns false when TCR == 150% (366ms) - ✓ checkRecoveryMode(): Returns false when TCR > 150% (365ms) - ✓ checkRecoveryMode(): Returns false when TCR == 0 (604ms) - ✓ getCdpStake(): Returns stake (511ms) - ✓ getCdpCollShares(): Returns coll (494ms) - ✓ getCdpDebt(): Returns debt (400ms) - ✓ getCdpStatus(): Returns status (434ms) - ✓ hasPendingRedistributedDebt(): Returns false it cdp is not active - - Contract: Unipool - Unipool - ✓ Two stakers with the same stakes wait DURATION (112ms) - ✓ Two stakers with the different (1:3) stakes wait DURATION (206ms) - ✓ Two stakers with the different (1:3) stakes wait DURATION and DURATION/2 (93ms) - ✓ Three stakers with the different (1:3:5) stakes wait different durations (392ms) - ✓ Four stakers with gaps of zero total supply (516ms) - ✓ Four stakers with gaps of zero total supply, with claims in between (430ms) - Unipool, before calling setAddresses - ✓ Stake fails - ✓ Withdraw falis - ✓ Claim fails - ✓ Exit fails - - - 1019 passing (29m) - 8 pending - -Done in 1740.19s. -``` diff --git a/packages/contracts/test/AccessControlTest.js b/packages/contracts/test/AccessControlTest.js index 9482b4ac6..2f7bc4ceb 100644 --- a/packages/contracts/test/AccessControlTest.js +++ b/packages/contracts/test/AccessControlTest.js @@ -68,18 +68,6 @@ contract('Access Control: Liquity functions with the caller restricted to Liquit } }) - // removeStake - it("removeStake(): reverts when called by an account that is not BorrowerOperations", async () => { - // Attempt call from alice - try { - const txAlice = await cdpManager.removeStake(bob, { from: alice }) - - } catch (err) { - assert.include(err.message, "revert") - // assert.include(err.message, "Caller is not the BorrowerOperations contract") - } - }) - // updateStakeAndTotalStakes it("updateStakeAndTotalStakes(): reverts when called by an account that is not BorrowerOperations", async () => { // Attempt call from alice diff --git a/packages/contracts/test/BorrowerOperationsTest.js b/packages/contracts/test/BorrowerOperationsTest.js index 75d5d706c..f4567a7e9 100644 --- a/packages/contracts/test/BorrowerOperationsTest.js +++ b/packages/contracts/test/BorrowerOperationsTest.js @@ -387,9 +387,9 @@ contract('BorrowerOperations', async accounts => { const systemDebtRedistributionIndex = await cdpManager.systemDebtRedistributionIndex() // check Alice and Bob's reward snapshots are zero before they alter their Cdps - const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(aliceIndex) + const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(aliceIndex) - const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.equal(alice_EBTCDebtRewardSnapshot_Before, 0) assert.equal(bob_EBTCDebtRewardSnapshot_Before, 0) @@ -420,9 +420,9 @@ contract('BorrowerOperations', async accounts => { /* Check that both Alice and Bob's snapshots of the rewards-per-unit-staked metrics should be updated to the latest values of L_STETHColl and systemDebtRedistributionIndex */ - const alice_EBTCDebtRewardSnapshot_After = await cdpManager.debtRedistributionIndex(aliceIndex) + const alice_EBTCDebtRewardSnapshot_After = await cdpManager.cdpDebtRedistributionIndex(aliceIndex) - const bob_EBTCDebtRewardSnapshot_After = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot_After = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.isAtMost(th.getDifference(alice_EBTCDebtRewardSnapshot_After, systemDebtRedistributionIndex), 100) assert.isAtMost(th.getDifference(bob_EBTCDebtRewardSnapshot_After, systemDebtRedistributionIndex), 100) @@ -817,9 +817,9 @@ contract('BorrowerOperations', async accounts => { const systemDebtRedistributionIndex = await cdpManager.systemDebtRedistributionIndex() // check Alice and Bob's reward snapshots are zero before they alter their Cdps - const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(aliceIndex) + const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(aliceIndex) - const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.equal(alice_EBTCDebtRewardSnapshot_Before, 0) assert.equal(bob_EBTCDebtRewardSnapshot_Before, 0) @@ -852,17 +852,17 @@ contract('BorrowerOperations', async accounts => { /* After top up, both Alice and Bob's snapshots of the rewards-per-unit-staked metrics should be updated to the latest values of L_STETHColl and systemDebtRedistributionIndex */ - const alice_EBTCDebtRewardSnapshot_After = await cdpManager.debtRedistributionIndex(aliceIndex) + const alice_EBTCDebtRewardSnapshot_After = await cdpManager.cdpDebtRedistributionIndex(aliceIndex) - const bob_EBTCDebtRewardSnapshot_After = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot_After = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.isAtMost(th.getDifference(alice_EBTCDebtRewardSnapshot_After, systemDebtRedistributionIndex), 100) assert.isAtMost(th.getDifference(bob_EBTCDebtRewardSnapshot_After, systemDebtRedistributionIndex), 100) }) - // --- withdrawEBTC() --- + // --- withdrawDebt() --- - it("withdrawEBTC(): reverts when withdrawal would leave cdp with ICR < MCR", async () => { + it("withdrawDebt(): reverts when withdrawal would leave cdp with ICR < MCR", async () => { // alice creates a Cdp and adds first collateral await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: bob } }) @@ -879,11 +879,11 @@ contract('BorrowerOperations', async accounts => { const EBTCwithdrawal = 1 // withdraw 1 wei EBTC - await assertRevert(borrowerOperations.withdrawEBTC(aliceIndex, EBTCwithdrawal, aliceIndex, aliceIndex, { from: alice }), + await assertRevert(borrowerOperations.withdrawDebt(aliceIndex, EBTCwithdrawal, aliceIndex, aliceIndex, { from: alice }), "BorrowerOperations: An operation that would result in ICR < MCR is not permitted") }) - it("withdrawEBTC(): does not decay a non-zero base rate", async () => { + it("withdrawDebt(): does not decay a non-zero base rate", async () => { await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: whale } }) await openCdp({ extraEBTCAmount: toBN(dec(20, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: A } }) @@ -910,7 +910,7 @@ contract('BorrowerOperations', async accounts => { th.fastForwardTime(7200, web3.currentProvider) // D withdraws EBTC - await borrowerOperations.withdrawEBTC(DIndex, dec(1, 18), AIndex, AIndex, { from: D }) + await borrowerOperations.withdrawDebt(DIndex, dec(1, 18), AIndex, AIndex, { from: D }) // Check baseRate should not decrease const baseRate_2 = await cdpManager.baseRate() @@ -920,14 +920,14 @@ contract('BorrowerOperations', async accounts => { th.fastForwardTime(3600, web3.currentProvider) // E withdraws EBTC - await borrowerOperations.withdrawEBTC(EIndex, dec(1, 18), AIndex, AIndex, { from: E }) + await borrowerOperations.withdrawDebt(EIndex, dec(1, 18), AIndex, AIndex, { from: E }) // Check baseRate should not decrease const baseRate_3 = await cdpManager.baseRate() assert.isTrue(baseRate_3.eq(baseRate_2)) }) - it("withdrawEBTC(): reverts when calling address does not have active cdp", async () => { + it("withdrawDebt(): reverts when calling address does not have active cdp", async () => { await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: bob } }) @@ -935,19 +935,19 @@ contract('BorrowerOperations', async accounts => { const carolIndex = th.RANDOM_INDEX // Bob successfully withdraws EBTC - const txBob = await borrowerOperations.withdrawEBTC(bobIndex, dec(1, 16), bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.withdrawDebt(bobIndex, dec(1, 16), bobIndex, bobIndex, { from: bob }) assert.isTrue(txBob.receipt.status) // Carol with no active cdp attempts to withdraw EBTC try { - const txCarol = await borrowerOperations.withdrawEBTC(carolIndex, dec(1, 17), bobIndex, bobIndex, { from: carol }) + const txCarol = await borrowerOperations.withdrawDebt(carolIndex, dec(1, 17), bobIndex, bobIndex, { from: carol }) assert.isFalse(txCarol.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("withdrawEBTC(): reverts when requested withdrawal amount is zero EBTC", async () => { + it("withdrawDebt(): reverts when requested withdrawal amount is zero EBTC", async () => { await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: bob } }) @@ -956,19 +956,19 @@ contract('BorrowerOperations', async accounts => { const carolIndex = th.RANDOM_INDEX // Bob successfully withdraws 1e-18 EBTC - const txBob = await borrowerOperations.withdrawEBTC(bobIndex, 1, bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.withdrawDebt(bobIndex, 1, bobIndex, bobIndex, { from: bob }) assert.isTrue(txBob.receipt.status) // Alice attempts to withdraw 0 EBTC try { - const txAlice = await borrowerOperations.withdrawEBTC(aliceIndex, 0, aliceIndex, aliceIndex, { from: alice }) + const txAlice = await borrowerOperations.withdrawDebt(aliceIndex, 0, aliceIndex, aliceIndex, { from: alice }) assert.isFalse(txAlice.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("withdrawEBTC(): reverts when system is in Recovery Mode", async () => { + it("withdrawDebt(): reverts when system is in Recovery Mode", async () => { await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: bob } }) await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: carol } }) @@ -980,7 +980,7 @@ contract('BorrowerOperations', async accounts => { assert.isFalse(await th.checkRecoveryMode(contracts)) // Withdrawal possible when recoveryMode == false - const txAlice = await borrowerOperations.withdrawEBTC(aliceIndex, dec(1, 16), aliceIndex, aliceIndex, { from: alice }) + const txAlice = await borrowerOperations.withdrawDebt(aliceIndex, dec(1, 16), aliceIndex, aliceIndex, { from: alice }) assert.isTrue(txAlice.receipt.status) await priceFeed.setPrice(dec(3000, 13)) @@ -989,14 +989,14 @@ contract('BorrowerOperations', async accounts => { //Check EBTC withdrawal impossible when recoveryMode == true try { - const txBob = await borrowerOperations.withdrawEBTC(bobIndex, 1, bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.withdrawDebt(bobIndex, 1, bobIndex, bobIndex, { from: bob }) assert.isFalse(txBob.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("withdrawEBTC(): reverts when withdrawal would bring the cdp's ICR < MCR", async () => { + it("withdrawDebt(): reverts when withdrawal would bring the cdp's ICR < MCR", async () => { await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(111, 16)), extraParams: { from: bob } }) // 111% ICR @@ -1004,14 +1004,14 @@ contract('BorrowerOperations', async accounts => { // Bob tries to withdraw EBTC that would bring his ICR < MCR try { - const txBob = await borrowerOperations.withdrawEBTC(bobIndex, toBN(100000000000000000), bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.withdrawDebt(bobIndex, toBN(100000000000000000), bobIndex, bobIndex, { from: bob }) assert.isFalse(txBob.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("withdrawEBTC(): reverts when a withdrawal would cause the TCR of the system to fall below the CCR", async () => { + it("withdrawDebt(): reverts when a withdrawal would cause the TCR of the system to fall below the CCR", async () => { await priceFeed.setPrice(dec(3800, 13)) // Alice and Bob creates cdps with 150% ICR. System TCR = 151%. @@ -1023,14 +1023,14 @@ contract('BorrowerOperations', async accounts => { // Bob attempts to withdraw 1 EBTC. // System TCR would be: ((3+3) * 100 ) / (200+201) = 600/401 = 149.62%, i.e. below CCR of 150%. try { - const txBob = await borrowerOperations.withdrawEBTC(bobIndex, dec(1, 18), bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.withdrawDebt(bobIndex, dec(1, 18), bobIndex, bobIndex, { from: bob }) assert.isFalse(txBob.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("withdrawEBTC(): reverts if system is in Recovery Mode", async () => { + it("withdrawDebt(): reverts if system is in Recovery Mode", async () => { // --- SETUP --- await openCdp({ ICR: toBN(dec(155, 16)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(155, 16)), extraParams: { from: bob } }) @@ -1045,14 +1045,14 @@ contract('BorrowerOperations', async accounts => { assert.isTrue((await th.getTCR(contracts)).lt(toBN(dec(15, 17)))) try { - const txData = await borrowerOperations.withdrawEBTC(aliceIndex, '200', aliceIndex, aliceIndex, { from: alice }) + const txData = await borrowerOperations.withdrawDebt(aliceIndex, '200', aliceIndex, aliceIndex, { from: alice }) assert.isFalse(txData.receipt.status) } catch (err) { assert.include(err.message, 'revert') } }) - it("withdrawEBTC(): increases the Cdp's EBTC debt by the correct amount", async () => { + it("withdrawDebt(): increases the Cdp's EBTC debt by the correct amount", async () => { await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) const aliceIndex = await sortedCdps.cdpOfOwnerByIndex(alice,0) @@ -1060,14 +1060,14 @@ contract('BorrowerOperations', async accounts => { const aliceDebtBefore = await getCdpEntireDebt(aliceIndex) assert.isTrue(aliceDebtBefore.gt(toBN(0))) - await borrowerOperations.withdrawEBTC(aliceIndex, await getNetBorrowingAmount(100), aliceIndex, aliceIndex, { from: alice }) + await borrowerOperations.withdrawDebt(aliceIndex, await getNetBorrowingAmount(100), aliceIndex, aliceIndex, { from: alice }) // check after const aliceDebtAfter = await getCdpEntireDebt(aliceIndex) th.assertIsApproximatelyEqual(aliceDebtAfter, aliceDebtBefore.add(toBN(100))) }) - it("withdrawEBTC(): increases EBTC debt in ActivePool by correct amount", async () => { + it("withdrawDebt(): increases EBTC debt in ActivePool by correct amount", async () => { await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: alice, value: toBN(dec(100, 'ether')) } }) const aliceIndex = await sortedCdps.cdpOfOwnerByIndex(alice,0) @@ -1078,14 +1078,14 @@ contract('BorrowerOperations', async accounts => { const activePool_EBTC_Before = await activePool.getSystemDebt() assert.isTrue(activePool_EBTC_Before.eq(aliceDebtBefore)) - await borrowerOperations.withdrawEBTC(aliceIndex, await getNetBorrowingAmount(dec(1, 17)), aliceIndex, aliceIndex, { from: alice }) + await borrowerOperations.withdrawDebt(aliceIndex, await getNetBorrowingAmount(dec(1, 17)), aliceIndex, aliceIndex, { from: alice }) // check after const activePool_EBTC_After = await activePool.getSystemDebt() th.assertIsApproximatelyEqual(activePool_EBTC_After, activePool_EBTC_Before.add(toBN(dec(1, 17)))) }) - it("withdrawEBTC(): increases user EBTCToken balance by correct amount", async () => { + it("withdrawDebt(): increases user EBTCToken balance by correct amount", async () => { await openCdp({ extraParams: { value: toBN(dec(100, 'ether')), from: alice } }) const aliceIndex = await sortedCdps.cdpOfOwnerByIndex(alice,0) @@ -1093,15 +1093,15 @@ contract('BorrowerOperations', async accounts => { const alice_EBTCTokenBalance_Before = await ebtcToken.balanceOf(alice) assert.isTrue(alice_EBTCTokenBalance_Before.gt(toBN('0'))) - await borrowerOperations.withdrawEBTC(aliceIndex, dec(1, 17), aliceIndex, aliceIndex, { from: alice }) + await borrowerOperations.withdrawDebt(aliceIndex, dec(1, 17), aliceIndex, aliceIndex, { from: alice }) // check after const alice_EBTCTokenBalance_After = await ebtcToken.balanceOf(alice) assert.isTrue(alice_EBTCTokenBalance_After.eq(alice_EBTCTokenBalance_Before.add(toBN(dec(1, 17))))) }) - // --- repayEBTC() --- - it("repayEBTC(): reverts when repayment would leave cdp with ICR < MCR", async () => { + // --- repayDebt() --- + it("repayDebt(): reverts when repayment would leave cdp with ICR < MCR", async () => { // alice creates a Cdp and adds first collateral await openCdp({ ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ ICR: toBN(dec(10, 18)), extraParams: { from: bob } }) @@ -1117,11 +1117,11 @@ contract('BorrowerOperations', async accounts => { const EBTCRepayment = 1 // 1 wei repayment - await assertRevert(borrowerOperations.repayEBTC(aliceIndex, EBTCRepayment, aliceIndex, aliceIndex, { from: alice }), + await assertRevert(borrowerOperations.repayDebt(aliceIndex, EBTCRepayment, aliceIndex, aliceIndex, { from: alice }), "BorrowerOperations: An operation that would result in ICR < MCR is not permitted") }) - it("repayEBTC(): Succeeds when it would leave cdp with net debt >= minimum net debt", async () => { + it("repayDebt(): Succeeds when it would leave cdp with net debt >= minimum net debt", async () => { // Make the EBTC request 2 wei above min net debt to correct for floor division, and make net debt = min net debt + 1 wei await _signer.sendTransaction({ to: A, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: B, value: ethers.utils.parseEther("20000")}); @@ -1133,7 +1133,7 @@ contract('BorrowerOperations', async accounts => { await borrowerOperations.openCdp(await getNetBorrowingAmount(MIN_NET_DEBT.add(toBN('2'))), A, A, _colAmt, { from: A }) const AIndex = await sortedCdps.cdpOfOwnerByIndex(A,0) - const repayTxA = await borrowerOperations.repayEBTC(AIndex, 1, AIndex, AIndex, { from: A }) + const repayTxA = await borrowerOperations.repayDebt(AIndex, 1, AIndex, AIndex, { from: A }) assert.isTrue(repayTxA.receipt.status) let _debtAmt = dec(20, 17); @@ -1141,11 +1141,11 @@ contract('BorrowerOperations', async accounts => { await borrowerOperations.openCdp(_debtAmt, B, B, _colAmt, { from: B }) const BIndex = await sortedCdps.cdpOfOwnerByIndex(B,0) - const repayTxB = await borrowerOperations.repayEBTC(BIndex, _repayAmt, BIndex, BIndex, { from: B }) + const repayTxB = await borrowerOperations.repayDebt(BIndex, _repayAmt, BIndex, BIndex, { from: B }) assert.isTrue(repayTxB.receipt.status) }) - it("repayEBTC(): reverts when it would leave cdp with net debt > 0", async () => { + it("repayDebt(): reverts when it would leave cdp with net debt > 0", async () => { await _signer.sendTransaction({ to: A, value: ethers.utils.parseEther("20000")}); let _colAmt = dec(100, 18); const price = await priceFeed.getPrice() @@ -1158,7 +1158,7 @@ contract('BorrowerOperations', async accounts => { const AIndex = await sortedCdps.cdpOfOwnerByIndex(A,0) let _aDebt = await cdpManager.getCdpDebt(AIndex); - const repayTxAPromise = borrowerOperations.repayEBTC(AIndex, _aDebt, AIndex, AIndex, { from: A }) + const repayTxAPromise = borrowerOperations.repayDebt(AIndex, _aDebt, AIndex, AIndex, { from: A }) await assertRevert(repayTxAPromise, "BorrowerOperations: Debt must be non-zero") }) @@ -1179,7 +1179,7 @@ contract('BorrowerOperations', async accounts => { "SafeMath: subtraction overflow") }) - it("repayEBTC(): reverts when calling address does not own cdp index supplied", async () => { + it("repayDebt(): reverts when calling address does not own cdp index supplied", async () => { await openCdp({ extraEBTCAmount: toBN(dec(10000, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ extraEBTCAmount: toBN(dec(10000, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: bob } }) @@ -1187,19 +1187,19 @@ contract('BorrowerOperations', async accounts => { const bobIndex = await sortedCdps.cdpOfOwnerByIndex(bob,0) // Bob successfully repays some EBTC - const txBob = await borrowerOperations.repayEBTC(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.repayDebt(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: bob }) assert.isTrue(txBob.receipt.status) - // Carol with no active cdp attempts to repayEBTC + // Carol with no active cdp attempts to repayDebt try { - const txCarol = await borrowerOperations.repayEBTC(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: carol }) + const txCarol = await borrowerOperations.repayDebt(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: carol }) assert.isFalse(txCarol.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - it("repayEBTC(): reverts when attempted repayment is > the debt of the cdp", async () => { + it("repayDebt(): reverts when attempted repayment is > the debt of the cdp", async () => { await _signer.sendTransaction({ to: alice, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: bob, value: ethers.utils.parseEther("20000")}); await openCdp({ extraEBTCAmount: toBN(dec(100, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) @@ -1211,20 +1211,20 @@ contract('BorrowerOperations', async accounts => { const aliceDebt = await getCdpEntireDebt(aliceIndex) // Bob successfully repays some EBTC - const txBob = await borrowerOperations.repayEBTC(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: bob }) + const txBob = await borrowerOperations.repayDebt(bobIndex, dec(10, 18), bobIndex, bobIndex, { from: bob }) assert.isTrue(txBob.receipt.status) // Alice attempts to repay more than her debt try { - const txAlice = await borrowerOperations.repayEBTC(aliceIndex, aliceDebt.add(toBN(dec(1, 18))), aliceIndex, aliceIndex, { from: alice }) + const txAlice = await borrowerOperations.repayDebt(aliceIndex, aliceDebt.add(toBN(dec(1, 18))), aliceIndex, aliceIndex, { from: alice }) assert.isFalse(txAlice.receipt.status) } catch (err) { assert.include(err.message, "revert") } }) - //repayEBTC: reduces EBTC debt in Cdp - it("repayEBTC(): reduces the Cdp's EBTC debt by the correct amount", async () => { + //repayDebt: reduces EBTC debt in Cdp + it("repayDebt(): reduces the Cdp's EBTC debt by the correct amount", async () => { await _signer.sendTransaction({ to: alice, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: bob, value: ethers.utils.parseEther("20000")}); await openCdp({ extraEBTCAmount: toBN(dec(100, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) @@ -1236,7 +1236,7 @@ contract('BorrowerOperations', async accounts => { const aliceDebtBefore = await getCdpEntireDebt(aliceIndex) assert.isTrue(aliceDebtBefore.gt(toBN('0'))) - await borrowerOperations.repayEBTC(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt + await borrowerOperations.repayDebt(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt const aliceDebtAfter = await getCdpEntireDebt(aliceIndex) assert.isTrue(aliceDebtAfter.gt(toBN('0'))) @@ -1244,7 +1244,7 @@ contract('BorrowerOperations', async accounts => { th.assertIsApproximatelyEqual(aliceDebtAfter, aliceDebtBefore.mul(toBN(9)).div(toBN(10))) // check 9/10 debt remaining }) - it("repayEBTC(): decreases EBTC debt in ActivePool by correct amount", async () => { + it("repayDebt(): decreases EBTC debt in ActivePool by correct amount", async () => { await _signer.sendTransaction({ to: alice, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: bob, value: ethers.utils.parseEther("20000")}); await openCdp({ extraEBTCAmount: toBN(dec(100, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) @@ -1260,14 +1260,14 @@ contract('BorrowerOperations', async accounts => { const activePool_EBTC_Before = await activePool.getSystemDebt() assert.isTrue(activePool_EBTC_Before.gt(toBN('0'))) - await borrowerOperations.repayEBTC(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt + await borrowerOperations.repayDebt(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt // check after const activePool_EBTC_After = await activePool.getSystemDebt() th.assertIsApproximatelyEqual(activePool_EBTC_After, activePool_EBTC_Before.sub(aliceDebtBefore.div(toBN(10)))) }) - it("repayEBTC(): decreases user EBTCToken balance by correct amount", async () => { + it("repayDebt(): decreases user EBTCToken balance by correct amount", async () => { await _signer.sendTransaction({ to: alice, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: bob, value: ethers.utils.parseEther("20000")}); await openCdp({ extraEBTCAmount: toBN(dec(100, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) @@ -1283,7 +1283,7 @@ contract('BorrowerOperations', async accounts => { const alice_EBTCTokenBalance_Before = await ebtcToken.balanceOf(alice) assert.isTrue(alice_EBTCTokenBalance_Before.gt(toBN('0'))) - await borrowerOperations.repayEBTC(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt + await borrowerOperations.repayDebt(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) // Repays 1/10 her debt // check after const alice_EBTCTokenBalance_After = await ebtcToken.balanceOf(alice) @@ -1291,7 +1291,7 @@ contract('BorrowerOperations', async accounts => { }) //TODO: fix - xit("repayEBTC(): can repay debt in Recovery Mode", async () => { + xit("repayDebt(): can repay debt in Recovery Mode", async () => { await openCdp({ extraEBTCAmount: toBN(dec(10000, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) await openCdp({ extraEBTCAmount: toBN(dec(10000, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: bob } }) @@ -1307,7 +1307,7 @@ contract('BorrowerOperations', async accounts => { assert.isTrue(await th.checkRecoveryMode(contracts)) - const tx = await borrowerOperations.repayEBTC(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) + const tx = await borrowerOperations.repayDebt(aliceIndex, aliceDebtBefore.div(toBN(10)), aliceIndex, aliceIndex, { from: alice }) assert.isTrue(tx.receipt.status) // Check Alice's debt: 110 (initial) - 50 (repaid) @@ -1315,7 +1315,7 @@ contract('BorrowerOperations', async accounts => { th.assertIsApproximatelyEqual(aliceDebtAfter, aliceDebtBefore.mul(toBN(9)).div(toBN(10))) }) - it("repayEBTC(): Reverts if borrower has insufficient EBTC balance to cover his debt repayment", async () => { + it("repayDebt(): Reverts if borrower has insufficient EBTC balance to cover his debt repayment", async () => { await _signer.sendTransaction({ to: alice, value: ethers.utils.parseEther("20000")}); await _signer.sendTransaction({ to: B, value: ethers.utils.parseEther("20000")}); await openCdp({ extraEBTCAmount: toBN(dec(100, 18)), ICR: toBN(dec(2, 18)), extraParams: { from: alice } }) @@ -1336,9 +1336,9 @@ contract('BorrowerOperations', async accounts => { assert.isTrue(bobBalAfter.eq(toBN(dec(5, 18)))) // Bob tries to repay 6 EBTC - const repayEBTCPromise_B = borrowerOperations.repayEBTC(BIndex, toBN(dec(6, 18)), BIndex, BIndex, { from: B }) + const repayDebtPromise_B = borrowerOperations.repayDebt(BIndex, toBN(dec(6, 18)), BIndex, BIndex, { from: B }) - await assertRevert(repayEBTCPromise_B, "Caller doesnt have enough EBTC to make repayment") + await assertRevert(repayDebtPromise_B, "Caller doesnt have enough EBTC to make repayment") }) // --- adjustCdp() --- @@ -1499,7 +1499,7 @@ contract('BorrowerOperations', async accounts => { // Alice attempts an adjustment that repays half her debt BUT withdraws 1 wei collateral, and fails await assertRevert(borrowerOperations.adjustCdp(aliceIndex, 1, dec(5000, 18), false, aliceIndex, aliceIndex, { from: alice }), - "BorrowerOperations: Collateral withdrawal not permitted Recovery Mode") + "BorrowerOperations: Collateral withdrawal not permitted during Recovery Mode") }) it("adjustCdp(): debt increase that would leave ICR < 150% reverts in Recovery Mode", async () => { @@ -2120,10 +2120,10 @@ contract('BorrowerOperations', async accounts => { const B_EBTCBal = await ebtcToken.balanceOf(B) assert.isTrue(B_EBTCBal.lt(bobDebt)) - const repayEBTCPromise_B = borrowerOperations.adjustCdp(BIndex, 0, bobDebt, false, BIndex, BIndex, { from: B }) + const repayDebtPromise_B = borrowerOperations.adjustCdp(BIndex, 0, bobDebt, false, BIndex, BIndex, { from: B }) // B attempts to repay all his debt - await assertRevert(repayEBTCPromise_B, "revert") + await assertRevert(repayDebtPromise_B, "revert") }) // --- closeCdp() --- @@ -2341,7 +2341,7 @@ contract('BorrowerOperations', async accounts => { await priceFeed.setPrice(dec(3000, 13)) // Get Alice's pending reward snapshots - const L_EBTCDebt_A_Snapshot = (await cdpManager.debtRedistributionIndex(aliceIndex)) + const L_EBTCDebt_A_Snapshot = (await cdpManager.cdpDebtRedistributionIndex(aliceIndex)) assert.isTrue(L_EBTCDebt_A_Snapshot.gt(toBN('0'))) // Liquidate Carol @@ -2349,7 +2349,7 @@ contract('BorrowerOperations', async accounts => { assert.isFalse(await sortedCdps.contains(carolIndex)) // Get Alice's pending reward snapshots after Carol's liquidation. Check above 0 - const L_EBTCDebt_Snapshot_A_AfterLiquidation = (await cdpManager.debtRedistributionIndex(aliceIndex)) + const L_EBTCDebt_Snapshot_A_AfterLiquidation = (await cdpManager.cdpDebtRedistributionIndex(aliceIndex)) assert.isTrue(L_EBTCDebt_Snapshot_A_AfterLiquidation.gt(toBN('0'))) @@ -2362,7 +2362,7 @@ contract('BorrowerOperations', async accounts => { await borrowerOperations.closeCdp(aliceIndex, { from: alice }) // Check Alice's pending reward snapshots are zero - const L_EBTCDebt_Snapshot_A_afterAliceCloses = (await cdpManager.debtRedistributionIndex(aliceIndex)) + const L_EBTCDebt_Snapshot_A_afterAliceCloses = (await cdpManager.cdpDebtRedistributionIndex(aliceIndex)) assert.equal(L_EBTCDebt_Snapshot_A_afterAliceCloses, '0') }) @@ -2591,9 +2591,9 @@ contract('BorrowerOperations', async accounts => { assert.notEqual(carolIndex, carolIndex2); // check Alice and Bob's reward snapshots are zero before they alter their Cdps - const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(aliceIndex) + const alice_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(aliceIndex) - const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot_Before = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.equal(alice_EBTCDebtRewardSnapshot_Before, 0) assert.equal(bob_EBTCDebtRewardSnapshot_Before, 0) @@ -3539,7 +3539,7 @@ contract('BorrowerOperations', async accounts => { const bobIndex = await sortedCdps.cdpOfOwnerByIndex(bob,0) // Check Bob's snapshots of L_STETHColl and L_EBTC equal the respective current values - const bob_EBTCDebtRewardSnapshot = await cdpManager.debtRedistributionIndex(bobIndex) + const bob_EBTCDebtRewardSnapshot = await cdpManager.cdpDebtRedistributionIndex(bobIndex) assert.isAtMost(th.getDifference(bob_EBTCDebtRewardSnapshot, L_EBTC), 1000) }) @@ -4174,7 +4174,7 @@ contract('Reset chain state', async accounts => { }) /* TODO: 1) Test SortedList re-ordering by ICR. ICR ratio - changes with addColl, withdrawColl, withdrawEBTC, repayEBTC, etc. Can split them up and put them with + changes with addColl, withdrawColl, withdrawDebt, repayDebt, etc. Can split them up and put them with individual functions, or give ordering it's own 'describe' block. 2)In security phase: diff --git a/packages/contracts/test/CdpManagerTest.js b/packages/contracts/test/CdpManagerTest.js index fc2ff1a73..25426e201 100644 --- a/packages/contracts/test/CdpManagerTest.js +++ b/packages/contracts/test/CdpManagerTest.js @@ -56,7 +56,7 @@ contract('CdpManager', async accounts => { const getActualDebtFromComposite = async (compositeDebt) => th.getActualDebtFromComposite(compositeDebt, contracts) const getNetBorrowingAmount = async (debtWithFee) => th.getNetBorrowingAmount(contracts, debtWithFee) const openCdp = async (params) => th.openCdp(contracts, params) - const withdrawEBTC = async (params) => th.withdrawEBTC(contracts, params) + const withdrawDebt = async (params) => th.withdrawDebt(contracts, params) before(async () => { await hre.network.provider.request({method: "hardhat_impersonateAccount", params: [beadp]}); @@ -123,7 +123,7 @@ contract('CdpManager', async accounts => { const A_EBTCWithdrawal = await getNetBorrowingAmount(dec(130, 18)) const targetICR = toBN('1111111111111111111') - await withdrawEBTC({_cdpId: _aliceCdpId, ICR: targetICR, extraParams: { from: alice } }) + await withdrawDebt({_cdpId: _aliceCdpId, ICR: targetICR, extraParams: { from: alice } }) const ICR_AfterWithdrawal = await cdpManager.getICR(_aliceCdpId, price) assert.isAtMost(th.getDifference(ICR_AfterWithdrawal, targetICR), 100) @@ -354,7 +354,7 @@ contract('CdpManager', async accounts => { assert.isAtMost(th.getDifference(L_EBTCDebt_AfterCarolLiquidated, L_EBTCDebt_expected_1), 100) // Bob now withdraws EBTC, bringing his ICR to 1.11 - const { increasedTotalDebt: B_increasedTotalDebt } = await withdrawEBTC({_cdpId: _bobCdpId, ICR: toBN(dec(111, 16)), extraParams: { from: bob } }) + const { increasedTotalDebt: B_increasedTotalDebt } = await withdrawDebt({_cdpId: _bobCdpId, ICR: toBN(dec(111, 16)), extraParams: { from: bob } }) let _bobTotalDebt = (await cdpManager.getDebtAndCollShares(_bobCdpId))[0] // Confirm system is not in Recovery Mode @@ -1098,8 +1098,8 @@ contract('CdpManager', async accounts => { // // All remaining cdps D and E repay a little debt, applying their pending rewards assert.isTrue((await sortedCdps.getSize()).eq(toBN('3'))) - await borrowerOperations.repayEBTC(_dCdpId, _repayAmt, _dCdpId, _dCdpId, {from: D}) - await borrowerOperations.repayEBTC(_eCdpId, _repayAmt, _eCdpId, _eCdpId, {from: E}) + await borrowerOperations.repayDebt(_dCdpId, _repayAmt, _dCdpId, _dCdpId, {from: D}) + await borrowerOperations.repayDebt(_eCdpId, _repayAmt, _eCdpId, _eCdpId, {from: E}) // Check D & E pending rewards already applied assert.isTrue(await cdpManager.hasPendingRedistributedDebt(_cCdpId)) @@ -1870,8 +1870,8 @@ contract('CdpManager', async accounts => { // // All remaining cdps D and E repay a little debt, applying their pending rewards assert.isTrue((await sortedCdps.getSize()).eq(toBN('3'))) - await borrowerOperations.repayEBTC(_dCdpId, dec(1, 15), _dCdpId, _dCdpId, {from: D}) - await borrowerOperations.repayEBTC(_eCdpId, dec(1, 15), _eCdpId, _eCdpId, {from: E}) + await borrowerOperations.repayDebt(_dCdpId, dec(1, 15), _dCdpId, _dCdpId, {from: D}) + await borrowerOperations.repayDebt(_eCdpId, dec(1, 15), _eCdpId, _eCdpId, {from: E}) // Check all pending rewards already applied assert.isTrue(await cdpManager.hasPendingRedistributedDebt(_cCdpId)) @@ -2428,7 +2428,7 @@ contract('CdpManager', async accounts => { } ) - const ETHFee = th.getEmittedRedemptionValues(redemptionTx)[3] + const feeCollShares = th.getEmittedRedemptionValues(redemptionTx)[3] const alice_Cdp_After = await cdpManager.Cdps(_aliceCdpId) const bob_Cdp_After = await cdpManager.Cdps(_bobCdpId) @@ -2449,10 +2449,10 @@ contract('CdpManager', async accounts => { const receivedETH = dennis_ETHBalance_After.sub(dennis_ETHBalance_Before) const expectedTotalCollDrawn = redemptionAmount.mul(mv._1e18BN).div(price) // convert redemptionAmount EBTC to collateral at given price - const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(ETHFee)) + const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(feeCollShares)) // console.log("*********************************************************************************") - // console.log("ETHFee: " + ETHFee) + // console.log("feeCollShares: " + feeCollShares) // console.log("dennis_ETHBalance_Before: " + dennis_ETHBalance_Before) // console.log("GAS_USED: " + th.gasUsed(redemptionTx)) // console.log("dennis_ETHBalance_After: " + dennis_ETHBalance_After) @@ -2519,7 +2519,7 @@ contract('CdpManager', async accounts => { } ) - const ETHFee = th.getEmittedRedemptionValues(redemptionTx)[3] + const feeCollShares = th.getEmittedRedemptionValues(redemptionTx)[3] const alice_Cdp_After = await cdpManager.Cdps(_aliceCdpId) const bob_Cdp_After = await cdpManager.Cdps(_bobCdpId) @@ -2540,7 +2540,7 @@ contract('CdpManager', async accounts => { const receivedETH = dennis_ETHBalance_After.sub(dennis_ETHBalance_Before) const expectedTotalCollDrawn = redemptionAmount.mul(mv._1e18BN).div(price) // convert redemptionAmount EBTC to collateral at given price - const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(ETHFee)) + const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(feeCollShares)) th.assertIsApproximatelyEqual(expectedReceivedETH, receivedETH) @@ -2602,7 +2602,7 @@ contract('CdpManager', async accounts => { } ) - const ETHFee = th.getEmittedRedemptionValues(redemptionTx)[3] + const feeCollShares = th.getEmittedRedemptionValues(redemptionTx)[3] const alice_Cdp_After = await cdpManager.Cdps(_aliceCdpId) const bob_Cdp_After = await cdpManager.Cdps(_bobCdpId) @@ -2623,7 +2623,7 @@ contract('CdpManager', async accounts => { const receivedETH = dennis_ETHBalance_After.sub(dennis_ETHBalance_Before) const expectedTotalCollDrawn = redemptionAmount.mul(mv._1e18BN).div(price) // convert redemptionAmount EBTC to collateral at given price - const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(ETHFee)) + const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(feeCollShares)) th.assertIsApproximatelyEqual(expectedReceivedETH, receivedETH) @@ -2692,7 +2692,7 @@ contract('CdpManager', async accounts => { } ) - const ETHFee = th.getEmittedRedemptionValues(redemptionTx)[3] + const feeCollShares = th.getEmittedRedemptionValues(redemptionTx)[3] const alice_Cdp_After = await cdpManager.Cdps(_aliceCdpId) const bob_Cdp_After = await cdpManager.Cdps(_bobCdpId) @@ -2713,7 +2713,7 @@ contract('CdpManager', async accounts => { const receivedETH = dennis_ETHBalance_After.sub(dennis_ETHBalance_Before) const expectedTotalCollDrawn = redemptionAmount.mul(mv._1e18BN).div(price) // convert redemptionAmount EBTC to collateral at given price - const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(ETHFee)) + const expectedReceivedETH = expectedTotalCollDrawn.sub(toBN(feeCollShares)) th.assertIsApproximatelyEqual(expectedReceivedETH, receivedETH) @@ -3035,12 +3035,12 @@ contract('CdpManager', async accounts => { } ) - const ETHFee = th.getEmittedRedemptionValues(redemptionTx)[3] + const feeCollShares = th.getEmittedRedemptionValues(redemptionTx)[3] const carol_ETHBalance_After = toBN(await web3.eth.getBalance(carol)) const expectedTotalCollDrawn = toBN(amount).div(price) // convert 100 EBTC to collateral at given price - const expectedReceivedETH = expectedTotalCollDrawn.sub(ETHFee) + const expectedReceivedETH = expectedTotalCollDrawn.sub(feeCollShares) const receivedETH = carol_ETHBalance_After.sub(carol_ETHBalance_Before) assert.isTrue(expectedReceivedETH.eq(receivedETH)) @@ -3909,7 +3909,7 @@ contract('CdpManager', async accounts => { assert.isTrue(lastFeeOpTime_3.gt(lastFeeOpTime_1)) }) - it("redeemCollateral(): a redemption made at zero base rate send a non-zero ETHFee to FeeRecipient", async () => { + it("redeemCollateral(): a redemption made at zero base rate send a non-zero feeCollShares to FeeRecipient", async () => { // time fast-forwards 1 year, and multisig stakes 1 LQTY await th.fastForwardTime(timeValues.SECONDS_IN_ONE_YEAR, web3.currentProvider) @@ -4070,7 +4070,7 @@ contract('CdpManager', async accounts => { assert.isTrue(feeRecipientBalanceAfter.gt(feeRecipientBalanceBefore)) }) - it("redeemCollateral(): a redemption sends the ETH remainder (ETHDrawn - ETHFee) to the redeemer", async () => { + it("redeemCollateral(): a redemption sends the ETH remainder (ETHDrawn - feeCollShares) to the redeemer", async () => { // time fast-forwards 1 year, and multisig stakes 1 LQTY await th.fastForwardTime(timeValues.SECONDS_IN_ONE_YEAR, web3.currentProvider) @@ -4479,7 +4479,7 @@ contract('CdpManager', async accounts => { const current_L_EBTCDebt = await cdpManager.systemDebtRedistributionIndex() assert.isTrue(current_L_EBTCDebt.gt(toBN('0'))) - const carolSnapshot_L_EBTCDebt = (await cdpManager.debtRedistributionIndex(_carolCdpId)) + const carolSnapshot_L_EBTCDebt = (await cdpManager.cdpDebtRedistributionIndex(_carolCdpId)) assert.equal(carolSnapshot_L_EBTCDebt, 0) const carol_PendingEBTCDebtReward = (await cdpManager.getPendingRedistributedDebt(_carolCdpId)) diff --git a/packages/contracts/test/CdpManager_LiquidationRewardsTest.js b/packages/contracts/test/CdpManager_LiquidationRewardsTest.js index 0ae6b0b15..c4794cb8c 100644 --- a/packages/contracts/test/CdpManager_LiquidationRewardsTest.js +++ b/packages/contracts/test/CdpManager_LiquidationRewardsTest.js @@ -549,7 +549,7 @@ contract('CdpManager - Redistribution reward calculations', async accounts => { await priceFeed.setPrice(dec(7428, 13)) // Alice withdraws EBTC - await borrowerOperations.withdrawEBTC(_aliceCdpId, await getNetBorrowingAmount(A_totalDebt), _aliceCdpId, _aliceCdpId, { from: alice }) + await borrowerOperations.withdrawDebt(_aliceCdpId, await getNetBorrowingAmount(A_totalDebt), _aliceCdpId, _aliceCdpId, { from: alice }) // Price drops to 100 $/E await priceFeed.setPrice(_newPrice) @@ -911,7 +911,7 @@ contract('CdpManager - Redistribution reward calculations', async accounts => { await priceFeed.setPrice(dec(7428, 13)) // Alice withdraws EBTC - await borrowerOperations.withdrawEBTC(_aliceCdpId, await getNetBorrowingAmount(A_totalDebt), _aliceCdpId, _aliceCdpId, { from: alice }) + await borrowerOperations.withdrawDebt(_aliceCdpId, await getNetBorrowingAmount(A_totalDebt), _aliceCdpId, _aliceCdpId, { from: alice }) // Price drops to 100 $/E await priceFeed.setPrice(_newPrice) diff --git a/packages/contracts/test/CdpManager_RecoveryMode_Cooldown_Test.js b/packages/contracts/test/CdpManager_RecoveryMode_Cooldown_Test.js index 45b471064..20ee4b88a 100644 --- a/packages/contracts/test/CdpManager_RecoveryMode_Cooldown_Test.js +++ b/packages/contracts/test/CdpManager_RecoveryMode_Cooldown_Test.js @@ -49,7 +49,7 @@ contract('CdpManager - Cooldown switch with respect to Recovery Mode to ensure d _MCR = await cdpManager.MCR(); _CCR = await cdpManager.CCR(); LICR = await cdpManager.LICR(); - _coolDownWait = await cdpManager.recoveryModeGracePeriod(); + _coolDownWait = await cdpManager.recoveryModeGracePeriodDuration(); borrowerOperations = contracts.borrowerOperations; collSurplusPool = contracts.collSurplusPool; collToken = contracts.collateral; @@ -198,7 +198,7 @@ contract('CdpManager - Cooldown switch with respect to Recovery Mode to ensure d await priceFeed.setPrice(_originalPrice); let _tcrAfter = await cdpManager.getTCR(_originalPrice); assert.isTrue(toBN(_tcrAfter.toString()).gt(_CCR)); - await borrowerOperations.withdrawEBTC(_carolCdpId, _dustVal, _carolCdpId, _carolCdpId, { from: carol } ); + await borrowerOperations.withdrawDebt(_carolCdpId, _dustVal, _carolCdpId, _carolCdpId, { from: carol } ); let _rmExitTimestamp = await cdpManager.lastGracePeriodStartTimestamp(); assert.isTrue(_rmExitTimestamp.eq(_initVal)); @@ -212,7 +212,7 @@ contract('CdpManager - Cooldown switch with respect to Recovery Mode to ensure d // end RM cooldown by adjust a CDP in RM (repayment) await debtToken.approve(borrowerOperations.address, _carolDebt, {from: carol}); - await borrowerOperations.repayEBTC(_carolCdpId, _carolDebt, _carolCdpId, _carolCdpId, { from: carol } ); + await borrowerOperations.repayDebt(_carolCdpId, _carolDebt, _carolCdpId, _carolCdpId, { from: carol } ); let _tcrFinal = await cdpManager.getTCR(_newPrice); assert.isTrue(toBN(_tcrFinal.toString()).gt(_CCR)); let _rmExitFinal = await cdpManager.lastGracePeriodStartTimestamp(); diff --git a/packages/contracts/test/CdpManager_StakingSplitFee_Test.js b/packages/contracts/test/CdpManager_StakingSplitFee_Test.js index da99b47d5..cd13add9d 100644 --- a/packages/contracts/test/CdpManager_StakingSplitFee_Test.js +++ b/packages/contracts/test/CdpManager_StakingSplitFee_Test.js @@ -117,7 +117,7 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco // apply accumulated fee split to CDP upon user operations let _expectedFeeShare = _fees[0]; - await borrowerOperations.withdrawEBTC(_aliceCdpId, 1, _aliceCdpId, _aliceCdpId, { from: alice, value: 0 }) + await borrowerOperations.withdrawDebt(_aliceCdpId, 1, _aliceCdpId, _aliceCdpId, { from: alice, value: 0 }) let _aliceCollAfter = await cdpManager.getCdpCollShares(_aliceCdpId); let _totalCollAfter = await cdpManager.getSystemCollShares(); th.assertIsApproximatelyEqual(_aliceCollAfter, _aliceColl.sub(_expectedFeeShare), _errorTolerance); @@ -236,8 +236,8 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco assert.isTrue(toBN(_tcrAfter.toString()).gt(toBN(_tcrBefore.toString()))); // apply accumulated fee split to CDP upon user operations - await borrowerOperations.withdrawEBTC(_aliceCdpId, 1, _aliceCdpId, _aliceCdpId, { from: alice, value: 0 }) - await borrowerOperations.withdrawEBTC(_bobCdpId, 1, _bobCdpId, _bobCdpId, { from: bob, value: 0 }) + await borrowerOperations.withdrawDebt(_aliceCdpId, 1, _aliceCdpId, _aliceCdpId, { from: alice, value: 0 }) + await borrowerOperations.withdrawDebt(_bobCdpId, 1, _bobCdpId, _bobCdpId, { from: bob, value: 0 }) _oldIndex = _newIndex; _newIndex = _newIndex.add((mv._1_5e18BN.sub(mv._1e18BN)));// increase by 0.05 for next @@ -492,11 +492,11 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco let _moreDebt = toBN("708960105069686413"); _deltaRequiredIdx = await cdpManager.getDeltaIndexToTriggerRM(_newIndex, _newPrice, _newSplitFee); assert.isTrue(_newIndex.sub(_oldIndex).gte(_deltaRequiredIdx)); - await assertRevert(borrowerOperations.withdrawEBTC(_cdpId, _moreDebt, th.DUMMY_BYTES32, th.DUMMY_BYTES32), "BorrowerOperations: Operation must leave cdp with ICR >= CCR"); + await assertRevert(borrowerOperations.withdrawDebt(_cdpId, _moreDebt, th.DUMMY_BYTES32, th.DUMMY_BYTES32), "BorrowerOperations: Operation must leave cdp with ICR >= CCR"); // price rebounce and adjust CDP await priceFeed.setPrice(_originalPrice); - borrowerOperations.withdrawEBTC(_cdpId, _moreDebt, th.DUMMY_BYTES32, th.DUMMY_BYTES32) + borrowerOperations.withdrawDebt(_cdpId, _moreDebt, th.DUMMY_BYTES32, th.DUMMY_BYTES32) // make some fee to claim await ethers.provider.send("evm_increaseTime", [43924]); @@ -559,8 +559,8 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco let _syncedTCR = await cdpManager.getSyncedTCR(_price); // apply CDP sync with staking split fee - await borrowerOperations.withdrawEBTC(_firstId, 1, th.DUMMY_BYTES32, th.DUMMY_BYTES32); - await borrowerOperations.repayEBTC(_firstId, 1, th.DUMMY_BYTES32, th.DUMMY_BYTES32); + await borrowerOperations.withdrawDebt(_firstId, 1, th.DUMMY_BYTES32, th.DUMMY_BYTES32); + await borrowerOperations.repayDebt(_firstId, 1, th.DUMMY_BYTES32, th.DUMMY_BYTES32); let _newIdxCached = await cdpManager.stEthIndex(); assert.isTrue(_newIdxCached.eq(_newIndex)); let _cdpCollAfter = await cdpManager.getCdpCollShares(_firstId); @@ -621,10 +621,10 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco let _bobId = await sortedCdps.cdpOfOwnerByIndex(bob, 0); // check synced state after CDP initialization - let _bobDebtIndex = await cdpManager.debtRedistributionIndex(_bobId); + let _bobDebtIndex = await cdpManager.cdpDebtRedistributionIndex(_bobId); let _globalDebtIndex = await cdpManager.systemDebtRedistributionIndex(); assert.isTrue(_globalDebtIndex.eq(_bobDebtIndex)); - let _bobFeeIndex = await cdpManager.stEthFeePerUnitIndex(_bobId); + let _bobFeeIndex = await cdpManager.cdpStEthFeePerUnitIndex(_bobId); let _globalFeeIndex = await cdpManager.systemStEthFeePerUnitIndex(); assert.isTrue(_globalFeeIndex.eq(_bobFeeIndex)); @@ -719,7 +719,7 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco let _cdpId = await sortedCdps.cdpOfOwnerByIndex(owner, 0); let _cdpDebtColl = await cdpManager.getDebtAndCollShares(_cdpId); let _nicrStart = await cdpManager.getNominalICR(_cdpId); - let _cdpSplitIdxStart = await cdpManager.stEthFeePerUnitIndex(_cdpId); + let _cdpSplitIdxStart = await cdpManager.cdpStEthFeePerUnitIndex(_cdpId); console.log('startNICR:' + _nicrStart + ', _cdpSplitIdxStart=' + _cdpSplitIdxStart); // now there is staking reward to split @@ -739,7 +739,7 @@ contract('CdpManager - Simple Liquidation with external liquidators', async acco assert.isTrue(_expectedFeeApplied[0].gt(_addedColl));// split fee take more collateral than added so NICR could decrease await collToken.deposit({from: owner, value: _addedColl}); await borrowerOperations.addColl(_cdpId, _cdpId, _cdpId, 20, { from: owner, value: 0 }) - let _cdpSplitIdxAfter = await cdpManager.stEthFeePerUnitIndex(_cdpId); + let _cdpSplitIdxAfter = await cdpManager.cdpStEthFeePerUnitIndex(_cdpId); assert.isTrue(_cdpSplitIdxAfter.eq(_expectedNewIdxPerUnit)); let _nicrAfter = await cdpManager.getNominalICR(_cdpId); diff --git a/packages/contracts/test/LiquityMathTest.js b/packages/contracts/test/EbtcMathTest.js similarity index 63% rename from packages/contracts/test/LiquityMathTest.js rename to packages/contracts/test/EbtcMathTest.js index c8032e1bc..17a72c47a 100644 --- a/packages/contracts/test/LiquityMathTest.js +++ b/packages/contracts/test/EbtcMathTest.js @@ -1,13 +1,13 @@ -const LiquityMathTester = artifacts.require("./LiquityMathTester.sol") +const EbtcMathTester = artifacts.require("./EbtcMathTester.sol") -contract('LiquityMath', async accounts => { - let liquityMathTester +contract('EbtcMath', async accounts => { + beforeEach('deploy tester', async () => { - liquityMathTester = await LiquityMathTester.new() + ebtcMathTester = await EbtcMathTester.new() }) const checkFunction = async (func, cond, params) => { - assert.equal(await liquityMathTester[func](...params), cond(...params)) + assert.equal(await ebtcMathTester[func](...params), cond(...params)) } it('max works if a > b', async () => { diff --git a/packages/contracts/test/FeeArithmeticTest.js b/packages/contracts/test/FeeArithmeticTest.js index 9149c3a69..82aab3b0b 100644 --- a/packages/contracts/test/FeeArithmeticTest.js +++ b/packages/contracts/test/FeeArithmeticTest.js @@ -3,7 +3,7 @@ const deploymentHelper = require("../utils/deploymentHelpers.js") const { BNConverter } = require("../utils/BNConverter.js") const testHelpers = require("../utils/testHelpers.js") const CdpManagerTester = artifacts.require("./CdpManagerTester.sol") -const LiquityMathTester = artifacts.require("./LiquityMathTester.sol") +const EbtcMathTester = artifacts.require("./EbtcMathTester.sol") const LiquidationLibrary = artifacts.require("./LiquidationLibrary.sol") const th = testHelpers.TestHelper @@ -332,8 +332,8 @@ contract('Fee arithmetic tests', async accounts => { ] before(async () => { - mathTester = await LiquityMathTester.new() - LiquityMathTester.setAsDeployed(mathTester) + mathTester = await EbtcMathTester.new() + EbtcMathTester.setAsDeployed(mathTester) }) beforeEach(async () => { diff --git a/packages/contracts/test/HintHelpers_getApproxHintTest.js b/packages/contracts/test/HintHelpers_getApproxHintTest.js index dbf2b7f6c..494bbbd1f 100644 --- a/packages/contracts/test/HintHelpers_getApproxHintTest.js +++ b/packages/contracts/test/HintHelpers_getApproxHintTest.js @@ -39,8 +39,8 @@ contract('HintHelpers', async accounts => { // console.time("makeCdpsInParallel") const openCdppromises = activeAccounts.map((account, index) => openCdp(account, index)) await Promise.all(openCdppromises) - const withdrawEBTCpromises = activeAccounts.map(account => withdrawEBTCfromCdp(account)) - await Promise.all(withdrawEBTCpromises) + const withdrawDebtpromises = activeAccounts.map(account => withdrawDebtfromCdp(account)) + await Promise.all(withdrawDebtpromises) // console.timeEnd("makeCdpsInParallel") } @@ -50,8 +50,8 @@ contract('HintHelpers', async accounts => { await borrowerOperations.openCdp(0, account, account, { from: account, value: coll }) } - const withdrawEBTCfromCdp = async (account) => { - await borrowerOperations.withdrawEBTC(th._100pct, '100000000000000000000', account, account, { from: account }) + const withdrawDebtfromCdp = async (account) => { + await borrowerOperations.withdrawDebt(th._100pct, '100000000000000000000', account, account, { from: account }) } // Sequentially add coll and withdraw EBTC, 1 account at a time diff --git a/packages/contracts/tests/simulation_helpers.py b/packages/contracts/tests/simulation_helpers.py index 0835774b2..dd9a73d41 100644 --- a/packages/contracts/tests/simulation_helpers.py +++ b/packages/contracts/tests/simulation_helpers.py @@ -678,7 +678,7 @@ def adjust_cdps(accounts, contracts, active_accounts, inactive_accounts, price_e pending = get_ebtc_to_repay(accounts, contracts, active_accounts, inactive_accounts, account, repay_amount) if pending == 0: - contracts.borrowerOperations.repayEBTC(cdp_id, repay_amount, hints[0], hints[1], + contracts.borrowerOperations.repayDebt(cdp_id, repay_amount, hints[0], hints[1], {'from': account}) elif check > 2 and not is_recovery_mode(contracts, price_ether_current): # withdraw EBTC @@ -686,7 +686,7 @@ def adjust_cdps(accounts, contracts, active_accounts, inactive_accounts, price_e withdraw_amount_wei = floatToWei(withdraw_amount) if is_new_tcr_above_ccr(contracts, 0, False, withdraw_amount_wei, True, floatToWei(price_ether_current)): - contracts.borrowerOperations.withdrawEBTC(cdp_id, withdraw_amount_wei, + contracts.borrowerOperations.withdrawDebt(cdp_id, withdraw_amount_wei, hints[0], hints[1], {'from': account}) rate_issuance = contracts.cdpManager.getBorrowingRateWithDecay() / 1e18 issuance_ebtc_adjust = issuance_ebtc_adjust + rate_issuance * withdraw_amount diff --git a/packages/contracts/utils/deploymentGasAndBytecode.js b/packages/contracts/utils/deploymentGasAndBytecode.js index 682a2a4cd..2ae785fcc 100644 --- a/packages/contracts/utils/deploymentGasAndBytecode.js +++ b/packages/contracts/utils/deploymentGasAndBytecode.js @@ -15,7 +15,7 @@ const HintHelpers = artifacts.require("./HintHelpers.sol") const CommunityIssuanceTester = artifacts.require("./LQTY/CommunityIssuanceTester.sol") const ActivePoolTester = artifacts.require("./ActivePoolTester.sol") -const LiquityMathTester = artifacts.require("./LiquityMathTester.sol") +const EbtcMathTester = artifacts.require("./EbtcMathTester.sol") const BorrowerOperationsTester = artifacts.require("./BorrowerOperationsTester.sol") const CdpManagerTester = artifacts.require("./CdpManagerTester.sol") const EBTCTokenTester = artifacts.require("./EBTCTokenTester.sol") @@ -46,7 +46,7 @@ const LQTYContractABIs = [ const TesterContractABIs = [ CommunityIssuanceTester, ActivePoolTester, - LiquityMathTester, + EbtcMathTester, BorrowerOperationsTester, CdpManagerTester, EBTCTokenTester, diff --git a/packages/contracts/utils/deploymentHelpers.js b/packages/contracts/utils/deploymentHelpers.js index 221fc6592..df5ffee03 100644 --- a/packages/contracts/utils/deploymentHelpers.js +++ b/packages/contracts/utils/deploymentHelpers.js @@ -21,7 +21,7 @@ const FeeRecipient = artifacts.require("./FeeRecipient.sol") const EBTCDeployer = artifacts.require("./EBTCDeployer.sol") const ActivePoolTester = artifacts.require("./ActivePoolTester.sol") -const LiquityMathTester = artifacts.require("./LiquityMathTester.sol") +const EbtcMathTester = artifacts.require("./EbtcMathTester.sol") const BorrowerOperationsTester = artifacts.require("./BorrowerOperationsTester.sol") const CdpManagerTester = artifacts.require("./CdpManagerTester.sol") const EBTCTokenTester = artifacts.require("./EBTCTokenTester.sol") @@ -474,7 +474,7 @@ class DeploymentHelper { testerContracts.weth = await WETH9.new() testerContracts.functionCaller = await FunctionCaller.new(); testerContracts.collateral = collateral; - testerContracts.math = await LiquityMathTester.new() + testerContracts.math = await EbtcMathTester.new() /** struct EbtcAddresses { diff --git a/packages/contracts/utils/proxyHelpers.js b/packages/contracts/utils/proxyHelpers.js index 645654aed..32c8b1c2d 100644 --- a/packages/contracts/utils/proxyHelpers.js +++ b/packages/contracts/utils/proxyHelpers.js @@ -103,12 +103,12 @@ class BorrowerOperationsProxy extends Proxy { return this.forwardFunction(params, 'withdrawColl(uint256,bytes32,bytes32)') } - async withdrawEBTC(...params) { - return this.forwardFunction(params, 'withdrawEBTC(uint256,bytes32,bytes32)') + async withdrawDebt(...params) { + return this.forwardFunction(params, 'withdrawDebt(uint256,bytes32,bytes32)') } - async repayEBTC(...params) { - return this.forwardFunction(params, 'repayEBTC(uint256,bytes32,bytes32)') + async repayDebt(...params) { + return this.forwardFunction(params, 'repayDebt(uint256,bytes32,bytes32)') } async closeCdp(...params) { @@ -235,8 +235,8 @@ class CdpManagerProxy extends Proxy { return this.proxyFunction('systemDebtRedistributionIndex', []) } - async debtRedistributionIndex(user) { - return this.proxyFunctionWithUser('debtRedistributionIndex', user) + async cdpDebtRedistributionIndex(user) { + return this.proxyFunctionWithUser('cdpDebtRedistributionIndex', user) } async lastRedemptionTimestamp() { diff --git a/packages/contracts/utils/testHelpers.js b/packages/contracts/utils/testHelpers.js index bdc7849f2..1b675de38 100644 --- a/packages/contracts/utils/testHelpers.js +++ b/packages/contracts/utils/testHelpers.js @@ -300,7 +300,7 @@ class TestHelper { static async syncGlobalStateAndGracePeriod(contracts, provider){ await contracts.cdpManager.syncGlobalAccountingAndGracePeriod(); - let _gracePeriod = await contracts.cdpManager.recoveryModeGracePeriod(); + let _gracePeriod = await contracts.cdpManager.recoveryModeGracePeriodDuration(); await provider.send("evm_increaseTime", [_gracePeriod.add(web3.utils.toBN('1')).toNumber()]); await provider.send("evm_mine"); } @@ -381,10 +381,10 @@ class TestHelper { const EBTCAmount = redemptionTx.logs[i].args[0] const totalEBTCRedeemed = redemptionTx.logs[i].args[1] - const totalETHDrawn = redemptionTx.logs[i].args[2] - const ETHFee = redemptionTx.logs[i].args[3] + const collSharesDrawn = redemptionTx.logs[i].args[2] + const feeCollShares = redemptionTx.logs[i].args[3] - return [EBTCAmount, totalEBTCRedeemed, totalETHDrawn, ETHFee] + return [EBTCAmount, totalEBTCRedeemed, collSharesDrawn, feeCollShares] } } throw ("The transaction logs do not contain a redemption event") @@ -574,7 +574,7 @@ class TestHelper { return { newColl, newDebt } } - static async getCollAndDebtFromWithdrawEBTC(contracts, account, amount) { + static async getCollAndDebtFromwithdrawDebt(contracts, account, amount) { const { entireColl, entireDebt } = await this.getEntireCollAndDebt(contracts, account) const newColl = entireColl @@ -583,7 +583,7 @@ class TestHelper { return { newColl, newDebt } } - static async getCollAndDebtFromRepayEBTC(contracts, account, amount) { + static async getCollAndDebtFromrepayDebt(contracts, account, amount) { const { entireColl, entireDebt } = await this.getEntireCollAndDebt(contracts, account) const newColl = entireColl @@ -819,7 +819,7 @@ class TestHelper { return tx; } - static async withdrawEBTC(contracts, { + static async withdrawDebt(contracts, { _cdpId, ebtcAmount, ICR, @@ -845,7 +845,7 @@ class TestHelper { increasedTotalDebt = await this.getAmountWithBorrowingFee(contracts, ebtcAmount) } - await contracts.borrowerOperations.withdrawEBTC(_cdpId, ebtcAmount, upperHint, lowerHint, extraParams) + await contracts.borrowerOperations.withdrawDebt(_cdpId, ebtcAmount, upperHint, lowerHint, extraParams) return { ebtcAmount, @@ -993,64 +993,64 @@ class TestHelper { return this.getGasMetrics(gasCostList) } - static async withdrawEBTC_allAccounts(accounts, contracts, amount, cdpIds) { + static async withdrawDebt_allAccounts(accounts, contracts, amount, cdpIds) { const gasCostList = [] for (let i = 0;i < accounts.length;i++) { const account = accounts[i]; - const { newColl, newDebt } = await this.getCollAndDebtFromWithdrawEBTC(contracts, cdpIds[i], amount) + const { newColl, newDebt } = await this.getCollAndDebtFromwithdrawDebt(contracts, cdpIds[i], amount) const {upperHint, lowerHint} = await this.getBorrowerOpsListHint(contracts, newColl, newDebt) - const tx = await contracts.borrowerOperations.withdrawEBTC(cdpIds[i], amount, upperHint, lowerHint, { from: account }) + const tx = await contracts.borrowerOperations.withdrawDebt(cdpIds[i], amount, upperHint, lowerHint, { from: account }) const gas = this.gasUsed(tx) gasCostList.push(gas) } return this.getGasMetrics(gasCostList) } - static async withdrawEBTC_allAccounts_randomAmount(min, max, accounts, contracts, cdpIds) { + static async withdrawDebt_allAccounts_randomAmount(min, max, accounts, contracts, cdpIds) { const gasCostList = [] for (let i = 0;i < accounts.length;i++) { const account = accounts[i]; const randEBTCAmount = this.randAmountInWei(min, max) - const { newColl, newDebt } = await this.getCollAndDebtFromWithdrawEBTC(contracts, cdpIds[i], randEBTCAmount) + const { newColl, newDebt } = await this.getCollAndDebtFromwithdrawDebt(contracts, cdpIds[i], randEBTCAmount) const {upperHint, lowerHint} = await this.getBorrowerOpsListHint(contracts, newColl, newDebt) - const tx = await contracts.borrowerOperations.withdrawEBTC(cdpIds[i], randEBTCAmount, upperHint, lowerHint, { from: account }) + const tx = await contracts.borrowerOperations.withdrawDebt(cdpIds[i], randEBTCAmount, upperHint, lowerHint, { from: account }) const gas = this.gasUsed(tx) gasCostList.push(gas) } return this.getGasMetrics(gasCostList) } - static async repayEBTC_allAccounts(accounts, contracts, amount, cdpIds) { + static async repayDebt_allAccounts(accounts, contracts, amount, cdpIds) { const gasCostList = [] for (let i = 0;i < accounts.length;i++) { const account = accounts[i]; - const { newColl, newDebt } = await this.getCollAndDebtFromRepayEBTC(contracts, cdpIds[i], amount) + const { newColl, newDebt } = await this.getCollAndDebtFromrepayDebt(contracts, cdpIds[i], amount) const {upperHint, lowerHint} = await this.getBorrowerOpsListHint(contracts, newColl, newDebt) - const tx = await contracts.borrowerOperations.repayEBTC(cdpIds[i], amount, upperHint, lowerHint, { from: account }) + const tx = await contracts.borrowerOperations.repayDebt(cdpIds[i], amount, upperHint, lowerHint, { from: account }) const gas = this.gasUsed(tx) gasCostList.push(gas) } return this.getGasMetrics(gasCostList) } - static async repayEBTC_allAccounts_randomAmount(min, max, accounts, contracts, cdpIds) { + static async repayDebt_allAccounts_randomAmount(min, max, accounts, contracts, cdpIds) { const gasCostList = [] for (let i = 0;i < accounts.length;i++) { const account = accounts[i]; const randEBTCAmount = this.randAmountInWei(min, max) - const { newColl, newDebt } = await this.getCollAndDebtFromRepayEBTC(contracts, cdpIds[i], randEBTCAmount) + const { newColl, newDebt } = await this.getCollAndDebtFromrepayDebt(contracts, cdpIds[i], randEBTCAmount) const {upperHint, lowerHint} = await this.getBorrowerOpsListHint(contracts, newColl, newDebt) - const tx = await contracts.borrowerOperations.repayEBTC(cdpIds[i], randEBTCAmount, upperHint, lowerHint, { from: account }) + const tx = await contracts.borrowerOperations.repayDebt(cdpIds[i], randEBTCAmount, upperHint, lowerHint, { from: account }) const gas = this.gasUsed(tx) gasCostList.push(gas) } diff --git a/packages/fuzzer/.gitignore b/packages/fuzzer/.gitignore deleted file mode 100644 index 5d376b6a0..000000000 --- a/packages/fuzzer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/chaos.csv diff --git a/packages/fuzzer/package.json b/packages/fuzzer/package.json deleted file mode 100644 index 04eba4f1e..000000000 --- a/packages/fuzzer/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "@ebtc/fuzzer", - "version": "0.0.1", - "private": true, - "scripts": { - "fuzzer": "ts-node src/index.ts" - }, - "devDependencies": { - "@types/yargs": "^16.0.0", - "colors": "^1.4.0", - "dotenv": "^8.2.0", - "ethers": "^5.4.3", - "ts-node": "^9.0.0", - "typescript": "~4.1.0", - "yargs": "^16.0.3" - } -} diff --git a/packages/fuzzer/src/GasHistogram.ts b/packages/fuzzer/src/GasHistogram.ts deleted file mode 100644 index 5f7648e31..000000000 --- a/packages/fuzzer/src/GasHistogram.ts +++ /dev/null @@ -1,86 +0,0 @@ -import assert from "assert"; - -import { BigNumber } from "@ethersproject/bignumber"; -import { TransactionReceipt } from "@ethersproject/abstract-provider"; - -import { EthersTransactionFailedError, SentEthersLiquityTransaction } from "@liquity/lib-ethers"; -import { MinedReceipt } from "@liquity/lib-base"; - -// Supports a max of 8 million gas -const intervalWidth = 10000; -const numberOfBins = 800; - -const retryUpTo = async ( - times: number, - sendTx: () => Promise -): Promise<[retries: number, receipt: MinedReceipt]> => { - let retries = 0; - - for (;;) { - const tx = await sendTx(); - const receipt = await tx.waitForReceipt(); - - if ( - receipt.status === "succeeded" || - receipt.rawReceipt.gasUsed.lt(tx.rawSentTransaction.gasLimit) || - retries === times - ) { - if (receipt.status === "succeeded" && retries) { - console.log(`// Retry succeeded with gasLimit = ${tx.rawSentTransaction.gasLimit}`); - } - - return [retries, receipt]; - } - - console.log(`// !!! Ran out of gas with gasLimit = ${tx.rawSentTransaction.gasLimit}`); - retries++; - } -}; - -export class GasHistogram { - expectedFailures = 0; - outOfGasFailures = 0; - - private readonly gasUsedBins = new Array(numberOfBins).fill(0); - - private addToGasUsedHisto(gasUsed: BigNumber) { - const binIndex = Math.floor(gasUsed.toNumber() / intervalWidth); - assert(binIndex < this.gasUsedBins.length); - this.gasUsedBins[binIndex]++; - } - - getResults(): [intervalMin: number, frequency: number][] { - const firstNonZeroIndex = this.gasUsedBins.findIndex(x => x > 0); - const firstNonZeroIndexFromEnd = this.gasUsedBins - .slice() - .reverse() - .findIndex(x => x > 0); - - return this.gasUsedBins - .slice(firstNonZeroIndex, this.gasUsedBins.length - firstNonZeroIndexFromEnd) - .map((frequency, i) => [intervalWidth * (firstNonZeroIndex + i), frequency]); - } - - async expectSuccess(sendTx: () => Promise>): Promise { - const [retries, receipt] = await retryUpTo(1, sendTx); - - this.outOfGasFailures += retries; - - if (receipt.status !== "succeeded") { - throw new EthersTransactionFailedError("Transaction failed", receipt); - } - - this.addToGasUsedHisto(receipt.rawReceipt.gasUsed); - } - - async expectFailure(waitForSuccess: () => Promise): Promise { - try { - await waitForSuccess(); - } catch { - this.expectedFailures++; - return; - } - - throw new Error("Unexpected success"); - } -} diff --git a/packages/fuzzer/src/commands/chaos.ts b/packages/fuzzer/src/commands/chaos.ts deleted file mode 100644 index 52b36b59c..000000000 --- a/packages/fuzzer/src/commands/chaos.ts +++ /dev/null @@ -1,198 +0,0 @@ -import fs from "fs"; - -import { - Decimal, - Difference, - EBTC_MINIMUM_DEBT, - Cdp, - CdpWithPendingRedistribution -} from "@liquity/lib-base"; - -import { Fixture } from "../fixture"; -import { deployer, funder, provider, subgraph } from "../globals"; - -import { - checkPoolBalances, - checkSubgraph, - checkCdpOrdering, - connectUsers, - createRandomWallets, - getListOfCdpsBeforeRedistribution, - shortenAddress -} from "../utils"; - -export interface ChaosParams { - rounds: number; - users: number; - subgraph: boolean; -} - -export const chaos = async ({ - rounds: numberOfRounds, - users: numberOfUsers, - subgraph: shouldCheckSubgraph -}: ChaosParams) => { - const [frontend, ...randomUsers] = createRandomWallets(numberOfUsers + 1, provider); - - const [deployerLiquity, funderLiquity, frontendLiquity, ...randomLiquities] = await connectUsers([ - deployer, - funder, - frontend, - ...randomUsers - ]); - - const fixture = await Fixture.setup( - deployerLiquity, - funder, - funderLiquity, - frontend.address, - frontendLiquity - ); - - let previousListOfCdps: CdpWithPendingRedistribution[] | undefined = undefined; - - console.log(); - console.log("// Keys"); - console.log(`[frontend]: ${frontend.privateKey}`); - randomUsers.forEach(user => console.log(`[${shortenAddress(user.address)}]: ${user.privateKey}`)); - - for (let i = 1; i <= numberOfRounds; ++i) { - console.log(); - console.log(`// Round #${i}`); - - const price = await fixture.setRandomPrice(); - await fixture.liquidateRandomNumberOfCdps(price); - - for (let i = 0; i < randomUsers.length; ++i) { - const user = randomUsers[i]; - const liquity = randomLiquities[i]; - - const x = Math.random(); - - if (x < 0.5) { - const cdp = await liquity.getCdp(); - - if (cdp.isEmpty) { - await fixture.openRandomCdp(user.address, liquity); - } else { - if (x < 0.4) { - await fixture.randomlyAdjustCdp(user.address, liquity, cdp); - } else { - await fixture.closeCdp(user.address, liquity, cdp); - } - } - } else if (x < 0.7) { - const deposit = await liquity.getStabilityDeposit(); - - if (deposit.initialEBTC.isZero || x < 0.6) { - await fixture.depositRandomAmountInStabilityPool(user.address, liquity); - } else { - await fixture.withdrawRandomAmountFromStabilityPool(user.address, liquity, deposit); - } - } else if (x < 0.9) { - const stake = await liquity.getLQTYStake(); - - if (stake.stakedLQTY.isZero || x < 0.8) { - await fixture.stakeRandomAmount(user.address, liquity); - } else { - await fixture.unstakeRandomAmount(user.address, liquity, stake); - } - } else { - await fixture.redeemRandomAmount(user.address, liquity); - } - - // await fixture.sweepEBTC(liquity); - await fixture.sweepLQTY(liquity); - - const listOfCdps = await getListOfCdpsBeforeRedistribution(deployerLiquity); - const totalRedistributed = await deployerLiquity.getTotalRedistributed(); - - checkCdpOrdering(listOfCdps, totalRedistributed, price, previousListOfCdps); - await checkPoolBalances(deployerLiquity, listOfCdps, totalRedistributed); - - previousListOfCdps = listOfCdps; - } - - if (shouldCheckSubgraph) { - const blockNumber = await provider.getBlockNumber(); - await subgraph.waitForBlock(blockNumber); - await checkSubgraph(subgraph, deployerLiquity); - } - } - - fs.appendFileSync("chaos.csv", fixture.summarizeGasStats()); -}; - -export const order = async () => { - const [deployerLiquity, funderLiquity] = await connectUsers([deployer, funder]); - - const initialPrice = await deployerLiquity.getPrice(); - // let initialNumberOfCdps = await funderLiquity.getNumberOfCdps(); - - let [firstCdp] = await funderLiquity.getCdps({ - first: 1, - sortedBy: "descendingCollateralRatio" - }); - - if (firstCdp.ownerAddress !== funder.address) { - const funderCdp = await funderLiquity.getCdp(); - - const targetCollateralRatio = Decimal.max( - firstCdp.collateralRatio(initialPrice).add(0.00001), - 1.51 - ); - - if (funderCdp.isEmpty) { - const targetCdp = new Cdp( - EBTC_MINIMUM_DEBT.mulDiv(targetCollateralRatio, initialPrice), - EBTC_MINIMUM_DEBT - ); - - const fees = await funderLiquity.getFees(); - - await funderLiquity.openCdp(Cdp.recreate(targetCdp, fees.borrowingRate())); - } else { - const targetCdp = funderCdp.setCollateral( - funderCdp.debt.mulDiv(targetCollateralRatio, initialPrice) - ); - - await funderLiquity.adjustCdp(funderCdp.adjustTo(targetCdp)); - } - } - - [firstCdp] = await funderLiquity.getCdps({ - first: 1, - sortedBy: "descendingCollateralRatio" - }); - - if (firstCdp.ownerAddress !== funder.address) { - throw new Error("didn't manage to hoist Funder's Cdp to head of SortedCdps"); - } - - await deployerLiquity.setPrice(0.001); - - let numberOfCdps: number; - while ((numberOfCdps = await funderLiquity.getNumberOfCdps()) > 1) { - const numberOfCdpsToLiquidate = numberOfCdps > 10 ? 10 : numberOfCdps - 1; - - console.log(`${numberOfCdps} Cdps left.`); - await funderLiquity.liquidateUpTo(numberOfCdpsToLiquidate); - } - - await deployerLiquity.setPrice(initialPrice); - - if ((await funderLiquity.getNumberOfCdps()) !== 1) { - throw new Error("didn't manage to liquidate every Cdp"); - } - - const funderCdp = await funderLiquity.getCdp(); - const total = await funderLiquity.getTotal(); - - const collateralDifference = Difference.between(total.collateral, funderCdp.collateral); - const debtDifference = Difference.between(total.debt, funderCdp.debt); - - console.log(); - console.log("Discrepancies:"); - console.log(`Collateral: ${collateralDifference}`); - console.log(`Debt: ${debtDifference}`); -}; diff --git a/packages/fuzzer/src/commands/checks.ts b/packages/fuzzer/src/commands/checks.ts deleted file mode 100644 index 63f232f5a..000000000 --- a/packages/fuzzer/src/commands/checks.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { EthersLiquity } from "@liquity/lib-ethers"; - -import { deployer, subgraph } from "../globals"; - -import { - checkSubgraph, - checkCdpOrdering, - dumpCdps, - getListOfCdpsBeforeRedistribution -} from "../utils"; - -export const checkSorting = async () => { - const deployerLiquity = await EthersLiquity.connect(deployer); - const listOfCdps = await getListOfCdpsBeforeRedistribution(deployerLiquity); - const totalRedistributed = await deployerLiquity.getTotalRedistributed(); - const price = await deployerLiquity.getPrice(); - - checkCdpOrdering(listOfCdps, totalRedistributed, price); - - console.log("All Cdps are sorted."); -}; - -export const checkSubgraphCmd = async () => { - const deployerLiquity = await EthersLiquity.connect(deployer); - - await checkSubgraph(subgraph, deployerLiquity); - - console.log("Subgraph looks fine."); -}; - -export const dumpCdpsCmd = async () => { - const deployerLiquity = await EthersLiquity.connect(deployer); - const listOfCdps = await getListOfCdpsBeforeRedistribution(deployerLiquity); - const totalRedistributed = await deployerLiquity.getTotalRedistributed(); - const price = await deployerLiquity.getPrice(); - - dumpCdps(listOfCdps, totalRedistributed, price); -}; diff --git a/packages/fuzzer/src/commands/warzone.ts b/packages/fuzzer/src/commands/warzone.ts deleted file mode 100644 index dcb133fef..000000000 --- a/packages/fuzzer/src/commands/warzone.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Wallet } from "@ethersproject/wallet"; - -import { Decimal, EBTC_MINIMUM_DEBT, Cdp } from "@liquity/lib-base"; -import { EthersLiquity } from "@liquity/lib-ethers"; - -import { deployer, funder, provider } from "../globals"; - -export interface WarzoneParams { - cdps: number; -} - -export const warzone = async ({ cdps: numberOfCdps }: WarzoneParams) => { - const deployerLiquity = await EthersLiquity.connect(deployer); - - const price = await deployerLiquity.getPrice(); - - for (let i = 1; i <= numberOfCdps; ++i) { - const user = Wallet.createRandom().connect(provider); - const userAddress = await user.getAddress(); - const debt = EBTC_MINIMUM_DEBT.add(99999 * Math.random()); - const collateral = debt.mulDiv(1.11 + 3 * Math.random(), price); - - const liquity = await EthersLiquity.connect(user); - - await funder.sendTransaction({ - to: userAddress, - value: Decimal.from(collateral).hex - }); - - const fees = await liquity.getFees(); - - await liquity.openCdp( - Cdp.recreate(new Cdp(collateral, debt), fees.borrowingRate()), - { borrowingFeeDecayToleranceMinutes: 0 }, - { gasPrice: 0 } - ); - - if (i % 4 === 0) { - const ebtcBalance = await liquity.getEBTCBalance(); - await liquity.depositEBTCInStabilityPool(ebtcBalance); - } - - if (i % 10 === 0) { - console.log(`Created ${i} Cdps.`); - } - - //await new Promise(resolve => setTimeout(resolve, 4000)); - } -}; diff --git a/packages/fuzzer/src/fixture.ts b/packages/fuzzer/src/fixture.ts deleted file mode 100644 index 83efde0e7..000000000 --- a/packages/fuzzer/src/fixture.ts +++ /dev/null @@ -1,454 +0,0 @@ -import { Signer } from "@ethersproject/abstract-signer"; - -import { - Decimal, - Decimalish, - LQTYStake, - EBTC_MINIMUM_DEBT, - StabilityDeposit, - TransactableLiquity, - Cdp, - CdpAdjustmentParams -} from "@liquity/lib-base"; - -import { EthersLiquity as Liquity } from "@liquity/lib-ethers"; - -import { - createRandomCdp, - shortenAddress, - benford, - getListOfCdpOwners, - listDifference, - getListOfCdps, - randomCollateralChange, - randomDebtChange, - objToString -} from "./utils"; - -import { GasHistogram } from "./GasHistogram"; - -type _GasHistogramsFrom = { - [P in keyof T]: T[P] extends (...args: never[]) => Promise ? GasHistogram : never; -}; - -type GasHistograms = Pick< - _GasHistogramsFrom, - | "openCdp" - | "adjustCdp" - | "closeCdp" - | "redeemEBTC" - | "depositEBTCInStabilityPool" - | "withdrawEBTCFromStabilityPool" - | "stakeLQTY" - | "unstakeLQTY" ->; - -export class Fixture { - private readonly deployerLiquity: Liquity; - private readonly funder: Signer; - private readonly funderLiquity: Liquity; - private readonly funderAddress: string; - private readonly frontendAddress: string; - private readonly gasHistograms: GasHistograms; - - private price: Decimal; - - totalNumberOfLiquidations = 0; - - private constructor( - deployerLiquity: Liquity, - funder: Signer, - funderLiquity: Liquity, - funderAddress: string, - frontendAddress: string, - price: Decimal - ) { - this.deployerLiquity = deployerLiquity; - this.funder = funder; - this.funderLiquity = funderLiquity; - this.funderAddress = funderAddress; - this.frontendAddress = frontendAddress; - this.price = price; - - this.gasHistograms = { - openCdp: new GasHistogram(), - adjustCdp: new GasHistogram(), - closeCdp: new GasHistogram(), - redeemEBTC: new GasHistogram(), - depositEBTCInStabilityPool: new GasHistogram(), - withdrawEBTCFromStabilityPool: new GasHistogram(), - stakeLQTY: new GasHistogram(), - unstakeLQTY: new GasHistogram() - }; - } - - static async setup( - deployerLiquity: Liquity, - funder: Signer, - funderLiquity: Liquity, - frontendAddress: string, - frontendLiquity: Liquity - ) { - const funderAddress = await funder.getAddress(); - const price = await deployerLiquity.getPrice(); - - await frontendLiquity.registerFrontend(Decimal.from(10).div(11)); - - return new Fixture( - deployerLiquity, - funder, - funderLiquity, - funderAddress, - frontendAddress, - price - ); - } - - private async sendEBTCFromFunder(toAddress: string, amount: Decimalish) { - amount = Decimal.from(amount); - - const ebtcBalance = await this.funderLiquity.getEBTCBalance(); - - if (ebtcBalance.lt(amount)) { - const cdp = await this.funderLiquity.getCdp(); - const total = await this.funderLiquity.getTotal(); - const fees = await this.funderLiquity.getFees(); - - const targetCollateralRatio = - cdp.isEmpty || !total.collateralRatioIsBelowCritical(this.price) - ? 1.51 - : Decimal.max(cdp.collateralRatio(this.price).add(0.00001), 1.11); - - let newCdp = cdp.isEmpty ? Cdp.create({ depositCollateral: 1, borrowEBTC: 0 }) : cdp; - newCdp = newCdp.adjust({ borrowEBTC: amount.sub(ebtcBalance).mul(2) }); - - if (newCdp.debt.lt(EBTC_MINIMUM_DEBT)) { - newCdp = newCdp.setDebt(EBTC_MINIMUM_DEBT); - } - - newCdp = newCdp.setCollateral(newCdp.debt.mulDiv(targetCollateralRatio, this.price)); - - if (cdp.isEmpty) { - const params = Cdp.recreate(newCdp, fees.borrowingRate()); - console.log(`[funder] openCdp(${objToString(params)})`); - await this.funderLiquity.openCdp(params); - } else { - let newTotal = total.add(newCdp).subtract(cdp); - - if ( - !total.collateralRatioIsBelowCritical(this.price) && - newTotal.collateralRatioIsBelowCritical(this.price) - ) { - newTotal = newTotal.setCollateral(newTotal.debt.mulDiv(1.51, this.price)); - newCdp = cdp.add(newTotal).subtract(total); - } - - const params = cdp.adjustTo(newCdp, fees.borrowingRate()); - console.log(`[funder] adjustCdp(${objToString(params)})`); - await this.funderLiquity.adjustCdp(params); - } - } - - await this.funderLiquity.sendEBTC(toAddress, amount); - } - - async setRandomPrice() { - this.price = this.price.add(200 * Math.random() + 100).div(2); - console.log(`[deployer] setPrice(${this.price})`); - await this.deployerLiquity.setPrice(this.price); - - return this.price; - } - - async liquidateRandomNumberOfCdps(price: Decimal) { - const ebtcInStabilityPoolBefore = await this.deployerLiquity.getEBTCInStabilityPool(); - console.log(`// Stability Pool balance: ${ebtcInStabilityPoolBefore}`); - - const cdpsBefore = await getListOfCdps(this.deployerLiquity); - - if (cdpsBefore.length === 0) { - console.log("// No Cdps to liquidate"); - return; - } - - const cdpOwnersBefore = cdpsBefore.map(cdp => cdp.ownerAddress); - const lastCdp = cdpsBefore[cdpsBefore.length - 1]; - - if (!lastCdp.collateralRatioIsBelowMinimum(price)) { - console.log("// No Cdps to liquidate"); - return; - } - - const maximumNumberOfCdpsToLiquidate = Math.floor(50 * Math.random()) + 1; - console.log(`[deployer] liquidateUpTo(${maximumNumberOfCdpsToLiquidate})`); - await this.deployerLiquity.liquidateUpTo(maximumNumberOfCdpsToLiquidate); - - const cdpOwnersAfter = await getListOfCdpOwners(this.deployerLiquity); - const liquidatedCdps = listDifference(cdpOwnersBefore, cdpOwnersAfter); - - if (liquidatedCdps.length > 0) { - for (const liquidatedCdp of liquidatedCdps) { - console.log(`// Liquidated ${shortenAddress(liquidatedCdp)}`); - } - } - - this.totalNumberOfLiquidations += liquidatedCdps.length; - - const ebtcInStabilityPoolAfter = await this.deployerLiquity.getEBTCInStabilityPool(); - console.log(`// Stability Pool balance: ${ebtcInStabilityPoolAfter}`); - } - - async openRandomCdp(userAddress: string, liquity: Liquity) { - const total = await liquity.getTotal(); - const fees = await liquity.getFees(); - - let newCdp: Cdp; - - const cannotOpen = (newCdp: Cdp) => - newCdp.debt.lt(EBTC_MINIMUM_DEBT) || - (total.collateralRatioIsBelowCritical(this.price) - ? !newCdp.isOpenableInRecoveryMode(this.price) - : newCdp.collateralRatioIsBelowMinimum(this.price) || - total.add(newCdp).collateralRatioIsBelowCritical(this.price)); - - // do { - newCdp = createRandomCdp(this.price); - // } while (cannotOpen(newCdp)); - - await this.funder.sendTransaction({ - to: userAddress, - value: newCdp.collateral.hex - }); - - const params = Cdp.recreate(newCdp, fees.borrowingRate()); - - if (cannotOpen(newCdp)) { - console.log( - `// [${shortenAddress(userAddress)}] openCdp(${objToString(params)}) expected to fail` - ); - - await this.gasHistograms.openCdp.expectFailure(() => - liquity.openCdp(params, undefined, { gasPrice: 0 }) - ); - } else { - console.log(`[${shortenAddress(userAddress)}] openCdp(${objToString(params)})`); - - await this.gasHistograms.openCdp.expectSuccess(() => - liquity.send.openCdp(params, undefined, { gasPrice: 0 }) - ); - } - } - - async randomlyAdjustCdp(userAddress: string, liquity: Liquity, cdp: Cdp) { - const total = await liquity.getTotal(); - const fees = await liquity.getFees(); - const x = Math.random(); - - const params: CdpAdjustmentParams = - x < 0.333 - ? randomCollateralChange(cdp) - : x < 0.666 - ? randomDebtChange(cdp) - : { ...randomCollateralChange(cdp), ...randomDebtChange(cdp) }; - - const cannotAdjust = (cdp: Cdp, params: CdpAdjustmentParams) => { - if ( - params.withdrawCollateral?.gte(cdp.collateral) || - params.repayEBTC?.gt(cdp.debt.sub(EBTC_MINIMUM_DEBT)) - ) { - return true; - } - - const adjusted = cdp.adjust(params, fees.borrowingRate()); - - return ( - (params.withdrawCollateral?.nonZero || params.borrowEBTC?.nonZero) && - (adjusted.collateralRatioIsBelowMinimum(this.price) || - (total.collateralRatioIsBelowCritical(this.price) - ? adjusted._nominalCollateralRatio.lt(cdp._nominalCollateralRatio) - : total.add(adjusted).subtract(cdp).collateralRatioIsBelowCritical(this.price))) - ); - }; - - if (params.depositCollateral) { - await this.funder.sendTransaction({ - to: userAddress, - value: params.depositCollateral.hex - }); - } - - if (params.repayEBTC) { - await this.sendEBTCFromFunder(userAddress, params.repayEBTC); - } - - if (cannotAdjust(cdp, params)) { - console.log( - `// [${shortenAddress(userAddress)}] adjustCdp(${objToString(params)}) expected to fail` - ); - - await this.gasHistograms.adjustCdp.expectFailure(() => - liquity.adjustCdp(params, undefined, { gasPrice: 0 }) - ); - } else { - console.log(`[${shortenAddress(userAddress)}] adjustCdp(${objToString(params)})`); - - await this.gasHistograms.adjustCdp.expectSuccess(() => - liquity.send.adjustCdp(params, undefined, { gasPrice: 0 }) - ); - } - } - - async closeCdp(userAddress: string, liquity: Liquity, cdp: Cdp) { - const total = await liquity.getTotal(); - - if (total.collateralRatioIsBelowCritical(this.price)) { - // Cannot close Cdp during recovery mode - console.log("// Skipping closeCdp() in recovery mode"); - return; - } - - await this.sendEBTCFromFunder(userAddress, cdp.netDebt); - - console.log(`[${shortenAddress(userAddress)}] closeCdp()`); - - await this.gasHistograms.closeCdp.expectSuccess(() => - liquity.send.closeCdp({ gasPrice: 0 }) - ); - } - - async redeemRandomAmount(userAddress: string, liquity: Liquity) { - const total = await liquity.getTotal(); - - if (total.collateralRatioIsBelowMinimum(this.price)) { - console.log("// Skipping redeemEBTC() when TCR < MCR"); - return; - } - - const amount = benford(10000); - await this.sendEBTCFromFunder(userAddress, amount); - - console.log(`[${shortenAddress(userAddress)}] redeemEBTC(${amount})`); - - try { - await this.gasHistograms.redeemEBTC.expectSuccess(() => - liquity.send.redeemEBTC(amount, undefined, { gasPrice: 0 }) - ); - } catch (error) { - if (error instanceof Error && error.message.includes("amount too low to redeem")) { - console.log("// amount too low to redeem"); - } else { - throw error; - } - } - } - - async depositRandomAmountInStabilityPool(userAddress: string, liquity: Liquity) { - const amount = benford(20000); - - await this.sendEBTCFromFunder(userAddress, amount); - - console.log(`[${shortenAddress(userAddress)}] depositEBTCInStabilityPool(${amount})`); - - await this.gasHistograms.depositEBTCInStabilityPool.expectSuccess(() => - liquity.send.depositEBTCInStabilityPool(amount, this.frontendAddress, { - gasPrice: 0 - }) - ); - } - - async withdrawRandomAmountFromStabilityPool( - userAddress: string, - liquity: Liquity, - deposit: StabilityDeposit - ) { - const [lastCdp] = await liquity.getCdps({ - first: 1, - sortedBy: "ascendingCollateralRatio" - }); - - const amount = deposit.currentEBTC.mul(1.1 * Math.random()).add(10 * Math.random()); - - const cannotWithdraw = (amount: Decimal) => - amount.nonZero && lastCdp.collateralRatioIsBelowMinimum(this.price); - - if (cannotWithdraw(amount)) { - console.log( - `// [${shortenAddress(userAddress)}] ` + - `withdrawEBTCFromStabilityPool(${amount}) expected to fail` - ); - - await this.gasHistograms.withdrawEBTCFromStabilityPool.expectFailure(() => - liquity.withdrawEBTCFromStabilityPool(amount, { gasPrice: 0 }) - ); - } else { - console.log(`[${shortenAddress(userAddress)}] withdrawEBTCFromStabilityPool(${amount})`); - - await this.gasHistograms.withdrawEBTCFromStabilityPool.expectSuccess(() => - liquity.send.withdrawEBTCFromStabilityPool(amount, { gasPrice: 0 }) - ); - } - } - - async stakeRandomAmount(userAddress: string, liquity: Liquity) { - const lqtyBalance = await this.funderLiquity.getLQTYBalance(); - const amount = lqtyBalance.mul(Math.random() / 2); - - await this.funderLiquity.sendLQTY(userAddress, amount); - - if (amount.eq(0)) { - console.log(`// [${shortenAddress(userAddress)}] stakeLQTY(${amount}) expected to fail`); - - await this.gasHistograms.stakeLQTY.expectFailure(() => - liquity.stakeLQTY(amount, { gasPrice: 0 }) - ); - } else { - console.log(`[${shortenAddress(userAddress)}] stakeLQTY(${amount})`); - - await this.gasHistograms.stakeLQTY.expectSuccess(() => - liquity.send.stakeLQTY(amount, { gasPrice: 0 }) - ); - } - } - - async unstakeRandomAmount(userAddress: string, liquity: Liquity, stake: LQTYStake) { - const amount = stake.stakedLQTY.mul(1.1 * Math.random()).add(10 * Math.random()); - - console.log(`[${shortenAddress(userAddress)}] unstakeLQTY(${amount})`); - - await this.gasHistograms.unstakeLQTY.expectSuccess(() => - liquity.send.unstakeLQTY(amount, { gasPrice: 0 }) - ); - } - - async sweepEBTC(liquity: Liquity) { - const ebtcBalance = await liquity.getEBTCBalance(); - - if (ebtcBalance.nonZero) { - await liquity.sendEBTC(this.funderAddress, ebtcBalance, { gasPrice: 0 }); - } - } - - async sweepLQTY(liquity: Liquity) { - const lqtyBalance = await liquity.getLQTYBalance(); - - if (lqtyBalance.nonZero) { - await liquity.sendLQTY(this.funderAddress, lqtyBalance, { gasPrice: 0 }); - } - } - - summarizeGasStats(): string { - return Object.entries(this.gasHistograms) - .map(([name, histo]) => { - const results = histo.getResults(); - - return ( - `${name},outOfGas,${histo.outOfGasFailures}\n` + - `${name},failure,${histo.expectedFailures}\n` + - results - .map(([intervalMin, frequency]) => `${name},success,${frequency},${intervalMin}\n`) - .join("") - ); - }) - .join(""); - } -} diff --git a/packages/fuzzer/src/globals.ts b/packages/fuzzer/src/globals.ts deleted file mode 100644 index dbd3784e8..000000000 --- a/packages/fuzzer/src/globals.ts +++ /dev/null @@ -1,19 +0,0 @@ -import dotenv from "dotenv"; -import { Wallet } from "@ethersproject/wallet"; -import { JsonRpcProvider } from "@ethersproject/providers"; - -import { SubgraphLiquity } from "@liquity/lib-subgraph"; - -dotenv.config(); - -export const provider = new JsonRpcProvider("http://localhost:8545"); -export const subgraph = new SubgraphLiquity("http://localhost:8000/subgraphs/name/liquity/subgraph"); - -export const deployer = process.env.DEPLOYER_PRIVATE_KEY - ? new Wallet(process.env.DEPLOYER_PRIVATE_KEY, provider) - : Wallet.createRandom().connect(provider); - -export const funder = new Wallet( - "0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7", - provider -); diff --git a/packages/fuzzer/src/index.ts b/packages/fuzzer/src/index.ts deleted file mode 100644 index 5eb6e8af2..000000000 --- a/packages/fuzzer/src/index.ts +++ /dev/null @@ -1,76 +0,0 @@ -import yargs from "yargs"; -import "colors"; - -import { chaos, order } from "./commands/chaos"; -import { warzone } from "./commands/warzone"; -import { checkSorting, checkSubgraphCmd, dumpCdpsCmd } from "./commands/checks"; - -const wrapCmd = (cmd: (...args: A) => Promise) => async (...args: A) => { - try { - return await cmd(...args); - } catch (error) { - console.error(error); - } -}; - -yargs - .scriptName("yarn fuzzer") - - .command( - "warzone", - "Create lots of Cdps.", - { - cdps: { - alias: "n", - default: 1000, - description: "Number of cdps to create" - } - }, - wrapCmd(warzone) - ) - - .command( - "chaos", - "Try to break Liquity by randomly interacting with it.", - { - users: { - alias: "u", - default: 40, - description: "Number of users to spawn" - }, - rounds: { - alias: "n", - default: 25, - description: "How many times each user should interact with Liquity" - }, - subgraph: { - alias: "g", - default: false, - description: "Check after every round that subgraph data matches layer 1" - } - }, - wrapCmd(chaos) - ) - - .command( - "order", - "End chaos and restore order by liquidating every Cdp except the Funder's.", - {}, - wrapCmd(order) - ) - - .command("check-sorting", "Check if Cdps are sorted by ICR.", {}, wrapCmd(checkSorting)) - - .command( - "check-subgraph", - "Check that subgraph data matches layer 1.", - {}, - wrapCmd(checkSubgraphCmd) - ) - - .command("dump-cdps", "Dump list of Cdps.", {}, wrapCmd(dumpCdpsCmd)) - - .strict() - .demandCommand() - .wrap(null) - .parse(); diff --git a/packages/fuzzer/src/utils.ts b/packages/fuzzer/src/utils.ts deleted file mode 100644 index 5d38f7181..000000000 --- a/packages/fuzzer/src/utils.ts +++ /dev/null @@ -1,330 +0,0 @@ -import { Signer } from "@ethersproject/abstract-signer"; -import { Provider } from "@ethersproject/abstract-provider"; -import { Wallet } from "@ethersproject/wallet"; - -import { - Decimal, - Decimalish, - Difference, - Percent, - Cdp, - CdpWithPendingRedistribution, - ReadableLiquity, - EBTC_LIQUIDATION_RESERVE -} from "@liquity/lib-base"; -import { EthersLiquity, ReadableEthersLiquity } from "@liquity/lib-ethers"; -import { SubgraphLiquity } from "@liquity/lib-subgraph"; - -export const objToString = (o: Record) => - "{ " + - Object.entries(o) - .map(([k, v]) => `${k}: ${v}`) - .join(", ") + - " }"; - -export const createRandomWallets = (numberOfWallets: number, provider: Provider) => { - const accounts = new Array(numberOfWallets); - - for (let i = 0; i < numberOfWallets; ++i) { - accounts[i] = Wallet.createRandom().connect(provider); - } - - return accounts; -}; - -export const createRandomCdp = (price: Decimal) => { - let randomValue = truncateLastDigits(benford(1000)); - - if (Math.random() < 0.5) { - const collateral = Decimal.from(randomValue); - const maxDebt = parseInt(price.mul(collateral).toString(0)); - const debt = EBTC_LIQUIDATION_RESERVE.add(truncateLastDigits(maxDebt - benford(maxDebt))); - - return new Cdp(collateral, debt); - } else { - const debt = EBTC_LIQUIDATION_RESERVE.add(100 * randomValue); - - const collateral = Decimal.from( - debt - .div(price) - .mul(100 + benford(200)) - .div(100) - .toString(4) - ); - - return new Cdp(collateral, debt); - } -}; - -export const randomCollateralChange = ({ collateral }: Cdp) => - Math.random() < 0.5 - ? { withdrawCollateral: collateral.mul(1.1 * Math.random()) } - : { depositCollateral: collateral.mul(0.5 * Math.random()) }; - -export const randomDebtChange = ({ debt }: Cdp) => - Math.random() < 0.5 - ? { repayEBTC: debt.mul(1.1 * Math.random()) } - : { borrowEBTC: debt.mul(0.5 * Math.random()) }; - -export const getListOfCdps = async (liquity: ReadableLiquity) => - liquity.getCdps({ - first: await liquity.getNumberOfCdps(), - sortedBy: "descendingCollateralRatio", - beforeRedistribution: false - }); - -export const getListOfCdpsBeforeRedistribution = async (liquity: ReadableLiquity) => - liquity.getCdps({ - first: await liquity.getNumberOfCdps(), - sortedBy: "descendingCollateralRatio", - beforeRedistribution: true - }); - -export const getListOfCdpOwners = async (liquity: ReadableLiquity) => - getListOfCdpsBeforeRedistribution(liquity).then(cdps => - cdps.map(cdp => cdp.ownerAddress) - ); - -const tinyDifference = Decimal.from("0.000000001"); - -const sortedByICR = ( - listOfCdps: CdpWithPendingRedistribution[], - totalRedistributed: Cdp, - price: Decimalish -) => { - if (listOfCdps.length < 2) { - return true; - } - - let currentCdp = listOfCdps[0].applyRedistribution(totalRedistributed); - - for (let i = 1; i < listOfCdps.length; ++i) { - const nextCdp = listOfCdps[i].applyRedistribution(totalRedistributed); - - if ( - nextCdp.collateralRatio(price).gt(currentCdp.collateralRatio(price).add(tinyDifference)) - ) { - return false; - } - - currentCdp = nextCdp; - } - - return true; -}; - -export const listDifference = (listA: string[], listB: string[]) => { - const setB = new Set(listB); - return listA.filter(x => !setB.has(x)); -}; - -export const listOfCdpsShouldBeEqual = ( - listA: CdpWithPendingRedistribution[], - listB: CdpWithPendingRedistribution[] -) => { - if (listA.length !== listB.length) { - throw new Error("length of cdp lists is different"); - } - - const mapB = new Map(listB.map(cdp => [cdp.ownerAddress, cdp])); - - listA.forEach(cdpA => { - const cdpB = mapB.get(cdpA.ownerAddress); - - if (!cdpB) { - throw new Error(`${cdpA.ownerAddress} has no cdp in listB`); - } - - if (!cdpA.equals(cdpB)) { - throw new Error(`${cdpA.ownerAddress} has different cdps in listA & listB`); - } - }); -}; - -export const checkCdpOrdering = ( - listOfCdps: CdpWithPendingRedistribution[], - totalRedistributed: Cdp, - price: Decimal, - previousListOfCdps?: CdpWithPendingRedistribution[] -) => { - if (!sortedByICR(listOfCdps, totalRedistributed, price)) { - if (previousListOfCdps) { - console.log(); - console.log("// List of Cdps before:"); - dumpCdps(previousListOfCdps, totalRedistributed, price); - - console.log(); - console.log("// List of Cdps after:"); - } - - dumpCdps(listOfCdps, totalRedistributed, price); - throw new Error("ordering is broken"); - } -}; - -export const checkPoolBalances = async ( - liquity: ReadableEthersLiquity, - listOfCdps: CdpWithPendingRedistribution[], - totalRedistributed: Cdp -) => { - const activePool = await liquity._getActivePool(); - const defaultPool = await liquity._getDefaultPool(); - - const [activeTotal, defaultTotal] = listOfCdps.reduce( - ([activeTotal, defaultTotal], cdpActive) => { - const cdpTotal = cdpActive.applyRedistribution(totalRedistributed); - const cdpDefault = cdpTotal.subtract(cdpActive); - - return [activeTotal.add(cdpActive), defaultTotal.add(cdpDefault)]; - }, - [new Cdp(), new Cdp()] - ); - - const diffs = [ - Difference.between(activePool.collateral, activeTotal.collateral), - Difference.between(activePool.debt, activeTotal.debt), - Difference.between(defaultPool.collateral, defaultTotal.collateral), - Difference.between(defaultPool.debt, defaultTotal.debt) - ]; - - if (!diffs.every(diff => diff.absoluteValue?.lt(tinyDifference))) { - console.log(); - console.log(` ActivePool: ${activePool}`); - console.log(` Total active: ${activeTotal}`); - console.log(); - console.log(` DefaultPool: ${defaultPool}`); - console.log(` Total default: ${defaultTotal}`); - console.log(); - - throw new Error("discrepancy between Cdps & Pools"); - } -}; - -const numbersEqual = (a: number, b: number) => a === b; -const decimalsEqual = (a: Decimal, b: Decimal) => a.eq(b); -const cdpsEqual = (a: Cdp, b: Cdp) => a.equals(b); - -const cdpsRoughlyEqual = (cdpA: Cdp, cdpB: Cdp) => - [ - [cdpA.collateral, cdpB.collateral], - [cdpA.debt, cdpB.debt] - ].every(([a, b]) => Difference.between(a, b).absoluteValue?.lt(tinyDifference)); - -class EqualityCheck { - private name: string; - private get: (l: ReadableLiquity) => Promise; - private equals: (a: T, b: T) => boolean; - - constructor( - name: string, - get: (l: ReadableLiquity) => Promise, - equals: (a: T, b: T) => boolean - ) { - this.name = name; - this.get = get; - this.equals = equals; - } - - async allEqual(liquities: ReadableLiquity[]) { - const [a, ...rest] = await Promise.all(liquities.map(l => this.get(l))); - - if (!rest.every(b => this.equals(a, b))) { - throw new Error(`Mismatch in ${this.name}`); - } - } -} - -const checks = [ - new EqualityCheck("numberOfCdps", l => l.getNumberOfCdps(), numbersEqual), - new EqualityCheck("price", l => l.getPrice(), decimalsEqual), - new EqualityCheck("total", l => l.getTotal(), cdpsRoughlyEqual), - new EqualityCheck("totalRedistributed", l => l.getTotalRedistributed(), cdpsEqual), - new EqualityCheck("tokensInStabilityPool", l => l.getEBTCInStabilityPool(), decimalsEqual) -]; - -export const checkSubgraph = async (subgraph: SubgraphLiquity, l1Liquity: ReadableLiquity) => { - await Promise.all(checks.map(check => check.allEqual([subgraph, l1Liquity]))); - - const l1ListOfCdps = await getListOfCdpsBeforeRedistribution(l1Liquity); - const subgraphListOfCdps = await getListOfCdpsBeforeRedistribution(subgraph); - listOfCdpsShouldBeEqual(l1ListOfCdps, subgraphListOfCdps); - - const totalRedistributed = await subgraph.getTotalRedistributed(); - const price = await subgraph.getPrice(); - - if (!sortedByICR(subgraphListOfCdps, totalRedistributed, price)) { - console.log(); - console.log("// List of Cdps returned by subgraph:"); - dumpCdps(subgraphListOfCdps, totalRedistributed, price); - throw new Error("subgraph sorting broken"); - } -}; - -export const shortenAddress = (address: string) => address.substr(0, 6) + "..." + address.substr(-4); - -const cdpToString = ( - cdpWithPendingRewards: CdpWithPendingRedistribution, - totalRedistributed: Cdp, - price: Decimalish -) => { - const cdp = cdpWithPendingRewards.applyRedistribution(totalRedistributed); - const rewards = cdp.subtract(cdpWithPendingRewards); - - return ( - `[${shortenAddress(cdpWithPendingRewards.ownerAddress)}]: ` + - `ICR = ${new Percent(cdp.collateralRatio(price)).toString(2)}, ` + - `ICR w/o reward = ${new Percent(cdpWithPendingRewards.collateralRatio(price)).toString(2)}, ` + - `coll = ${cdp.collateral.toString(2)}, ` + - `debt = ${cdp.debt.toString(2)}, ` + - `coll reward = ${rewards.collateral.toString(2)}, ` + - `debt reward = ${rewards.debt.toString(2)}` - ); -}; - -export const dumpCdps = ( - listOfCdps: CdpWithPendingRedistribution[], - totalRedistributed: Cdp, - price: Decimalish -) => { - if (listOfCdps.length === 0) { - return; - } - - let currentCdp = listOfCdps[0]; - console.log(` ${cdpToString(currentCdp, totalRedistributed, price)}`); - - for (let i = 1; i < listOfCdps.length; ++i) { - const nextCdp = listOfCdps[i]; - - if ( - nextCdp - .applyRedistribution(totalRedistributed) - .collateralRatio(price) - .sub(tinyDifference) - .gt(currentCdp.applyRedistribution(totalRedistributed).collateralRatio(price)) - ) { - console.log(`!! ${cdpToString(nextCdp, totalRedistributed, price)}`.red); - } else { - console.log(` ${cdpToString(nextCdp, totalRedistributed, price)}`); - } - - currentCdp = nextCdp; - } -}; - -export const benford = (max: number) => Math.floor(Math.exp(Math.log(max) * Math.random())); - -const truncateLastDigits = (n: number) => { - if (n > 100000) { - return 1000 * Math.floor(n / 1000); - } else if (n > 10000) { - return 100 * Math.floor(n / 100); - } else if (n > 1000) { - return 10 * Math.floor(n / 10); - } else { - return n; - } -}; - -export const connectUsers = (users: Signer[]) => - Promise.all(users.map(user => EthersLiquity.connect(user))); diff --git a/packages/fuzzer/tsconfig.json b/packages/fuzzer/tsconfig.json deleted file mode 100644 index 564a59900..000000000 --- a/packages/fuzzer/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src"] -}