Ich möchte meine Verträge kompilieren und eine Ausgabe mit den Opcodes im Detail (nicht nur Assemblierung), sondern mit Verweisen auf den Solidity-Quellcode in jeder Zeile erhalten. Dies ist die Ausgabe, die man standardmäßig erhält, wenn man den Remix-Editor verwendet und auf "Details" klickt, aber ich kann keinen Weg finden, das mit der solc
Binärdatei zu bekommen: Ich bekomme entweder Assembly mit Kommentaren mit --asm
oder Opcodes ohne Kommentare --opcodes
. Kann ich das machen?
EDIT: Um zu verdeutlichen, was ich mit Montage meine, ist so etwas wie tag_11 /* "pot.sol":5259:5263 myid */ dup3 /* "pot.sol":5265:5271 result */ dup3 /* "pot.sol":5283:5284 0 */ 0x0 /* "pot.sol":5273:5285 new bytes(0) */
und was ich mit Opcodes meine, ist so etwas wie
SWAP1 contract Coucou{\n address ... DIV contract Coucou{\n address ... PUSH FFFFFFFF contract Coucou{\n address ... AND contract Coucou{\n address ... DUP1 contract Coucou{\n address ... PUSH 26121FF0 contract Coucou{\n address ...
Ich bin mir nicht sicher, was Sie mit Assembly vs. Opcodes meinen. Sie haben die Option --abi, die die ABI des Vertrags ausgibt, und --bin für die Binärdatei.
Wenn Sie außerdem nur solc
Ihre Konsole eingeben, sehen Sie alle verfügbaren Optionen. In meiner Installation zeigt es folgendes:
Output Components:
--ast AST of all source files.
--ast-json AST of all source files in JSON format.
--ast-compact-json AST of all source files in a compact JSON format.
--asm EVM assembly of the contracts.
--asm-json EVM assembly of the contracts in JSON format.
--opcodes Opcodes of the contracts.
--bin Binary of the contracts in hex.
--bin-runtime Binary of the runtime part of the contracts in hex.
--clone-bin Binary of the clone contracts in hex.
--abi ABI specification of the contracts.
--hashes Function signature hashes of the contracts.
--userdoc Natspec user documentation of all contracts.
--devdoc Natspec developer documentation of all contracts.
--metadata Combined Metadata JSON whose Swarm hash is stored on-chain.
--formal Translated source suitable for formal analysis.
Nur mit solc
kann es sich nicht. Sie müssen mit arbeiten srcmap-runtime
. Sie können den Befehl wie folgt ausführen: solc --pretty-json --combined-json srcmap-runtime YourContract.sol
Dann erhalten Sie so etwas wie:
"srcmap-runtime" : "26:184:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;137:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;137:71:0;;;;;;;;;;;;;;;;;;;;;;;70:57;;8:9:-1;5:2;;;30:1;27;20:12;5:2;70:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;137:71;175:4;198:3;;191:10;;137:71;:::o;70:57::-;118:2;112:3;:8;;;;70:57;:::o"
Die Notation ist hier dokumentiert: https://solidity.readthedocs.io/en/develop/miscellaneous.html#source-mappings
Benutzer3078439