mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
reviews addressed
This commit is contained in:
parent
c2ae141388
commit
a801cedff7
|
@ -19,7 +19,7 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogDepositFrom(
|
||||
event LogDepositFromUsingManager(
|
||||
address indexed market,
|
||||
address indexed token,
|
||||
address from,
|
||||
|
@ -46,7 +46,7 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogWithdrawFrom(
|
||||
event LogWithdrawFromUsingManager(
|
||||
address indexed market,
|
||||
address indexed token,
|
||||
address from,
|
||||
|
@ -89,7 +89,7 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogPaybackFrom(
|
||||
event LogPaybackFromUsingManager(
|
||||
address indexed market,
|
||||
address from,
|
||||
address to,
|
||||
|
@ -97,15 +97,6 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogLiquidate(
|
||||
address indexed borrower,
|
||||
address indexed tokenToPay,
|
||||
address indexed tokenInReturn,
|
||||
uint256 tokenAmt,
|
||||
uint256 getId,
|
||||
uint256 setId
|
||||
);
|
||||
|
||||
event LogBuyCollateral(
|
||||
address indexed market,
|
||||
address indexed token,
|
||||
|
@ -126,7 +117,7 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogTransferAssetFrom(
|
||||
event LogTransferAssetFromUsingManager(
|
||||
address indexed market,
|
||||
address token,
|
||||
address indexed from,
|
||||
|
@ -136,11 +127,7 @@ contract Events {
|
|||
uint256 setId
|
||||
);
|
||||
|
||||
event LogAllow(
|
||||
address indexed market,
|
||||
address indexed manager,
|
||||
bool allow
|
||||
);
|
||||
event LogAllow(address indexed market, address indexed manager, bool allow);
|
||||
|
||||
event LogAllowWithPermit(
|
||||
address indexed market,
|
||||
|
|
|
@ -49,8 +49,6 @@ abstract contract Helpers is DSMath, Basic {
|
|||
address to,
|
||||
uint256 amt
|
||||
) internal {
|
||||
bytes memory data;
|
||||
|
||||
if (from == address(0)) {
|
||||
CometInterface(market).transferAsset(to, token, amt);
|
||||
} else {
|
||||
|
@ -62,39 +60,39 @@ abstract contract Helpers is DSMath, Basic {
|
|||
internal
|
||||
returns (uint256 amt, uint256 setId)
|
||||
{
|
||||
uint256 _amt = getUint(params.getId, params.amt);
|
||||
uint256 amt_ = getUint(params.getId, params.amt);
|
||||
|
||||
require(
|
||||
params.market != address(0) && params.token != address(0),
|
||||
"invalid market/token address"
|
||||
);
|
||||
bool isEth = params.token == ethAddr;
|
||||
address _token = isEth ? wethAddr : params.token;
|
||||
address token_ = isEth ? wethAddr : params.token;
|
||||
|
||||
TokenInterface tokenContract = TokenInterface(_token);
|
||||
TokenInterface tokenContract = TokenInterface(token_);
|
||||
|
||||
uint256 initialBal = getAccountSupplyBalanceOfAsset(
|
||||
address(this),
|
||||
params.market,
|
||||
_token
|
||||
token_
|
||||
);
|
||||
|
||||
_amt = _amt == uint256(-1) ? initialBal : _amt;
|
||||
amt_ = amt_ == uint256(-1) ? initialBal : amt_;
|
||||
|
||||
_withdraw(params.market, _token, params.from, params.to, _amt);
|
||||
_withdraw(params.market, token_, params.from, params.to, amt_);
|
||||
|
||||
uint256 finalBal = getAccountSupplyBalanceOfAsset(
|
||||
address(this),
|
||||
params.market,
|
||||
_token
|
||||
token_
|
||||
);
|
||||
_amt = sub(initialBal, finalBal);
|
||||
amt_ = sub(initialBal, finalBal);
|
||||
|
||||
convertWethToEth(isEth, tokenContract, _amt);
|
||||
convertWethToEth(isEth, tokenContract, amt_);
|
||||
|
||||
setUint(params.setId, _amt);
|
||||
setUint(params.setId, amt_);
|
||||
|
||||
amt = _amt;
|
||||
amt = amt_;
|
||||
setId = params.setId;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
CometInterface(market).supplyFrom(from, to, token_, amt_);
|
||||
setUint(setId, amt_);
|
||||
|
||||
eventName_ = "LogDepositFrom(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventName_ = "LogDepositFromUsingManager(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventParam_ = abi.encode(market, token, from, to, amt_, getId, setId);
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
})
|
||||
);
|
||||
|
||||
eventName_ = "LogWithdrawFrom(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventName_ = "LogWithdrawFromUsingManager(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventParam_ = abi.encode(market, token, from, to, amt_, getId, setId_);
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
setId: setId
|
||||
})
|
||||
);
|
||||
eventName_ = "LogBorrowFrom(address,address,address,uint256,uint256,uint256)";
|
||||
eventName_ = "LogBorrowFromUsingManager(address,address,address,uint256,uint256,uint256)";
|
||||
eventParam_ = abi.encode(market, from, to, amt_, getId, setId_);
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
|
||||
/**
|
||||
* @dev Repays entire borrow of the base asset form 'from' on behalf of 'to'.
|
||||
* @notice Repays an entire borrow of the base asset on behalf of 'to'.
|
||||
* @notice Repays an entire borrow of the base asset on behalf of 'to'. Approve the comet markey
|
||||
* @param market The address of the market.
|
||||
* @param from The address from which the borrow has to be repaid on behalf of 'to'.
|
||||
* @param to The address on behalf of which the borrow is to be repaid.
|
||||
|
@ -544,7 +544,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
|
||||
setUint(setId, amt_);
|
||||
|
||||
eventName_ = "LogPaybackFrom(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventName_ = "LogPaybackFromUsingManager(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventParam_ = abi.encode(market, token, from, to, amt_, getId, setId);
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
* @notice Buy collateral asset to increase protocol base reserves until targetReserves is reached.
|
||||
* @param market The address of the market from where to withdraw.
|
||||
* @param asset The collateral asset to purachase.
|
||||
* @param dest The address on to transfer the purchased assets.
|
||||
* @param dest The address to transfer the purchased assets.
|
||||
* @param minCollateralAmt Minimum amount of collateral expected to be received.
|
||||
* @param baseAmt Amount of base asset to be sold for collateral.
|
||||
* @param getId ID to retrieve amt.
|
||||
|
@ -596,7 +596,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
eventParam_ = abi.encode(
|
||||
market,
|
||||
asset,
|
||||
baseAmt,
|
||||
amt_,
|
||||
minCollateralAmt,
|
||||
collAmt,
|
||||
getId,
|
||||
|
@ -695,7 +695,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
|
|||
|
||||
setUint(setId, amt_);
|
||||
|
||||
eventName_ = "LogTransferAssetFrom(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventName_ = "LogTransferAssetFromUsingManager(address,address,address,address,uint256,uint256,uint256)";
|
||||
eventParam_ = abi.encode(market, token_, src, dest, amt_, getId, setId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user