tx · 2ybgCRPWBrhphAyvxSEqMetLiZd9p7JRgdHcQx8nmMfU 3Mztw7BQPWhCXDxHESrBoX2DKk12yNAGK5E: -0.01400000 Waves 2019.06.28 15:03 [561944] smart account 3Mztw7BQPWhCXDxHESrBoX2DKk12yNAGK5E > SELF 0.00000000 Waves
{ "type": 13, "id": "2ybgCRPWBrhphAyvxSEqMetLiZd9p7JRgdHcQx8nmMfU", "fee": 1400000, "feeAssetId": null, "timestamp": 1561723392698, "version": 1, "sender": "3Mztw7BQPWhCXDxHESrBoX2DKk12yNAGK5E", "senderPublicKey": "BG7Fy2R6zh7x23ssfb44qii1ivXk7oLoc7s83p9tt3uB", "proofs": [ "5LLjsRoAHuGTR1sv4Q3rWrQGoN8QyxctUWWPxbHwwgpH27vXnznZyDsX8uq7WRK2935xW9j3UAjt7ABXYQNEKDne" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAR3RVVSAQAAACBzGpFB+ZZa/ByHLBhs91SzGvP+M4XN16feP65d4McXDgAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAR3RVVSCQAAAgAAAAECAAAAQHdFVVIgIC0gOGtLUDhoQ2FvU2Ezdk5ONGUyZTNiYm9LZm53M2FyejdrTGhRZUNCV2F1UUggb25seSB0b2tlbnMEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwAAAABaQEAAAAId2l0aGRyYXcAAAABAAAABmFtb3VudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQFAAAABmFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAGYW1vdW50CQAAAgAAAAECAAAAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR3RVVSBQAAAANuaWwAAAAALUJ1Kg==", "chainId": 84, "height": 561944, "spentComplexity": 0 } View: original | compacted Prev: none Next: F2gj39eNHREmp1ywYh4J8YUj4fAuHsUnuLnu1yeHvMHo Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let wEUR = base58'8kKP8hCaoSa3vNN4e2e3bboKfnw3arz7kLhQeCBWauQH' | |
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if ((pmt.assetId != wEUR)) | |
10 | + | then throw("wEUR - 8kKP8hCaoSa3vNN4e2e3bboKfnw3arz7kLhQeCBWauQH only tokens") | |
11 | + | else { | |
12 | + | let currentKey = toBase58String(i.caller.bytes) | |
13 | + | let currentAmount = match getInteger(this, currentKey) { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | let newAmount = (currentAmount + pmt.amount) | |
20 | + | WriteSet([DataEntry(currentKey, newAmount)]) | |
21 | + | } | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | @Callable(i) | |
27 | + | func withdraw (amount) = { | |
28 | + | let currentKey = toBase58String(i.caller.bytes) | |
29 | + | let currentAmount = match getInteger(this, currentKey) { | |
30 | + | case a: Int => | |
31 | + | a | |
32 | + | case _ => | |
33 | + | 0 | |
34 | + | } | |
35 | + | let newAmount = (currentAmount - amount) | |
36 | + | if ((0 > amount)) | |
37 | + | then throw("Can't withdraw negative amount") | |
38 | + | else if ((0 > newAmount)) | |
39 | + | then throw("Not enough balance") | |
40 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, wEUR)])) | |
41 | + | } | |
42 | + | ||
43 | + |
github/deemru/w8io/026f985 15.59 ms ◑