(gasPrice, gasLimit uint64, contractAddr common.Address, version byte,
params []interface{}, funcAbi *abi.NativeContractFunctionAbi)
| 38 | ) |
| 39 | |
| 40 | func NewNativeInvokeTransaction(gasPrice, gasLimit uint64, contractAddr common.Address, version byte, |
| 41 | params []interface{}, funcAbi *abi.NativeContractFunctionAbi) (*types.MutableTransaction, error) { |
| 42 | builder := neovm.NewParamsBuilder(new(bytes.Buffer)) |
| 43 | err := ParseNativeFuncParam(builder, funcAbi.Name, params, funcAbi.Parameters) |
| 44 | if err != nil { |
| 45 | return nil, err |
| 46 | } |
| 47 | builder.EmitPushByteArray([]byte(funcAbi.Name)) |
| 48 | builder.EmitPushByteArray(contractAddr[:]) |
| 49 | builder.EmitPushInteger(new(big.Int).SetInt64(int64(version))) |
| 50 | builder.Emit(neovm.SYSCALL) |
| 51 | builder.EmitPushByteArray([]byte(svrneovm.NATIVE_INVOKE_NAME)) |
| 52 | invokeCode := builder.ToArray() |
| 53 | return httpcom.NewSmartContractTransaction(gasPrice, gasLimit, invokeCode) |
| 54 | } |
| 55 | |
| 56 | func ParseNativeFuncParam(builder *neovm.ParamsBuilder, funName string, params []interface{}, paramsAbi []*abi.NativeContractParamAbi) error { |
| 57 | size := len(paramsAbi) |
nothing calls this directly
no test coverage detected