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