updated changes- Arbitrum

This commit is contained in:
Shriya Tyagi 2022-04-27 18:18:18 +04:00
parent 11ded62f6d
commit d5b096c995
3 changed files with 39 additions and 11 deletions

View File

@ -32,10 +32,26 @@ contract Events {
event LogDisableCollateral(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 LogApproveDelegation( event LogDelegateBorrow(
address token, address token,
uint16 debtType, uint256 amount,
uint16 rateMode,
address delegateTo, address delegateTo,
uint256 amount uint256 getId,
uint256 setId
);
event LogDepositWithoutCollateral(
address token,
uint256 amt,
uint256 getId,
uint256 setId
);
event LogBorrowOnBehalfOf(
address token,
uint256 amt,
uint256 rateMode,
address onBehalfOf,
uint256 getId,
uint256 setId
); );
} }

View File

@ -70,7 +70,7 @@ abstract contract Helpers is DSMath, Basic {
* @param token token address of the asset * @param token token address of the asset
* @param rateMode Debt type: stable-1, variable-2 * @param rateMode Debt type: stable-1, variable-2
*/ */
function getDTokenAddr(address token, uint16 rateMode) function getDTokenAddr(address token, uint256 rateMode)
internal internal
view view
returns(address dToken) returns(address dToken)

View File

@ -224,7 +224,7 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt); setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)"; _eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, getId, setId); _eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
} }
/** /**
@ -409,29 +409,41 @@ abstract contract AaveResolver is Events, Helpers {
* @dev Approve Delegation * @dev Approve Delegation
* @notice Gives approval to delegate debt tokens * @notice Gives approval to delegate debt tokens
* @param token The address of token * @param token The address of token
* @param amount The amount
* @param rateMode The type of borrow debt * @param rateMode The type of borrow debt
* @param delegateTo The address to whom the user is delegating * @param delegateTo The address to whom the user is delegating
* @param amount The amount * @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/ */
function approveDelegation(address token, , uint256 amount, uint256 rateMode, address delegateTo) function delegateBorrow(
address token,
uint256 amount,
uint256 rateMode,
address delegateTo,
uint256 getId,
uint256 setId
)
external external
payable payable
returns (string memory _eventName, bytes memory _eventParam) returns (string memory _eventName, bytes memory _eventParam)
{ {
require(rateMode == 1 || rateMode == 2, "Invalid debt type"); require(rateMode == 1 || rateMode == 2, "Invalid debt type");
uint256 _amt = getUint(getId, amount);
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
address _token = isEth ? wethAddr : token; address _token = isEth ? wethAddr : token;
address _dToken = getDTokenAddr(_token, rateMode); address _dToken = getDTokenAddr(_token, rateMode);
DTokenInterface(_dToken).approveDelegation(delegateTo, amount); DTokenInterface(_dToken).approveDelegation(delegateTo, _amt);
_eventName = "LogApproveDelegation(address,uint16,address,uint256)"; setUint(setId, _amt);
_eventParam = abi.encode(token, rateMode, delegateTo, amount);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
} }
} }
contract ConnectV2AaveV3Arbitrum is AaveResolver { contract ConnectV2AaveV3Arbitrum is AaveResolver {
string public constant name = "AaveV3-v1.1"; string public constant name = "AaveV3-v1.2";
} }