tx · CDrGp3tfVNxyYV3JPZk3cWUZU7FpeWnWjrgYBsifJ947

3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc:  -0.01400000 Waves

2019.09.19 18:58 [683383] smart account 3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc > SELF 0.00000000 Waves

{ "type": 13, "id": "CDrGp3tfVNxyYV3JPZk3cWUZU7FpeWnWjrgYBsifJ947", "fee": 1400000, "feeAssetId": null, "timestamp": 1568908725404, "version": 1, "sender": "3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc", "senderPublicKey": "Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY", "proofs": [ "5Xk2gmpjV57qEwowDnUE46mpMdbLMrJ5qqEYDWiVJuASbQ5np6kzMCVG6mjLv24Tugie6KcZ4JgyFKTW3D7Rwb5e" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAA5vd25lclB1YmxpY0tleQEAAAAgkTEnTdeol7uGSzlcY9XCaZJBCT/vNHbkSFPcfsdd2lcAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsd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dHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgZk2h5V", "chainId": 84, "height": 683383, "spentComplexity": 0 } View: original | compacted Prev: 6cqELvDuNMW7h4VrTaZ6wDRvL2oMAgBdH9CUjj1Bt2pq Next: GHZBcozPb7Ne2atSBsj79fYhzJmAZ1b64DUjrDvc2B9j Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY'
5+
6+let NONE = "none"
7+
8+func getNumberByKey (key) = {
9+ let num = match getInteger(this, key) {
10+ case a: Int =>
11+ a
12+ case _ =>
13+ 0
14+ }
15+ num
16+ }
17+
18+
19+func getStrByKey (key) = {
20+ let str = match getString(this, key) {
21+ case a: String =>
22+ a
23+ case _ =>
24+ NONE
25+ }
26+ str
27+ }
28+
29+
30+func getKeyItemPrice (item) = (item + "_price")
31+
32+
33+func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
34+
35+
36+func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
37+
38+
39+func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
40+
41+
42+func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
43+
44+
45+func getKeyItemData (item) = (item + "_data")
46+
47+
48+func getKeyItemSupplier (item) = (item + "_owner")
49+
50+
51+func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
52+
53+
54+func getKeyBalanceSupplier (account) = (account + "_balance")
55+
56+
57+func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
58+
59+
60+@Callable(i)
61+func addItem (title,price,data) = {
62+ let supplierAddress = toBase58String(i.caller.bytes)
63+ let item = getKeyItem(supplierAddress, title)
64+ if ((0 >= price))
65+ then throw("purchase amount cannot be less than item price")
66+ else if ((getValueItemSupplier(item) != NONE))
67+ then throw("an item is already exist")
68+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
69+ }
70+
71+
572
673 @Callable(i)
774 func purchase (item) = {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY'
5+
6+let NONE = "none"
7+
8+func getNumberByKey (key) = {
9+ let num = match getInteger(this, key) {
10+ case a: Int =>
11+ a
12+ case _ =>
13+ 0
14+ }
15+ num
16+ }
17+
18+
19+func getStrByKey (key) = {
20+ let str = match getString(this, key) {
21+ case a: String =>
22+ a
23+ case _ =>
24+ NONE
25+ }
26+ str
27+ }
28+
29+
30+func getKeyItemPrice (item) = (item + "_price")
31+
32+
33+func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
34+
35+
36+func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
37+
38+
39+func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
40+
41+
42+func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
43+
44+
45+func getKeyItemData (item) = (item + "_data")
46+
47+
48+func getKeyItemSupplier (item) = (item + "_owner")
49+
50+
51+func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
52+
53+
54+func getKeyBalanceSupplier (account) = (account + "_balance")
55+
56+
57+func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
58+
59+
60+@Callable(i)
61+func addItem (title,price,data) = {
62+ let supplierAddress = toBase58String(i.caller.bytes)
63+ let item = getKeyItem(supplierAddress, title)
64+ if ((0 >= price))
65+ then throw("purchase amount cannot be less than item price")
66+ else if ((getValueItemSupplier(item) != NONE))
67+ then throw("an item is already exist")
68+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
69+ }
70+
71+
572
673 @Callable(i)
774 func purchase (item) = {
875 let pmt = extract(i.payment)
976 if (isDefined(pmt.assetId))
1077 then throw("can use WAVES only at the moment")
1178 else {
1279 let customerAddress = toBase58String(i.caller.bytes)
1380 let price = match getInteger(this, (("item_" + item) + "_coupon_price")) {
1481 case a: Int =>
1582 a
1683 case _ =>
1784 0
1885 }
1986 if ((price > pmt.amount))
2087 then throw("purchase amount cannot be less than item price")
2188 else if ((pmt.amount > price))
2289 then throw("purchase amount cannot be higher than item price")
2390 else WriteSet([DataEntry(((("status:purchase_item_" + item) + "_customer") + customerAddress), "confirmed"), DataEntry(((("price:purchase_item_" + item) + "_customer") + customerAddress), price)])
2491 }
2592 }
2693
2794
2895 @Verifier(tx)
2996 func verify () = match tx {
3097 case d: SetScriptTransaction =>
3198 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
3299 case d: DataTransaction =>
33100 true
34101 case _ =>
35102 true
36103 }
37104

github/deemru/w8io/026f985 
22.28 ms