tx · 6ww995RvdtmHsqNwrMo8jZbHjBBWDWa4HkPHyuwERAct
3N2GeUw4KtMF34jdvNesau48iCxfT4DksAD: -0.01400000 Waves
2019.07.22 16:29 [597235] smart account 3N2GeUw4KtMF34jdvNesau48iCxfT4DksAD > SELF 0.00000000 Waves
{
"type": 13,
"id": "6ww995RvdtmHsqNwrMo8jZbHjBBWDWa4HkPHyuwERAct",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1563802239577,
"version": 1,
"sender": "3N2GeUw4KtMF34jdvNesau48iCxfT4DksAD",
"senderPublicKey": "FfcdngZ7eunm8gtpDuM4pGeH8Yy6SHYt4eQKPaWbHc2o",
"proofs": [
"5QA4sVTi7FS12z6KpQpmhoxoM44pij4a28utDgryX9eLprWrmL9SNUkgMMHhqTAzBqy8P939vm7haWmTPrqka7cj"
],
"script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAR3RVVSAQAAACAalE+6fc1iBGhWiVs8CvQr6BWbfknI/DueR4BuM0ni+gAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAR3RVVSCQAAAgAAAAECAAAATEwndW5pY28gYXNzZXQgYW1tZXNzbyDDqCB3RVVSIC0gMm5rbVd5U0pjazd4M3ZHVFpxY1FwZlM3cFBMeHh1cWE4R2RHRDRkVlVGTjkEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWQFAAAAByRtYXRjaDAFAAAAAWQAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwAAAABaQEAAAAId2l0aGRyYXcAAAABAAAABmFtb3VudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQFAAAABmFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAGYW1vdW50CQAAAgAAAAECAAAALk5vbiDDqCBwb3NzaWJpbGUgcHJlbGV2YXJlIHVuIGltcG9ydG8gbmVnYXRpdm8DCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAACJOb24gw6ggcG9zc2liaWxlIGF6emVyYXJlIGlsIGNvbnRvCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHdFVVIFAAAAA25pbAAAAAAMo19j",
"chainId": 84,
"height": 597235,
"spentComplexity": 0
}
View: original | compacted
Prev: FUMjrSp9rRsYM2kdiZWvSS7pakysCiE5LoS9cHX6J8TL
Next: none
Diff:
Old | New | | Differences |
---|
22 | 22 | | } |
---|
23 | 23 | | |
---|
24 | 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("Non è possibile prelevare un importo negativo") |
---|
| 38 | + | else if ((0 > newAmount)) |
---|
| 39 | + | then throw("Non è possibile azzerare il conto") |
---|
| 40 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, wEUR)])) |
---|
| 41 | + | } |
---|
| 42 | + | |
---|
| 43 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let wEUR = base58'2nkmWySJck7x3vGTZqcQpfS7pPLxxuqa8GdGD4dVUFN9' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func deposit () = { |
---|
8 | 8 | | let pmt = extract(i.payment) |
---|
9 | 9 | | if ((pmt.assetId != wEUR)) |
---|
10 | 10 | | then throw("L'unico asset ammesso è wEUR - 2nkmWySJck7x3vGTZqcQpfS7pPLxxuqa8GdGD4dVUFN9") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let currentKey = toBase58String(i.caller.bytes) |
---|
13 | 13 | | let currentAmount = match getInteger(this, currentKey) { |
---|
14 | 14 | | case d: Int => |
---|
15 | 15 | | d |
---|
16 | 16 | | case _ => |
---|
17 | 17 | | 0 |
---|
18 | 18 | | } |
---|
19 | 19 | | let newAmount = (currentAmount + pmt.amount) |
---|
20 | 20 | | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
21 | 21 | | } |
---|
22 | 22 | | } |
---|
23 | 23 | | |
---|
24 | 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("Non è possibile prelevare un importo negativo") |
---|
| 38 | + | else if ((0 > newAmount)) |
---|
| 39 | + | then throw("Non è possibile azzerare il conto") |
---|
| 40 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, wEUR)])) |
---|
| 41 | + | } |
---|
| 42 | + | |
---|
| 43 | + | |
---|