tx · ArAMNuUgarhbcUm4pfMY19y9r5iw1h6BhmbiFSqmEJRa 3MrZ15ZMZRcsgCuZjJ3W3oGz9vDGWirXKa2: -0.01000000 Waves 2019.11.02 01:26 [746393] smart account 3MrZ15ZMZRcsgCuZjJ3W3oGz9vDGWirXKa2 > SELF 0.00000000 Waves
{ "type": 13, "id": "ArAMNuUgarhbcUm4pfMY19y9r5iw1h6BhmbiFSqmEJRa", "fee": 1000000, "feeAssetId": null, "timestamp": 1572647116225, "version": 1, "sender": "3MrZ15ZMZRcsgCuZjJ3W3oGz9vDGWirXKa2", "senderPublicKey": "rihVasjx7xm4ViY4SLCmYfRDu8sKWhJuhC2HUPheMeB", "proofs": [ "gTndkCNKFtp4XWP9xeEYvqypFDAyZBeNwdk8nuBLgNCAphUHMJCxd9uvfA46t3bT7nhxy9NtTKFdRFDeHpDgWrc" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAABAAAAABZzdGFibGVBc3NldENvaW5Bc3NldElkAQAAACCsC+HuICq87tiTC006zv4vmKp9z1PaPDLL9fbGTdO8CgAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9kbCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAMY3VycmVudFByaWNlCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNNeUR0TlRrQ055UkN3M28ycXY1QlBQUzd2dlVvc2lRZTZGCQABLAAAAAICAAAABnByaWNlXwkAAaQAAAABBQAAAAZoZWlnaHQEAAAADXR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3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAdI5Ot1", "chainId": 84, "height": 746393, "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 | + | let stableAssetCoinAssetId = base58'CabdiPbYMxKHrPwVX5qUyJJWpZptEwmejYspeEYhVDLD' | |
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if (isDefined(pmt.assetId)) | |
10 | + | then throw("can hodl waves only at the moment") | |
11 | + | else { | |
12 | + | let currentKey = toBase58String(i.caller.bytes) | |
13 | + | let currentPrice = getIntegerValue(addressFromStringValue("3MyDtNTkCNyRCw3o2qv5BPPS7vvUosiQe6F"), ("price_" + toString(height))) | |
14 | + | let transfrAmount = (pmt.amount + (currentPrice / 150)) | |
15 | + | ScriptResult(WriteSet([DataEntry((((currentKey + "_") + toBase58String(i.transactionId)) + "_deposit"), pmt.amount), DataEntry((((currentKey + "_") + toBase58String(i.transactionId)) + "_amount"), transfrAmount)]), TransferSet([ScriptTransfer(i.caller, transfrAmount, stableAssetCoinAssetId)])) | |
16 | + | } | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | @Callable(i) | |
22 | + | func withdraw (amount) = { | |
23 | + | let currentKey = toBase58String(i.caller.bytes) | |
24 | + | let currentAmount = match getInteger(this, currentKey) { | |
25 | + | case a: Int => | |
26 | + | a | |
27 | + | case _ => | |
28 | + | 0 | |
29 | + | } | |
30 | + | let newAmount = (currentAmount - amount) | |
31 | + | if ((0 > amount)) | |
32 | + | then throw("Can't withdraw negative amount") | |
33 | + | else if ((0 > newAmount)) | |
34 | + | then throw("Not enough balance") | |
35 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | @Verifier(tx) | |
40 | + | func verify () = false | |
41 | + |
github/deemru/w8io/026f985 13.20 ms ◑