tx · C7XMpyex3FdL3tmBKZA7RtsDzkM9WZg5JbfY1xwr4iGo 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY: -0.01000000 Waves 2022.06.16 01:39 [2098098] smart account 3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY > SELF 0.00000000 Waves
{ "type": 13, "id": "C7XMpyex3FdL3tmBKZA7RtsDzkM9WZg5JbfY1xwr4iGo", "fee": 1000000, "feeAssetId": null, "timestamp": 1655332770154, "version": 2, "chainId": 84, "sender": "3N6LXAerq2VVAPds14fKmB72f1Whmem7pxY", "senderPublicKey": "fFTt4dRQEMWmxs9cA5He1tph3gmQLAM4cnpj6eqkWPR", "proofs": [ "3Jj5ov5fajiMb4uzWFGvzYq37eKpDsLGw3nEBUChWXkh3kZP5kFaCqSXfE9rBAnNG4AFEojasdZoCybfQwsPEiCa" ], "script": "base64:AAIFAAAAAAAAACsIAhIKCggICAgICAQBARIDCgEEEgUKAwQEBBIDCgEBEgMKAQQSABIDCgEBAAAAHwAAAAAEbWFpbgIAAAAKbWFpbl9hc3NldAAAAAABbAIAAAAJbHBfYXNzZXRfAAAAAAJhMQIAAAAMc3dhcF9hc3NldDFfAAAAAAJzdAIAAAAPYWRkcmVzc19zdGFrZXJfAAAAAANzc3QCAAAADWFkZHJlc3NfcG9vbF8AAAAAA3N3cAIAAAANYWRkcmVzc19zd2FwXwAAAAACYTICAAAADHN3YXBfYXNzZXQyXwAAAAADYWExAgAAAAdwb29sXzFfAAAAAANhYTICAAAAB3Bvb2xfMl8AAAAAA3N0MQIAAAAOc3Rha2VyX2FkZHJlc3MAAAAABHR5cGUCAAAABXR5cGVfAAAAAAJzYQIAAAAPU1RBS0lOR19BTU9VTlRfAAAAAAJsYQIAAAANTEVBU0VfQU1PVU5UXwAAAAACaXgCAAAAA0lEXwAAAAAHcmF0ZUZlZQIAAAATcGVyY2VudGFnZV9yYXRlX2ZlZQAAAAACRDgAAAAAAAX14QAAAAAAAkQ2AAAAAAAAD0JAAAAAAA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EludGVnZXJFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAUVG90YWxfVG9rZW5zX0xvY2tlZDoFAAAACnRvdGFsdG9rZW4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAACU1haW5Bc3NldAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIJAABoAAAAAgkAAGkAAAACCQAAaAAAAAIFAAAABGRpZmYFAAAAA2JjZAUAAAATcHJldmlvdXNsb2NrYmFsYW5jZQUAAAANY3VycmVudEFtb3VudAUAAAAJTWFpbkFzc2V0BQAAAANuaWwJAAACAAAAAQIAAAApbGlxdWlkaXR5IGlzIGN1cnJlbnRseSB1bmRlciBtYWludGVuYW5jZS4JAAACAAAAAQIAAAAkZEFwcCBpcyBjdXJyZW50bHkgdW5kZXIgbWFpbnRlbmFuY2UuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5D5g6yQ==", "height": 2098098, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GmqNS7rVJTWHTzkk35inrkpwshXLTXEezfwWS9ytEKRD Next: 41exwtqWT7YAmEyhUFR2wK39mmxoZ1dgWHEAe1U4Bwe5 Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | ||
54 | 54 | let liquidityAc = "activate_liquidity" | |
55 | 55 | ||
56 | + | let bcD = "block_distribuition" | |
57 | + | ||
56 | 58 | let usdn = "usdn_asset" | |
57 | 59 | ||
58 | 60 | let usdt = "usdt_asset" | |
64 | 66 | let aWaves = "accept_waves" | |
65 | 67 | ||
66 | 68 | @Callable(i) | |
67 | - | func constructor (MainAssetId,UsdnAssetId,UsdtAssetId,UsdcAssetId,NgnnAssetId,acceptWaves,percentageRate) = if ((i.caller == this)) | |
68 | - | 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)] | |
69 | + | 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)] | |
69 | 71 | else throw("Only the Admin itself can invoke this function") | |
70 | 72 | ||
71 | 73 | ||
152 | 154 | let previouslockbalance = getIntegerValue(this, "Total_Tokens_Locked:") | |
153 | 155 | let totaltoken = (previouslockbalance - amount) | |
154 | 156 | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
157 | + | let bcd = getIntegerValue(this, bcD) | |
155 | 158 | if ((0 > amount)) | |
156 | 159 | then throw("Can't withdraw negative AxAi amount") | |
157 | 160 | else { | |
158 | 161 | let newAmount = (currentAmount - amount) | |
159 | 162 | if ((0 > newAmount)) | |
160 | 163 | then throw("Not enough AxAi balance") | |
161 | - | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, (((diff * | |
164 | + | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, (((diff * bcd) / previouslockbalance) * currentAmount), MainAsset)] | |
162 | 165 | } | |
163 | 166 | } | |
164 | 167 | 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 | + | let bcD = "block_distribuition" | |
57 | + | ||
56 | 58 | let usdn = "usdn_asset" | |
57 | 59 | ||
58 | 60 | let usdt = "usdt_asset" | |
59 | 61 | ||
60 | 62 | let usdc = "usdc_asset" | |
61 | 63 | ||
62 | 64 | let ngnn = "ngnn_asset" | |
63 | 65 | ||
64 | 66 | let aWaves = "accept_waves" | |
65 | 67 | ||
66 | 68 | @Callable(i) | |
67 | - | func constructor (MainAssetId,UsdnAssetId,UsdtAssetId,UsdcAssetId,NgnnAssetId,acceptWaves,percentageRate) = if ((i.caller == this)) | |
68 | - | 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)] | |
69 | + | 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)] | |
69 | 71 | else throw("Only the Admin itself can invoke this function") | |
70 | 72 | ||
71 | 73 | ||
72 | 74 | ||
73 | 75 | @Callable(i) | |
74 | 76 | func activate (v) = if ((i.caller == this)) | |
75 | 77 | then [BooleanEntry(ac, v)] | |
76 | 78 | else throw("Only the Admin itself can invoke this function") | |
77 | 79 | ||
78 | 80 | ||
79 | 81 | ||
80 | 82 | @Callable(i) | |
81 | 83 | func maintenance (pools,swap,stake) = if ((i.caller == this)) | |
82 | 84 | then [BooleanEntry(poolAc, pools), BooleanEntry(swapAc, swap), BooleanEntry(liquidityAc, stake)] | |
83 | 85 | else throw("Only the Admin itself can invoke this function") | |
84 | 86 | ||
85 | 87 | ||
86 | 88 | ||
87 | 89 | @Callable(i) | |
88 | 90 | func percentualRateFeeEdit (rate) = if ((i.caller == this)) | |
89 | 91 | then [IntegerEntry(rateFee, rate)] | |
90 | 92 | else throw("Only the Admin itself can invoke this function") | |
91 | 93 | ||
92 | 94 | ||
93 | 95 | ||
94 | 96 | @Callable(i) | |
95 | 97 | func acceptWaves (activate) = if ((i.caller == this)) | |
96 | 98 | then [BooleanEntry(aWaves, activate)] | |
97 | 99 | else throw("Only the Admin itself can invoke this function") | |
98 | 100 | ||
99 | 101 | ||
100 | 102 | ||
101 | 103 | @Callable(i) | |
102 | 104 | func deposit () = { | |
103 | 105 | let power = getBooleanValue(this, ac) | |
104 | 106 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
105 | 107 | let acWaves = getBooleanValue(this, aWaves) | |
106 | 108 | let pmt = i.payments[0] | |
107 | 109 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
108 | 110 | if (power) | |
109 | 111 | then if (!(liquidityPower)) | |
110 | 112 | then if ((pmt.assetId != MainAsset)) | |
111 | 113 | then throw(("Invalid Asset! Kindly Deposit Only " + toBase58String(MainAsset))) | |
112 | 114 | else { | |
113 | 115 | let currentKey = toBase58String(i.caller.bytes) | |
114 | 116 | let currentAmount = match getInteger(this, currentKey) { | |
115 | 117 | case a: Int => | |
116 | 118 | a | |
117 | 119 | case _ => | |
118 | 120 | 0 | |
119 | 121 | } | |
120 | 122 | let newAmount = (currentAmount + pmt.amount) | |
121 | 123 | let useramount = IntegerEntry(currentKey, newAmount) | |
122 | 124 | let userdepositheight = IntegerEntry(("Deposit_Height_Of_" + currentKey), height) | |
123 | 125 | let previouslockbalance = match getInteger(this, "Total_Tokens_Locked:") { | |
124 | 126 | case a: Int => | |
125 | 127 | a | |
126 | 128 | case _ => | |
127 | 129 | 0 | |
128 | 130 | } | |
129 | 131 | let totaltoken = (previouslockbalance + pmt.amount) | |
130 | 132 | let TLV = IntegerEntry("Total_Tokens_Locked:", totaltoken) | |
131 | 133 | [useramount, userdepositheight, TLV] | |
132 | 134 | } | |
133 | 135 | else throw("liquidity is currently under maintenance.") | |
134 | 136 | else throw("dApp is currently under maintenance.") | |
135 | 137 | } | |
136 | 138 | ||
137 | 139 | ||
138 | 140 | ||
139 | 141 | @Callable(i) | |
140 | 142 | func remove (amount) = { | |
141 | 143 | let power = getBooleanValue(this, ac) | |
142 | 144 | let liquidityPower = getBooleanValue(this, liquidityAc) | |
143 | 145 | let acWaves = getBooleanValue(this, aWaves) | |
144 | 146 | let pmt = i.payments[0] | |
145 | 147 | let MainAsset = fromBase58String(getStringValue(this, main)) | |
146 | 148 | if (power) | |
147 | 149 | then if (!(liquidityPower)) | |
148 | 150 | then { | |
149 | 151 | let currentKey = toBase58String(i.caller.bytes) | |
150 | 152 | let currentAmount = valueOrElse(getInteger(this, currentKey), 0) | |
151 | 153 | let swapheightkeyname = ("Deposit_Height_Of_" + currentKey) | |
152 | 154 | let previouslockbalance = getIntegerValue(this, "Total_Tokens_Locked:") | |
153 | 155 | let totaltoken = (previouslockbalance - amount) | |
154 | 156 | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
157 | + | let bcd = getIntegerValue(this, bcD) | |
155 | 158 | if ((0 > amount)) | |
156 | 159 | then throw("Can't withdraw negative AxAi amount") | |
157 | 160 | else { | |
158 | 161 | let newAmount = (currentAmount - amount) | |
159 | 162 | if ((0 > newAmount)) | |
160 | 163 | then throw("Not enough AxAi balance") | |
161 | - | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, (((diff * | |
164 | + | else [IntegerEntry(currentKey, newAmount), IntegerEntry("Total_Tokens_Locked:", totaltoken), ScriptTransfer(i.caller, amount, MainAsset), ScriptTransfer(i.caller, (((diff * bcd) / previouslockbalance) * currentAmount), MainAsset)] | |
162 | 165 | } | |
163 | 166 | } | |
164 | 167 | else throw("liquidity is currently under maintenance.") | |
165 | 168 | else throw("dApp is currently under maintenance.") | |
166 | 169 | } | |
167 | 170 | ||
168 | 171 | ||
169 | 172 | @Verifier(tx) | |
170 | 173 | func verify () = match tx { | |
171 | 174 | case _ => | |
172 | 175 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
173 | 176 | } | |
174 | 177 |
github/deemru/w8io/026f985 42.13 ms ◑