mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
feat: added disable collateral
This commit is contained in:
parent
432c1782e0
commit
41c13f4568
|
@ -29,6 +29,7 @@ contract Events {
|
||||||
uint256 setId
|
uint256 setId
|
||||||
);
|
);
|
||||||
event LogEnableCollateral(address[] tokens);
|
event LogEnableCollateral(address[] tokens);
|
||||||
|
event LogDisableCollateral(address[] tokens);
|
||||||
event LogSwapRateMode(address indexed token, uint256 rateMode);
|
event LogSwapRateMode(address indexed token, uint256 rateMode);
|
||||||
event LogSetUserEMode(uint8 categoryId);
|
event LogSetUserEMode(uint8 categoryId);
|
||||||
event LogDelegateBorrow(
|
event LogDelegateBorrow(
|
||||||
|
|
|
@ -402,6 +402,33 @@ abstract contract AaveResolver is Events, Helpers {
|
||||||
_eventParam = abi.encode(tokens);
|
_eventParam = abi.encode(tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Disable collateral
|
||||||
|
* @notice Disable an array of tokens as collateral
|
||||||
|
* @param tokens Array of tokens to disable as collateral
|
||||||
|
*/
|
||||||
|
function disableCollateral(address[] calldata tokens)
|
||||||
|
external
|
||||||
|
payable
|
||||||
|
returns (string memory _eventName, bytes memory _eventParam)
|
||||||
|
{
|
||||||
|
uint256 _length = tokens.length;
|
||||||
|
require(_length > 0, "0-tokens-not-allowed");
|
||||||
|
|
||||||
|
AaveInterface aave = AaveInterface(aaveProvider.getPool());
|
||||||
|
|
||||||
|
for (uint256 i = 0; i < _length; i++) {
|
||||||
|
bool isEth = tokens[i] == ethAddr;
|
||||||
|
address _token = isEth ? wethAddr : tokens[i];
|
||||||
|
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
|
||||||
|
aave.setUserUseReserveAsCollateral(_token, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_eventName = "LogDisableCollateral(address[])";
|
||||||
|
_eventParam = abi.encode(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Swap borrow rate mode
|
* @dev Swap borrow rate mode
|
||||||
* @notice Swaps user borrow rate mode between variable and stable
|
* @notice Swaps user borrow rate mode between variable and stable
|
||||||
|
|
Loading…
Reference in New Issue
Block a user