tx · 2Wwify76SyDEeG8fgXADobWBm3QiZpTbQVph3C9t1Kfq

3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX:  -0.05000000 Waves

2019.08.21 13:55 [640788] smart account 3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX > SELF 0.00000000 Waves

{ "type": 13, "id": "2Wwify76SyDEeG8fgXADobWBm3QiZpTbQVph3C9t1Kfq", "fee": 5000000, "feeAssetId": null, "timestamp": 1566384885090, "version": 1, "sender": "3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX", "senderPublicKey": "rbQBcP925Nu3mB58D4Zw36LLDks2LgrcbshyaiSJSHy", "proofs": [ "5uwLPzDxSTzrPyE718YHEEjiT8quJekY4SgHMHQh1roX64hfgPcgwKyH5NoJgU1zSXF591xm13pZ3z8bZhT2z9Af" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFuBQAAAAckbWF0Y2gwBQAAAAFuAAAAAAAAAAAAAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FAQAAAApnZXRLZXlJdGVtAAAAAgAAAAhzdXBwbGllcgAAAAV0aXRsZQkAASwAAAACAgAAAAVpdGVtXwkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAg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wbGllckFkZHJlc3MDCQAAZwAAAAIAAAAAAAAAAAAFAAAAB2JhbGFuY2UJAAACAAAAAQIAAAAUaW5zdWZmaWNpZW50IGJhbGFuY2UJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAVZ2V0S2V5QmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAA9zdXBwbGllckFkZHJlc3MJAQAAABdnZXRWYWx1ZUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAAEdW5pdAUAAAADbmlsAAAAAMikgYk=", "chainId": 84, "height": 640788, "spentComplexity": 0 } View: original | compacted Prev: C4Y9dZCGzspCU3mkj5WL2GPupYGkTG6ggYAZU6aT3h4k Next: BDpFoTbsQqGXSdNdUDrDPAvhKWzr6YCYJbJt13pZS5qX Diff:
OldNewDifferences
8888 }
8989
9090
91+
92+@Callable(w)
93+func withdraw () = {
94+ let z = toBase58String(w.caller.bytes)
95+ let C = v(z)
96+ if ((0 >= C))
97+ then throw("insufficient balance")
98+ else ScriptResult(WriteSet([DataEntry(q(z), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(z), v(z), unit)]))
99+ }
100+
101+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 func b (c) = {
77 let d = getInteger(this, c)
88 if ($isInstanceOf(d, "Int"))
99 then {
1010 let e = d
1111 e
1212 }
1313 else 0
1414 }
1515
1616
1717 func f (c) = {
1818 let d = getString(this, c)
1919 if ($isInstanceOf(d, "String"))
2020 then {
2121 let g = d
2222 g
2323 }
2424 else a
2525 }
2626
2727
2828 func h (i,j) = ("item_" + toBase58String(sha256(toBytes((i + j)))))
2929
3030
3131 func k (l) = (l + "_owner")
3232
3333
3434 func m (l) = (l + "_price")
3535
3636
3737 func n (l) = (l + "_data")
3838
3939
4040 func o (p,l) = (((l + "_") + p) + "_cnt")
4141
4242
4343 func q (r) = (r + "_account")
4444
4545
4646 func s (l) = b(m(l))
4747
4848
4949 func t (p,l) = b(o(p, l))
5050
5151
5252 func u (l) = f(k(l))
5353
5454
5555 func v (r) = b(q(r))
5656
5757
5858 @Callable(w)
5959 func addItem (j,x,y) = {
6060 let z = toBase58String(w.caller.bytes)
6161 let l = h(z, j)
6262 if ((0 >= x))
6363 then throw("purchase amount cannot be ess than item price")
6464 else if ((u(l) != a))
6565 then throw("an item already exists")
6666 else WriteSet([DataEntry(k(l), z), DataEntry(m(l), x), DataEntry(n(l), y)])
6767 }
6868
6969
7070
7171 @Callable(w)
7272 func purchase (l) = {
7373 let A = extract(w.payment)
7474 if (isDefined(A.assetId))
7575 then throw("can use only WAVES token at the moment")
7676 else {
7777 let B = toBase58String(w.caller.bytes)
7878 let x = s(l)
7979 let z = u(l)
8080 if ((x > A.amount))
8181 then throw("purchase price cannot be lower than item price")
8282 else if ((x > A.amount))
8383 then throw("purchase price cannot be higher than item price")
8484 else if ((z == a))
8585 then throw("supplier does not exist")
8686 else WriteSet([DataEntry(o(B, l), (t(B, l) + 1)), DataEntry(q(z), (v(z) + A.amount))])
8787 }
8888 }
8989
9090
91+
92+@Callable(w)
93+func withdraw () = {
94+ let z = toBase58String(w.caller.bytes)
95+ let C = v(z)
96+ if ((0 >= C))
97+ then throw("insufficient balance")
98+ else ScriptResult(WriteSet([DataEntry(q(z), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(z), v(z), unit)]))
99+ }
100+
101+

github/deemru/w8io/169f3d6 
32.65 ms