Skip to content
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

Paraswap, AaveV2, Balancer, Yearn, DSR Filters #208

Merged
merged 15 commits into from
Mar 11, 2021

Conversation

olivdb
Copy link
Contributor

@olivdb olivdb commented Mar 4, 2021

Includes implementation & tests for the following authorisation filters:

  • Paraswap
  • AaveV2
  • Balancer
  • Yearn
  • DSR

@olivdb olivdb self-assigned this Mar 4, 2021
Base automatically changed from experiment/minimal-wallet to develop March 4, 2021 16:13
@olivdb olivdb requested a review from juniset March 5, 2021 20:14
@olivdb olivdb force-pushed the minimal-wallet/defi-filters branch from 9f0b470 to 854caff Compare March 5, 2021 20:34
@olivdb olivdb changed the title Defi Filters for Minimal Wallet Paraswap Filters for Minimal Wallet Mar 5, 2021
@olivdb olivdb force-pushed the minimal-wallet/defi-filters branch from 0d89160 to 29cdf6f Compare March 8, 2021 10:43
@olivdb olivdb force-pushed the minimal-wallet/defi-filters branch from 09ce94d to c19710a Compare March 8, 2021 14:51
@olivdb olivdb changed the title Paraswap Filters for Minimal Wallet Defi Filters for Minimal Wallet Mar 8, 2021
@olivdb olivdb marked this pull request as ready for review March 8, 2021 14:52
@olivdb olivdb changed the title Defi Filters for Minimal Wallet Paraswap & AaveV2 Filters for Minimal Wallet Mar 8, 2021
@olivdb olivdb requested a review from juniset March 8, 2021 14:52
@olivdb olivdb changed the title Paraswap & AaveV2 Filters for Minimal Wallet Paraswap, AaveV2, Balancer Filters for Minimal Wallet Mar 8, 2021
return (method == ERC20_APPROVE);
}

function getMethod(bytes memory _data) internal pure returns (bytes4 method) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should move this method to an abstract BaseFilter contract given that it will be used by all filters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already Utils.functionPrefix that does that

Copy link
Contributor Author

@olivdb olivdb Mar 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utils.functionPrefix has a require(_data.length >= 4, "Utils: Invalid functionPrefix"); which we don't want (we want to return false in most of these cases, and sometimes even accept _data.length == 0).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But by the point where this is called you've already ensured that require is met

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. But that's a useless require. Also, I like that we have tried so far to write filters in a way that doesn't rely on any other file than IFilter and BaseFilter, making it easier to publish the filters and DappRegistry in a standalone repo, should this become a reference registry used outside Argent.

@olivdb olivdb changed the title Paraswap, AaveV2, Balancer Filters for Minimal Wallet Paraswap, AaveV2, Balancer, Yearn Filters Mar 9, 2021
@olivdb olivdb requested a review from juniset March 9, 2021 15:48
test/paraswap.js Outdated

filter = await Filter.new(tokenPriceRegistry.address, dexRegistry.address);
await dappRegistry.addDapp(0, paraswap.address, filter.address);
await dappRegistry.addDapp(0, paraswapProxy, ZERO_ADDRESS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have a filter for the proxy as well?

const AaveV2Filter = artifacts.require("AaveV2Filter");
const BalancerFilter = artifacts.require("BalancerFilter");
const YearnFilter = artifacts.require("YearnFilter");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the paraswap proxy filter

Copy link
Contributor

@elenadimitrova elenadimitrova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed I think best to integrate test these with a mainnet fork although happy to leave it on the tech debt backlog for now.

@olivdb olivdb changed the title Paraswap, AaveV2, Balancer, Yearn Filters Paraswap, AaveV2, Balancer, Yearn, DSR Filters Mar 10, 2021
@olivdb olivdb merged commit 2c313ec into develop Mar 11, 2021
@elenadimitrova elenadimitrova deleted the minimal-wallet/defi-filters branch March 11, 2021 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants