tx · 31Li9KkucfFGWok6WYQ8cSQz8dtqEgFVrF9YqpivZn61 3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB: -0.01400000 Waves 2021.06.01 04:12 [1550615] smart account 3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB > SELF 0.00000000 Waves
{ "type": 13, "id": "31Li9KkucfFGWok6WYQ8cSQz8dtqEgFVrF9YqpivZn61", "fee": 1400000, "feeAssetId": null, "timestamp": 1622509956339, "version": 2, "chainId": 84, "sender": "3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB", "senderPublicKey": "CQ7vntBAYh2QZcKcqiiyEnQWWXsr98ysDptD23Wgxmvb", "proofs": [ "2Tyfb7Xtp2W36VpzKBjyp4vYuU4prB3w15vbHXnvvod4W84UWDddfuPdWuoUbigGvsokCz3TWgbkhhNiWN97zhs8" ], "script": "base64:AAIEAAAAAAAAAAkIAhIDCgEBEgAAAAAFAAAAAAhraXR0ZW5JZAIAAAAsR3VvYmNIdlc5V3FvdG5rR1VqN0prcGNiWHRnVmZCMzdUQTRKa2dTajlRYmIBAAAAD2dldFJhbmRvbU51bWJlcgAAAAQAAAAIdmFyaWFudHMAAAAEdHhJZAAAABRoYXRjaGluZ0ZpbmlzaEhlaWdodAAAAAZvZmZzZXQEAAAAD3JhbmRvbVNlZWRCbG9jawkBAAAABXZhbHVlAAAAAQkAA+0AAAABCQAAZQAAAAIFAAAAFGhhdGNoaW5nRmluaXNoSGVpZ2h0AAAAAAAAAAABBAAAAApyYW5kb21IYXNoCQAB9wAAAAEJAADLAAAAAgUAAAAEdHhJZAkBAAAABXZhbHVlAAAAAQgFAAAAD3JhbmRvbVNlZWRCbG9jawAAAAN2cmYJAABqAAAAAgkABLIAAAACBQAAAApyYW5kb21IYXNoCQAAaAAAAAIFAAAABm9mZnNldAAAAAAAAAAACAUAAAAIdmFyaWFudHMBAAAACmdlbmVyYXRpb24AAAABAAAAA251bQMDCQAAZgAAAAIFAAAAA251bQAAAAAA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IBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleao0YMM=", "height": 1550615, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H9wVYAkyxVazSsacyfk1L7MpNAyDkmUDUttX2kDAwuua Next: 5KVpEg1NmCPxeYhejDGVYdv5FZt5Gi97DNKkLE1GaLU5 Diff:
Old | New | Differences | |
---|---|---|---|
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | - | func testIssueGeneCode (num) = { | |
64 | - | let timestamp = lastBlock.timestamp | |
65 | - | let timestampStr = toString(timestamp) | |
66 | - | let timestamp2 = takeRight(timestampStr, 2) | |
67 | - | let percent = parseIntValue(timestamp2) | |
68 | - | if ((percent == 0)) | |
69 | - | then "II-II-II-II" | |
70 | - | else if (if ((percent > 0)) | |
71 | - | then (3 >= percent) | |
63 | + | func testIssueGeneCode (num) = if ((num == 100)) | |
64 | + | then "II-II-II-II" | |
65 | + | else if (if ((num >= 1)) | |
66 | + | then (3 >= num) | |
67 | + | else false) | |
68 | + | then "BB-BB-BB-BB" | |
69 | + | else if (if ((num > 3)) | |
70 | + | then (8 >= num) | |
72 | 71 | else false) | |
73 | - | then " | |
74 | - | else if (if (( | |
75 | - | then ( | |
72 | + | then "CC-CC-CC-CC" | |
73 | + | else if (if ((num > 8)) | |
74 | + | then (15 >= num) | |
76 | 75 | else false) | |
77 | - | then " | |
78 | - | else if (if (( | |
79 | - | then ( | |
76 | + | then "DD-DD-DD-DD" | |
77 | + | else if (if ((num > 15)) | |
78 | + | then (24 >= num) | |
80 | 79 | else false) | |
81 | - | then " | |
82 | - | else if (if (( | |
83 | - | then ( | |
80 | + | then "EE-EE-EE-EE" | |
81 | + | else if (if ((num > 24)) | |
82 | + | then (35 >= num) | |
84 | 83 | else false) | |
85 | - | then " | |
86 | - | else if (if (( | |
87 | - | then ( | |
84 | + | then "FF-FF-FF-FF" | |
85 | + | else if (if ((num > 35)) | |
86 | + | then (48 >= num) | |
88 | 87 | else false) | |
89 | - | then " | |
90 | - | else if (if (( | |
91 | - | then ( | |
88 | + | then "GG-GG-GG-GG" | |
89 | + | else if (if ((num > 48)) | |
90 | + | then (51 >= num) | |
92 | 91 | else false) | |
93 | - | then "GG-GG-GG-GG" | |
94 | - | else if (if ((percent > 48)) | |
95 | - | then (51 >= percent) | |
96 | - | else false) | |
97 | - | then "AA-AA-AA-AA" | |
98 | - | else "HH-HH-HH-HH" | |
99 | - | } | |
92 | + | then "AA-AA-AA-AA" | |
93 | + | else "HH-HH-HH-HH" | |
100 | 94 | ||
101 | 95 | ||
102 | 96 | @Callable(i) | |
124 | 118 | let issueNftId = calculateAssetId(issueNft) | |
125 | 119 | let blockHeight = lastBlock.height | |
126 | 120 | let typeRandom = getRandomNumber(100, issueNftId, blockHeight, 0) | |
121 | + | let geneCode = testIssueGeneCode(typeRandom) | |
127 | 122 | if ((num == 0)) | |
128 | - | then throw(((("blockHeight:" + toString(blockHeight)) + "/typeRandom:") + toString(typeRandom))) | |
129 | - | else { | |
130 | - | let geneCode = testIssueGeneCode(typeRandom) | |
131 | - | [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), geneCode), IntegerEntry("issueQuantity", newQuantity)] | |
132 | - | } | |
123 | + | then throw(((((("blockHeight:" + toString(blockHeight)) + "/typeRandom:") + toString(typeRandom)) + "/geneCode:") + geneCode)) | |
124 | + | else [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), geneCode), IntegerEntry("issueQuantity", newQuantity)] | |
133 | 125 | } | |
134 | 126 | } | |
135 | 127 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kittenId = "GuobcHvW9WqotnkGUj7JkpcbXtgVfB37TA4JkgSj9Qbb" | |
5 | 5 | ||
6 | 6 | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
7 | 7 | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
8 | 8 | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
9 | 9 | (toInt(randomHash, (offset * 8)) % variants) | |
10 | 10 | } | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func generation (num) = if (if ((num > 0)) | |
14 | 14 | then true | |
15 | 15 | else (300 >= num)) | |
16 | 16 | then "G1" | |
17 | 17 | else if (if ((num > 300)) | |
18 | 18 | then true | |
19 | 19 | else (1000 >= num)) | |
20 | 20 | then "G2" | |
21 | 21 | else "G3" | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func issueGeneCode () = { | |
25 | 25 | let timestamp = lastBlock.timestamp | |
26 | 26 | let timestampStr = toString(timestamp) | |
27 | 27 | let timestamp2 = takeRight(timestampStr, 2) | |
28 | 28 | let percent = parseIntValue(timestamp2) | |
29 | 29 | if ((percent == 0)) | |
30 | 30 | then "II-II-II-II" | |
31 | 31 | else if (if ((percent > 0)) | |
32 | 32 | then (3 >= percent) | |
33 | 33 | else false) | |
34 | 34 | then "BB-BB-BB-BB" | |
35 | 35 | else if (if ((percent > 3)) | |
36 | 36 | then (8 >= percent) | |
37 | 37 | else false) | |
38 | 38 | then "CC-CC-CC-CC" | |
39 | 39 | else if (if ((percent > 8)) | |
40 | 40 | then (15 >= percent) | |
41 | 41 | else false) | |
42 | 42 | then "DD-DD-DD-DD" | |
43 | 43 | else if (if ((percent > 15)) | |
44 | 44 | then (24 >= percent) | |
45 | 45 | else false) | |
46 | 46 | then "EE-EE-EE-EE" | |
47 | 47 | else if (if ((percent > 24)) | |
48 | 48 | then (35 >= percent) | |
49 | 49 | else false) | |
50 | 50 | then "FF-FF-FF-FF" | |
51 | 51 | else if (if ((percent > 35)) | |
52 | 52 | then (48 >= percent) | |
53 | 53 | else false) | |
54 | 54 | then "GG-GG-GG-GG" | |
55 | 55 | else if (if ((percent > 48)) | |
56 | 56 | then (51 >= percent) | |
57 | 57 | else false) | |
58 | 58 | then "AA-AA-AA-AA" | |
59 | 59 | else "HH-HH-HH-HH" | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | - | func testIssueGeneCode (num) = { | |
64 | - | let timestamp = lastBlock.timestamp | |
65 | - | let timestampStr = toString(timestamp) | |
66 | - | let timestamp2 = takeRight(timestampStr, 2) | |
67 | - | let percent = parseIntValue(timestamp2) | |
68 | - | if ((percent == 0)) | |
69 | - | then "II-II-II-II" | |
70 | - | else if (if ((percent > 0)) | |
71 | - | then (3 >= percent) | |
63 | + | func testIssueGeneCode (num) = if ((num == 100)) | |
64 | + | then "II-II-II-II" | |
65 | + | else if (if ((num >= 1)) | |
66 | + | then (3 >= num) | |
67 | + | else false) | |
68 | + | then "BB-BB-BB-BB" | |
69 | + | else if (if ((num > 3)) | |
70 | + | then (8 >= num) | |
72 | 71 | else false) | |
73 | - | then " | |
74 | - | else if (if (( | |
75 | - | then ( | |
72 | + | then "CC-CC-CC-CC" | |
73 | + | else if (if ((num > 8)) | |
74 | + | then (15 >= num) | |
76 | 75 | else false) | |
77 | - | then " | |
78 | - | else if (if (( | |
79 | - | then ( | |
76 | + | then "DD-DD-DD-DD" | |
77 | + | else if (if ((num > 15)) | |
78 | + | then (24 >= num) | |
80 | 79 | else false) | |
81 | - | then " | |
82 | - | else if (if (( | |
83 | - | then ( | |
80 | + | then "EE-EE-EE-EE" | |
81 | + | else if (if ((num > 24)) | |
82 | + | then (35 >= num) | |
84 | 83 | else false) | |
85 | - | then " | |
86 | - | else if (if (( | |
87 | - | then ( | |
84 | + | then "FF-FF-FF-FF" | |
85 | + | else if (if ((num > 35)) | |
86 | + | then (48 >= num) | |
88 | 87 | else false) | |
89 | - | then " | |
90 | - | else if (if (( | |
91 | - | then ( | |
88 | + | then "GG-GG-GG-GG" | |
89 | + | else if (if ((num > 48)) | |
90 | + | then (51 >= num) | |
92 | 91 | else false) | |
93 | - | then "GG-GG-GG-GG" | |
94 | - | else if (if ((percent > 48)) | |
95 | - | then (51 >= percent) | |
96 | - | else false) | |
97 | - | then "AA-AA-AA-AA" | |
98 | - | else "HH-HH-HH-HH" | |
99 | - | } | |
92 | + | then "AA-AA-AA-AA" | |
93 | + | else "HH-HH-HH-HH" | |
100 | 94 | ||
101 | 95 | ||
102 | 96 | @Callable(i) | |
103 | 97 | func testKitten (num) = { | |
104 | 98 | let pmt = i.payments[0] | |
105 | 99 | let pmtId = toBase58String(value(pmt.assetId)) | |
106 | 100 | if ((pmtId != kittenId)) | |
107 | 101 | then throw("Please send Kitten token.") | |
108 | 102 | else { | |
109 | 103 | let kittenAmount = pmt.amount | |
110 | 104 | if ((kittenAmount > 300)) | |
111 | 105 | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
112 | 106 | else if ((300 > kittenAmount)) | |
113 | 107 | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
114 | 108 | else { | |
115 | 109 | let issueQuantity = match getInteger(this, "issueQuantity") { | |
116 | 110 | case a: Int => | |
117 | 111 | a | |
118 | 112 | case _ => | |
119 | 113 | 0 | |
120 | 114 | } | |
121 | 115 | let newQuantity = (issueQuantity + 1) | |
122 | 116 | let generationType = generation(newQuantity) | |
123 | 117 | let issueNft = Issue("Kitten(=^・^=)", ("generation:" + generationType), 1, 0, false) | |
124 | 118 | let issueNftId = calculateAssetId(issueNft) | |
125 | 119 | let blockHeight = lastBlock.height | |
126 | 120 | let typeRandom = getRandomNumber(100, issueNftId, blockHeight, 0) | |
121 | + | let geneCode = testIssueGeneCode(typeRandom) | |
127 | 122 | if ((num == 0)) | |
128 | - | then throw(((("blockHeight:" + toString(blockHeight)) + "/typeRandom:") + toString(typeRandom))) | |
129 | - | else { | |
130 | - | let geneCode = testIssueGeneCode(typeRandom) | |
131 | - | [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), geneCode), IntegerEntry("issueQuantity", newQuantity)] | |
132 | - | } | |
123 | + | then throw(((((("blockHeight:" + toString(blockHeight)) + "/typeRandom:") + toString(typeRandom)) + "/geneCode:") + geneCode)) | |
124 | + | else [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), geneCode), IntegerEntry("issueQuantity", newQuantity)] | |
133 | 125 | } | |
134 | 126 | } | |
135 | 127 | } | |
136 | 128 | ||
137 | 129 | ||
138 | 130 | ||
139 | 131 | @Callable(i) | |
140 | 132 | func giveBirthKitten () = { | |
141 | 133 | let pmt = i.payments[0] | |
142 | 134 | let pmtId = toBase58String(value(pmt.assetId)) | |
143 | 135 | if ((pmtId != kittenId)) | |
144 | 136 | then throw("Please send Kitten token.") | |
145 | 137 | else { | |
146 | 138 | let kittenAmount = pmt.amount | |
147 | 139 | let issueQuantity = match getInteger(this, "issueQuantity") { | |
148 | 140 | case a: Int => | |
149 | 141 | a | |
150 | 142 | case _ => | |
151 | 143 | 0 | |
152 | 144 | } | |
153 | 145 | let newQuantity = (issueQuantity + 1) | |
154 | 146 | let generationType = generation(newQuantity) | |
155 | 147 | if ((kittenAmount > 300)) | |
156 | 148 | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
157 | 149 | else if ((300 > kittenAmount)) | |
158 | 150 | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
159 | 151 | else { | |
160 | 152 | let issueNft = Issue("Kitten(=^・^=)", ("generation:" + generationType), 1, 0, false) | |
161 | 153 | let issueNftId = calculateAssetId(issueNft) | |
162 | 154 | let nftTransfer = ScriptTransfer(i.caller, 1, issueNftId) | |
163 | 155 | let geneCode = issueGeneCode() | |
164 | 156 | [issueNft, nftTransfer, StringEntry(toBase58String(value(issueNftId)), geneCode), IntegerEntry("issueQuantity", newQuantity)] | |
165 | 157 | } | |
166 | 158 | } | |
167 | 159 | } | |
168 | 160 | ||
169 | 161 | ||
170 | 162 | @Verifier(tx) | |
171 | 163 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
172 | 164 |
github/deemru/w8io/026f985 59.07 ms ◑