0

There is Solidity Cheat Sheet: https://github.com/manojpramesh/solidity-cheatsheet There is OPCODEs list: https://github.com/crytic/evm-opcodes

But is there any list that show opcode's solidity code provisions example;

ADD (Opcode) = + (Solidity Code)

2
  • 1
    I don't understand your question. What do you mean by "code provisions" . Solidity is higher language, EVM assembly is the lower level language. solc will compile high level code , optimize it if needed, and produce EVM assembly. So this equation ADD (Opcode) = + (Solidity Code) doesn't make sense. You want to us to refer you to the solidity sources ???
    – Nulik
    Aug 6, 2021 at 17:26
  • I can't really tell what you mean, but you can learn more about Ethereum Virtual Machine Opcodes from: evm.codes and ethervm.io May 18, 2022 at 20:11

2 Answers 2

1

Try this link and scroll down a little please. I think it is what you have been asked.

Instruction Explanation
stop stop execution, identical to return(0,0)
add(x, y) x + y
sub(x, y) x - y
mul(x, y) x * y
div(x, y) x / y
sdiv(x, y) x / y, for signed numbers in two’s complement
mod(x, y) x % y
smod(x, y) x % y, for signed numbers in two’s complement
exp(x, y) x to the power of y
not(x) ~x, every bit of x is negated
lt(x, y) 1 if x < y, 0 otherwise
gt(x, y) 1 if x > y, 0 otherwise
slt(x, y) 1 if x < y, 0 otherwise, for signed numbers in two’s complement
sgt(x, y) 1 if x > y, 0 otherwise, for signed numbers in two’s complement
eq(x, y) 1 if x == y, 0 otherwise
iszero(x) 1 if x == 0, 0 otherwise
and(x, y) bitwise and of x and y
or(x, y) bitwise or of x and y
xor(x, y) bitwise xor of x and y
byte(n, x) nth byte of x, where the most significant byte is the 0th byte
shl(x, y) logical shift left y by x bits
shr(x, y) logical shift right y by x bits
sar(x, y) arithmetic shift right y by x bits
pop(x) remove the element pushed by x
gas gas still available to execution
address address of the current contract / execution context
balance(a) wei balance at address a
caller call sender (excluding delegatecall)
call(g, a, v, in, insize, out, outsize) call contract at address a with input mem[in…(in+insize)) providing g gas and v wei and output area mem[out…(out+outsize)) returning 0 on error (eg. out of gas) and 1 on success
callcode(g, a, v, in, insize, out, outsize) identical to call but only use the code from a and stay in the context of the current contract otherwise
delegatecall(g, a, in, insize, out, outsize) identical to callcode but also keep caller and callvalue
staticcall(g, a, in, insize, out, outsize) identical to call(g, a, 0, in, insize, out, outsize) but do not allow state modifications
return(p, s) end execution, return data mem[p…(p+s))
revert(p, s) end execution, revert state changes, return data mem[p…(p+s))
selfdestruct(a) end execution, destroy current contract and send funds to a
origin transaction sender
gasprice gas price of the transaction
blockhash(b) hash of block nr b - only for last 256 blocks excluding current
timestamp timestamp of the current block in seconds since the epoch
gaslimit block gas limit of the current block
0
0

I can't really tell what you mean, but you can learn more about Ethereum Virtual Machine Opcodes from:

https://www.evm.codes/ and https://www.ethervm.io/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.