tx · ADRjarNrVY5rMEdywTwkbUkfxNiPDRuFaUM1yGueuPRF

3NBWMaVGwnT8pQt7ngM23Ss8tfGEUCgN2Hm:  -0.01300000 Waves

2023.03.02 11:12 [2472181] smart account 3NBWMaVGwnT8pQt7ngM23Ss8tfGEUCgN2Hm > SELF 0.00000000 Waves

{ "type": 13, "id": "ADRjarNrVY5rMEdywTwkbUkfxNiPDRuFaUM1yGueuPRF", "fee": 1300000, "feeAssetId": null, "timestamp": 1677744741100, "version": 1, "sender": "3NBWMaVGwnT8pQt7ngM23Ss8tfGEUCgN2Hm", "senderPublicKey": "9dHmg7QMq8PCA9RS95ZqdGz82AUwfTBX7ebde6WAwKAD", "proofs": [ "cAiz628c82Qbttk2YnyvBZicQV5xs3Rqd2Lfw8QNKc4egbuuTS11dWP9V6DHK2WRiiozdPnv44G7zjgKchKtToM" ], "script": "base64:BgIVCAISAwoBCBIAEgMKAQgSAwoBCBIAJAADU0VQAgJfXwAGc2NhbGU4AIDC1y8AEXBvb2xTdGF0c1ByaWNlS2V5AAQADmlkeFBvb2xBZGRyZXNzAAEADWlkeFBvb2xTdGF0dXMAAgAQaWR4UG9vbExQQXNzZXRJZAADAA1pZHhBbXRBc3NldElkAAQAD2lkeFByaWNlQXNzZXRJZAAFAA5pZHhBbXRBc3NldERjbQAGABBpZHhQcmljZUFzc2V0RGNtAAcADmlkeElBbXRBc3NldElkAAgAEGlkeElQcmljZUFzc2V0SWQACQANaWR4TFBBc3NldERjbQAKABNpZHhNYXRjaGVyUHVibGljS2V5AAsBDmtleVJlZ2lzdGVyUHV0Agtwb29sQWRkcmVzcwR0eElkCQCsAgIJAKwCAgkArAICAgslcyVzJXNfX1BfXwULcG9vbEFkZHJlc3MCAl9fBQR0eElkARFrZXlSZWdpc3RlckludmVzdAILcG9vbEFkZHJlc3MEdHhJZAkArAICCQCsAgIJAKwCAgIQJXMlcyVzX19pbnZlc3RfXwULcG9vbEFkZHJlc3MCAl9fBQR0eElkARZrZXlQb29sVG90Y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ldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleQXFtcg=", "chainId": 84, "height": 2472181, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5NQrZ3tJFXaiozNTpJZci8iLHv6A5vUzG1TAnWMSjPy4 Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let scale8 = 100000000
77
88 let poolStatsPriceKey = 4
99
1010 let idxPoolAddress = 1
1111
1212 let idxPoolStatus = 2
1313
1414 let idxPoolLPAssetId = 3
1515
1616 let idxAmtAssetId = 4
1717
1818 let idxPriceAssetId = 5
1919
2020 let idxAmtAssetDcm = 6
2121
2222 let idxPriceAssetDcm = 7
2323
2424 let idxIAmtAssetId = 8
2525
2626 let idxIPriceAssetId = 9
2727
2828 let idxLPAssetDcm = 10
2929
3030 let idxMatcherPublicKey = 11
3131
3232 func keyRegisterPut (poolAddress,txId) = ((("%s%s%s__P__" + poolAddress) + "__") + txId)
3333
3434
3535 func keyRegisterInvest (poolAddress,txId) = ((("%s%s%s__invest__" + poolAddress) + "__") + txId)
3636
3737
3838 func keyPoolTotalAmtByAsset (poolAddress,assetId) = ((("%s%s%s__total__" + poolAddress) + "__") + assetId)
3939
4040
4141 func keyFactoryContract () = "%s__factoryContract"
4242
4343
4444 func keySlippageAmtPerAssetCumulative (poolAddress,assetId) = (((("%s%s%s__" + poolAddress) + "__") + assetId) + "__slippageCumulative")
4545
4646
4747 func keyFactoryConfig () = "%s__factoryConfig"
4848
4949
5050 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2PoolAssets")
5151
5252
5353 func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset))
5454
5555
5656 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
5757
5858
5959 func keyAllPoolsShutdown () = "%s__shutdown"
6060
6161
6262 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
6363
6464
6565 func keyManagerPublicKey () = "%s__managerPublicKey"
6666
6767
6868 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
6969
7070
7171 let factoryContract = addressFromStringValue(valueOrErrorMessage(getString(this, keyFactoryContract()), "No Factory Acc found."))
7272
7373 func convertAssetId (assetId) = if (!(isDefined(assetId)))
7474 then "WAVES"
7575 else assetId
7676
7777
7878 func dataPutActionInfo (inAssetId,inAssetAmt,txHeight,txTimestamp) = makeString(["%s%d%d%d", inAssetId, toString(inAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
7979
8080
8181 func dataInvestActionInfo (outAmountAssetAmt,outPriceAssetAmt,txHeight,txTimestamp) = makeString(["%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(txHeight), toString(txTimestamp)], SEP)
8282
8383
8484 func asString (val) = match val {
8585 case valStr: String =>
8686 valStr
8787 case _ =>
8888 throw("fail to cast into String")
8989 }
9090
9191
9292 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
9393
9494
9595 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
9696 case s: String =>
9797 fromBase58String(s)
9898 case _: Unit =>
9999 unit
100100 case _ =>
101101 throw("Match error")
102102 }
103103
104104
105105 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
106106 case s: String =>
107107 fromBase58String(s)
108108 case _: Unit =>
109109 unit
110110 case _ =>
111111 throw("Match error")
112112 }
113113
114114
115115 func mustManager (i) = {
116116 let pd = throw("Permission denied")
117117 match managerPublicKeyOrUnit() {
118118 case pk: ByteVector =>
119119 if ((i.callerPublicKey == pk))
120120 then true
121121 else pd
122122 case _: Unit =>
123123 if ((i.caller == this))
124124 then true
125125 else pd
126126 case _ =>
127127 throw("Match error")
128128 }
129129 }
130130
131131
132132 @Callable(i)
133133 func constructor (factoryContract) = {
134134 let checkCaller = mustManager(i)
135135 if ((checkCaller == checkCaller))
136136 then [StringEntry(keyFactoryContract(), factoryContract)]
137137 else throw("Strict value is not equal to itself.")
138138 }
139139
140140
141141
142142 @Callable(i)
143143 func put () = {
144144 let pool = toString(i.caller)
145145 let pmtAmtAsset = value(i.payments[0])
146146 let pmtAssetId = if (!(isDefined(pmtAmtAsset.assetId)))
147147 then "WAVES"
148148 else toBase58String(value(pmtAmtAsset.assetId))
149149 let pmtAssetAmt = pmtAmtAsset.amount
150150 let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(pool)), "Invalid caller"), SEP)
151151 let amountAssetId = parseIntValue(poolAssets[1])
152152 let priceAssetId = parseIntValue(poolAssets[2])
153153 let amountAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(amountAssetId)), "Cannot find asset")
154154 let priceAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(priceAssetId)), "Cannot find asset")
155155 let totalAmt = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(pool, pmtAssetId)), 0)
156156 let cumulativeSlippageAmt = valueOrElse(getInteger(this, keySlippageAmtPerAssetCumulative(pool, pmtAssetId)), 0)
157157 [StringEntry(keyRegisterPut(pool, toBase58String(i.transactionId)), dataPutActionInfo(pmtAssetId, pmtAssetAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(pool, pmtAssetId), (totalAmt + pmtAssetAmt)), IntegerEntry(keySlippageAmtPerAssetCumulative(pool, pmtAssetId), (cumulativeSlippageAmt + pmtAssetAmt))]
158158 }
159159
160160
161161
162162 @Callable(i)
163163 func invest (poolAddressStr) = {
164164 let poolAddress = valueOrErrorMessage(addressFromString(poolAddressStr), "invalid pool address")
165165 let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(poolAddressStr)), "Invalid pool passed."), SEP)
166166 let amId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[1]))), "No asset mapping found")
167167 let prId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[2]))), "No asset mapping found")
168168 let amBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, amId)), 0)
169169 let prBalance = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddressStr, prId)), 0)
170170 let estByPrResult = invoke(poolAddress, "evaluatePutByPriceAssetREADONLY", [prBalance], nil)
171171 let estByAmResult = invoke(poolAddress, "evaluatePutByAmountAssetREADONLY", [amBalance], nil)
172172 let IdxEstAmAmount = 7
173173 let IdxEstPrAmount = 8
174174 let estAmAmt = valueOrErrorMessage(parseIntValue(split(asString(estByPrResult), SEP)[IdxEstAmAmount]), "fail to parse estimated amAsset amount")
175175 let estPrAmt = valueOrErrorMessage(parseIntValue(split(asString(estByAmResult), SEP)[IdxEstPrAmount]), "fail to parse estimated prAsset amount")
176176 let $t067836884 = if ((amBalance >= estAmAmt))
177177 then $Tuple2(estAmAmt, prBalance)
178178 else $Tuple2(amBalance, estPrAmt)
179179 let amAmt = $t067836884._1
180180 let prAmt = $t067836884._2
181181 let amAssetId = if ((amId == "WAVES"))
182182 then unit
183183 else fromBase58String(amId)
184184 let prAssetId = if ((prId == "WAVES"))
185185 then unit
186186 else fromBase58String(prId)
187187 let lpPut = invoke(poolAddress, "putForFree", [1000], [AttachedPayment(amAssetId, amAmt), AttachedPayment(prAssetId, prAmt)])
188188 if ((lpPut == lpPut))
189189 then [StringEntry(keyRegisterInvest(poolAddressStr, toBase58String(i.transactionId)), dataInvestActionInfo(amAmt, prAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, amId), (amBalance - amAmt)), IntegerEntry(keyPoolTotalAmtByAsset(poolAddressStr, prId), (prBalance - prAmt))]
190190 else throw("Strict value is not equal to itself.")
191191 }
192192
193193
194194
195195 @Callable(i)
196196 func setManager (pendingManagerPublicKey) = {
197197 let checkCaller = mustManager(i)
198198 if ((checkCaller == checkCaller))
199199 then {
200200 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
201201 if ((checkManagerPublicKey == checkManagerPublicKey))
202202 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
203203 else throw("Strict value is not equal to itself.")
204204 }
205205 else throw("Strict value is not equal to itself.")
206206 }
207207
208208
209209
210210 @Callable(i)
211211 func confirmManager () = {
212212 let pm = pendingManagerPublicKeyOrUnit()
213213 let hasPM = if (isDefined(pm))
214214 then true
215215 else throw("No pending manager")
216216 if ((hasPM == hasPM))
217217 then {
218218 let checkPM = if ((i.callerPublicKey == value(pm)))
219219 then true
220220 else throw("You are not pending manager")
221221 if ((checkPM == checkPM))
222222 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
223223 else throw("Strict value is not equal to itself.")
224224 }
225225 else throw("Strict value is not equal to itself.")
226226 }
227227
228228
229229 @Verifier(tx)
230230 func verify () = {
231231 let targetPublicKey = match managerPublicKeyOrUnit() {
232232 case pk: ByteVector =>
233233 pk
234234 case _: Unit =>
235235 tx.senderPublicKey
236236 case _ =>
237237 throw("Match error")
238238 }
239239 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
240240 }
241241

github/deemru/w8io/169f3d6 
34.71 ms