tx · KCF2fX7EBAzrGinNGMZuUe5SWH8xZKfZSJVnW3dPzEE

3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7:  -0.01400000 Waves

2021.08.02 03:44 [1640007] smart account 3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7 > SELF 0.00000000 Waves

{ "type": 13, "id": "KCF2fX7EBAzrGinNGMZuUe5SWH8xZKfZSJVnW3dPzEE", "fee": 1400000, "feeAssetId": null, "timestamp": 1627865115960, "version": 2, "chainId": 84, "sender": "3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7", "senderPublicKey": "3tp5fNYyPi4jMnkf6s1k4kBqvJ7nm57SxzvLyi8RkxT2", "proofs": [ "3nqE19Ct9pZ5AEA6MVDGSJE68UZtFV4i9hVP9eKvzoMbbFY1neqSUBUieWo5o1sMTBC7DhSgY1yeeWV4PHDGQyez" ], "script": "base64:AAIEAAAAAAAAADsIAhIDCgEIEgYKBAgBCAESBwoFCAgBCAESAwoBCBIECgIICBIDCgEIEgQKAggIEgQKAggIEgUKAwgICAAAADUAAAAABE5PTkUCAAAABE5PTkUAAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhBUFBST1ZBTAIAAAAIYXBwcm92YWwAAAAACFJFSkVDVEVEAgAAAAhyZWplY3RlZAAAAAAIQUNDRVBURUQCAAAACGFjY2VwdGVkAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FAQAAAA9nZ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YXR1cwAAAAEFAAAABGl0ZW0FAAAACW5ld1N0YXR1cwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAQSXNzdWVUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5B/+iK6I=", "height": 1640007, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5vS2PiVGJw3MezycGfnJsvmtRN1v41KPP2AF8dwyW6kP Next: Ca54uLDM9RY2i7g3QrdYDWAomvZQEQaZjoMJoBvyRCzR Diff:
OldNewDifferences
1414 let VOTING = "voting"
1515
1616 let REVEAL = "reveal"
17+
18+let APPROVAL = "approval"
19+
20+let REJECTED = "rejected"
21+
22+let ACCEPTED = "accepted"
1723
1824 func getStringByKey (key) = match getString(this, key) {
1925 case a: String =>
5864 func getKeyItemExpireDate (item) = (item + "_expiredate")
5965
6066
67+func getKeyItemSoldCounter (item) = (item + "_sold")
68+
69+
6170 func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
6271
6372
7382 func getKeyVotesCount (item,vote) = ((item + "_res:") + vote)
7483
7584
76-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
85+func getKeySupplierBalance (supplier) = (supplier + "_balance")
7786
7887
79-func getKeyBalanceSupplier (account) = (account + "_balance")
88+func getPurchase (supplier,item,user) = ("purchase_" + toBase58String(sha256(toBytes(((((supplier + "_") + item) + "_") + user)))))
89+
90+
91+func getKeyPurchaseStatus (purchase) = (purchase + "_status")
92+
93+
94+func getKeyPurchaseItem (purchase) = (purchase + "_item")
95+
96+
97+func getKeyPurchaseSupplier (purchase) = (purchase + "_supplier")
98+
99+
100+func getKeyPurchaseUser (purchase) = (purchase + "_user")
101+
102+
103+func getKeyPurchaseAmount (purchase) = (purchase + "_amount")
104+
105+
106+func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp")
80107
81108
82109 func getKeyCoupon (assetId) = ("coupon_" + assetId)
85112 func getKeyCouponItem (coupon) = (coupon + "_item")
86113
87114
88-func getValueBalanceSupplier (account) = {
89- let supplierBalanceKey = getKeyBalanceSupplier(account)
90- match getInteger(this, supplierBalanceKey) {
91- case a: Int =>
92- a
93- case _ =>
94- 0
95- }
96- }
115+func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier))
97116
98117
99-func getValueUserItemCounter (user,item) = {
100- let userItemCounterKey = getKeyUserItemCounter(user, item)
101- match getInteger(this, userItemCounterKey) {
102- case a: Int =>
103- a
104- case _ =>
105- 0
106- }
107- }
118+func getValuePurchaseStatus (purchase) = getStringByKey(getKeyPurchaseStatus(purchase))
108119
109120
110-func getValueItemPrice (item) = {
111- let keyItemPrice = getKeyItemPrice(item)
112- getIntegerValue(this, keyItemPrice)
113- }
121+func getValuePurchaseItem (purchase) = getStringValue(this, getKeyPurchaseItem(purchase))
122+
123+
124+func getValuePurchaseSupplier (purchase) = getStringValue(this, getKeyPurchaseSupplier(purchase))
125+
126+
127+func getValuePurchaseUser (purchase) = getStringValue(this, getKeyPurchaseUser(purchase))
128+
129+
130+func getValuePurchaseAmount (purchase) = getIntegerValue(this, getKeyPurchaseAmount(purchase))
131+
132+
133+func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase))
134+
135+
136+func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item))
114137
115138
116139 func getValueItemSupplier (item) = getStringByKey(getKeyItemSupplier(item))
120143
121144
122145 func getValueItemTitle (item) = getStringByKey(getKeyItemTitle(item))
146+
147+
148+func getValueItemSoldCounter (item) = getIntegerByKey(getKeyItemSoldCounter(item))
123149
124150
125151 func getValueCommit (item,user) = getStringByKey(getKeyCommit(item, user))
202228 if (isDefined(pmt.assetId))
203229 then throw("You can buy tokens only with Waves tokens")
204230 else {
205- let userAddress = toBase58String(i.caller.bytes)
231+ let user = toBase58String(i.caller.bytes)
206232 let price = getValueItemPrice(item)
207233 let supplier = getValueItemSupplier(item)
208234 let expire = getValueItemExpireTime(item)
217243 else if ((supplier == NONE))
218244 then throw("Supplier does not exists")
219245 else {
220- let userItemCounter = getKeyUserItemCounter(userAddress, item)
221- let newValueUserItemCounter = (getValueUserItemCounter(userAddress, item) + 1)
222- let supplierBalanceKey = getKeyBalanceSupplier(supplier)
223- let newSupplierBalance = (getValueBalanceSupplier(supplier) + pmt.amount)
224- let coupon = getKeyCoupon(assetId)
225-[IntegerEntry(userItemCounter, newValueUserItemCounter), IntegerEntry(supplierBalanceKey, newSupplierBalance), StringEntry(getKeyCouponItem(coupon), item), ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
246+ let purchase = getPurchase(supplier, item, user)
247+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
248+ let keyPurchaseItem = getKeyPurchaseItem(purchase)
249+ let keyPurchaseSupplier = getKeyPurchaseSupplier(purchase)
250+ let keyPurchaseUser = getKeyPurchaseUser(purchase)
251+ let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
252+ let keyPurchaseTimestamp = getKeyPurchaseTimestamp(purchase)
253+[StringEntry(keyPurchaseStatus, APPROVAL), StringEntry(keyPurchaseItem, item), StringEntry(keyPurchaseSupplier, supplier), StringEntry(keyPurchaseUser, user), IntegerEntry(keyPurchaseAmount, pmt.amount), IntegerEntry(keyPurchaseTimestamp, lastBlock.timestamp)]
226254 }
227255 }
256+ }
257+
258+
259+
260+@Callable(i)
261+func rejectPurchase (purchase) = {
262+ let caller = toBase58String(i.caller.bytes)
263+ let status = getValuePurchaseStatus(purchase)
264+ let supplier = getValuePurchaseSupplier(purchase)
265+ let item = getValuePurchaseItem(purchase)
266+ if (if ((supplier == NONE))
267+ then true
268+ else (caller != supplier))
269+ then throw("Your are not the owner of this item")
270+ else if ((status != APPROVAL))
271+ then throw("You cannot reject this purchased")
272+ else {
273+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
274+ let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
275+ let keySupplierBalance = getKeySupplierBalance(supplier)
276+ let keyItemSoldCounter = getKeyItemSoldCounter(item)
277+ let user = getValuePurchaseUser(purchase)
278+ let amount = getValuePurchaseAmount(purchase)
279+ let supplierBalance = (getValueSupplierBalance(supplier) - amount)
280+ let itemSoldCounter = (getValueItemSoldCounter(item) - 1)
281+ let address = addressFromStringValue(user)
282+[StringEntry(keyPurchaseStatus, REJECTED), IntegerEntry(keyPurchaseAmount, 0), ScriptTransfer(address, amount, unit)]
283+ }
284+ }
285+
286+
287+
288+@Callable(i)
289+func acceptPurchase (purchase,couponAssetId) = {
290+ let caller = toBase58String(i.caller.bytes)
291+ let status = getValuePurchaseStatus(purchase)
292+ let supplier = getValuePurchaseSupplier(purchase)
293+ let item = getValuePurchaseItem(purchase)
294+ let expire = getValueItemExpireTime(item)
295+ if (if ((supplier == NONE))
296+ then true
297+ else (caller != supplier))
298+ then throw("Your are not the owner of this item")
299+ else if ((status != APPROVAL))
300+ then throw("You cannot reject this purchased")
301+ else if (if ((expire > 0))
302+ then (lastBlock.timestamp >= expire)
303+ else false)
304+ then throw("Coupon expired")
305+ else {
306+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
307+ let keySupplierBalance = getKeySupplierBalance(supplier)
308+ let keyItemSoldCounter = getKeyItemSoldCounter(item)
309+ let amount = getValuePurchaseAmount(purchase)
310+ let supplierBalance = (getValueSupplierBalance(supplier) + amount)
311+ let itemSoldCounter = (getValueItemSoldCounter(item) + 1)
312+ let user = getValuePurchaseUser(purchase)
313+ let address = addressFromStringValue(user)
314+[IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter), ScriptTransfer(address, 1, fromBase58String(couponAssetId))]
315+ }
228316 }
229317
230318
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "NONE"
55
66 let VOTERS = 3
77
88 let QUORUM = 2
99
1010 let FEATURED = "featured"
1111
1212 let DELISTED = "delisted"
1313
1414 let VOTING = "voting"
1515
1616 let REVEAL = "reveal"
17+
18+let APPROVAL = "approval"
19+
20+let REJECTED = "rejected"
21+
22+let ACCEPTED = "accepted"
1723
1824 func getStringByKey (key) = match getString(this, key) {
1925 case a: String =>
2026 a
2127 case _ =>
2228 NONE
2329 }
2430
2531
2632 func getIntegerByKey (key) = match getInteger(this, key) {
2733 case a: Int =>
2834 a
2935 case _ =>
3036 0
3137 }
3238
3339
3440 func getKeySupplierAccount (account) = (account + "_account")
3541
3642
3743 func getSupplierAccount (account) = getStringByKey(getKeySupplierAccount(account))
3844
3945
4046 func getKeyItem (supplier,title) = {
4147 let supplierTitle = (supplier + title)
4248 ("item_" + toBase58String(sha256(toBytes(supplierTitle))))
4349 }
4450
4551
4652 func getKeyItemSupplier (item) = (item + "_owner")
4753
4854
4955 func getKeyItemTitle (item) = (item + "_title")
5056
5157
5258 func getKeyItemPrice (item) = (item + "_price")
5359
5460
5561 func getKeyItemData (item) = (item + "_data")
5662
5763
5864 func getKeyItemExpireDate (item) = (item + "_expiredate")
5965
6066
67+func getKeyItemSoldCounter (item) = (item + "_sold")
68+
69+
6170 func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
6271
6372
6473 func getKeyCommitsCount (item) = (item + "_cmtcnt")
6574
6675
6776 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
6877
6978
7079 func getKeyItemStatus (item) = (item + "_status")
7180
7281
7382 func getKeyVotesCount (item,vote) = ((item + "_res:") + vote)
7483
7584
76-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
85+func getKeySupplierBalance (supplier) = (supplier + "_balance")
7786
7887
79-func getKeyBalanceSupplier (account) = (account + "_balance")
88+func getPurchase (supplier,item,user) = ("purchase_" + toBase58String(sha256(toBytes(((((supplier + "_") + item) + "_") + user)))))
89+
90+
91+func getKeyPurchaseStatus (purchase) = (purchase + "_status")
92+
93+
94+func getKeyPurchaseItem (purchase) = (purchase + "_item")
95+
96+
97+func getKeyPurchaseSupplier (purchase) = (purchase + "_supplier")
98+
99+
100+func getKeyPurchaseUser (purchase) = (purchase + "_user")
101+
102+
103+func getKeyPurchaseAmount (purchase) = (purchase + "_amount")
104+
105+
106+func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp")
80107
81108
82109 func getKeyCoupon (assetId) = ("coupon_" + assetId)
83110
84111
85112 func getKeyCouponItem (coupon) = (coupon + "_item")
86113
87114
88-func getValueBalanceSupplier (account) = {
89- let supplierBalanceKey = getKeyBalanceSupplier(account)
90- match getInteger(this, supplierBalanceKey) {
91- case a: Int =>
92- a
93- case _ =>
94- 0
95- }
96- }
115+func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier))
97116
98117
99-func getValueUserItemCounter (user,item) = {
100- let userItemCounterKey = getKeyUserItemCounter(user, item)
101- match getInteger(this, userItemCounterKey) {
102- case a: Int =>
103- a
104- case _ =>
105- 0
106- }
107- }
118+func getValuePurchaseStatus (purchase) = getStringByKey(getKeyPurchaseStatus(purchase))
108119
109120
110-func getValueItemPrice (item) = {
111- let keyItemPrice = getKeyItemPrice(item)
112- getIntegerValue(this, keyItemPrice)
113- }
121+func getValuePurchaseItem (purchase) = getStringValue(this, getKeyPurchaseItem(purchase))
122+
123+
124+func getValuePurchaseSupplier (purchase) = getStringValue(this, getKeyPurchaseSupplier(purchase))
125+
126+
127+func getValuePurchaseUser (purchase) = getStringValue(this, getKeyPurchaseUser(purchase))
128+
129+
130+func getValuePurchaseAmount (purchase) = getIntegerValue(this, getKeyPurchaseAmount(purchase))
131+
132+
133+func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase))
134+
135+
136+func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item))
114137
115138
116139 func getValueItemSupplier (item) = getStringByKey(getKeyItemSupplier(item))
117140
118141
119142 func getValueItemExpireTime (item) = getIntegerByKey(getKeyItemExpireDate(item))
120143
121144
122145 func getValueItemTitle (item) = getStringByKey(getKeyItemTitle(item))
146+
147+
148+func getValueItemSoldCounter (item) = getIntegerByKey(getKeyItemSoldCounter(item))
123149
124150
125151 func getValueCommit (item,user) = getStringByKey(getKeyCommit(item, user))
126152
127153
128154 func getValueCommitsCount (item) = getIntegerByKey(getKeyCommitsCount(item))
129155
130156
131157 func getValueReveal (item,user) = getStringByKey(getKeyReveal(item, user))
132158
133159
134160 func getValueItemStatus (item) = getStringByKey(getKeyItemStatus(item))
135161
136162
137163 func getValueVotesCount (item,vote) = getIntegerByKey(getKeyVotesCount(item, vote))
138164
139165
140166 @Callable(i)
141167 func registerSupplier (data) = {
142168 let supplier = toBase58String(i.caller.bytes)
143169 let account = getSupplierAccount(supplier)
144170 if ((account != NONE))
145171 then throw("This address has already registred as supplier")
146172 else [StringEntry(getKeySupplierAccount(supplier), data)]
147173 }
148174
149175
150176
151177 @Callable(i)
152178 func addItem (title,price,data,expire) = {
153179 let supplier = toBase58String(i.caller.bytes)
154180 let account = getSupplierAccount(supplier)
155181 let item = getKeyItem(supplier, title)
156182 if ((account == NONE))
157183 then throw("You should register as supplier to add an item")
158184 else if ((0 >= price))
159185 then throw("Purchase amount cannot be less than item price")
160186 else if ((getValueItemSupplier(item) != NONE))
161187 then throw("An item already exists")
162188 else [StringEntry(getKeyItemSupplier(item), supplier), StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)]
163189 }
164190
165191
166192
167193 @Callable(i)
168194 func updateItem (item,title,price,data,expire) = {
169195 let supplier = toBase58String(i.caller.bytes)
170196 let account = getSupplierAccount(supplier)
171197 let itemSupplier = getValueItemSupplier(item)
172198 if ((account == NONE))
173199 then throw("You should register as supplier to remove an item")
174200 else if (if ((item == NONE))
175201 then true
176202 else (supplier != itemSupplier))
177203 then throw(("You don't owned item " + item))
178204 else [StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)]
179205 }
180206
181207
182208
183209 @Callable(i)
184210 func removeItem (item) = {
185211 let supplier = toBase58String(i.caller.bytes)
186212 let account = getSupplierAccount(supplier)
187213 let itemSupplier = getValueItemSupplier(item)
188214 if ((account == NONE))
189215 then throw("You should register as supplier to remove an item")
190216 else if (if ((item == NONE))
191217 then true
192218 else (supplier != itemSupplier))
193219 then throw(("You don't owned item " + item))
194220 else [DeleteEntry(getKeyItemSupplier(item)), DeleteEntry(getKeyItemTitle(item)), DeleteEntry(getKeyItemPrice(item)), DeleteEntry(getKeyItemData(item)), DeleteEntry(getKeyItemExpireDate(item))]
195221 }
196222
197223
198224
199225 @Callable(i)
200226 func purchase (item,assetId) = {
201227 let pmt = i.payments[0]
202228 if (isDefined(pmt.assetId))
203229 then throw("You can buy tokens only with Waves tokens")
204230 else {
205- let userAddress = toBase58String(i.caller.bytes)
231+ let user = toBase58String(i.caller.bytes)
206232 let price = getValueItemPrice(item)
207233 let supplier = getValueItemSupplier(item)
208234 let expire = getValueItemExpireTime(item)
209235 if (if ((expire > 0))
210236 then (lastBlock.timestamp >= expire)
211237 else false)
212238 then throw("Coupon expired")
213239 else if ((price > pmt.amount))
214240 then throw("Purchase amount cannot be less than item price")
215241 else if ((pmt.amount > price))
216242 then throw("Purchase amount cannot be higher than item price")
217243 else if ((supplier == NONE))
218244 then throw("Supplier does not exists")
219245 else {
220- let userItemCounter = getKeyUserItemCounter(userAddress, item)
221- let newValueUserItemCounter = (getValueUserItemCounter(userAddress, item) + 1)
222- let supplierBalanceKey = getKeyBalanceSupplier(supplier)
223- let newSupplierBalance = (getValueBalanceSupplier(supplier) + pmt.amount)
224- let coupon = getKeyCoupon(assetId)
225-[IntegerEntry(userItemCounter, newValueUserItemCounter), IntegerEntry(supplierBalanceKey, newSupplierBalance), StringEntry(getKeyCouponItem(coupon), item), ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
246+ let purchase = getPurchase(supplier, item, user)
247+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
248+ let keyPurchaseItem = getKeyPurchaseItem(purchase)
249+ let keyPurchaseSupplier = getKeyPurchaseSupplier(purchase)
250+ let keyPurchaseUser = getKeyPurchaseUser(purchase)
251+ let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
252+ let keyPurchaseTimestamp = getKeyPurchaseTimestamp(purchase)
253+[StringEntry(keyPurchaseStatus, APPROVAL), StringEntry(keyPurchaseItem, item), StringEntry(keyPurchaseSupplier, supplier), StringEntry(keyPurchaseUser, user), IntegerEntry(keyPurchaseAmount, pmt.amount), IntegerEntry(keyPurchaseTimestamp, lastBlock.timestamp)]
226254 }
227255 }
256+ }
257+
258+
259+
260+@Callable(i)
261+func rejectPurchase (purchase) = {
262+ let caller = toBase58String(i.caller.bytes)
263+ let status = getValuePurchaseStatus(purchase)
264+ let supplier = getValuePurchaseSupplier(purchase)
265+ let item = getValuePurchaseItem(purchase)
266+ if (if ((supplier == NONE))
267+ then true
268+ else (caller != supplier))
269+ then throw("Your are not the owner of this item")
270+ else if ((status != APPROVAL))
271+ then throw("You cannot reject this purchased")
272+ else {
273+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
274+ let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
275+ let keySupplierBalance = getKeySupplierBalance(supplier)
276+ let keyItemSoldCounter = getKeyItemSoldCounter(item)
277+ let user = getValuePurchaseUser(purchase)
278+ let amount = getValuePurchaseAmount(purchase)
279+ let supplierBalance = (getValueSupplierBalance(supplier) - amount)
280+ let itemSoldCounter = (getValueItemSoldCounter(item) - 1)
281+ let address = addressFromStringValue(user)
282+[StringEntry(keyPurchaseStatus, REJECTED), IntegerEntry(keyPurchaseAmount, 0), ScriptTransfer(address, amount, unit)]
283+ }
284+ }
285+
286+
287+
288+@Callable(i)
289+func acceptPurchase (purchase,couponAssetId) = {
290+ let caller = toBase58String(i.caller.bytes)
291+ let status = getValuePurchaseStatus(purchase)
292+ let supplier = getValuePurchaseSupplier(purchase)
293+ let item = getValuePurchaseItem(purchase)
294+ let expire = getValueItemExpireTime(item)
295+ if (if ((supplier == NONE))
296+ then true
297+ else (caller != supplier))
298+ then throw("Your are not the owner of this item")
299+ else if ((status != APPROVAL))
300+ then throw("You cannot reject this purchased")
301+ else if (if ((expire > 0))
302+ then (lastBlock.timestamp >= expire)
303+ else false)
304+ then throw("Coupon expired")
305+ else {
306+ let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
307+ let keySupplierBalance = getKeySupplierBalance(supplier)
308+ let keyItemSoldCounter = getKeyItemSoldCounter(item)
309+ let amount = getValuePurchaseAmount(purchase)
310+ let supplierBalance = (getValueSupplierBalance(supplier) + amount)
311+ let itemSoldCounter = (getValueItemSoldCounter(item) + 1)
312+ let user = getValuePurchaseUser(purchase)
313+ let address = addressFromStringValue(user)
314+[IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter), ScriptTransfer(address, 1, fromBase58String(couponAssetId))]
315+ }
228316 }
229317
230318
231319
232320 @Callable(i)
233321 func voteCommit (item,hash) = {
234322 let user = toBase58String(i.caller.bytes)
235323 let commitsCount = getValueCommitsCount(item)
236324 let status = getValueItemStatus(item)
237325 if ((commitsCount >= VOTERS))
238326 then throw("Reached max number of voters")
239327 else if ((getValueCommit(item, user) != NONE))
240328 then throw("You voted already")
241329 else if ((getKeyItemSupplier(item) == NONE))
242330 then throw("Item does not exists")
243331 else if (if ((status != NONE))
244332 then (status != VOTING)
245333 else false)
246334 then throw("Voting is not active for this item now")
247335 else {
248336 let newStatus = if ((commitsCount == VOTERS))
249337 then REVEAL
250338 else VOTING
251339 [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commitsCount + 1)), StringEntry(getKeyItemStatus(item), newStatus)]
252340 }
253341 }
254342
255343
256344
257345 @Callable(i)
258346 func voteReveal (item,vote,salt) = {
259347 let user = toBase58String(i.caller.bytes)
260348 let status = getValueItemStatus(item)
261349 let newVotesCount = (getValueVotesCount(item, vote) + 1)
262350 let saltedVote = toBase58String(sha256(toBytes(((item + vote) + salt))))
263351 if ((saltedVote != getValueCommit(item, user)))
264352 then throw("Reveal data is not valid")
265353 else if ((VOTERS > getValueCommitsCount(item)))
266354 then throw("Max number of voters not reached")
267355 else if ((getValueReveal(item, user) != NONE))
268356 then throw("You voted already")
269357 else if (if ((status != VOTING))
270358 then (status != REVEAL)
271359 else false)
272360 then throw("Voting is not active for this item now")
273361 else if (if ((vote != FEATURED))
274362 then (vote != DELISTED)
275363 else false)
276364 then throw("Provided voting option is incorrect")
277365 else {
278366 let newStatus = if ((newVotesCount >= QUORUM))
279367 then vote
280368 else REVEAL
281369 [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVotesCount(item, user), newVotesCount), StringEntry(getKeyItemStatus(item), newStatus)]
282370 }
283371 }
284372
285373
286374 @Verifier(tx)
287375 func verify () = match tx {
288376 case t: SetScriptTransaction =>
289377 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
290378 case t: IssueTransaction =>
291379 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
292380 case t: TransferTransaction =>
293381 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
294382 case _ =>
295383 false
296384 }
297385

github/deemru/w8io/026f985 
61.88 ms