MCPcopy Create free account
hub / github.com/CPChain/chain / opStaticCall

Function opStaticCall

core/vm/instructions.go:751–774  ·  view source on GitHub ↗
(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack)

Source from the content-addressed store, hash-verified

749}
750
751func opStaticCall(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
752 // Pop gas. The actual gas is in evm.callGasTemp.
753 evm.interpreter.intPool.put(stack.pop())
754 gas := evm.callGasTemp
755 // Pop other call parameters.
756 addr, inOffset, inSize, retOffset, retSize := stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop()
757 toAddr := common.BigToAddress(addr)
758 // Get arguments from the memory.
759 args := memory.Get(inOffset.Int64(), inSize.Int64())
760
761 ret, returnGas, err := evm.StaticCall(contract, toAddr, args, gas)
762 if err != nil {
763 stack.push(evm.interpreter.intPool.getZero())
764 } else {
765 stack.push(evm.interpreter.intPool.get().SetUint64(1))
766 }
767 if err == nil || err == errExecutionReverted {
768 memory.Set(retOffset.Uint64(), retSize.Uint64(), ret)
769 }
770 contract.Gas += returnGas
771
772 evm.interpreter.intPool.put(addr, inOffset, inSize, retOffset, retSize)
773 return ret, nil
774}
775
776func opReturn(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
777 offset, size := stack.pop(), stack.pop()

Callers

nothing calls this directly

Calls 10

popMethod · 0.80
Int64Method · 0.80
StaticCallMethod · 0.80
getZeroMethod · 0.80
Uint64Method · 0.80
GetMethod · 0.65
putMethod · 0.45
pushMethod · 0.45
getMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected