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