bug fixes + refactoring

This commit is contained in:
pradyuman-verma 2022-06-08 19:07:56 +05:30
parent ae51a19713
commit 7477438395
No known key found for this signature in database
GPG Key ID: E36FD6BC8923221F
5 changed files with 141 additions and 26 deletions

View File

@ -103,7 +103,7 @@ abstract contract AaveResolver is Events, Helpers {
aave.supply(_token, _amt, address(this), referralCode);
if (getCollateralBalance(_token) > 0 && getIsColl(token)) {
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, false);
}
@ -224,7 +224,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -344,7 +351,9 @@ abstract contract AaveResolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(_token);
_amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt;
_amt = _amt == uint256(-1)
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
: _amt;
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
@ -355,7 +364,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -484,7 +500,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
delegateTo,
getId,
setId
);
}
}

View File

@ -103,7 +103,7 @@ abstract contract AaveResolver is Events, Helpers {
aave.supply(_token, _amt, address(this), referralCode);
if (getCollateralBalance(_token) > 0 && getIsColl(token)) {
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, false);
}
@ -224,7 +224,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -344,7 +351,9 @@ abstract contract AaveResolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(_token);
_amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt;
_amt = _amt == uint256(-1)
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
: _amt;
if (isAVAX) convertAvaxToWavax(isAVAX, tokenContract, _amt);
@ -355,7 +364,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -409,6 +425,7 @@ abstract contract AaveResolver is Events, Helpers {
_eventName = "LogDisableCollateral(address[])";
_eventParam = abi.encode(tokens);
}
/**
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
@ -483,7 +500,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
delegateTo,
getId,
setId
);
}
}

View File

@ -103,7 +103,7 @@ abstract contract AaveResolver is Events, Helpers {
aave.supply(_token, _amt, address(this), referralCode);
if (getCollateralBalance(_token) > 0 && getIsColl(token)) {
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, false);
}
@ -224,7 +224,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -344,7 +351,9 @@ abstract contract AaveResolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(_token);
_amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt;
_amt = _amt == uint256(-1)
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
: _amt;
if (isFTM) convertFtmToWftm(isFTM, tokenContract, _amt);
@ -355,7 +364,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -484,8 +500,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
delegateTo,
getId,
setId
);
}
}

View File

@ -103,7 +103,7 @@ abstract contract AaveResolver is Events, Helpers {
aave.supply(_token, _amt, address(this), referralCode);
if (getCollateralBalance(_token) > 0 && getIsColl(token)) {
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, false);
}
@ -224,7 +224,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -344,7 +351,9 @@ abstract contract AaveResolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(_token);
_amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt;
_amt = _amt == uint256(-1)
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
: _amt;
if (isEth) convertEthToWeth(isEth, tokenContract, _amt);
@ -355,7 +364,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -484,7 +500,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
delegateTo,
getId,
setId
);
}
}

View File

@ -103,7 +103,7 @@ abstract contract AaveResolver is Events, Helpers {
aave.supply(_token, _amt, address(this), referralCode);
if (getCollateralBalance(_token) > 0 && getIsColl(token)) {
if (getCollateralBalance(_token) > 0 && getIsColl(_token)) {
aave.setUserUseReserveAsCollateral(_token, false);
}
@ -224,7 +224,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogBorrowOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -344,7 +351,9 @@ abstract contract AaveResolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(_token);
_amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt;
_amt = _amt == uint256(-1)
? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf)
: _amt;
if (isMatic) convertMaticToWmatic(isMatic, tokenContract, _amt);
@ -355,7 +364,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
onBehalfOf,
getId,
setId
);
}
/**
@ -485,7 +501,14 @@ abstract contract AaveResolver is Events, Helpers {
setUint(setId, _amt);
_eventName = "LogDelegateBorrow(address,uint256,uint256,address,uint256,uint256)";
_eventParam = abi.encode(token, _amt, rateMode, delegateTo, getId, setId);
_eventParam = abi.encode(
token,
_amt,
rateMode,
delegateTo,
getId,
setId
);
}
}