tx · Ho21XGkPN4ZpaDveZNkci67GhvK2jDThXKLmvNUZ7uRF 3N2aVWUqiBRjzXjk1f34yoKYaVSDoYEzpoR: -0.04000000 Waves 2022.01.05 19:26 [1865829] smart account 3N2aVWUqiBRjzXjk1f34yoKYaVSDoYEzpoR > SELF 0.00000000 Waves
{ "type": 13, "id": "Ho21XGkPN4ZpaDveZNkci67GhvK2jDThXKLmvNUZ7uRF", "fee": 4000000, "feeAssetId": null, "timestamp": 1641400038439, "version": 2, "chainId": 84, "sender": "3N2aVWUqiBRjzXjk1f34yoKYaVSDoYEzpoR", "senderPublicKey": "4i3k91ucuKe48pXjapYP1ydYV5xZNbFug7n47XuW5qPu", "proofs": [ "5rPfSroUE6g1pAZCgz2GtaUWfqY96jbBDEvCCF9fDU7myNsPHusG5H9PiQV1nspCgRYQG9Bp9UawC1kFfP1vyhwa" ], "script": "base64:AAIFAAAAAAAAA/EIAhIECgIICBIECgIICBoICgFBEgN4eTMaCwoBQhIGeHkxS2V5GgsKAUMSBnh5MktleRoLCgFEEgZ4eTNLZXkaCwoBRRIGeHlWYWwxGgwKAUYSByRtYXRjaDAaCwoBRxIGeHlWYWwyGgsKAUgSBnh5VmFsMxoQCgFJEgtnZXRYeVJldHVybhoHCgFKEgJ4eRoQCgFLEgskdDAxNDYxMTQ3NhoKCgFMEgVnZXRYeRoICgFNEgN4eWcaDgoBThIJY2hlY2tMaXN0GhAKAU8SCyR0MDE1OTIxNjEzGgsKAVASBmdlblN0choTCgFREg5jaGVja0ZvckV2b2x2ZRoQCgFSEgskdDAyMjYwMjI4MRoHCgFTEgJwMRoHCgFUEgJwMhoHCgFVEgJwMxoHCgFWEgJwNBoHCgFXEgJwNRoHCgFYEgJwNhoHCgFZEgJwNxoHCgFaEgJwOBoJCgFhEgRDT0xTGggKAmFhEgJwORoRCgJhYhILY2xhaW1TcXVhcmUaEwoCYWMSDXRyYW5zYWN0aW9uSWQaEQoCYWQSCyR0MDMzMzQzNDMxGg8KAmFlEglyZXN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0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let COLS = 1024 | |
5 | + | ||
6 | + | let ROWS = 1024 | |
7 | + | ||
8 | + | let nftDomain = "https://nft.gridgang.io/" | |
9 | + | ||
10 | + | let DEBUG = true | |
11 | + | ||
12 | + | let holdingsPublicKey = toBytes("4i3k91ucuKe48pXjapYP1ydYV5xZNbFug7n47XuW5qPu") | |
13 | + | ||
14 | + | func getBoundCoords (data) = { | |
15 | + | let $t0302324 = data | |
16 | + | let x = $t0302324._1 | |
17 | + | let y = $t0302324._2 | |
18 | + | let gen = $t0302324._3 | |
19 | + | let d = pow(2, 0, (gen - 1), 0, 0, HALFUP) | |
20 | + | let tl = $Tuple2((x - d), (y - d)) | |
21 | + | let tc = $Tuple2(x, (y - d)) | |
22 | + | let tr = $Tuple2((x + d), (y + d)) | |
23 | + | let l = $Tuple2((x - d), y) | |
24 | + | let r = $Tuple2((x + d), y) | |
25 | + | let bl = $Tuple2((x - d), (y + d)) | |
26 | + | let bc = $Tuple2(x, (y + d)) | |
27 | + | let br = $Tuple2((x + d), (y + d)) | |
28 | + | [$Tuple3(tl, tc, l), $Tuple3(tc, tr, r), $Tuple3(l, bl, bc), $Tuple3(r, bc, br)] | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func checkSquareForEvolve (coords,gen,ownerId) = { | |
33 | + | let $t0757785 = coords | |
34 | + | let xy1 = $t0757785._1 | |
35 | + | let xy2 = $t0757785._2 | |
36 | + | let xy3 = $t0757785._3 | |
37 | + | let xy1Key = (((((toString(xy1._1) + ",") + toString(xy1._2)) + ",") + gen) + "_owner") | |
38 | + | let xy2Key = (((((toString(xy2._1) + ",") + toString(xy2._2)) + ",") + gen) + "_owner") | |
39 | + | let xy3Key = (((((toString(xy3._1) + ",") + toString(xy3._2)) + ",") + gen) + "_owner") | |
40 | + | let xyVal1 = match getString(this, xy1Key) { | |
41 | + | case _: Unit => | |
42 | + | "unset" | |
43 | + | case x: String => | |
44 | + | x | |
45 | + | case _ => | |
46 | + | throw("Match error") | |
47 | + | } | |
48 | + | let xyVal2 = match getString(this, xy2Key) { | |
49 | + | case _: Unit => | |
50 | + | "unset" | |
51 | + | case x: String => | |
52 | + | x | |
53 | + | case _ => | |
54 | + | throw("Match error") | |
55 | + | } | |
56 | + | let xyVal3 = match getString(this, xy3Key) { | |
57 | + | case _: Unit => | |
58 | + | "unset" | |
59 | + | case x: String => | |
60 | + | x | |
61 | + | case _ => | |
62 | + | throw("Match error") | |
63 | + | } | |
64 | + | if (if ((xyVal1 == ownerId)) | |
65 | + | then (xyVal2 == ownerId) | |
66 | + | else false) | |
67 | + | then (xyVal3 == ownerId) | |
68 | + | else false | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func getXyReturn (xy,gen) = { | |
73 | + | let $t014611476 = xy | |
74 | + | let x = $t014611476._1 | |
75 | + | let y = $t014611476._2 | |
76 | + | $Tuple3(x, y, (gen + 1)) | |
77 | + | } | |
78 | + | ||
79 | + | ||
80 | + | func getXy (xyg,ownerId) = { | |
81 | + | let checkList = getBoundCoords(xyg) | |
82 | + | let $t015921613 = xyg | |
83 | + | let x = $t015921613._1 | |
84 | + | let y = $t015921613._2 | |
85 | + | let gen = $t015921613._3 | |
86 | + | let genStr = toString(gen) | |
87 | + | if (checkSquareForEvolve(checkList[0], genStr, ownerId)) | |
88 | + | then getXyReturn(checkList[0]._1, gen) | |
89 | + | else if (checkSquareForEvolve(checkList[1], genStr, ownerId)) | |
90 | + | then getXyReturn(checkList[1]._1, gen) | |
91 | + | else if (checkSquareForEvolve(checkList[2], genStr, ownerId)) | |
92 | + | then getXyReturn(checkList[2]._1, gen) | |
93 | + | else if (checkSquareForEvolve(checkList[3], genStr, ownerId)) | |
94 | + | then getXyReturn(checkList[3]._1, gen) | |
95 | + | else xyg | |
96 | + | } | |
97 | + | ||
98 | + | ||
99 | + | func checkForEvolve (xyg,ownerId) = { | |
100 | + | let $t022602281 = xyg | |
101 | + | let x = $t022602281._1 | |
102 | + | let y = $t022602281._2 | |
103 | + | let gen = $t022602281._3 | |
104 | + | let p1 = getXy(xyg, ownerId) | |
105 | + | if ((p1._3 == gen)) | |
106 | + | then p1 | |
107 | + | else { | |
108 | + | let p2 = getXy(p1, ownerId) | |
109 | + | if ((p2._3 == p1._3)) | |
110 | + | then p2 | |
111 | + | else { | |
112 | + | let p3 = getXy(p2, ownerId) | |
113 | + | if ((p3._3 == p2._3)) | |
114 | + | then p3 | |
115 | + | else { | |
116 | + | let p4 = getXy(p3, ownerId) | |
117 | + | if ((p4._3 == p3._3)) | |
118 | + | then p4 | |
119 | + | else { | |
120 | + | let p5 = getXy(p4, ownerId) | |
121 | + | if ((p5._3 == p4._3)) | |
122 | + | then p5 | |
123 | + | else { | |
124 | + | let p6 = getXy(p5, ownerId) | |
125 | + | if ((p6._3 == p5._3)) | |
126 | + | then p6 | |
127 | + | else { | |
128 | + | let p7 = getXy(p6, ownerId) | |
129 | + | if ((p7._3 == p6._3)) | |
130 | + | then p7 | |
131 | + | else { | |
132 | + | let p8 = getXy(p7, ownerId) | |
133 | + | if ((p8._3 == p7._3)) | |
134 | + | then p8 | |
135 | + | else { | |
136 | + | let p9 = getXy(p8, ownerId) | |
137 | + | if ((p9._3 == p8._3)) | |
138 | + | then p9 | |
139 | + | else getXy(getXy(p9, ownerId), ownerId) | |
140 | + | } | |
141 | + | } | |
142 | + | } | |
143 | + | } | |
144 | + | } | |
145 | + | } | |
146 | + | } | |
147 | + | } | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | func claimSquare (x,y,ownerId,transactionId) = { | |
152 | + | let $t033343431 = getXy($Tuple3(parseIntValue(x), parseIntValue(y), 1), ownerId) | |
153 | + | let resolvedX = $t033343431._1 | |
154 | + | let resolvedY = $t033343431._2 | |
155 | + | let resolvedGen = $t033343431._3 | |
156 | + | let resolvedXStr = toString(resolvedX) | |
157 | + | let resolvedYStr = toString(resolvedY) | |
158 | + | let resolvedGenStr = toString(resolvedGen) | |
159 | + | let assetName = ((resolvedXStr + ",") + resolvedYStr) | |
160 | + | let assetUrl = ((nftDomain + transactionId) + ".png") | |
161 | + | let asset = Issue(((assetName + " Gen ") + resolvedGenStr), assetUrl, 1, 0, false) | |
162 | + | let assetId = calculateAssetId(asset) | |
163 | + | let gen = resolvedGenStr | |
164 | + | let dataKeyPrefix = ((assetName + ",") + gen) | |
165 | + | $Tuple4(asset, assetId, assetUrl, dataKeyPrefix) | |
166 | + | } | |
167 | + | ||
168 | + | ||
169 | + | @Callable(i) | |
170 | + | func purchase (x,y) = { | |
171 | + | let ownerId = toBase58String(i.caller.bytes) | |
172 | + | let transactionId = toBase58String(i.transactionId) | |
173 | + | let $t040644154 = claimSquare(x, y, ownerId, transactionId) | |
174 | + | let asset = $t040644154._1 | |
175 | + | let assetId = $t040644154._2 | |
176 | + | let assetUrl = $t040644154._3 | |
177 | + | let dataKeyPrefix = $t040644154._4 | |
178 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(i.caller, 1, assetId)] | |
179 | + | } | |
180 | + | ||
181 | + | ||
182 | + | ||
183 | + | @Callable(i) | |
184 | + | func autoBuy (x,y) = { | |
185 | + | let address = addressFromPublicKey(base58'251TfxXBEXj72aSzHVyqj8vf47nRECBGm96ZbfjqbY8s') | |
186 | + | let ownerId = toBase58String(address.bytes) | |
187 | + | let transactionId = toBase58String(i.transactionId) | |
188 | + | let $t046864776 = claimSquare(x, y, ownerId, transactionId) | |
189 | + | let asset = $t046864776._1 | |
190 | + | let assetId = $t046864776._2 | |
191 | + | let assetUrl = $t046864776._3 | |
192 | + | let dataKeyPrefix = $t046864776._4 | |
193 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(address, 1, assetId)] | |
194 | + | } | |
195 | + | ||
196 | + | ||
197 | + | @Verifier(tx) | |
198 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
199 | + | then true | |
200 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], holdingsPublicKey) | |
201 | + |
github/deemru/w8io/169f3d6 29.10 ms ◑