protected StackItem OnPersist(ApplicationEngine engine, VMArray args) { if (engine.Trigger != TriggerType.System) { return(false); } return(OnPersist(engine)); }
protected StackItem Transfer(ApplicationEngine engine, VMArray args) { UInt160 from = new UInt160(args[0].GetByteArray()); UInt160 to = new UInt160(args[1].GetByteArray()); BigInteger amount = args[2].GetBigInteger(); return(Transfer(engine, from, to, amount)); }
private StackItem SetFeePerByte(ApplicationEngine engine, VMArray args) { if (!CheckValidators(engine)) { return(false); } long value = (long)args[0].GetBigInteger(); StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_FeePerByte)); storage.Value = BitConverter.GetBytes(value); return(true); }
private StackItem SetMaxTransactionsPerBlock(ApplicationEngine engine, VMArray args) { if (!CheckValidators(engine)) { return(false); } uint value = (uint)args[0].GetBigInteger(); StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_MaxTransactionsPerBlock)); storage.Value = BitConverter.GetBytes(value); return(true); }
private StackItem SetMaxBlockSize(ApplicationEngine engine, VMArray args) { if (!CheckValidators(engine)) { return(false); } uint value = (uint)args[0].GetBigInteger(); if (Network.P2P.Message.PayloadMaxSize <= value) { return(false); } StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_MaxBlockSize)); storage.Value = BitConverter.GetBytes(value); return(true); }
internal bool Invoke(ApplicationEngine engine) { if (!engine.CurrentScriptHash.Equals(Hash)) { return(false); } string operation = engine.CurrentContext.EvaluationStack.Pop().GetString(); VMArray args = (VMArray)engine.CurrentContext.EvaluationStack.Pop(); if (!methods.TryGetValue(operation, out ContractMethodMetadata method)) { return(false); } StackItem result = method.Delegate(engine, args); engine.CurrentContext.EvaluationStack.Push(result); return(true); }
private StackItem UnblockAccount(ApplicationEngine engine, VMArray args) { if (!CheckValidators(engine)) { return(false); } UInt160 account = new UInt160(args[0].GetByteArray()); StorageKey key = CreateStorageKey(Prefix_BlockedAccounts); StorageItem storage = engine.Snapshot.Storages[key]; HashSet <UInt160> accounts = new HashSet <UInt160>(storage.Value.AsSerializableArray <UInt160>()); if (!accounts.Remove(account)) { return(false); } storage = engine.Snapshot.Storages.GetAndChange(key); storage.Value = accounts.ToArray().ToByteArray(); return(true); }
private StackItem GetFeePerByte(ApplicationEngine engine, VMArray args) { return(GetFeePerByte(engine.Snapshot)); }
private StackItem GetMaxBlockSize(ApplicationEngine engine, VMArray args) { return(GetMaxBlockSize(engine.Snapshot)); }
private StackItem GetMaxTransactionsPerBlock(ApplicationEngine engine, VMArray args) { return(GetMaxTransactionsPerBlock(engine.Snapshot)); }
protected StackItem NameMethod(ApplicationEngine engine, VMArray args) { return(Name); }
private StackItem GetBlockedAccounts(ApplicationEngine engine, VMArray args) { return(GetBlockedAccounts(engine.Snapshot).Select(p => (StackItem)p.ToArray()).ToList()); }
protected StackItem BalanceOf(ApplicationEngine engine, VMArray args) { return(BalanceOf(engine.Snapshot, new UInt160(args[0].GetByteArray()))); }
protected StackItem TotalSupply(ApplicationEngine engine, VMArray args) { return(TotalSupply(engine.Snapshot)); }
protected StackItem DecimalsMethod(ApplicationEngine engine, VMArray args) { return((uint)Decimals); }
protected StackItem SymbolMethod(ApplicationEngine engine, VMArray args) { return(Symbol); }
protected StackItem SupportedStandardsMethod(ApplicationEngine engine, VMArray args) { return(SupportedStandards.Select(p => (StackItem)p).ToList()); }
private StackItem GetSysFeeAmount(ApplicationEngine engine, VMArray args) { uint index = (uint)args[0].GetBigInteger(); return(GetSysFeeAmount(engine.Snapshot, index)); }