tx · EVLfLcJMdRPW2dhVS3xF27Dej8Zqvym9N37pUcU6iRiw 3N3HtdnBkqSSc16DaydiwtrMBUv3DfqKjSW: -0.01400000 Waves 2021.11.22 15:19 [1802231] smart account 3N3HtdnBkqSSc16DaydiwtrMBUv3DfqKjSW > SELF 0.00000000 Waves
{ "type": 13, "id": "EVLfLcJMdRPW2dhVS3xF27Dej8Zqvym9N37pUcU6iRiw", "fee": 1400000, "feeAssetId": null, "timestamp": 1637583607964, "version": 2, "chainId": 84, "sender": "3N3HtdnBkqSSc16DaydiwtrMBUv3DfqKjSW", "senderPublicKey": "Aw1UftaEn1LLmCdG6VwWAuVtaSpcmPw18uZ4x2mvd9Wr", "proofs": [ "5wBdGbowmr57jeahXGejFRPwH66Rmy7vkYjZgec9Z2Y8LZ8ZpDsMvH8bU1f7hTyt69HdhJ7tz7ThYN9xCtoFkFgg", "5dZRRGUu5oGPGFb9DQy7xx3rjfmdAowVQCLzUMZBYgsv4KSZr2HJZYq5ktXQzZMWp5ekdu2vt53ot8QE3Snm1J3P" ], "script": "base64:AAIFAAAAAAAAAA4IAhIECgIIARIECgIRGAAAAA0AAAAAEGtleUFjaGlldmVtZW50SWQCAAAAA2lkXwAAAAAGb3JhY2xlCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU6UWqHpAvOq7xug7mLpqSXxqYhOHzYrMIAAAAAA9rZXlBZG1pblB1YktleTECAAAAC2FkbWluX3B1Yl8xAAAAAA9rZXlBZG1pblB1YktleTICAAAAC2FkbWluX3B1Yl8yAAAAAA9rZXlBZG1pblB1YktleTMCAAAAC2FkbWluX3B1Yl8zAQAAAAtnZXRBZG1pblB1YgAAAAEAAAALa2V5QWRtaW5QdWIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAGb3JhY2xlBQAAAAtrZXlBZG1pblB1YgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAZzdHJpbmcFAAAAByRtYXRjaDAJAAJZAAAAAQUAAAAG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vZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAABJhZG1pblB1YktleVN0YWtpbmcEAAAAByRtYXRjaDAFAAAAAnR4BQAAABNtdWx0aVNpZ25lZEJ5QWRtaW5zsq0YYQ==", "height": 1802231, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9w66HneWdEhJBYUc3pmgP4yfjuejFtCfpTr9a3TLJvkZ Next: HdzT1Ntx7ce7hPVkHmBgwcpm4yZBL1kt6NzmdNC2HXWk Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | ||
42 | 42 | ||
43 | 43 | @Callable(i) | |
44 | - | func add (achievementId,amount) = if (!(containsElement(achievementsWriters, toString(this)))) | |
45 | - | then throw("Only achievment writer can call this function") | |
46 | - | else if (!(isDefined(getInteger(this, (keyAchievementId + achievementId))))) | |
47 | - | then throw("Unknown achievement id") | |
48 | - | else { | |
49 | - | let userAddress = toString(i.originCaller) | |
50 | - | let amountOld = valueOrElse(getInteger(this, ((userAddress + "_") + achievementId)), 0) | |
44 | + | func add (achievementId,amount) = { | |
45 | + | let debugKeyId = (keyAchievementId + achievementId) | |
46 | + | if (!(containsElement(achievementsWriters, toString(this)))) | |
47 | + | then throw("Only achievment writer can call this function") | |
48 | + | else if (!(isDefined(getInteger(this, debugKeyId)))) | |
49 | + | then throw("Unknown achievement id") | |
50 | + | else { | |
51 | + | let userAddress = toString(i.originCaller) | |
52 | + | let amountOld = valueOrElse(getInteger(this, ((userAddress + "_") + achievementId)), 0) | |
51 | 53 | [IntegerEntry(((userAddress + "_") + achievementId), (amountOld + amount))] | |
52 | - | } | |
54 | + | } | |
55 | + | } | |
53 | 56 | ||
54 | 57 | ||
55 | 58 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyAchievementId = "id_" | |
5 | 5 | ||
6 | 6 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
7 | 7 | ||
8 | 8 | let keyAdminPubKey1 = "admin_pub_1" | |
9 | 9 | ||
10 | 10 | let keyAdminPubKey2 = "admin_pub_2" | |
11 | 11 | ||
12 | 12 | let keyAdminPubKey3 = "admin_pub_3" | |
13 | 13 | ||
14 | 14 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
15 | 15 | case string: String => | |
16 | 16 | fromBase58String(string) | |
17 | 17 | case nothing => | |
18 | 18 | throw("Admin public key is empty") | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
23 | 23 | ||
24 | 24 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
25 | 25 | ||
26 | 26 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
27 | 27 | ||
28 | 28 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
29 | 29 | ||
30 | 30 | let keyAchievementsWriters = "achievements_writers" | |
31 | 31 | ||
32 | 32 | let achievementsWriters = split(valueOrElse(getString(oracle, keyAchievementsWriters), ""), ",") | |
33 | 33 | ||
34 | 34 | func zipNext (acc,list2Element) = { | |
35 | 35 | let $t0922950 = acc | |
36 | 36 | let list1 = $t0922950._1 | |
37 | 37 | let i = $t0922950._2 | |
38 | 38 | let result = $t0922950._3 | |
39 | 39 | $Tuple3(list1, (i + 1), (result :+ StringEntry((keyAchievementId + toString(list1[i])), list2Element))) | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | @Callable(i) | |
44 | - | func add (achievementId,amount) = if (!(containsElement(achievementsWriters, toString(this)))) | |
45 | - | then throw("Only achievment writer can call this function") | |
46 | - | else if (!(isDefined(getInteger(this, (keyAchievementId + achievementId))))) | |
47 | - | then throw("Unknown achievement id") | |
48 | - | else { | |
49 | - | let userAddress = toString(i.originCaller) | |
50 | - | let amountOld = valueOrElse(getInteger(this, ((userAddress + "_") + achievementId)), 0) | |
44 | + | func add (achievementId,amount) = { | |
45 | + | let debugKeyId = (keyAchievementId + achievementId) | |
46 | + | if (!(containsElement(achievementsWriters, toString(this)))) | |
47 | + | then throw("Only achievment writer can call this function") | |
48 | + | else if (!(isDefined(getInteger(this, debugKeyId)))) | |
49 | + | then throw("Unknown achievement id") | |
50 | + | else { | |
51 | + | let userAddress = toString(i.originCaller) | |
52 | + | let amountOld = valueOrElse(getInteger(this, ((userAddress + "_") + achievementId)), 0) | |
51 | 53 | [IntegerEntry(((userAddress + "_") + achievementId), (amountOld + amount))] | |
52 | - | } | |
54 | + | } | |
55 | + | } | |
53 | 56 | ||
54 | 57 | ||
55 | 58 | ||
56 | 59 | @Callable(i) | |
57 | 60 | func addAchievements (achievementIds,achievementNames) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
58 | 61 | then throw("Only admin can call this function") | |
59 | 62 | else { | |
60 | 63 | let achievementsEtries = { | |
61 | 64 | let $l = achievementNames | |
62 | 65 | let $s = size($l) | |
63 | 66 | let $acc0 = $Tuple3(achievementIds, 0, nil) | |
64 | 67 | func 1 ($a,$i) = if (($i >= $s)) | |
65 | 68 | then $a | |
66 | 69 | else zipNext($a, $l[$i]) | |
67 | 70 | ||
68 | 71 | func 2 ($a,$i) = if (($i >= $s)) | |
69 | 72 | then $a | |
70 | 73 | else throw("List size exceeds 20") | |
71 | 74 | ||
72 | 75 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
73 | 76 | } | |
74 | 77 | achievementsEtries._3 | |
75 | 78 | } | |
76 | 79 | ||
77 | 80 | ||
78 | 81 | @Verifier(tx) | |
79 | 82 | func verify () = { | |
80 | 83 | let multiSignedByAdmins = { | |
81 | 84 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
82 | 85 | then 1 | |
83 | 86 | else 0 | |
84 | 87 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
85 | 88 | then 1 | |
86 | 89 | else 0 | |
87 | 90 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
88 | 91 | then 1 | |
89 | 92 | else 0 | |
90 | 93 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
91 | 94 | } | |
92 | 95 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
93 | 96 | then true | |
94 | 97 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
95 | 98 | then true | |
96 | 99 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
97 | 100 | then true | |
98 | 101 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
99 | 102 | match tx { | |
100 | 103 | case _ => | |
101 | 104 | multiSignedByAdmins | |
102 | 105 | } | |
103 | 106 | } | |
104 | 107 |
github/deemru/w8io/026f985 48.17 ms ◑