| 666 | } |
| 667 | |
| 668 | func opCall(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { |
| 669 | // Pop gas. The actual gas in in evm.callGasTemp. |
| 670 | evm.interpreter.intPool.put(stack.pop()) |
| 671 | gas := evm.callGasTemp |
| 672 | // Pop other call parameters. |
| 673 | addr, value, inOffset, inSize, retOffset, retSize := stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop() |
| 674 | toAddr := common.BigToAddress(addr) |
| 675 | value = math.U256(value) |
| 676 | // Get the arguments from the memory. |
| 677 | args := memory.Get(inOffset.Int64(), inSize.Int64()) |
| 678 | |
| 679 | if value.Sign() != 0 { |
| 680 | gas += configs.CallStipend |
| 681 | } |
| 682 | ret, returnGas, err := evm.Call(contract, toAddr, args, gas, value) |
| 683 | if err != nil { |
| 684 | stack.push(evm.interpreter.intPool.getZero()) |
| 685 | } else { |
| 686 | stack.push(evm.interpreter.intPool.get().SetUint64(1)) |
| 687 | } |
| 688 | if err == nil || err == errExecutionReverted { |
| 689 | memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) |
| 690 | } |
| 691 | contract.Gas += returnGas |
| 692 | |
| 693 | evm.interpreter.intPool.put(addr, value, inOffset, inSize, retOffset, retSize) |
| 694 | return ret, nil |
| 695 | } |
| 696 | |
| 697 | func opCallCode(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { |
| 698 | // Pop gas. The actual gas is in evm.callGasTemp. |