GithubHelp home page GithubHelp logo

devanoneth / tokenchecks Goto Github PK

View Code? Open in Web Editor NEW
122.0 4.0 40.0 927 KB

Perform various checks against tokens on-chain with 0 gas and 0 deployments

License: MIT License

Shell 0.03% JavaScript 1.58% Solidity 51.95% TypeScript 46.45%

tokenchecks's Introduction

Token Checks for MEV

On-chain checks for common types of smart contract scams. Useful for anyone exploring MEV. See the original TokenProvidence repo for more details on these types of checks. Check them out in /contracts.

This repo is a hardhat-ified and constructor optimized version of OxV19's providence checks. Thanks to DrGorilla for the constructor input to avoid deploying the contracts at all.

I added some basic tests to show how they can be used. Check them out in test/ to see how to use these contracts efficently.

I also added on an example of geth's state override set inspired by libevm's tweet. These are the flashSwap.ts files in test and scripts. These need to be heavily modified to be useful in a production setting, but they serve as an example for now.

Setup

  • cp .env.example .env
  • Fill out the .env file
  • npm install

Tests

  • npm run test

Usage

Checking Tokens using a constructor only contract

  • npm run token <token address>
  • e.g. npm run token 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 for USDC
  • e.g. npm run token 0x843976d0705c821ae02ab72ab505a496765c8f93 for some honeypot

Checking Tokens using geth's state override set

  • npm run token <token address>
  • e.g. npm run token-override 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 for USDC
  • e.g. npm run token-override 0x843976d0705c821ae02ab72ab505a496765c8f93 for some honeypot

This seems to be the more robust way, so as to avoid intelligent malicious contracts like EvilERC20. Thanks to Ape Dev's tweet and PR for this very sneaky contract.

Flash Swap

There is also a Uniswap Flash Swap example between UniswapV2 and Sushiswap on their ETH<>DAI pairs. Running npm run flash will test the opportunity without deploying any contracts.

Note, this example is unlikely to find an arb as that's a heavily watched pair. Also, the example is:

  • Not gas optimized.
  • Only works one way and tries to get a profit of 1e-18 DAI.
  • Probably not secure enough for production use.

Think of it as a proof of concept to help you learn about flash swaps and usage of eth_call.

Inspired by:

WARNING

Not responsible for any errors which may occur. Use at your own risk.

tokenchecks's People

Contributors

ape-dev-cs avatar devanoneth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tokenchecks's Issues

Add sell taxes check

Thanks for contracts, good job!
But I noticed that only buy phase is checked for fees in InternalFees contract. I suppose, there can be some tokens with 0% buy fee, but x% sell fee. Maybe add sell check too?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.