def Runtime_Notify(self, engine): state = engine.EvaluationStack.Pop() # Build and emit smart contract event state_py = stack_item_to_py(state) payload = state_py if isinstance(state_py, list) else [ state_py ] # Runtime.Notify payload must be a list args = NotifyEventArgs( engine.ScriptContainer, UInt160(data=engine.CurrentContext.ScriptHash()), payload) message = payload[0] if len(payload) > 0 else payload engine.write_log(str(message)) self.notifications.append(args) if settings.emit_notify_events_on_sc_execution_error: # emit Notify events even if the SC execution might fail. tx_hash = engine.ScriptContainer.Hash height = Blockchain.Default().Height + 1 success = None self.events_to_dispatch.append( NotifyEvent(SmartContractEvent.RUNTIME_NOTIFY, args.State, args.ScriptHash, height, tx_hash, success, engine.testMode)) return True
def Runtime_Notify(self, engine): state = engine.EvaluationStack.Pop() notice = NotifyEventArgs( engine.ScriptContainer, UInt160(data=engine.CurrentContext.ScriptHash), state) self.NotifyEvent.on_change(notice) return True
def Runtime_Notify(self, engine): state = engine.EvaluationStack.Pop() # Build and emit smart contract event state_py = stack_item_to_py(state) payload = state_py if isinstance(state_py, list) else [state_py] # Runtime.Notify payload must be a list args = NotifyEventArgs( engine.ScriptContainer, UInt160(data=engine.CurrentContext.ScriptHash()), payload ) self.notifications.append(args) return True
def Runtime_Notify(self, engine): state = engine.EvaluationStack.Pop() args = NotifyEventArgs( engine.ScriptContainer, UInt160(engine.CurrentContext.ScriptHash()), state ) if type(self) is StateReader: if state.IsArray: for item in state.GetArray(): print("NOTIFY ITEM %s " % str(item)) else: print("ITEM: %s " % str(state)) self.NotifyEvent.on_change(args) return True
def Runtime_Notify(self, engine: ExecutionEngine): state = engine.CurrentContext.EvaluationStack.Pop() payload = ContractParameter.ToParameter(state) args = NotifyEventArgs( engine.ScriptContainer, UInt160(data=engine.CurrentContext.ScriptHash()), payload) self.notifications.append(args) if settings.emit_notify_events_on_sc_execution_error: # emit Notify events even if the SC execution might fail. tx_hash = engine.ScriptContainer.Hash height = GetBlockchain().Height + 1 success = None self.events_to_dispatch.append( NotifyEvent(SmartContractEvent.RUNTIME_NOTIFY, payload, args.ScriptHash, height, tx_hash, success, engine.testMode)) return True