tx · BcFoFeqAmKBqkoBQngZ9F3JcfU6att3KfbCX9zRTv3CH 3NCR8hU9D6y5fsC2A9JcgB6YMUov1ZirAv5: -0.01000000 Waves 2020.09.11 14:30 [1172597] smart account 3NCR8hU9D6y5fsC2A9JcgB6YMUov1ZirAv5 > SELF 0.00000000 Waves
{ "type": 13, "id": "BcFoFeqAmKBqkoBQngZ9F3JcfU6att3KfbCX9zRTv3CH", "fee": 1000000, "feeAssetId": null, "timestamp": 1599823848171, "version": 1, "sender": "3NCR8hU9D6y5fsC2A9JcgB6YMUov1ZirAv5", "senderPublicKey": "BQoXUYVAQCLLRVRJKqzfgcodTF25sprvVdcS5EuoVhfF", "proofs": [ "2mGD1WMo6KY2mLhswaFdTM2UHHDyqZvjosyLba4tAkQwSA9SW1wzXRqU4GMv31ZfyzNmZxiNgNAyZhN67ve1vtHQ" ], "script": "base64:AAIEAAAAAAAAABIIAhIAEgASAwoBCBIFCgMIAQEAAABFAQAAAA5rZXlVY29sbGF0ZXJhbAAAAAACAAAADCR1Y29sbGF0ZXJhbAEAAAAbZ2VuZXJhdGVLZXlBc3NldExvY2tlZFRvdGFsAAAAAQAAAAdhc3NldElkCQABLAAAAAICAAAAFiRhc3NldF9sb2NrZWRfdG90YWxfXyQFAAAAB2Fzc2V0SWQBAAAAE2tleUFjY291bnRPcGVyYXRpb24AAAADAAAADHVubG9ja0hlaWdodAAAAAdhZGRyZXNzAAAABnN0YXR1cwkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAFyRkZWZvQXNzZXRfb3BlcmF0aW9uX18kBQAAAAdhZGRyZXNzAgAAAANfXyMJAAGkAAAAAQUAAAAMdW5sb2NrSGVpZ2h0AgAAAANfXyQFAAAABnN0YXR1cwAAAAAUSWR4T3BlcmF0aW9uQW1vdW50SW4AAAAAAAAAAAAAAAAAE0lkeE9wZXJhdGlvbkFzc2V0SW4AAAAAAAAAAAEAAAAAEUlkeE9wZXJhdGlvblByaWNlAA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vbGxhdGVyYWxFbnRyeQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V51UvnYw==", "chainId": 84, "height": 1172597, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func keyUcollateral () = "$ucollateral" | |
5 | + | ||
6 | + | ||
7 | + | func generateKeyAssetLockedTotal (assetId) = ("$asset_locked_total__$" + assetId) | |
8 | + | ||
9 | + | ||
10 | + | func keyAccountOperation (unlockHeight,address,status) = ((((("$defoAsset_operation__$" + address) + "__#") + toString(unlockHeight)) + "__$") + status) | |
11 | + | ||
12 | + | ||
13 | + | let IdxOperationAmountIn = 0 | |
14 | + | ||
15 | + | let IdxOperationAssetIn = 1 | |
16 | + | ||
17 | + | let IdxOperationPrice = 2 | |
18 | + | ||
19 | + | let IdxOperationAmountOut = 3 | |
20 | + | ||
21 | + | let IdxOperationAssetOut = 4 | |
22 | + | ||
23 | + | func dataAccountOperation (amountIn,assetIn,price,amountOut,assetOut,bruttoAmount,feeAmount) = ((((((((((((toString(amountIn) + "__") + assetIn) + "__") + toString(amountOut)) + "__") + assetOut) + "__") + toString(price)) + "__") + toString(bruttoAmount)) + "__") + toString(feeAmount)) | |
24 | + | ||
25 | + | ||
26 | + | func readAccountOperationDataArrayOrFail (accOperationKey) = { | |
27 | + | let accOperationDataStr = valueOrErrorMessage(getString(this, accOperationKey), ("There is no request for passed arguments: " + accOperationKey)) | |
28 | + | split(accOperationDataStr, "__") | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | let nullInt = -1 | |
33 | + | ||
34 | + | let nullStr = "NULL" | |
35 | + | ||
36 | + | let factoryAcc = addressFromStringValue(getStringValue(this, "factory")) | |
37 | + | ||
38 | + | func getAssetAddressBySymbolKey (assetSymbol) = (("asset_" + assetSymbol) + "_address") | |
39 | + | ||
40 | + | ||
41 | + | func getAssetSymbolKey (assetAddress) = (("asset_" + assetAddress) + "_symbol") | |
42 | + | ||
43 | + | ||
44 | + | func getAssetMetaKey (assetAddress) = (("asset_" + assetAddress) + "_meta") | |
45 | + | ||
46 | + | ||
47 | + | func getAssetStatusKey (assetAddress) = (("asset_" + assetAddress) + "_status") | |
48 | + | ||
49 | + | ||
50 | + | func getAssetInitHeightKey (assetAddress) = (("asset_" + assetAddress) + "_init_height") | |
51 | + | ||
52 | + | ||
53 | + | func getAssetActivateHeightKey (assetAddress) = (("asset_" + assetAddress) + "_activate_height") | |
54 | + | ||
55 | + | ||
56 | + | func getAssetAddressKey (assetAddress) = (("asset_" + assetAddress) + "_address") | |
57 | + | ||
58 | + | ||
59 | + | func getAssetMinRequiredPoolAmountKey (assetAddress) = (("asset_" + assetAddress) + "_min_pool") | |
60 | + | ||
61 | + | ||
62 | + | func getAssetCurrrentPoolAmountKey (assetAddress) = (("asset_" + assetAddress) + "_current_pool") | |
63 | + | ||
64 | + | ||
65 | + | func getAssetMaxPoolAmountKey (assetAddress) = (("asset_" + assetAddress) + "_max_pool") | |
66 | + | ||
67 | + | ||
68 | + | func getPoolMakerParticipationAmountKey (assetAddress,poolMakerAddress) = (((("pool_" + assetAddress) + "_") + poolMakerAddress) + "_amount") | |
69 | + | ||
70 | + | ||
71 | + | func getPoolMakerParticipationMaxAmountKey (assetAddress,poolMakerAddress) = (((("pool_" + assetAddress) + "_") + poolMakerAddress) + "max_amount") | |
72 | + | ||
73 | + | ||
74 | + | let IdxDefoAssetCode = 0 | |
75 | + | ||
76 | + | let IdxDefoAssetId = 1 | |
77 | + | ||
78 | + | let IdxDefoAssetStatus = 2 | |
79 | + | ||
80 | + | let IdxPriceDecimals = 3 | |
81 | + | ||
82 | + | let IdxBaseAssetId = 4 | |
83 | + | ||
84 | + | let IdxOverCollateralPercent = 5 | |
85 | + | ||
86 | + | let IdxMinInitPool = 6 | |
87 | + | ||
88 | + | let IdxPriceOracleAddress = 7 | |
89 | + | ||
90 | + | let IdxMinBuyPayment = 8 | |
91 | + | ||
92 | + | let IdxMinSellPayment = 9 | |
93 | + | ||
94 | + | let IdxBuyLockInterval = 10 | |
95 | + | ||
96 | + | let IdxSellLockInterval = 11 | |
97 | + | ||
98 | + | let IdxBuyFeePercent = 12 | |
99 | + | ||
100 | + | let IdxSellFeePercent = 13 | |
101 | + | ||
102 | + | let stakingAddressStr = getStringValue(factoryAcc, "neutrino_staking") | |
103 | + | ||
104 | + | let stakingAddress = addressFromStringValue(stakingAddressStr) | |
105 | + | ||
106 | + | let cfg = getStringValue(factoryAcc, ("$defoAsset_" + toString(this))) | |
107 | + | ||
108 | + | let cfgArray = split(cfg, "__") | |
109 | + | ||
110 | + | let defoAssetCode = cfgArray[IdxDefoAssetCode] | |
111 | + | ||
112 | + | let defoAssetId = fromBase58String(cfgArray[IdxDefoAssetId]) | |
113 | + | ||
114 | + | let priceOracleAddress = addressFromStringValue(cfgArray[IdxPriceOracleAddress]) | |
115 | + | ||
116 | + | let overCollateralPercent = parseIntValue(cfgArray[IdxOverCollateralPercent]) | |
117 | + | ||
118 | + | let baseAssetIdStr = cfgArray[IdxBaseAssetId] | |
119 | + | ||
120 | + | let baseAssetId = fromBase58String(baseAssetIdStr) | |
121 | + | ||
122 | + | let priceDecimals = parseIntValue(cfgArray[IdxPriceDecimals]) | |
123 | + | ||
124 | + | let minBasicBuyAmount = parseIntValue(cfgArray[IdxMinBuyPayment]) | |
125 | + | ||
126 | + | let minSynthSellAmount = parseIntValue(cfgArray[IdxMinSellPayment]) | |
127 | + | ||
128 | + | let buyLockInterval = parseIntValue(cfgArray[IdxBuyLockInterval]) | |
129 | + | ||
130 | + | let sellLockInterval = parseIntValue(cfgArray[IdxSellLockInterval]) | |
131 | + | ||
132 | + | let buyFeePercent = parseIntValue(cfgArray[IdxBuyFeePercent]) | |
133 | + | ||
134 | + | func controlAccReadCurrIdxOrFail () = valueOrErrorMessage(getInteger(priceOracleAddress, "currIdx"), ("No currIdx at controlAcc=" + toString(priceOracleAddress))) | |
135 | + | ||
136 | + | ||
137 | + | func controlAccReadIdxHeight (idx) = { | |
138 | + | let idxHeightKey = ("idxHeight_" + toString(idx)) | |
139 | + | valueOrElse(getInteger(priceOracleAddress, idxHeightKey), 0) | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | func controlAccReadPriceByHeight (priceHeight) = { | |
144 | + | let priceByHeightKey = ("price_" + toString(priceHeight)) | |
145 | + | valueOrErrorMessage(getInteger(priceOracleAddress, priceByHeightKey), ((("No " + priceByHeightKey) + " at controlAcc=") + toString(priceOracleAddress))) | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | func getStakingBalance () = valueOrElse(getInteger(this, ((("rpd_balance_" + baseAssetIdStr) + "_") + toString(this))), 0) | |
150 | + | ||
151 | + | ||
152 | + | let ucollateral = valueOrElse(getInteger(this, keyUcollateral()), 0) | |
153 | + | ||
154 | + | let currPoolAmount = getIntegerValue(factoryAcc, (("$defoAsset_" + toString(this)) + "_currentPool")) | |
155 | + | ||
156 | + | let doubleCheckBasicBalance = (assetBalance(this, baseAssetId) + getStakingBalance()) | |
157 | + | ||
158 | + | let doubleCheckUcollateral = if ((0 > ucollateral)) | |
159 | + | then 0 | |
160 | + | else ucollateral | |
161 | + | ||
162 | + | let doubleCheckCurrPoolAmount = (doubleCheckBasicBalance - doubleCheckUcollateral) | |
163 | + | ||
164 | + | let price = getIntegerValue(priceOracleAddress, ("$price_" + defoAssetCode)) | |
165 | + | ||
166 | + | let overPrice = (((priceDecimals + overCollateralPercent) * price) / priceDecimals) | |
167 | + | ||
168 | + | let emission = value(assetInfo(defoAssetId)).quantity | |
169 | + | ||
170 | + | let basicAssetLockedAmt = valueOrElse(getInteger(this, generateKeyAssetLockedTotal(baseAssetIdStr)), 0) | |
171 | + | ||
172 | + | let availablePoolBalance = (currPoolAmount - basicAssetLockedAmt) | |
173 | + | ||
174 | + | @Callable(i) | |
175 | + | func buyAsset () = if ((currPoolAmount != doubleCheckCurrPoolAmount)) | |
176 | + | then throw(((("Invalid currPoolAmount calculations: currPoolAmount=" + toString(currPoolAmount)) + " doubleCheckCurrPoolAmount=") + toString(doubleCheckCurrPoolAmount))) | |
177 | + | else { | |
178 | + | let pmt = value(i.payments[0]) | |
179 | + | let pmtAsset = value(pmt.assetId) | |
180 | + | let availableDefoAssetInPool = (fraction(availablePoolBalance, priceDecimals, overPrice) - emission) | |
181 | + | let fullDefoAssetAmountBrutto = fraction(pmt.amount, priceDecimals, price) | |
182 | + | let fullDefoAssetAmount = fraction((priceDecimals - buyFeePercent), fullDefoAssetAmountBrutto, priceDecimals) | |
183 | + | let feeAmount = (fullDefoAssetAmountBrutto - fullDefoAssetAmount) | |
184 | + | let defoAssetAmount = if ((fullDefoAssetAmount > availableDefoAssetInPool)) | |
185 | + | then (fullDefoAssetAmount - availableDefoAssetInPool) | |
186 | + | else fullDefoAssetAmount | |
187 | + | let requiredBasicAssetAmount = fraction(fullDefoAssetAmountBrutto, price, priceDecimals) | |
188 | + | let change = (pmt.amount - requiredBasicAssetAmount) | |
189 | + | if ((0 >= availableDefoAssetInPool)) | |
190 | + | then throw((("Impossible to issue new " + defoAssetCode) + ": not enough collateral")) | |
191 | + | else if ((pmtAsset != baseAssetId)) | |
192 | + | then throw(((("Payment asset id doesn't match basic asset: expected=" + toBase58String(baseAssetId)) + " actual=") + toBase58String(pmtAsset))) | |
193 | + | else if ((minBasicBuyAmount > pmt.amount)) | |
194 | + | then throw(((((("Impossible to issue new " + defoAssetCode) + ": payment=") + toString(pmt.amount)) + "is less then min amount=") + toString(minBasicBuyAmount))) | |
195 | + | else [IntegerEntry(keyUcollateral(), (ucollateral + requiredBasicAssetAmount)), StringEntry(keyAccountOperation(height, toString(i.caller), "FINISHED"), dataAccountOperation(pmt.amount, toBase58String(pmtAsset), price, fullDefoAssetAmount, toBase58String(defoAssetId), fullDefoAssetAmountBrutto, feeAmount)), Reissue(defoAssetId, defoAssetAmount, true), ScriptTransfer(i.caller, defoAssetAmount, defoAssetId), ScriptTransfer(i.caller, change, baseAssetId)] | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | @Callable(i) | |
201 | + | func sellAsset () = { | |
202 | + | let pmt = value(i.payments[0]) | |
203 | + | let pmtAsset = value(pmt.assetId) | |
204 | + | let callerAddress = toString(i.caller) | |
205 | + | let keyAssetLockedTotal = generateKeyAssetLockedTotal(toBase58String(pmtAsset)) | |
206 | + | let currAssetTotalLocked = valueOrElse(getInteger(this, keyAssetLockedTotal), 0) | |
207 | + | let unlockHeight = (height + sellLockInterval) | |
208 | + | let keyAccountLock = keyAccountOperation(unlockHeight, callerAddress, "PENDING") | |
209 | + | if ((pmtAsset != defoAssetId)) | |
210 | + | then throw(((("Invalid payment asset id: expected=" + toBase58String(defoAssetId)) + " actual=") + toBase58String(pmtAsset))) | |
211 | + | else if ((minSynthSellAmount > pmt.amount)) | |
212 | + | then throw(((("Payment amount less then mininimal allowed: paymentAmount=" + toString(pmt.amount)) + " minAmount=") + toString(minSynthSellAmount))) | |
213 | + | else if (isDefined(getInteger(this, keyAccountLock))) | |
214 | + | then throw((((("Sell request has been already defined for " + callerAddress) + "_") + toString(unlockHeight)) + " pair: need to wait next block")) | |
215 | + | else [IntegerEntry(keyAssetLockedTotal, (currAssetTotalLocked + pmt.amount)), StringEntry(keyAccountLock, dataAccountOperation(pmt.amount, toBase58String(defoAssetId), nullInt, nullInt, toBase58String(baseAssetId), nullInt, nullInt))] | |
216 | + | } | |
217 | + | ||
218 | + | ||
219 | + | ||
220 | + | @Callable(i) | |
221 | + | func crossExchange (defoAssetId) = throw("Temporary not implemented") | |
222 | + | ||
223 | + | ||
224 | + | ||
225 | + | @Callable(i) | |
226 | + | func withdraw (accountAddress,unlockHeight,idx) = { | |
227 | + | let accOperationKey = keyAccountOperation(unlockHeight, accountAddress, "PENDING") | |
228 | + | let accOperationDataArray = readAccountOperationDataArrayOrFail(accOperationKey) | |
229 | + | let amountIn = parseIntValue(accOperationDataArray[IdxOperationAmountIn]) | |
230 | + | let assetIn = accOperationDataArray[IdxOperationAssetIn] | |
231 | + | let assetOut = accOperationDataArray[IdxOperationAssetOut] | |
232 | + | if ((unlockHeight > height)) | |
233 | + | then throw((("Please wait " + toString(unlockHeight)) + " to withdraw your funds")) | |
234 | + | else { | |
235 | + | let accountLockedAmt = amountIn | |
236 | + | if ((0 >= accountLockedAmt)) | |
237 | + | then throw("LockedAmount <= 0") | |
238 | + | else { | |
239 | + | let keyAssetLockedTotal = generateKeyAssetLockedTotal(accOperationDataArray[IdxOperationAssetIn]) | |
240 | + | let currAssetLockedTotal = valueOrErrorMessage(getInteger(this, keyAssetLockedTotal), (("State contains sellAssetRequest=" + accOperationKey) + " BUT no totalLocked")) | |
241 | + | let idxHeight = controlAccReadIdxHeight(idx) | |
242 | + | let prevIdxHeight = controlAccReadIdxHeight((idx - 1)) | |
243 | + | let currIdx = controlAccReadCurrIdxOrFail() | |
244 | + | if (if (if ((idx > currIdx)) | |
245 | + | then true | |
246 | + | else (unlockHeight > idxHeight)) | |
247 | + | then true | |
248 | + | else if ((prevIdxHeight != 0)) | |
249 | + | then (prevIdxHeight >= unlockHeight) | |
250 | + | else false) | |
251 | + | then throw(((((((((("invalid price idx: idx=" + toString(idx)) + " currIdx=") + toString(currIdx)) + " idxHeight=") + toString(idxHeight)) + " unlockHeight=") + toString(unlockHeight)) + " prevIdxHeight=") + toString(prevIdxHeight))) | |
252 | + | else { | |
253 | + | let synth2basicPrice = controlAccReadPriceByHeight(idxHeight) | |
254 | + | let assetInBytes = fromBase58String(assetIn) | |
255 | + | let $t01161312483 = if ((assetInBytes == baseAssetId)) | |
256 | + | then { | |
257 | + | let synthAmt = fraction(amountIn, priceDecimals, synth2basicPrice) | |
258 | + | $Tuple4(synthAmt, Reissue(defoAssetId, synthAmt, true), ScriptTransfer(addressFromStringValue(accountAddress), synthAmt, defoAssetId), IntegerEntry(keyUcollateral(), (ucollateral + amountIn))) | |
259 | + | } | |
260 | + | else if ((assetInBytes == defoAssetId)) | |
261 | + | then { | |
262 | + | let basicAmt = fraction(amountIn, synth2basicPrice, priceDecimals) | |
263 | + | let newUcollateral = (ucollateral - basicAmt) | |
264 | + | $Tuple4(basicAmt, Burn(baseAssetId, basicAmt), ScriptTransfer(addressFromStringValue(accountAddress), basicAmt, baseAssetId), IntegerEntry(keyUcollateral(), (ucollateral - basicAmt))) | |
265 | + | } | |
266 | + | else throw(("Unsupported assetIn=" + assetIn)) | |
267 | + | let amountOut = $t01161312483._1 | |
268 | + | let burnOrIssue = $t01161312483._2 | |
269 | + | let transferSynthOrBasic = $t01161312483._3 | |
270 | + | let ucollateralEntry = $t01161312483._4 | |
271 | + | if ((0 > (currAssetLockedTotal - accountLockedAmt))) | |
272 | + | then throw((("Invalid data state: " + keyAssetLockedTotal) + " less then 0")) | |
273 | + | else ((([IntegerEntry(keyAssetLockedTotal, (currAssetLockedTotal - accountLockedAmt)), DeleteEntry(accOperationKey), StringEntry(keyAccountOperation(unlockHeight, accountAddress, "FINISHED"), dataAccountOperation(amountIn, assetIn, synth2basicPrice, amountOut, assetOut, 0, 0))] :+ burnOrIssue) :+ transferSynthOrBasic) :+ ucollateralEntry) | |
274 | + | } | |
275 | + | } | |
276 | + | } | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | @Verifier(tx) | |
281 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
282 | + |
github/deemru/w8io/169f3d6 37.77 ms ◑