tx · CBLGmKDEuaUThq4xRyCPStvWic93WBTsHUam5fQ87E8R
3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK: -0.04000000 Waves
2020.10.29 20:38 [1242247] smart account 3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK > SELF 0.00000000 Waves
{
"type": 13,
"id": "CBLGmKDEuaUThq4xRyCPStvWic93WBTsHUam5fQ87E8R",
"fee": 4000000,
"feeAssetId": null,
"timestamp": 1603993143111,
"version": 2,
"chainId": 84,
"sender": "3NBYuiC6eFv2jT8DptUfiMDTbhXgFvn7NcK",
"senderPublicKey": "BN5UNNa95ZrPJ8JGf9eweh6CLRZ618MuRsvqmxPX1yTR",
"proofs": [
"pRHFDNq2PkbU73k8heNpCyHN77w5r7hLg8rA4pYn7WnoRct1r7TU6YqhU2KBCi8pktWLXyAAUTDGSzrU7dgEJCh"
],
"script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAAgEAAAAHaXNPd25lcgAAAAEAAAAHYWRkcmVzcwkAAAAAAAACBQAAAAdhZGRyZXNzBQAAAAR0aGlzAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzBQAAAANrZXkAAAABAAAAAWkBAAAACWFkZEFuc3dlcgAAAAEAAAAGQW5zd2VyAwkBAAAAASEAAAABCQEAAAAHaXNPd25lcgAAAAEIBQAAAAFpAAAABmNhbGxlcgkAAAIAAAABAgAAACFhY2Nlc3Mgb25seSBieSB0aGUgY29udHJhY3Qgb3duZXIDCQEAAAACIT0AAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAtoYXNoX2F3bnNlcgUAAAAGQW5zd2VyCQAAAgAAAAECAAAAHHRoZSBjb250ZXN0IGlzIGFscmVhZHkgdGFrZW4EAAAABnJld2FyZAgJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAAC2hhc2hfYW5zd2VyBQAAAAZBbnN3ZXIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAACWFuc3dlcl9pZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAZBbnN3ZXICAAAAAV8JAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAIAAAAHX3Jld2FyZAUAAAAGcmV3YXJkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAA5jcmVhdGVkX2hlaWdodAUAAAAGaGVpZ2h0BQAAAANuaWwAAAAAB474wQ==",
"height": 1242247,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7bkFHfHc94MT8Lfn5QTdd9oWUFPGauDaEmGiLzYyw65S
Next: BNpjA1nDi9Bzh4YTfwUE1TRNNfCRQm6TxS5EggCwvxkk
Full:
Old | New | | Differences |
---|
1 | | - | {-# STDLIB_VERSION 4 #-} |
---|
| 1 | + | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func isOwner (address) = (address == this) |
---|
5 | 5 | | |
---|
6 | 6 | | |
---|
7 | | - | func getStringByKey (key) = valueOrElse(getString(this, key), "") |
---|
| 7 | + | func getStringByKey (key) = getStringValue(this, key) |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | @Callable(i) |
---|
11 | | - | func addAnswer (Answer) = { |
---|
12 | | - | let getHashAnswer = getStringByKey("hash-answer") |
---|
13 | | - | if (!(isOwner(i.caller))) |
---|
14 | | - | then throw("access only by the contract owner") |
---|
| 11 | + | func addAnswer (Answer) = if (!(isOwner(i.caller))) |
---|
| 12 | + | then throw("access only by the contract owner") |
---|
| 13 | + | else if ((getStringValue(this, "hash_awnser") != Answer)) |
---|
| 14 | + | then throw("the contest is already taken") |
---|
15 | 15 | | else { |
---|
16 | | - | let hashAnswer = Answer |
---|
17 | | - | let reward = value(i.payments[0]) |
---|
18 | | - | [StringEntry("hash-answer", hashAnswer), StringEntry("answer_id", toBase58String(i.transactionId)), IntegerEntry((((hashAnswer + "_") + toBase58String(i.transactionId)) + "_reward"), reward.amount), IntegerEntry("created_height", height)] |
---|
| 16 | + | let reward = extract(i.payment).amount |
---|
| 17 | + | WriteSet([DataEntry("hash_answer", Answer), DataEntry("answer_id", toBase58String(i.transactionId)), DataEntry((((Answer + "_") + toBase58String(i.transactionId)) + "_reward"), reward), DataEntry("created_height", height)]) |
---|
19 | 18 | | } |
---|
20 | | - | } |
---|
21 | 19 | | |
---|
22 | | - | |
---|
23 | | - | @Verifier(tx) |
---|
24 | | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
25 | 20 | | |
---|