tx · 4YkzitfNG7rCEF3ZdUkhApNi6qyM4o6GdMQUmsqTxj8q 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY: -0.01100000 Waves 2022.06.16 02:00 [2098116] smart account 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY > SELF 0.00000000 Waves
{ "type": 13, "id": "4YkzitfNG7rCEF3ZdUkhApNi6qyM4o6GdMQUmsqTxj8q", "fee": 1100000, "feeAssetId": null, "timestamp": 1655334039469, "version": 2, "chainId": 84, "sender": "3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY", "senderPublicKey": "fFTt4dRQEMWmxs9cA5He1tph3gmQLAM4cnpj6eqkWPR", "proofs": [ "5iZ3WMY5vLxJzQQpXSNsNCYVoJ8yVEiwgiWJ4DDd2Jg9Xr3znSaLAzESUKNBuZCZ8EpjcVoCG5EsgN4HPH51tfUM" ], "script": "base64:AAIFAAAAAAAAADAIAhIKCggICAgICAQBARIDCgEEEgUKAwQEBBIDCgEBEgMKAQQSAwoBARIAEgMKAQEAAAAfAAAAAARtYWluAgAAAAptYWluX2Fzc2V0AAAAAAFsAgAAAAlscF9hc3NldF8AAAAAAmExAgAAAAxzd2FwX2Fzc2V0MV8AAAAAAnN0AgAAAA9hZGRyZXNzX3N0YWtlcl8AAAAAA3NzdAIAAAANYWRkcmVzc19wb29sXwAAAAADc3dwAgAAAA1hZGRyZXNzX3N3YXBfAAAAAAJhMgIAAAAMc3dhcF9hc3NldDJfAAAAAANhYTECAAAAB3Bvb2xfMV8AAAAAA2FhMgIAAAAHcG9vbF8yXwAAAAADc3QxAgAAAA5zdGFrZXJfYWRkcmVzcwAAAAAEdHlwZQIAAAAFdHlwZV8AAAAAAnNhAgAAAA9TVEFLSU5HX0FNT1VOVF8AAAAAAmxhAgAAAA1MRUFTRV9BTU9VTlRfAAAAAAJpeAIAAAADSURfAAAAAAdyYXRlRmVlAgAAABNwZXJjZW50YWdlX3JhdGVfZmVlAAAAAAJEOAAAAAAABfXhAAAAAAACRD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x5IHVuZGVyIG1haW50ZW5hbmNlLgkAAAIAAAABAgAAACRkQXBwIGlzIGN1cnJlbnRseSB1bmRlciBtYWludGVuYW5jZS4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl8Dyw7", "height": 2098116, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6gw6jghdUt5JbpnMZt7m8u7fkcTArsK1ofSJpVFzkHTm Next: GCYL9PTMRsnUdXbXe4cw67QZ8SNbhbs8FiaV5MDu66RZ Diff:
Old | New | Differences | |
---|---|---|---|
168 | 168 | let newAmount = (currentAmount - amount) | |
169 | 169 | if ((0 > newAmount)) | |
170 | 170 | then throw("Not enough AxAi balance") | |
171 | - | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, ((((diff * bcd) / previouslockbalance) * amount) * D8), MainAsset)] | |
171 | + | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, ((((diff * bcd) / previouslockbalance) * amount) * D8), MainAsset), StringEntry("a1", ((((((((toString(diff) + "_*_") + toString(bcd)) + "_/_") + toString(previouslockbalance)) + "_*_") + toString(amount)) + "_*_") + toString(D8)))] | |
172 | 172 | } | |
173 | 173 | } | |
174 | 174 | else throw("liquidity is currently under maintenance.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let main = "main_asset" | |
5 | 5 | ||
6 | 6 | let l = "lp_asset_" | |
7 | 7 | ||
8 | 8 | let a1 = "swap_asset1_" | |
9 | 9 | ||
10 | 10 | let st = "address_staker_" | |
11 | 11 | ||
12 | 12 | let sst = "address_pool_" | |
13 | 13 | ||
14 | 14 | let swp = "address_swap_" | |
15 | 15 | ||
16 | 16 | let a2 = "swap_asset2_" | |
17 | 17 | ||
18 | 18 | let aa1 = "pool_1_" | |
19 | 19 | ||
20 | 20 | let aa2 = "pool_2_" | |
21 | 21 | ||
22 | 22 | let st1 = "staker_address" | |
23 | 23 | ||
24 | 24 | let type = "type_" | |
25 | 25 | ||
26 | 26 | let sa = "STAKING_AMOUNT_" | |
27 | 27 | ||
28 | 28 | let la = "LEASE_AMOUNT_" | |
29 | 29 | ||
30 | 30 | let ix = "ID_" | |
31 | 31 | ||
32 | 32 | let rateFee = "percentage_rate_fee" | |
33 | 33 | ||
34 | 34 | let D8 = 100000000 | |
35 | 35 | ||
36 | 36 | let D6 = 1000000 | |
37 | 37 | ||
38 | 38 | let contractAddress = Address(this.bytes) | |
39 | 39 | ||
40 | 40 | let exchangeRate = 5 | |
41 | 41 | ||
42 | 42 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse " + address) + " as address"))) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | let ac = "activate" | |
49 | 49 | ||
50 | 50 | let poolAc = "activate_pools" | |
51 | 51 | ||
52 | 52 | let swapAc = "activate_swap" | |
53 | 53 | ||
54 | 54 | let liquidityAc = "activate_liquidity" | |
55 | 55 | ||
56 | 56 | let bcD = "block_distribuition" | |
57 | 57 | ||
58 | 58 | let usdn = "usdn_asset" | |
59 | 59 | ||
60 | 60 | let usdt = "usdt_asset" | |
61 | 61 | ||
62 | 62 | let usdc = "usdc_asset" | |
63 | 63 | ||
64 | 64 | let ngnn = "ngnn_asset" | |
65 | 65 | ||
66 | 66 | let aWaves = "accept_waves" | |
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func constructor (MainAssetId,UsdnAssetId,UsdtAssetId,UsdcAssetId,NgnnAssetId,acceptWaves,percentageRate,blockDistribution) = if ((i.caller == this)) | |
70 | 70 | then [StringEntry(main, MainAssetId), StringEntry(usdn, UsdnAssetId), StringEntry(usdc, UsdcAssetId), StringEntry(usdt, UsdtAssetId), StringEntry(ngnn, NgnnAssetId), BooleanEntry(aWaves, acceptWaves), IntegerEntry(rateFee, percentageRate), BooleanEntry(ac, true), BooleanEntry(swapAc, false), BooleanEntry(poolAc, false), BooleanEntry(liquidityAc, false), IntegerEntry(bcD, blockDistribution)] | |
71 | 71 | else throw("Only the Admin itself can invoke this function") | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
75 | 75 | @Callable(i) | |
76 | 76 | func activate (v) = if ((i.caller == this)) | |
77 | 77 | then [BooleanEntry(ac, v)] | |
78 | 78 | else throw("Only the Admin itself can invoke this function") | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func maintenance (pools,swap,stake) = if ((i.caller == this)) | |
84 | 84 | then [BooleanEntry(poolAc, pools), BooleanEntry(swapAc, swap), BooleanEntry(liquidityAc, stake)] | |
85 | 85 | else throw("Only the Admin itself can invoke this function") | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func percentualRateFeeEdit (rate) = if ((i.caller == this)) | |
91 | 91 | then [IntegerEntry(rateFee, rate)] | |
92 | 92 | else throw("Only the Admin itself can invoke this function") | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | 97 | func acceptWaves (activate) = if ((i.caller == this)) | |
98 | 98 | then [BooleanEntry(aWaves, activate)] | |
99 | 99 | else throw("Only the Admin itself can invoke this function") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func blockDistribution (newValue) = if ((i.caller == this)) | |
105 | 105 | then [IntegerEntry(bcD, newValue)] | |
106 | 106 | else throw("Only the Admin itself can invoke this function") | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | @Callable(i) | |
111 | 111 | func deposit () = { | |
112 | 112 | let power = getBooleanValue(this, ac) | |
113 | 113 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
114 | 114 | let acWaves = getBooleanValue(this, aWaves) | |
115 | 115 | let pmt = i.payments[0] | |
116 | 116 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
117 | 117 | if (power) | |
118 | 118 | then if (!(liquidityPower)) | |
119 | 119 | then if ((pmt.assetId != MainAsset)) | |
120 | 120 | then throw(("Invalid Asset! Kindly Deposit Only " + toBase58String(MainAsset))) | |
121 | 121 | else { | |
122 | 122 | let currentKey = toBase58String(i.caller.bytes) | |
123 | 123 | let currentAmount = match getInteger(this, currentKey) { | |
124 | 124 | case a: Int => | |
125 | 125 | a | |
126 | 126 | case _ => | |
127 | 127 | 0 | |
128 | 128 | } | |
129 | 129 | let newAmount = (currentAmount + pmt.amount) | |
130 | 130 | let useramount = IntegerEntry(currentKey, newAmount) | |
131 | 131 | let userdepositheight = IntegerEntry(("Deposit_Height_Of_" + currentKey), height) | |
132 | 132 | let previouslockbalance = match getInteger(this, "Total_Tokens_Locked:") { | |
133 | 133 | case a: Int => | |
134 | 134 | a | |
135 | 135 | case _ => | |
136 | 136 | 0 | |
137 | 137 | } | |
138 | 138 | let totaltoken = (previouslockbalance + pmt.amount) | |
139 | 139 | let TLV = IntegerEntry("Total_Tokens_Locked:", totaltoken) | |
140 | 140 | [useramount, userdepositheight, TLV] | |
141 | 141 | } | |
142 | 142 | else throw("liquidity is currently under maintenance.") | |
143 | 143 | else throw("dApp is currently under maintenance.") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | 148 | @Callable(i) | |
149 | 149 | func remove (amount) = { | |
150 | 150 | let power = getBooleanValue(this, ac) | |
151 | 151 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
152 | 152 | let acWaves = getBooleanValue(this, aWaves) | |
153 | 153 | let pmt = i.payments[0] | |
154 | 154 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
155 | 155 | if (power) | |
156 | 156 | then if (!(liquidityPower)) | |
157 | 157 | then { | |
158 | 158 | let currentKey = toBase58String(i.caller.bytes) | |
159 | 159 | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
160 | 160 | let swapheightkeyname = ("Deposit_Height_Of_" + currentKey) | |
161 | 161 | let previouslockbalance = getIntegerValue(this, "Total_Tokens_Locked:") | |
162 | 162 | let totaltoken = (previouslockbalance - amount) | |
163 | 163 | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
164 | 164 | let bcd = getIntegerValue(this, bcD) | |
165 | 165 | if ((0 > amount)) | |
166 | 166 | then throw("Can't withdraw negative AxAi amount") | |
167 | 167 | else { | |
168 | 168 | let newAmount = (currentAmount - amount) | |
169 | 169 | if ((0 > newAmount)) | |
170 | 170 | then throw("Not enough AxAi balance") | |
171 | - | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, ((((diff * bcd) / previouslockbalance) * amount) * D8), MainAsset)] | |
171 | + | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, ((((diff * bcd) / previouslockbalance) * amount) * D8), MainAsset), StringEntry("a1", ((((((((toString(diff) + "_*_") + toString(bcd)) + "_/_") + toString(previouslockbalance)) + "_*_") + toString(amount)) + "_*_") + toString(D8)))] | |
172 | 172 | } | |
173 | 173 | } | |
174 | 174 | else throw("liquidity is currently under maintenance.") | |
175 | 175 | else throw("dApp is currently under maintenance.") | |
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | @Verifier(tx) | |
180 | 180 | func verify () = match tx { | |
181 | 181 | case _ => | |
182 | 182 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
183 | 183 | } | |
184 | 184 |
github/deemru/w8io/026f985 49.35 ms ◑