tx · 4Z4tDNz7xqFn6L1C7Vb22gUtsBgAzYJogPQ3FN6ySBuy 3MvUyzQxNGmwExAcKdhojfKem3XwkXdkByH: -0.04000000 Waves 2022.04.17 04:41 [2011895] smart account 3MvUyzQxNGmwExAcKdhojfKem3XwkXdkByH > SELF 0.00000000 Waves
{ "type": 13, "id": "4Z4tDNz7xqFn6L1C7Vb22gUtsBgAzYJogPQ3FN6ySBuy", "fee": 4000000, "feeAssetId": null, "timestamp": 1650159744241, "version": 2, "chainId": 84, "sender": "3MvUyzQxNGmwExAcKdhojfKem3XwkXdkByH", "senderPublicKey": "G2whNsDNG7LDDcHiMuFrtDiNuudzqif5tAopWE1Y7oAQ", "proofs": [ "5sFtSkKNfouKXdceAK5shFSs2sSGB4f7st9CuFk2J8jgCfYzkuwYtmYBvDMngXSof3moCX3jyS4gxTdhFsu8sX1G" ], "script": "base64:AAIFAAAAAAAAACsIAhIFCgMICAgSBAoCCAgSBQoDCAgIEgYKBAgICAgSBAoCCAESBQoDCAgIAAAAEQAAAAAEQ09MUwAAAAAAAAAEAAAAAAAEUk9XUwAAAAAAAAAEAAAAAAAJbmZ0RG9tYWluAgAAABhodHRwczovL25mdC5ncmlkZ2FuZy5pby8AAAAAFWFkZE93bmVyQW5kQW1vdW50RnVuYwIAAAARYWRkT3duZXJBbmRBbW91bnQAAAAABURFQlVHBgAAAAARbWluRm9yU2FsZVdhdmxldHMAAAAAAAX14QAAAAAAEG1pblB1cmNoYXNlUHJpY2UAAAAAAAAPQkAAAAAABGRhcHACAAAAIzNNdlV5elF4Tkdtd0V4QWNLZGhvamZLZW0zWHdrWGRrQnlIAAAAAAtkYXBwQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAABGRhcHAAAAAAEWhvbGRpbmdzUHVibGljS2V5AgAAACwyZWl4cUxES0o1a2p1WThpbUg0SEcyRkJKZHVUNlFzanhMTGNoMWlhQWFkeAAAAAAIaG9sZGluZ3MCAAAAIzNNcEZ0Y2R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ZXJUZXh0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BgkAAAAAAAACCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BQAAAA9ob2xkaW5nc0FkZHJlc3MGCQAAAAAAAAIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkFAAAAC2RhcHBBZGRyZXNzjCq7ag==", "height": 2011895, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C7DBKDaZRRZrhZ9vcbdLqfESUuck71WQQzCuukVeZbcE Next: 4mvWvymTqoHxBdcMM68zHzuvSooTstRy46wThVAxqjWk Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let COLS = 1024 | |
5 | 5 | ||
6 | - | let | |
6 | + | let ROWS = 1024 | |
7 | 7 | ||
8 | - | let | |
8 | + | let nftDomain = "https://nft.gridgang.io/" | |
9 | 9 | ||
10 | - | let | |
10 | + | let addOwnerAndAmountFunc = "addOwnerAndAmount" | |
11 | 11 | ||
12 | - | let | |
12 | + | let DEBUG = true | |
13 | 13 | ||
14 | - | let | |
14 | + | let minForSaleWavlets = 100000000 | |
15 | 15 | ||
16 | - | let | |
16 | + | let minPurchasePrice = 1000000 | |
17 | 17 | ||
18 | - | @Callable(i) | |
19 | - | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)] | |
18 | + | let dapp = "3MvUyzQxNGmwExAcKdhojfKem3XwkXdkByH" | |
20 | 19 | ||
20 | + | let dappAddress = Address(fromBase58String(dapp)) | |
21 | + | ||
22 | + | let holdingsPublicKey = "2eixqLDKJ5kjuY8imH4HG2FBJduT6QsjxLLch1iaAadx" | |
23 | + | ||
24 | + | let holdings = "3MpFtcdhaB66NB38tW2APSiaVqaAoWoPvRJ" | |
25 | + | ||
26 | + | let holdingsAddress = Address(fromBase58String(holdings)) | |
27 | + | ||
28 | + | func getAssetName (x,y) = { | |
29 | + | let name = ((x + ",") + y) | |
30 | + | name | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func getDataKeyPrefix (x,y,gen) = { | |
35 | + | let name = getAssetName(x, y) | |
36 | + | let prefix = ((name + ",") + gen) | |
37 | + | prefix | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | func getXYGenFromName (name) = { | |
42 | + | let parts = split(name, ",") | |
43 | + | let tuple = $Tuple3(parts[0], parts[1], parts[2]) | |
44 | + | tuple | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | func getDataKeyPrefixFromAssetName (name) = { | |
49 | + | let $t010011041 = getXYGenFromName(name) | |
50 | + | let x = $t010011041._1 | |
51 | + | let y = $t010011041._2 | |
52 | + | let gen = $t010011041._3 | |
53 | + | let prefix = getDataKeyPrefix(x, y, gen) | |
54 | + | prefix | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func claimSquare (x,y,gen,ownerId,transactionId) = { | |
59 | + | let resolvedXStr = x | |
60 | + | let resolvedYStr = y | |
61 | + | let resolvedGenStr = gen | |
62 | + | let assetName = getAssetName(resolvedXStr, resolvedYStr) | |
63 | + | let assetUrl = ((nftDomain + transactionId) + ".png") | |
64 | + | let asset = Issue(((assetName + ",") + resolvedGenStr), assetUrl, 1, 0, false) | |
65 | + | let assetId = calculateAssetId(asset) | |
66 | + | let dataKeyPrefix = getDataKeyPrefix(resolvedXStr, resolvedYStr, gen) | |
67 | + | $Tuple4(asset, assetId, assetUrl, dataKeyPrefix) | |
68 | + | } | |
21 | 69 | ||
22 | 70 | ||
23 | 71 | @Callable(i) | |
24 | - | func revokeForSale (assetId) = { | |
25 | - | let callerId = toBase58String(i.caller.bytes) | |
26 | - | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
72 | + | func purchase (x,y,userText) = { | |
73 | + | let prefix = getDataKeyPrefix(x, y, "1") | |
74 | + | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
75 | + | let existingAssetId = match getString(this, (prefix + "_assetId")) { | |
27 | 76 | case _: Unit => | |
28 | 77 | "unset" | |
29 | - | case | |
30 | - | | |
78 | + | case err: String => | |
79 | + | throw("This square has already been purchased") | |
31 | 80 | case _ => | |
32 | 81 | throw("Match error") | |
33 | 82 | } | |
34 | - | if ((callerId != ownerId)) | |
35 | - | then throw("Owners do not match") | |
36 | - | else [StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0), ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
83 | + | if ((minPurchasePrice > paymentAmount)) | |
84 | + | then throw((("You need to send at least " + toString(minPurchasePrice)) + "WAVLETS to purchase a square")) | |
85 | + | else { | |
86 | + | let ownerId = toBase58String(i.caller.bytes) | |
87 | + | let transactionId = toBase58String(i.transactionId) | |
88 | + | let $t022332328 = claimSquare(x, y, "1", ownerId, transactionId) | |
89 | + | let asset = $t022332328._1 | |
90 | + | let assetId = $t022332328._2 | |
91 | + | let assetUrl = $t022332328._3 | |
92 | + | let dataKeyPrefix = $t022332328._4 | |
93 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry((ownerId + "_handle"), userText), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(i.caller, 1, assetId)] | |
94 | + | } | |
37 | 95 | } | |
38 | 96 | ||
39 | 97 | ||
40 | 98 | ||
41 | 99 | @Callable(i) | |
42 | - | func buyFromHoldings (assetId,userText) = { | |
43 | - | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
44 | - | case _: Unit => | |
45 | - | "unset" | |
46 | - | case x: String => | |
47 | - | x | |
100 | + | func autoBuy (x,y) = { | |
101 | + | let callerId = toBase58String(i.caller.bytes) | |
102 | + | if (if ((callerId != holdings)) | |
103 | + | then (callerId != dapp) | |
104 | + | else false) | |
105 | + | then throw("This can only be triggering internally") | |
106 | + | else { | |
107 | + | let transactionId = toBase58String(i.transactionId) | |
108 | + | let $t029553051 = claimSquare(x, y, "1", holdings, transactionId) | |
109 | + | let asset = $t029553051._1 | |
110 | + | let assetId = $t029553051._2 | |
111 | + | let assetUrl = $t029553051._3 | |
112 | + | let dataKeyPrefix = $t029553051._4 | |
113 | + | let assetIdStr = toBase58String(assetId) | |
114 | + | let res = invoke(holdingsAddress, addOwnerAndAmountFunc, [holdings, assetIdStr, 3], [AttachedPayment(unit, 0)]) | |
115 | + | if ((res == res)) | |
116 | + | then [asset, StringEntry((dataKeyPrefix + "_assetId"), assetIdStr), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), holdings), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(holdingsAddress, 1, assetId)] | |
117 | + | else throw("Strict value is not equal to itself.") | |
118 | + | } | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(i) | |
124 | + | func promotionPurchase (x,y,desinationAddress) = { | |
125 | + | let callerId = toBase58String(i.caller.bytes) | |
126 | + | if ((callerId != holdings)) | |
127 | + | then throw("This can only be triggering internally") | |
128 | + | else { | |
129 | + | let transactionId = toBase58String(i.transactionId) | |
130 | + | let $t038073912 = claimSquare(x, y, "1", desinationAddress, transactionId) | |
131 | + | let asset = $t038073912._1 | |
132 | + | let assetId = $t038073912._2 | |
133 | + | let assetUrl = $t038073912._3 | |
134 | + | let dataKeyPrefix = $t038073912._4 | |
135 | + | let assetIdStr = toBase58String(assetId) | |
136 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), assetIdStr), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), desinationAddress), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(Address(fromBase58String(desinationAddress)), 1, assetId)] | |
137 | + | } | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | @Callable(i) | |
143 | + | func evolve (x,y,gen,ownerId) = { | |
144 | + | let callerId = toBase58String(i.caller.bytes) | |
145 | + | if ((callerId != holdings)) | |
146 | + | then throw("This can only be triggering internally") | |
147 | + | else { | |
148 | + | let transactionId = toBase58String(i.transactionId) | |
149 | + | let $t046384733 = claimSquare(x, y, gen, ownerId, transactionId) | |
150 | + | let asset = $t046384733._1 | |
151 | + | let assetId = $t046384733._2 | |
152 | + | let assetUrl = $t046384733._3 | |
153 | + | let dataKeyPrefix = $t046384733._4 | |
154 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(Address(fromBase58String(ownerId)), 1, assetId)] | |
155 | + | } | |
156 | + | } | |
157 | + | ||
158 | + | ||
159 | + | ||
160 | + | @Callable(i) | |
161 | + | func putForSale (assetId,amount) = { | |
162 | + | let callerId = toBase58String(i.caller.bytes) | |
163 | + | let assetData = match assetInfo(fromBase58String(assetId)) { | |
164 | + | case ass: Asset => | |
165 | + | ass | |
48 | 166 | case _ => | |
49 | - | throw(" | |
167 | + | throw("Asset not found") | |
50 | 168 | } | |
51 | - | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
52 | - | let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) { | |
53 | - | case _: Unit => | |
54 | - | 0 | |
55 | - | case x: Int => | |
56 | - | x | |
169 | + | let dataPrefix = getDataKeyPrefixFromAssetName(assetData.name) | |
170 | + | let ownerId = match getString(this, (dataPrefix + "_owner")) { | |
171 | + | case s: String => | |
172 | + | s | |
57 | 173 | case _ => | |
58 | - | throw(" | |
174 | + | throw("Owner not found in data") | |
59 | 175 | } | |
60 | - | if (if ((ownerId == "unset")) | |
61 | - | then true | |
62 | - | else (ownerId == "")) | |
63 | - | then throw("Original owner not found ") | |
64 | - | else if (if ((amount == 0)) | |
65 | - | then true | |
66 | - | else (amount > paymentAmount)) | |
67 | - | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
176 | + | if ((minForSaleWavlets > amount)) | |
177 | + | then throw("Amount needs to be more than 1 wave") | |
178 | + | else if (if ((callerId != ownerId)) | |
179 | + | then (callerId != holdings) | |
180 | + | else false) | |
181 | + | then throw("You are not able to put this asset up for sale") | |
68 | 182 | else { | |
69 | - | let callerId = toBase58String(i.caller.bytes) | |
70 | - | let res = invoke(dAppAddress, "finalizeSale", [assetId, callerId, userText], [AttachedPayment(unit, 0)]) | |
183 | + | let res = invoke(holdingsAddress, addOwnerAndAmountFunc, [callerId, assetId, amount], [AttachedPayment(unit, 0)]) | |
71 | 184 | if ((res == res)) | |
72 | - | then { | |
73 | - | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)] | |
74 | - | if ((ownerId != holdingsAddressStr)) | |
75 | - | then { | |
76 | - | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
77 | - | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
78 | - | let ownerAddress = Address(fromBase58String(ownerId)) | |
79 | - | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
80 | - | } | |
81 | - | else transfer | |
82 | - | } | |
185 | + | then [ScriptTransfer(holdingsAddress, 1, fromBase58String(assetId))] | |
83 | 186 | else throw("Strict value is not equal to itself.") | |
84 | 187 | } | |
188 | + | } | |
189 | + | ||
190 | + | ||
191 | + | ||
192 | + | @Callable(i) | |
193 | + | func finalizeSale (assetId,ownerId,userText) = { | |
194 | + | let callerId = toBase58String(i.caller.bytes) | |
195 | + | if ((callerId != holdings)) | |
196 | + | then throw("This can only be triggering internally") | |
197 | + | else { | |
198 | + | let prefix = match assetInfo(fromBase58String(assetId)) { | |
199 | + | case asset: Asset => | |
200 | + | asset.name | |
201 | + | case _ => | |
202 | + | throw("Can't find asset") | |
203 | + | } | |
204 | + | [StringEntry((prefix + "_owner"), ownerId), StringEntry((ownerId + "_handle"), userText)] | |
205 | + | } | |
85 | 206 | } | |
86 | 207 | ||
87 | 208 | ||
90 | 211 | then true | |
91 | 212 | else (addressFromPublicKey(tx.senderPublicKey) == holdingsAddress)) | |
92 | 213 | then true | |
93 | - | else (addressFromPublicKey(tx.senderPublicKey) == | |
214 | + | else (addressFromPublicKey(tx.senderPublicKey) == dappAddress) | |
94 | 215 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let COLS = 1024 | |
5 | 5 | ||
6 | - | let | |
6 | + | let ROWS = 1024 | |
7 | 7 | ||
8 | - | let | |
8 | + | let nftDomain = "https://nft.gridgang.io/" | |
9 | 9 | ||
10 | - | let | |
10 | + | let addOwnerAndAmountFunc = "addOwnerAndAmount" | |
11 | 11 | ||
12 | - | let | |
12 | + | let DEBUG = true | |
13 | 13 | ||
14 | - | let | |
14 | + | let minForSaleWavlets = 100000000 | |
15 | 15 | ||
16 | - | let | |
16 | + | let minPurchasePrice = 1000000 | |
17 | 17 | ||
18 | - | @Callable(i) | |
19 | - | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)] | |
18 | + | let dapp = "3MvUyzQxNGmwExAcKdhojfKem3XwkXdkByH" | |
20 | 19 | ||
20 | + | let dappAddress = Address(fromBase58String(dapp)) | |
21 | + | ||
22 | + | let holdingsPublicKey = "2eixqLDKJ5kjuY8imH4HG2FBJduT6QsjxLLch1iaAadx" | |
23 | + | ||
24 | + | let holdings = "3MpFtcdhaB66NB38tW2APSiaVqaAoWoPvRJ" | |
25 | + | ||
26 | + | let holdingsAddress = Address(fromBase58String(holdings)) | |
27 | + | ||
28 | + | func getAssetName (x,y) = { | |
29 | + | let name = ((x + ",") + y) | |
30 | + | name | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func getDataKeyPrefix (x,y,gen) = { | |
35 | + | let name = getAssetName(x, y) | |
36 | + | let prefix = ((name + ",") + gen) | |
37 | + | prefix | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | func getXYGenFromName (name) = { | |
42 | + | let parts = split(name, ",") | |
43 | + | let tuple = $Tuple3(parts[0], parts[1], parts[2]) | |
44 | + | tuple | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | func getDataKeyPrefixFromAssetName (name) = { | |
49 | + | let $t010011041 = getXYGenFromName(name) | |
50 | + | let x = $t010011041._1 | |
51 | + | let y = $t010011041._2 | |
52 | + | let gen = $t010011041._3 | |
53 | + | let prefix = getDataKeyPrefix(x, y, gen) | |
54 | + | prefix | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func claimSquare (x,y,gen,ownerId,transactionId) = { | |
59 | + | let resolvedXStr = x | |
60 | + | let resolvedYStr = y | |
61 | + | let resolvedGenStr = gen | |
62 | + | let assetName = getAssetName(resolvedXStr, resolvedYStr) | |
63 | + | let assetUrl = ((nftDomain + transactionId) + ".png") | |
64 | + | let asset = Issue(((assetName + ",") + resolvedGenStr), assetUrl, 1, 0, false) | |
65 | + | let assetId = calculateAssetId(asset) | |
66 | + | let dataKeyPrefix = getDataKeyPrefix(resolvedXStr, resolvedYStr, gen) | |
67 | + | $Tuple4(asset, assetId, assetUrl, dataKeyPrefix) | |
68 | + | } | |
21 | 69 | ||
22 | 70 | ||
23 | 71 | @Callable(i) | |
24 | - | func revokeForSale (assetId) = { | |
25 | - | let callerId = toBase58String(i.caller.bytes) | |
26 | - | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
72 | + | func purchase (x,y,userText) = { | |
73 | + | let prefix = getDataKeyPrefix(x, y, "1") | |
74 | + | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
75 | + | let existingAssetId = match getString(this, (prefix + "_assetId")) { | |
27 | 76 | case _: Unit => | |
28 | 77 | "unset" | |
29 | - | case | |
30 | - | | |
78 | + | case err: String => | |
79 | + | throw("This square has already been purchased") | |
31 | 80 | case _ => | |
32 | 81 | throw("Match error") | |
33 | 82 | } | |
34 | - | if ((callerId != ownerId)) | |
35 | - | then throw("Owners do not match") | |
36 | - | else [StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0), ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
83 | + | if ((minPurchasePrice > paymentAmount)) | |
84 | + | then throw((("You need to send at least " + toString(minPurchasePrice)) + "WAVLETS to purchase a square")) | |
85 | + | else { | |
86 | + | let ownerId = toBase58String(i.caller.bytes) | |
87 | + | let transactionId = toBase58String(i.transactionId) | |
88 | + | let $t022332328 = claimSquare(x, y, "1", ownerId, transactionId) | |
89 | + | let asset = $t022332328._1 | |
90 | + | let assetId = $t022332328._2 | |
91 | + | let assetUrl = $t022332328._3 | |
92 | + | let dataKeyPrefix = $t022332328._4 | |
93 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry((ownerId + "_handle"), userText), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(i.caller, 1, assetId)] | |
94 | + | } | |
37 | 95 | } | |
38 | 96 | ||
39 | 97 | ||
40 | 98 | ||
41 | 99 | @Callable(i) | |
42 | - | func buyFromHoldings (assetId,userText) = { | |
43 | - | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
44 | - | case _: Unit => | |
45 | - | "unset" | |
46 | - | case x: String => | |
47 | - | x | |
100 | + | func autoBuy (x,y) = { | |
101 | + | let callerId = toBase58String(i.caller.bytes) | |
102 | + | if (if ((callerId != holdings)) | |
103 | + | then (callerId != dapp) | |
104 | + | else false) | |
105 | + | then throw("This can only be triggering internally") | |
106 | + | else { | |
107 | + | let transactionId = toBase58String(i.transactionId) | |
108 | + | let $t029553051 = claimSquare(x, y, "1", holdings, transactionId) | |
109 | + | let asset = $t029553051._1 | |
110 | + | let assetId = $t029553051._2 | |
111 | + | let assetUrl = $t029553051._3 | |
112 | + | let dataKeyPrefix = $t029553051._4 | |
113 | + | let assetIdStr = toBase58String(assetId) | |
114 | + | let res = invoke(holdingsAddress, addOwnerAndAmountFunc, [holdings, assetIdStr, 3], [AttachedPayment(unit, 0)]) | |
115 | + | if ((res == res)) | |
116 | + | then [asset, StringEntry((dataKeyPrefix + "_assetId"), assetIdStr), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), holdings), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(holdingsAddress, 1, assetId)] | |
117 | + | else throw("Strict value is not equal to itself.") | |
118 | + | } | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(i) | |
124 | + | func promotionPurchase (x,y,desinationAddress) = { | |
125 | + | let callerId = toBase58String(i.caller.bytes) | |
126 | + | if ((callerId != holdings)) | |
127 | + | then throw("This can only be triggering internally") | |
128 | + | else { | |
129 | + | let transactionId = toBase58String(i.transactionId) | |
130 | + | let $t038073912 = claimSquare(x, y, "1", desinationAddress, transactionId) | |
131 | + | let asset = $t038073912._1 | |
132 | + | let assetId = $t038073912._2 | |
133 | + | let assetUrl = $t038073912._3 | |
134 | + | let dataKeyPrefix = $t038073912._4 | |
135 | + | let assetIdStr = toBase58String(assetId) | |
136 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), assetIdStr), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), desinationAddress), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(Address(fromBase58String(desinationAddress)), 1, assetId)] | |
137 | + | } | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | @Callable(i) | |
143 | + | func evolve (x,y,gen,ownerId) = { | |
144 | + | let callerId = toBase58String(i.caller.bytes) | |
145 | + | if ((callerId != holdings)) | |
146 | + | then throw("This can only be triggering internally") | |
147 | + | else { | |
148 | + | let transactionId = toBase58String(i.transactionId) | |
149 | + | let $t046384733 = claimSquare(x, y, gen, ownerId, transactionId) | |
150 | + | let asset = $t046384733._1 | |
151 | + | let assetId = $t046384733._2 | |
152 | + | let assetUrl = $t046384733._3 | |
153 | + | let dataKeyPrefix = $t046384733._4 | |
154 | + | [asset, StringEntry((dataKeyPrefix + "_assetId"), toBase58String(assetId)), StringEntry((dataKeyPrefix + "_asset"), assetUrl), StringEntry((dataKeyPrefix + "_owner"), ownerId), StringEntry(transactionId, dataKeyPrefix), ScriptTransfer(Address(fromBase58String(ownerId)), 1, assetId)] | |
155 | + | } | |
156 | + | } | |
157 | + | ||
158 | + | ||
159 | + | ||
160 | + | @Callable(i) | |
161 | + | func putForSale (assetId,amount) = { | |
162 | + | let callerId = toBase58String(i.caller.bytes) | |
163 | + | let assetData = match assetInfo(fromBase58String(assetId)) { | |
164 | + | case ass: Asset => | |
165 | + | ass | |
48 | 166 | case _ => | |
49 | - | throw(" | |
167 | + | throw("Asset not found") | |
50 | 168 | } | |
51 | - | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
52 | - | let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) { | |
53 | - | case _: Unit => | |
54 | - | 0 | |
55 | - | case x: Int => | |
56 | - | x | |
169 | + | let dataPrefix = getDataKeyPrefixFromAssetName(assetData.name) | |
170 | + | let ownerId = match getString(this, (dataPrefix + "_owner")) { | |
171 | + | case s: String => | |
172 | + | s | |
57 | 173 | case _ => | |
58 | - | throw(" | |
174 | + | throw("Owner not found in data") | |
59 | 175 | } | |
60 | - | if (if ((ownerId == "unset")) | |
61 | - | then true | |
62 | - | else (ownerId == "")) | |
63 | - | then throw("Original owner not found ") | |
64 | - | else if (if ((amount == 0)) | |
65 | - | then true | |
66 | - | else (amount > paymentAmount)) | |
67 | - | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
176 | + | if ((minForSaleWavlets > amount)) | |
177 | + | then throw("Amount needs to be more than 1 wave") | |
178 | + | else if (if ((callerId != ownerId)) | |
179 | + | then (callerId != holdings) | |
180 | + | else false) | |
181 | + | then throw("You are not able to put this asset up for sale") | |
68 | 182 | else { | |
69 | - | let callerId = toBase58String(i.caller.bytes) | |
70 | - | let res = invoke(dAppAddress, "finalizeSale", [assetId, callerId, userText], [AttachedPayment(unit, 0)]) | |
183 | + | let res = invoke(holdingsAddress, addOwnerAndAmountFunc, [callerId, assetId, amount], [AttachedPayment(unit, 0)]) | |
71 | 184 | if ((res == res)) | |
72 | - | then { | |
73 | - | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)] | |
74 | - | if ((ownerId != holdingsAddressStr)) | |
75 | - | then { | |
76 | - | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
77 | - | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
78 | - | let ownerAddress = Address(fromBase58String(ownerId)) | |
79 | - | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
80 | - | } | |
81 | - | else transfer | |
82 | - | } | |
185 | + | then [ScriptTransfer(holdingsAddress, 1, fromBase58String(assetId))] | |
83 | 186 | else throw("Strict value is not equal to itself.") | |
84 | 187 | } | |
188 | + | } | |
189 | + | ||
190 | + | ||
191 | + | ||
192 | + | @Callable(i) | |
193 | + | func finalizeSale (assetId,ownerId,userText) = { | |
194 | + | let callerId = toBase58String(i.caller.bytes) | |
195 | + | if ((callerId != holdings)) | |
196 | + | then throw("This can only be triggering internally") | |
197 | + | else { | |
198 | + | let prefix = match assetInfo(fromBase58String(assetId)) { | |
199 | + | case asset: Asset => | |
200 | + | asset.name | |
201 | + | case _ => | |
202 | + | throw("Can't find asset") | |
203 | + | } | |
204 | + | [StringEntry((prefix + "_owner"), ownerId), StringEntry((ownerId + "_handle"), userText)] | |
205 | + | } | |
85 | 206 | } | |
86 | 207 | ||
87 | 208 | ||
88 | 209 | @Verifier(tx) | |
89 | 210 | func verify () = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
90 | 211 | then true | |
91 | 212 | else (addressFromPublicKey(tx.senderPublicKey) == holdingsAddress)) | |
92 | 213 | then true | |
93 | - | else (addressFromPublicKey(tx.senderPublicKey) == | |
214 | + | else (addressFromPublicKey(tx.senderPublicKey) == dappAddress) | |
94 | 215 |
github/deemru/w8io/169f3d6 55.24 ms ◑