tx · A4fk2dJdU4AkEp7eFUNcteuBJrvLd668bPRM5v73cpsk

3NDCcfUw3NdSjTPHukj85CQZrt1WmB9aWA9:  -0.01400000 Waves

2021.10.26 23:07 [1763723] smart account 3NDCcfUw3NdSjTPHukj85CQZrt1WmB9aWA9 > SELF 0.00000000 Waves

{ "type": 13, "id": "A4fk2dJdU4AkEp7eFUNcteuBJrvLd668bPRM5v73cpsk", "fee": 1400000, "feeAssetId": null, "timestamp": 1635278884861, "version": 1, "sender": "3NDCcfUw3NdSjTPHukj85CQZrt1WmB9aWA9", "senderPublicKey": "Ft1jz1c1eR7JbyAxdiSRJ1d4qkBH7DSdv89PspmNK5dq", "proofs": [ "3mFSs9QjtW8kYKj9nSSGUuHTBnhLpjytNzV56xKtYLjcmzwcFSATkGycigLS7Jm5tmny53YxE73GQJXtR4B92ETa" ], "script": "base64:AAIFAAAAAAAAACQIAhIGCgQICAgBEgQKAggEEgMKAQESBAoCCAQSABIDCgEBEgAAAAALAAAAAA5TV09QZ292ZXJuYW5jZQkABCYAAAABCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAAD1NXT1BfZ292ZXJuYW5jZQIAAAAhRW1wdHkga2V5IFNXT1BfZ292ZXJuYW5jZV9hZGRyZXNzAAAAAA1XYXZlc1VzZG5Qb29sCQEAAAAFdmFsdWUAAAABCQAEJgAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAPV0FWRVNfVVNETl9Qb29sAgAAACFFbXB0eSBrZXkgU1dPUF9nb3Zlcm5hbmNlX2FkZHJlc3MAAAAAF2RlZmloZWxwZXJNYW5hZ2VyUHViS2V5CQACWQAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAZZGVmaWhlbHBlcl9tYW5hZ2VyX1B1YktleQIAAAAjRW1wdHkga2V5IGRlZmloZWxwZXJfbWFuYWdlcl9Qd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sYW5jZQAAAAEFAAAACWNhbGxlclN0cgMJAABmAAAAAgUAAAALd2l0aGRyYXdBbXQFAAAADWNhbGxlckJhbGFuY2UJAAACAAAAAQIAAAAbd2l0aGRyYXdBbXQgPiBjYWxsZXJCYWxhbmNlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAACWNhbGxlclN0cgUAAAAKa2V5QmFsYW5jZQkAAGUAAAACBQAAAA1jYWxsZXJCYWxhbmNlBQAAAAt3aXRoZHJhd0FtdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAC3dpdGhkcmF3QW10BQAAAAR1bml0BQAAAANuaWwAAAABaQEAAAAIc2h1dGRvd24AAAAAAwkBAAAAASEAAAABBQAAABBpc1Byb3RvY29sQWN0aXZlCQAAAgAAAAECAAAAF1Byb3RvbCBzdG9wcGVkIGJ5IGFkbWluAwkBAAAAASEAAAABCQEAAAAPY29udGFpbnNFbGVtZW50AAAAAgkABEwAAAACBQAAAAxhZG1pblB1YktleTEJAARMAAAAAgUAAAAMYWRtaW5QdWJLZXkyCQAETAAAAAIFAAAADGFkbWluUHViS2V5MwkABEwAAAACBQAAABdkZWZpaGVscGVyTWFuYWdlclB1YktleQUAAAADbmlsCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkJAAACAAAAAQIAAAAhT25seSBhZG1pbiBjYW4gY2FsbCB0aGlzIGZ1bmN0aW9uCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACAgAAABBpc1Byb3RvY29sQWN0aXZlBwUAAAADbmlsAAAAAHD6CW4=", "chainId": 84, "height": 1763723, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EzZTHNEoHpEMXLweurdkiaRzE3UaXmwmtujmaB5S4Aqq Next: 64QrNPvzCC2d6qBMo4UWPBMNKosw3hkmo1e2JxVqauRQ Diff:
OldNewDifferences
8888 let D = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
8989 let E = (D - C)
9090 if ((0 > E))
91- then throw(("Insufficient balance:" + toString(E)))
91+ then throw(((("Insufficient new balance:" + toString(E)) + " for user ") + z))
9292 else [IntegerEntry((z + g), E)]
9393 }
9494 }
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,s) = 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", s), BooleanEntry("isProtocolActive", true)]
5656
5757
5858
5959 @Callable(u)
6060 func updateAutomateStatus (w,x) = 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(w, x)]
6565
6666
6767
6868 @Callable(u)
6969 func updateProtocolFee (y) = 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", y)]
7474
7575
7676
7777 @Callable(u)
7878 func extractFee (z,A) = if (!(i))
7979 then throw("Protol stopped by admin")
8080 else {
8181 let B = valueOrErrorMessage(getBoolean(this, toString(u.caller)), ("Empty key i.caller: " + toString(u.caller)))
8282 if (!(B))
8383 then throw("This automate is inactive")
8484 else {
8585 let C = if (A)
8686 then p()
8787 else 0
8888 let D = valueOrErrorMessage(getInteger(this, (z + g)), (("Empty key user + keyBalance: " + z) + g))
8989 let E = (D - C)
9090 if ((0 > E))
91- then throw(("Insufficient balance:" + toString(E)))
91+ then throw(((("Insufficient new balance:" + toString(E)) + " for user ") + z))
9292 else [IntegerEntry((z + g), E)]
9393 }
9494 }
9595
9696
9797
9898 @Callable(u)
9999 func replanishBalance () = if (!(i))
100100 then throw("Protol stopped by admin")
101101 else {
102102 let F = $Tuple2(u.payments[0].amount, u.payments[0].assetId)
103103 let G = F._1
104104 let H = F._2
105105 if ((H != unit))
106106 then throw("Only WAVES available for replanishment")
107107 else {
108108 let k = toString(u.caller)
109109 let l = j(k)
110110 [IntegerEntry((k + g), (l + G))]
111111 }
112112 }
113113
114114
115115
116116 @Callable(u)
117117 func withdraw (I) = if (!(i))
118118 then throw("Protol stopped by admin")
119119 else {
120120 let k = toString(u.caller)
121121 let l = j(k)
122122 if ((I > l))
123123 then throw("withdrawAmt > callerBalance")
124124 else [IntegerEntry((k + g), (l - I)), ScriptTransfer(u.caller, I, unit)]
125125 }
126126
127127
128128
129129 @Callable(u)
130130 func shutdown () = if (!(i))
131131 then throw("Protol stopped by admin")
132132 else if (!(containsElement([d, e, f, c], u.callerPublicKey)))
133133 then throw("Only admin can call this function")
134134 else [BooleanEntry("isProtocolActive", false)]
135135
136136

github/deemru/w8io/026f985 
37.89 ms