tx · 8xYQ8snZP2T8CbuqkkLd9xSiLywUgrNKxAjKcjy3udfT

3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J:  -0.01400000 Waves

2021.10.25 18:01 [1761998] smart account 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J > SELF 0.00000000 Waves

{ "type": 13, "id": "8xYQ8snZP2T8CbuqkkLd9xSiLywUgrNKxAjKcjy3udfT", "fee": 1400000, "feeAssetId": null, "timestamp": 1635174059890, "version": 1, "sender": "3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J", "senderPublicKey": "B7ayemTreAJnAMuzH9P3MnVXhpL6PTtRBrV29h7EUS1H", "proofs": [ "4a1FvQbeFC87cDPBrZvGjbA7d9LjAHNFyXTTzk6HrD4EjijHyUs2qJyfLLYXjLXAm2NkuHdKpeQuaJFjsKd1EJ84" ], "script": "base64:AAIFAAAAAAAAACMIAhIGCgQICAgBEgQKAggEEgMKAQESAwoBCBIAEgMKAQESAAAAAAsAAAAADlNXT1Bnb3Zlcm5hbmNlCQAEJgAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAPU1dPUF9nb3Zlcm5hbmNlAgAAACFFbXB0eSBrZXkgU1dPUF9nb3Zlcm5hbmNlX2FkZHJlc3MAAAAADVdhdmVzVXNkblBvb2wJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAA9XQVZFU19VU0ROX1Bvb2wCAAAAIUVtcHR5IGtleSBTV09QX2dvdmVybmFuY2VfYWRkcmVzcwAAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkJAAJZAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABlkZWZpaGVscGVyX21hbmFnZXJfUHViS2V5AgAAACNFbXB0eSBrZXkgZGVmaWhlbHBlcl9tY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AIAAAABAgAAABt3aXRoZHJhd0FtdCA+IGNhbGxlckJhbGFuY2UJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAJY2FsbGVyU3RyBQAAAAprZXlCYWxhbmNlCQAAZQAAAAIFAAAADWNhbGxlckJhbGFuY2UFAAAAC3dpdGhkcmF3QW10CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALd2l0aGRyYXdBbXQFAAAABHVuaXQFAAAAA25pbAAAAAFpAQAAAAhzaHV0ZG93bgAAAAADCQEAAAABIQAAAAEFAAAAEGlzUHJvdG9jb2xBY3RpdmUJAAACAAAAAQIAAAAXUHJvdG9sIHN0b3BwZWQgYnkgYWRtaW4DCQEAAAABIQAAAAEJAQAAAA9jb250YWluc0VsZW1lbnQAAAACCQAETAAAAAIFAAAADGFkbWluUHViS2V5MQkABEwAAAACBQAAAAxhZG1pblB1YktleTIJAARMAAAAAgUAAAAMYWRtaW5QdWJLZXkzCQAETAAAAAIFAAAAF2RlZmloZWxwZXJNYW5hZ2VyUHViS2V5BQAAAANuaWwIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQkAAAIAAAABAgAAACFPbmx5IGFkbWluIGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24JAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAICAAAAEGlzUHJvdG9jb2xBY3RpdmUHBQAAAANuaWwAAAAAOfBa3Q==", "chainId": 84, "height": 1761998, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CKVjj69GXanas2VXVMcfxKscKWYGkogRBXf4di8ytVBW Next: none Diff:
OldNewDifferences
8383 then throw("This automate is inactive")
8484 else {
8585 let B = p()
86- if (true)
87- then throw(toString(B))
88- else {
89- let C = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
90- let D = (C - B)
91- if ((0 > D))
92- then throw(("Insufficient balance:" + toString(D)))
93- else [IntegerEntry((z + g), D)]
94- }
86+ let C = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
87+ let D = (C - B)
88+ if ((0 > D))
89+ then throw(("Insufficient balance:" + toString(D)))
90+ else [IntegerEntry((z + g), D)]
9591 }
9692 }
9793
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = addressFromString(valueOrElse(getString(this, "SWOP_governance"), "Empty key SWOP_governance_address"))
55
66 let b = value(addressFromString(valueOrElse(getString(this, "WAVES_USDN_Pool"), "Empty key SWOP_governance_address")))
77
88 let c = fromBase58String(valueOrElse(getString(this, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey"))
99
1010 let d = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1111
1212 let e = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1313
1414 let f = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv'
1515
1616 let g = "_balance"
1717
1818 let h = "fee_in_usdn"
1919
2020 let i = valueOrErrorMessage(getBoolean(this, "isProtocolActive"), "Empty key isProtocolActive")
2121
2222 func j (k) = {
2323 let l = {
2424 let m = getInteger(this, (k + g))
2525 if ($isInstanceOf(m, "Int"))
2626 then {
2727 let n = m
2828 n
2929 }
3030 else if ($isInstanceOf(m, "Unit"))
3131 then {
3232 let o = m
3333 0
3434 }
3535 else throw("Match error")
3636 }
3737 l
3838 }
3939
4040
4141 func p () = {
4242 let q = valueOrErrorMessage(getInteger(b, "B_asset_balance"), "Empty B_asset_balance")
4343 let r = valueOrErrorMessage(getInteger(b, "A_asset_balance"), "Empty A_asset_balance")
4444 let s = valueOrErrorMessage(getInteger(this, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn")
4545 let t = fraction(s, r, q)
4646 t
4747 }
4848
4949
5050 @Callable(u)
5151 func init (c,b,v,w) = if (if (isDefined(getString(this, "WAVES_USDN_Pool")))
5252 then true
5353 else isDefined(getString(this, "defihelper_manager_PubKey")))
5454 then throw("Already initialized")
5555 else [StringEntry("defihelper_manager_PubKey", c), StringEntry("WAVES_USDN_Pool", b), StringEntry("SWOP_governance", v), IntegerEntry("protocol_fee_in_usdn", w), BooleanEntry("isProtocolActive", true)]
5656
5757
5858
5959 @Callable(u)
6060 func updateAutomateStatus (x,y) = if (!(i))
6161 then throw("Protol stopped by admin")
6262 else if (!(containsElement([c], u.callerPublicKey)))
6363 then throw("Only admin can call this function")
6464 else [BooleanEntry(x, y)]
6565
6666
6767
6868 @Callable(u)
6969 func updateProtocolFee (w) = if (!(i))
7070 then throw("Protol stopped by admin")
7171 else if (!(containsElement([c], u.callerPublicKey)))
7272 then throw("Only admin can call this function")
7373 else [IntegerEntry("protocol_fee_in_usdn", w)]
7474
7575
7676
7777 @Callable(u)
7878 func extractFee (z) = if (!(i))
7979 then throw("Protol stopped by admin")
8080 else {
8181 let A = valueOrErrorMessage(getBoolean(this, toString(u.caller)), ("Empty key i.caller: " + toString(u.caller)))
8282 if (!(A))
8383 then throw("This automate is inactive")
8484 else {
8585 let B = p()
86- if (true)
87- then throw(toString(B))
88- else {
89- let C = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
90- let D = (C - B)
91- if ((0 > D))
92- then throw(("Insufficient balance:" + toString(D)))
93- else [IntegerEntry((z + g), D)]
94- }
86+ let C = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
87+ let D = (C - B)
88+ if ((0 > D))
89+ then throw(("Insufficient balance:" + toString(D)))
90+ else [IntegerEntry((z + g), D)]
9591 }
9692 }
9793
9894
9995
10096 @Callable(u)
10197 func replanishBalance () = if (!(i))
10298 then throw("Protol stopped by admin")
10399 else {
104100 let E = $Tuple2(u.payments[0].amount, u.payments[0].assetId)
105101 let F = E._1
106102 let G = E._2
107103 if ((G != unit))
108104 then throw("Only WAVES available for replanishment")
109105 else {
110106 let k = toString(u.caller)
111107 let l = j(k)
112108 [IntegerEntry((k + g), (l + F))]
113109 }
114110 }
115111
116112
117113
118114 @Callable(u)
119115 func withdraw (H) = if (!(i))
120116 then throw("Protol stopped by admin")
121117 else {
122118 let k = toString(u.caller)
123119 let l = j(k)
124120 if ((H > l))
125121 then throw("withdrawAmt > callerBalance")
126122 else [IntegerEntry((k + g), (l - H)), ScriptTransfer(u.caller, H, unit)]
127123 }
128124
129125
130126
131127 @Callable(u)
132128 func shutdown () = if (!(i))
133129 then throw("Protol stopped by admin")
134130 else if (!(containsElement([d, e, f, c], u.callerPublicKey)))
135131 then throw("Only admin can call this function")
136132 else [BooleanEntry("isProtocolActive", false)]
137133
138134

github/deemru/w8io/169f3d6 
44.12 ms