tx · F7XecAJQRWdzatVhr6pKJiPPL9KqbAU1YRocH2YTn44a
3MwUT9eqXHZVH4mipVZDRcLhqsjNnpPJKLV: -0.01400000 Waves
2019.06.22 12:09 [553023] smart account 3MwUT9eqXHZVH4mipVZDRcLhqsjNnpPJKLV > SELF 0.00000000 Waves
{
"type": 13,
"id": "F7XecAJQRWdzatVhr6pKJiPPL9KqbAU1YRocH2YTn44a",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1561194613114,
"version": 1,
"sender": "3MwUT9eqXHZVH4mipVZDRcLhqsjNnpPJKLV",
"senderPublicKey": "Bk1amW8KVtdKMKnrFQuduBaMWYBxgVAMdiULbDR861hs",
"proofs": [
"26xUWk6EbrBxU8edJ9QNke3ng3vYsANrAwCDtWRKcWmaWUBW63VJnsxg78oYXiimGoRFkkUfX9PgeVyaqXCnsyU9"
],
"script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAR3RXVyAQAAACClhqGo076a8zyBwOfLl6EVCDPW+Yx0ufxPXDElCmQCzAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAIhPQAAAAIIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAABHdFdXIJAAACAAAAAQIAAAAeT25seSB3RXVyIGRlcG9zaXRzIGFyZSBhbGxvd2VkBAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAD3ByZXZpb3VzQmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAAdhZGRyZXNzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACm5ld0JhbGFuY2UJAABkAAAAAgUAAAAPcHJldmlvdXNCYWxhbmNlCAUAAAAHcGF5bWVudAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAB2FkZHJlc3MFAAAACm5ld0JhbGFuY2UFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAB2JhbGFuY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAHYWRkcmVzcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAApuZXdCYWxhbmNlCQAAZQAAAAIFAAAAB2JhbGFuY2UFAAAABmFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAKbmV3QmFsYW5jZQkAAAIAAAABAgAAACdVbnN1ZmZpY2llbnQgYmFsYW5jZSBmb3IgdGhpcyBvcGVyYXRpb24JAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAdhZGRyZXNzBQAAAApuZXdCYWxhbmNlBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHdFdXIFAAAAA25pbAAAAAD4Al8F",
"chainId": 84,
"height": 553023,
"spentComplexity": 0
}
View: original | compacted
Prev: 4KN29U3TUbr4dtnoZ7yziYhudxhDXnGLhsgDJ6WLSqe8
Next: 9kwLGGUGFeZEGoWahRuq7Amue91TEdhpVcNGsd9gdk5d
Diff:
Old | New | | Differences |
---|
22 | 22 | | } |
---|
23 | 23 | | |
---|
24 | 24 | | |
---|
| 25 | + | |
---|
| 26 | + | @Callable(i) |
---|
| 27 | + | func withdraw (amount) = { |
---|
| 28 | + | let address = toBase58String(i.caller.bytes) |
---|
| 29 | + | let balance = match getInteger(this, address) { |
---|
| 30 | + | case a: Int => |
---|
| 31 | + | a |
---|
| 32 | + | case _ => |
---|
| 33 | + | 0 |
---|
| 34 | + | } |
---|
| 35 | + | let newBalance = (balance - amount) |
---|
| 36 | + | if ((0 > newBalance)) |
---|
| 37 | + | then throw("Unsufficient balance for this operation") |
---|
| 38 | + | else ScriptResult(WriteSet([DataEntry(address, newBalance)]), TransferSet([ScriptTransfer(i.caller, amount, wEur)])) |
---|
| 39 | + | } |
---|
| 40 | + | |
---|
| 41 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let wEur = base58'C99Lf3hGnc9UFgYduxxxveKS8ECWCZfxXfFpnpUgRCc3' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func deposit () = { |
---|
8 | 8 | | let payment = extract(i.payment) |
---|
9 | 9 | | if ((payment.assetId != wEur)) |
---|
10 | 10 | | then throw("Only wEur deposits are allowed") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let address = toBase58String(i.caller.bytes) |
---|
13 | 13 | | let previousBalance = match getInteger(this, address) { |
---|
14 | 14 | | case a: Int => |
---|
15 | 15 | | a |
---|
16 | 16 | | case _ => |
---|
17 | 17 | | 0 |
---|
18 | 18 | | } |
---|
19 | 19 | | let newBalance = (previousBalance + payment.amount) |
---|
20 | 20 | | WriteSet([DataEntry(address, newBalance)]) |
---|
21 | 21 | | } |
---|
22 | 22 | | } |
---|
23 | 23 | | |
---|
24 | 24 | | |
---|
| 25 | + | |
---|
| 26 | + | @Callable(i) |
---|
| 27 | + | func withdraw (amount) = { |
---|
| 28 | + | let address = toBase58String(i.caller.bytes) |
---|
| 29 | + | let balance = match getInteger(this, address) { |
---|
| 30 | + | case a: Int => |
---|
| 31 | + | a |
---|
| 32 | + | case _ => |
---|
| 33 | + | 0 |
---|
| 34 | + | } |
---|
| 35 | + | let newBalance = (balance - amount) |
---|
| 36 | + | if ((0 > newBalance)) |
---|
| 37 | + | then throw("Unsufficient balance for this operation") |
---|
| 38 | + | else ScriptResult(WriteSet([DataEntry(address, newBalance)]), TransferSet([ScriptTransfer(i.caller, amount, wEur)])) |
---|
| 39 | + | } |
---|
| 40 | + | |
---|
| 41 | + | |
---|