tx · BVPtun9bc8j2ioFCCUFm3zDwMxvx6v254qF96yLXyZGR 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J: -0.01400000 Waves 2021.10.25 17:30 [1761964] smart account 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J > SELF 0.00000000 Waves
{ "type": 13, "id": "BVPtun9bc8j2ioFCCUFm3zDwMxvx6v254qF96yLXyZGR", "fee": 1400000, "feeAssetId": null, "timestamp": 1635172211049, "version": 1, "sender": "3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J", "senderPublicKey": "B7ayemTreAJnAMuzH9P3MnVXhpL6PTtRBrV29h7EUS1H", "proofs": [ "j998YNdDK4V24GqMSdAUFBnPXRKu6jhD5ASQsyeZaGX72YF1c2aCErzebAV8VLs5hnJGw5PUZampoLAuyPth2fM" ], "script": "base64:AAIFAAAAAAAAACQIAhIGCgQICAgBEgQKAggEEgMKAQESBAoCAQgSABIDCgEBEgAAAAAKAAAAAA5TV09QZ292ZXJuYW5jZQkABCYAAAABCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAAD1NXT1BfZ292ZXJuYW5jZQIAAAAhRW1wdHkga2V5IFNXT1BfZ292ZXJuYW5jZV9hZGRyZXNzAAAAAA1XYXZlc1VzZG5Qb29sCQAEJgAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAPV0FWRVNfVVNETl9Qb29sAgAAACFFbXB0eSBrZXkgU1dPUF9nb3Zlcm5hbmNlX2FkZHJlc3MAAAAAF2RlZmloZWxwZXJNYW5hZ2VyUHViS2V5CQACWQAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAZZGVmaWhlbHBlcl9tYW5hZ2VyX1B1YktleQIAAAAjRW1wdHkga2V5IGRlZmloZWxwZXJfbWFuYWdlcl9QdWJLZXkAAAAADGFkbWluUHViS2V5M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GxlclN0cgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIEAAAADWNhbGxlckJhbGFuY2UJAQAAABBnZXRDYWxsZXJCYWxhbmNlAAAAAQUAAAAJY2FsbGVyU3RyAwkAAGYAAAACBQAAAAt3aXRoZHJhd0FtdAUAAAANY2FsbGVyQmFsYW5jZQkAAAIAAAABAgAAABt3aXRoZHJhd0FtdCA+IGNhbGxlckJhbGFuY2UJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAJY2FsbGVyU3RyBQAAAAprZXlCYWxhbmNlCQAAZQAAAAIFAAAADWNhbGxlckJhbGFuY2UFAAAAC3dpdGhkcmF3QW10CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALd2l0aGRyYXdBbXQFAAAABHVuaXQFAAAAA25pbAAAAAFpAQAAAAhzaHV0ZG93bgAAAAADCQEAAAABIQAAAAEFAAAAEGlzUHJvdG9jb2xBY3RpdmUJAAACAAAAAQIAAAAXUHJvdG9sIHN0b3BwZWQgYnkgYWRtaW4DCQEAAAABIQAAAAEJAQAAAA9jb250YWluc0VsZW1lbnQAAAACCQAETAAAAAIFAAAADGFkbWluUHViS2V5MQkABEwAAAACBQAAAAxhZG1pblB1YktleTIJAARMAAAAAgUAAAAMYWRtaW5QdWJLZXkzCQAETAAAAAIFAAAAF2RlZmloZWxwZXJNYW5hZ2VyUHViS2V5BQAAAANuaWwIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQkAAAIAAAABAgAAACFPbmx5IGFkbWluIGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24JAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAICAAAAEGlzUHJvdG9jb2xBY3RpdmUHBQAAAANuaWwAAAAA2lv76g==", "chainId": 84, "height": 1761964, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2ADxAXYA6kfNgyHVtebV4eiLV8fRVQMhPNC9vciJhjwf Next: 3cmV7haLVPsmk9pP2xgxyvC1dsMz4tFkAj6kjmsXa3Du Diff:
Old | New | Differences | |
---|---|---|---|
69 | 69 | func extractFee (u,v) = if (!(i)) | |
70 | 70 | then throw("Protol stopped by admin") | |
71 | 71 | else { | |
72 | - | let w = valueOrErrorMessage(getBoolean(this, | |
72 | + | let w = valueOrErrorMessage(getBoolean(this, toString(p.caller)), ("Empty key i.caller: " + toString(p.caller))) | |
73 | 73 | if (!(w)) | |
74 | 74 | then throw("This automate is inactive") | |
75 | 75 | else { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = addressFromString(valueOrElse(getString(this, "SWOP_governance"), "Empty key SWOP_governance_address")) | |
5 | 5 | ||
6 | 6 | let b = addressFromString(valueOrElse(getString(this, "WAVES_USDN_Pool"), "Empty key SWOP_governance_address")) | |
7 | 7 | ||
8 | 8 | let c = fromBase58String(valueOrElse(getString(this, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey")) | |
9 | 9 | ||
10 | 10 | let d = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
11 | 11 | ||
12 | 12 | let e = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
13 | 13 | ||
14 | 14 | let f = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
15 | 15 | ||
16 | 16 | let g = "_balance" | |
17 | 17 | ||
18 | 18 | let h = "fee_in_usdn" | |
19 | 19 | ||
20 | 20 | let i = valueOrErrorMessage(getBoolean(this, "isProtocolActive"), "Empty key isProtocolActive") | |
21 | 21 | ||
22 | 22 | func j (k) = { | |
23 | 23 | let l = { | |
24 | 24 | let m = getInteger(this, (k + g)) | |
25 | 25 | if ($isInstanceOf(m, "Int")) | |
26 | 26 | then { | |
27 | 27 | let n = m | |
28 | 28 | n | |
29 | 29 | } | |
30 | 30 | else if ($isInstanceOf(m, "Unit")) | |
31 | 31 | then { | |
32 | 32 | let o = m | |
33 | 33 | 0 | |
34 | 34 | } | |
35 | 35 | else throw("Match error") | |
36 | 36 | } | |
37 | 37 | l | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(p) | |
42 | 42 | func init (c,b,q,r) = if (if (isDefined(getString(this, "WAVES_USDN_Pool"))) | |
43 | 43 | then true | |
44 | 44 | else isDefined(getString(this, "defihelper_manager_PubKey"))) | |
45 | 45 | then throw("Already initialized") | |
46 | 46 | else [StringEntry("defihelper_manager_PubKey", c), StringEntry("WAVES_USDN_Pool", b), StringEntry("SWOP_governance", q), IntegerEntry("protocol_fee_in_usdn", r), BooleanEntry("isProtocolActive", true)] | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Callable(p) | |
51 | 51 | func updateAutomateStatus (s,t) = if (!(i)) | |
52 | 52 | then throw("Protol stopped by admin") | |
53 | 53 | else if (!(containsElement([c], p.callerPublicKey))) | |
54 | 54 | then throw("Only admin can call this function") | |
55 | 55 | else [BooleanEntry(s, t)] | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(p) | |
60 | 60 | func updateProtocolFee (r) = if (!(i)) | |
61 | 61 | then throw("Protol stopped by admin") | |
62 | 62 | else if (!(containsElement([c], p.callerPublicKey))) | |
63 | 63 | then throw("Only admin can call this function") | |
64 | 64 | else [IntegerEntry("protocol_fee_in_usdn", r)] | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(p) | |
69 | 69 | func extractFee (u,v) = if (!(i)) | |
70 | 70 | then throw("Protol stopped by admin") | |
71 | 71 | else { | |
72 | - | let w = valueOrErrorMessage(getBoolean(this, | |
72 | + | let w = valueOrErrorMessage(getBoolean(this, toString(p.caller)), ("Empty key i.caller: " + toString(p.caller))) | |
73 | 73 | if (!(w)) | |
74 | 74 | then throw("This automate is inactive") | |
75 | 75 | else { | |
76 | 76 | let x = valueOrErrorMessage(getInteger(this, (v + g)), (("Empty key user + keyBalance: " + v) + g)) | |
77 | 77 | [IntegerEntry((v + g), (x - u))] | |
78 | 78 | } | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(p) | |
84 | 84 | func replanishBalance () = if (!(i)) | |
85 | 85 | then throw("Protol stopped by admin") | |
86 | 86 | else { | |
87 | 87 | let y = $Tuple2(p.payments[0].amount, p.payments[0].assetId) | |
88 | 88 | let z = y._1 | |
89 | 89 | let A = y._2 | |
90 | 90 | if ((A != unit)) | |
91 | 91 | then throw("Only WAVES available for replanishment") | |
92 | 92 | else { | |
93 | 93 | let k = toString(p.caller) | |
94 | 94 | let l = j(k) | |
95 | 95 | [IntegerEntry((k + g), (l + z))] | |
96 | 96 | } | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | 101 | @Callable(p) | |
102 | 102 | func withdraw (B) = if (!(i)) | |
103 | 103 | then throw("Protol stopped by admin") | |
104 | 104 | else { | |
105 | 105 | let k = toString(p.caller) | |
106 | 106 | let l = j(k) | |
107 | 107 | if ((B > l)) | |
108 | 108 | then throw("withdrawAmt > callerBalance") | |
109 | 109 | else [IntegerEntry((k + g), (l - B)), ScriptTransfer(p.caller, B, unit)] | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(p) | |
115 | 115 | func shutdown () = if (!(i)) | |
116 | 116 | then throw("Protol stopped by admin") | |
117 | 117 | else if (!(containsElement([d, e, f, c], p.callerPublicKey))) | |
118 | 118 | then throw("Only admin can call this function") | |
119 | 119 | else [BooleanEntry("isProtocolActive", false)] | |
120 | 120 | ||
121 | 121 |
github/deemru/w8io/169f3d6 31.23 ms ◑