tx · 5DnPEMBev1fh4HZZUEYfdfJVFdfccUijNWXCzHWpXKJF 3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS: -0.01400000 Waves 2021.10.25 17:17 [1761951] smart account 3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS > SELF 0.00000000 Waves
{ "type": 13, "id": "5DnPEMBev1fh4HZZUEYfdfJVFdfccUijNWXCzHWpXKJF", "fee": 1400000, "feeAssetId": null, "timestamp": 1635171508424, "version": 1, "sender": "3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS", "senderPublicKey": "FWDMjbKuHyuUuAo4utnjwDgcbsiysMPDjX835SxvtLHq", "proofs": [ "3Zp2aKN6LvTFcsFbXghrqT5DVfVWHajD77BJGFxDuesrjy9EPFSQvUNKXAiMLJqGTj7umWw3UG1g8Uume5h9N4yZ" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgASAwoBARIDCgEBAAAAFgAAAAAHYmFsYW5jZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVKMjU/C0oWt5judpFHXM19dztnXKmPy+aQAAAAARU1dPUGdvdmVybmFuY2VBZHIJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2JhbGFuY2UCAAAAD1NXT1BfZ292ZXJuYW5jZQIAAAAVRW1wdHkgU1dPUF9nb3Zlcm5hbmNlAAAAAA1XYXZlc1VzZG5Qb29sCQEAAAAFdmFsdWUAAAABCQAEJgAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdiYWxhbmNlAgAAAA9XQVZFU19VU0ROX1Bvb2wCAAAAFUVtcHR5IFdBVkVTX1VTRE5fUG9vbAAAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkJAAJZAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAdiYWxhbmNlAgAAABl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AABAgAAACpBbW91bnQgdG8gY2xhaW0gaXMgbGVzcyB0aGFuIG1pblNXT1ByZXdhcmQEAAAAAXoJAAP8AAAABAUAAAARU1dPUGdvdmVybmFuY2VBZHICAAAAEWNsYWltQW5kU3Rha2VTV09QCQAETAAAAAIFAAAABW93bmVyBQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAABegUAAAABegQAAAABeQkAA/wAAAAEBQAAAAdiYWxhbmNlAgAAAApleHRyYWN0RmVlCQAETAAAAAIFAAAAC3Byb3RvY29sRmVlBQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAABeQUAAAABeQUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABaQEAAAASZ292ZXJuYW5jZVdpdGhkcmF3AAAAAQAAAA1hbXRUb1dpdGhkcmF3AwkBAAAAAiE9AAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAVvd25lcgkAAAIAAAABAgAAACFPbmx5IG93bmVyIGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24EAAAAAXoJAAP8AAAABAUAAAARU1dPUGdvdmVybmFuY2VBZHICAAAADHdpdGhkcmF3U1dPUAkABEwAAAACBQAAAA1hbXRUb1dpdGhkcmF3BQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAABegUAAAABegkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWFtdFRvV2l0aGRyYXcFAAAABFNXT1AFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAZu7TZQ==", "chainId": 84, "height": 1761951, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4EfPqzkJAHf9sjnjyccdb8Y8pb8Xw9u5kfHdvXj8PCWZ Next: 3sjRy5uvZd8M25EaoMwU1owfxMU4KThg1xVRdwe982vP Diff:
Old | New | Differences | |
---|---|---|---|
127 | 127 | if ((minSWOPreward > claimAmount)) | |
128 | 128 | then throw("Amount to claim is less than minSWOPreward") | |
129 | 129 | else { | |
130 | - | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", | |
130 | + | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", [owner], nil) | |
131 | 131 | if ((z == z)) | |
132 | 132 | then { | |
133 | 133 | let y = invoke(balance, "extractFee", [protocolFee], nil) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let balance = Address(base58'3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J') | |
5 | 5 | ||
6 | 6 | let SWOPgovernanceAdr = value(addressFromString(valueOrErrorMessage(getString(balance, "SWOP_governance"), "Empty SWOP_governance"))) | |
7 | 7 | ||
8 | 8 | let WavesUsdnPool = value(addressFromString(valueOrErrorMessage(getString(balance, "WAVES_USDN_Pool"), "Empty WAVES_USDN_Pool"))) | |
9 | 9 | ||
10 | 10 | let defihelperManagerPubKey = fromBase58String(valueOrElse(getString(balance, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey")) | |
11 | 11 | ||
12 | 12 | let adminPubKey1 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
13 | 13 | ||
14 | 14 | let adminPubKey2 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
15 | 15 | ||
16 | 16 | let adminPubKey3 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
17 | 17 | ||
18 | 18 | let keyOwner = "owner" | |
19 | 19 | ||
20 | 20 | let keyIsProtocolActive = "isProtocolActive" | |
21 | 21 | ||
22 | 22 | let owner = addressFromString(valueOrErrorMessage(getString(this, keyOwner), "Empty keyOwner")) | |
23 | 23 | ||
24 | 24 | let isProtocolActive = valueOrErrorMessage(getBoolean(balance, keyIsProtocolActive), "Empty key isProtocolActive") | |
25 | 25 | ||
26 | 26 | let keyLastInterest = "last_interest" | |
27 | 27 | ||
28 | 28 | let keyUserSWOPLocked = "_SWOP_amount" | |
29 | 29 | ||
30 | 30 | let keyUserLastInterest = "_last_interest" | |
31 | 31 | ||
32 | 32 | let SWOP = base58'Ccgesc9iWMSg1f8CqFP5nZwgF6xsGirReDhpvNp1JAWW' | |
33 | 33 | ||
34 | 34 | let scaleValue = 100000000 | |
35 | 35 | ||
36 | 36 | func getLastInterestInfo () = { | |
37 | 37 | let lastInterest = valueOrElse(getInteger(SWOPgovernanceAdr, keyLastInterest), 0) | |
38 | 38 | lastInterest | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func calcWavesProtocolFee () = { | |
43 | 43 | let balanceUSDN = valueOrErrorMessage(getInteger(WavesUsdnPool, "B_asset_balance"), "Empty B_asset_balance") | |
44 | 44 | let balanceWAVES = valueOrErrorMessage(getInteger(WavesUsdnPool, "A_asset_balance"), "Empty A_asset_balance") | |
45 | 45 | let feeInUSDN = valueOrErrorMessage(getInteger(balance, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn") | |
46 | 46 | let priceWAVES = fraction(balanceUSDN, feeInUSDN, balanceWAVES) | |
47 | 47 | priceWAVES | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getUserSWOPLocked (user) = valueOrElse(getInteger(SWOPgovernanceAdr, (toString(user) + keyUserSWOPLocked)), 0) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getUserInterestInfo (user,lastInterest) = { | |
55 | 55 | let userSWOPAmount = getUserSWOPLocked(user) | |
56 | 56 | let userLastInterest = getInteger(SWOPgovernanceAdr, (toString(user) + keyUserLastInterest)) | |
57 | 57 | let userLastInterestValue = match userLastInterest { | |
58 | 58 | case userLastInterest: Int => | |
59 | 59 | userLastInterest | |
60 | 60 | case _ => | |
61 | 61 | lastInterest | |
62 | 62 | } | |
63 | 63 | $Tuple2(userLastInterestValue, userSWOPAmount) | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func claimCalc (caller) = { | |
68 | 68 | let lastInterest = getLastInterestInfo() | |
69 | 69 | let uifo = getUserInterestInfo(caller, lastInterest) | |
70 | 70 | let userLastInterest = uifo._1 | |
71 | 71 | let userSWOPLocked = uifo._2 | |
72 | 72 | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
73 | 73 | let userNewInterest = lastInterest | |
74 | 74 | $Tuple2(userNewInterest, claimAmount) | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | let protocolFee = calcWavesProtocolFee() | |
79 | 79 | ||
80 | 80 | @Callable(i) | |
81 | 81 | func init () = if (isDefined(getString(this, keyOwner))) | |
82 | 82 | then throw("Contract already initialized") | |
83 | 83 | else if ((size(i.payments) == 0)) | |
84 | 84 | then [StringEntry(keyOwner, toString(i.caller))] | |
85 | 85 | else if ((size(i.payments) == 1)) | |
86 | 86 | then { | |
87 | 87 | let $t033113386 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
88 | 88 | let pmtAmount = $t033113386._1 | |
89 | 89 | let pmtAssetId = $t033113386._2 | |
90 | 90 | if ((pmtAssetId != SWOP)) | |
91 | 91 | then throw("Only SWOP payment available in init()") | |
92 | 92 | else { | |
93 | 93 | let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)]) | |
94 | 94 | if ((z == z)) | |
95 | 95 | then [StringEntry(keyOwner, toString(i.caller))] | |
96 | 96 | else throw("Strict value is not equal to itself.") | |
97 | 97 | } | |
98 | 98 | } | |
99 | 99 | else throw("Incorrect paynemt. You should attach SWOP or empty payment") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func governanceLockSWOP () = { | |
105 | 105 | let $t038003875 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
106 | 106 | let pmtAmount = $t038003875._1 | |
107 | 107 | let pmtAssetId = $t038003875._2 | |
108 | 108 | if ((pmtAssetId != SWOP)) | |
109 | 109 | then throw("Only SWOP payment available in governanceLockSWOP()") | |
110 | 110 | else { | |
111 | 111 | let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)]) | |
112 | 112 | if ((z == z)) | |
113 | 113 | then nil | |
114 | 114 | else throw("Strict value is not equal to itself.") | |
115 | 115 | } | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func governanceClaimAndStake (minSWOPreward) = if (if ((i.caller != owner)) | |
122 | 122 | then (i.callerPublicKey != defihelperManagerPubKey) | |
123 | 123 | else false) | |
124 | 124 | then throw("Only owner or admin can call this function") | |
125 | 125 | else { | |
126 | 126 | let claimAmount = claimCalc(this)._2 | |
127 | 127 | if ((minSWOPreward > claimAmount)) | |
128 | 128 | then throw("Amount to claim is less than minSWOPreward") | |
129 | 129 | else { | |
130 | - | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", | |
130 | + | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", [owner], nil) | |
131 | 131 | if ((z == z)) | |
132 | 132 | then { | |
133 | 133 | let y = invoke(balance, "extractFee", [protocolFee], nil) | |
134 | 134 | if ((y == y)) | |
135 | 135 | then nil | |
136 | 136 | else throw("Strict value is not equal to itself.") | |
137 | 137 | } | |
138 | 138 | else throw("Strict value is not equal to itself.") | |
139 | 139 | } | |
140 | 140 | } | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | ||
144 | 144 | @Callable(i) | |
145 | 145 | func governanceWithdraw (amtToWithdraw) = if ((i.caller != owner)) | |
146 | 146 | then throw("Only owner can call this function") | |
147 | 147 | else { | |
148 | 148 | let z = invoke(SWOPgovernanceAdr, "withdrawSWOP", [amtToWithdraw], nil) | |
149 | 149 | if ((z == z)) | |
150 | 150 | then [ScriptTransfer(i.caller, amtToWithdraw, SWOP)] | |
151 | 151 | else throw("Strict value is not equal to itself.") | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 |
github/deemru/w8io/169f3d6 32.64 ms ◑