tx · 7ARqe6NWvAipFWWet3NARMtECc9KwVwZjLApVBkDBBNr 3N9uzrTiArce1h9VCqK3QUUZmFqBgg5rZSW: -0.00100000 Waves 2022.06.17 09:23 [2100009] smart account 3N9uzrTiArce1h9VCqK3QUUZmFqBgg5rZSW > SELF 0.00000000 Waves
{ "type": 13, "id": "7ARqe6NWvAipFWWet3NARMtECc9KwVwZjLApVBkDBBNr", "fee": 100000, "feeAssetId": null, "timestamp": 1655446993321, "version": 2, "chainId": 84, "sender": "3N9uzrTiArce1h9VCqK3QUUZmFqBgg5rZSW", "senderPublicKey": "2f5ca9ECz8S814GxgTjP6iWmM4xP5Q7HTDT6WVFqTzAW", "proofs": [ "3HVeA1FqeG6193FVGrZTSYsBbtMDxf7BiXpStTKoY2yMnpCisyLmGcx1B84HS4zBuvvfBuhMh4CzrYbAPERba2De" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAABAAAAAAprZXlCYWxhbmNlAgAAAAhfYmFsYW5jZQAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAABmNhbGxlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAdiYWxhbmNlCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAGY2FsbGVyBQAAAAprZXlCYWxhbmNlAAAAAAAAAAAAAwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAE1BheW1lbnQgaXMgcmVxdWlyZWQEAAAAB3BheW1lbnQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAdhc3NldElkBQAAAAR1bml0CQAAAgAAAAECAAAAG09ubHkgV0FWRVMgY2FuIGJlIGRlcG9zaXRlZAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACBQAAAAZjYWxsZXIFAAAACmtleUJhbGFuY2UJAABkAAAAAgUAAAAHYmFsYW5jZQgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAANuaWwAAAABaQEAAAAId2l0aGRyYXcAAAABAAAABmFtb3VudAQAAAAGY2FsbGVyCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAB2JhbGFuY2UJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAZjYWxsZXIFAAAACmtleUJhbGFuY2UAAAAAAAAAAAADCQAAZgAAAAIFAAAABmFtb3VudAUAAAAHYmFsYW5jZQkAAAIAAAABAgAAAB5JbnN1ZmZpZW50IGJhbGFuY2UgdG8gd2l0aGRyYXcJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAGY2FsbGVyBQAAAAprZXlCYWxhbmNlCQAAZQAAAAIFAAAAB2JhbGFuY2UFAAAABmFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAP0sQaQ=", "height": 2100009, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FWMELEL3jmoSxG2bHcMjwADQrfbam3x3kQFqqDnqkaNZ Next: none Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | let balance = valueOrElse(getInteger(this, (caller + keyBalance)), 0) | |
26 | 26 | if ((amount > balance)) | |
27 | 27 | then throw("Insuffient balance to withdraw") | |
28 | - | else [ScriptTransfer(i.caller, amount, unit)] | |
28 | + | else [IntegerEntry((caller + keyBalance), (balance - amount)), ScriptTransfer(i.caller, amount, unit)] | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyBalance = "_balance" | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = { | |
8 | 8 | let caller = toBase58String(i.caller.bytes) | |
9 | 9 | let balance = valueOrElse(getInteger(this, (caller + keyBalance)), 0) | |
10 | 10 | if ((size(i.payments) == 0)) | |
11 | 11 | then throw("Payment is required") | |
12 | 12 | else { | |
13 | 13 | let payment = i.payments[0] | |
14 | 14 | if ((payment.assetId != unit)) | |
15 | 15 | then throw("Only WAVES can be deposited") | |
16 | 16 | else [IntegerEntry((caller + keyBalance), (balance + payment.amount))] | |
17 | 17 | } | |
18 | 18 | } | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func withdraw (amount) = { | |
24 | 24 | let caller = toBase58String(i.caller.bytes) | |
25 | 25 | let balance = valueOrElse(getInteger(this, (caller + keyBalance)), 0) | |
26 | 26 | if ((amount > balance)) | |
27 | 27 | then throw("Insuffient balance to withdraw") | |
28 | - | else [ScriptTransfer(i.caller, amount, unit)] | |
28 | + | else [IntegerEntry((caller + keyBalance), (balance - amount)), ScriptTransfer(i.caller, amount, unit)] | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 |
github/deemru/w8io/026f985 41.54 ms ◑