tx · 62sxiBmiAEbo46GqRg9LN6tzRexgNSXc8UZi3zkNMKSQ 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra: -0.01400000 Waves 2021.07.22 21:29 [1625210] smart account 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra > SELF 0.00000000 Waves
{ "type": 13, "id": "62sxiBmiAEbo46GqRg9LN6tzRexgNSXc8UZi3zkNMKSQ", "fee": 1400000, "feeAssetId": null, "timestamp": 1626978638155, "version": 2, "chainId": 84, "sender": "3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra", "senderPublicKey": "6hg3zCfLeDbfSrz2QVG7hdax7eXSpabUDqSP1ya8PBVZ", "proofs": [ "5bBVW5ULVhMYG1Dk4jW4YfQC7nU4iJKM8amiN2MzfmyrRRZWmwbkgLANEh8mnbGEdLnMwSj5uQfKyRoRDTPiWxLa" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAACgAAAAAOZ292ZXJuYW5jZUFkZHIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVSq+mnegfQTUoXKPy46iFGzGeqYHFnyDS0AAAAAC3NlcnZpY2VBZGRyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU1mt5dWK5qVBdy3fN3rygy+dzMgU+ip9tAAAAAA9rZXlMYXN0SW50ZXJlc3QCAAAADWxhc3RfaW50ZXJlc3QAAAAAEWtleVVzZXJTV09QTG9ja2VkAgAAAAxfU1dPUF9hbW91bnQAAAAAE2tleVVzZXJMYXN0SW50ZXJlc3QCAAAADl9sYXN0X2ludGVyZXN0AAAAAApzY2FsZVZhbHVlAAAAAAAF9eEAAQAAABNnZXRMYXN0SW50ZXJlc3RJbmZvAAAAAAQAAAAMbGFzdEludGVyZXN0CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAADmdvdmVybmFuY2VBZGRyBQAAAA9rZXlMYXN0SW50ZXJlc3QAAAAAAAAAAAAFAAAADGxhc3RJbnRlc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VkCQAAZQAAAAIFAAAADGxhc3RJbnRlcmVzdAUAAAAQdXNlckxhc3RJbnRlcmVzdAUAAAAKc2NhbGVWYWx1ZQQAAAAPdXNlck5ld0ludGVyZXN0BQAAAAxsYXN0SW50ZXJlc3QJAAUUAAAAAgUAAAAPdXNlck5ld0ludGVyZXN0BQAAAAtjbGFpbUFtb3VudAAAAAEAAAABaQEAAAARcmVzdGFrZUdvdmVybmFuY2UAAAABAAAADW1pblNXT1ByZXdhcmQDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAAC3NlcnZpY2VBZGRyCQAAAgAAAAECAAAAMU9ubHkgc3Rha2luZyBzZXJ2aWNlIGlzIGFsbG93ZWQgdG8gY2FsbCB0aGlzIGZ1bmMEAAAAC2NsYWltQW1vdW50CAkBAAAACWNsYWltQ2FsYwAAAAEFAAAABHRoaXMAAAACXzIDCQAAZgAAAAIFAAAADW1pblNXT1ByZXdhcmQFAAAAC2NsYWltQW1vdW50CQAAAgAAAAECAAAAKkFtb3VudCB0byBjbGFpbSBpcyBsZXNzIHRoYW4gbWluU1dPUHJld2FyZAQAAAABegkAA/wAAAAEBQAAAA5nb3Zlcm5hbmNlQWRkcgIAAAARY2xhaW1BbmRTdGFrZVNXT1AFAAAAA25pbAUAAAADbmlsAwkAAAAAAAACBQAAAAF6BQAAAAF6BQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXleVqhZ", "height": 1625210, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FuKAqhWzSzR6W2kR1YWywd3kcH9SiKqzCZVY8jF2bqap Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let governanceAddr = Address(base58'') | |
4 | + | let governanceAddr = Address(base58'3N5W8da2iiijVieA6qLGo7KzCJj8B19smWU') | |
5 | 5 | ||
6 | - | let serviceAddr = Address(base58'') | |
6 | + | let serviceAddr = Address(base58'3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr') | |
7 | 7 | ||
8 | 8 | let keyLastInterest = "last_interest" | |
9 | 9 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let governanceAddr = Address(base58'') | |
4 | + | let governanceAddr = Address(base58'3N5W8da2iiijVieA6qLGo7KzCJj8B19smWU') | |
5 | 5 | ||
6 | - | let serviceAddr = Address(base58'') | |
6 | + | let serviceAddr = Address(base58'3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr') | |
7 | 7 | ||
8 | 8 | let keyLastInterest = "last_interest" | |
9 | 9 | ||
10 | 10 | let keyUserSWOPLocked = "_SWOP_amount" | |
11 | 11 | ||
12 | 12 | let keyUserLastInterest = "_last_interest" | |
13 | 13 | ||
14 | 14 | let scaleValue = 100000000 | |
15 | 15 | ||
16 | 16 | func getLastInterestInfo () = { | |
17 | 17 | let lastInterest = valueOrElse(getInteger(governanceAddr, keyLastInterest), 0) | |
18 | 18 | lastInterest | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getUserSWOPLocked (user) = valueOrElse(getInteger(governanceAddr, (toString(user) + keyUserSWOPLocked)), 0) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getUserInterestInfo (user,lastInterest) = { | |
26 | 26 | let userSWOPAmount = getUserSWOPLocked(user) | |
27 | 27 | let userLastInterest = getInteger(governanceAddr, (toString(user) + keyUserLastInterest)) | |
28 | 28 | let userLastInterestValue = match userLastInterest { | |
29 | 29 | case userLastInterest: Int => | |
30 | 30 | userLastInterest | |
31 | 31 | case _ => | |
32 | 32 | lastInterest | |
33 | 33 | } | |
34 | 34 | $Tuple2(userLastInterestValue, userSWOPAmount) | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func claimCalc (caller) = { | |
39 | 39 | let lastInterest = getLastInterestInfo() | |
40 | 40 | let uifo = getUserInterestInfo(caller, lastInterest) | |
41 | 41 | let userLastInterest = uifo._1 | |
42 | 42 | let userSWOPLocked = uifo._2 | |
43 | 43 | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
44 | 44 | let userNewInterest = lastInterest | |
45 | 45 | $Tuple2(userNewInterest, claimAmount) | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(i) | |
50 | 50 | func restakeGovernance (minSWOPreward) = if ((i.caller != serviceAddr)) | |
51 | 51 | then throw("Only staking service is allowed to call this func") | |
52 | 52 | else { | |
53 | 53 | let claimAmount = claimCalc(this)._2 | |
54 | 54 | if ((minSWOPreward > claimAmount)) | |
55 | 55 | then throw("Amount to claim is less than minSWOPreward") | |
56 | 56 | else { | |
57 | 57 | let z = invoke(governanceAddr, "claimAndStakeSWOP", nil, nil) | |
58 | 58 | if ((z == z)) | |
59 | 59 | then nil | |
60 | 60 | else throw("Strict value is not equal to itself.") | |
61 | 61 | } | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Verifier(tx) | |
66 | 66 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
67 | 67 |
github/deemru/w8io/169f3d6 55.29 ms ◑