tx · CFZDnpoB7tPFQuLf4DKLeNB5To5hKDfnXFHcBCZ3sxoR

3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS:  -0.01400000 Waves

2021.10.25 01:06 [1760981] smart account 3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS > SELF 0.00000000 Waves

{ "type": 13, "id": "CFZDnpoB7tPFQuLf4DKLeNB5To5hKDfnXFHcBCZ3sxoR", "fee": 1400000, "feeAssetId": null, "timestamp": 1635113209565, "version": 1, "sender": "3MxaubN2nHCzE5spNox3ZCbPbDMfczSFrZS", "senderPublicKey": "FWDMjbKuHyuUuAo4utnjwDgcbsiysMPDjX835SxvtLHq", "proofs": [ "4kGmed98CqaAmgFXD7i8dZ5QaCD69jn7JgSJvRFYgmA2MHwpQSXcMWo6zv6KmxR173gAn2s3z8DgmChLZ2HThXd5" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgASAwoBARIDCgEBAAAAFgAAAAAHYmFsYW5jZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMiyryG3C7/Yidq0/9LPxzKMhegBrag41AAAAAARU1dPUGdvdmVybmFuY2VBZHIJAAQmAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAAB2JhbGFuY2UCAAAAD1NXT1BfZ292ZXJuYW5jZQIAAAAVRW1wdHkgU1dPUF9nb3Zlcm5hbmNlAAAAAA1XYXZlc1VzZG5Qb29sCQEAAAAFdmFsdWUAAAABCQAEJgAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdiYWxhbmNlAgAAAA9XQVZFU19VU0ROX1Bvb2wCAAAAFUVtcHR5IFdBVkVTX1VTRE5fUG9vbAAAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkJAAJZAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAdiYWxhbmNlAgAAABlkZWZpaGVscGVyX21hb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WwgdG8gaXRzZWxmLgAAAACuvhpV", "chainId": 84, "height": 1760981, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 42TUUXdLX7CDFFR5otWW2R69MzMSo7qGxg439VChX8gV Next: QxeGZwg1YtKN9D3oHkZy36REht5146qMa4xwRtZuYbi Diff:
OldNewDifferences
7878 }
7979
8080
81-@Callable(K)
81+let K = s()
82+
83+@Callable(L)
8284 func init () = if (isDefined(getString(this, h)))
8385 then throw("Contract already initialized")
84- else if ((size(K.payments) == 0))
85- then [StringEntry(h, toString(K.caller))]
86- else if ((size(K.payments) == 1))
86+ else if ((size(L.payments) == 0))
87+ then [StringEntry(h, toString(L.caller))]
88+ else if ((size(L.payments) == 1))
8789 then {
88- let L = $Tuple2(K.payments[0].amount, K.payments[0].assetId)
89- let M = L._1
90- let N = L._2
91- if ((N != o))
90+ let M = $Tuple2(L.payments[0].amount, L.payments[0].assetId)
91+ let N = M._1
92+ let O = M._2
93+ if ((O != o))
9294 then throw("Only SWOP payment available in init()")
9395 else {
94- let O = invoke(i, "lockSWOP", nil, [AttachedPayment(o, M)])
95- if ((O == O))
96- then {
97- let P = invoke(a, "updateBalance", [100], nil)
98- if ((P == P))
99- then [StringEntry(h, toString(K.caller))]
100- else throw("Strict value is not equal to itself.")
101- }
96+ let P = invoke(i, "lockSWOP", nil, [AttachedPayment(o, N)])
97+ if ((P == P))
98+ then [StringEntry(h, toString(L.caller))]
10299 else throw("Strict value is not equal to itself.")
103100 }
104101 }
106103
107104
108105
109-@Callable(K)
106+@Callable(L)
110107 func governanceLockSWOP () = {
111- let Q = $Tuple2(K.payments[0].amount, K.payments[0].assetId)
112- let M = Q._1
113- let N = Q._2
114- if ((N != o))
108+ let Q = $Tuple2(L.payments[0].amount, L.payments[0].assetId)
109+ let N = Q._1
110+ let O = Q._2
111+ if ((O != o))
115112 then throw("Only SWOP payment available in governanceLockSWOP()")
116113 else {
117- let O = invoke(i, "lockSWOP", nil, [AttachedPayment(o, M)])
118- if ((O == O))
119- then [StringEntry(h, toString(K.caller))]
114+ let P = invoke(i, "lockSWOP", nil, [AttachedPayment(o, N)])
115+ if ((P == P))
116+ then [StringEntry(h, toString(L.caller))]
120117 else throw("Strict value is not equal to itself.")
121118 }
122119 }
123120
124121
125122
126-@Callable(K)
127-func governanceClaimAndStake (R) = if (if ((K.caller != j))
128- then (K.callerPublicKey != d)
123+@Callable(L)
124+func governanceClaimAndStake (R) = if (if ((L.caller != j))
125+ then (L.callerPublicKey != d)
129126 else false)
130127 then throw("Only owner or admin can call this function")
131128 else {
133130 if ((R > I))
134131 then throw("Amount to claim is less than minSWOPreward")
135132 else {
136- let O = invoke(i, "claimAndStakeSWOP", nil, nil)
137- if ((O == O))
138- then nil
133+ let P = invoke(i, "claimAndStakeSWOP", nil, nil)
134+ if ((P == P))
135+ then {
136+ let S = invoke(a, "extractFee", [K], nil)
137+ if ((S == S))
138+ then nil
139+ else throw("Strict value is not equal to itself.")
140+ }
139141 else throw("Strict value is not equal to itself.")
140142 }
141143 }
142144
143145
144146
145-@Callable(K)
146-func governanceWithdraw (S) = if ((K.caller != j))
147+@Callable(L)
148+func governanceWithdraw (T) = if ((L.caller != j))
147149 then throw("Only owner can call this function")
148150 else {
149- let O = invoke(i, "withdrawSWOP", [S], nil)
150- if ((O == O))
151- then [ScriptTransfer(K.caller, S, o)]
151+ let P = invoke(i, "withdrawSWOP", [T], nil)
152+ if ((P == P))
153+ then [ScriptTransfer(L.caller, T, o)]
152154 else throw("Strict value is not equal to itself.")
153155 }
154156
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = Address(base58'3N8DGyUZufuYfENW6HZovoKaTkD3ESpAPj1')
55
66 let b = addressFromString(valueOrErrorMessage(getString(a, "SWOP_governance"), "Empty SWOP_governance"))
77
88 let c = value(addressFromString(valueOrErrorMessage(getString(a, "WAVES_USDN_Pool"), "Empty WAVES_USDN_Pool")))
99
1010 let d = fromBase58String(valueOrElse(getString(a, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
1111
1212 let e = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1313
1414 let f = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1515
1616 let g = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1717
1818 let h = "owner"
1919
2020 let i = Address(base58'3N5W8da2iiijVieA6qLGo7KzCJj8B19smWU')
2121
2222 let j = addressFromString(valueOrErrorMessage(getString(this, "keyOwner"), "Empty keyOwner"))
2323
2424 let k = valueOrErrorMessage(getBoolean(a, "isProtocolActive"), "Empty key isProtocolActive")
2525
2626 let l = "last_interest"
2727
2828 let m = "_SWOP_amount"
2929
3030 let n = "_last_interest"
3131
3232 let o = base58'Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT'
3333
3434 let p = 100000000
3535
3636 func q () = {
3737 let r = valueOrElse(getInteger(i, l), 0)
3838 r
3939 }
4040
4141
4242 func s () = {
4343 let t = valueOrErrorMessage(getInteger(c, "B_asset_balance"), "Empty B_asset_balance")
4444 let u = valueOrErrorMessage(getInteger(c, "A_asset_balance"), "Empty A_asset_balance")
4545 let v = valueOrErrorMessage(getInteger(a, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn")
4646 let w = fraction(t, v, u)
4747 w
4848 }
4949
5050
5151 func x (y) = valueOrElse(getInteger(i, (toString(y) + m)), 0)
5252
5353
5454 func z (y,r) = {
5555 let A = x(y)
5656 let B = getInteger(i, (toString(y) + n))
5757 let C = {
5858 let D = B
5959 if ($isInstanceOf(D, "Int"))
6060 then {
6161 let B = D
6262 B
6363 }
6464 else r
6565 }
6666 $Tuple2(C, A)
6767 }
6868
6969
7070 func E (F) = {
7171 let r = q()
7272 let G = z(F, r)
7373 let B = G._1
7474 let H = G._2
7575 let I = fraction(H, (r - B), p)
7676 let J = r
7777 $Tuple2(J, I)
7878 }
7979
8080
81-@Callable(K)
81+let K = s()
82+
83+@Callable(L)
8284 func init () = if (isDefined(getString(this, h)))
8385 then throw("Contract already initialized")
84- else if ((size(K.payments) == 0))
85- then [StringEntry(h, toString(K.caller))]
86- else if ((size(K.payments) == 1))
86+ else if ((size(L.payments) == 0))
87+ then [StringEntry(h, toString(L.caller))]
88+ else if ((size(L.payments) == 1))
8789 then {
88- let L = $Tuple2(K.payments[0].amount, K.payments[0].assetId)
89- let M = L._1
90- let N = L._2
91- if ((N != o))
90+ let M = $Tuple2(L.payments[0].amount, L.payments[0].assetId)
91+ let N = M._1
92+ let O = M._2
93+ if ((O != o))
9294 then throw("Only SWOP payment available in init()")
9395 else {
94- let O = invoke(i, "lockSWOP", nil, [AttachedPayment(o, M)])
95- if ((O == O))
96- then {
97- let P = invoke(a, "updateBalance", [100], nil)
98- if ((P == P))
99- then [StringEntry(h, toString(K.caller))]
100- else throw("Strict value is not equal to itself.")
101- }
96+ let P = invoke(i, "lockSWOP", nil, [AttachedPayment(o, N)])
97+ if ((P == P))
98+ then [StringEntry(h, toString(L.caller))]
10299 else throw("Strict value is not equal to itself.")
103100 }
104101 }
105102 else throw("Incorrect paynemt. You should attach SWOP or empty payment")
106103
107104
108105
109-@Callable(K)
106+@Callable(L)
110107 func governanceLockSWOP () = {
111- let Q = $Tuple2(K.payments[0].amount, K.payments[0].assetId)
112- let M = Q._1
113- let N = Q._2
114- if ((N != o))
108+ let Q = $Tuple2(L.payments[0].amount, L.payments[0].assetId)
109+ let N = Q._1
110+ let O = Q._2
111+ if ((O != o))
115112 then throw("Only SWOP payment available in governanceLockSWOP()")
116113 else {
117- let O = invoke(i, "lockSWOP", nil, [AttachedPayment(o, M)])
118- if ((O == O))
119- then [StringEntry(h, toString(K.caller))]
114+ let P = invoke(i, "lockSWOP", nil, [AttachedPayment(o, N)])
115+ if ((P == P))
116+ then [StringEntry(h, toString(L.caller))]
120117 else throw("Strict value is not equal to itself.")
121118 }
122119 }
123120
124121
125122
126-@Callable(K)
127-func governanceClaimAndStake (R) = if (if ((K.caller != j))
128- then (K.callerPublicKey != d)
123+@Callable(L)
124+func governanceClaimAndStake (R) = if (if ((L.caller != j))
125+ then (L.callerPublicKey != d)
129126 else false)
130127 then throw("Only owner or admin can call this function")
131128 else {
132129 let I = E(this)._2
133130 if ((R > I))
134131 then throw("Amount to claim is less than minSWOPreward")
135132 else {
136- let O = invoke(i, "claimAndStakeSWOP", nil, nil)
137- if ((O == O))
138- then nil
133+ let P = invoke(i, "claimAndStakeSWOP", nil, nil)
134+ if ((P == P))
135+ then {
136+ let S = invoke(a, "extractFee", [K], nil)
137+ if ((S == S))
138+ then nil
139+ else throw("Strict value is not equal to itself.")
140+ }
139141 else throw("Strict value is not equal to itself.")
140142 }
141143 }
142144
143145
144146
145-@Callable(K)
146-func governanceWithdraw (S) = if ((K.caller != j))
147+@Callable(L)
148+func governanceWithdraw (T) = if ((L.caller != j))
147149 then throw("Only owner can call this function")
148150 else {
149- let O = invoke(i, "withdrawSWOP", [S], nil)
150- if ((O == O))
151- then [ScriptTransfer(K.caller, S, o)]
151+ let P = invoke(i, "withdrawSWOP", [T], nil)
152+ if ((P == P))
153+ then [ScriptTransfer(L.caller, T, o)]
152154 else throw("Strict value is not equal to itself.")
153155 }
154156
155157

github/deemru/w8io/169f3d6 
47.97 ms