CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.

77

1.05x

Evaluation77%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-4/

Library Bytecode Linker

Build a helper that transforms compiled contract bytecode containing unresolved library placeholders into fully linked bytecode ready for deployment.

Capabilities

Links all library placeholders

  • Replaces every library placeholder (for example __MathLib______________________________) within a hex string using the provided 20-byte addresses and returns a linked 0x-prefixed bytecode string. @test

Validates missing or malformed addresses

  • If any placeholder lacks a corresponding address or an address is not a 40-character hex value (with or without 0x), raise a clear error that lists the problematic library identifiers. @test

Namespaced library mapping

  • Handles placeholders that include source-qualified identifiers (for example contracts/Math.sol:MathLib) by resolving each fully qualified name to the correct address so that no placeholders remain. @test

Compiler override

  • When given a compiler override (version label or binary path), linking succeeds using that compiler even if the active compiler differs, and the linked output reflects the provided addresses. @test

Implementation

@generates

API

from typing import Dict, Optional

def link_bytecode(
    unlinked_bytecode: str,
    libraries: Dict[str, str],
    compiler_version: Optional[str] = None,
    compiler_binary: Optional[str] = None,
) -> str:
    """
    Link placeholders in compiled bytecode to the provided library addresses.

    Returns a 0x-prefixed hex string or raises an error when required addresses are missing or malformed.
    """

Dependencies { .dependencies }

py-solc-x { .dependency }

Provides Solidity compiler management and bytecode linking utilities for replacing library placeholders in compiled contracts.

Install with Tessl CLI

npx tessl i tessl/pypi-py-solc-x

tile.json