morpho-org / morpho-blue-bundlers

Morpho Blue Bundlers
https://morpho.org
Other
17 stars 11 forks source link

Should we decouple approvals from interactions in migration bundlers? #202

Closed MerlinEgalite closed 1 year ago

MerlinEgalite commented 1 year ago

Right now we have the following pattern:

https://github.com/morpho-labs/morpho-blue-bundlers/blob/3036d49e2e680084fad0cbf0609d990e2034406c/contracts/migration/AaveV3MigrationBundler.sol#L30-L34

But this can create issue for tokens that prevent approval frontrunning such as USDT. I don't think this is an issue for now since a max approval should be so large that there's no need to increase the allowance later on.

As a general remark we could make sure that it is always possible to approve 0 first and the increase the allowance before doing any interaction through the entire codebase.

Rubilmax commented 1 year ago

Do you suggest to isolate the behavior of _approveMaxTo to a new, dedicated bundler action?

MerlinEgalite commented 1 year ago

I don't think it's required. We should at least add a comment I think.

MerlinEgalite commented 1 year ago

Why? We're adding a comment