aave-v3-core icon indicating copy to clipboard operation
aave-v3-core copied to clipboard

Allow `withdraw` function to be called on behalf of some account.

Open jkrivine opened this issue 2 years ago • 3 comments

Currently all interactions with the pool can be done onbehalf of another account (modulo approval), except withdraw.

This makes it gas costly for a protocol managing user's funds on AAVE because it needs to transfer overlyings from the user's account to the protocol's account before being able to withdraw. Unless there is a good reason not to do this (i'd be curious to know), in general it is a nice feature that all functions that pull funds from a protocol (here, borrow and withdraw) can be done 'onBehalf' and 'to' some accounts (with the required approval).

jkrivine avatar Jul 15 '22 10:07 jkrivine

@jkrivine How would you give allowance to someone to withdraw on your behalf?

miguelmtzinf avatar Jul 22 '22 07:07 miguelmtzinf

Dont do it i didnt give no one permission

Tommmyklee avatar Jul 22 '22 07:07 Tommmyklee

@jkrivine How would you give allowance to someone to withdraw on your behalf?

well, you can borrow on someone's behalf by using a special approval of the debt token, a similar scheme could be used on aToken using an approveDelegate function. When a delegatee wants to withdraw on delegator's behalf the logic would need to check that:

  • Allowance is enough to withdraw
  • the health factor of the delegator's account permits the withdrawal

jkrivine avatar Jul 25 '22 12:07 jkrivine

@jkrivine How would you give allowance to someone to withdraw on your behalf?

well, you can borrow on someone's behalf by using a special approval of the debt token, a similar scheme could be used on aToken using an approveDelegate function. When a delegatee wants to withdraw on delegator's behalf the logic would need to check that:

  • Allowance is enough to withdraw
  • the health factor of the delegator's account permits the withdrawal

The concept is straightforward, but I think a "withdraw on somone's behalf" does not bring value. As a user:

  • I can send directly my aToken to another user so he can withdraw
  • I can approve another user, so I can still earn yield until he pulls and withdraws.

I suggest you to open a thread in the governance forum so the community can discuss about it

miguelmtzinf avatar Nov 17 '22 07:11 miguelmtzinf