tx · 5Aoq76tGWqzsEqxcGnjCgH7a69CvCm7jyV6jF6KXGYGa

3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D:  -0.01400000 Waves

2019.06.22 17:13 [553358] smart account 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D > SELF 0.00000000 Waves

{ "type": 13, "id": "5Aoq76tGWqzsEqxcGnjCgH7a69CvCm7jyV6jF6KXGYGa", "fee": 1400000, "feeAssetId": null, "timestamp": 1561212871599, "version": 1, "sender": "3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D", "senderPublicKey": "BJRaSW2saRv7CcFs3mSYpaVFQSFpZq9rGKnCcRKuKgWv", "proofs": [ "4M3W1NAAB2FZS8Pyr7L8T2Hrx7mppxtNCRjpzgoUPJvD6C2bRPVABLqBt4Xf4wfZSjtnmvJkrFyyMZPCvaneBxY2" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAApnZXRLZXlJdGVtAAAAAgAAAAhzdXBwbGllcgAAAAV0aXRsZQkAASwAAAACAgAAAAVpdGVtXwkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAhfYmFsYW5jZQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAFX2RhdGEBAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIAAAAEdXNlcgAAAARpdGVtCQABLAAAAAIJAAE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jZQkBAAAAF2dldFZhbHVlQmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAwkAAGcAAAACAAAAAAAAAAAABQAAAAdiYWxhbmNlCQAAAgAAAAECAAAAFGluc3VmZmljaWVudCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAdiYWxhbmNlBQAAAAR1bml0BQAAAANuaWwAAAAAwSzENA==", "chainId": 84, "height": 553358, "spentComplexity": 0 } View: original | compacted Prev: EKC61cF24UvhESRWABKAvwmG1BiZ1EMjb7zDrUh39kdc Next: C61ebeiM7iWGYJUJUebHmLWEMcbNizcbDkpqYELujFpe Diff:
OldNewDifferences
120120 }
121121
122122
123+
124+@Callable(x)
125+func withdraw () = {
126+ let D = toBase58String(x.caller.bytes)
127+ let F = v(D)
128+ if ((0 >= F))
129+ then throw("insufficient balance")
130+ else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)]))
131+ }
132+
133+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 func b (c,d) = ("item_" + toBase58String(sha256(toBytes((c + d)))))
77
88
99 func e (f) = (f + "_owner")
1010
1111
1212 func g (f) = (f + "_balance")
1313
1414
1515 func h (f) = (f + "_price")
1616
1717
1818 func i (f) = (f + "_data")
1919
2020
2121 func j (k,f) = (((f + "_") + k) + "_cnt")
2222
2323
2424 func l (m) = {
2525 let n = {
2626 let o = getString(this, m)
2727 if ($isInstanceOf(o, "String"))
2828 then {
2929 let p = o
3030 p
3131 }
3232 else a
3333 }
3434 n
3535 }
3636
3737
3838 func q (m) = {
3939 let r = {
4040 let o = getInteger(this, m)
4141 if ($isInstanceOf(o, "Int"))
4242 then {
4343 let p = o
4444 p
4545 }
4646 else 0
4747 }
4848 r
4949 }
5050
5151
5252 func s (f) = l(e(f))
5353
5454
5555 func t (f) = q(h(f))
5656
5757
5858 func u (k,f) = q(j(k, f))
5959
6060
6161 func v (w) = q(g(w))
6262
6363
6464 @Callable(x)
6565 func purchaseOld (y) = {
6666 let z = extract(x.payment)
6767 if (isDefined(z.assetId))
6868 then throw("can use WAVES only at the moment")
6969 else {
7070 let A = toBase58String(x.caller.bytes)
7171 let B = {
7272 let o = getInteger(this, (("item_" + y) + "_coupon_price"))
7373 if ($isInstanceOf(o, "Int"))
7474 then {
7575 let p = o
7676 p
7777 }
7878 else 0
7979 }
8080 if ((B > z.amount))
8181 then throw("purschase amount cannot be less than item price")
8282 else if ((z.amount > B))
8383 then throw("purchase amount cannot be higher than item price")
8484 else WriteSet([DataEntry(((("status:purchase_item_" + y) + "_customer_") + A), "confirmed"), DataEntry(((("price:purchase_item_" + y) + "_customer_") + A), B)])
8585 }
8686 }
8787
8888
8989
9090 @Callable(x)
9191 func addItem (d,B,C) = {
9292 let D = toBase58String(x.caller.bytes)
9393 let f = b(D, d)
9494 if ((0 >= B))
9595 then throw("purchase amount cannot be less than item price")
9696 else if ((s(f) != a))
9797 then throw("an items is already exist")
9898 else WriteSet([DataEntry(e(f), D), DataEntry(h(f), B), DataEntry(i(f), C)])
9999 }
100100
101101
102102
103103 @Callable(x)
104104 func purchase (f) = {
105105 let z = extract(x.payment)
106106 if (isDefined(z.assetId))
107107 then throw("WAVES tokens only at the moment")
108108 else {
109109 let E = toBase58String(x.caller.bytes)
110110 let B = t(f)
111111 let D = s(f)
112112 if ((B > z.amount))
113113 then throw("purchase amount cannot be less than item price")
114114 else if ((z.amount > B))
115115 then throw("purchase amount cannot be higher than item price")
116116 else if ((D == a))
117117 then throw("supplier does not exist")
118118 else WriteSet([DataEntry(j(E, f), (u(E, f) + 1)), DataEntry(g(D), (v(D) + z.amount))])
119119 }
120120 }
121121
122122
123+
124+@Callable(x)
125+func withdraw () = {
126+ let D = toBase58String(x.caller.bytes)
127+ let F = v(D)
128+ if ((0 >= F))
129+ then throw("insufficient balance")
130+ else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)]))
131+ }
132+
133+

github/deemru/w8io/026f985 
32.58 ms