refactor: created internal approve delegation function

This commit is contained in:
Hadrien Charlanes 2021-07-05 10:03:15 +02:00
parent 76a141cd36
commit fce470cfb7

View File

@ -38,8 +38,7 @@ abstract contract DebtTokenBase is
* force a delegator HF to go below 1) * force a delegator HF to go below 1)
**/ **/
function approveDelegation(address delegatee, uint256 amount) external override { function approveDelegation(address delegatee, uint256 amount) external override {
_borrowAllowances[_msgSender()][delegatee] = amount; _approveDelegation(_msgSender(), delegatee, amount);
emit BorrowAllowanceDelegated(_msgSender(), delegatee, _getUnderlyingAssetAddress(), amount);
} }
/** /**
@ -118,6 +117,15 @@ abstract contract DebtTokenBase is
revert('ALLOWANCE_NOT_SUPPORTED'); revert('ALLOWANCE_NOT_SUPPORTED');
} }
function _approveDelegation(
address delegator,
address delegatee,
uint256 amount
) internal {
_borrowAllowances[delegator][delegatee] = amount;
emit BorrowAllowanceDelegated(delegator, delegatee, _getUnderlyingAssetAddress(), amount);
}
function _decreaseBorrowAllowance( function _decreaseBorrowAllowance(
address delegator, address delegator,
address delegatee, address delegatee,