-
-
Save JAC-02/fc0d982ac0dde31e32edff5c200a2b6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [] | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from solcx import compile_source\n", | |
"\n", | |
"compiled_sol = compile_source(\n", | |
" '''\n", | |
"// SPDX-License-Identifier: MIT\n", | |
"\n", | |
"pragma solidity 0.8.7;\n", | |
"\n", | |
"\n", | |
"contract HelloWorld {\n", | |
"\n", | |
" string public message;\n", | |
"\n", | |
" constructor() {\n", | |
"\n", | |
" message = \"Hello World\";\n", | |
" }\n", | |
"\n", | |
" function setMessage(string memory _message) public{\n", | |
" message = _message;\n", | |
" }\n", | |
"\n", | |
" function sayMessage() view public returns(string memory) {\n", | |
" return message;\n", | |
" }\n", | |
"}\n", | |
"''', output_values = ['abi', 'bin'])" | |
], | |
"metadata": { | |
"id": "bBTpfs86XePK" | |
}, | |
"execution_count": 10, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"compiled_sol" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "Nw1Ttdr7m8Xe", | |
"outputId": "c20fb355-23f4-413a-f64d-a5ff493d967d" | |
}, | |
"execution_count": 13, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"{'<stdin>:HelloWorld': {'abi': [{'inputs': [],\n", | |
" 'stateMutability': 'nonpayable',\n", | |
" 'type': 'constructor'},\n", | |
" {'inputs': [],\n", | |
" 'name': 'message',\n", | |
" 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}],\n", | |
" 'stateMutability': 'view',\n", | |
" 'type': 'function'},\n", | |
" {'inputs': [],\n", | |
" 'name': 'sayMessage',\n", | |
" 'outputs': [{'internalType': 'string', 'name': '', 'type': 'string'}],\n", | |
" 'stateMutability': 'view',\n", | |
" 'type': 'function'},\n", | |
" {'inputs': [{'internalType': 'string',\n", | |
" 'name': '_message',\n", | |
" 'type': 'string'}],\n", | |
" 'name': 'setMessage',\n", | |
" 'outputs': [],\n", | |
" 'stateMutability': 'nonpayable',\n", | |
" 'type': 'function'}],\n", | |
" 'bin': '608060405234801561001057600080fd5b506040518060400160405280600b81526020017f48656c6c6f20576f726c640000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610166565b82805461006e90610105565b90600052602060002090601f01602090048101928261009057600085556100d7565b82601f106100a957805160ff19168380011785556100d7565b828001600101855582156100d7579182015b828111156100d65782518255916020019190600101906100bb565b5b5090506100e491906100e8565b5090565b5b808211156101015760008160009055506001016100e9565b5090565b6000600282049050600182168061011d57607f821691505b6020821081141561013157610130610137565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b61055f806101756000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063368b877214610046578063e21f37ce14610062578063fc4a028714610080575b600080fd5b610060600480360381019061005b91906102eb565b61009e565b005b61006a6100b8565b604051610077919061036d565b60405180910390f35b610088610146565b604051610095919061036d565b60405180910390f35b80600090805190602001906100b49291906101d8565b5050565b600080546100c590610443565b80601f01602080910402602001604051908101604052809291908181526020018280546100f190610443565b801561013e5780601f106101135761010080835404028352916020019161013e565b820191906000526020600020905b81548152906001019060200180831161012157829003601f168201915b505050505081565b60606000805461015590610443565b80601f016020809104026020016040519081016040528092919081815260200182805461018190610443565b80156101ce5780601f106101a3576101008083540402835291602001916101ce565b820191906000526020600020905b8154815290600101906020018083116101b157829003601f168201915b5050505050905090565b8280546101e490610443565b90600052602060002090601f016020900481019282610206576000855561024d565b82601f1061021f57805160ff191683800117855561024d565b8280016001018555821561024d579182015b8281111561024c578251825591602001919060010190610231565b5b50905061025a919061025e565b5090565b5b8082111561027757600081600090555060010161025f565b5090565b600061028e610289846103b4565b61038f565b9050828152602081018484840111156102aa576102a9610509565b5b6102b5848285610401565b509392505050565b600082601f8301126102d2576102d1610504565b5b81356102e284826020860161027b565b91505092915050565b60006020828403121561030157610300610513565b5b600082013567ffffffffffffffff81111561031f5761031e61050e565b5b61032b848285016102bd565b91505092915050565b600061033f826103e5565b61034981856103f0565b9350610359818560208601610410565b61036281610518565b840191505092915050565b600060208201905081810360008301526103878184610334565b905092915050565b60006103996103aa565b90506103a58282610475565b919050565b6000604051905090565b600067ffffffffffffffff8211156103cf576103ce6104d5565b5b6103d882610518565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b82818337600083830152505050565b60005b8381101561042e578082015181840152602081019050610413565b8381111561043d576000848401525b50505050565b6000600282049050600182168061045b57607f821691505b6020821081141561046f5761046e6104a6565b5b50919050565b61047e82610518565b810181811067ffffffffffffffff8211171561049d5761049c6104d5565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f830116905091905056fea2646970667358221220f678b3e3724497c3e85e660a341279eae885455ddd4c692600d099075afb153e64736f6c63430008070033'}}" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 13 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "foo08xbb4eoP" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment