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