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