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

Update erc20Swap detection #14

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Conversation

ponyjackal
Copy link
Contributor

No description provided.

Copy link

linear bot commented Nov 30, 2023

OU-1151 ERC20 Swap

We should detect an ERC20 swap if:

  • The from account sent and received 1 asset. The sent and received must be either ETH OR an ERC20.
  • Only 1 other account sends and receives assets (the liquidity pool). This is a simple check against the other addresses in netAssetTransfers (sent.length === 1 && received.length===1)
  • Only 4 addresses max in netAssetTransfers. This is because when using a router there are likely other parties receiving fees. Some erc20s take a fee for any transfers as well. 4 addresses should be safe.

To generate the erc20 swap, only look at the tx.from address in netAssetTransfers to pull out the sent/received (i.e., swapped from token X <> to token Y)

@pcowgill pcowgill merged commit 47a360a into main Nov 30, 2023
2 checks passed
@pcowgill pcowgill deleted the benguyen0214/ou-1151-erc20-swap branch November 30, 2023 16:10
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.

2 participants