tx · E1wS6nSTx4FKYUCbv3JNMwYumLTuNcgLWbm6nr4HwkMo 3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ: -0.01400000 Waves 2022.05.17 13:00 [2055516] smart account 3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ > SELF 0.00000000 Waves
{ "type": 13, "id": "E1wS6nSTx4FKYUCbv3JNMwYumLTuNcgLWbm6nr4HwkMo", "fee": 1400000, "feeAssetId": null, "timestamp": 1652781776435, "version": 2, "chainId": 84, "sender": "3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ", "senderPublicKey": "ApEZSyUFWsckB3mZSWm3spfm6UPyDhMdrpxNhydohYs1", "proofs": [ "2cdEhohXnK8GVuA9QbRxJ6Kg1D7qGhyaqnsu2WPz5YJmxkmB9Ug77z9wRd4BDPAYAgRV6bbS8bdxroFgRzVcsVV8" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAFwAAAAAJc2VwYXJhdG9yAgAAAAFfAAAAAA1rZXlDaGFyc0NvdW50AgAAAAtjaGFyc19jb3VudAAAAAAIa2V5T3duZXICAAAABW93bmVyAAAAAA1rZXlBcHBlYXJhbmNlAgAAAAphcHBlYXJhbmNlAAAAAAxrZXlQeXJvQm9udXMCAAAACnB5cm9fYm9udXMAAAAADGtleUFxdWFCb251cwIAAAAKYXF1YV9ib251cwAAAAANa2V5VGVycmFCb251cwIAAAALdGVycmFfYm9udXMAAAAADGtleUFlcm9Cb251cwIAAAAKYWVyb19ib251cwAAAAANa2V5TG9vdHNCb251cwIAAAALbG9vdHNfYm9udXMAAAAAEmtleUdlbmVyYXRpbmdCb251cwIAAAAQZ2VuZXJhdGluZ19ib251cwAAAAAHZ292QWRkcgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM015eGZ3dmJ1ZVVCeW5ZSGZRc3V0TlhaTnFOb3pHaU1uc0cAAAAAFWtleUVjb3N5c3RlbUFkZHJlc3NlcwIAAAATZWNvc3lzdGVt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0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnk5q6N", "height": 2055516, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 77DuniQNft7TNSU2eHHgSWkYjWNYf2iSN789WS5kpaMG Next: 4v2sTWWE6eWicKiGtzK46j5qao16bktZKRgrVPYToURs Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | 6 | let keyCharsCount = "chars_count" | |
7 | - | ||
8 | - | let keyChar = "char" | |
9 | 7 | ||
10 | 8 | let keyOwner = "owner" | |
11 | 9 | ||
57 | 55 | } | |
58 | 56 | ||
59 | 57 | ||
60 | - | func | |
58 | + | func with (a,b) = ((toString(b) + separator) + a) | |
61 | 59 | ||
62 | 60 | ||
63 | 61 | func getRandomBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
121 | 119 | let aeroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 24, txId) | |
122 | 120 | let generatingBonus = getRandomBonus(statsTiersRanges, generatingBonusRanges, 31, txId) | |
123 | 121 | let lootsBonus = getRandomBonus(statsTiersRanges, lootsBonusRanges, 38, txId) | |
124 | - | [StringEntry( | |
122 | + | [StringEntry(with(keyOwner, charId), callerAddr), StringEntry(with(keyAppearance, charId), appearance), IntegerEntry(with(keyPyroBonus, charId), pyroBonus), IntegerEntry(with(keyAquaBonus, charId), aquaBonus), IntegerEntry(with(keyTerraBonus, charId), terraBonus), IntegerEntry(with(keyAeroBonus, charId), aeroBonus), IntegerEntry(with(keyLootsBonus, charId), lootsBonus), IntegerEntry(with(keyGeneratingBonus, charId), generatingBonus), IntegerEntry(keyCharsCount, (charId + 1))] | |
125 | 123 | }) | |
126 | 124 | ||
127 | 125 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | 6 | let keyCharsCount = "chars_count" | |
7 | - | ||
8 | - | let keyChar = "char" | |
9 | 7 | ||
10 | 8 | let keyOwner = "owner" | |
11 | 9 | ||
12 | 10 | let keyAppearance = "appearance" | |
13 | 11 | ||
14 | 12 | let keyPyroBonus = "pyro_bonus" | |
15 | 13 | ||
16 | 14 | let keyAquaBonus = "aqua_bonus" | |
17 | 15 | ||
18 | 16 | let keyTerraBonus = "terra_bonus" | |
19 | 17 | ||
20 | 18 | let keyAeroBonus = "aero_bonus" | |
21 | 19 | ||
22 | 20 | let keyLootsBonus = "loots_bonus" | |
23 | 21 | ||
24 | 22 | let keyGeneratingBonus = "generating_bonus" | |
25 | 23 | ||
26 | 24 | let govAddr = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
27 | 25 | ||
28 | 26 | let keyEcosystemAddresses = "ecosystem_addresses" | |
29 | 27 | ||
30 | 28 | let keyCharsBodiesAmount = "chars_bodies_amount" | |
31 | 29 | ||
32 | 30 | let keyCharsEyesAmount = "chars_eyes_amount" | |
33 | 31 | ||
34 | 32 | let keyCharsMouthsAmount = "chars_mouths_amount" | |
35 | 33 | ||
36 | 34 | let keyCharsStatsTiersRanges = "chars_stats_tiers_ranges" | |
37 | 35 | ||
38 | 36 | let keyCharsNaturalElemBonusRanges = "chars_natural_elem_bonus_ranges" | |
39 | 37 | ||
40 | 38 | let keyCharsNaturalLootsBonusRanges = "chars_natural_loots_bonus_ranges" | |
41 | 39 | ||
42 | 40 | let keyCharsNaturalGeneratingBonusRanges = "chars_natural_generating_bonus_ranges" | |
43 | 41 | ||
44 | 42 | func invokChecks (callerAddr) = if ((isDataStorageUntouched(govAddr) != false)) | |
45 | 43 | then throw("Governing app not ready") | |
46 | 44 | else { | |
47 | 45 | let ecosystemAddresses = getStringValue(govAddr, keyEcosystemAddresses) | |
48 | 46 | if ((contains(ecosystemAddresses, toString(callerAddr)) != false)) | |
49 | 47 | then throw("Access denied") | |
50 | 48 | else unit | |
51 | 49 | } | |
52 | 50 | ||
53 | 51 | ||
54 | 52 | func randInt (min,max,txId,nonce) = { | |
55 | 53 | let hash = value(sha256_16Kb(((value(value(blockInfoByHeight(height)).vrf) + txId) + toBytes(nonce)))) | |
56 | 54 | value(((value(toInt(hash)) % ((max - min) + 1)) + min)) | |
57 | 55 | } | |
58 | 56 | ||
59 | 57 | ||
60 | - | func | |
58 | + | func with (a,b) = ((toString(b) + separator) + a) | |
61 | 59 | ||
62 | 60 | ||
63 | 61 | func getRandomBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
64 | 62 | let sT1 = parseIntValue(statsTierRanges[0]) | |
65 | 63 | let sT2 = parseIntValue(statsTierRanges[1]) | |
66 | 64 | let sT3 = parseIntValue(statsTierRanges[2]) | |
67 | 65 | let sT4 = parseIntValue(statsTierRanges[3]) | |
68 | 66 | let sT5 = parseIntValue(statsTierRanges[4]) | |
69 | 67 | let sT6 = parseIntValue(statsTierRanges[5]) | |
70 | 68 | let bT1 = parseIntValue(bonusRanges[0]) | |
71 | 69 | let bT2 = parseIntValue(bonusRanges[1]) | |
72 | 70 | let bT3 = parseIntValue(bonusRanges[2]) | |
73 | 71 | let bT4 = parseIntValue(bonusRanges[3]) | |
74 | 72 | let bT5 = parseIntValue(bonusRanges[4]) | |
75 | 73 | let bT6 = parseIntValue(bonusRanges[5]) | |
76 | 74 | let tierResult = randInt(0, 10000, txId, startingNonce) | |
77 | 75 | if (if ((tierResult >= 0)) | |
78 | 76 | then (sT1 >= tierResult) | |
79 | 77 | else false) | |
80 | 78 | then randInt(0, bT1, txId, (startingNonce + 1)) | |
81 | 79 | else if (if ((tierResult > sT1)) | |
82 | 80 | then (sT2 >= tierResult) | |
83 | 81 | else false) | |
84 | 82 | then randInt((bT1 + 1), bT2, txId, (startingNonce + 2)) | |
85 | 83 | else if (if ((tierResult > sT2)) | |
86 | 84 | then (sT3 >= tierResult) | |
87 | 85 | else false) | |
88 | 86 | then randInt((bT2 + 1), bT3, txId, (startingNonce + 3)) | |
89 | 87 | else if (if ((tierResult > sT3)) | |
90 | 88 | then (sT4 >= tierResult) | |
91 | 89 | else false) | |
92 | 90 | then randInt((bT3 + 1), bT4, txId, (startingNonce + 4)) | |
93 | 91 | else if (if ((tierResult > sT4)) | |
94 | 92 | then (sT5 >= tierResult) | |
95 | 93 | else false) | |
96 | 94 | then randInt((bT4 + 1), bT5, txId, (startingNonce + 5)) | |
97 | 95 | else if (if ((tierResult > sT5)) | |
98 | 96 | then (sT6 >= tierResult) | |
99 | 97 | else false) | |
100 | 98 | then randInt((bT5 + 1), bT6, txId, (startingNonce + 6)) | |
101 | 99 | else throw("Unexpected error") | |
102 | 100 | } | |
103 | 101 | ||
104 | 102 | ||
105 | 103 | @Callable(i) | |
106 | 104 | func createChar () = valueOrElse(invokChecks(i.caller), { | |
107 | 105 | let txId = i.transactionId | |
108 | 106 | let callerAddr = toBase58String(i.caller.bytes) | |
109 | 107 | let charId = valueOrElse(getInteger(this, keyCharsCount), 1) | |
110 | 108 | let bodiesAmount = getIntegerValue(govAddr, keyCharsBodiesAmount) | |
111 | 109 | let eyesAmount = getIntegerValue(govAddr, keyCharsEyesAmount) | |
112 | 110 | let mouthsAmount = getIntegerValue(govAddr, keyCharsMouthsAmount) | |
113 | 111 | let statsTiersRanges = split(getStringValue(govAddr, keyCharsStatsTiersRanges), separator) | |
114 | 112 | let elemBonusRanges = split(getStringValue(govAddr, keyCharsNaturalElemBonusRanges), separator) | |
115 | 113 | let lootsBonusRanges = split(getStringValue(govAddr, keyCharsNaturalLootsBonusRanges), separator) | |
116 | 114 | let generatingBonusRanges = split(getStringValue(govAddr, keyCharsNaturalGeneratingBonusRanges), separator) | |
117 | 115 | let appearance = makeString([toString(randInt(1, bodiesAmount, txId, 0)), toString(randInt(1, eyesAmount, txId, 1)), toString(randInt(1, mouthsAmount, txId, 2))], separator) | |
118 | 116 | let pyroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 3, txId) | |
119 | 117 | let aquaBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 10, txId) | |
120 | 118 | let terraBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 17, txId) | |
121 | 119 | let aeroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 24, txId) | |
122 | 120 | let generatingBonus = getRandomBonus(statsTiersRanges, generatingBonusRanges, 31, txId) | |
123 | 121 | let lootsBonus = getRandomBonus(statsTiersRanges, lootsBonusRanges, 38, txId) | |
124 | - | [StringEntry( | |
122 | + | [StringEntry(with(keyOwner, charId), callerAddr), StringEntry(with(keyAppearance, charId), appearance), IntegerEntry(with(keyPyroBonus, charId), pyroBonus), IntegerEntry(with(keyAquaBonus, charId), aquaBonus), IntegerEntry(with(keyTerraBonus, charId), terraBonus), IntegerEntry(with(keyAeroBonus, charId), aeroBonus), IntegerEntry(with(keyLootsBonus, charId), lootsBonus), IntegerEntry(with(keyGeneratingBonus, charId), generatingBonus), IntegerEntry(keyCharsCount, (charId + 1))] | |
125 | 123 | }) | |
126 | 124 | ||
127 | 125 | ||
128 | 126 | @Verifier(tx) | |
129 | 127 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
130 | 128 |
github/deemru/w8io/169f3d6 31.75 ms ◑