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