protected override bool OnSysCall(uint method) { if (!AddGas(InteropService.GetPrice(method, CurrentContext.EvaluationStack, Snapshot))) { return(false); } return(InteropService.Invoke(this, method)); }
protected virtual long GetPriceForSysCall() { Instruction instruction = CurrentContext.CurrentInstruction; uint method = instruction.TokenU32; long price = InteropService.GetPrice(method); if (price > 0) { return(price); } if (method == InteropService.Neo_Crypto_CheckMultiSig) { if (CurrentContext.EvaluationStack.Count == 0) { return(1); } var item = CurrentContext.EvaluationStack.Peek(); int n; if (item is VMArray array) { n = array.Count; } else { n = (int)item.GetBigInteger(); } if (n < 1) { return(1); } return(100 * n); } if (method == InteropService.Neo_Contract_Create || method == InteropService.Neo_Contract_Migrate) { long fee = 100L; ContractPropertyState contract_properties = (ContractPropertyState)(byte)CurrentContext.EvaluationStack.Peek(3).GetBigInteger(); if (contract_properties.HasFlag(ContractPropertyState.HasStorage)) { fee += 400L; } return(fee * (long)NativeContract.GAS.Factor / ratio); } if (method == InteropService.System_Storage_Put || method == InteropService.System_Storage_PutEx) { return(((CurrentContext.EvaluationStack.Peek(1).GetByteArray().Length + CurrentContext.EvaluationStack.Peek(2).GetByteArray().Length - 1) / 1024 + 1) * 1000); } return(1); }