tx · HcDAfdbXaXvidJmrYuxMnLurVgFjt2CGfbcmL4pox1Go

3MutmaPPwkdgnBpfTr6u6pkRt64xvKi4BQM:  -0.01000000 Waves

2019.07.02 12:11 [567577] smart account 3MutmaPPwkdgnBpfTr6u6pkRt64xvKi4BQM > SELF 0.00000000 Waves

{ "type": 13, "id": "HcDAfdbXaXvidJmrYuxMnLurVgFjt2CGfbcmL4pox1Go", "fee": 1000000, "feeAssetId": null, "timestamp": 1562058670541, "version": 1, "sender": "3MutmaPPwkdgnBpfTr6u6pkRt64xvKi4BQM", "senderPublicKey": "GLMpvCp5dFLe6JaLtqng1pAc8pnCMLTb8GFrMtEWcbKt", "proofs": [ "2Yuz7p7qS2mnJVNzTqFz8mABP62HJH3nzBFf5ThQR2AiC55zAL9zR8gyZULo4D7sCK1cTELAqPnXPBVsUcu9iMW" ], "script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAtvd25lclB1YktleQEAAAAg49TjMgtsnrBYu12Qlkj2fS/EVt/2a0kLbz4e5amujDcBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlAQAAABFnZXRWYWx1ZUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkBAAAADmdldE51bWJlckJ5S2V5AAAAAQkBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEFAAAABGl0ZW0BAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIAAAAEdXNlcgAAAARpdGVtCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAARpdGVtAgAAAAFfBQAAAAR1c2VyAgAA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0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ownerPubKey = base58'GLMpvCp5dFLe6JaLtqng1pAc8pnCMLTb8GFrMtEWcbKt'
5+
6+func getNumberByKey (key) = {
7+ let num = match getInteger(this, key) {
8+ case a: Int =>
9+ a
10+ case _ =>
11+ 0
12+ }
13+ num
14+ }
15+
16+
17+func getKeyItemPrice (item) = (item + "_price")
18+
19+
20+func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
21+
22+
23+func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
24+
25+
26+func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
27+
28+
29+@Callable(i)
30+func purchase (item) = {
31+ let pmt = extract(i.payment)
32+ if (isDefined(pmt.assetId))
33+ then throw("can use WAVES only at the moment")
34+ else {
35+ let customerAddress = toBase58String(i.caller.bytes)
36+ let price = getValueItemPrice(item)
37+ if ((price > pmt.amount))
38+ then throw("purchase amount cannot be less than item price")
39+ else if ((pmt.amount > price))
40+ then throw("purchase amount cannot be higher than item price")
41+ else WriteSet([DataEntry(getKeyUserItemCounter(customerAddress, item), (getValueUserItemCounter(customerAddress, item) + 1))])
42+ }
43+ }
44+
45+

github/deemru/w8io/169f3d6 
22.19 ms