tx · FTsegQgfsrr57qLagsc6t8DsPuCDH4RA2yU6TEK3Z8Nm 3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu: -0.01000000 Waves 2021.11.16 12:00 [1793390] smart account 3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu > SELF 0.00000000 Waves
{ "type": 13, "id": "FTsegQgfsrr57qLagsc6t8DsPuCDH4RA2yU6TEK3Z8Nm", "fee": 1000000, "feeAssetId": null, "timestamp": 1637053259104, "version": 1, "sender": "3MxpZZ46oGH5idG2rXfcUDwFotSELDEtyQu", "senderPublicKey": "HLjebBrq1Pdi1gabeao41GqBhEf9kyjY2P4k6dbNW8XC", "proofs": [ "qyKbB7eTaRaAwMQV3vfu5WmXeTqJtncKsoJw6J87MNNJ6Z3xqU59CBh88RB43FewRCGGnfSgr8CpNKpMm4rJozL" ], "script": "base64:AAIFAAAAAAAAACcIAhIDCgEIEgMKAQgSBAoCCAgSAwoBCBIHCgUBAQEICBIAEgMKAQgAAAAyAAAAAAZTQ0FMRTgAAAAAAAAAAAgAAAAABU1VTFQ4AAAAAAAF9eEAAAAAAAdTQ0FMRTE4AAAAAAAAAAASAAAAAAZNVUxUMTgJAAE2AAAAAQAN4Lazp2QAAAAAAAADU0VQAgAAAAJfXwAAAAAOaWR4UG9vbEFkZHJlc3MAAAAAAAAAAAEAAAAADWlkeFBvb2xTdGF0dXMAAAAAAAAAAAIAAAAAEGlkeFBvb2xMUEFzc2V0SWQAAAAAAAAAAAMAAAAADWlkeEFtdEFzc2V0SWQAAAAAAAAAAAQAAAAAD2lkeFByaWNlQXNzZXRJZAAAAAAAAAAABQAAAAAOaWR4QW10QXNzZXREY20AAAAAAAAAAAYAAAAAEGlkeFByaWNlQXNzZXREY20AAAAAAAAAAAcAAAAADmlkeElBbXRBc3NldElkAAAAAAAAAAAIAAAAABBpZHhJUHJpY2VBc3NldElkAAAAAAAAAAAJAAAAAA1pZHhMUEFzc2V0RGNtAAAAAAAAAAAKAQAAAA9nZXRTd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AAAIY3VyUHJpY2UJAARMAAAAAgkAAaQAAAABBQAAAA9scEFtdEFzc2V0U2hhcmUJAARMAAAAAgkAAaQAAAABBQAAABFscFByaWNlQXNzZXRTaGFyZQkABEwAAAACCQABpAAAAAEFAAAACnBvb2xXZWlnaHQFAAAAA25pbAUAAAADU0VQAAAAAMhxnR0=", "chainId": 84, "height": 1793390, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CYPhwj3imUdgjDn3DnXuLt3WcMxuJjbfKFbBQJV8yrFK Next: GwSzNjwHBQzmPJpoeDLMgM9Da5UZDQQ179sTMzpLdPdS Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | + | ||
14 | + | let idxPoolAddress = 1 | |
15 | + | ||
16 | + | let idxPoolStatus = 2 | |
17 | + | ||
18 | + | let idxPoolLPAssetId = 3 | |
19 | + | ||
20 | + | let idxAmtAssetId = 4 | |
21 | + | ||
22 | + | let idxPriceAssetId = 5 | |
23 | + | ||
24 | + | let idxAmtAssetDcm = 6 | |
25 | + | ||
26 | + | let idxPriceAssetDcm = 7 | |
27 | + | ||
28 | + | let idxIAmtAssetId = 8 | |
29 | + | ||
30 | + | let idxIPriceAssetId = 9 | |
31 | + | ||
32 | + | let idxLPAssetDcm = 10 | |
13 | 33 | ||
14 | 34 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
15 | 35 | ||
26 | 46 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
27 | 47 | ||
28 | 48 | ||
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 | + | ||
29 | 66 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
30 | 67 | ||
31 | 68 | ||
32 | 69 | func keyFactoryLpList () = "%s__lpTokensList" | |
33 | 70 | ||
34 | 71 | ||
35 | - | func keyFactoryCfg () = "%s__factoryConfig" | |
72 | + | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
73 | + | ||
74 | + | ||
75 | + | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
36 | 76 | ||
37 | 77 | ||
38 | 78 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
41 | 81 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
42 | 82 | ||
43 | 83 | ||
44 | - | func readFactoryCfgOrFail () = split(getStringByAddressOrFail(readFactoryAddressOrFail(), keyFactoryCfg()), SEP) | |
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" | |
45 | 106 | ||
46 | 107 | ||
47 | 108 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
50 | 111 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
51 | 112 | ||
52 | 113 | ||
53 | - | func | |
114 | + | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
54 | 115 | ||
55 | 116 | ||
56 | - | func internalCurrentRewardRate (stakingContract,lpAssetId) = { | |
57 | - | let wxEmissionPerBlock = 0 | |
58 | - | let maxFactor = (1 * MULT8) | |
117 | + | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
118 | + | ||
119 | + | ||
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 = fraction(poolWxEmissionPerBlockMax, poolWxEmissionPerBlock, MULT8) | |
59 | 138 | let totalLpStaked = getIntOrZero(stakingContract, keyStakedTotal(lpAssetId)) | |
60 | - | [ | |
139 | + | [poolWxEmissionPerBlock, maxFactor, totalLpStaked] | |
61 | 140 | } | |
62 | 141 | ||
63 | 142 | ||
70 | 149 | ||
71 | 150 | @Callable(i) | |
72 | 151 | func currentRewardRateREADONLY (lpAssetId) = { | |
73 | - | let factoryCfgArray = readFactoryCfgOrFail() | |
74 | - | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
75 | - | let rewardData = internalCurrentRewardRate(stakingContract, 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) | |
76 | 157 | let wxEmissionPerBlock = rewardData[0] | |
77 | 158 | let maxFactor = rewardData[1] | |
78 | 159 | let totalLpStaked = rewardData[2] | |
83 | 164 | ||
84 | 165 | @Callable(i) | |
85 | 166 | func currentUserRewardRateREADONLY (lpAssetId,userAddress) = { | |
86 | - | let factoryCfgArray = readFactoryCfgOrFail() | |
87 | - | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
88 | - | let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId) | |
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) | |
89 | 172 | let wxEmissionPerBlock = rewardData[0] | |
90 | 173 | let maxFactor = rewardData[1] | |
91 | 174 | let totalLpStaked = rewardData[2] | |
92 | 175 | let lpStakedByUser = getIntOrZero(stakingContract, keyStakedByUser(userAddress, lpAssetId)) | |
93 | 176 | let boostingPower = (1 * MULT8) | |
94 | - | $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP)) | |
177 | + | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP)) | |
95 | 178 | } | |
96 | 179 | ||
97 | 180 | ||
148 | 231 | func wxEmissionStatsREADONLY () = { | |
149 | 232 | let ONEMULT = toString(MULT8) | |
150 | 233 | let ONE = "1" | |
151 | - | let totalWxReleased = 0 | |
152 | - | let totalWxLocked = 0 | |
153 | - | let locksDurationSumInBlocks = 0 | |
154 | - | let locksCount = 0 | |
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()) | |
155 | 247 | $Tuple2(nil, makeString(["%d%d%d%d", toString(totalWxReleased), toString(totalWxLocked), toString(locksDurationSumInBlocks), toString(locksCount)], SEP)) | |
248 | + | } | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
253 | + | func lpStatsREADONLY (lpAsset) = { | |
254 | + | let factoryAddress = readFactoryAddressOrFail() | |
255 | + | 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")) | |
280 | + | 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]") | |
290 | + | 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))) | |
298 | + | $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)) | |
156 | 299 | } | |
157 | 300 | ||
158 | 301 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let SCALE18 = 18 | |
9 | 9 | ||
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | + | ||
14 | + | let idxPoolAddress = 1 | |
15 | + | ||
16 | + | let idxPoolStatus = 2 | |
17 | + | ||
18 | + | let idxPoolLPAssetId = 3 | |
19 | + | ||
20 | + | let idxAmtAssetId = 4 | |
21 | + | ||
22 | + | let idxPriceAssetId = 5 | |
23 | + | ||
24 | + | let idxAmtAssetDcm = 6 | |
25 | + | ||
26 | + | let idxPriceAssetDcm = 7 | |
27 | + | ||
28 | + | let idxIAmtAssetId = 8 | |
29 | + | ||
30 | + | let idxIPriceAssetId = 9 | |
31 | + | ||
32 | + | let idxLPAssetDcm = 10 | |
13 | 33 | ||
14 | 34 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
15 | 35 | ||
16 | 36 | ||
17 | 37 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
18 | 38 | ||
19 | 39 | ||
20 | 40 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
21 | 41 | ||
22 | 42 | ||
23 | 43 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
24 | 44 | ||
25 | 45 | ||
26 | 46 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
27 | 47 | ||
28 | 48 | ||
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 | + | ||
29 | 66 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
30 | 67 | ||
31 | 68 | ||
32 | 69 | func keyFactoryLpList () = "%s__lpTokensList" | |
33 | 70 | ||
34 | 71 | ||
35 | - | func keyFactoryCfg () = "%s__factoryConfig" | |
72 | + | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
73 | + | ||
74 | + | ||
75 | + | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
36 | 76 | ||
37 | 77 | ||
38 | 78 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
39 | 79 | ||
40 | 80 | ||
41 | 81 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
42 | 82 | ||
43 | 83 | ||
44 | - | func readFactoryCfgOrFail () = split(getStringByAddressOrFail(readFactoryAddressOrFail(), keyFactoryCfg()), SEP) | |
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" | |
45 | 106 | ||
46 | 107 | ||
47 | 108 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
48 | 109 | ||
49 | 110 | ||
50 | 111 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
51 | 112 | ||
52 | 113 | ||
53 | - | func | |
114 | + | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
54 | 115 | ||
55 | 116 | ||
56 | - | func internalCurrentRewardRate (stakingContract,lpAssetId) = { | |
57 | - | let wxEmissionPerBlock = 0 | |
58 | - | let maxFactor = (1 * MULT8) | |
117 | + | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
118 | + | ||
119 | + | ||
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 = fraction(poolWxEmissionPerBlockMax, poolWxEmissionPerBlock, MULT8) | |
59 | 138 | let totalLpStaked = getIntOrZero(stakingContract, keyStakedTotal(lpAssetId)) | |
60 | - | [ | |
139 | + | [poolWxEmissionPerBlock, maxFactor, totalLpStaked] | |
61 | 140 | } | |
62 | 141 | ||
63 | 142 | ||
64 | 143 | @Callable(i) | |
65 | 144 | func constructor (factoryAddress) = if ((i.caller != this)) | |
66 | 145 | then throw("not authorized") | |
67 | 146 | else [StringEntry(keyFactoryAddress(), factoryAddress)] | |
68 | 147 | ||
69 | 148 | ||
70 | 149 | ||
71 | 150 | @Callable(i) | |
72 | 151 | func currentRewardRateREADONLY (lpAssetId) = { | |
73 | - | let factoryCfgArray = readFactoryCfgOrFail() | |
74 | - | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
75 | - | let rewardData = internalCurrentRewardRate(stakingContract, 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) | |
76 | 157 | let wxEmissionPerBlock = rewardData[0] | |
77 | 158 | let maxFactor = rewardData[1] | |
78 | 159 | let totalLpStaked = rewardData[2] | |
79 | 160 | $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked)], SEP)) | |
80 | 161 | } | |
81 | 162 | ||
82 | 163 | ||
83 | 164 | ||
84 | 165 | @Callable(i) | |
85 | 166 | func currentUserRewardRateREADONLY (lpAssetId,userAddress) = { | |
86 | - | let factoryCfgArray = readFactoryCfgOrFail() | |
87 | - | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
88 | - | let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId) | |
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) | |
89 | 172 | let wxEmissionPerBlock = rewardData[0] | |
90 | 173 | let maxFactor = rewardData[1] | |
91 | 174 | let totalLpStaked = rewardData[2] | |
92 | 175 | let lpStakedByUser = getIntOrZero(stakingContract, keyStakedByUser(userAddress, lpAssetId)) | |
93 | 176 | let boostingPower = (1 * MULT8) | |
94 | - | $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP)) | |
177 | + | $Tuple2(nil, makeString(["%d%d%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP)) | |
95 | 178 | } | |
96 | 179 | ||
97 | 180 | ||
98 | 181 | ||
99 | 182 | @Callable(i) | |
100 | 183 | func claimedRewardREADONLY (userAddress) = { | |
101 | 184 | let lpList = readLpList() | |
102 | 185 | let prefix = "%s%d%d%d%s" | |
103 | 186 | func claimedRewardByLpAggregator (resultStr,nextLp) = { | |
104 | 187 | let rand = ((toInt(fromBase58String(nextLp)) % 100000) + (toInt(toBytes(userAddress)) % 100000)) | |
105 | 188 | let absRand = if ((0 > rand)) | |
106 | 189 | then -(rand) | |
107 | 190 | else rand | |
108 | 191 | let val = (((absRand % 100) * MULT8) + (absRand * (MULT8 / 100000))) | |
109 | 192 | let minRewardClaimed = 0 | |
110 | 193 | let boostRewardClaimed = 0 | |
111 | 194 | let gFeeClaimed = 0 | |
112 | 195 | makeString([(prefix + resultStr), nextLp, toString(minRewardClaimed), toString(boostRewardClaimed), toString(gFeeClaimed), "end"], SEP) | |
113 | 196 | } | |
114 | 197 | ||
115 | 198 | let result = { | |
116 | 199 | let $l = lpList | |
117 | 200 | let $s = size($l) | |
118 | 201 | let $acc0 = "%s" | |
119 | 202 | func 1 ($a,$i) = if (($i >= $s)) | |
120 | 203 | then $a | |
121 | 204 | else claimedRewardByLpAggregator($a, $l[$i]) | |
122 | 205 | ||
123 | 206 | func 2 ($a,$i) = if (($i >= $s)) | |
124 | 207 | then $a | |
125 | 208 | else throw("List size exceeds 10") | |
126 | 209 | ||
127 | 210 | 2(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
128 | 211 | } | |
129 | 212 | $Tuple2(nil, ((result + SEP) + userAddress)) | |
130 | 213 | } | |
131 | 214 | ||
132 | 215 | ||
133 | 216 | ||
134 | 217 | @Callable(i) | |
135 | 218 | func calcBoostREADONLY (deltaWxAmount,deltaLockPeriodInBlocks,deltaLpAmount,lpAssetIdOpt,userAddressOpt) = { | |
136 | 219 | let boost = if ((userAddressOpt != "")) | |
137 | 220 | then (3 * MULT8) | |
138 | 221 | else (1 * MULT8) | |
139 | 222 | let monthes18 = fraction(toBigInt(deltaLockPeriodInBlocks), MULT18, toBigInt((30 * 1440))) | |
140 | 223 | let coeff18 = (pow(monthes18, SCALE18, toBigInt(2), 0, SCALE18, HALFUP) / toBigInt(1000)) | |
141 | 224 | let gWxAmount = fraction(toBigInt(deltaWxAmount), coeff18, MULT18) | |
142 | 225 | $Tuple2(nil, makeString(["%d%d", toString(toInt(gWxAmount)), toString(boost)], SEP)) | |
143 | 226 | } | |
144 | 227 | ||
145 | 228 | ||
146 | 229 | ||
147 | 230 | @Callable(i) | |
148 | 231 | func wxEmissionStatsREADONLY () = { | |
149 | 232 | let ONEMULT = toString(MULT8) | |
150 | 233 | let ONE = "1" | |
151 | - | let totalWxReleased = 0 | |
152 | - | let totalWxLocked = 0 | |
153 | - | let locksDurationSumInBlocks = 0 | |
154 | - | let locksCount = 0 | |
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()) | |
155 | 247 | $Tuple2(nil, makeString(["%d%d%d%d", toString(totalWxReleased), toString(totalWxLocked), toString(locksDurationSumInBlocks), toString(locksCount)], SEP)) | |
248 | + | } | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
253 | + | func lpStatsREADONLY (lpAsset) = { | |
254 | + | let factoryAddress = readFactoryAddressOrFail() | |
255 | + | 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")) | |
280 | + | 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]") | |
290 | + | 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))) | |
298 | + | $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)) | |
156 | 299 | } | |
157 | 300 | ||
158 | 301 |
github/deemru/w8io/026f985 49.72 ms ◑