tx · 4v2sTWWE6eWicKiGtzK46j5qao16bktZKRgrVPYToURs 3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ: -0.01400000 Waves 2022.05.18 12:47 [2056937] smart account 3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ > SELF 0.00000000 Waves
{ "type": 13, "id": "4v2sTWWE6eWicKiGtzK46j5qao16bktZKRgrVPYToURs", "fee": 1400000, "feeAssetId": null, "timestamp": 1652867264255, "version": 2, "chainId": 84, "sender": "3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ", "senderPublicKey": "ApEZSyUFWsckB3mZSWm3spfm6UPyDhMdrpxNhydohYs1", "proofs": [ "BSqUw9Hye8rno8F2j6D1zbgc7CZDtrhBKpQBxwETnQj8SZKFz5dibQze3CJqMa6knECp85W6KT2aD5VWtGVzfnv" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAFwAAAAAJc2VwYXJhdG9yAgAAAAFfAAAAAA1rZXlDaGFyc0NvdW50AgAAAAtjaGFyc19jb3VudAAAAAAIa2V5T3duZXICAAAABW93bmVyAAAAAA1rZXlBcHBlYXJhbmNlAgAAAAphcHBlYXJhbmNlAAAAABNrZXlOYXR1cmFsUHlyb0JvbnVzAgAAABJuYXR1cmFsX3B5cm9fYm9udXMAAAAAE2tleU5hdHVyYWxBcXVhQm9udXMCAAAAEm5hdHVyYWxfYXF1YV9ib251cwAAAAAUa2V5TmF0dXJhbFRlcnJhQm9udXMCAAAAE25hdHVyYWxfdGVycmFfYm9udXMAAAAAE2tleU5hdHVyYWxBZXJvQm9udXMCAAAAEm5hdHVyYWxfYWVyb19ib251cwAAAAAUa2V5TmF0dXJhbExvb3RzQm9udXMCAAAAE25hdHVyYWxfbG9vdHNfYm9udXMAAAAAGWtleU5hdHVyYWxHZW5lcmF0aW5nQm9udXMCAAAAGG5hdHVyYWxfZ2VuZXJhdGluZ19ib251cwAAAAAGZ292QXBwCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABA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Cb251cwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAABHdpdGgAAAACBQAAABNrZXlOYXR1cmFsQWVyb0JvbnVzBQAAAAZjaGFySWQFAAAADG5hdEFlcm9Cb251cwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAABHdpdGgAAAACBQAAABRrZXlOYXR1cmFsTG9vdHNCb251cwUAAAAGY2hhcklkBQAAAA1uYXRMb290c0JvbnVzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAEd2l0aAAAAAIFAAAAGWtleU5hdHVyYWxHZW5lcmF0aW5nQm9udXMFAAAABmNoYXJJZAUAAAASbmF0R2VuZXJhdGluZ0JvbnVzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAA1rZXlDaGFyc0NvdW50CQAAZAAAAAIFAAAABmNoYXJJZAAAAAAAAAAAAQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXk8kZDQ", "height": 2056937, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E1wS6nSTx4FKYUCbv3JNMwYumLTuNcgLWbm6nr4HwkMo Next: EH6F1nYWZQHZZXjnwRsM9abBC79iw7zqgFtdv48bLezg Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let keyAppearance = "appearance" | |
11 | 11 | ||
12 | - | let | |
12 | + | let keyNaturalPyroBonus = "natural_pyro_bonus" | |
13 | 13 | ||
14 | - | let | |
14 | + | let keyNaturalAquaBonus = "natural_aqua_bonus" | |
15 | 15 | ||
16 | - | let | |
16 | + | let keyNaturalTerraBonus = "natural_terra_bonus" | |
17 | 17 | ||
18 | - | let | |
18 | + | let keyNaturalAeroBonus = "natural_aero_bonus" | |
19 | 19 | ||
20 | - | let | |
20 | + | let keyNaturalLootsBonus = "natural_loots_bonus" | |
21 | 21 | ||
22 | - | let | |
22 | + | let keyNaturalGeneratingBonus = "natural_generating_bonus" | |
23 | 23 | ||
24 | - | let | |
24 | + | let govApp = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
25 | 25 | ||
26 | 26 | let keyEcosystemAddresses = "ecosystem_addresses" | |
27 | 27 | ||
28 | - | let | |
28 | + | let keyCharsBodyAmount = "chars_body_amount" | |
29 | 29 | ||
30 | 30 | let keyCharsEyesAmount = "chars_eyes_amount" | |
31 | 31 | ||
32 | - | let | |
32 | + | let keyCharsMouthAmount = "chars_mouth_amount" | |
33 | 33 | ||
34 | 34 | let keyCharsStatsTiersRanges = "chars_stats_tiers_ranges" | |
35 | 35 | ||
39 | 39 | ||
40 | 40 | let keyCharsNaturalGeneratingBonusRanges = "chars_natural_generating_bonus_ranges" | |
41 | 41 | ||
42 | - | func | |
42 | + | func invokeChecks (callerAddr) = if ((isDataStorageUntouched(govApp) != false)) | |
43 | 43 | then throw("Governing app not ready") | |
44 | 44 | else { | |
45 | - | let ecosystemAddresses = getStringValue( | |
45 | + | let ecosystemAddresses = getStringValue(govApp, keyEcosystemAddresses) | |
46 | 46 | if ((contains(ecosystemAddresses, toString(callerAddr)) != false)) | |
47 | 47 | then throw("Access denied") | |
48 | - | else | |
48 | + | else true | |
49 | 49 | } | |
50 | + | ||
51 | + | ||
52 | + | func with (a,b) = { | |
53 | + | let c = match b { | |
54 | + | case isInt: Int => | |
55 | + | toString(isInt) | |
56 | + | case isStr: String => | |
57 | + | isStr | |
58 | + | case _ => | |
59 | + | throw("Matching issue in with function") | |
60 | + | } | |
61 | + | ((c + separator) + a) | |
62 | + | } | |
50 | 63 | ||
51 | 64 | ||
52 | 65 | func randInt (min,max,txId,nonce) = { | |
55 | 68 | } | |
56 | 69 | ||
57 | 70 | ||
58 | - | func with (a,b) = ((toString(b) + separator) + a) | |
59 | - | ||
60 | - | ||
61 | - | func getRandomBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
71 | + | func genRandomNaturalBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
62 | 72 | let sT1 = parseIntValue(statsTierRanges[0]) | |
63 | 73 | let sT2 = parseIntValue(statsTierRanges[1]) | |
64 | 74 | let sT3 = parseIntValue(statsTierRanges[2]) | |
101 | 111 | ||
102 | 112 | ||
103 | 113 | @Callable(i) | |
104 | - | func createChar () = valueOrElse(invokChecks(i.caller), { | |
105 | - | let txId = i.transactionId | |
106 | - | let callerAddr = toBase58String(i.caller.bytes) | |
107 | - | let charId = valueOrElse(getInteger(this, keyCharsCount), 1) | |
108 | - | let bodiesAmount = getIntegerValue(govAddr, keyCharsBodiesAmount) | |
109 | - | let eyesAmount = getIntegerValue(govAddr, keyCharsEyesAmount) | |
110 | - | let mouthsAmount = getIntegerValue(govAddr, keyCharsMouthsAmount) | |
111 | - | let statsTiersRanges = split(getStringValue(govAddr, keyCharsStatsTiersRanges), separator) | |
112 | - | let elemBonusRanges = split(getStringValue(govAddr, keyCharsNaturalElemBonusRanges), separator) | |
113 | - | let lootsBonusRanges = split(getStringValue(govAddr, keyCharsNaturalLootsBonusRanges), separator) | |
114 | - | let generatingBonusRanges = split(getStringValue(govAddr, keyCharsNaturalGeneratingBonusRanges), separator) | |
115 | - | let appearance = makeString([toString(randInt(1, bodiesAmount, txId, 0)), toString(randInt(1, eyesAmount, txId, 1)), toString(randInt(1, mouthsAmount, txId, 2))], separator) | |
116 | - | let pyroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 3, txId) | |
117 | - | let aquaBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 10, txId) | |
118 | - | let terraBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 17, txId) | |
119 | - | let aeroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 24, txId) | |
120 | - | let generatingBonus = getRandomBonus(statsTiersRanges, generatingBonusRanges, 31, txId) | |
121 | - | let lootsBonus = getRandomBonus(statsTiersRanges, lootsBonusRanges, 38, txId) | |
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))] | |
123 | - | }) | |
114 | + | func createChar () = if ((invokeChecks(i.caller) != true)) | |
115 | + | then throw() | |
116 | + | else { | |
117 | + | let txId = i.transactionId | |
118 | + | let callerAddr = toBase58String(i.caller.bytes) | |
119 | + | let charId = valueOrElse(getInteger(this, keyCharsCount), 1) | |
120 | + | let bodiesAmount = getIntegerValue(govApp, keyCharsBodyAmount) | |
121 | + | let eyesAmount = getIntegerValue(govApp, keyCharsEyesAmount) | |
122 | + | let mouthsAmount = getIntegerValue(govApp, keyCharsMouthAmount) | |
123 | + | let statsTiersRanges = split(getStringValue(govApp, keyCharsStatsTiersRanges), separator) | |
124 | + | let natElemBonusRanges = split(getStringValue(govApp, keyCharsNaturalElemBonusRanges), separator) | |
125 | + | let natLootsBonusRanges = split(getStringValue(govApp, keyCharsNaturalLootsBonusRanges), separator) | |
126 | + | let natGeneratingBonusRanges = split(getStringValue(govApp, keyCharsNaturalGeneratingBonusRanges), separator) | |
127 | + | let appearance = makeString([toString(randInt(1, bodiesAmount, txId, 0)), toString(randInt(1, eyesAmount, txId, 1)), toString(randInt(1, mouthsAmount, txId, 2))], separator) | |
128 | + | let natPyroBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 3, txId) | |
129 | + | let natAquaBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 10, txId) | |
130 | + | let natTerraBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 17, txId) | |
131 | + | let natAeroBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 24, txId) | |
132 | + | let natGeneratingBonus = genRandomNaturalBonus(statsTiersRanges, natGeneratingBonusRanges, 31, txId) | |
133 | + | let natLootsBonus = genRandomNaturalBonus(statsTiersRanges, natLootsBonusRanges, 38, txId) | |
134 | + | [StringEntry(with(keyOwner, charId), callerAddr), StringEntry(with(keyAppearance, charId), appearance), IntegerEntry(with(keyNaturalPyroBonus, charId), natPyroBonus), IntegerEntry(with(keyNaturalAquaBonus, charId), natAquaBonus), IntegerEntry(with(keyNaturalTerraBonus, charId), natTerraBonus), IntegerEntry(with(keyNaturalAeroBonus, charId), natAeroBonus), IntegerEntry(with(keyNaturalLootsBonus, charId), natLootsBonus), IntegerEntry(with(keyNaturalGeneratingBonus, charId), natGeneratingBonus), IntegerEntry(keyCharsCount, (charId + 1))] | |
135 | + | } | |
124 | 136 | ||
125 | 137 | ||
126 | 138 | @Verifier(tx) |
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 | 7 | ||
8 | 8 | let keyOwner = "owner" | |
9 | 9 | ||
10 | 10 | let keyAppearance = "appearance" | |
11 | 11 | ||
12 | - | let | |
12 | + | let keyNaturalPyroBonus = "natural_pyro_bonus" | |
13 | 13 | ||
14 | - | let | |
14 | + | let keyNaturalAquaBonus = "natural_aqua_bonus" | |
15 | 15 | ||
16 | - | let | |
16 | + | let keyNaturalTerraBonus = "natural_terra_bonus" | |
17 | 17 | ||
18 | - | let | |
18 | + | let keyNaturalAeroBonus = "natural_aero_bonus" | |
19 | 19 | ||
20 | - | let | |
20 | + | let keyNaturalLootsBonus = "natural_loots_bonus" | |
21 | 21 | ||
22 | - | let | |
22 | + | let keyNaturalGeneratingBonus = "natural_generating_bonus" | |
23 | 23 | ||
24 | - | let | |
24 | + | let govApp = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
25 | 25 | ||
26 | 26 | let keyEcosystemAddresses = "ecosystem_addresses" | |
27 | 27 | ||
28 | - | let | |
28 | + | let keyCharsBodyAmount = "chars_body_amount" | |
29 | 29 | ||
30 | 30 | let keyCharsEyesAmount = "chars_eyes_amount" | |
31 | 31 | ||
32 | - | let | |
32 | + | let keyCharsMouthAmount = "chars_mouth_amount" | |
33 | 33 | ||
34 | 34 | let keyCharsStatsTiersRanges = "chars_stats_tiers_ranges" | |
35 | 35 | ||
36 | 36 | let keyCharsNaturalElemBonusRanges = "chars_natural_elem_bonus_ranges" | |
37 | 37 | ||
38 | 38 | let keyCharsNaturalLootsBonusRanges = "chars_natural_loots_bonus_ranges" | |
39 | 39 | ||
40 | 40 | let keyCharsNaturalGeneratingBonusRanges = "chars_natural_generating_bonus_ranges" | |
41 | 41 | ||
42 | - | func | |
42 | + | func invokeChecks (callerAddr) = if ((isDataStorageUntouched(govApp) != false)) | |
43 | 43 | then throw("Governing app not ready") | |
44 | 44 | else { | |
45 | - | let ecosystemAddresses = getStringValue( | |
45 | + | let ecosystemAddresses = getStringValue(govApp, keyEcosystemAddresses) | |
46 | 46 | if ((contains(ecosystemAddresses, toString(callerAddr)) != false)) | |
47 | 47 | then throw("Access denied") | |
48 | - | else | |
48 | + | else true | |
49 | 49 | } | |
50 | + | ||
51 | + | ||
52 | + | func with (a,b) = { | |
53 | + | let c = match b { | |
54 | + | case isInt: Int => | |
55 | + | toString(isInt) | |
56 | + | case isStr: String => | |
57 | + | isStr | |
58 | + | case _ => | |
59 | + | throw("Matching issue in with function") | |
60 | + | } | |
61 | + | ((c + separator) + a) | |
62 | + | } | |
50 | 63 | ||
51 | 64 | ||
52 | 65 | func randInt (min,max,txId,nonce) = { | |
53 | 66 | let hash = value(sha256_16Kb(((value(value(blockInfoByHeight(height)).vrf) + txId) + toBytes(nonce)))) | |
54 | 67 | value(((value(toInt(hash)) % ((max - min) + 1)) + min)) | |
55 | 68 | } | |
56 | 69 | ||
57 | 70 | ||
58 | - | func with (a,b) = ((toString(b) + separator) + a) | |
59 | - | ||
60 | - | ||
61 | - | func getRandomBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
71 | + | func genRandomNaturalBonus (statsTierRanges,bonusRanges,startingNonce,txId) = { | |
62 | 72 | let sT1 = parseIntValue(statsTierRanges[0]) | |
63 | 73 | let sT2 = parseIntValue(statsTierRanges[1]) | |
64 | 74 | let sT3 = parseIntValue(statsTierRanges[2]) | |
65 | 75 | let sT4 = parseIntValue(statsTierRanges[3]) | |
66 | 76 | let sT5 = parseIntValue(statsTierRanges[4]) | |
67 | 77 | let sT6 = parseIntValue(statsTierRanges[5]) | |
68 | 78 | let bT1 = parseIntValue(bonusRanges[0]) | |
69 | 79 | let bT2 = parseIntValue(bonusRanges[1]) | |
70 | 80 | let bT3 = parseIntValue(bonusRanges[2]) | |
71 | 81 | let bT4 = parseIntValue(bonusRanges[3]) | |
72 | 82 | let bT5 = parseIntValue(bonusRanges[4]) | |
73 | 83 | let bT6 = parseIntValue(bonusRanges[5]) | |
74 | 84 | let tierResult = randInt(0, 10000, txId, startingNonce) | |
75 | 85 | if (if ((tierResult >= 0)) | |
76 | 86 | then (sT1 >= tierResult) | |
77 | 87 | else false) | |
78 | 88 | then randInt(0, bT1, txId, (startingNonce + 1)) | |
79 | 89 | else if (if ((tierResult > sT1)) | |
80 | 90 | then (sT2 >= tierResult) | |
81 | 91 | else false) | |
82 | 92 | then randInt((bT1 + 1), bT2, txId, (startingNonce + 2)) | |
83 | 93 | else if (if ((tierResult > sT2)) | |
84 | 94 | then (sT3 >= tierResult) | |
85 | 95 | else false) | |
86 | 96 | then randInt((bT2 + 1), bT3, txId, (startingNonce + 3)) | |
87 | 97 | else if (if ((tierResult > sT3)) | |
88 | 98 | then (sT4 >= tierResult) | |
89 | 99 | else false) | |
90 | 100 | then randInt((bT3 + 1), bT4, txId, (startingNonce + 4)) | |
91 | 101 | else if (if ((tierResult > sT4)) | |
92 | 102 | then (sT5 >= tierResult) | |
93 | 103 | else false) | |
94 | 104 | then randInt((bT4 + 1), bT5, txId, (startingNonce + 5)) | |
95 | 105 | else if (if ((tierResult > sT5)) | |
96 | 106 | then (sT6 >= tierResult) | |
97 | 107 | else false) | |
98 | 108 | then randInt((bT5 + 1), bT6, txId, (startingNonce + 6)) | |
99 | 109 | else throw("Unexpected error") | |
100 | 110 | } | |
101 | 111 | ||
102 | 112 | ||
103 | 113 | @Callable(i) | |
104 | - | func createChar () = valueOrElse(invokChecks(i.caller), { | |
105 | - | let txId = i.transactionId | |
106 | - | let callerAddr = toBase58String(i.caller.bytes) | |
107 | - | let charId = valueOrElse(getInteger(this, keyCharsCount), 1) | |
108 | - | let bodiesAmount = getIntegerValue(govAddr, keyCharsBodiesAmount) | |
109 | - | let eyesAmount = getIntegerValue(govAddr, keyCharsEyesAmount) | |
110 | - | let mouthsAmount = getIntegerValue(govAddr, keyCharsMouthsAmount) | |
111 | - | let statsTiersRanges = split(getStringValue(govAddr, keyCharsStatsTiersRanges), separator) | |
112 | - | let elemBonusRanges = split(getStringValue(govAddr, keyCharsNaturalElemBonusRanges), separator) | |
113 | - | let lootsBonusRanges = split(getStringValue(govAddr, keyCharsNaturalLootsBonusRanges), separator) | |
114 | - | let generatingBonusRanges = split(getStringValue(govAddr, keyCharsNaturalGeneratingBonusRanges), separator) | |
115 | - | let appearance = makeString([toString(randInt(1, bodiesAmount, txId, 0)), toString(randInt(1, eyesAmount, txId, 1)), toString(randInt(1, mouthsAmount, txId, 2))], separator) | |
116 | - | let pyroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 3, txId) | |
117 | - | let aquaBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 10, txId) | |
118 | - | let terraBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 17, txId) | |
119 | - | let aeroBonus = getRandomBonus(statsTiersRanges, elemBonusRanges, 24, txId) | |
120 | - | let generatingBonus = getRandomBonus(statsTiersRanges, generatingBonusRanges, 31, txId) | |
121 | - | let lootsBonus = getRandomBonus(statsTiersRanges, lootsBonusRanges, 38, txId) | |
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))] | |
123 | - | }) | |
114 | + | func createChar () = if ((invokeChecks(i.caller) != true)) | |
115 | + | then throw() | |
116 | + | else { | |
117 | + | let txId = i.transactionId | |
118 | + | let callerAddr = toBase58String(i.caller.bytes) | |
119 | + | let charId = valueOrElse(getInteger(this, keyCharsCount), 1) | |
120 | + | let bodiesAmount = getIntegerValue(govApp, keyCharsBodyAmount) | |
121 | + | let eyesAmount = getIntegerValue(govApp, keyCharsEyesAmount) | |
122 | + | let mouthsAmount = getIntegerValue(govApp, keyCharsMouthAmount) | |
123 | + | let statsTiersRanges = split(getStringValue(govApp, keyCharsStatsTiersRanges), separator) | |
124 | + | let natElemBonusRanges = split(getStringValue(govApp, keyCharsNaturalElemBonusRanges), separator) | |
125 | + | let natLootsBonusRanges = split(getStringValue(govApp, keyCharsNaturalLootsBonusRanges), separator) | |
126 | + | let natGeneratingBonusRanges = split(getStringValue(govApp, keyCharsNaturalGeneratingBonusRanges), separator) | |
127 | + | let appearance = makeString([toString(randInt(1, bodiesAmount, txId, 0)), toString(randInt(1, eyesAmount, txId, 1)), toString(randInt(1, mouthsAmount, txId, 2))], separator) | |
128 | + | let natPyroBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 3, txId) | |
129 | + | let natAquaBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 10, txId) | |
130 | + | let natTerraBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 17, txId) | |
131 | + | let natAeroBonus = genRandomNaturalBonus(statsTiersRanges, natElemBonusRanges, 24, txId) | |
132 | + | let natGeneratingBonus = genRandomNaturalBonus(statsTiersRanges, natGeneratingBonusRanges, 31, txId) | |
133 | + | let natLootsBonus = genRandomNaturalBonus(statsTiersRanges, natLootsBonusRanges, 38, txId) | |
134 | + | [StringEntry(with(keyOwner, charId), callerAddr), StringEntry(with(keyAppearance, charId), appearance), IntegerEntry(with(keyNaturalPyroBonus, charId), natPyroBonus), IntegerEntry(with(keyNaturalAquaBonus, charId), natAquaBonus), IntegerEntry(with(keyNaturalTerraBonus, charId), natTerraBonus), IntegerEntry(with(keyNaturalAeroBonus, charId), natAeroBonus), IntegerEntry(with(keyNaturalLootsBonus, charId), natLootsBonus), IntegerEntry(with(keyNaturalGeneratingBonus, charId), natGeneratingBonus), IntegerEntry(keyCharsCount, (charId + 1))] | |
135 | + | } | |
124 | 136 | ||
125 | 137 | ||
126 | 138 | @Verifier(tx) | |
127 | 139 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
128 | 140 |
github/deemru/w8io/169f3d6 35.54 ms ◑