Git Product home page Git Product logo

erc20-topup's Introduction

TBSS Searcher ๐ŸฆŒ

Token Balance Storage Slot Searcher

Use case

Finding the storage slot of an ERC20 token can be useful for updating the balance of a token on a forked network.

Supported tokens

It supports the majority of ERC20 tokens accross Vyper and Solidity. Even proxies and cases for which storage contract where balances are stored is different than the token itself (eg. SNX). Note that for some contracts balance is not solely determined by the storage slot, so in those cases setting the storage slot to a specific value may not be exectly reflected in the balance - it could be slightly higher or lower.

Components

API

The API is live on: http://token-bss.xyz.

Supported Networks Keys

  • ethereum / eth
  • arbitrum / arb
  • optimism / opt
  • avalanche / avax

Example

Request:

$ curl http://token-bss.xyz/opt/0x513c7e3a9c69ca3e22550ef58ac1c0088e918fff | jq

Response:

{
  "success": true,
  "msg": {
    "token": "0x513c7e3a9c69ca3e22550ef58ac1c0088e918fff",
    "contract": "0x513c7e3a9c69ca3e22550ef58ac1c0088e918fff",
    "slot": "0x34",
    "updateRatio": 1.0011,
    "lang": "solidity"
  }
}

Checkout Server README for more information on usage.

CLI Tool

Features

  • Storage Slot Discovery: Trace ERC20 balanceOf calls to determine the storage slot of a token and where is it stored.
  • Balance Updating: Directly update the balance of an ERC20 token on a forked network.

image

Checkout CLI README for more information on usage.

Library

match token_bss::find_slot(&provider, token, None, None).await {
    Ok((contract, slot, update_ratio, lang)) => {
        println!("{symbol}({token:?}): {contract:?}({lang}) - {slot:?} / ฮ”R: {update_ratio}")
    }
    Err(e) => println!("{symbol}({token:?}): {e}"),
}

Run an Example

$ cargo run --example eth_token_support

Contributions are more than welcomed!

Reach out on X

erc20-topup's People

Contributors

halo3mic avatar

Stargazers

ddl avatar Aliez avatar 0xStone avatar Michael Demarais avatar Jack McPherson avatar 0xDmtri avatar

Watchers

Michael Demarais avatar  avatar

erc20-topup's Issues

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.