Skip to content

Commit

Permalink
order of transfer changed: first tries permit2 now
Browse files Browse the repository at this point in the history
  • Loading branch information
hoytech committed Jul 3, 2024
1 parent e6d9ddc commit 9366c02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/whitepaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Since the virtual deposit shares are incorporated into the exchange rate, they w

In order to move tokens in or out of the vault, the vault code has internal abstractions `pullAssets` and `pushAssets`.

`pullAssets` will first attempt to call `transferFrom` on the underlying asset using the vault's address as the recipient. If the user has given sufficient approval for the vault, this will succeed. Otherwise, `pullAssets` will attempt to use [Permit2](https://github.com/Uniswap/permit2) to transfer the assets into the vault. Permit2 can enable better user experiences because approvals can be created as signed messages that are bundled into the same EVC batch as a `deposit` (for example). Although the user does need to first add an approval for the Permit2 contract, this is a one-time operation and many users will already have done this when interacting with Uniswap or other apps.
`pullAssets` will first attempt to use [Permit2](https://github.com/Uniswap/permit2) to transfer the assets into the vault. If this is unsuccessful, it will then attempt to call `transferFrom` on the underlying asset using the vault's address as the recipient. Permit2 can enable better user experiences because approvals can be created as signed messages that are bundled into the same EVC batch as a `deposit` (for example). Although the user does need to first add an approval for the Permit2 contract, this is a one-time operation and many users will already have done this when interacting with Uniswap or other apps.

`pushAssets` always simply uses `transfer` on the underlying asset. However, in order to prevent loss of funds, `pushAssets` will first check with the EVC to see if the recipient address is a known non-owner address (a virtual sub-account address). If so, it will refuse to transfer the assets. If the underlying asset is EVC-aware (perhaps a [nested vault](#nesting)), then the `CFG_EVC_COMPATIBLE_ASSET` config flag can be enabled, which prevents this check.

Expand Down

0 comments on commit 9366c02

Please sign in to comment.