tx · 48TQYq1gFvN2eGAMj6UVFDn4WQsyXYEDdKddjDBVVzeo

3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS:  -0.01400000 Waves

2021.10.25 17:43 [1761977] smart account 3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS > SELF 0.00000000 Waves

{ "type": 13, "id": "48TQYq1gFvN2eGAMj6UVFDn4WQsyXYEDdKddjDBVVzeo", "fee": 1400000, "feeAssetId": null, "timestamp": 1635173004858, "version": 1, "sender": "3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS", "senderPublicKey": "FWDMjbKuHyuUuAo4utnjwDgcbsiysMPDjX835SxvtLHq", "proofs": [ "41SUjqz5NFnbCMqZcTBmtmYnPvNSpin11vuhaY4bEqn1xP2sAMVQxfwj8WorjuheBWKmGkBg5ReSPvCDwibS33XH" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgASAwoBARIDCgEBAAAAFAAAAAAHYmFsYW5jZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVKMjU/C0oWt5judpFHXM19dztnXKmPy+aQAAAAARU1dPUGdvdmVybmFuY2VBZHIJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2JhbGFuY2UCAAAAD1NXT1BfZ292ZXJuYW5jZQIAAAAVRW1wdHkgU1dPUF9nb3Zlcm5hbmNlAAAAABdkZWZpaGVscGVyTWFuYWdlclB1YktleQkAAlkAAAABCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAAB2JhbGFuY2UCAAAAGWRlZmloZWxwZXJfbWFuYWdlcl9QdWJLZXkCAAAAI0VtcHR5IGtleSBkZWZpaGVscGVyX21hbmFnZXJfUHViS2V5AAAAAAxhZG1pblB1YktleTEBAAAAIJI0rvSL2N+4Jd3ss8OgEArwbahdnCXQKg1y+jLzTuJDAAAAAAxhZG1pblB1YktleTIBAAAAIJI0rvSL2N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sAwkAAAAAAAACBQAAAAF6BQAAAAF6CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAANYW10VG9XaXRoZHJhdwUAAAAEU1dPUAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAAvXLB5", "chainId": 84, "height": 1761977, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BwAM9u7cK6NRK8Yf21Zq87ZyCdyqFLCRrposwjkANaF9 Next: 6juBwX97hPpSRpMw8dL8zPfAp7PRdgBAckdEZZZnwEow Diff:
OldNewDifferences
55
66 let b = value(addressFromString(valueOrErrorMessage(getString(a, "SWOP_governance"), "Empty SWOP_governance")))
77
8-let c = value(addressFromString(valueOrErrorMessage(getString(a, "WAVES_USDN_Pool"), "Empty WAVES_USDN_Pool")))
8+let c = fromBase58String(valueOrElse(getString(a, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
99
10-let d = fromBase58String(valueOrElse(getString(a, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
10+let d = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1111
1212 let e = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1313
1414 let f = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1515
16-let g = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
16+let g = "owner"
1717
18-let h = "owner"
18+let h = "isProtocolActive"
1919
20-let i = "isProtocolActive"
20+let i = addressFromString(valueOrErrorMessage(getString(this, g), "Empty keyOwner"))
2121
22-let j = addressFromString(valueOrErrorMessage(getString(this, h), "Empty keyOwner"))
22+let j = valueOrErrorMessage(getString(this, g), "Empty keyOwner")
2323
24-let k = valueOrErrorMessage(getString(this, h), "Empty keyOwner")
24+let k = valueOrErrorMessage(getBoolean(a, h), "Empty key isProtocolActive")
2525
26-let l = valueOrErrorMessage(getBoolean(a, i), "Empty key isProtocolActive")
26+let l = "last_interest"
2727
28-let m = "last_interest"
28+let m = "_SWOP_amount"
2929
30-let n = "_SWOP_amount"
30+let n = "_last_interest"
3131
32-let o = "_last_interest"
32+let o = base58'Ccgesc9iWMSg1f8CqFP5nZwgF6xsGirReDhpvNp1JAWW'
3333
34-let p = base58'Ccgesc9iWMSg1f8CqFP5nZwgF6xsGirReDhpvNp1JAWW'
34+let p = 100000000
3535
36-let q = 100000000
37-
38-func r () = {
39- let s = valueOrElse(getInteger(b, m), 0)
40- s
36+func q () = {
37+ let r = valueOrElse(getInteger(b, l), 0)
38+ r
4139 }
4240
4341
44-func t () = {
45- let u = valueOrErrorMessage(getInteger(c, "B_asset_balance"), "Empty B_asset_balance")
46- let v = valueOrErrorMessage(getInteger(c, "A_asset_balance"), "Empty A_asset_balance")
47- let w = valueOrErrorMessage(getInteger(a, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn")
48- let x = fraction(u, w, v)
49- x
42+func s (t) = valueOrElse(getInteger(b, (toString(t) + m)), 0)
43+
44+
45+func u (t,r) = {
46+ let v = s(t)
47+ let w = getInteger(b, (toString(t) + n))
48+ let x = {
49+ let y = w
50+ if ($isInstanceOf(y, "Int"))
51+ then {
52+ let w = y
53+ w
54+ }
55+ else r
56+ }
57+ $Tuple2(x, v)
5058 }
5159
5260
53-func y (z) = valueOrElse(getInteger(b, (toString(z) + n)), 0)
54-
55-
56-func A (z,s) = {
57- let B = y(z)
58- let C = getInteger(b, (toString(z) + o))
59- let D = {
60- let E = C
61- if ($isInstanceOf(E, "Int"))
62- then {
63- let C = E
64- C
65- }
66- else s
67- }
68- $Tuple2(D, B)
61+func z (A) = {
62+ let r = q()
63+ let B = u(A, r)
64+ let w = B._1
65+ let C = B._2
66+ let D = fraction(C, (r - w), p)
67+ let E = r
68+ $Tuple2(E, D)
6969 }
7070
7171
72-func F (G) = {
73- let s = r()
74- let H = A(G, s)
75- let C = H._1
76- let I = H._2
77- let J = fraction(I, (s - C), q)
78- let K = s
79- $Tuple2(K, J)
80- }
81-
82-
83-let L = t()
84-
85-@Callable(M)
86-func init () = if (isDefined(getString(this, h)))
72+@Callable(F)
73+func init () = if (isDefined(getString(this, g)))
8774 then throw("Contract already initialized")
88- else if ((size(M.payments) == 0))
89- then [StringEntry(h, toString(M.caller))]
90- else if ((size(M.payments) == 1))
75+ else if ((size(F.payments) == 0))
76+ then [StringEntry(g, toString(F.caller))]
77+ else if ((size(F.payments) == 1))
9178 then {
92- let N = $Tuple2(M.payments[0].amount, M.payments[0].assetId)
93- let O = N._1
94- let P = N._2
95- if ((P != p))
79+ let G = $Tuple2(F.payments[0].amount, F.payments[0].assetId)
80+ let H = G._1
81+ let I = G._2
82+ if ((I != o))
9683 then throw("Only SWOP payment available in init()")
9784 else {
98- let Q = invoke(b, "lockSWOP", nil, [AttachedPayment(p, O)])
99- if ((Q == Q))
100- then [StringEntry(h, toString(M.caller))]
85+ let J = invoke(b, "lockSWOP", nil, [AttachedPayment(o, H)])
86+ if ((J == J))
87+ then [StringEntry(g, toString(F.caller))]
10188 else throw("Strict value is not equal to itself.")
10289 }
10390 }
10592
10693
10794
108-@Callable(M)
95+@Callable(F)
10996 func governanceLockSWOP () = {
110- let R = $Tuple2(M.payments[0].amount, M.payments[0].assetId)
111- let O = R._1
112- let P = R._2
113- if ((P != p))
97+ let K = $Tuple2(F.payments[0].amount, F.payments[0].assetId)
98+ let H = K._1
99+ let I = K._2
100+ if ((I != o))
114101 then throw("Only SWOP payment available in governanceLockSWOP()")
115102 else {
116- let Q = invoke(b, "lockSWOP", nil, [AttachedPayment(p, O)])
117- if ((Q == Q))
103+ let J = invoke(b, "lockSWOP", nil, [AttachedPayment(o, H)])
104+ if ((J == J))
118105 then nil
119106 else throw("Strict value is not equal to itself.")
120107 }
122109
123110
124111
125-@Callable(M)
126-func governanceClaimAndStake (S) = if (if ((M.caller != j))
127- then (M.callerPublicKey != d)
112+@Callable(F)
113+func governanceClaimAndStake (L) = if (if ((F.caller != i))
114+ then (F.callerPublicKey != c)
128115 else false)
129116 then throw("Only owner or admin can call this function")
130117 else {
131- let J = F(this)._2
132- if ((S > J))
118+ let D = z(this)._2
119+ if ((L > D))
133120 then throw("Amount to claim is less than minSWOPreward")
134121 else {
135- let Q = invoke(b, "claimAndStakeSWOP", nil, nil)
136- if ((Q == Q))
122+ let J = invoke(b, "claimAndStakeSWOP", nil, nil)
123+ if ((J == J))
137124 then {
138- let T = invoke(a, "extractFee", [L, k], nil)
139- if ((T == T))
125+ let M = invoke(a, "extractFee", [j], nil)
126+ if ((M == M))
140127 then nil
141128 else throw("Strict value is not equal to itself.")
142129 }
146133
147134
148135
149-@Callable(M)
150-func governanceWithdraw (U) = if ((M.caller != j))
136+@Callable(F)
137+func governanceWithdraw (N) = if ((F.caller != i))
151138 then throw("Only owner can call this function")
152139 else {
153- let Q = invoke(b, "withdrawSWOP", [U], nil)
154- if ((Q == Q))
155- then [ScriptTransfer(M.caller, U, p)]
140+ let J = invoke(b, "withdrawSWOP", [N], nil)
141+ if ((J == J))
142+ then [ScriptTransfer(F.caller, N, o)]
156143 else throw("Strict value is not equal to itself.")
157144 }
158145
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = Address(base58'3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J')
55
66 let b = value(addressFromString(valueOrErrorMessage(getString(a, "SWOP_governance"), "Empty SWOP_governance")))
77
8-let c = value(addressFromString(valueOrErrorMessage(getString(a, "WAVES_USDN_Pool"), "Empty WAVES_USDN_Pool")))
8+let c = fromBase58String(valueOrElse(getString(a, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
99
10-let d = fromBase58String(valueOrElse(getString(a, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
10+let d = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1111
1212 let e = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1313
1414 let f = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1515
16-let g = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
16+let g = "owner"
1717
18-let h = "owner"
18+let h = "isProtocolActive"
1919
20-let i = "isProtocolActive"
20+let i = addressFromString(valueOrErrorMessage(getString(this, g), "Empty keyOwner"))
2121
22-let j = addressFromString(valueOrErrorMessage(getString(this, h), "Empty keyOwner"))
22+let j = valueOrErrorMessage(getString(this, g), "Empty keyOwner")
2323
24-let k = valueOrErrorMessage(getString(this, h), "Empty keyOwner")
24+let k = valueOrErrorMessage(getBoolean(a, h), "Empty key isProtocolActive")
2525
26-let l = valueOrErrorMessage(getBoolean(a, i), "Empty key isProtocolActive")
26+let l = "last_interest"
2727
28-let m = "last_interest"
28+let m = "_SWOP_amount"
2929
30-let n = "_SWOP_amount"
30+let n = "_last_interest"
3131
32-let o = "_last_interest"
32+let o = base58'Ccgesc9iWMSg1f8CqFP5nZwgF6xsGirReDhpvNp1JAWW'
3333
34-let p = base58'Ccgesc9iWMSg1f8CqFP5nZwgF6xsGirReDhpvNp1JAWW'
34+let p = 100000000
3535
36-let q = 100000000
37-
38-func r () = {
39- let s = valueOrElse(getInteger(b, m), 0)
40- s
36+func q () = {
37+ let r = valueOrElse(getInteger(b, l), 0)
38+ r
4139 }
4240
4341
44-func t () = {
45- let u = valueOrErrorMessage(getInteger(c, "B_asset_balance"), "Empty B_asset_balance")
46- let v = valueOrErrorMessage(getInteger(c, "A_asset_balance"), "Empty A_asset_balance")
47- let w = valueOrErrorMessage(getInteger(a, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn")
48- let x = fraction(u, w, v)
49- x
42+func s (t) = valueOrElse(getInteger(b, (toString(t) + m)), 0)
43+
44+
45+func u (t,r) = {
46+ let v = s(t)
47+ let w = getInteger(b, (toString(t) + n))
48+ let x = {
49+ let y = w
50+ if ($isInstanceOf(y, "Int"))
51+ then {
52+ let w = y
53+ w
54+ }
55+ else r
56+ }
57+ $Tuple2(x, v)
5058 }
5159
5260
53-func y (z) = valueOrElse(getInteger(b, (toString(z) + n)), 0)
54-
55-
56-func A (z,s) = {
57- let B = y(z)
58- let C = getInteger(b, (toString(z) + o))
59- let D = {
60- let E = C
61- if ($isInstanceOf(E, "Int"))
62- then {
63- let C = E
64- C
65- }
66- else s
67- }
68- $Tuple2(D, B)
61+func z (A) = {
62+ let r = q()
63+ let B = u(A, r)
64+ let w = B._1
65+ let C = B._2
66+ let D = fraction(C, (r - w), p)
67+ let E = r
68+ $Tuple2(E, D)
6969 }
7070
7171
72-func F (G) = {
73- let s = r()
74- let H = A(G, s)
75- let C = H._1
76- let I = H._2
77- let J = fraction(I, (s - C), q)
78- let K = s
79- $Tuple2(K, J)
80- }
81-
82-
83-let L = t()
84-
85-@Callable(M)
86-func init () = if (isDefined(getString(this, h)))
72+@Callable(F)
73+func init () = if (isDefined(getString(this, g)))
8774 then throw("Contract already initialized")
88- else if ((size(M.payments) == 0))
89- then [StringEntry(h, toString(M.caller))]
90- else if ((size(M.payments) == 1))
75+ else if ((size(F.payments) == 0))
76+ then [StringEntry(g, toString(F.caller))]
77+ else if ((size(F.payments) == 1))
9178 then {
92- let N = $Tuple2(M.payments[0].amount, M.payments[0].assetId)
93- let O = N._1
94- let P = N._2
95- if ((P != p))
79+ let G = $Tuple2(F.payments[0].amount, F.payments[0].assetId)
80+ let H = G._1
81+ let I = G._2
82+ if ((I != o))
9683 then throw("Only SWOP payment available in init()")
9784 else {
98- let Q = invoke(b, "lockSWOP", nil, [AttachedPayment(p, O)])
99- if ((Q == Q))
100- then [StringEntry(h, toString(M.caller))]
85+ let J = invoke(b, "lockSWOP", nil, [AttachedPayment(o, H)])
86+ if ((J == J))
87+ then [StringEntry(g, toString(F.caller))]
10188 else throw("Strict value is not equal to itself.")
10289 }
10390 }
10491 else throw("Incorrect paynemt. You should attach SWOP or empty payment")
10592
10693
10794
108-@Callable(M)
95+@Callable(F)
10996 func governanceLockSWOP () = {
110- let R = $Tuple2(M.payments[0].amount, M.payments[0].assetId)
111- let O = R._1
112- let P = R._2
113- if ((P != p))
97+ let K = $Tuple2(F.payments[0].amount, F.payments[0].assetId)
98+ let H = K._1
99+ let I = K._2
100+ if ((I != o))
114101 then throw("Only SWOP payment available in governanceLockSWOP()")
115102 else {
116- let Q = invoke(b, "lockSWOP", nil, [AttachedPayment(p, O)])
117- if ((Q == Q))
103+ let J = invoke(b, "lockSWOP", nil, [AttachedPayment(o, H)])
104+ if ((J == J))
118105 then nil
119106 else throw("Strict value is not equal to itself.")
120107 }
121108 }
122109
123110
124111
125-@Callable(M)
126-func governanceClaimAndStake (S) = if (if ((M.caller != j))
127- then (M.callerPublicKey != d)
112+@Callable(F)
113+func governanceClaimAndStake (L) = if (if ((F.caller != i))
114+ then (F.callerPublicKey != c)
128115 else false)
129116 then throw("Only owner or admin can call this function")
130117 else {
131- let J = F(this)._2
132- if ((S > J))
118+ let D = z(this)._2
119+ if ((L > D))
133120 then throw("Amount to claim is less than minSWOPreward")
134121 else {
135- let Q = invoke(b, "claimAndStakeSWOP", nil, nil)
136- if ((Q == Q))
122+ let J = invoke(b, "claimAndStakeSWOP", nil, nil)
123+ if ((J == J))
137124 then {
138- let T = invoke(a, "extractFee", [L, k], nil)
139- if ((T == T))
125+ let M = invoke(a, "extractFee", [j], nil)
126+ if ((M == M))
140127 then nil
141128 else throw("Strict value is not equal to itself.")
142129 }
143130 else throw("Strict value is not equal to itself.")
144131 }
145132 }
146133
147134
148135
149-@Callable(M)
150-func governanceWithdraw (U) = if ((M.caller != j))
136+@Callable(F)
137+func governanceWithdraw (N) = if ((F.caller != i))
151138 then throw("Only owner can call this function")
152139 else {
153- let Q = invoke(b, "withdrawSWOP", [U], nil)
154- if ((Q == Q))
155- then [ScriptTransfer(M.caller, U, p)]
140+ let J = invoke(b, "withdrawSWOP", [N], nil)
141+ if ((J == J))
142+ then [ScriptTransfer(F.caller, N, o)]
156143 else throw("Strict value is not equal to itself.")
157144 }
158145
159146

github/deemru/w8io/169f3d6 
69.61 ms