tx · JE3n4hdNK4yo2vwwzeGzmMSAZAsNDugyqsAuR35cq4y1

3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK:  -0.04000000 Waves

2020.10.30 01:38 [1242542] smart account 3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK > SELF 0.00000000 Waves

{ "type": 13, "id": "JE3n4hdNK4yo2vwwzeGzmMSAZAsNDugyqsAuR35cq4y1", "fee": 4000000, "feeAssetId": null, "timestamp": 1604011139823, "version": 2, "chainId": 84, "sender": "3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK", "senderPublicKey": "BN5UNNa95ZrPJ8JGf9eweh6CLRZ618MuRsvqmxPX1yTR", "proofs": [ "sbHsm8Pq9Uy2weqB563E82oXKfHQ7DFdEPWqB9S1bgjwCuPymKTfjBEcNbSQXK43ZQsFqNS2NoFqpjjUGr1GMuv" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAADAQAAAAdpc093bmVyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN2YWwBAAAAD2dldEludGVnZXJCeUtleQAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAAAAAIAAAABaQEAAAAJYWRkQW5zd2VyAAAAAQAAAAZBbnN3ZXIDCQEAAAABIQAAAAEJAQAAAAdpc093bmVyAAAAAQgFAAAAA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JAQAAAAlEYXRhRW50cnkAAAACAgAAAA5jb3JyZWN0X2Fuc3dlcgUAAAAFR3Vlc3MJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABndpbm5lcgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAAloAAAABCQABmwAAAAEFAAAABUd1ZXNzAgAAAAdfcmV3YXJkAAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZyZXdhcmQFAAAABHVuaXQFAAAAA25pbAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMd3JvbmdfZ3Vlc3NfCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgIAAAABXwkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAAVHdWVzcwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAQc3RhbmRhcmRWZXJpZmllcgAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5XaHHlA==", "height": 1242542, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EWhxDghjf4nub9VR5wui8HgjXU49HmxQw9uYPpveuS4h Next: none Diff:
OldNewDifferences
3939
4040
4141 @Callable(i)
42-func guessAnswer (Guess) = if ((getStringByKey("hash_answer") == toBase64String(toBytes(Guess))))
43- then {
44- let reward = getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward"))
45- ScriptResult(WriteSet([DataEntry("correct_answer", Guess), DataEntry("winner", toString(i.caller)), DataEntry((toBase64String(toBytes(Guess)) + "_reward"), 0)]), TransferSet([ScriptTransfer(i.caller, reward, unit)]))
46- }
47- else WriteSet([DataEntry(((("wrong_guess_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)), Guess)])
42+func guessAnswer (Guess) = if ((getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward")) == 0))
43+ then throw("sorry, game over")
44+ else if ((getStringByKey("hash_answer") == toBase64String(toBytes(Guess))))
45+ then {
46+ let reward = getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward"))
47+ ScriptResult(WriteSet([DataEntry("correct_answer", Guess), DataEntry("winner", toString(i.caller)), DataEntry((toBase64String(toBytes(Guess)) + "_reward"), 0)]), TransferSet([ScriptTransfer(i.caller, reward, unit)]))
48+ }
49+ else WriteSet([DataEntry(((("wrong_guess_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)), Guess)])
4850
51+
52+@Verifier(tx)
53+func standardVerifier () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
4954
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func isOwner (address) = (address == this)
55
66
77 func getStringByKey (key) = {
88 let val = match getString(this, key) {
99 case b: String =>
1010 b
1111 case _ =>
1212 ""
1313 }
1414 val
1515 }
1616
1717
1818 func getIntegerByKey (key) = {
1919 let val = match getInteger(this, key) {
2020 case b: Int =>
2121 b
2222 case _ =>
2323 0
2424 }
2525 val
2626 }
2727
2828
2929 @Callable(i)
3030 func addAnswer (Answer) = if (!(isOwner(i.caller)))
3131 then throw("access only by the contract owner")
3232 else if ((getIntegerByKey((Answer + "_reward")) != 0))
3333 then throw("the contest is already taken")
3434 else {
3535 let reward = extract(i.payment).amount
3636 WriteSet([DataEntry("hash_answer", Answer), DataEntry((Answer + "_reward"), reward), DataEntry("created_height", height)])
3737 }
3838
3939
4040
4141 @Callable(i)
42-func guessAnswer (Guess) = if ((getStringByKey("hash_answer") == toBase64String(toBytes(Guess))))
43- then {
44- let reward = getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward"))
45- ScriptResult(WriteSet([DataEntry("correct_answer", Guess), DataEntry("winner", toString(i.caller)), DataEntry((toBase64String(toBytes(Guess)) + "_reward"), 0)]), TransferSet([ScriptTransfer(i.caller, reward, unit)]))
46- }
47- else WriteSet([DataEntry(((("wrong_guess_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)), Guess)])
42+func guessAnswer (Guess) = if ((getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward")) == 0))
43+ then throw("sorry, game over")
44+ else if ((getStringByKey("hash_answer") == toBase64String(toBytes(Guess))))
45+ then {
46+ let reward = getIntegerByKey((toBase64String(toBytes(Guess)) + "_reward"))
47+ ScriptResult(WriteSet([DataEntry("correct_answer", Guess), DataEntry("winner", toString(i.caller)), DataEntry((toBase64String(toBytes(Guess)) + "_reward"), 0)]), TransferSet([ScriptTransfer(i.caller, reward, unit)]))
48+ }
49+ else WriteSet([DataEntry(((("wrong_guess_" + toString(i.caller)) + "_") + toBase58String(i.transactionId)), Guess)])
4850
51+
52+@Verifier(tx)
53+func standardVerifier () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
4954

github/deemru/w8io/026f985 
29.61 ms