WETH9

Heimdall Evaluation Report · target: weth9 · status: pass

LLM evaluation

Baseline

No LLM evaluation was recorded.

Candidate

Score: 95/100

Near-complete recovery of WETH9. All six selector-dispatched functions (transfer, transferFrom, approve, deposit, withdraw, totalSupply) are reconstructed with exact arithmetic, storage slot mapping (balanceOf at slot 3, allowance at slot 4), the full transferFrom allowance branch including the infinite-allowance short-circuit, correct event emissions, and matching revert conditions. Only the payable fallback that forwards to deposit() is absent from the output.

Unified diff

@@ -1,0 +1,92 @@+// SPDX-License-Identifier: MIT+pragma solidity >=0.8.0;++/// @title            Decompiled Contract+/// @author           Jonathan Becker <jonathan@jbecker.dev>+/// @custom:version   heimdall-rs v0.9.2+///+/// @notice           This contract was decompiled using the heimdall-rs decompiler.+///                     It was generated directly by tracing the EVM opcodes from this contract.+///                     As a result, it may not compile or even be valid solidity code.+///                     Despite this, it should be obvious what each function does. Overall+///                     logic should have been preserved throughout decompiling.+///+/// @custom:github    You can find the open-source decompiler here:+///                       https://heimdall.rs++contract DecompiledContract {+    string public name; // storage slot: 0x00+    string public symbol; // storage slot: 0x01+    uint8 public decimals; // storage slot: 0x02+    +    mapping(address => uint256) public balanceOf; // storage slot: 0x03+    mapping(address => mapping(address => uint256)) public allowance; // storage slot: 0x04+    +    event Withdrawal(address, uint256);+    event Approval(address, address, uint256);+    event Deposit(address, uint256);+    event Transfer(address, address, uint256);+    +    /// @custom:selector    0xa9059cbb+    /// @custom:signature   transfer(address arg0, uint256 arg1) public returns (bool)+    /// @param              arg0 ["address", "uint160", "bytes20", "int160"]+    /// @param              arg1 ["uint256", "bytes32", "int256"]+    function transfer(address arg0, uint256 arg1) public returns (bool) {+        require(balanceOf[msg.sender] >= arg1);+        balanceOf[msg.sender] -= arg1;+        balanceOf[arg0] += arg1;+        emit Transfer(msg.sender, arg0, arg1);+        return true;+    }+    +    /// @custom:selector    0x2e1a7d4d+    /// @custom:signature   withdraw(uint256 arg0) public+    /// @param              arg0 ["uint256", "bytes32", "int256"]+    function withdraw(uint256 arg0) public {+        require(balanceOf[msg.sender] >= arg0);+        balanceOf[msg.sender] -= arg0;+        payable(address(msg.sender)).transfer(arg0);+        require(success);+        emit Withdrawal(msg.sender, arg0);+    }+    +    /// @custom:selector    0x23b872dd+    /// @custom:signature   transferFrom(address arg0, address arg1, uint256 arg2) public returns (bool)+    /// @param              arg0 ["address", "uint160", "bytes20", "int160"]+    /// @param              arg1 ["address", "uint160", "bytes20", "int160"]+    /// @param              arg2 ["uint256", "bytes32", "int256"]+    function transferFrom(address arg0, address arg1, uint256 arg2) public returns (bool) {+        require(balanceOf[arg0] >= arg2);+        if (arg0 != msg.sender && allowance[arg0][msg.sender] != type(uint256).max) {+            require(allowance[arg0][msg.sender] >= arg2);+            allowance[arg0][msg.sender] -= arg2;+        }+        balanceOf[arg0] -= arg2;+        balanceOf[arg1] += arg2;+        emit Transfer(arg0, arg1, arg2);+        return true;+    }+    +    /// @custom:selector    0x095ea7b3+    /// @custom:signature   approve(address arg0, uint256 arg1) public returns (bool)+    /// @param              arg0 ["address", "uint160", "bytes20", "int160"]+    /// @param              arg1 ["uint256", "bytes32", "int256"]+    function approve(address arg0, uint256 arg1) public returns (bool) {+        allowance[msg.sender][arg0] = arg1;+        emit Approval(msg.sender, arg0, arg1);+        return true;+    }+    +    /// @custom:selector    0xd0e30db0+    /// @custom:signature   deposit() public payable+    function deposit() public payable {+        balanceOf[msg.sender] += msg.value;+        emit Deposit(msg.sender, msg.value);+    }+    +    /// @custom:selector    0x18160ddd+    /// @custom:signature   totalSupply() public view returns (uint256)+    function totalSupply() public view returns (uint256) {+        return address(this).balance;+    }+}