tx · FwBsK5DWmkqsmVoPF8WnTfm6WcvDYUd7YbCmEBgbbUGH

3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt:  -0.01400000 Waves

2020.11.18 14:59 [1270766] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves

{ "type": 13, "id": "FwBsK5DWmkqsmVoPF8WnTfm6WcvDYUd7YbCmEBgbbUGH", "fee": 1400000, "feeAssetId": null, "timestamp": 1605700768981, "version": 2, "chainId": 84, "sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt", "senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp", "proofs": [ "4bZQMZPA8o4xA5EG6m9G4WPe9WLUCp6XFiG6DFVWrXBM74VVSBRVRA1Ta73FSU4FBYnhcXeUveobHJAeUgx3dpcU" ], "script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAABAAAACGl0ZW1OYW1lBAAAAAdwYXltZW50CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAXT25seSBXYXZlcyBhcmUgYWNjZXB0ZWQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAACGl0ZW1OYW1lAgAAAA1fY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAJAABoAAAAAgUAAAABYQAAAAAABfXhAAkAAAIAAAABAgAAAA5JdGVtIG5vdCBmb3VuZAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAAdwYXltZW50AAAABmFtb3VudAkAAAIAAAABAgAAABpQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGxvdwMJAABmAAAAAggFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAABtQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGhpZ2gJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAB9zdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MCAAAABHRydWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAecHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABozLFnE=", "height": 1270766, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Cdf882AQtM9hiAdb5A5EaDaXwKAzPvVqfNboYCnyXXGz Next: CnaDhKVuCwogAt2eriKp8rAzajAkbeLX6Fsu4yXRjAoX Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (itemName) = {
88 let payment = value(i.payments[0])
99 if (isDefined(payment.assetId))
1010 then throw("Only Waves are accepted")
1111 else {
1212 let customerAddress = toBase58String(i.caller.bytes)
13- let price = match getInteger(this, "item_A_coupon_price") {
13+ let price = match getInteger(this, (itemName + "_coupon_price")) {
1414 case a: Int =>
1515 (a * 100000000)
1616 case _ =>
17- 0
17+ throw("Item not found")
1818 }
19- if ((payment.amount == 0))
20- then throw("Purchase amount is 0")
21- else if ((price > payment.amount))
22- then throw("Purchase amount is too low")
23- else if ((payment.amount > price))
24- then throw("Purchase amount is too high")
25- else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)]
19+ if ((price > payment.amount))
20+ then throw("Purchase amount is too low")
21+ else if ((payment.amount > price))
22+ then throw("Purchase amount is too high")
23+ else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)]
2624 }
2725 }
2826
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func purchase () = {
7+func purchase (itemName) = {
88 let payment = value(i.payments[0])
99 if (isDefined(payment.assetId))
1010 then throw("Only Waves are accepted")
1111 else {
1212 let customerAddress = toBase58String(i.caller.bytes)
13- let price = match getInteger(this, "item_A_coupon_price") {
13+ let price = match getInteger(this, (itemName + "_coupon_price")) {
1414 case a: Int =>
1515 (a * 100000000)
1616 case _ =>
17- 0
17+ throw("Item not found")
1818 }
19- if ((payment.amount == 0))
20- then throw("Purchase amount is 0")
21- else if ((price > payment.amount))
22- then throw("Purchase amount is too low")
23- else if ((payment.amount > price))
24- then throw("Purchase amount is too high")
25- else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)]
19+ if ((price > payment.amount))
20+ then throw("Purchase amount is too low")
21+ else if ((payment.amount > price))
22+ then throw("Purchase amount is too high")
23+ else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)]
2624 }
2725 }
2826
2927
3028 @Verifier(tx)
3129 func verify () = true
3230

github/deemru/w8io/026f985 
23.44 ms