tx · H9nhvh63chs7Jwdp5K48UAJ8K6BN8dGy2jPWNDFL62xy 3N2idNzCJ9a55CzgQksGvN8dJtzxJP2fRXS: -0.01000000 Waves 2020.09.23 10:14 [1189633] smart account 3N2idNzCJ9a55CzgQksGvN8dJtzxJP2fRXS > SELF 0.00000000 Waves
{ "type": 13, "id": "H9nhvh63chs7Jwdp5K48UAJ8K6BN8dGy2jPWNDFL62xy", "fee": 1000000, "feeAssetId": null, "timestamp": 1600845317113, "version": 2, "chainId": 84, "sender": "3N2idNzCJ9a55CzgQksGvN8dJtzxJP2fRXS", "senderPublicKey": "5XbovAGoKSWTrXtsESKTrACco3sctwbFxeScg3zYkuxr", "proofs": [ "4sGHSWgeVgYrg6FB3Jm8uThpRerVotieWvSUpafUPbkJswVoG7ifWMvCVBCWRDE4WMSgH6nVk6S3ZWAV9Q6UrKdS" ], "script": "base64:AAIDAAAAAAAAAA8IARIFCgMIAQESBAoCCAEAAAAAAAAAAgAAAAFpAQAAAAhyZWdpc3RlcgAAAAMAAAAEaXRlbQAAAAVwcmljZQAAAAVzdG9jawQAAAAIc3VwcGxpZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAIZXhpc3RpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAYHAwkAAAAAAAACBQAAAARpdGVtAgAAAAAJAAACAAAAAQIAAAAgaXRlbSBuYW1lIGNhbm5vdCBiZSBlbXB0eSBzdHJpbmcJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlBQAAAAVwcmljZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAARpdGVtAgAAAA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AAZQAAAAIFAAAAA3N0awUAAAADbnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAlwdXJjaGFzZToFAAAABGl0ZW0CAAAAAToJAAGkAAAAAQUAAAAGaGVpZ2h0CQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAl7J2l0ZW0nOicFAAAABGl0ZW0CAAAACicsJ3ByaWNlJzoJAAGkAAAAAQUAAAAFcHJpY2UCAAAACiwnbnVtYmVyJzoJAAGkAAAAAQUAAAADbnVtAgAAAAF9BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWkFAAAAByRtYXRjaDAGB+virUM=", "height": 1189633, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func register (item,price,stock) = { | |
8 | + | let supplier = toBase58String(i.caller.bytes) | |
9 | + | let existing = match getString(this, (item + "_owner")) { | |
10 | + | case a: String => | |
11 | + | true | |
12 | + | case _ => | |
13 | + | false | |
14 | + | } | |
15 | + | if ((item == "")) | |
16 | + | then throw("item name cannot be empty string") | |
17 | + | else WriteSet([DataEntry((item + "_price"), price), DataEntry((item + "_stock"), stock), DataEntry((item + "_owner"), supplier)]) | |
18 | + | } | |
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | @Callable(i) | |
23 | + | func purchase (item,num) = { | |
24 | + | let price = getIntegerValue(this, (item + "_price")) | |
25 | + | let pmt = extract(i.payment) | |
26 | + | let customer = toBase58String(i.caller.bytes) | |
27 | + | let supplier = getStringValue(this, (item + "_owner")) | |
28 | + | let stk = getIntegerValue(this, (item + "_stock")) | |
29 | + | let purchaseHistory = getStringValue(this, ((("status:" + item) + "_") + customer)) | |
30 | + | if (((price * num) != pmt.amount)) | |
31 | + | then throw(("your payment is not equal to the price of " + item)) | |
32 | + | else if ((num > stk)) | |
33 | + | then throw("over stock") | |
34 | + | else WriteSet([DataEntry((item + "_stock"), (stk - num)), DataEntry(((("purchase:" + item) + ":") + toString(height)), (((((("{'item':'" + item) + "','price':") + toString(price)) + ",'number':") + toString(num)) + "}"))]) | |
35 | + | } | |
36 | + | ||
37 | + | ||
38 | + | @Verifier(tx) | |
39 | + | func verify () = match tx { | |
40 | + | case i: InvokeScriptTransaction => | |
41 | + | true | |
42 | + | case _ => | |
43 | + | false | |
44 | + | } | |
45 | + |
github/deemru/w8io/026f985 14.20 ms ◑