/// <summary> /// Runs the specified smartcontract from the constructor with a given transaction /// </summary> /// <param name="trans">Data[1] inside transaction specifies where you enter the program</param> /// <returns>Returns an out transaction which should be added to your DB</returns> public Maybe <Transaction> Run(Transaction trans) { Data = trans.Data; InTrans = trans; InstructionPointer = EntryRegister[trans.Data[1]]; while (InstructionPointer < ExpressionList.Count) { int flag = Eval(ExpressionList[InstructionPointer]); if (flag == 0) { break; } InstructionPointer++; } if (OutTrans.OutputReceiver.Count > 0) { //copying time of in trans OutTrans.Mode = 100; OutTrans.From = SmartcontractAddress; OutTrans.GenerateHash(); OutTrans.Time = Timestamp.UnixSecondsTimestamp; return(Maybe <Transaction> .Some(OutTrans)); } return(Maybe <Transaction> .None); }
private void SetOutTransaction(Expression exp) { //we get the value from args1 WITHOUT TYPE PREFIX!! string receiver = Register.GetFromRegister(exp.Args1).GetValueAs <string>(); //we get the value from args1 WITHOUT TYPE PrEFIX! int cash = Register.GetFromRegister(exp.Args2).GetValueAs <int>(); OutTrans.AddOutput(cash, receiver); }