-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compound Filter #209
Compound Filter #209
Conversation
|
||
import "./IFilter.sol"; | ||
|
||
contract CompoundFilter is IFilter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the only method that needs to be forbidden is repayBorrowBehalf
. Everything else is safe to allow (note that ERC20 methods of cToken will be caught in recoverSpender
and do not need to be forbidden here). In particular why not allow borrow
, repayBorrow
, redeemUnderlying
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed for the CToken methods, we should only block reapyBorrowBehalf
.
However I believe ERC20 token methods where the spender is the cToken (i.e. the ones which will end up in the filter) must be blocked because you want to prevent e.g. a transfer of DAI to cBAT. So dai.transfer(cBAT, 1000)
must be blocked. The only one we should accept is an approve on the underlying to allow minting, i.e. dai.approve(cDAI,1000)
.
|
||
function isValid(address _wallet, address _spender, address _to, bytes calldata _data) external view override returns (bool) { | ||
// disable ETH transfer | ||
if (_data.length < 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could create the filter with a constructor parameter indicating whether this is a cErc20 or a cEther. For a cEther filter, it would be nice to enable ETH transfers (which invoke cEther's fallback) to enable deposits via simple ETH transfers.
e43dddd
to
fe312cc
Compare
This PR adds support for lending with Compound by: