tx · CrRyWGZ4hqHxqYUK6emMFeaAFPyn3NQASaU9nixngxds 3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY: -0.14000000 Waves 2021.10.28 15:33 [1766147] smart account 3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY > SELF 0.00000000 Waves
{ "type": 13, "id": "CrRyWGZ4hqHxqYUK6emMFeaAFPyn3NQASaU9nixngxds", "fee": 14000000, "feeAssetId": null, "timestamp": 1635424409726, "version": 2, "chainId": 84, "sender": "3NCCJWh4gk9p2FssfGtuHEQgbcBiEJNwfpY", "senderPublicKey": "6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn", "proofs": [ "125SsZwcFkMk7komfwg5ZqePDLkRD8mMk7sQEau9eRLZdtkiS9yGwnpXp6yczwi7b2L6NP9JorAKjxu8GZ5ZAE6i", "3DMte56o3oxkYPvBjFeHKZevcay5rGa3ktEwzVDm6zWty11PJUNvCk7AoWw8iT9NDQfHdPScqamm5CKwiM23pk4x" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAMAAAAABhrZXlVc2VyRU5OT0NsYWltZWRBbW91bnQCAAAAFF9FTk5PX2NsYWltZWRfYW1vdW50AAAAABxrZXlVc2VyRU5OT0xhc3RDbGFpbWVkQW1vdW50AgAAABlfRU5OT19sYXN0X2NsYWltZWRfYW1vdW50AAAAABFrZXlVc2VyRU5OT0xvY2tlZAIAAAAMX0VOTk9fYW1vdW50AAAAABRrZXlVc2VyRU5OT0xvY2tlZFRhZwIAAAAGc2hhcmVfAAAAAAxhZG1pblB1YktleTEBAAAAIFepk7yEupOYL1euYnjVKBoA6QMFEEnH/ZuMJcQl4MoPAAAAAAxhZG1pblB1YktleTIBAAAAIFepk7yEupOYL1euYnjVKBoA6QMFEEnH/ZuMJcQl4MoPAAAAAAxhZG1pblB1YktleTMBAAAAIFepk7yEupOYL1euYnjVKBoA6QMFEEnH/ZuMJcQl4MoPAAAAAAlzaGFyZURhdGEBA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AZAAAAAIFAAAAEmFkbWluUHViS2V5MVNpZ25lZAUAAAASYWRtaW5QdWJLZXkyU2lnbmVkBQAAABJhZG1pblB1YktleTNTaWduZWQAAAAAAAAAAALoXbpf", "height": 1766147, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GNtVjSt67gVcm2RELBRsX1cMLX5ZLj24uhYwKxfimZ9f Next: 2pc9QseAtA4QeJwqnGZxENGs8PwB41BoVxgb3bSLVeMR Diff:
Old | New | Differences | |
---|---|---|---|
48 | 48 | ||
49 | 49 | ||
50 | 50 | func getClaimedAmount (caller) = { | |
51 | - | let callerWithdrawn = getInteger( | |
51 | + | let callerWithdrawn = getInteger(stakeDApp, (toString(caller) + keyUserENNOClaimedAmount)) | |
52 | 52 | let callerWithdrawnAmount = match callerWithdrawn { | |
53 | 53 | case share: Int => | |
54 | 54 | 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 adminPubKey1 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
13 | 13 | ||
14 | 14 | let adminPubKey2 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
15 | 15 | ||
16 | 16 | let adminPubKey3 = base58'6uCSnTeNsFiTBE6u6npUmFezFkve5M54EgMVmfEEZ4Yn' | |
17 | 17 | ||
18 | 18 | let shareData = base58'79G9MRTWPsir5gThDeuicpBuQxx8UFNqVaDUYcRfWtPA' | |
19 | 19 | ||
20 | 20 | let stakeDApp = addressFromPublicKey(base58'Ese6jz6mtrhgwJWdXbAxHNHg2qzae5D2xXWuVF7tLfs8') | |
21 | 21 | ||
22 | 22 | func getCallerShare (caller) = { | |
23 | 23 | let callerShare = getInteger(addressFromPublicKey(shareData), (keyUserENNOLockedTag + toString(caller))) | |
24 | 24 | let callerShareAmount = match callerShare { | |
25 | 25 | case share: Int => | |
26 | 26 | share | |
27 | 27 | case share: Unit => | |
28 | 28 | throw("Only governance qualifiers can call this function.") | |
29 | 29 | case _ => | |
30 | 30 | throw("Match error") | |
31 | 31 | } | |
32 | 32 | callerShareAmount | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getCallerLock (caller) = { | |
37 | 37 | let callerShare = getInteger(stakeDApp, (toString(caller) + keyUserENNOLocked)) | |
38 | 38 | let callerShareAmount = match callerShare { | |
39 | 39 | case share: Int => | |
40 | 40 | share | |
41 | 41 | case share: Unit => | |
42 | 42 | throw("Only governance qualifiers can call this function.") | |
43 | 43 | case _ => | |
44 | 44 | throw("Match error") | |
45 | 45 | } | |
46 | 46 | callerShareAmount | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func getClaimedAmount (caller) = { | |
51 | - | let callerWithdrawn = getInteger( | |
51 | + | let callerWithdrawn = getInteger(stakeDApp, (toString(caller) + keyUserENNOClaimedAmount)) | |
52 | 52 | let callerWithdrawnAmount = match callerWithdrawn { | |
53 | 53 | case share: Int => | |
54 | 54 | share | |
55 | 55 | case share: Unit => | |
56 | 56 | 0 | |
57 | 57 | case _ => | |
58 | 58 | throw("Match error") | |
59 | 59 | } | |
60 | 60 | callerWithdrawnAmount | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func claimAndWithdrawENNO () = { | |
66 | 66 | let userShare = getCallerShare(i.caller) | |
67 | 67 | let userClaimedAmount = getClaimedAmount(i.caller) | |
68 | 68 | let claimAmount = (userShare - userClaimedAmount) | |
69 | 69 | if ((0 >= claimAmount)) | |
70 | 70 | then throw("Claim amount must be bigger than 0") | |
71 | 71 | else { | |
72 | 72 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
73 | 73 | let stake = invoke(stakeDApp, "claimAndWithdrawENNO", nil, nil) | |
74 | 74 | if ((stake == stake)) | |
75 | 75 | then [IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] | |
76 | 76 | else throw("Strict value is not equal to itself.") | |
77 | 77 | } | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func claimAndStakeENNO () = { | |
84 | 84 | let userShare = getCallerShare(i.caller) | |
85 | 85 | let userClaimedAmount = getClaimedAmount(i.caller) | |
86 | 86 | let claimAmount = (userShare - userClaimedAmount) | |
87 | 87 | if ((0 >= claimAmount)) | |
88 | 88 | then throw("Claim amount must be bigger than 0") | |
89 | 89 | else { | |
90 | 90 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
91 | 91 | let stake = invoke(stakeDApp, "claimAndStakeENNO", nil, nil) | |
92 | 92 | if ((stake == stake)) | |
93 | 93 | then [IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] | |
94 | 94 | else throw("Strict value is not equal to itself.") | |
95 | 95 | } | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Verifier(tx) | |
100 | 100 | func verify () = match tx { | |
101 | 101 | case _ => | |
102 | 102 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
103 | 103 | then 1 | |
104 | 104 | else 0 | |
105 | 105 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
106 | 106 | then 1 | |
107 | 107 | else 0 | |
108 | 108 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
109 | 109 | then 1 | |
110 | 110 | else 0 | |
111 | 111 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
112 | 112 | } | |
113 | 113 |
github/deemru/w8io/169f3d6 28.60 ms ◑