tx · GktThkULjnMXU583Q9RpPwgVv9n4M7UYQynBuzMM98Ad 3N7sjiFtcgyB6idwt51r3Dh1Kzbr9pUdkhK: -0.01000000 Waves 2021.09.29 14:47 [1724207] smart account 3N7sjiFtcgyB6idwt51r3Dh1Kzbr9pUdkhK > SELF 0.00000000 Waves
{ "type": 13, "id": "GktThkULjnMXU583Q9RpPwgVv9n4M7UYQynBuzMM98Ad", "fee": 1000000, "feeAssetId": null, "timestamp": 1632916040717, "version": 1, "sender": "3N7sjiFtcgyB6idwt51r3Dh1Kzbr9pUdkhK", "senderPublicKey": "A7V6Ezu31p2vCdVto9WfNpRZsF9kRFfr3tb6n48MDGtC", "proofs": [ "3K932RVzhHZyAUork9FVTbGbRyMqxcMhmxtHyfntEipDXRhz6c5h8MfoQBi5FdEN2CaWbcJ3KAjxwiKJV3e8WMEq" ], "script": "base64:AAIFAAAAAAAAACIIAhIDCgEIEgMKAQgSBAoCCAgSAwoBCBIHCgUBAQEICBIAAAAAEgAAAAAGU0NBTEU4AAAAAAAAAAAIAAAAAAVNVUxUOAAAAAAABfXhAAAAAAADU0VQAgAAAAJfXwEAAAAPZ2V0U3RyaW5nT3JGYWlsAAAAAQAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABCIAAAABBQAAAANrZXkJAAEsAAAAAgkAASwAAAACAgAAAA9tYW5kYXRvcnkgdGhpcy4FAAAAA2tleQIAAAAPIGlzIG5vdCBkZWZpbmVkAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NPckZhaWwAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAACm1hbmRhdG9yeSAJAAQlAAAAAQUAAAAHYWRkcmVzcwIAAAABLgUAAAADa2V5AgAAAA8gaXMgbm90IGRlZmluZWQBAAA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AADRVhQAAAAAAAAAAAGBQAAAAlwb3dlck11bHQFAAAABlNDQUxFOAUAAAAGU0NBTEU4BQAAAAZIQUxGVVAEAAAACWdXeEFtb3VudAkAAGsAAAADBQAAAA1kZWx0YVd4QW1vdW50BQAAAAVNVUxUOAUAAAAFa011bHQJAAUUAAAAAgUAAAADbmlsCQAEuQAAAAIJAARMAAAAAgIAAAAEJWQlZAkABEwAAAACCQABpAAAAAEFAAAACWdXeEFtb3VudAkABEwAAAACCQABpAAAAAEFAAAABWJvb3N0BQAAAANuaWwFAAAAA1NFUAAAAAFpAQAAABd3eEVtaXNzaW9uU3RhdHNSRUFET05MWQAAAAAEAAAAB09ORU1VTFQJAAGkAAAAAQUAAAAFTVVMVDgEAAAAA09ORQIAAAABMQQAAAAPdG90YWxXeFJlbGVhc2VkAAAAAAAAAAAABAAAAA10b3RhbFd4TG9ja2VkAAAAAAAAAAAABAAAABhsb2Nrc0R1cmF0aW9uU3VtSW5CbG9ja3MAAAAAAAAAAAAEAAAACmxvY2tzQ291bnQAAAAAAAAAAAAJAAUUAAAAAgUAAAADbmlsCQAEuQAAAAIJAARMAAAAAgIAAAAIJWQlZCVkJWQJAARMAAAAAgkAAaQAAAABBQAAAA90b3RhbFd4UmVsZWFzZWQJAARMAAAAAgkAAaQAAAABBQAAAA10b3RhbFd4TG9ja2VkCQAETAAAAAIJAAGkAAAAAQUAAAAYbG9ja3NEdXJhdGlvblN1bUluQmxvY2tzCQAETAAAAAIJAAGkAAAAAQUAAAAKbG9ja3NDb3VudAUAAAADbmlsBQAAAANTRVAAAAAAtW4Y6A==", "chainId": 84, "height": 1724207, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SCALE8 = 8 | |
5 | + | ||
6 | + | let MULT8 = 100000000 | |
7 | + | ||
8 | + | let SEP = "__" | |
9 | + | ||
10 | + | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
11 | + | ||
12 | + | ||
13 | + | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
14 | + | ||
15 | + | ||
16 | + | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
17 | + | ||
18 | + | ||
19 | + | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
20 | + | ||
21 | + | ||
22 | + | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
23 | + | ||
24 | + | ||
25 | + | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
26 | + | ||
27 | + | ||
28 | + | func keyFactoryLpList () = "%s__lpTokensList" | |
29 | + | ||
30 | + | ||
31 | + | func keyFactoryCfg () = "%s__factoryConfig" | |
32 | + | ||
33 | + | ||
34 | + | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
35 | + | ||
36 | + | ||
37 | + | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
38 | + | ||
39 | + | ||
40 | + | func readFactoryCfgOrFail () = split(getStringByAddressOrFail(readFactoryAddressOrFail(), keyFactoryCfg()), SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
44 | + | ||
45 | + | ||
46 | + | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
47 | + | ||
48 | + | ||
49 | + | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[1]) | |
50 | + | ||
51 | + | ||
52 | + | func internalCurrentRewardRate (stakingContract,lpAssetId) = { | |
53 | + | let wxEmissionPerBlock = 0 | |
54 | + | let maxFactor = (1 * MULT8) | |
55 | + | let totalLpStaked = getIntOrZero(stakingContract, keyStakedTotal(lpAssetId)) | |
56 | + | [wxEmissionPerBlock, maxFactor, totalLpStaked] | |
57 | + | } | |
58 | + | ||
59 | + | ||
60 | + | @Callable(i) | |
61 | + | func constructor (factoryAddress) = if ((i.caller != this)) | |
62 | + | then throw("not authorized") | |
63 | + | else [StringEntry(keyFactoryAddress(), factoryAddress)] | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func currentRewardRateREADONLY (lpAssetId) = { | |
69 | + | let factoryCfgArray = readFactoryCfgOrFail() | |
70 | + | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
71 | + | let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId) | |
72 | + | let wxEmissionPerBlock = rewardData[0] | |
73 | + | let maxFactor = rewardData[1] | |
74 | + | let totalLpStaked = rewardData[2] | |
75 | + | $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked)], SEP)) | |
76 | + | } | |
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | @Callable(i) | |
81 | + | func currentUserRewardRateREADONLY (lpAssetId,userAddress) = { | |
82 | + | let factoryCfgArray = readFactoryCfgOrFail() | |
83 | + | let stakingContract = getStakingAddressOrFail(factoryCfgArray) | |
84 | + | let rewardData = internalCurrentRewardRate(stakingContract, lpAssetId) | |
85 | + | let wxEmissionPerBlock = rewardData[0] | |
86 | + | let maxFactor = rewardData[1] | |
87 | + | let totalLpStaked = rewardData[2] | |
88 | + | let lpStakedByUser = getIntOrZero(stakingContract, keyStakedByUser(userAddress, lpAssetId)) | |
89 | + | let boostingPower = (1 * MULT8) | |
90 | + | $Tuple2(nil, makeString(["%d%d%d", toString(wxEmissionPerBlock), toString(maxFactor), toString(totalLpStaked), toString(lpStakedByUser), toString(boostingPower)], SEP)) | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func claimedRewardREADONLY (userAddress) = { | |
97 | + | let lpList = readLpList() | |
98 | + | let prefix = "%s%d%d%d%s" | |
99 | + | func claimedRewardByLpAggregator (resultStr,nextLp) = { | |
100 | + | let rand = ((toInt(fromBase58String(nextLp)) % 100000) + (toInt(toBytes(userAddress)) % 100000)) | |
101 | + | let absRand = if ((0 > rand)) | |
102 | + | then -(rand) | |
103 | + | else rand | |
104 | + | let val = (((absRand % 100) * MULT8) + (absRand * (MULT8 / 100000))) | |
105 | + | let minRewardClaimed = 0 | |
106 | + | let boostRewardClaimed = 0 | |
107 | + | let gFeeClaimed = 0 | |
108 | + | makeString([(prefix + resultStr), nextLp, toString(minRewardClaimed), toString(boostRewardClaimed), toString(gFeeClaimed), "end"], SEP) | |
109 | + | } | |
110 | + | ||
111 | + | let result = { | |
112 | + | let $l = lpList | |
113 | + | let $s = size($l) | |
114 | + | let $acc0 = "%s" | |
115 | + | func 1 ($a,$i) = if (($i >= $s)) | |
116 | + | then $a | |
117 | + | else claimedRewardByLpAggregator($a, $l[$i]) | |
118 | + | ||
119 | + | func 2 ($a,$i) = if (($i >= $s)) | |
120 | + | then $a | |
121 | + | else throw("List size exceeds 10") | |
122 | + | ||
123 | + | 2(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
124 | + | } | |
125 | + | $Tuple2(nil, ((result + SEP) + userAddress)) | |
126 | + | } | |
127 | + | ||
128 | + | ||
129 | + | ||
130 | + | @Callable(i) | |
131 | + | func calcBoostREADONLY (deltaWxAmount,deltaLockPeriodInBlocks,deltaLpAmount,lpAssetIdOpt,userAddressOpt) = { | |
132 | + | let boost = if ((userAddressOpt != "")) | |
133 | + | then (3 * MULT8) | |
134 | + | else (1 * MULT8) | |
135 | + | let EXP = 2718281 | |
136 | + | let powerMult = fraction((1440 + deltaLockPeriodInBlocks), MULT8, 1440) | |
137 | + | let kMult = pow(EXP, 6, powerMult, SCALE8, SCALE8, HALFUP) | |
138 | + | let gWxAmount = fraction(deltaWxAmount, MULT8, kMult) | |
139 | + | $Tuple2(nil, makeString(["%d%d", toString(gWxAmount), toString(boost)], SEP)) | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | ||
144 | + | @Callable(i) | |
145 | + | func wxEmissionStatsREADONLY () = { | |
146 | + | let ONEMULT = toString(MULT8) | |
147 | + | let ONE = "1" | |
148 | + | let totalWxReleased = 0 | |
149 | + | let totalWxLocked = 0 | |
150 | + | let locksDurationSumInBlocks = 0 | |
151 | + | let locksCount = 0 | |
152 | + | $Tuple2(nil, makeString(["%d%d%d%d", toString(totalWxReleased), toString(totalWxLocked), toString(locksDurationSumInBlocks), toString(locksCount)], SEP)) | |
153 | + | } | |
154 | + | ||
155 | + |
github/deemru/w8io/169f3d6 35.17 ms ◑