tx · GAcviWtbFfJfS3JLGtDAKkdDvLGBE8hkBY4sDK4Mb9aH 3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC: -0.01400000 Waves 2020.04.10 13:08 [948106] smart account 3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC > SELF 0.00000000 Waves
{ "type": 13, "id": "GAcviWtbFfJfS3JLGtDAKkdDvLGBE8hkBY4sDK4Mb9aH", "fee": 1400000, "feeAssetId": null, "timestamp": 1586513354299, "version": 1, "sender": "3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC", "senderPublicKey": "BNrrKkZSXXCbcCtXLT3VMQnSAJt2jt8TLnZWaB5US3Ci", "proofs": [ "4uyBKdwVvN9qzR1GFef3tTK8q8uWnT6ZbjYs91Gcbqq4ZZdkbNQcG7fPtftc3mqBGoEnM1ofuHKxniDETwvTTaaT" ], "script": "base64:AAIDAAAAAAAAAAoIARIAEgQKAgEIAAAAAwEAAAAKZ2V0QmFsYW5jZQAAAAIAAAAHYWRkcmVzcwAAAAdhc3NldElkBAAAAAFiCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgkAASwAAAACBQAAAAdhZGRyZXNzAgAAAAFfBQAAAAdhc3NldElkBAAAAAckbWF0Y2gwBQAAAAFiAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAFAAAAAXQAAAAAAAAAAAABAAAACmdldEFzc2V0SWQAAAABAAAAB2Fzc2V0SWQEAAAAByRtYXRjaDAFAAAAB2Fzc2V0SWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAWIFAAAAByRtYXRjaDAJAAJYAAAAAQUAAAABYgIAAAAFV0FWRVMBAAAADmFzc2V0SWRUb0J5dGVzAAAAAQAAAAdhc3NldElkAwMJAAAAAAAAAgUAAAAHYXNzZXRJZAIAAAAFV0FWRVMGCQAAAAAAAAIFAAAAB2Fzc2V0SWQCAAAAAAUAAA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AwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQJAQAAAA5hc3NldElkVG9CeXRlcwAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAEFlvdXIgYmFsYW5jZSBpcyAJAAGkAAAAAQUAAAADYmFsAAAAAD4Dc2k=", "chainId": 84, "height": 948106, "spentComplexity": 0 } View: original | compacted Prev: D1pfZeBq4bqTMMABvr8SAsC3RfyNwiakJC9Je2fHgeDf Next: 81c7LxywrdGVVtpVT4JLCDZa4vEgSAUYZVEfBN1VfaUD Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let usdn = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC' | |
5 | - | ||
6 | 4 | func getBalance (address,assetId) = { | |
7 | 5 | let b = getInteger(this, ((address + "_") + assetId)) | |
8 | 6 | match b { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let usdn = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC' | |
5 | - | ||
6 | 4 | func getBalance (address,assetId) = { | |
7 | 5 | let b = getInteger(this, ((address + "_") + assetId)) | |
8 | 6 | match b { | |
9 | 7 | case t: Int => | |
10 | 8 | t | |
11 | 9 | case _ => | |
12 | 10 | 0 | |
13 | 11 | } | |
14 | 12 | } | |
15 | 13 | ||
16 | 14 | ||
17 | 15 | func getAssetId (assetId) = match assetId { | |
18 | 16 | case b: ByteVector => | |
19 | 17 | toBase58String(b) | |
20 | 18 | case _ => | |
21 | 19 | "WAVES" | |
22 | 20 | } | |
23 | 21 | ||
24 | 22 | ||
25 | 23 | func assetIdToBytes (assetId) = if (if ((assetId == "WAVES")) | |
26 | 24 | then true | |
27 | 25 | else (assetId == "")) | |
28 | 26 | then unit | |
29 | 27 | else fromBase58String(assetId) | |
30 | 28 | ||
31 | 29 | ||
32 | 30 | @Callable(i) | |
33 | 31 | func deposit () = { | |
34 | 32 | let address = toBase58String(i.caller.bytes) | |
35 | 33 | let payment = extract(i.payment) | |
36 | 34 | let assetId = getAssetId(payment.assetId) | |
37 | 35 | let bal = getBalance(address, assetId) | |
38 | 36 | ScriptResult(WriteSet([DataEntry(((address + "_") + assetId), (bal + payment.amount))]), TransferSet(nil)) | |
39 | 37 | } | |
40 | 38 | ||
41 | 39 | ||
42 | 40 | ||
43 | 41 | @Callable(i) | |
44 | 42 | func withdraw (amount,assetId) = { | |
45 | 43 | let address = toBase58String(i.caller.bytes) | |
46 | 44 | let bal = getBalance(address, assetId) | |
47 | 45 | if ((bal >= amount)) | |
48 | 46 | then ScriptResult(WriteSet([DataEntry(((address + "_") + assetId), (bal - amount))]), TransferSet([ScriptTransfer(i.caller, amount, assetIdToBytes(assetId))])) | |
49 | 47 | else throw(("Your balance is " + toString(bal))) | |
50 | 48 | } | |
51 | 49 | ||
52 | 50 |
github/deemru/w8io/026f985 32.22 ms ◑