tx · 65uAJAgE1nZv99ThTtju3fSEyVyZ5HM9rtQMmF9XC4eg 3N5qejBhCedYyTbK7Qgqxn2T6kubSeHt7pu: -0.14000000 Waves 2021.10.27 11:31 [1764459] smart account 3N5qejBhCedYyTbK7Qgqxn2T6kubSeHt7pu > SELF 0.00000000 Waves
{ "type": 13, "id": "65uAJAgE1nZv99ThTtju3fSEyVyZ5HM9rtQMmF9XC4eg", "fee": 14000000, "feeAssetId": null, "timestamp": 1635323484556, "version": 2, "chainId": 84, "sender": "3N5qejBhCedYyTbK7Qgqxn2T6kubSeHt7pu", "senderPublicKey": "Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8", "proofs": [ "2tNBhhmLRjq7faoJ8HApoHzV7S4YrtzPmYKFq54kaYQ6S4qbWn84xHjRyeQrmtg58WvksRfRB9ynTpdbj2PT4bxp", "2JQBY69zY8otwZYbQRCB6qeajsF4oj6Q978XRRfiCEcZ4PMZT6VcoxX6y8KkAMqnfDKyscAWQaQZgg1z9oe7DZvh" ], "script": "base64:AAIFAAAAAAAAAA0IAhIAEgMKAQESABIAAAAADQAAAAAMYWRtaW5QdWJLZXkxAQAAACDOIOsfrF/B0g3/qNz0tul4UpbyfoMvXUKuDPJ3pNlvGwAAAAAMYWRtaW5QdWJLZXkyAQAAACDOIOsfrF/B0g3/qNz0tul4UpbyfoMvXUKuDPJ3pNlvGwAAAAAMYWRtaW5QdWJLZXkzAQAAACDOIOsfrF/B0g3/qNz0tul4UpbyfoMvXUKuDPJ3pNlvGwAAAAAUYWRtaW5QdWJLZXlTdGFydFN0b3ABAAAAIM4g6x+sX8HSDf+o3PS26XhSlvJ+gy9dQq4M8nek2W8bAAAAAAlrZXlBY3RpdmUCAAAABmFjdGl2ZQAAAAAIa2V5Q2F1c2UCAAAADnNodXRkb3duX2NhdXNlAAAAABFrZXlVc2VyRU5OT0xvY2tlZAIAAAAMX0VOTk9fYW1vdW50AAAAABJrZXlUb3RhbEVOTk9Mb2NrZW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AnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAACBQAAAAxhZG1pblB1YktleTMAAAAAAAAAAAEAAAAAAAAAAAAJAABnAAAAAgkAAGQAAAACCQAAZAAAAAIFAAAAEmFkbWluUHViS2V5MVNpZ25lZAUAAAASYWRtaW5QdWJLZXkyU2lnbmVkBQAAABJhZG1pblB1YktleTNTaWduZWQAAAAAAAAAAAJseTnI", "height": 1764459, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GovS7S95YvAwKdXn6q594We5zP4W72bXPSEMtXkGvfpJ Next: HgCWcPF9xikzzS5dZ1QfdJDYskbR18vpt6sozTaRCoHS Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | if ((pmtAssetId != ENNO)) | |
41 | 41 | then throw("Incorrect pmtAssetId") | |
42 | 42 | else { | |
43 | - | let userENNOLocked = getUserENNOLocked(i. | |
43 | + | let userENNOLocked = getUserENNOLocked(i.originCaller) | |
44 | 44 | let userENNOLockedNew = (userENNOLocked + pmtAmount) | |
45 | 45 | let totalENNOLocked = getTotalENNOLocked() | |
46 | 46 | let totalENNOLockedNew = (totalENNOLocked + pmtAmount) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminPubKey1 = base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8' | |
5 | 5 | ||
6 | 6 | let adminPubKey2 = base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8' | |
7 | 7 | ||
8 | 8 | let adminPubKey3 = base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8' | |
9 | 9 | ||
10 | 10 | let adminPubKeyStartStop = base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8' | |
11 | 11 | ||
12 | 12 | let keyActive = "active" | |
13 | 13 | ||
14 | 14 | let keyCause = "shutdown_cause" | |
15 | 15 | ||
16 | 16 | let keyUserENNOLocked = "_ENNO_amount" | |
17 | 17 | ||
18 | 18 | let keyTotalENNOLocked = "total_ENNO_amount" | |
19 | 19 | ||
20 | 20 | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
21 | 21 | ||
22 | 22 | let ENNO = base58'2Tqhz5PWbkijnzYpdLxLDFfVDw5ALQWm2rmxQ79ooMRZ' | |
23 | 23 | ||
24 | 24 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func getUserENNOLocked (user) = valueOrElse(getInteger(this, (toString(user) + keyUserENNOLocked)), 0) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getTotalENNOLocked () = valueOrElse(getInteger(this, keyTotalENNOLocked), 0) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func lockENNO () = if (!(isActive)) | |
35 | 35 | then throw("DApp is inactive at this moment") | |
36 | 36 | else { | |
37 | 37 | let $t010381113 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
38 | 38 | let pmtAmount = $t010381113._1 | |
39 | 39 | let pmtAssetId = $t010381113._2 | |
40 | 40 | if ((pmtAssetId != ENNO)) | |
41 | 41 | then throw("Incorrect pmtAssetId") | |
42 | 42 | else { | |
43 | - | let userENNOLocked = getUserENNOLocked(i. | |
43 | + | let userENNOLocked = getUserENNOLocked(i.originCaller) | |
44 | 44 | let userENNOLockedNew = (userENNOLocked + pmtAmount) | |
45 | 45 | let totalENNOLocked = getTotalENNOLocked() | |
46 | 46 | let totalENNOLockedNew = (totalENNOLocked + pmtAmount) | |
47 | 47 | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOLockedNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew)] | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func withdrawENNO (withdrawAmount) = if (!(isActive)) | |
55 | 55 | then throw("DApp is inactive at this moment") | |
56 | 56 | else if ((0 >= withdrawAmount)) | |
57 | 57 | then throw("withdrawAmount <= 0") | |
58 | 58 | else { | |
59 | 59 | let totalENNOLocked = getTotalENNOLocked() | |
60 | 60 | let userENNOLocked = getUserENNOLocked(i.caller) | |
61 | 61 | if ((withdrawAmount > userENNOLocked)) | |
62 | 62 | then throw("withdrawAmount > availableToUnstake") | |
63 | 63 | else { | |
64 | 64 | let totalENNOLockedNew = (totalENNOLocked - withdrawAmount) | |
65 | 65 | let userENNOamountNew = (userENNOLocked - withdrawAmount) | |
66 | 66 | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, withdrawAmount, ENNO)] | |
67 | 67 | } | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | @Callable(i) | |
73 | 73 | func shutdown () = if (!(isActive)) | |
74 | 74 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
75 | 75 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
76 | 76 | then throw("Only admin can call this function") | |
77 | 77 | else suspend("Paused by admin") | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | 81 | @Callable(i) | |
82 | 82 | func activate () = if (isActive) | |
83 | 83 | then throw("DApp is already active") | |
84 | 84 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
85 | 85 | then throw("Only admin can call this function") | |
86 | 86 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Verifier(tx) | |
90 | 90 | func verify () = { | |
91 | 91 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
92 | 92 | then 1 | |
93 | 93 | else 0 | |
94 | 94 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
95 | 95 | then 1 | |
96 | 96 | else 0 | |
97 | 97 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
98 | 98 | then 1 | |
99 | 99 | else 0 | |
100 | 100 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
101 | 101 | } | |
102 | 102 |
github/deemru/w8io/169f3d6 29.09 ms ◑