tx · CwF5ERhJnbb2cWGH1CqrsVq8S3wiDbUrfqG14oh1xoVF
3NCVWoqgP5evS1BbN2RYeDofxSSfc83UPrm: -0.14000000 Waves
2021.10.27 10:31 [1764400] smart account 3NCVWoqgP5evS1BbN2RYeDofxSSfc83UPrm > SELF 0.00000000 Waves
{
"type": 13,
"id": "CwF5ERhJnbb2cWGH1CqrsVq8S3wiDbUrfqG14oh1xoVF",
"fee": 14000000,
"feeAssetId": null,
"timestamp": 1635319897426,
"version": 2,
"chainId": 84,
"sender": "3NCVWoqgP5evS1BbN2RYeDofxSSfc83UPrm",
"senderPublicKey": "Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2",
"proofs": [
"2jeUJUGw3cJ18bXtYhddq7D5zZsX4N7twSArKeRT6Q9uX9yET7w9ACFbv6vimff68DF2MphGsjaW6CoxjXPj453e",
"4NfnRPUHufrZE7Uc3fAnZXdFWH6FJW6aujyvG2F64znWDtS6PJjfUEi8kn2LQdR21Bx5svyZMagN5fbRwfktDxQc"
],
"script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAALAAAAABhrZXlVc2VyRU5OT0NsYWltZWRBbW91bnQCAAAAFF9FTk5PX2NsYWltZWRfYW1vdW50AAAAABxrZXlVc2VyRU5OT0xhc3RDbGFpbWVkQW1vdW50AgAAABlfRU5OT19sYXN0X2NsYWltZWRfYW1vdW50AAAAAARFTk5PAQAAACAVu9xX04Dqsv7neb8N5XqfEZgi74hev1uuuc/fa0g3cAAAAAAMYWRtaW5QdWJLZXkxAQAAACDKDd7fzM1mZ5Htvcbud2oeN4XrWvIR2nKL78WnCFqVEQAAAAAMYWRtaW5QdWJLZXkyAQAAACDKDd7fzM1mZ5Htvcbud2oeN4XrWvIR2nKL78WnCFqVEQAAAAAMYWRtaW5QdWJLZXkzAQAAACDKDd7fzM1mZ5Htvcbud2oeN4XrWvIR2nKL78WnCFqVEQAAAAAJc2hhcmVEYXRhAQAAACBbQ+QzUMC1aF2T3q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kAAAAAgkAAGQAAAACBQAAABJhZG1pblB1YktleTFTaWduZWQFAAAAEmFkbWluUHViS2V5MlNpZ25lZAUAAAASYWRtaW5QdWJLZXkzU2lnbmVkAAAAAAAAAAACiWnp9Q==",
"height": 1764400,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7ftLy1XJiYguEBjKBMUvyR4fbeFfunkU4NBETjJijLjA
Next: EbV29d2TrMVZSJyqpT3DiAPtprKCqNQ3K7pTupMoxRvR
Diff:
Old | New | | Differences |
---|
15 | 15 | | |
---|
16 | 16 | | let shareData = base58'79G9MRTWPsir5gThDeuicpBuQxx8UFNqVaDUYcRfWtPA' |
---|
17 | 17 | | |
---|
| 18 | + | let stakeDApp = addressFromPublicKey(base58'Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2') |
---|
| 19 | + | |
---|
18 | 20 | | func getCallerShare (caller) = { |
---|
19 | 21 | | let callerShare = getInteger(addressFromPublicKey(shareData), ("share_" + toString(caller))) |
---|
| 22 | + | let callerShareAmount = match callerShare { |
---|
| 23 | + | case share: Int => |
---|
| 24 | + | share |
---|
| 25 | + | case share: Unit => |
---|
| 26 | + | throw("Only governance qualifiers can call this function.") |
---|
| 27 | + | case _ => |
---|
| 28 | + | throw("Match error") |
---|
| 29 | + | } |
---|
| 30 | + | callerShareAmount |
---|
| 31 | + | } |
---|
| 32 | + | |
---|
| 33 | + | |
---|
| 34 | + | func getCallerLock (caller) = { |
---|
| 35 | + | let callerShare = getInteger(stakeDApp, (toString(caller) + "_ENNO_amount")) |
---|
20 | 36 | | let callerShareAmount = match callerShare { |
---|
21 | 37 | | case share: Int => |
---|
22 | 38 | | share |
---|
|
57 | 73 | | } |
---|
58 | 74 | | |
---|
59 | 75 | | |
---|
| 76 | + | |
---|
| 77 | + | @Callable(i) |
---|
| 78 | + | func lockENNO () = { |
---|
| 79 | + | let userShare = getCallerShare(i.caller) |
---|
| 80 | + | let userClaimedAmount = getClaimedAmount(i.caller) |
---|
| 81 | + | let claimAmount = (userShare - userClaimedAmount) |
---|
| 82 | + | if ((0 >= claimAmount)) |
---|
| 83 | + | then throw("Claim amount must be bigger than 0") |
---|
| 84 | + | else { |
---|
| 85 | + | let userClaimedAmountNew = (userClaimedAmount + claimAmount) |
---|
| 86 | + | let amount = claimAmount |
---|
| 87 | + | let stake = invoke(stakeDApp, "lockENNO", nil, [AttachedPayment(ENNO, amount)]) |
---|
| 88 | + | if ((stake == stake)) |
---|
| 89 | + | then [ScriptTransfer(i.caller, claimAmount, ENNO), IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] |
---|
| 90 | + | else throw("Strict value is not equal to itself.") |
---|
| 91 | + | } |
---|
| 92 | + | } |
---|
| 93 | + | |
---|
| 94 | + | |
---|
60 | 95 | | @Verifier(tx) |
---|
61 | 96 | | func verify () = match tx { |
---|
62 | 97 | | case _ => |
---|
Full:
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 ENNO = base58'2Tqhz5PWbkijnzYpdLxLDFfVDw5ALQWm2rmxQ79ooMRZ' |
---|
9 | 9 | | |
---|
10 | 10 | | let adminPubKey1 = base58'Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2' |
---|
11 | 11 | | |
---|
12 | 12 | | let adminPubKey2 = base58'Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2' |
---|
13 | 13 | | |
---|
14 | 14 | | let adminPubKey3 = base58'Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2' |
---|
15 | 15 | | |
---|
16 | 16 | | let shareData = base58'79G9MRTWPsir5gThDeuicpBuQxx8UFNqVaDUYcRfWtPA' |
---|
17 | 17 | | |
---|
| 18 | + | let stakeDApp = addressFromPublicKey(base58'Ebjd61Ze5xP5ZS519XxDrSmiRo4s1e2BEaxbYCXzrSs2') |
---|
| 19 | + | |
---|
18 | 20 | | func getCallerShare (caller) = { |
---|
19 | 21 | | let callerShare = getInteger(addressFromPublicKey(shareData), ("share_" + toString(caller))) |
---|
| 22 | + | let callerShareAmount = match callerShare { |
---|
| 23 | + | case share: Int => |
---|
| 24 | + | share |
---|
| 25 | + | case share: Unit => |
---|
| 26 | + | throw("Only governance qualifiers can call this function.") |
---|
| 27 | + | case _ => |
---|
| 28 | + | throw("Match error") |
---|
| 29 | + | } |
---|
| 30 | + | callerShareAmount |
---|
| 31 | + | } |
---|
| 32 | + | |
---|
| 33 | + | |
---|
| 34 | + | func getCallerLock (caller) = { |
---|
| 35 | + | let callerShare = getInteger(stakeDApp, (toString(caller) + "_ENNO_amount")) |
---|
20 | 36 | | let callerShareAmount = match callerShare { |
---|
21 | 37 | | case share: Int => |
---|
22 | 38 | | share |
---|
23 | 39 | | case share: Unit => |
---|
24 | 40 | | throw("Only governance qualifiers can call this function.") |
---|
25 | 41 | | case _ => |
---|
26 | 42 | | throw("Match error") |
---|
27 | 43 | | } |
---|
28 | 44 | | callerShareAmount |
---|
29 | 45 | | } |
---|
30 | 46 | | |
---|
31 | 47 | | |
---|
32 | 48 | | func getClaimedAmount (caller) = { |
---|
33 | 49 | | let callerWithdrawn = getInteger(this, (toString(caller) + keyUserENNOClaimedAmount)) |
---|
34 | 50 | | let callerWithdrawnAmount = match callerWithdrawn { |
---|
35 | 51 | | case share: Int => |
---|
36 | 52 | | share |
---|
37 | 53 | | case share: Unit => |
---|
38 | 54 | | 0 |
---|
39 | 55 | | case _ => |
---|
40 | 56 | | throw("Match error") |
---|
41 | 57 | | } |
---|
42 | 58 | | callerWithdrawnAmount |
---|
43 | 59 | | } |
---|
44 | 60 | | |
---|
45 | 61 | | |
---|
46 | 62 | | @Callable(i) |
---|
47 | 63 | | func claimENNO () = { |
---|
48 | 64 | | let userShare = getCallerShare(i.caller) |
---|
49 | 65 | | let userClaimedAmount = getClaimedAmount(i.caller) |
---|
50 | 66 | | let claimAmount = (userShare - userClaimedAmount) |
---|
51 | 67 | | if ((0 >= claimAmount)) |
---|
52 | 68 | | then throw("Claim amount must be bigger than 0") |
---|
53 | 69 | | else { |
---|
54 | 70 | | let userClaimedAmountNew = (userClaimedAmount + claimAmount) |
---|
55 | 71 | | [ScriptTransfer(i.caller, claimAmount, ENNO), IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] |
---|
56 | 72 | | } |
---|
57 | 73 | | } |
---|
58 | 74 | | |
---|
59 | 75 | | |
---|
| 76 | + | |
---|
| 77 | + | @Callable(i) |
---|
| 78 | + | func lockENNO () = { |
---|
| 79 | + | let userShare = getCallerShare(i.caller) |
---|
| 80 | + | let userClaimedAmount = getClaimedAmount(i.caller) |
---|
| 81 | + | let claimAmount = (userShare - userClaimedAmount) |
---|
| 82 | + | if ((0 >= claimAmount)) |
---|
| 83 | + | then throw("Claim amount must be bigger than 0") |
---|
| 84 | + | else { |
---|
| 85 | + | let userClaimedAmountNew = (userClaimedAmount + claimAmount) |
---|
| 86 | + | let amount = claimAmount |
---|
| 87 | + | let stake = invoke(stakeDApp, "lockENNO", nil, [AttachedPayment(ENNO, amount)]) |
---|
| 88 | + | if ((stake == stake)) |
---|
| 89 | + | then [ScriptTransfer(i.caller, claimAmount, ENNO), IntegerEntry((toString(i.caller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.caller) + keyUserENNOLastClaimedAmount), claimAmount)] |
---|
| 90 | + | else throw("Strict value is not equal to itself.") |
---|
| 91 | + | } |
---|
| 92 | + | } |
---|
| 93 | + | |
---|
| 94 | + | |
---|
60 | 95 | | @Verifier(tx) |
---|
61 | 96 | | func verify () = match tx { |
---|
62 | 97 | | case _ => |
---|
63 | 98 | | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) |
---|
64 | 99 | | then 1 |
---|
65 | 100 | | else 0 |
---|
66 | 101 | | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) |
---|
67 | 102 | | then 1 |
---|
68 | 103 | | else 0 |
---|
69 | 104 | | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) |
---|
70 | 105 | | then 1 |
---|
71 | 106 | | else 0 |
---|
72 | 107 | | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) |
---|
73 | 108 | | } |
---|
74 | 109 | | |
---|