def RunTimeTest(user): Log("11111111") res = CheckWitness(user) Log(res) Notify("Hi BlockChain") Notify("s1", "s2", 1, 2, 3) Log("log message")
def Main(operation, args): # Here you can define the method name "checkName" to anything you want if operation == "checkName": return checkName() # Here you can define the method name "checkBalanceOf" to anything you want if operation == "checkBalanceOf": if len(args) == 1: account = args[0] return checkBalanceOf(account) else: return False if operation == "checkSelfBalance": return checkSelfBalance() if operation == "checkTransfer": if len(args) != 3: Log("len(args)!=3 ") return False else: fromAcct = args[0] toAcct = args[1] tokenAmount = args[2] return checkTransfer(fromAcct, toAcct, tokenAmount) if operation == "sendOEP4TokenFromContractTo": if len(args) == 2: toAcct = args[0] tokenAmount = args[1] return sendOEP4TokenFromContractTo(toAcct, tokenAmount) else: return False return False
def Main(operation, args): Notify(GetTime()) user = bytearray([ 248, 142, 51, 220, 214, 177, 110, 235, 27, 218, 59, 86, 23, 47, 140, 20, 114, 119, 159, 152 ]) CheckWitness(user) Notify("Hi BlockChain") Notify("s1", "s2", 1, 2, 3) Log("log message")
def Main(operation, args): if operation == "CallNep5Contract": Log("1111111111") if len(args) != 4: return False from_acct = args[0] to_acct = args[1] value = args[2] hash_a = args[3] return CallNep5Contract(from_acct, to_acct, value, hash_a)
def Main(operation, args): if operation == "transfer": if len(args) != 3: Log("len(args)!=3 ") return False return CallNep5Contract("transfer", args) # Here you can define the method name "Name" to anything you want if operation == "Name": # This "name" below should be consistent with your OEP4Contract methods return OEP4Contract("name", 0) # Here you can define the method name "BalanceOf" to anything you want if operation == "BalanceOf": # This "balanceOf" below should be consistent with your OEP4Contract methods return OEP4Contract("balanceOf", args)
def Hello(msg): Log(msg) return True
def CallNep5Contract(from_acct, to_acct, value, contractHash): Log("222222222") res = YouLeContract("transfer", from_acct, to_acct, value) if res != "\x01": raise Exception() return True
def get(): b = Get(ctx, 'test') a = Deserialize(b) Log(a['a']) Notify(a['b'])