tx · 5KPi12He2papvNXVDQrnAgA4rzF8JUXTcvKJGXxJQP11

3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu:  -0.01400000 Waves

2021.12.16 17:01 [1836903] smart account 3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu > SELF 0.00000000 Waves

{ "type": 13, "id": "5KPi12He2papvNXVDQrnAgA4rzF8JUXTcvKJGXxJQP11", "fee": 1400000, "feeAssetId": null, "timestamp": 1639663315114, "version": 1, "sender": "3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu", "senderPublicKey": "HLjebBrq1Pdi1gabeao41GqBhEf9kyjY2P4k6dbNW8XC", "proofs": [ "NPEhVch1QWa7MWiVnaCmjonAT8232wwpQZ6t83YjVn52DjYdxS24snVMzpUN4PJpba8vuKB3XGHXCdqirtqZZkn" ], "script": "base64:AAIFAAAAAAAAADkIAhIDCgEIEgMKAQgSBAoCCAgSAwoBCBIHCgUBAQEICBIAEgMKAQgSBAoCCAESBAoCCAESBAoCCAEAAAAgAAAAAAZTQ0FMRTgAAAAAAAAAAAgAAAAABU1VTFQ4AAAAAAAF9eEAAAAAAAdTQ0FMRTE4AAAAAAAAAAASAAAAAAZNVUxUMTgJAAE2AAAAAQAN4Lazp2QAAAAAAAADU0VQAgAAAAJfXwAAAAAKemVyb0JpZ0ludAkAATYAAAABAAAAAAAAAAAAAAAAAA5pZHhQb29sQWRkcmVzcwAAAAAAAAAAAQAAAAANaWR4UG9vbFN0YXR1cwAAAAAAAAAAAgAAAAAQaWR4UG9vbExQQXNzZXRJZAAAAAAAAAAAAwAAAAANaWR4QW10QXNzZXRJZAAAAAAAAAAABAAAAAAPaWR4UHJpY2VBc3NldElkAAAAAAAAAAAFAAAAAA5pZHhBbXRBc3NldERjbQAAAAAAAAAABgAAAAAQaWR4UHJpY2VBc3NldERjbQAAAAAAAAAABwAAAAAOaWR4SUFtdEFzc2V0SWQAAAAAAAAAAAgAAAAAEGlkeElQcmljZUFzc2V0SWQAAAAAAAA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AIb3V0UHJBbXQFAAAACWFtQmFsYW5jZQUAAAAJcHJCYWxhbmNlBQAAAApscEVtaXNzaW9uBQAAAAhjdXJQcmljZQUAAAAKcG9vbFN0YXR1cwkAAAIAAAABAgAAABNDb3VsZG4ndCBjYXN0IHR5cGVzBAAAAAhvdXRBbUFtdAgFAAAADSR0MDE1MDU4MTU0NzUAAAACXzEEAAAACG91dFByQW10CAUAAAANJHQwMTUwNTgxNTQ3NQAAAAJfMgQAAAAJYW1CYWxhbmNlCAUAAAANJHQwMTUwNTgxNTQ3NQAAAAJfMwQAAAAJcHJCYWxhbmNlCAUAAAANJHQwMTUwNTgxNTQ3NQAAAAJfNAQAAAAKbHBFbWlzc2lvbggFAAAADSR0MDE1MDU4MTU0NzUAAAACXzUEAAAACGN1clByaWNlCAUAAAANJHQwMTUwNTgxNTQ3NQAAAAJfNgQAAAAKcG9vbFN0YXR1cwgFAAAADSR0MDE1MDU4MTU0NzUAAAACXzcJAAUUAAAAAgUAAAADbmlsCQAEuQAAAAIJAARMAAAAAgIAAAAOJWQlZCVkJWQlZCVkJWQJAARMAAAAAgkAAaQAAAABBQAAAAhvdXRBbUFtdAkABEwAAAACCQABpAAAAAEFAAAACG91dFByQW10CQAETAAAAAIJAAGkAAAAAQUAAAAJYW1CYWxhbmNlCQAETAAAAAIJAAGkAAAAAQUAAAAJcHJCYWxhbmNlCQAETAAAAAIJAAGkAAAAAQUAAAAKbHBFbWlzc2lvbgkABEwAAAACBQAAAAhjdXJQcmljZQkABEwAAAACBQAAAApwb29sU3RhdHVzBQAAAANuaWwFAAAAA1NFUAAAAAAC4Cwf", "chainId": 84, "height": 1836903, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8pGigL65MavoTS7SehK6YyieCmD6LUxoTZVkYysshMrj Next: none Diff:
OldNewDifferences
1010 let MULT18 = toBigInt(1000000000000000000)
1111
1212 let SEP = "__"
13+
14+let zeroBigInt = toBigInt(0)
1315
1416 let idxPoolAddress = 1
1517
4648 func keyFactoryAddress () = "%s%s__config__factoryAddress"
4749
4850
49-let IdxFactoryCfgStakingDapp = 1
50-
51-let IdxFactoryCfgBoostingDapp = 2
52-
53-let IdxFactoryCfgIdoDapp = 3
54-
55-let IdxFactoryCfgTeamDapp = 4
56-
57-let IdxFactoryCfgEmissionDapp = 5
58-
59-let IdxFactoryCfgRestDapp = 6
60-
61-let IdxFactoryCfgSlippageDapp = 7
62-
63-func keyFactoryCfg () = "%s__factoryConfig"
64-
65-
66-func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
51+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
6752
6853
6954 func keyFactoryLpList () = "%s__lpTokensList"
7055
7156
72-func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
73-
74-
75-func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
57+func keyFactoryCfg () = "%s__factoryConfig"
7658
7759
7860 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
8163 func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
8264
8365
84-func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP)
85-
86-
87-func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
88-
89-
90-func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
91-
92-
93-func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
94-
95-
96-func keyBoostingLockParamTotalAmount () = "%s%s__stats__activeTotalLocked"
97-
98-
99-func keyBoostingStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks"
100-
101-
102-func keyBoostingStatsLocksCount () = "%s%s__stats__locksCount"
103-
104-
105-func keyBoostingStatsUsersCount () = "%s%s__stats__activeUsersCount"
66+func readFactoryCfgOrFail () = split(getStringByAddressOrFail(readFactoryAddressOrFail(), keyFactoryCfg()), SEP)
10667
10768
10869 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
11172 func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
11273
11374
114-func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
75+func keyPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
11576
11677
117-func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
78+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[1])
11879
11980
120-func keyEmissionStartBlock () = "%s%s__emission__startBlock"
121-
122-
123-func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
124-
125-
126-func keyEmissionEndBlock () = "%s%s__emission__endBlock"
127-
128-
129-func internalCurrentRewardRate (factoryContract,stakingContract,emissionContract,lpAssetId) = {
130- let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId))
131- let poolWeightMult = MULT8
132- let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
133- let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
134- let wxEmissionPerBlockMax = getIntOrFail(emissionContract, keyEmissionRatePerBlockMaxCurrent())
135- let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, poolWeightMult)
136- let poolWxEmissionPerBlockMax = fraction(wxEmissionPerBlockMax, poolWeight, poolWeightMult)
137- let maxFactor = (3 * MULT8)
81+func internalCurrentRewardRate (stakingContract,lpAssetId) = {
82+ let wxEmissionPerBlock = 0
83+ let maxFactor = (1 * MULT8)
13884 let totalLpStaked = getIntOrZero(stakingContract, keyStakedTotal(lpAssetId))
139-[poolWxEmissionPerBlock, maxFactor, totalLpStaked]
85+[wxEmissionPerBlock, maxFactor, totalLpStaked]
14086 }
14187
14288
14995
15096 @Callable(i)
15197 func currentRewardRateREADONLY (lpAssetId) = {
152- let factoryContract = readFactoryAddressOrFail()
153- let factoryCfg = readFactoryCfgOrFail(factoryContract)
154- let stakingContract = getStakingAddressOrFail(factoryCfg)
155- let emissionContract = getEmissionAddressOrFail(factoryCfg)
156- let rewardData = internalCurrentRewardRate(factoryContract, stakingContract, emissionContract, lpAssetId)
98+ let factoryCfgArray = readFactoryCfgOrFail()
99+ let stakingContract = getStakingAddressOrFail(factoryCfgArray)
100+ let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId)
157101 let wxEmissionPerBlock = rewardData[0]
158102 let maxFactor = rewardData[1]
159103 let totalLpStaked = rewardData[2]
164108
165109 @Callable(i)
166110 func currentUserRewardRateREADONLY (lpAssetId,userAddress) = {
167- let factoryContract = readFactoryAddressOrFail()
168- let factoryCfg = readFactoryCfgOrFail(factoryContract)
169- let stakingContract = getStakingAddressOrFail(factoryCfg)
170- let emissionContract = getEmissionAddressOrFail(factoryCfg)
171- let rewardData = internalCurrentRewardRate(factoryContract, stakingContract, emissionContract, lpAssetId)
111+ let factoryCfgArray = readFactoryCfgOrFail()
112+ let stakingContract = getStakingAddressOrFail(factoryCfgArray)
113+ let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId)
172114 let wxEmissionPerBlock = rewardData[0]
173115 let maxFactor = rewardData[1]
174116 let totalLpStaked = rewardData[2]
175117 let lpStakedByUser = getIntOrZero(stakingContract, keyStakedByUser(userAddress, lpAssetId))
176118 let boostingPower = (1 * MULT8)
177- $Tuple2(nil, makeString(["%d%d%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP))
119+ $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP))
178120 }
179121
180122
189131 then -(rand)
190132 else rand
191133 let val = (((absRand % 100) * MULT8) + (absRand * (MULT8 / 100000)))
192- let minRewardClaimed = ((val / 6) * 2)
193- let boostRewardClaimed = ((val / 6) * 3)
194- let gFeeClaimed = (val / 6)
134+ let minRewardClaimed = 0
135+ let boostRewardClaimed = 0
136+ let gFeeClaimed = 0
195137 makeString([(prefix + resultStr), nextLp, toString(minRewardClaimed), toString(boostRewardClaimed), toString(gFeeClaimed), "end"], SEP)
196138 }
197139
199141 let $l = lpList
200142 let $s = size($l)
201143 let $acc0 = "%s"
202- func 1 ($a,$i) = if (($i >= $s))
144+ func $f0_1 ($a,$i) = if (($i >= $s))
203145 then $a
204146 else claimedRewardByLpAggregator($a, $l[$i])
205147
206- func 2 ($a,$i) = if (($i >= $s))
148+ func $f0_2 ($a,$i) = if (($i >= $s))
207149 then $a
208150 else throw("List size exceeds 10")
209151
210- 2(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
152+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
211153 }
212154 $Tuple2(nil, ((result + SEP) + userAddress))
213155 }
220162 then (3 * MULT8)
221163 else (1 * MULT8)
222164 let monthes18 = fraction(toBigInt(deltaLockPeriodInBlocks), MULT18, toBigInt((30 * 1440)))
223- let coeff18 = (pow(monthes18, SCALE18, toBigInt(2), 0, SCALE18, HALFUP) / toBigInt(1000))
165+ let coeff18 = (pow(monthes18, SCALE18, toBigInt(2), 0, SCALE18, HALFUP) / toBigInt(100))
224166 let gWxAmount = fraction(toBigInt(deltaWxAmount), coeff18, MULT18)
225167 $Tuple2(nil, makeString(["%d%d", toString(toInt(gWxAmount)), toString(boost)], SEP))
226168 }
231173 func wxEmissionStatsREADONLY () = {
232174 let ONEMULT = toString(MULT8)
233175 let ONE = "1"
234- let factoryContract = readFactoryAddressOrFail()
235- let factoryCfg = readFactoryCfgOrFail(factoryContract)
236- let boostingContract = getBoostingAddressOrFail(factoryCfg)
237- let emissionContract = getEmissionAddressOrFail(factoryCfg)
238- let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
239- let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
240- let passedBlocks = if ((emissionStartBlock > height))
241- then 0
242- else (height - emissionStartBlock)
243- let totalWxReleased = (wxEmissionPerBlock * passedBlocks)
244- let totalWxLocked = getIntOrZero(boostingContract, keyBoostingLockParamTotalAmount())
245- let locksDurationSumInBlocks = getIntOrZero(boostingContract, keyBoostingStatsLocksDurationSumInBlocks())
246- let locksCount = getIntOrZero(boostingContract, keyBoostingStatsLocksCount())
176+ let totalWxReleased = 0
177+ let totalWxLocked = 0
178+ let locksDurationSumInBlocks = 0
179+ let locksCount = 0
247180 $Tuple2(nil, makeString(["%d%d%d%d", toString(totalWxReleased), toString(totalWxLocked), toString(locksDurationSumInBlocks), toString(locksCount)], SEP))
248181 }
249182
250183
251184
252185 @Callable(i)
253-func lpStatsREADONLY (lpAsset) = {
186+func poolStatsREADONLY (lpAsset) = {
254187 let factoryAddress = readFactoryAddressOrFail()
255188 let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
256- let cfg = if ($isInstanceOf(invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil), "List[Any]"))
257- then invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
258- else throw("Couldn't cast Any to List[Any]")
259- let lpAssetId = fromBase58String(if ($isInstanceOf(cfg[idxPoolLPAssetId], "String"))
260- then cfg[idxPoolLPAssetId]
261- else throw("Couldn't cast Any to String"))
262- let amtAssetId = if ($isInstanceOf(cfg[idxAmtAssetId], "String"))
263- then cfg[idxAmtAssetId]
264- else throw("Couldn't cast Any to String")
265- let priceAssetId = if ($isInstanceOf(cfg[idxPriceAssetId], "String"))
266- then cfg[idxPriceAssetId]
267- else throw("Couldn't cast Any to String")
268- let iAmtAssetId = if ($isInstanceOf(cfg[idxIAmtAssetId], "String"))
269- then cfg[idxIAmtAssetId]
270- else throw("Couldn't cast Any to String")
271- let iPriceAssetId = if ($isInstanceOf(cfg[idxIPriceAssetId], "String"))
272- then cfg[idxIPriceAssetId]
273- else throw("Couldn't cast Any to String")
274- let amtAssetDcm = parseIntValue(if ($isInstanceOf(cfg[idxAmtAssetDcm], "String"))
275- then cfg[idxAmtAssetDcm]
276- else throw("Couldn't cast Any to String"))
277- let priceAssetDcm = parseIntValue(if ($isInstanceOf(cfg[idxPriceAssetDcm], "String"))
278- then cfg[idxPriceAssetDcm]
279- else throw("Couldn't cast Any to String"))
189+ let cfg = {
190+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
191+ if ($isInstanceOf(@, "List[Any]"))
192+ then @
193+ else throw("Couldn't cast Any to List[Any]")
194+ }
195+ let lpAssetId = fromBase58String({
196+ let @ = cfg[idxPoolLPAssetId]
197+ if ($isInstanceOf(@, "String"))
198+ then @
199+ else throw("Couldn't cast Any to String")
200+ })
201+ let amtAssetId = {
202+ let @ = cfg[idxAmtAssetId]
203+ if ($isInstanceOf(@, "String"))
204+ then @
205+ else throw("Couldn't cast Any to String")
206+ }
207+ let priceAssetId = {
208+ let @ = cfg[idxPriceAssetId]
209+ if ($isInstanceOf(@, "String"))
210+ then @
211+ else throw("Couldn't cast Any to String")
212+ }
213+ let iAmtAssetId = {
214+ let @ = cfg[idxIAmtAssetId]
215+ if ($isInstanceOf(@, "String"))
216+ then @
217+ else throw("Couldn't cast Any to String")
218+ }
219+ let iPriceAssetId = {
220+ let @ = cfg[idxIPriceAssetId]
221+ if ($isInstanceOf(@, "String"))
222+ then @
223+ else throw("Couldn't cast Any to String")
224+ }
225+ let amtAssetDcm = parseIntValue({
226+ let @ = cfg[idxAmtAssetDcm]
227+ if ($isInstanceOf(@, "String"))
228+ then @
229+ else throw("Couldn't cast Any to String")
230+ })
231+ let priceAssetDcm = parseIntValue({
232+ let @ = cfg[idxPriceAssetDcm]
233+ if ($isInstanceOf(@, "String"))
234+ then @
235+ else throw("Couldn't cast Any to String")
236+ })
280237 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
281- let accAmtAssetBalance = if ($isInstanceOf(invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil), "Int"))
282- then invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil)
283- else throw("Couldn't cast Any to Int")
284- let accPriceAssetBalance = if ($isInstanceOf(invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil), "Int"))
285- then invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil)
286- else throw("Couldn't cast Any to Int")
287- let pricesList = if ($isInstanceOf(invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil), "List[Any]"))
288- then invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil)
289- else throw("Couldn't cast Any to List[Any]")
238+ let accAmtAssetBalance = {
239+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil)
240+ if ($isInstanceOf(@, "Int"))
241+ then @
242+ else throw("Couldn't cast Any to Int")
243+ }
244+ let accPriceAssetBalance = {
245+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil)
246+ if ($isInstanceOf(@, "Int"))
247+ then @
248+ else throw("Couldn't cast Any to Int")
249+ }
250+ let pricesList = {
251+ let @ = invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil)
252+ if ($isInstanceOf(@, "List[Any]"))
253+ then @
254+ else throw("Couldn't cast Any to List[Any]")
255+ }
290256 let curPrice = 0
291- let lpAmtAssetShare = if ($isInstanceOf(invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil), "Int"))
292- then invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil)
293- else throw("Couldn't cast Any to Int")
294- let lpPriceAssetShare = if ($isInstanceOf(invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil), "Int"))
295- then invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil)
296- else throw("Couldn't cast Any to Int")
297- let poolWeight = getIntegerValue(factoryAddress, keyFactoryPoolWeight(toString(poolAddress)))
257+ let lpAmtAssetShare = {
258+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil)
259+ if ($isInstanceOf(@, "Int"))
260+ then @
261+ else throw("Couldn't cast Any to Int")
262+ }
263+ let lpPriceAssetShare = {
264+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil)
265+ if ($isInstanceOf(@, "Int"))
266+ then @
267+ else throw("Couldn't cast Any to Int")
268+ }
269+ let poolWeight = getIntegerValue(readFactoryAddressOrFail(), keyPoolWeight(toString(poolAddress)))
298270 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP))
299271 }
300272
301273
302274
303275 @Callable(i)
304-func gwxUserInfoREADONLY (userAddress) = {
305- let factoryContract = readFactoryAddressOrFail()
306- let factoryCfg = readFactoryCfgOrFail(factoryContract)
307- let boostingContract = getBoostingAddressOrFail(factoryCfg)
308- let gwxUserInfoLIST = if ($isInstanceOf(invoke(boostingContract, "gwxUserInfoREADONLY", [userAddress], nil), "List[Any]"))
309- then invoke(boostingContract, "gwxUserInfoREADONLY", [userAddress], nil)
310- else throw("Couldn't cast Any to List[Any]")
311- let gwxAmount = if ($isInstanceOf(gwxUserInfoLIST[0], "Int"))
312- then gwxUserInfoLIST[0]
313- else throw("Couldn't cast Any to Int")
314- $Tuple2(nil, makeString(["%d", toString(gwxAmount)], SEP))
276+func poolEvaluatePutByAmountAssetREADONLY (lpAsset,inAmAssetAmt) = {
277+ let factoryAddress = readFactoryAddressOrFail()
278+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
279+ let cfg = {
280+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
281+ if ($isInstanceOf(@, "List[Any]"))
282+ then @
283+ else throw("Couldn't cast Any to List[Any]")
284+ }
285+ let lpAssetId = fromBase58String({
286+ let @ = cfg[idxPoolLPAssetId]
287+ if ($isInstanceOf(@, "String"))
288+ then @
289+ else throw("Couldn't cast Any to String")
290+ })
291+ let amAssetIdStr = {
292+ let @ = cfg[idxAmtAssetId]
293+ if ($isInstanceOf(@, "String"))
294+ then @
295+ else throw("Couldn't cast Any to String")
296+ }
297+ let amAssetId = fromBase58String(amAssetIdStr)
298+ let prAssetIdStr = {
299+ let @ = cfg[idxPriceAssetId]
300+ if ($isInstanceOf(@, "String"))
301+ then @
302+ else throw("Couldn't cast Any to String")
303+ }
304+ let prAssetId = fromBase58String(prAssetIdStr)
305+ let amtAssetDcm = parseIntValue({
306+ let @ = cfg[idxAmtAssetDcm]
307+ if ($isInstanceOf(@, "String"))
308+ then @
309+ else throw("Couldn't cast Any to String")
310+ })
311+ let priceAssetDcm = parseIntValue({
312+ let @ = cfg[idxPriceAssetDcm]
313+ if ($isInstanceOf(@, "String"))
314+ then @
315+ else throw("Couldn't cast Any to String")
316+ })
317+ let poolStatus = {
318+ let @ = cfg[idxPoolStatus]
319+ if ($isInstanceOf(@, "String"))
320+ then @
321+ else throw("Couldn't cast Any to String")
322+ }
323+ let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
324+ let accAmtAssetBalance = {
325+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amAssetIdStr], nil)
326+ if ($isInstanceOf(@, "Int"))
327+ then @
328+ else throw("Couldn't cast Any to Int")
329+ }
330+ let accPriceAssetBalance = {
331+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [prAssetIdStr], nil)
332+ if ($isInstanceOf(@, "Int"))
333+ then @
334+ else throw("Couldn't cast Any to Int")
335+ }
336+ let amtAssetAmtX18 = parseBigIntValue({
337+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [accAmtAssetBalance, amtAssetDcm], nil)
338+ if ($isInstanceOf(@, "String"))
339+ then @
340+ else throw("Couldn't cast Any to String")
341+ })
342+ let priceAssetAmtX18 = parseBigIntValue({
343+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [accPriceAssetBalance, priceAssetDcm], nil)
344+ if ($isInstanceOf(@, "String"))
345+ then @
346+ else throw("Couldn't cast Any to String")
347+ })
348+ let curPriceX18 = if ((poolLPBalance == 0))
349+ then zeroBigInt
350+ else parseBigIntValue({
351+ let @ = invoke(poolAddress, "calcPriceBigIntWrapperREADONLY", [toString(priceAssetAmtX18), toString(amtAssetAmtX18)], nil)
352+ if ($isInstanceOf(@, "String"))
353+ then @
354+ else throw("Couldn't cast Any to String")
355+ })
356+ let curPrice = {
357+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(curPriceX18), MULT8], nil)
358+ if ($isInstanceOf(@, "Int"))
359+ then @
360+ else throw("Couldn't cast Any to Int")
361+ }
362+ let inAmAssetAmtX18 = parseBigIntValue({
363+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [inAmAssetAmt, amtAssetDcm], nil)
364+ if ($isInstanceOf(@, "String"))
365+ then @
366+ else throw("Couldn't cast Any to String")
367+ })
368+ let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, MULT18)
369+ let inPrAssetAmt = {
370+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(inPrAssetAmtX18), priceAssetDcm], nil)
371+ if ($isInstanceOf(@, "Int"))
372+ then @
373+ else throw("Couldn't cast Any to Int")
374+ }
375+ let res = invoke(poolAddress, "estimatePutOperationWrapperREADONLY", ["", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false], nil)
376+ let $t01090111254 = match res {
377+ case _ =>
378+ if (if ($isInstanceOf($match0._1, "Int"))
379+ then if ($isInstanceOf($match0._3, "Int"))
380+ then if ($isInstanceOf($match0._4, "Int"))
381+ then if ($isInstanceOf($match0._5, "Int"))
382+ then $isInstanceOf($match0._6, "Int")
383+ else false
384+ else false
385+ else false
386+ else false)
387+ then {
388+ let calcLpAmt = $match0._1
389+ let curPriceCalc = $match0._3
390+ let amBalance = $match0._4
391+ let prBalance = $match0._5
392+ let lpEmission = $match0._6
393+ $Tuple5(calcLpAmt, curPriceCalc, amBalance, prBalance, lpEmission)
394+ }
395+ else throw("Couldn't cast types")
396+ }
397+ let calcLpAmt = $t01090111254._1
398+ let curPriceCalc = $t01090111254._2
399+ let amBalance = $t01090111254._3
400+ let prBalance = $t01090111254._4
401+ let lpEmission = $t01090111254._5
402+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(curPrice), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
403+ }
404+
405+
406+
407+@Callable(i)
408+func poolEvaluatePutByPriceAssetREADONLY (lpAsset,inPrAssetAmt) = {
409+ let factoryAddress = readFactoryAddressOrFail()
410+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
411+ let cfg = {
412+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
413+ if ($isInstanceOf(@, "List[Any]"))
414+ then @
415+ else throw("Couldn't cast Any to List[Any]")
416+ }
417+ let lpAssetId = fromBase58String({
418+ let @ = cfg[idxPoolLPAssetId]
419+ if ($isInstanceOf(@, "String"))
420+ then @
421+ else throw("Couldn't cast Any to String")
422+ })
423+ let amAssetIdStr = {
424+ let @ = cfg[idxAmtAssetId]
425+ if ($isInstanceOf(@, "String"))
426+ then @
427+ else throw("Couldn't cast Any to String")
428+ }
429+ let amAssetId = fromBase58String(amAssetIdStr)
430+ let prAssetIdStr = {
431+ let @ = cfg[idxPriceAssetId]
432+ if ($isInstanceOf(@, "String"))
433+ then @
434+ else throw("Couldn't cast Any to String")
435+ }
436+ let prAssetId = fromBase58String(prAssetIdStr)
437+ let amtAssetDcm = parseIntValue({
438+ let @ = cfg[idxAmtAssetDcm]
439+ if ($isInstanceOf(@, "String"))
440+ then @
441+ else throw("Couldn't cast Any to String")
442+ })
443+ let priceAssetDcm = parseIntValue({
444+ let @ = cfg[idxPriceAssetDcm]
445+ if ($isInstanceOf(@, "String"))
446+ then @
447+ else throw("Couldn't cast Any to String")
448+ })
449+ let poolStatus = {
450+ let @ = cfg[idxPoolStatus]
451+ if ($isInstanceOf(@, "String"))
452+ then @
453+ else throw("Couldn't cast Any to String")
454+ }
455+ let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
456+ let amBalanceRaw = {
457+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amAssetIdStr], nil)
458+ if ($isInstanceOf(@, "Int"))
459+ then @
460+ else throw("Couldn't cast Any to Int")
461+ }
462+ let prBalanceRaw = {
463+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [prAssetIdStr], nil)
464+ if ($isInstanceOf(@, "Int"))
465+ then @
466+ else throw("Couldn't cast Any to Int")
467+ }
468+ let amBalanceRawX18 = parseBigIntValue({
469+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [amBalanceRaw, amtAssetDcm], nil)
470+ if ($isInstanceOf(@, "String"))
471+ then @
472+ else throw("Couldn't cast Any to String")
473+ })
474+ let prBalanceRawX18 = parseBigIntValue({
475+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [prBalanceRaw, priceAssetDcm], nil)
476+ if ($isInstanceOf(@, "String"))
477+ then @
478+ else throw("Couldn't cast Any to String")
479+ })
480+ let curPriceX18 = if ((poolLPBalance == 0))
481+ then zeroBigInt
482+ else parseBigIntValue({
483+ let @ = invoke(poolAddress, "calcPriceBigIntWrapperREADONLY", [toString(prBalanceRawX18), toString(amBalanceRawX18)], nil)
484+ if ($isInstanceOf(@, "String"))
485+ then @
486+ else throw("Couldn't cast Any to String")
487+ })
488+ let curPrice = {
489+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(curPriceX18), MULT8], nil)
490+ if ($isInstanceOf(@, "Int"))
491+ then @
492+ else throw("Couldn't cast Any to Int")
493+ }
494+ let inPrAssetAmtX18 = parseBigIntValue({
495+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [inPrAssetAmt, priceAssetDcm], nil)
496+ if ($isInstanceOf(@, "String"))
497+ then @
498+ else throw("Couldn't cast Any to String")
499+ })
500+ let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, MULT18, curPriceX18)
501+ let inAmAssetAmt = {
502+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(inAmAssetAmtX18), amtAssetDcm], nil)
503+ if ($isInstanceOf(@, "Int"))
504+ then @
505+ else throw("Couldn't cast Any to Int")
506+ }
507+ let res = invoke(poolAddress, "estimatePutOperationWrapperREADONLY", ["", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false], nil)
508+ let $t01395714310 = match res {
509+ case _ =>
510+ if (if ($isInstanceOf($match0._1, "Int"))
511+ then if ($isInstanceOf($match0._3, "Int"))
512+ then if ($isInstanceOf($match0._4, "Int"))
513+ then if ($isInstanceOf($match0._5, "Int"))
514+ then $isInstanceOf($match0._6, "Int")
515+ else false
516+ else false
517+ else false
518+ else false)
519+ then {
520+ let calcLpAmt = $match0._1
521+ let curPriceCalc = $match0._3
522+ let amBalance = $match0._4
523+ let prBalance = $match0._5
524+ let lpEmission = $match0._6
525+ $Tuple5(calcLpAmt, curPriceCalc, amBalance, prBalance, lpEmission)
526+ }
527+ else throw("Couldn't cast types")
528+ }
529+ let calcLpAmt = $t01395714310._1
530+ let curPriceCalc = $t01395714310._2
531+ let amBalance = $t01395714310._3
532+ let prBalance = $t01395714310._4
533+ let lpEmission = $t01395714310._5
534+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(curPrice), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
535+ }
536+
537+
538+
539+@Callable(i)
540+func poolEvaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
541+ let factoryAddress = readFactoryAddressOrFail()
542+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(paymentLpAssetId)))
543+ let res = invoke(poolAddress, "estimateGetOperationWrapperREADONLY", ["", paymentLpAssetId, paymentLpAmt, toString(poolAddress)], nil)
544+ let $t01505815475 = match res {
545+ case _ =>
546+ if (if ($isInstanceOf($match0._1, "Int"))
547+ then if ($isInstanceOf($match0._2, "Int"))
548+ then if ($isInstanceOf($match0._5, "Int"))
549+ then if ($isInstanceOf($match0._6, "Int"))
550+ then if ($isInstanceOf($match0._7, "Int"))
551+ then if ($isInstanceOf($match0._8, "String"))
552+ then $isInstanceOf($match0._9, "String")
553+ else false
554+ else false
555+ else false
556+ else false
557+ else false
558+ else false)
559+ then {
560+ let outAmAmt = $match0._1
561+ let outPrAmt = $match0._2
562+ let amBalance = $match0._5
563+ let prBalance = $match0._6
564+ let lpEmission = $match0._7
565+ let curPrice = $match0._8
566+ let poolStatus = $match0._9
567+ $Tuple7(outAmAmt, outPrAmt, amBalance, prBalance, lpEmission, curPrice, poolStatus)
568+ }
569+ else throw("Couldn't cast types")
570+ }
571+ let outAmAmt = $t01505815475._1
572+ let outPrAmt = $t01505815475._2
573+ let amBalance = $t01505815475._3
574+ let prBalance = $t01505815475._4
575+ let lpEmission = $t01505815475._5
576+ let curPrice = $t01505815475._6
577+ let poolStatus = $t01505815475._7
578+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), curPrice, poolStatus], SEP))
315579 }
316580
317581
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SCALE8 = 8
55
66 let MULT8 = 100000000
77
88 let SCALE18 = 18
99
1010 let MULT18 = toBigInt(1000000000000000000)
1111
1212 let SEP = "__"
13+
14+let zeroBigInt = toBigInt(0)
1315
1416 let idxPoolAddress = 1
1517
1618 let idxPoolStatus = 2
1719
1820 let idxPoolLPAssetId = 3
1921
2022 let idxAmtAssetId = 4
2123
2224 let idxPriceAssetId = 5
2325
2426 let idxAmtAssetDcm = 6
2527
2628 let idxPriceAssetDcm = 7
2729
2830 let idxIAmtAssetId = 8
2931
3032 let idxIPriceAssetId = 9
3133
3234 let idxLPAssetDcm = 10
3335
3436 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
3537
3638
3739 func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
3840
3941
4042 func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0)
4143
4244
4345 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined"))
4446
4547
4648 func keyFactoryAddress () = "%s%s__config__factoryAddress"
4749
4850
49-let IdxFactoryCfgStakingDapp = 1
50-
51-let IdxFactoryCfgBoostingDapp = 2
52-
53-let IdxFactoryCfgIdoDapp = 3
54-
55-let IdxFactoryCfgTeamDapp = 4
56-
57-let IdxFactoryCfgEmissionDapp = 5
58-
59-let IdxFactoryCfgRestDapp = 6
60-
61-let IdxFactoryCfgSlippageDapp = 7
62-
63-func keyFactoryCfg () = "%s__factoryConfig"
64-
65-
66-func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
51+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
6752
6853
6954 func keyFactoryLpList () = "%s__lpTokensList"
7055
7156
72-func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
73-
74-
75-func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
57+func keyFactoryCfg () = "%s__factoryConfig"
7658
7759
7860 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
7961
8062
8163 func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
8264
8365
84-func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP)
85-
86-
87-func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
88-
89-
90-func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
91-
92-
93-func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
94-
95-
96-func keyBoostingLockParamTotalAmount () = "%s%s__stats__activeTotalLocked"
97-
98-
99-func keyBoostingStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks"
100-
101-
102-func keyBoostingStatsLocksCount () = "%s%s__stats__locksCount"
103-
104-
105-func keyBoostingStatsUsersCount () = "%s%s__stats__activeUsersCount"
66+func readFactoryCfgOrFail () = split(getStringByAddressOrFail(readFactoryAddressOrFail(), keyFactoryCfg()), SEP)
10667
10768
10869 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
10970
11071
11172 func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
11273
11374
114-func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
75+func keyPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
11576
11677
117-func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
78+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[1])
11879
11980
120-func keyEmissionStartBlock () = "%s%s__emission__startBlock"
121-
122-
123-func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
124-
125-
126-func keyEmissionEndBlock () = "%s%s__emission__endBlock"
127-
128-
129-func internalCurrentRewardRate (factoryContract,stakingContract,emissionContract,lpAssetId) = {
130- let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId))
131- let poolWeightMult = MULT8
132- let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
133- let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
134- let wxEmissionPerBlockMax = getIntOrFail(emissionContract, keyEmissionRatePerBlockMaxCurrent())
135- let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, poolWeightMult)
136- let poolWxEmissionPerBlockMax = fraction(wxEmissionPerBlockMax, poolWeight, poolWeightMult)
137- let maxFactor = (3 * MULT8)
81+func internalCurrentRewardRate (stakingContract,lpAssetId) = {
82+ let wxEmissionPerBlock = 0
83+ let maxFactor = (1 * MULT8)
13884 let totalLpStaked = getIntOrZero(stakingContract, keyStakedTotal(lpAssetId))
139-[poolWxEmissionPerBlock, maxFactor, totalLpStaked]
85+[wxEmissionPerBlock, maxFactor, totalLpStaked]
14086 }
14187
14288
14389 @Callable(i)
14490 func constructor (factoryAddress) = if ((i.caller != this))
14591 then throw("not authorized")
14692 else [StringEntry(keyFactoryAddress(), factoryAddress)]
14793
14894
14995
15096 @Callable(i)
15197 func currentRewardRateREADONLY (lpAssetId) = {
152- let factoryContract = readFactoryAddressOrFail()
153- let factoryCfg = readFactoryCfgOrFail(factoryContract)
154- let stakingContract = getStakingAddressOrFail(factoryCfg)
155- let emissionContract = getEmissionAddressOrFail(factoryCfg)
156- let rewardData = internalCurrentRewardRate(factoryContract, stakingContract, emissionContract, lpAssetId)
98+ let factoryCfgArray = readFactoryCfgOrFail()
99+ let stakingContract = getStakingAddressOrFail(factoryCfgArray)
100+ let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId)
157101 let wxEmissionPerBlock = rewardData[0]
158102 let maxFactor = rewardData[1]
159103 let totalLpStaked = rewardData[2]
160104 $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked)], SEP))
161105 }
162106
163107
164108
165109 @Callable(i)
166110 func currentUserRewardRateREADONLY (lpAssetId,userAddress) = {
167- let factoryContract = readFactoryAddressOrFail()
168- let factoryCfg = readFactoryCfgOrFail(factoryContract)
169- let stakingContract = getStakingAddressOrFail(factoryCfg)
170- let emissionContract = getEmissionAddressOrFail(factoryCfg)
171- let rewardData = internalCurrentRewardRate(factoryContract, stakingContract, emissionContract, lpAssetId)
111+ let factoryCfgArray = readFactoryCfgOrFail()
112+ let stakingContract = getStakingAddressOrFail(factoryCfgArray)
113+ let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId)
172114 let wxEmissionPerBlock = rewardData[0]
173115 let maxFactor = rewardData[1]
174116 let totalLpStaked = rewardData[2]
175117 let lpStakedByUser = getIntOrZero(stakingContract, keyStakedByUser(userAddress, lpAssetId))
176118 let boostingPower = (1 * MULT8)
177- $Tuple2(nil, makeString(["%d%d%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP))
119+ $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP))
178120 }
179121
180122
181123
182124 @Callable(i)
183125 func claimedRewardREADONLY (userAddress) = {
184126 let lpList = readLpList()
185127 let prefix = "%s%d%d%d%s"
186128 func claimedRewardByLpAggregator (resultStr,nextLp) = {
187129 let rand = ((toInt(fromBase58String(nextLp)) % 100000) + (toInt(toBytes(userAddress)) % 100000))
188130 let absRand = if ((0 > rand))
189131 then -(rand)
190132 else rand
191133 let val = (((absRand % 100) * MULT8) + (absRand * (MULT8 / 100000)))
192- let minRewardClaimed = ((val / 6) * 2)
193- let boostRewardClaimed = ((val / 6) * 3)
194- let gFeeClaimed = (val / 6)
134+ let minRewardClaimed = 0
135+ let boostRewardClaimed = 0
136+ let gFeeClaimed = 0
195137 makeString([(prefix + resultStr), nextLp, toString(minRewardClaimed), toString(boostRewardClaimed), toString(gFeeClaimed), "end"], SEP)
196138 }
197139
198140 let result = {
199141 let $l = lpList
200142 let $s = size($l)
201143 let $acc0 = "%s"
202- func 1 ($a,$i) = if (($i >= $s))
144+ func $f0_1 ($a,$i) = if (($i >= $s))
203145 then $a
204146 else claimedRewardByLpAggregator($a, $l[$i])
205147
206- func 2 ($a,$i) = if (($i >= $s))
148+ func $f0_2 ($a,$i) = if (($i >= $s))
207149 then $a
208150 else throw("List size exceeds 10")
209151
210- 2(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
152+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
211153 }
212154 $Tuple2(nil, ((result + SEP) + userAddress))
213155 }
214156
215157
216158
217159 @Callable(i)
218160 func calcBoostREADONLY (deltaWxAmount,deltaLockPeriodInBlocks,deltaLpAmount,lpAssetIdOpt,userAddressOpt) = {
219161 let boost = if ((userAddressOpt != ""))
220162 then (3 * MULT8)
221163 else (1 * MULT8)
222164 let monthes18 = fraction(toBigInt(deltaLockPeriodInBlocks), MULT18, toBigInt((30 * 1440)))
223- let coeff18 = (pow(monthes18, SCALE18, toBigInt(2), 0, SCALE18, HALFUP) / toBigInt(1000))
165+ let coeff18 = (pow(monthes18, SCALE18, toBigInt(2), 0, SCALE18, HALFUP) / toBigInt(100))
224166 let gWxAmount = fraction(toBigInt(deltaWxAmount), coeff18, MULT18)
225167 $Tuple2(nil, makeString(["%d%d", toString(toInt(gWxAmount)), toString(boost)], SEP))
226168 }
227169
228170
229171
230172 @Callable(i)
231173 func wxEmissionStatsREADONLY () = {
232174 let ONEMULT = toString(MULT8)
233175 let ONE = "1"
234- let factoryContract = readFactoryAddressOrFail()
235- let factoryCfg = readFactoryCfgOrFail(factoryContract)
236- let boostingContract = getBoostingAddressOrFail(factoryCfg)
237- let emissionContract = getEmissionAddressOrFail(factoryCfg)
238- let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
239- let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
240- let passedBlocks = if ((emissionStartBlock > height))
241- then 0
242- else (height - emissionStartBlock)
243- let totalWxReleased = (wxEmissionPerBlock * passedBlocks)
244- let totalWxLocked = getIntOrZero(boostingContract, keyBoostingLockParamTotalAmount())
245- let locksDurationSumInBlocks = getIntOrZero(boostingContract, keyBoostingStatsLocksDurationSumInBlocks())
246- let locksCount = getIntOrZero(boostingContract, keyBoostingStatsLocksCount())
176+ let totalWxReleased = 0
177+ let totalWxLocked = 0
178+ let locksDurationSumInBlocks = 0
179+ let locksCount = 0
247180 $Tuple2(nil, makeString(["%d%d%d%d", toString(totalWxReleased), toString(totalWxLocked), toString(locksDurationSumInBlocks), toString(locksCount)], SEP))
248181 }
249182
250183
251184
252185 @Callable(i)
253-func lpStatsREADONLY (lpAsset) = {
186+func poolStatsREADONLY (lpAsset) = {
254187 let factoryAddress = readFactoryAddressOrFail()
255188 let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
256- let cfg = if ($isInstanceOf(invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil), "List[Any]"))
257- then invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
258- else throw("Couldn't cast Any to List[Any]")
259- let lpAssetId = fromBase58String(if ($isInstanceOf(cfg[idxPoolLPAssetId], "String"))
260- then cfg[idxPoolLPAssetId]
261- else throw("Couldn't cast Any to String"))
262- let amtAssetId = if ($isInstanceOf(cfg[idxAmtAssetId], "String"))
263- then cfg[idxAmtAssetId]
264- else throw("Couldn't cast Any to String")
265- let priceAssetId = if ($isInstanceOf(cfg[idxPriceAssetId], "String"))
266- then cfg[idxPriceAssetId]
267- else throw("Couldn't cast Any to String")
268- let iAmtAssetId = if ($isInstanceOf(cfg[idxIAmtAssetId], "String"))
269- then cfg[idxIAmtAssetId]
270- else throw("Couldn't cast Any to String")
271- let iPriceAssetId = if ($isInstanceOf(cfg[idxIPriceAssetId], "String"))
272- then cfg[idxIPriceAssetId]
273- else throw("Couldn't cast Any to String")
274- let amtAssetDcm = parseIntValue(if ($isInstanceOf(cfg[idxAmtAssetDcm], "String"))
275- then cfg[idxAmtAssetDcm]
276- else throw("Couldn't cast Any to String"))
277- let priceAssetDcm = parseIntValue(if ($isInstanceOf(cfg[idxPriceAssetDcm], "String"))
278- then cfg[idxPriceAssetDcm]
279- else throw("Couldn't cast Any to String"))
189+ let cfg = {
190+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
191+ if ($isInstanceOf(@, "List[Any]"))
192+ then @
193+ else throw("Couldn't cast Any to List[Any]")
194+ }
195+ let lpAssetId = fromBase58String({
196+ let @ = cfg[idxPoolLPAssetId]
197+ if ($isInstanceOf(@, "String"))
198+ then @
199+ else throw("Couldn't cast Any to String")
200+ })
201+ let amtAssetId = {
202+ let @ = cfg[idxAmtAssetId]
203+ if ($isInstanceOf(@, "String"))
204+ then @
205+ else throw("Couldn't cast Any to String")
206+ }
207+ let priceAssetId = {
208+ let @ = cfg[idxPriceAssetId]
209+ if ($isInstanceOf(@, "String"))
210+ then @
211+ else throw("Couldn't cast Any to String")
212+ }
213+ let iAmtAssetId = {
214+ let @ = cfg[idxIAmtAssetId]
215+ if ($isInstanceOf(@, "String"))
216+ then @
217+ else throw("Couldn't cast Any to String")
218+ }
219+ let iPriceAssetId = {
220+ let @ = cfg[idxIPriceAssetId]
221+ if ($isInstanceOf(@, "String"))
222+ then @
223+ else throw("Couldn't cast Any to String")
224+ }
225+ let amtAssetDcm = parseIntValue({
226+ let @ = cfg[idxAmtAssetDcm]
227+ if ($isInstanceOf(@, "String"))
228+ then @
229+ else throw("Couldn't cast Any to String")
230+ })
231+ let priceAssetDcm = parseIntValue({
232+ let @ = cfg[idxPriceAssetDcm]
233+ if ($isInstanceOf(@, "String"))
234+ then @
235+ else throw("Couldn't cast Any to String")
236+ })
280237 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
281- let accAmtAssetBalance = if ($isInstanceOf(invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil), "Int"))
282- then invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil)
283- else throw("Couldn't cast Any to Int")
284- let accPriceAssetBalance = if ($isInstanceOf(invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil), "Int"))
285- then invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil)
286- else throw("Couldn't cast Any to Int")
287- let pricesList = if ($isInstanceOf(invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil), "List[Any]"))
288- then invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil)
289- else throw("Couldn't cast Any to List[Any]")
238+ let accAmtAssetBalance = {
239+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amtAssetId], nil)
240+ if ($isInstanceOf(@, "Int"))
241+ then @
242+ else throw("Couldn't cast Any to Int")
243+ }
244+ let accPriceAssetBalance = {
245+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [priceAssetId], nil)
246+ if ($isInstanceOf(@, "Int"))
247+ then @
248+ else throw("Couldn't cast Any to Int")
249+ }
250+ let pricesList = {
251+ let @ = invoke(poolAddress, "calcPricesWrapperREADONLY", [accAmtAssetBalance, accPriceAssetBalance, poolLPBalance], nil)
252+ if ($isInstanceOf(@, "List[Any]"))
253+ then @
254+ else throw("Couldn't cast Any to List[Any]")
255+ }
290256 let curPrice = 0
291- let lpAmtAssetShare = if ($isInstanceOf(invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil), "Int"))
292- then invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil)
293- else throw("Couldn't cast Any to Int")
294- let lpPriceAssetShare = if ($isInstanceOf(invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil), "Int"))
295- then invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil)
296- else throw("Couldn't cast Any to Int")
297- let poolWeight = getIntegerValue(factoryAddress, keyFactoryPoolWeight(toString(poolAddress)))
257+ let lpAmtAssetShare = {
258+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[1], MULT8], nil)
259+ if ($isInstanceOf(@, "Int"))
260+ then @
261+ else throw("Couldn't cast Any to Int")
262+ }
263+ let lpPriceAssetShare = {
264+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [pricesList[2], MULT8], nil)
265+ if ($isInstanceOf(@, "Int"))
266+ then @
267+ else throw("Couldn't cast Any to Int")
268+ }
269+ let poolWeight = getIntegerValue(readFactoryAddressOrFail(), keyPoolWeight(toString(poolAddress)))
298270 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP))
299271 }
300272
301273
302274
303275 @Callable(i)
304-func gwxUserInfoREADONLY (userAddress) = {
305- let factoryContract = readFactoryAddressOrFail()
306- let factoryCfg = readFactoryCfgOrFail(factoryContract)
307- let boostingContract = getBoostingAddressOrFail(factoryCfg)
308- let gwxUserInfoLIST = if ($isInstanceOf(invoke(boostingContract, "gwxUserInfoREADONLY", [userAddress], nil), "List[Any]"))
309- then invoke(boostingContract, "gwxUserInfoREADONLY", [userAddress], nil)
310- else throw("Couldn't cast Any to List[Any]")
311- let gwxAmount = if ($isInstanceOf(gwxUserInfoLIST[0], "Int"))
312- then gwxUserInfoLIST[0]
313- else throw("Couldn't cast Any to Int")
314- $Tuple2(nil, makeString(["%d", toString(gwxAmount)], SEP))
276+func poolEvaluatePutByAmountAssetREADONLY (lpAsset,inAmAssetAmt) = {
277+ let factoryAddress = readFactoryAddressOrFail()
278+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
279+ let cfg = {
280+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
281+ if ($isInstanceOf(@, "List[Any]"))
282+ then @
283+ else throw("Couldn't cast Any to List[Any]")
284+ }
285+ let lpAssetId = fromBase58String({
286+ let @ = cfg[idxPoolLPAssetId]
287+ if ($isInstanceOf(@, "String"))
288+ then @
289+ else throw("Couldn't cast Any to String")
290+ })
291+ let amAssetIdStr = {
292+ let @ = cfg[idxAmtAssetId]
293+ if ($isInstanceOf(@, "String"))
294+ then @
295+ else throw("Couldn't cast Any to String")
296+ }
297+ let amAssetId = fromBase58String(amAssetIdStr)
298+ let prAssetIdStr = {
299+ let @ = cfg[idxPriceAssetId]
300+ if ($isInstanceOf(@, "String"))
301+ then @
302+ else throw("Couldn't cast Any to String")
303+ }
304+ let prAssetId = fromBase58String(prAssetIdStr)
305+ let amtAssetDcm = parseIntValue({
306+ let @ = cfg[idxAmtAssetDcm]
307+ if ($isInstanceOf(@, "String"))
308+ then @
309+ else throw("Couldn't cast Any to String")
310+ })
311+ let priceAssetDcm = parseIntValue({
312+ let @ = cfg[idxPriceAssetDcm]
313+ if ($isInstanceOf(@, "String"))
314+ then @
315+ else throw("Couldn't cast Any to String")
316+ })
317+ let poolStatus = {
318+ let @ = cfg[idxPoolStatus]
319+ if ($isInstanceOf(@, "String"))
320+ then @
321+ else throw("Couldn't cast Any to String")
322+ }
323+ let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
324+ let accAmtAssetBalance = {
325+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amAssetIdStr], nil)
326+ if ($isInstanceOf(@, "Int"))
327+ then @
328+ else throw("Couldn't cast Any to Int")
329+ }
330+ let accPriceAssetBalance = {
331+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [prAssetIdStr], nil)
332+ if ($isInstanceOf(@, "Int"))
333+ then @
334+ else throw("Couldn't cast Any to Int")
335+ }
336+ let amtAssetAmtX18 = parseBigIntValue({
337+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [accAmtAssetBalance, amtAssetDcm], nil)
338+ if ($isInstanceOf(@, "String"))
339+ then @
340+ else throw("Couldn't cast Any to String")
341+ })
342+ let priceAssetAmtX18 = parseBigIntValue({
343+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [accPriceAssetBalance, priceAssetDcm], nil)
344+ if ($isInstanceOf(@, "String"))
345+ then @
346+ else throw("Couldn't cast Any to String")
347+ })
348+ let curPriceX18 = if ((poolLPBalance == 0))
349+ then zeroBigInt
350+ else parseBigIntValue({
351+ let @ = invoke(poolAddress, "calcPriceBigIntWrapperREADONLY", [toString(priceAssetAmtX18), toString(amtAssetAmtX18)], nil)
352+ if ($isInstanceOf(@, "String"))
353+ then @
354+ else throw("Couldn't cast Any to String")
355+ })
356+ let curPrice = {
357+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(curPriceX18), MULT8], nil)
358+ if ($isInstanceOf(@, "Int"))
359+ then @
360+ else throw("Couldn't cast Any to Int")
361+ }
362+ let inAmAssetAmtX18 = parseBigIntValue({
363+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [inAmAssetAmt, amtAssetDcm], nil)
364+ if ($isInstanceOf(@, "String"))
365+ then @
366+ else throw("Couldn't cast Any to String")
367+ })
368+ let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, MULT18)
369+ let inPrAssetAmt = {
370+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(inPrAssetAmtX18), priceAssetDcm], nil)
371+ if ($isInstanceOf(@, "Int"))
372+ then @
373+ else throw("Couldn't cast Any to Int")
374+ }
375+ let res = invoke(poolAddress, "estimatePutOperationWrapperREADONLY", ["", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false], nil)
376+ let $t01090111254 = match res {
377+ case _ =>
378+ if (if ($isInstanceOf($match0._1, "Int"))
379+ then if ($isInstanceOf($match0._3, "Int"))
380+ then if ($isInstanceOf($match0._4, "Int"))
381+ then if ($isInstanceOf($match0._5, "Int"))
382+ then $isInstanceOf($match0._6, "Int")
383+ else false
384+ else false
385+ else false
386+ else false)
387+ then {
388+ let calcLpAmt = $match0._1
389+ let curPriceCalc = $match0._3
390+ let amBalance = $match0._4
391+ let prBalance = $match0._5
392+ let lpEmission = $match0._6
393+ $Tuple5(calcLpAmt, curPriceCalc, amBalance, prBalance, lpEmission)
394+ }
395+ else throw("Couldn't cast types")
396+ }
397+ let calcLpAmt = $t01090111254._1
398+ let curPriceCalc = $t01090111254._2
399+ let amBalance = $t01090111254._3
400+ let prBalance = $t01090111254._4
401+ let lpEmission = $t01090111254._5
402+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(curPrice), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
403+ }
404+
405+
406+
407+@Callable(i)
408+func poolEvaluatePutByPriceAssetREADONLY (lpAsset,inPrAssetAmt) = {
409+ let factoryAddress = readFactoryAddressOrFail()
410+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(lpAsset)))
411+ let cfg = {
412+ let @ = invoke(poolAddress, "getPoolConfigWrapperREADONLY", nil, nil)
413+ if ($isInstanceOf(@, "List[Any]"))
414+ then @
415+ else throw("Couldn't cast Any to List[Any]")
416+ }
417+ let lpAssetId = fromBase58String({
418+ let @ = cfg[idxPoolLPAssetId]
419+ if ($isInstanceOf(@, "String"))
420+ then @
421+ else throw("Couldn't cast Any to String")
422+ })
423+ let amAssetIdStr = {
424+ let @ = cfg[idxAmtAssetId]
425+ if ($isInstanceOf(@, "String"))
426+ then @
427+ else throw("Couldn't cast Any to String")
428+ }
429+ let amAssetId = fromBase58String(amAssetIdStr)
430+ let prAssetIdStr = {
431+ let @ = cfg[idxPriceAssetId]
432+ if ($isInstanceOf(@, "String"))
433+ then @
434+ else throw("Couldn't cast Any to String")
435+ }
436+ let prAssetId = fromBase58String(prAssetIdStr)
437+ let amtAssetDcm = parseIntValue({
438+ let @ = cfg[idxAmtAssetDcm]
439+ if ($isInstanceOf(@, "String"))
440+ then @
441+ else throw("Couldn't cast Any to String")
442+ })
443+ let priceAssetDcm = parseIntValue({
444+ let @ = cfg[idxPriceAssetDcm]
445+ if ($isInstanceOf(@, "String"))
446+ then @
447+ else throw("Couldn't cast Any to String")
448+ })
449+ let poolStatus = {
450+ let @ = cfg[idxPoolStatus]
451+ if ($isInstanceOf(@, "String"))
452+ then @
453+ else throw("Couldn't cast Any to String")
454+ }
455+ let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
456+ let amBalanceRaw = {
457+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [amAssetIdStr], nil)
458+ if ($isInstanceOf(@, "Int"))
459+ then @
460+ else throw("Couldn't cast Any to Int")
461+ }
462+ let prBalanceRaw = {
463+ let @ = invoke(poolAddress, "getAccBalanceWrapperREADONLY", [prAssetIdStr], nil)
464+ if ($isInstanceOf(@, "Int"))
465+ then @
466+ else throw("Couldn't cast Any to Int")
467+ }
468+ let amBalanceRawX18 = parseBigIntValue({
469+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [amBalanceRaw, amtAssetDcm], nil)
470+ if ($isInstanceOf(@, "String"))
471+ then @
472+ else throw("Couldn't cast Any to String")
473+ })
474+ let prBalanceRawX18 = parseBigIntValue({
475+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [prBalanceRaw, priceAssetDcm], nil)
476+ if ($isInstanceOf(@, "String"))
477+ then @
478+ else throw("Couldn't cast Any to String")
479+ })
480+ let curPriceX18 = if ((poolLPBalance == 0))
481+ then zeroBigInt
482+ else parseBigIntValue({
483+ let @ = invoke(poolAddress, "calcPriceBigIntWrapperREADONLY", [toString(prBalanceRawX18), toString(amBalanceRawX18)], nil)
484+ if ($isInstanceOf(@, "String"))
485+ then @
486+ else throw("Couldn't cast Any to String")
487+ })
488+ let curPrice = {
489+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(curPriceX18), MULT8], nil)
490+ if ($isInstanceOf(@, "Int"))
491+ then @
492+ else throw("Couldn't cast Any to Int")
493+ }
494+ let inPrAssetAmtX18 = parseBigIntValue({
495+ let @ = invoke(poolAddress, "toX18WrapperREADONLY", [inPrAssetAmt, priceAssetDcm], nil)
496+ if ($isInstanceOf(@, "String"))
497+ then @
498+ else throw("Couldn't cast Any to String")
499+ })
500+ let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, MULT18, curPriceX18)
501+ let inAmAssetAmt = {
502+ let @ = invoke(poolAddress, "fromX18WrapperREADONLY", [toString(inAmAssetAmtX18), amtAssetDcm], nil)
503+ if ($isInstanceOf(@, "Int"))
504+ then @
505+ else throw("Couldn't cast Any to Int")
506+ }
507+ let res = invoke(poolAddress, "estimatePutOperationWrapperREADONLY", ["", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false], nil)
508+ let $t01395714310 = match res {
509+ case _ =>
510+ if (if ($isInstanceOf($match0._1, "Int"))
511+ then if ($isInstanceOf($match0._3, "Int"))
512+ then if ($isInstanceOf($match0._4, "Int"))
513+ then if ($isInstanceOf($match0._5, "Int"))
514+ then $isInstanceOf($match0._6, "Int")
515+ else false
516+ else false
517+ else false
518+ else false)
519+ then {
520+ let calcLpAmt = $match0._1
521+ let curPriceCalc = $match0._3
522+ let amBalance = $match0._4
523+ let prBalance = $match0._5
524+ let lpEmission = $match0._6
525+ $Tuple5(calcLpAmt, curPriceCalc, amBalance, prBalance, lpEmission)
526+ }
527+ else throw("Couldn't cast types")
528+ }
529+ let calcLpAmt = $t01395714310._1
530+ let curPriceCalc = $t01395714310._2
531+ let amBalance = $t01395714310._3
532+ let prBalance = $t01395714310._4
533+ let lpEmission = $t01395714310._5
534+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(curPrice), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
535+ }
536+
537+
538+
539+@Callable(i)
540+func poolEvaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
541+ let factoryAddress = readFactoryAddressOrFail()
542+ let poolAddress = addressFromStringValue(getStringByAddressOrFail(factoryAddress, keyFactoryLpAssetToPoolContractAddress(paymentLpAssetId)))
543+ let res = invoke(poolAddress, "estimateGetOperationWrapperREADONLY", ["", paymentLpAssetId, paymentLpAmt, toString(poolAddress)], nil)
544+ let $t01505815475 = match res {
545+ case _ =>
546+ if (if ($isInstanceOf($match0._1, "Int"))
547+ then if ($isInstanceOf($match0._2, "Int"))
548+ then if ($isInstanceOf($match0._5, "Int"))
549+ then if ($isInstanceOf($match0._6, "Int"))
550+ then if ($isInstanceOf($match0._7, "Int"))
551+ then if ($isInstanceOf($match0._8, "String"))
552+ then $isInstanceOf($match0._9, "String")
553+ else false
554+ else false
555+ else false
556+ else false
557+ else false
558+ else false)
559+ then {
560+ let outAmAmt = $match0._1
561+ let outPrAmt = $match0._2
562+ let amBalance = $match0._5
563+ let prBalance = $match0._6
564+ let lpEmission = $match0._7
565+ let curPrice = $match0._8
566+ let poolStatus = $match0._9
567+ $Tuple7(outAmAmt, outPrAmt, amBalance, prBalance, lpEmission, curPrice, poolStatus)
568+ }
569+ else throw("Couldn't cast types")
570+ }
571+ let outAmAmt = $t01505815475._1
572+ let outPrAmt = $t01505815475._2
573+ let amBalance = $t01505815475._3
574+ let prBalance = $t01505815475._4
575+ let lpEmission = $t01505815475._5
576+ let curPrice = $t01505815475._6
577+ let poolStatus = $t01505815475._7
578+ $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), curPrice, poolStatus], SEP))
315579 }
316580
317581

github/deemru/w8io/026f985 
71.54 ms