tx · 9zkvzo8pJgcQaSPVWyMXXr2y8BDei9NygdLaKajvQJLN

3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR:  -0.01400000 Waves

2019.07.14 02:55 [584665] smart account 3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR > SELF 0.00000000 Waves

{ "type": 13, "id": "9zkvzo8pJgcQaSPVWyMXXr2y8BDei9NygdLaKajvQJLN", "fee": 1400000, "feeAssetId": null, "timestamp": 1563062168261, "version": 1, "sender": "3N7MT5t1Gmyb9tcpdoUrd47pxXtTkAcgLsR", "senderPublicKey": "Adn8NfJZ8ZXuWNMXb9VaY6X6kh6k6G3KMb1WQUesFUV", "proofs": [ "4dQ42jEWFxpdt3yNkX7Nvxxh7FfDHwHvwjroSzvDAFi53K1FDY1oixoKDsoqSaQVCdYYtPYaEJU3GMWV6yKrhAxy" ], "script": "base64:AAIDAAAAAAAAAAAAAAAXAAAAAA5vd25lclB1YmxpY0tleQEAAAAgAnfP9tCFuj2k2BUY5PW9DVGxrCHBHKJwugv8WyiaGXIAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdW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", "chainId": 84, "height": 584665, "spentComplexity": 0 } View: original | compacted Prev: J1o7LrnUANvJGJ2T5vatrjaWpWzJQ5irT2Q3dhDQP2rd Next: AQgjFY4Fjpu7ridNAuiCcX3ZMyRYn4q5U9dv192pwRuA Diff:
OldNewDifferences
9191 then throw("can use WAVES only at the moment")
9292 else {
9393 let customerAddress = toBase58String(i.caller.bytes)
94- let price = match getInteger(this, "item_A_coupon_price") {
95- case a: Int =>
96- a
97- case _ =>
98- 0
99- }
94+ let price = getValueItemPrice(item)
95+ let supplierAddress = getValueItemSupplier(item)
10096 if ((price > pmt.amount))
10197 then throw("purchase amount cannot be less than item price")
10298 else if ((pmt.amount > price))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'Adn8NfJZ8ZXuWNMXb9VaY6X6kh6k6G3KMb1WQUesFUV'
55
66 let NONE = "none"
77
88 func getNumberByKey (key) = {
99 let num = match getInteger(this, key) {
1010 case a: Int =>
1111 a
1212 case _ =>
1313 0
1414 }
1515 num
1616 }
1717
1818
1919 func getStrByKey (key) = {
2020 let str = match getString(this, key) {
2121 case a: String =>
2222 a
2323 case _ =>
2424 NONE
2525 }
2626 str
2727 }
2828
2929
3030 func getKeyItemPrice (item) = (item + "_price")
3131
3232
3333 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
3434
3535
3636 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
3737
3838
3939 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
4040
4141
4242 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
4343
4444
4545 func getKeyItemData (item) = (item + "_data")
4646
4747
4848 func getKeyItemSupplier (item) = (item + "_owner")
4949
5050
5151 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
5252
5353
5454 func getKeyBalanceSupplier (account) = (account + "_balance")
5555
5656
5757 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5858
5959
6060 func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
6161
6262
6363 func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
6464
6565
6666 func getKeyCommitsCount (item) = (item + "_comcnt")
6767
6868
6969 func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
7070
7171
7272 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
7373
7474
7575 func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
7676
7777
7878 func getKeyItemStatus (item) = (item + "_status")
7979
8080
8181 func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
8282
8383
8484 func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
8585
8686
8787 @Callable(i)
8888 func purchase (item) = {
8989 let pmt = extract(i.payment)
9090 if (isDefined(pmt.assetId))
9191 then throw("can use WAVES only at the moment")
9292 else {
9393 let customerAddress = toBase58String(i.caller.bytes)
94- let price = match getInteger(this, "item_A_coupon_price") {
95- case a: Int =>
96- a
97- case _ =>
98- 0
99- }
94+ let price = getValueItemPrice(item)
95+ let supplierAddress = getValueItemSupplier(item)
10096 if ((price > pmt.amount))
10197 then throw("purchase amount cannot be less than item price")
10298 else if ((pmt.amount > price))
10399 then throw("purchase amount cannot be higher than item price")
104100 else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)])
105101 }
106102 }
107103
108104
109105
110106 @Callable(i)
111107 func addItem (title,price,data) = {
112108 let supplierAddress = toBase58String(i.caller.bytes)
113109 let item = getKeyItem(supplierAddress, title)
114110 if ((0 >= price))
115111 then throw("purchase amount cannot be less than item price")
116112 else if ((getValueItemSupplier(item) != NONE))
117113 then throw("an item is already exist")
118114 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
119115 }
120116
121117
122118 @Verifier(tx)
123119 func verify () = match tx {
124120 case d: SetScriptTransaction =>
125121 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
126122 case d: DataTransaction =>
127123 true
128124 case _ =>
129125 false
130126 }
131127

github/deemru/w8io/026f985 
25.81 ms