tx · FsR1iZ5pZbsyxTFg64goC18kaYLdQPbmAoxqbdWZCfwW 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY: -0.01800000 Waves 2022.06.16 22:56 [2099376] smart account 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY > SELF 0.00000000 Waves
{ "type": 13, "id": "FsR1iZ5pZbsyxTFg64goC18kaYLdQPbmAoxqbdWZCfwW", "fee": 1800000, "feeAssetId": null, "timestamp": 1655409365374, "version": 2, "chainId": 84, "sender": "3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY", "senderPublicKey": "fFTt4dRQEMWmxs9cA5He1tph3gmQLAM4cnpj6eqkWPR", "proofs": [ "2Xpos3LEXf9r96gyzbroNuoLjd9YYhdDKvAAkEMJDbDsugziQEJgJ9y7s31QGnHDdFPW3YaXCD65kEV5nbeBvUUK" ], "script": "base64:AAIFAAAAAAAAADYIAhIKCggICAgICAQBARIDCgEEEgUKAwQEBBIDCgEBEgMKAQQSAwoBARIAEgMKAQESBAoCCAgAAAAfAAAAAARtYWluAgAAAAptYWluX2Fzc2V0AAAAAAFsAgAAAAlscF9hc3NldF8AAAAAA2FhMQIAAAAGcG9vbF9fAAAAAAJzYQIAAAAPU1RBS0lOR19BTU9VTlRfAAAAAAJsYQIAAAANTEVBU0VfQU1PVU5UXwAAAAACaXgCAAAAA0lEXwAAAAAHcmF0ZUZlZQIAAAATcGVyY2VudGFnZV9yYXRlX2ZlZQAAAAAOZGVwb3NpdF9oZWlnaHQCAAAAEkRlcG9zaXRfSGVpZ2h0X09mXwAAAAACRDgAAAAAAAX14QAAAAAAAkQ2AAAAAAAAD0JAAAAAAA9jb250cmFjdEFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQgFAAAABHRoaXMAAAAFYnl0ZXMAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAABQEAAAARZ2V0QWRkcmVzc0lmVmFsaWQAAAABAAAAB2FkZHJlc3MJAAQlAAAAAQkBAAAAE3ZhbHVlT3J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FAAAABkFzc2V0MgUAAAAGQXNzZXQxBAAAAAphc3NldDJwb29sCQEAAAAGYXNzZXRQAAAAAgkBAAAAAmtwAAAAAgUAAAAGQXNzZXQxBQAAAAZBc3NldDIFAAAABkFzc2V0MgQAAAAGcEJsb2NrCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAABHBrZXkAAAADBQAAAAZBc3NldDEFAAAABkFzc2V0MgUAAAAKY3VycmVudEtleQUAAAAGaGVpZ2h0BAAAABBuZXdDdXJyZW50QW1vdW50BQAAAA1jdXJyZW50QW1vdW50AwMJAAAAAAAAAgUAAAAKYXNzZXQxcG9vbAAAAAAAAAAAAAYJAAAAAAAAAgUAAAAKYXNzZXQycG9vbAAAAAAAAAAAAAUAAAADbmlsBQAAAANuaWwJAAACAAAAAQIAAAARSW52YWxpZCBQb29sIEtleS4JAAACAAAAAQIAAAAZSW52YWxpZCBBc3NldDEgb3IgQXNzZXQyIQkAAAIAAAABAgAAACBBc3NldDEgY2Fubm90IGJlIGVxdWFsIHRvIEFzc2V0MgkAAAIAAAABAgAAAClsaXF1aWRpdHkgaXMgY3VycmVudGx5IHVuZGVyIG1haW50ZW5hbmNlLgkAAAIAAAABAgAAACRkQXBwIGlzIGN1cnJlbnRseSB1bmRlciBtYWludGVuYW5jZS4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlDfk2j", "height": 2099376, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9Cy7ZrS3p7AGqfU3AGLLSLABV8QEvD1Mm4mKgv8eVEW7 Next: DxBZe1CnTKFKE86xM3btgvdpcnnXkua1WySFoPZ3oASj Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let l = "lp_asset_" | |
7 | 7 | ||
8 | - | let a1 = "swap_asset1_" | |
9 | - | ||
10 | - | let st = "address_staker_" | |
11 | - | ||
12 | - | let sst = "address_pool_" | |
13 | - | ||
14 | - | let swp = "address_swap_" | |
15 | - | ||
16 | - | let a2 = "swap_asset2_" | |
17 | - | ||
18 | - | let aa1 = "pool_1_" | |
19 | - | ||
20 | - | let aa2 = "pool_2_" | |
21 | - | ||
22 | - | let st1 = "staker_address" | |
23 | - | ||
24 | - | let type = "type_" | |
8 | + | let aa1 = "pool__" | |
25 | 9 | ||
26 | 10 | let sa = "STAKING_AMOUNT_" | |
27 | 11 | ||
30 | 14 | let ix = "ID_" | |
31 | 15 | ||
32 | 16 | let rateFee = "percentage_rate_fee" | |
17 | + | ||
18 | + | let deposit_height = "Deposit_Height_Of_" | |
33 | 19 | ||
34 | 20 | let D8 = 100000000 | |
35 | 21 | ||
55 | 41 | ||
56 | 42 | let bcD = "block_distribuition" | |
57 | 43 | ||
44 | + | let total_locked = "Total_Tokens_Locked_" | |
45 | + | ||
58 | 46 | let usdn = "usdn_asset" | |
59 | 47 | ||
60 | 48 | let usdt = "usdt_asset" | |
65 | 53 | ||
66 | 54 | let aWaves = "accept_waves" | |
67 | 55 | ||
56 | + | func kp (asset1,asset2) = (((aa1 + asset1) + "_") + asset2) | |
57 | + | ||
58 | + | ||
59 | + | func validPoolK (key) = valueOrElse(getInteger(this, key), 0) | |
60 | + | ||
61 | + | ||
62 | + | func kpAddress (address,key) = valueOrElse(getIntegerValue(this, ((key + "_") + address)), 0) | |
63 | + | ||
64 | + | ||
65 | + | func poolAA (address,key,asset) = valueOrElse(getIntegerValue(this, ((((key + "_") + address) + "_") + asset)), 0) | |
66 | + | ||
67 | + | ||
68 | + | func assetP (key,asset) = valueOrElse(getIntegerValue(this, ((key + "_") + asset)), 0) | |
69 | + | ||
70 | + | ||
71 | + | func pkey (Asset1,Asset2,address) = (((deposit_height + kp(Asset1, Asset2)) + "_") + address) | |
72 | + | ||
73 | + | ||
68 | 74 | @Callable(i) | |
69 | 75 | func constructor (MainAssetId,UsdnAssetId,UsdtAssetId,UsdcAssetId,NgnnAssetId,acceptWaves,percentageRate,blockDistribution) = if ((i.caller == this)) | |
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)] | |
76 | + | then { | |
77 | + | let keyPoolUsdnUsdt = kp(UsdnAssetId, UsdtAssetId) | |
78 | + | let keyPoolUsdnUsdc = kp(UsdnAssetId, UsdcAssetId) | |
79 | + | let keyPoolUsdnNgnn = kp(UsdnAssetId, NgnnAssetId) | |
80 | + | let keyPoolUsdnWaves = kp(UsdnAssetId, "WAVES") | |
81 | + | let keyPoolUsdnMainAsset = kp(UsdnAssetId, MainAssetId) | |
82 | + | let keyPoolUsdcUsdt = kp(UsdcAssetId, UsdtAssetId) | |
83 | + | let keyPoolUsdcNgnn = kp(UsdcAssetId, NgnnAssetId) | |
84 | + | let keyPoolUsdcWaves = kp(UsdcAssetId, "WAVES") | |
85 | + | let keyPoolUsdcMainAsset = kp(UsdcAssetId, MainAssetId) | |
86 | + | let keyPoolUsdtNgnn = kp(UsdtAssetId, NgnnAssetId) | |
87 | + | let keyPoolUsdtWaves = kp(UsdtAssetId, "WAVES") | |
88 | + | let keyPoolUsdtMainAsset = kp(UsdtAssetId, MainAssetId) | |
89 | + | let keyPoolNgnnWaves = kp(NgnnAssetId, "WAVES") | |
90 | + | let keyPoolNgnnMainAsset = kp(NgnnAssetId, MainAssetId) | |
91 | + | let keyPoolMainWaves = kp(MainAssetId, "WAVES") | |
92 | + | [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), IntegerEntry(keyPoolUsdnUsdt, 0), IntegerEntry(keyPoolUsdnWaves, 0), IntegerEntry(keyPoolUsdnUsdc, 0), IntegerEntry(keyPoolUsdnNgnn, 0), IntegerEntry(keyPoolUsdnMainAsset, 0), IntegerEntry(keyPoolUsdcUsdt, 0), IntegerEntry(keyPoolUsdcNgnn, 0), IntegerEntry(keyPoolUsdcWaves, 0), IntegerEntry(keyPoolUsdtMainAsset, 0), IntegerEntry(keyPoolUsdtNgnn, 0), IntegerEntry(keyPoolUsdtWaves, 0), IntegerEntry(keyPoolUsdtMainAsset, 0), IntegerEntry(keyPoolNgnnWaves, 0), IntegerEntry(keyPoolNgnnMainAsset, 0), IntegerEntry(keyPoolMainWaves, 0)] | |
93 | + | } | |
71 | 94 | else throw("Only the Admin itself can invoke this function") | |
72 | 95 | ||
73 | 96 | ||
128 | 151 | } | |
129 | 152 | let newAmount = (currentAmount + pmt.amount) | |
130 | 153 | let useramount = IntegerEntry(currentKey, newAmount) | |
131 | - | let userdepositheight = IntegerEntry(( | |
154 | + | let userdepositheight = IntegerEntry((deposit_height + currentKey), height) | |
132 | 155 | let previouslockbalance = match getInteger(this, "Total_Tokens_Locked:") { | |
133 | 156 | case a: Int => | |
134 | 157 | a | |
157 | 180 | then { | |
158 | 181 | let currentKey = toBase58String(i.caller.bytes) | |
159 | 182 | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
160 | - | let swapheightkeyname = ( | |
183 | + | let swapheightkeyname = (deposit_height + currentKey) | |
161 | 184 | let previouslockbalance = getIntegerValue(this, "Total_Tokens_Locked:") | |
162 | 185 | let totaltoken = (previouslockbalance - amount) | |
163 | 186 | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
178 | 201 | } | |
179 | 202 | ||
180 | 203 | ||
204 | + | ||
205 | + | @Callable(i) | |
206 | + | func addLiquidity (Asset1,Asset2) = { | |
207 | + | let power = getBooleanValue(this, ac) | |
208 | + | let poolActivate = getBooleanValue(this, poolAc) | |
209 | + | let acWaves = getBooleanValue(this, aWaves) | |
210 | + | let key = validPoolK(kp(Asset1, Asset2)) | |
211 | + | let asset1 = i.payments[0].assetId | |
212 | + | let asset2 = i.payments[1].assetId | |
213 | + | let USDN = toBytes(getStringValue(this, usdn)) | |
214 | + | let USDC = toBytes(getStringValue(this, usdc)) | |
215 | + | let USDT = toBytes(getStringValue(this, usdt)) | |
216 | + | let NGNN = toBytes(getStringValue(this, ngnn)) | |
217 | + | let MainAsset = fromBase58String(getStringValue(this, main)) | |
218 | + | if (power) | |
219 | + | then if (!(poolActivate)) | |
220 | + | then if (if (if (!((asset1 == asset2))) | |
221 | + | then (asset1 == fromBase58String(Asset1)) | |
222 | + | else false) | |
223 | + | then (asset2 == fromBase58String(Asset2)) | |
224 | + | else false) | |
225 | + | then if (if (if (if (if (if (if (if (if (if ((asset1 == USDN)) | |
226 | + | then true | |
227 | + | else (asset1 == USDC)) | |
228 | + | then true | |
229 | + | else (asset1 == USDT)) | |
230 | + | then true | |
231 | + | else (asset1 == NGNN)) | |
232 | + | then true | |
233 | + | else (asset1 == MainAsset)) | |
234 | + | then true | |
235 | + | else (asset2 == USDN)) | |
236 | + | then true | |
237 | + | else (asset2 == USDC)) | |
238 | + | then true | |
239 | + | else (asset2 == USDT)) | |
240 | + | then true | |
241 | + | else (asset2 == NGNN)) | |
242 | + | then true | |
243 | + | else (asset2 == MainAsset)) | |
244 | + | then if (!((key == 0))) | |
245 | + | then { | |
246 | + | let currentKey = toBase58String(i.caller.bytes) | |
247 | + | let currentAmount = kpAddress(currentKey, kp(Asset1, Asset2)) | |
248 | + | let currentAmountAsset1 = poolAA(currentKey, kp(Asset1, Asset2), Asset1) | |
249 | + | let currentAmountAsset2 = poolAA(currentKey, kp(Asset1, Asset2), Asset2) | |
250 | + | let asset1pool = assetP(kp(Asset1, Asset2), Asset1) | |
251 | + | let asset2pool = assetP(kp(Asset1, Asset2), Asset2) | |
252 | + | let pBlock = IntegerEntry(pkey(Asset1, Asset2, currentKey), height) | |
253 | + | let newCurrentAmount = currentAmount | |
254 | + | if (if ((asset1pool == 0)) | |
255 | + | then true | |
256 | + | else (asset2pool == 0)) | |
257 | + | then nil | |
258 | + | else nil | |
259 | + | } | |
260 | + | else throw("Invalid Pool Key.") | |
261 | + | else throw("Invalid Asset1 or Asset2!") | |
262 | + | else throw("Asset1 cannot be equal to Asset2") | |
263 | + | else throw("liquidity is currently under maintenance.") | |
264 | + | else throw("dApp is currently under maintenance.") | |
265 | + | } | |
266 | + | ||
267 | + | ||
181 | 268 | @Verifier(tx) | |
182 | 269 | func verify () = match tx { | |
183 | 270 | case _ => |
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 | - | let a1 = "swap_asset1_" | |
9 | - | ||
10 | - | let st = "address_staker_" | |
11 | - | ||
12 | - | let sst = "address_pool_" | |
13 | - | ||
14 | - | let swp = "address_swap_" | |
15 | - | ||
16 | - | let a2 = "swap_asset2_" | |
17 | - | ||
18 | - | let aa1 = "pool_1_" | |
19 | - | ||
20 | - | let aa2 = "pool_2_" | |
21 | - | ||
22 | - | let st1 = "staker_address" | |
23 | - | ||
24 | - | let type = "type_" | |
8 | + | let aa1 = "pool__" | |
25 | 9 | ||
26 | 10 | let sa = "STAKING_AMOUNT_" | |
27 | 11 | ||
28 | 12 | let la = "LEASE_AMOUNT_" | |
29 | 13 | ||
30 | 14 | let ix = "ID_" | |
31 | 15 | ||
32 | 16 | let rateFee = "percentage_rate_fee" | |
17 | + | ||
18 | + | let deposit_height = "Deposit_Height_Of_" | |
33 | 19 | ||
34 | 20 | let D8 = 100000000 | |
35 | 21 | ||
36 | 22 | let D6 = 1000000 | |
37 | 23 | ||
38 | 24 | let contractAddress = Address(this.bytes) | |
39 | 25 | ||
40 | 26 | let exchangeRate = 5 | |
41 | 27 | ||
42 | 28 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse " + address) + " as address"))) | |
43 | 29 | ||
44 | 30 | ||
45 | 31 | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
46 | 32 | ||
47 | 33 | ||
48 | 34 | let ac = "activate" | |
49 | 35 | ||
50 | 36 | let poolAc = "activate_pools" | |
51 | 37 | ||
52 | 38 | let swapAc = "activate_swap" | |
53 | 39 | ||
54 | 40 | let liquidityAc = "activate_liquidity" | |
55 | 41 | ||
56 | 42 | let bcD = "block_distribuition" | |
57 | 43 | ||
44 | + | let total_locked = "Total_Tokens_Locked_" | |
45 | + | ||
58 | 46 | let usdn = "usdn_asset" | |
59 | 47 | ||
60 | 48 | let usdt = "usdt_asset" | |
61 | 49 | ||
62 | 50 | let usdc = "usdc_asset" | |
63 | 51 | ||
64 | 52 | let ngnn = "ngnn_asset" | |
65 | 53 | ||
66 | 54 | let aWaves = "accept_waves" | |
67 | 55 | ||
56 | + | func kp (asset1,asset2) = (((aa1 + asset1) + "_") + asset2) | |
57 | + | ||
58 | + | ||
59 | + | func validPoolK (key) = valueOrElse(getInteger(this, key), 0) | |
60 | + | ||
61 | + | ||
62 | + | func kpAddress (address,key) = valueOrElse(getIntegerValue(this, ((key + "_") + address)), 0) | |
63 | + | ||
64 | + | ||
65 | + | func poolAA (address,key,asset) = valueOrElse(getIntegerValue(this, ((((key + "_") + address) + "_") + asset)), 0) | |
66 | + | ||
67 | + | ||
68 | + | func assetP (key,asset) = valueOrElse(getIntegerValue(this, ((key + "_") + asset)), 0) | |
69 | + | ||
70 | + | ||
71 | + | func pkey (Asset1,Asset2,address) = (((deposit_height + kp(Asset1, Asset2)) + "_") + address) | |
72 | + | ||
73 | + | ||
68 | 74 | @Callable(i) | |
69 | 75 | func constructor (MainAssetId,UsdnAssetId,UsdtAssetId,UsdcAssetId,NgnnAssetId,acceptWaves,percentageRate,blockDistribution) = if ((i.caller == this)) | |
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)] | |
76 | + | then { | |
77 | + | let keyPoolUsdnUsdt = kp(UsdnAssetId, UsdtAssetId) | |
78 | + | let keyPoolUsdnUsdc = kp(UsdnAssetId, UsdcAssetId) | |
79 | + | let keyPoolUsdnNgnn = kp(UsdnAssetId, NgnnAssetId) | |
80 | + | let keyPoolUsdnWaves = kp(UsdnAssetId, "WAVES") | |
81 | + | let keyPoolUsdnMainAsset = kp(UsdnAssetId, MainAssetId) | |
82 | + | let keyPoolUsdcUsdt = kp(UsdcAssetId, UsdtAssetId) | |
83 | + | let keyPoolUsdcNgnn = kp(UsdcAssetId, NgnnAssetId) | |
84 | + | let keyPoolUsdcWaves = kp(UsdcAssetId, "WAVES") | |
85 | + | let keyPoolUsdcMainAsset = kp(UsdcAssetId, MainAssetId) | |
86 | + | let keyPoolUsdtNgnn = kp(UsdtAssetId, NgnnAssetId) | |
87 | + | let keyPoolUsdtWaves = kp(UsdtAssetId, "WAVES") | |
88 | + | let keyPoolUsdtMainAsset = kp(UsdtAssetId, MainAssetId) | |
89 | + | let keyPoolNgnnWaves = kp(NgnnAssetId, "WAVES") | |
90 | + | let keyPoolNgnnMainAsset = kp(NgnnAssetId, MainAssetId) | |
91 | + | let keyPoolMainWaves = kp(MainAssetId, "WAVES") | |
92 | + | [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), IntegerEntry(keyPoolUsdnUsdt, 0), IntegerEntry(keyPoolUsdnWaves, 0), IntegerEntry(keyPoolUsdnUsdc, 0), IntegerEntry(keyPoolUsdnNgnn, 0), IntegerEntry(keyPoolUsdnMainAsset, 0), IntegerEntry(keyPoolUsdcUsdt, 0), IntegerEntry(keyPoolUsdcNgnn, 0), IntegerEntry(keyPoolUsdcWaves, 0), IntegerEntry(keyPoolUsdtMainAsset, 0), IntegerEntry(keyPoolUsdtNgnn, 0), IntegerEntry(keyPoolUsdtWaves, 0), IntegerEntry(keyPoolUsdtMainAsset, 0), IntegerEntry(keyPoolNgnnWaves, 0), IntegerEntry(keyPoolNgnnMainAsset, 0), IntegerEntry(keyPoolMainWaves, 0)] | |
93 | + | } | |
71 | 94 | else throw("Only the Admin itself can invoke this function") | |
72 | 95 | ||
73 | 96 | ||
74 | 97 | ||
75 | 98 | @Callable(i) | |
76 | 99 | func activate (v) = if ((i.caller == this)) | |
77 | 100 | then [BooleanEntry(ac, v)] | |
78 | 101 | else throw("Only the Admin itself can invoke this function") | |
79 | 102 | ||
80 | 103 | ||
81 | 104 | ||
82 | 105 | @Callable(i) | |
83 | 106 | func maintenance (pools,swap,stake) = if ((i.caller == this)) | |
84 | 107 | then [BooleanEntry(poolAc, pools), BooleanEntry(swapAc, swap), BooleanEntry(liquidityAc, stake)] | |
85 | 108 | else throw("Only the Admin itself can invoke this function") | |
86 | 109 | ||
87 | 110 | ||
88 | 111 | ||
89 | 112 | @Callable(i) | |
90 | 113 | func percentualRateFeeEdit (rate) = if ((i.caller == this)) | |
91 | 114 | then [IntegerEntry(rateFee, rate)] | |
92 | 115 | else throw("Only the Admin itself can invoke this function") | |
93 | 116 | ||
94 | 117 | ||
95 | 118 | ||
96 | 119 | @Callable(i) | |
97 | 120 | func acceptWaves (activate) = if ((i.caller == this)) | |
98 | 121 | then [BooleanEntry(aWaves, activate)] | |
99 | 122 | else throw("Only the Admin itself can invoke this function") | |
100 | 123 | ||
101 | 124 | ||
102 | 125 | ||
103 | 126 | @Callable(i) | |
104 | 127 | func blockDistribution (newValue) = if ((i.caller == this)) | |
105 | 128 | then [IntegerEntry(bcD, newValue)] | |
106 | 129 | else throw("Only the Admin itself can invoke this function") | |
107 | 130 | ||
108 | 131 | ||
109 | 132 | ||
110 | 133 | @Callable(i) | |
111 | 134 | func deposit () = { | |
112 | 135 | let power = getBooleanValue(this, ac) | |
113 | 136 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
114 | 137 | let acWaves = getBooleanValue(this, aWaves) | |
115 | 138 | let pmt = i.payments[0] | |
116 | 139 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
117 | 140 | if (power) | |
118 | 141 | then if (!(liquidityPower)) | |
119 | 142 | then if ((pmt.assetId != MainAsset)) | |
120 | 143 | then throw(("Invalid Asset! Kindly Deposit Only " + toBase58String(MainAsset))) | |
121 | 144 | else { | |
122 | 145 | let currentKey = toBase58String(i.caller.bytes) | |
123 | 146 | let currentAmount = match getInteger(this, currentKey) { | |
124 | 147 | case a: Int => | |
125 | 148 | a | |
126 | 149 | case _ => | |
127 | 150 | 0 | |
128 | 151 | } | |
129 | 152 | let newAmount = (currentAmount + pmt.amount) | |
130 | 153 | let useramount = IntegerEntry(currentKey, newAmount) | |
131 | - | let userdepositheight = IntegerEntry(( | |
154 | + | let userdepositheight = IntegerEntry((deposit_height + currentKey), height) | |
132 | 155 | let previouslockbalance = match getInteger(this, "Total_Tokens_Locked:") { | |
133 | 156 | case a: Int => | |
134 | 157 | a | |
135 | 158 | case _ => | |
136 | 159 | 0 | |
137 | 160 | } | |
138 | 161 | let totaltoken = (previouslockbalance + pmt.amount) | |
139 | 162 | let TLV = IntegerEntry("Total_Tokens_Locked:", totaltoken) | |
140 | 163 | [useramount, userdepositheight, TLV] | |
141 | 164 | } | |
142 | 165 | else throw("liquidity is currently under maintenance.") | |
143 | 166 | else throw("dApp is currently under maintenance.") | |
144 | 167 | } | |
145 | 168 | ||
146 | 169 | ||
147 | 170 | ||
148 | 171 | @Callable(i) | |
149 | 172 | func remove (amount) = { | |
150 | 173 | let power = getBooleanValue(this, ac) | |
151 | 174 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
152 | 175 | let acWaves = getBooleanValue(this, aWaves) | |
153 | 176 | let pmt = i.payments[0] | |
154 | 177 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
155 | 178 | if (power) | |
156 | 179 | then if (!(liquidityPower)) | |
157 | 180 | then { | |
158 | 181 | let currentKey = toBase58String(i.caller.bytes) | |
159 | 182 | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
160 | - | let swapheightkeyname = ( | |
183 | + | let swapheightkeyname = (deposit_height + currentKey) | |
161 | 184 | let previouslockbalance = getIntegerValue(this, "Total_Tokens_Locked:") | |
162 | 185 | let totaltoken = (previouslockbalance - amount) | |
163 | 186 | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
164 | 187 | let bcd = getIntegerValue(this, bcD) | |
165 | 188 | let reward = ((diff * bcd) * D8) | |
166 | 189 | let feeCalc = (reward / (previouslockbalance / amount)) | |
167 | 190 | if ((0 > amount)) | |
168 | 191 | then throw("Can't withdraw negative AxAi amount") | |
169 | 192 | else { | |
170 | 193 | let newAmount = (currentAmount - amount) | |
171 | 194 | if ((0 > newAmount)) | |
172 | 195 | then throw("Not enough AxAi balance") | |
173 | 196 | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, feeCalc, MainAsset)] | |
174 | 197 | } | |
175 | 198 | } | |
176 | 199 | else throw("liquidity is currently under maintenance.") | |
177 | 200 | else throw("dApp is currently under maintenance.") | |
178 | 201 | } | |
179 | 202 | ||
180 | 203 | ||
204 | + | ||
205 | + | @Callable(i) | |
206 | + | func addLiquidity (Asset1,Asset2) = { | |
207 | + | let power = getBooleanValue(this, ac) | |
208 | + | let poolActivate = getBooleanValue(this, poolAc) | |
209 | + | let acWaves = getBooleanValue(this, aWaves) | |
210 | + | let key = validPoolK(kp(Asset1, Asset2)) | |
211 | + | let asset1 = i.payments[0].assetId | |
212 | + | let asset2 = i.payments[1].assetId | |
213 | + | let USDN = toBytes(getStringValue(this, usdn)) | |
214 | + | let USDC = toBytes(getStringValue(this, usdc)) | |
215 | + | let USDT = toBytes(getStringValue(this, usdt)) | |
216 | + | let NGNN = toBytes(getStringValue(this, ngnn)) | |
217 | + | let MainAsset = fromBase58String(getStringValue(this, main)) | |
218 | + | if (power) | |
219 | + | then if (!(poolActivate)) | |
220 | + | then if (if (if (!((asset1 == asset2))) | |
221 | + | then (asset1 == fromBase58String(Asset1)) | |
222 | + | else false) | |
223 | + | then (asset2 == fromBase58String(Asset2)) | |
224 | + | else false) | |
225 | + | then if (if (if (if (if (if (if (if (if (if ((asset1 == USDN)) | |
226 | + | then true | |
227 | + | else (asset1 == USDC)) | |
228 | + | then true | |
229 | + | else (asset1 == USDT)) | |
230 | + | then true | |
231 | + | else (asset1 == NGNN)) | |
232 | + | then true | |
233 | + | else (asset1 == MainAsset)) | |
234 | + | then true | |
235 | + | else (asset2 == USDN)) | |
236 | + | then true | |
237 | + | else (asset2 == USDC)) | |
238 | + | then true | |
239 | + | else (asset2 == USDT)) | |
240 | + | then true | |
241 | + | else (asset2 == NGNN)) | |
242 | + | then true | |
243 | + | else (asset2 == MainAsset)) | |
244 | + | then if (!((key == 0))) | |
245 | + | then { | |
246 | + | let currentKey = toBase58String(i.caller.bytes) | |
247 | + | let currentAmount = kpAddress(currentKey, kp(Asset1, Asset2)) | |
248 | + | let currentAmountAsset1 = poolAA(currentKey, kp(Asset1, Asset2), Asset1) | |
249 | + | let currentAmountAsset2 = poolAA(currentKey, kp(Asset1, Asset2), Asset2) | |
250 | + | let asset1pool = assetP(kp(Asset1, Asset2), Asset1) | |
251 | + | let asset2pool = assetP(kp(Asset1, Asset2), Asset2) | |
252 | + | let pBlock = IntegerEntry(pkey(Asset1, Asset2, currentKey), height) | |
253 | + | let newCurrentAmount = currentAmount | |
254 | + | if (if ((asset1pool == 0)) | |
255 | + | then true | |
256 | + | else (asset2pool == 0)) | |
257 | + | then nil | |
258 | + | else nil | |
259 | + | } | |
260 | + | else throw("Invalid Pool Key.") | |
261 | + | else throw("Invalid Asset1 or Asset2!") | |
262 | + | else throw("Asset1 cannot be equal to Asset2") | |
263 | + | else throw("liquidity is currently under maintenance.") | |
264 | + | else throw("dApp is currently under maintenance.") | |
265 | + | } | |
266 | + | ||
267 | + | ||
181 | 268 | @Verifier(tx) | |
182 | 269 | func verify () = match tx { | |
183 | 270 | case _ => | |
184 | 271 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
185 | 272 | } | |
186 | 273 |
github/deemru/w8io/169f3d6 39.16 ms ◑