tx · TyLrL1qwGrspWBN2qEKUjC744xCJEwN5u4yuP3Tuc4R 3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY: -0.14000000 Waves 2021.10.28 15:45 [1766161] smart account 3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY > SELF 0.00000000 Waves
{ "type": 13, "id": "TyLrL1qwGrspWBN2qEKUjC744xCJEwN5u4yuP3Tuc4R", "fee": 14000000, "feeAssetId": null, "timestamp": 1635425187825, "version": 2, "chainId": 84, "sender": "3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY", "senderPublicKey": "6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn", "proofs": [ "5HgThq261FbXUgb4biQFBzMPJYKjuxkqZ2uArrismLg8E2gc5T6Cw6dJnxMF8kUmMHUceNam8jeX3u95LJaz3aar", "2uZmc2NHTKZD9WJ6MNVdDwd7MLn6fcTjPjftjavGgMaKS9jYbbC1gvBaZ9SxvRyEhjN4WpHvkb5v2AUVYJsD4tmp" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAPAAAAABhrZXlVc2VyRU5OT0NsYWltZWRBbW91bnQCAAAAFF9FTk5PX2NsYWltZWRfYW1vdW50AAAAABxrZXlVc2VyRU5OT0xhc3RDbGFpbWVkQW1vdW50AgAAABlfRU5OT19sYXN0X2NsYWltZWRfYW1vdW50AAAAABFrZXlVc2VyRU5OT0xvY2tlZAIAAAAMX0VOTk9fYW1vdW50AAAAABRrZXlVc2VyRU5OT0xvY2tlZFRhZwIAAAAGc2hhcmVfAAAAAAlrZXlBY3RpdmUCAAAABmFjdGl2ZQAAAAAIa2V5Q2F1c2UCAAAADnNodXRkb3duX2NhdXNlAAAAAAxhZG1pblB1YktleTEBAAAAIFepk7yEupOYL1euYnjVKBoA6QMFEEnH/ZuMJcQl4MoPAAAAAAxhZG1pblB1YktleTIBAAAAIFepk7yEupOYL1euYnjVKBoA6QMFEEnH/ZuMJcQl4MoPAAAAAA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gkAAGQAAAACCQAAZAAAAAIFAAAAEmFkbWluUHViS2V5MVNpZ25lZAUAAAASYWRtaW5QdWJLZXkyU2lnbmVkBQAAABJhZG1pblB1YktleTNTaWduZWQAAAAAAAAAAAKnHz9X", "height": 1766161, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2pc9QseAtA4QeJwqnGZxENGs8PwB41BoVxgb3bSLVeMR Next: none Diff:
Old | New | Differences | |
---|---|---|---|
30 | 30 | ||
31 | 31 | func getCallerShare (caller) = { | |
32 | 32 | let callerShare = getInteger(addressFromPublicKey(shareData), (keyUserENNOLockedTag + toString(caller))) | |
33 | - | let callerShareAmount = match callerShare { | |
34 | - | case share: Int => | |
35 | - | share | |
36 | - | case share: Unit => | |
37 | - | throw("Only governance qualifiers can call this function.") | |
38 | - | case _ => | |
39 | - | throw("Match error") | |
40 | - | } | |
41 | - | callerShareAmount | |
42 | - | } | |
43 | - | ||
44 | - | ||
45 | - | func getCallerLock (caller) = { | |
46 | - | let callerShare = getInteger(stakeDApp, (toString(caller) + keyUserENNOLocked)) | |
47 | 33 | let callerShareAmount = match callerShare { | |
48 | 34 | case share: Int => | |
49 | 35 | share |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyUserENNOClaimedAmount = "_ENNO_claimed_amount" | |
5 | 5 | ||
6 | 6 | let keyUserENNOLastClaimedAmount = "_ENNO_last_claimed_amount" | |
7 | 7 | ||
8 | 8 | let keyUserENNOLocked = "_ENNO_amount" | |
9 | 9 | ||
10 | 10 | let keyUserENNOLockedTag = "share_" | |
11 | 11 | ||
12 | 12 | let keyActive = "active" | |
13 | 13 | ||
14 | 14 | let keyCause = "shutdown_cause" | |
15 | 15 | ||
16 | 16 | let adminPubKey1 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
17 | 17 | ||
18 | 18 | let adminPubKey2 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
19 | 19 | ||
20 | 20 | let adminPubKey3 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
21 | 21 | ||
22 | 22 | let shareData = base58'79G9MRTWPsir5gThDeuicpBuQxx8UFNqVaDUYcRfWtPA' | |
23 | 23 | ||
24 | 24 | let stakeDApp = addressFromPublicKey(base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8') | |
25 | 25 | ||
26 | 26 | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
27 | 27 | ||
28 | 28 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getCallerShare (caller) = { | |
32 | 32 | let callerShare = getInteger(addressFromPublicKey(shareData), (keyUserENNOLockedTag + toString(caller))) | |
33 | - | let callerShareAmount = match callerShare { | |
34 | - | case share: Int => | |
35 | - | share | |
36 | - | case share: Unit => | |
37 | - | throw("Only governance qualifiers can call this function.") | |
38 | - | case _ => | |
39 | - | throw("Match error") | |
40 | - | } | |
41 | - | callerShareAmount | |
42 | - | } | |
43 | - | ||
44 | - | ||
45 | - | func getCallerLock (caller) = { | |
46 | - | let callerShare = getInteger(stakeDApp, (toString(caller) + keyUserENNOLocked)) | |
47 | 33 | let callerShareAmount = match callerShare { | |
48 | 34 | case share: Int => | |
49 | 35 | share | |
50 | 36 | case share: Unit => | |
51 | 37 | throw("Only governance qualifiers can call this function.") | |
52 | 38 | case _ => | |
53 | 39 | throw("Match error") | |
54 | 40 | } | |
55 | 41 | callerShareAmount | |
56 | 42 | } | |
57 | 43 | ||
58 | 44 | ||
59 | 45 | func getClaimedAmount (caller) = { | |
60 | 46 | let callerWithdrawn = getInteger(stakeDApp, (toString(caller) + keyUserENNOClaimedAmount)) | |
61 | 47 | let callerWithdrawnAmount = match callerWithdrawn { | |
62 | 48 | case share: Int => | |
63 | 49 | share | |
64 | 50 | case share: Unit => | |
65 | 51 | 0 | |
66 | 52 | case _ => | |
67 | 53 | throw("Match error") | |
68 | 54 | } | |
69 | 55 | callerWithdrawnAmount | |
70 | 56 | } | |
71 | 57 | ||
72 | 58 | ||
73 | 59 | @Callable(i) | |
74 | 60 | func claimAndWithdrawENNO () = if (!(isActive)) | |
75 | 61 | then throw("DApp is inactive at this moment") | |
76 | 62 | else { | |
77 | 63 | let userShare = getCallerShare(i.caller) | |
78 | 64 | let userClaimedAmount = getClaimedAmount(i.caller) | |
79 | 65 | let claimAmount = (userShare - userClaimedAmount) | |
80 | 66 | if ((0 >= claimAmount)) | |
81 | 67 | then throw("Claim amount must be bigger than 0") | |
82 | 68 | else { | |
83 | 69 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
84 | 70 | let stake = invoke(stakeDApp, "claimAndWithdrawENNO", nil, nil) | |
85 | 71 | if ((stake == stake)) | |
86 | 72 | then [IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] | |
87 | 73 | else throw("Strict value is not equal to itself.") | |
88 | 74 | } | |
89 | 75 | } | |
90 | 76 | ||
91 | 77 | ||
92 | 78 | ||
93 | 79 | @Callable(i) | |
94 | 80 | func claimAndStakeENNO () = if (!(isActive)) | |
95 | 81 | then throw("DApp is inactive at this moment") | |
96 | 82 | else { | |
97 | 83 | let userShare = getCallerShare(i.caller) | |
98 | 84 | let userClaimedAmount = getClaimedAmount(i.caller) | |
99 | 85 | let claimAmount = (userShare - userClaimedAmount) | |
100 | 86 | if ((0 >= claimAmount)) | |
101 | 87 | then throw("Claim amount must be bigger than 0") | |
102 | 88 | else { | |
103 | 89 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
104 | 90 | let stake = invoke(stakeDApp, "claimAndStakeENNO", nil, nil) | |
105 | 91 | if ((stake == stake)) | |
106 | 92 | then [IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] | |
107 | 93 | else throw("Strict value is not equal to itself.") | |
108 | 94 | } | |
109 | 95 | } | |
110 | 96 | ||
111 | 97 | ||
112 | 98 | @Verifier(tx) | |
113 | 99 | func verify () = match tx { | |
114 | 100 | case _ => | |
115 | 101 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
116 | 102 | then 1 | |
117 | 103 | else 0 | |
118 | 104 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
119 | 105 | then 1 | |
120 | 106 | else 0 | |
121 | 107 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
122 | 108 | then 1 | |
123 | 109 | else 0 | |
124 | 110 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
125 | 111 | } | |
126 | 112 |
github/deemru/w8io/026f985 41.95 ms ◑