tx · 8KTND8WuqdztFVAXHdoZwJQKbmnxMgLRWme7YtVapGmF

3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4:  -0.01000010 Waves

2021.07.07 14:17 [1603118] smart account 3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4 > SELF 0.00000000 Waves

{ "type": 13, "id": "8KTND8WuqdztFVAXHdoZwJQKbmnxMgLRWme7YtVapGmF", "fee": 1000010, "feeAssetId": null, "timestamp": 1625656678447, "version": 2, "chainId": 84, "sender": "3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4", "senderPublicKey": "B3Kkg7AgjdZYrAW5kNXeBi1KfWcjdiHpEnu3tsfirQPy", "proofs": [ "5zZZ4UmTgwgVAq2Ru6oN7nnTtRd4jQhudidpcZJnbeZJKdL82qdQmJd7YcN2hkW2wfVvgnsFext4o6MwK73Fz9Fx" ], "script": "base64:AAIFAAAAAAAAAkQIAhIFCgMIAQgSAwoBCBIAGgoKAmExEgROT05FGhQKAmEyEg5nZXROdW1iZXJCeUtleRoJCgJhMxIDa2V5GgkKAmE0EgNudW0aDQoCYTUSByRtYXRjaDAaBwoCYTYSAWEaEQoCYTcSC2dldFN0ckJ5S2V5GgkKAmE4EgNzdHIaFQoCYTkSD2dldEtleUl0ZW1QcmljZRoKCgJiMRIEaXRlbRoXCgJiMhIRZ2V0VmFsdWVJdGVtUHJpY2UaGwoCYjMSFWdldEtleVVzZXJJdGVtQ291bnRlchoKCgJiNBIEdXNlchodCgJiNRIXZ2V0VmFsdWVVc2VySXRlbUNvdW50ZXIaEAoCYjYSCmdldEtleUl0ZW0aDgoCYjcSCHN1cHBsaWVyGgsKAmI4EgV0aXRsZRoUCgJiORIOZ2V0S2V5SXRlbURhdGEaGAoCYzESEmdldEtleUl0ZW1TdXBwbGllchoaCgJjMhIUZ2V0VmFsdWVJdGVtU3VwcGxpZXIaGwoCYzMSFWdldEtleUJhbGFuY2VTdXBwbGllchoNCgJjNBIHYWNjb3VudBodCgJjNRIXZ2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Status": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4uam79MWtrNAT7o4wEJad34bo8sGcJYZVNecvadDABWZ Next: none Diff:
OldNewDifferences
9494 let supplierAddress = toBase58String(i.caller.bytes)
9595 let balance = getValueBalanceSupplier(supplierAddress)
9696 if ((0 >= balance))
97- then throw("insufficient balance")
97+ then throw("za mało środków")
9898 else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
9999 }
100100
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
55
66 func getNumberByKey (key) = {
77 let num = match getInteger(this, key) {
88 case a: Int =>
99 a
1010 case _ =>
1111 0
1212 }
1313 num
1414 }
1515
1616
1717 func getStrByKey (key) = {
1818 let str = match getString(this, key) {
1919 case a: String =>
2020 a
2121 case _ =>
2222 NONE
2323 }
2424 str
2525 }
2626
2727
2828 func getKeyItemPrice (item) = (item + "_price")
2929
3030
3131 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
3232
3333
3434 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
3535
3636
3737 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
3838
3939
4040 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
4141
4242
4343 func getKeyItemData (item) = (item + "_data")
4444
4545
4646 func getKeyItemSupplier (item) = (item + "_data")
4747
4848
4949 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
5050
5151
5252 func getKeyBalanceSupplier (account) = (account + "_balance")
5353
5454
5555 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5656
5757
5858 @Callable(i)
5959 func addItem (title,price,data) = {
6060 let supplierAddress = toBase58String(i.caller.bytes)
6161 let item = getKeyItem(supplierAddress, title)
6262 if ((0 >= price))
6363 then throw("purchase amount cannot be less than item price")
6464 else if ((getValueItemSupplier(item) != NONE))
6565 then throw("an item is already exist")
6666 else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)]
6767 }
6868
6969
7070
7171 @Callable(i)
7272 func purchase (item) = {
7373 let pmt = i.payments[0]
7474 if (isDefined(pmt.assetId))
7575 then throw("WAVES token only at the moment")
7676 else {
7777 let userAddress = toBase58String(i.caller.bytes)
7878 let price = getValueItemPrice(item)
7979 let supplierAddres = getValueItemSupplier(item)
8080 if ((price > pmt.amount))
8181 then throw("purchase amunt cannot be less than item price")
8282 else if ((pmt.amount > price))
8383 then throw("purchase amount cannot be higher than item price")
8484 else if ((supplierAddres == NONE))
8585 then throw("Supplier address doesn't exist")
8686 else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddres), (getValueBalanceSupplier(supplierAddres) + pmt.amount))]
8787 }
8888 }
8989
9090
9191
9292 @Callable(i)
9393 func withdraw () = {
9494 let supplierAddress = toBase58String(i.caller.bytes)
9595 let balance = getValueBalanceSupplier(supplierAddress)
9696 if ((0 >= balance))
97- then throw("insufficient balance")
97+ then throw("za mało środków")
9898 else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
9999 }
100100
101101

github/deemru/w8io/026f985 
318.25 ms