tx · 3MAAMJYru4pbfhrNCTUkZAhGufHbofgEFJpqJVP5cGUi

3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3:  -0.01000000 Waves

2023.11.29 22:21 [2865113] smart account 3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3 > SELF 0.00000000 Waves

{ "type": 13, "id": "3MAAMJYru4pbfhrNCTUkZAhGufHbofgEFJpqJVP5cGUi", "fee": 1000000, "feeAssetId": null, "timestamp": 1701285698256, "version": 2, "chainId": 84, "sender": "3NAoJSThEgz12iLrRFSeMZpP1mEYc4QcGa3", "senderPublicKey": "5TXMdPyvDNfxhdixe86fk7Ya8FScpZGfZ6XNawu8sYK4", "proofs": [ "QCz24x9S8ccfYmvUbpPda7Y4xnKygdsSkFB1H8CTmkUCHy6hhFG8JLdtq27M2Fy58mafxZiw393iC63zGcajNiD" ], "script": "base64:BgIWCAISBwoFEREICAESAwoBCBIECgIIAQYAC0JBSV9BRERSRVNTAiMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAEVFlQRQIPY3Jhc2hFdmFsdWF0aW9uAAdCQUlfRkVFAICt4gQAEUFJX1RPS0VOX0FTU0VUX0lEASCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgELcmVtb3ZlTWFya3MBC21hcmtzU3RyaW5nBAFhCQCwAgIFC21hcmtzU3RyaW5nAAEEAWIJALMCAgUBYQABBQFiAQlwYXJzZUpzb24BBGpzb24EDG1vZGlmaWVkSnNvbgkAsAICBQRqc29uAAEEDW1vZGlmaWVkSnNvbjIJALMCAgUMbW9kaWZpZWRKc29uAAEEBnNwbGl0MQkAtQkCBQ1tb2RpZmllZEpzb24yAgEsBAlrZXlWYWx1ZTEJALUJAgkAkQMCBQZzcGxpdDEAAAIBOgQEa2V5MQkBC3JlbW92ZU1hcmtzAQkAkQMCBQlrZXlWYWx1ZTEAAAQGdmFsdWUxCQELcmVtb3ZlTWFya3MBCQCRAwIFCWtleV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zZXMgd2l0aCBldmFsdWF0ZWQgc3RhdHVzIGNhbiByZXF1ZXN0IGEgcGF5b3V0IQQQZWxpZ2libGVfYWRkcmVzcwQHJG1hdGNoMAkAoggBCQCsAgIFB2NyYXNoSWQCEV9pbm5vY2VudF9hZGRyZXNzAwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwIObm8gRGF0YSBleGlzdHMDCQAAAgUGc3RhdHVzAg5ubyBEYXRhIGV4aXN0cwkAAgECKlRoZXJlIGlzIG5vIGVsaWdpYmxlIHBlcnNvbiBmb3IgdGhpcyBjYXNlIQMJAQIhPQIFEGVsaWdpYmxlX2FkZHJlc3MFBnNlbmRlcgkAAgECKFlvdSBhcmUgbm90IGFsbG93ZWQgdG8gcmVxdWVzdCBhIHBheW91dCEJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICCQCsAgIFB2NyYXNoSWQCAV8FBnNlbmRlcgIFX2Nvc3QFBmFtb3VudAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFB2NyYXNoSWQCB19zdGF0dXMCBmNsb3NlZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQUGc2VuZGVyAIDC1y8FBHVuaXQFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXn6vSII", "height": 2865113, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4ypyKu4JKGe6iG5CDhLns9aRm54xWYtKYH6huCHuTVVz Next: 2mQu1Zd2j7zagJ7sL7S2gLTmTpoTfXAQvGWiFMtfg9h2 Diff:
OldNewDifferences
8181 if ((status == "no Data exists"))
8282 then throw("There is no status for this case!")
8383 else if ((status == "closed"))
84- then throw("A case should payed out twice!")
84+ then throw("A case should not be payed out twice!")
8585 else if ((status == "evaluated"))
8686 then throw("A case should not be evaluated twice!")
8787 else {
103103
104104
105105 @Callable(i)
106-func evaluatedData (prediction_id,per_one_address,per_two_address,guilty_person_address) = {
106+func requestPayout (crashId,amount) = {
107+ let sender = toString(i.caller)
107108 let txId = toBase58String(i.transactionId)
108-[StringEntry(prediction_id, txId), StringEntry((txId + "_guilty"), guilty_person_address)]
109+ let status = match getString((crashId + "_status")) {
110+ case s: String =>
111+ s
112+ case _ =>
113+ "no Data exists"
109114 }
110-
111-
112-
113-@Callable(i)
114-func requestPayout (pred_txId,amount,id) = {
115- let client = toString(i.caller)
116- let txId = toBase58String(i.transactionId)
117-[StringEntry((id + "_request_payout"), txId), IntegerEntry((txId + "_amount"), amount), StringEntry((txId + "_prediction_id"), pred_txId)]
115+ if ((status == "no Data exists"))
116+ then throw("There is no status for this case!")
117+ else if ((status != "evaluated"))
118+ then throw("Only cases with evaluated status can request a payout!")
119+ else {
120+ let eligible_address = match getString((crashId + "_innocent_address")) {
121+ case s: String =>
122+ s
123+ case _ =>
124+ "no Data exists"
125+ }
126+ if ((status == "no Data exists"))
127+ then throw("There is no eligible person for this case!")
128+ else if ((eligible_address != sender))
129+ then throw("You are not allowed to request a payout!")
130+ else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), 100000000, unit)]
131+ }
118132 }
119133
120134
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BAI_ADDRESS = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV"
55
66 let TYPE = "crashEvaluation"
77
88 let BAI_FEE = 10000000
99
1010 let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
1111
1212 func removeMarks (marksString) = {
1313 let a = drop(marksString, 1)
1414 let b = dropRight(a, 1)
1515 b
1616 }
1717
1818
1919 func parseJson (json) = {
2020 let modifiedJson = drop(json, 1)
2121 let modifiedJson2 = dropRight(modifiedJson, 1)
2222 let split1 = split(modifiedJson2, ",")
2323 let keyValue1 = split(split1[0], ":")
2424 let key1 = removeMarks(keyValue1[0])
2525 let value1 = removeMarks(keyValue1[1])
2626 let keyValue2 = split(split1[1], ":")
2727 let key2 = removeMarks(keyValue2[0])
2828 let value2 = removeMarks(keyValue2[1])
2929 let keyValue3 = split(split1[2], ":")
3030 let key3 = removeMarks(keyValue3[0])
3131 let value3 = removeMarks(keyValue3[1])
3232 $Tuple3([key1, value1], [key2, value2], [key3, value3])
3333 }
3434
3535
3636 @Callable(i)
3737 func registerData (clientInput,opponentInput,id,oppAddress,lgtCond) = {
3838 let searchForExistingData = match getString(id) {
3939 case s: String =>
4040 s
4141 case _ =>
4242 "no Data exists"
4343 }
4444 if ((searchForExistingData != "no Data exists"))
4545 then throw("There is already existing Data for this case!")
4646 else {
4747 let parameters = [id, TYPE, "evaluatedDataCallback"]
4848 let client = toString(i.caller)
4949 let txId = toBase58String(i.transactionId)
5050 let invokeTask = invoke(Address(fromBase58String(BAI_ADDRESS)), "registerTaskCallback", parameters, [AttachedPayment(AI_TOKEN_ASSET_ID, BAI_FEE)])
5151 if ((invokeTask != invokeTask))
5252 then throw("Strict value is not equal to itself.")
5353 else [StringEntry(id, txId), IntegerEntry((((id + "_") + client) + "_age"), clientInput[0]), IntegerEntry((((id + "_") + client) + "_sex"), clientInput[1]), IntegerEntry((((id + "_") + client) + "_damage"), clientInput[2]), IntegerEntry((((id + "_") + client) + "_fac1"), clientInput[3]), IntegerEntry((((id + "_") + client) + "_fac2"), clientInput[4]), IntegerEntry((((id + "_") + client) + "_fac3"), clientInput[5]), IntegerEntry((((id + "_") + client) + "_fac4"), clientInput[6]), IntegerEntry((((id + "_") + client) + "_vio1"), clientInput[7]), IntegerEntry((((id + "_") + client) + "_vio2"), clientInput[8]), IntegerEntry((((id + "_") + client) + "_vio3"), clientInput[9]), IntegerEntry((((id + "_") + client) + "_vio4"), clientInput[10]), IntegerEntry((((id + "_") + client) + "_cost"), clientInput[11]), IntegerEntry((((id + "_") + oppAddress) + "_age"), opponentInput[0]), IntegerEntry((((id + "_") + oppAddress) + "_sex"), opponentInput[1]), IntegerEntry((((id + "_") + oppAddress) + "_damage"), opponentInput[2]), IntegerEntry((((id + "_") + oppAddress) + "_fac1"), opponentInput[3]), IntegerEntry((((id + "_") + oppAddress) + "_fac2"), opponentInput[4]), IntegerEntry((((id + "_") + oppAddress) + "_fac3"), opponentInput[5]), IntegerEntry((((id + "_") + oppAddress) + "_fac4"), opponentInput[6]), IntegerEntry((((id + "_") + oppAddress) + "_vio1"), opponentInput[7]), IntegerEntry((((id + "_") + oppAddress) + "_vio2"), opponentInput[8]), IntegerEntry((((id + "_") + oppAddress) + "_vio3"), opponentInput[9]), IntegerEntry((((id + "_") + oppAddress) + "_vio4"), opponentInput[10]), IntegerEntry((((id + "_") + oppAddress) + "_cost"), opponentInput[11]), IntegerEntry((id + "_lgt"), lgtCond), StringEntry((id + "_status"), "open"), StringEntry((id + "_sender"), client)]
5454 }
5555 }
5656
5757
5858
5959 @Callable(i)
6060 func evaluatedDataCallback (response) = {
6161 let txId = toBase58String(i.transactionId)
6262 let parsedJson = parseJson(response)
6363 let crashId = parsedJson._1[1]
6464 let innocentAddress = parsedJson._2[1]
6565 let guiltyAddress = parsedJson._3[1]
6666 let RegisterTxId = match getString(crashId) {
6767 case s: String =>
6868 s
6969 case _ =>
7070 "no Data exists"
7171 }
7272 if ((RegisterTxId == "no Data exists"))
7373 then throw("There is no Data for this crashId!")
7474 else {
7575 let status = match getString((crashId + "_status")) {
7676 case s: String =>
7777 s
7878 case _ =>
7979 "no Data exists"
8080 }
8181 if ((status == "no Data exists"))
8282 then throw("There is no status for this case!")
8383 else if ((status == "closed"))
84- then throw("A case should payed out twice!")
84+ then throw("A case should not be payed out twice!")
8585 else if ((status == "evaluated"))
8686 then throw("A case should not be evaluated twice!")
8787 else {
8888 let costEstimationOfInnocentPerson = match getInteger((((crashId + "_") + innocentAddress) + "_cost")) {
8989 case s: Int =>
9090 s
9191 case _ =>
9292 "No data Found"
9393 }
9494 if ((costEstimationOfInnocentPerson == "No data Found"))
9595 then throw("There is no cost data for this address!")
9696 else if ((costEstimationOfInnocentPerson == -1))
9797 then [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "evaluated")]
9898 else [StringEntry((crashId + "_eval"), txId), StringEntry((crashId + "_innocent_address"), innocentAddress), StringEntry((crashId + "_guilty_address"), guiltyAddress), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(innocentAddress)), 100000000, unit)]
9999 }
100100 }
101101 }
102102
103103
104104
105105 @Callable(i)
106-func evaluatedData (prediction_id,per_one_address,per_two_address,guilty_person_address) = {
106+func requestPayout (crashId,amount) = {
107+ let sender = toString(i.caller)
107108 let txId = toBase58String(i.transactionId)
108-[StringEntry(prediction_id, txId), StringEntry((txId + "_guilty"), guilty_person_address)]
109+ let status = match getString((crashId + "_status")) {
110+ case s: String =>
111+ s
112+ case _ =>
113+ "no Data exists"
109114 }
110-
111-
112-
113-@Callable(i)
114-func requestPayout (pred_txId,amount,id) = {
115- let client = toString(i.caller)
116- let txId = toBase58String(i.transactionId)
117-[StringEntry((id + "_request_payout"), txId), IntegerEntry((txId + "_amount"), amount), StringEntry((txId + "_prediction_id"), pred_txId)]
115+ if ((status == "no Data exists"))
116+ then throw("There is no status for this case!")
117+ else if ((status != "evaluated"))
118+ then throw("Only cases with evaluated status can request a payout!")
119+ else {
120+ let eligible_address = match getString((crashId + "_innocent_address")) {
121+ case s: String =>
122+ s
123+ case _ =>
124+ "no Data exists"
125+ }
126+ if ((status == "no Data exists"))
127+ then throw("There is no eligible person for this case!")
128+ else if ((eligible_address != sender))
129+ then throw("You are not allowed to request a payout!")
130+ else [IntegerEntry((((crashId + "_") + sender) + "_cost"), amount), StringEntry((crashId + "_status"), "closed"), ScriptTransfer(Address(fromBase58String(sender)), 100000000, unit)]
131+ }
118132 }
119133
120134
121135 @Verifier(tx)
122136 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
123137

github/deemru/w8io/026f985 
48.25 ms