tx · 6XkCH9rCqkHCUYdsyF1iUrKjekwvD2A3Mqr7u26oRBMB

3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc:  -0.01400000 Waves

2019.09.20 20:36 [684956] smart account 3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc > SELF 0.00000000 Waves

{ "type": 13, "id": "6XkCH9rCqkHCUYdsyF1iUrKjekwvD2A3Mqr7u26oRBMB", "fee": 1400000, "feeAssetId": null, "timestamp": 1569001045046, "version": 1, "sender": "3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc", "senderPublicKey": "Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY", "proofs": [ "3fSQqmEW3JRzXqwZrkGEmtZje3jHckEqZn3dcXhBP7MEcdL2hjyPA9wrBnVtDRt4busiFVsXjDMBC5VwDxcGp3nn" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAA5vd25lclB1YmxpY0tleQEAAAAgkTEnTdeol7uGSzlcY9XCaZJBCT/vNHbkSFPcfsdd2lcAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFs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RTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGBzhWyYk=", "chainId": 84, "height": 684956, "spentComplexity": 0 } View: original | compacted Prev: GHZBcozPb7Ne2atSBsj79fYhzJmAZ1b64DUjrDvc2B9j Next: GYXQczvH1CfNSCrKX3ND8uQw8fa8hfrSQQgtwaedr75D Diff:
OldNewDifferences
9797 case d: DataTransaction =>
9898 true
9999 case _ =>
100- true
100+ false
101101 }
102102
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY'
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 @Callable(i)
6161 func addItem (title,price,data) = {
6262 let supplierAddress = toBase58String(i.caller.bytes)
6363 let item = getKeyItem(supplierAddress, title)
6464 if ((0 >= price))
6565 then throw("purchase amount cannot be less than item price")
6666 else if ((getValueItemSupplier(item) != NONE))
6767 then throw("an item is already exist")
6868 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
6969 }
7070
7171
7272
7373 @Callable(i)
7474 func purchase (item) = {
7575 let pmt = extract(i.payment)
7676 if (isDefined(pmt.assetId))
7777 then throw("can use WAVES only at the moment")
7878 else {
7979 let userAddress = toBase58String(i.caller.bytes)
8080 let price = getValueItemPrice(item)
8181 let supplierAddress = getValueItemSupplier(item)
8282 if ((price > pmt.amount))
8383 then throw("pruchase amount cannot be less tahn item price")
8484 else if ((pmt.amount > price))
8585 then throw("pruchase amount cannot be higher tahn item price")
8686 else if ((supplierAddress == NONE))
8787 then throw("supplier does not exist")
8888 else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
8989 }
9090 }
9191
9292
9393 @Verifier(tx)
9494 func verify () = match tx {
9595 case d: SetScriptTransaction =>
9696 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
9797 case d: DataTransaction =>
9898 true
9999 case _ =>
100- true
100+ false
101101 }
102102

github/deemru/w8io/026f985 
22.85 ms