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

Use safeApprove in Uniswap adapter #12

Open
gabririgo opened this issue Jan 11, 2021 · 0 comments
Open

Use safeApprove in Uniswap adapter #12

gabririgo opened this issue Jan 11, 2021 · 0 comments

Comments

@gabririgo
Copy link
Contributor

Summary

In order for swapping any tokens, must use safe approve, as to guarantee that data.length is always 3*32 + 4 bytes.

Motivation

A few tokens are problematic when sending transactions from smart contracts. By not encoding the call withing the smart contract, but sending to token as low-level call, the data length binding is guaranteed.

Specification

Implement approve as low-level call instead of token.approve, i.e.:

 tokenAddress.call(abi.encodeWithSelector(SELECTOR, owner, spender, amount))
@gabririgo gabririgo changed the title Use safeApprove in uniswap adapter Use safeApprove in Uniswap adapter Jan 11, 2021
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

No branches or pull requests

1 participant