Coder Social home page Coder Social logo

jaredfromsubway-contract's Introduction

Decypher jaredfromsubway.eth contract

Converting the contract of jaredfromsubway.eth from bytecode to Huff and write some test to validate the behavior.

Motivation

The goal is to decompile the contract to understand its logic and create a readable version. This allows us all to learn for it. To achieve this, tests are created to validate the behavior of both the deployed and the decompiled contract.

Status

The original contract was probably not created with Huff. Huff always appends the CODECOPY parts at the end of the contract. Jared's contract makes use of a wall of STOP operations to keep the data. For this reason, the decompiled version is longer, and there are some adjustments to keep the JUMPDEST instructions in the same place. Currently, not all jump destinations are likely in the correct place.

Version:

The contract was deployed on Mar-09-2024 03:47:35 AM UTC.
Contract: 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80
Deployment: tx

Structure

src/
    Jared.huff <- decoded contract
decompile-contract/
    resources/
        disassembled.evm <- original contract
        disassembled.evm <- disassembled contract
    src/
        decompile_contract/convert_to_huff.py <- script to convert the contract to huff
test/
    BasicTests.t.sol <- test the Huff contract

Getting Started

Requirements

Run

In the test you can modify if the Huff version or the original constructor should be used.

export ETH_MAINNET_HTTP=<RPC PROVIDER>
forge test

Disassemble contract

The disassembled version in decompile-contract/resources/disassembled.evm was created using heimdall-rs.

heimdall disassemble 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80

Development

If you like to improve the decompiler I am happy to get your help. The decompiler is written in python

  1. Create a python virtual environment and install the dependencies:
cd decompile-contract
pip install -e .
  1. Run the decompiler:
python src/decompile_contract/convert_to_huff.py

jaredfromsubway-contract's People

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.