tx · b9niW7Wp4DXFaiyp3ZKavC26bKpupahBrbcUfu3TdVh

3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt:  -0.01400000 Waves

2020.11.18 16:11 [1270833] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves

{ "type": 13, "id": "b9niW7Wp4DXFaiyp3ZKavC26bKpupahBrbcUfu3TdVh", "fee": 1400000, "feeAssetId": null, "timestamp": 1605705163035, "version": 2, "chainId": 84, "sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt", "senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp", "proofs": [ "2to6Wfvw1Hdxs3Bksb1JJbRCyHFUo8bhx5mGuo3riGfZ3GqbgcM8si6MpKrHHhiEKePEkhB5FXFmsTXQ5So8Xf7o" ], "script": "base64:AAIEAAAAAAAAAA4IAhIDCgEIEgUKAwgBCAAAAAAAAAACAAAAAWkBAAAACHB1cmNoYXNlAAAAAQAAAAhpdGVtTmFtZQQAAAAHcGF5bWVudAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCQAAAgAAAAECAAAAF09ubHkgV2F2ZXMgYXJlIGFjY2VwdGVkBAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAhpdGVtTmFtZQIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwCQAAaAAAAAIFAAAAAWEAAAAAAAX14QAJAAACAAAAAQIAAAAOSXRlbSBub3QgZm91bmQDCQAAZgAAAAIF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AAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAAA2tleQIAAAAGX3ByaWNlBQAAAAVwcmljZQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIFAAAAA2tleQIAAAAFX2RhdGEFAAAABGRhdGEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAGiniFNA==", "height": 1270833, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CnaDhKVuCwogAt2eriKp8rAzajAkbeLX6Fsu4yXRjAoX Next: EH3rjfx3jQY3oymHJnWF263qfCuqGB6a9BsYjwNEikZv Diff:
OldNewDifferences
3232 let key = ("item_" + toBase58String(sha256(toBytes((supplierAddress + title)))))
3333 if ((0 >= price))
3434 then throw("Price cannot be lower than 0")
35- else if ((getStringValue(this, key) != "none"))
35+ else if (isDefined(getStringValue(this, key)))
3636 then throw("Item exists")
3737 else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)]
3838 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 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)
1313 let price = match getInteger(this, (itemName + "_coupon_price")) {
1414 case a: Int =>
1515 (a * 100000000)
1616 case _ =>
1717 throw("Item not found")
1818 }
1919 if ((price > payment.amount))
2020 then throw("Purchase amount is too low")
2121 else if ((payment.amount > price))
2222 then throw("Purchase amount is too high")
2323 else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)]
2424 }
2525 }
2626
2727
2828
2929 @Callable(i)
3030 func addItem (title,price,data) = {
3131 let supplierAddress = toBase58String(i.caller.bytes)
3232 let key = ("item_" + toBase58String(sha256(toBytes((supplierAddress + title)))))
3333 if ((0 >= price))
3434 then throw("Price cannot be lower than 0")
35- else if ((getStringValue(this, key) != "none"))
35+ else if (isDefined(getStringValue(this, key)))
3636 then throw("Item exists")
3737 else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)]
3838 }
3939
4040
4141 @Verifier(tx)
4242 func verify () = true
4343

github/deemru/w8io/026f985 
35.17 ms