tessl install tessl/pypi-web3@7.13.0A Python library for interacting with Ethereum blockchain
Agent Success
Agent success rate when using this tile
88%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
87%
Build a contract deployment service that can deploy Ethereum smart contracts to a blockchain network.
Create a Python module that provides functionality to deploy smart contracts given their bytecode and ABI. The module should:
Your solution should include:
estimate_deployment_gas(w3, bytecode, abi, constructor_args) that estimates the gas required for deploymentdeploy_contract(w3, bytecode, abi, constructor_args, deployer_address) that deploys the contract and returns a dictionary with keys contract_address and tx_hashCreate a test file test_deployment.py with the following test cases:
Given:
0x608060405234801561001057600080fd5b5060405161012a38038061012a83398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b60cd8061005e6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80632e64cec11460375780636057361d146051575b600080fd5b603d6069565b6040519081526020015b60405180910390f35b6067605c366004608b565b600055565b005b60005481565b600080fd5b6000602082840312156099578081fd5b503591905056fea2646970667358221220f3e0a7a1b9c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e064736f6c63430008070033[{"inputs":[{"internalType":"uint256","name":"initialValue","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}]42Expected:
Given:
0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063ebb4a0af14602d575b600080fd5b60336045565b60405190815260200160405180910390f35b600a90509056fea264697066735822122033445566778899aabbccddeeff00112233445566778899aabbccddeeff00112264736f6c63430008070033[{"inputs":[],"name":"getValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]Expected:
Given:
0xinvalid[]Expected:
Provides Ethereum blockchain interaction capabilities for contract deployment.