Swap#
Swap the top of the stack with another item on the stack given by n
.
def _swap(evm, n):
value1, value2 = evm.stack.get(0), evm.stack.get(n+1)
evm.stack.set(0, value2)
evm.stack.set(n+1, value1)
evm.pc += 1
evm.gas_dec(3)