tx · JBqHQLCwbB3aZ4hAR18k1BjBKy3GSepNRfpXiTGV81p9 3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6: -0.04000000 Waves 2021.11.04 15:53 [1776282] smart account 3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6 > SELF 0.00000000 Waves
{ "type": 13, "id": "JBqHQLCwbB3aZ4hAR18k1BjBKy3GSepNRfpXiTGV81p9", "fee": 4000000, "feeAssetId": null, "timestamp": 1636030451727, "version": 2, "chainId": 84, "sender": "3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6", "senderPublicKey": "Gud7Z17wiZEMZiHRbn48k2D9H13jmLEDZZ8b7NCfjRJL", "proofs": [ "3NNjGUNJdTuTXFa5ckMbASTTDeQF9Hpamo2vKbjEscEyNUDaNvBS5TJEZFh5XzeYr8jEidoAywfJdmAGTHfsFhni" ], "script": "base64:AAIFAAAAAAAAABEIAhIAEgASAwoBARIECgIBCAAAAAAAAAAEAAAAAWkBAAAABGNhbGwAAAAABAAAAAVhc3NldAkABEMAAAAHAgAAAAVBc3NldAIAAAAAAAAAAAAAAAABAAAAAAAAAAAABgUAAAAEdW5pdAAAAAAAAAAAAAQAAAAHYXNzZXRJZAkABDgAAAABBQAAAAVhc3NldAkABEwAAAACCQEAAAALQmluYXJ5RW50cnkAAAACAgAAAANiaW4BAAAAAAkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAAEYm9vbAYJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAA2ludAAAAAAAAAAAAQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAANzdHICAAAAAAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABAgAAAANzdHIJAARMAAAAAgUAAAAFYXNzZXQJAARMAAAAAgkBAAAAB1JlaXNzdWUAAAADBQAAAAdhc3NldElkAAAAAAAAAAABBwkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAAB2Fzc2V0SWQ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bWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwAwUAAAAFc21hcnQGBQAAAAZzZWNvbmQHl1011A==", "height": 1776282, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EV9ioqFYaHZczFbGVeKD68SAbxAgr8jahc1QJpMchLAQ Next: DsZWMNEt42YSdLa6Ezz1ei6ZyqHmDcHybWR6pxE8j6cT Diff:
Old | New | Differences | |
---|---|---|---|
75 | 75 | case _ => | |
76 | 76 | 0 | |
77 | 77 | } | |
78 | - | $Tuple2([IntegerEntry(currentKey, newAmount), IntegerEntry( | |
78 | + | $Tuple2([IntegerEntry(currentKey, newAmount), IntegerEntry(recKey, (recAmount + amount))], unit) | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func call () = { | |
8 | 8 | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
9 | 9 | let assetId = calculateAssetId(asset) | |
10 | 10 | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)] | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | 15 | @Callable(i) | |
16 | 16 | func deposit () = { | |
17 | 17 | let pmt = if ((size(i.payments) == 1)) | |
18 | 18 | then i.payments[0] | |
19 | 19 | else throw("Attached payment is required") | |
20 | 20 | if (isDefined(pmt.assetId)) | |
21 | 21 | then throw("works with waves only") | |
22 | 22 | else { | |
23 | 23 | let currentKey = toBase58String(i.caller.bytes) | |
24 | 24 | let currentAmount = match getInteger(this, currentKey) { | |
25 | 25 | case a: Int => | |
26 | 26 | a | |
27 | 27 | case _ => | |
28 | 28 | 0 | |
29 | 29 | } | |
30 | 30 | let newAmount = (currentAmount + pmt.amount) | |
31 | 31 | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
32 | 32 | } | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | 37 | @Callable(i) | |
38 | 38 | func withdraw (amount) = { | |
39 | 39 | let currentKey = toBase58String(i.caller.bytes) | |
40 | 40 | let currentAmount = match getInteger(this, currentKey) { | |
41 | 41 | case a: Int => | |
42 | 42 | a | |
43 | 43 | case _ => | |
44 | 44 | 0 | |
45 | 45 | } | |
46 | 46 | let newAmount = (currentAmount - amount) | |
47 | 47 | if ((0 > amount)) | |
48 | 48 | then throw("Can't withdraw negative amount") | |
49 | 49 | else if ((0 > newAmount)) | |
50 | 50 | then throw("Not enough balance") | |
51 | 51 | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func transfer (amount,recipient) = { | |
58 | 58 | let currentKey = toBase58String(i.caller.bytes) | |
59 | 59 | let currentAmount = match getInteger(this, currentKey) { | |
60 | 60 | case a: Int => | |
61 | 61 | a | |
62 | 62 | case _ => | |
63 | 63 | 0 | |
64 | 64 | } | |
65 | 65 | let newAmount = (currentAmount - amount) | |
66 | 66 | if ((0 > amount)) | |
67 | 67 | then throw("Can't withdraw negative amount") | |
68 | 68 | else if ((0 > newAmount)) | |
69 | 69 | then throw("Not enough balance") | |
70 | 70 | else { | |
71 | 71 | let recKey = toBase58String(Address(fromBase58String(recipient)).bytes) | |
72 | 72 | let recAmount = match getInteger(this, recKey) { | |
73 | 73 | case a: Int => | |
74 | 74 | a | |
75 | 75 | case _ => | |
76 | 76 | 0 | |
77 | 77 | } | |
78 | - | $Tuple2([IntegerEntry(currentKey, newAmount), IntegerEntry( | |
78 | + | $Tuple2([IntegerEntry(currentKey, newAmount), IntegerEntry(recKey, (recAmount + amount))], unit) | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Verifier(tx) | |
84 | 84 | func verify () = { | |
85 | 85 | let smartPK = base58'Gud7Z17wiZEMZiHRbn48k2D9H13jmLEDZZ8b7NCfjRJL' | |
86 | 86 | let secondPK = base58'CwvKLDcXt3Wd2MEyEemVKawiD7gaCV68wh2GcnJRHFqB' | |
87 | 87 | let smart = sigVerify(tx.bodyBytes, tx.proofs[0], smartPK) | |
88 | 88 | let second = sigVerify(tx.bodyBytes, tx.proofs[0], secondPK) | |
89 | 89 | match tx { | |
90 | 90 | case t: SetScriptTransaction => | |
91 | 91 | true | |
92 | 92 | case t: DataTransaction => | |
93 | 93 | true | |
94 | 94 | case t: InvokeScriptTransaction => | |
95 | 95 | true | |
96 | 96 | case t: TransferTransaction => | |
97 | 97 | if (smart) | |
98 | 98 | then true | |
99 | 99 | else second | |
100 | 100 | case _ => | |
101 | 101 | false | |
102 | 102 | } | |
103 | 103 | } | |
104 | 104 |
github/deemru/w8io/169f3d6 26.88 ms ◑