tx · 74X15JuSnq2Hen5M92d5Na4VxfBZ6njDA8UA3T4kjsnR

3MpcyLdYAQ6Z14cs1Fy3o7XK1cAHajK5g5N:  -0.01000000 Waves

2022.04.26 22:48 [2025888] smart account 3MpcyLdYAQ6Z14cs1Fy3o7XK1cAHajK5g5N > SELF 0.00000000 Waves

{ "type": 13, "id": "74X15JuSnq2Hen5M92d5Na4VxfBZ6njDA8UA3T4kjsnR", "fee": 1000000, "feeAssetId": null, "timestamp": 1651002485630, "version": 2, "chainId": 84, "sender": "3MpcyLdYAQ6Z14cs1Fy3o7XK1cAHajK5g5N", "senderPublicKey": "CpN2UR96CYA49vvxNChb3NFpAE9TK2nyuCptRU4VkHzS", "proofs": [ "4QWAqAtk98vsXi3Xswa3T4b49oBknui5VJ6oA9bzviz7ZqMHbGzBFxNxvUKFjteNUtT87MDJtVBA6MxkNgihaYRo" ], "script": "base64:AAIFAAAAAAAAAB8IAhIECgIBARIDCgEIEgcKBQEBAQEIEgMKAQESABIAAAAAGgAAAAADdmVyAgAAAAMxLjAAAAAABHllYXIAAAAAAAAIBSAAAAAACXNlcGFyYXRvcgIAAAACX18AAAAACldBVkVTSURTVFICAAAABVdBVkVTAAAAAAdXQVZFU0lECQACWQAAAAEFAAAACldBVkVTSURTVFIAAAAADG1heEludmVzdEtleQIAAAANJXNfX21heEludmVzdAAAAAAOdG90YWxJbnZlc3RLZXkCAAAADyVzX190b3RhbEludmVzdAAAAAAOaW52ZXN0QXNzZXRLZXkCAAAAESVzX19pbnZlc3RBc3NldElkAAAAAAphcHlGcm9tS2V5AgAAAAslc19fYXB5RnJvbQAAAAAIYXB5VG9LZXkCAAAACSVzX19hcHlUbwAAAAAUaW52ZXN0SW50ZXJ2YWxNaW5LZXkCAAAADyVzX19pbnRlcnZhbE1pbgAAAAAObWF4SW50ZXJ2YWxLZXkCAAAADiVfX21heEludGVydmFsAQAAABBnZXRVc2VySW52ZXN0S2V5AAAAAQAAAAR1c2VyCQAEuQAAAAIJAARMAAAA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AAAAAQJAAGRAAAAAgUAAAAEZGF0YQAAAAAAAAAABQkAAZEAAAACBQAAAARkYXRhAAAAAAAAAAAGBAAAAAdjbGFpbWVkCQAAZAAAAAIJAAGRAAAAAgUAAAAEZGF0YQAAAAAAAAAABAUAAAAHdG9DbGFpbQQAAAALY2xhaW1IZWlnaHQFAAAABmhlaWdodAMJAAAAAAAAAgUAAAAHdG9DbGFpbQAAAAAAAAAAAAkAAAIAAAABAgAAABBOb3RoaW5nIHRvIGNsYWltCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAHdG9DbGFpbQkAAlkAAAABBQAAAAtpbnZlc3RBc3NldAkABEwAAAACCQEAAAALc2V0VXNlckRhdGEAAAAICQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgkAAZEAAAACBQAAAARkYXRhAAAAAAAAAAAACQABkQAAAAIFAAAABGRhdGEAAAAAAAAAAAEFAAAAC2NsYWltSGVpZ2h0CQABkQAAAAIFAAAABGRhdGEAAAAAAAAAAAMAAAAAAAAAAAAFAAAAB2NsYWltZWQJAAGRAAAAAgUAAAAEZGF0YQAAAAAAAAAABgUAAAADbmlsAAAAAWkBAAAADGRlbGV0ZUFtb3VudAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADnRvdGFsSW52ZXN0S2V5AAAAAAAAAAAABQAAAANuaWwAAAAAYE0i9g==", "height": 2025888, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4rrPHcu2tzHxxAmvdQpQ7hRxZHWA2JjicSyvRerZEgHz Next: BTEDgXJwX7CHQ5TwmDfYpwDtsf3P3D8JTxKsTGqJGSaj Diff:
OldNewDifferences
159159 else {
160160 let currentApy = getApy(interval, maxInterval)
161161 let userData = readUserData(userAddressString)
162- let claimHeight = userData[2]
162+ let noClaimed = calculateToClaim(userData[0], userData[1], userData[2], userData[3], userData[4], userData[5], userData[6])
163163 let allAmount = (amount + userData[3])
164164 let claimed = userData[4]
165165 let toClaim = userData[5]
166-[setUserData(userAddressString, investStart, investEnd, claimHeight, allAmount, toClaim, claimed, currentApy), IntegerEntry(totalInvestKey, (amount + totalInvested))]
166+[setUserData(userAddressString, investStart, investEnd, investStart, allAmount, noClaimed, claimed, currentApy), IntegerEntry(totalInvestKey, (amount + totalInvested))]
167167 }
168168 }
169169 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ver = "1.0"
55
66 let year = 525600
77
88 let separator = "__"
99
1010 let WAVESIDSTR = "WAVES"
1111
1212 let WAVESID = fromBase58String(WAVESIDSTR)
1313
1414 let maxInvestKey = "%s__maxInvest"
1515
1616 let totalInvestKey = "%s__totalInvest"
1717
1818 let investAssetKey = "%s__investAssetId"
1919
2020 let apyFromKey = "%s__apyFrom"
2121
2222 let apyToKey = "%s__apyTo"
2323
2424 let investIntervalMinKey = "%s__intervalMin"
2525
2626 let maxIntervalKey = "%__maxInterval"
2727
2828 func getUserInvestKey (user) = makeString(["%s%s$d", "clrcInvest", user], separator)
2929
3030
3131 func valueOrDefault (val,defaultVal) = if ((valueOrElse(val, 0) != 0))
3232 then val
3333 else defaultVal
3434
3535
3636 func getMinVal (val1,val2) = if ((val1 > val2))
3737 then val2
3838 else val1
3939
4040
4141 func getMaxVal (val1,val2) = if ((val2 > val1))
4242 then val2
4343 else val1
4444
4545
4646 func getIntOrZero (key) = valueOrElse(getInteger(this, key), 0)
4747
4848
4949 func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal)
5050
5151
5252 func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined"))
5353
5454
5555 func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal)
5656
5757
5858 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("Mandatory this." + key) + " is not defined"))
5959
6060
6161 func toAssetVect (assetStr) = if ((assetStr == WAVESIDSTR))
6262 then unit
6363 else fromBase58String(assetStr)
6464
6565
6666 func getApy (interval,maxInterval) = {
6767 let apyTo = getIntOrZero(apyToKey)
6868 let apyFrom = getIntOrZero(apyFromKey)
6969 let deltaApy = ((apyTo - apyFrom) * 1000000)
7070 let kInterval = (maxInterval - 1)
7171 let apyNormalize = ((deltaApy * (interval - 1)) / kInterval)
7272 let finalApy = (apyNormalize + (apyFrom * 1000000))
7373 finalApy
7474 }
7575
7676
7777 func readUserData (user) = {
7878 let data = split(getStrOrElse(getUserInvestKey(user), ""), separator)
7979 if ((7 > size(data)))
8080 then [0, 0, 0, 0, 0, 0, 0]
8181 else {
8282 let heightStart = valueOrElse(parseInt(data[1]), 0)
8383 let heightEnd = valueOrElse(parseInt(data[2]), 0)
8484 let claimed = valueOrElse(parseInt(data[3]), 0)
8585 let amount = valueOrElse(parseInt(data[4]), 0)
8686 let toClaim = valueOrElse(parseInt(data[5]), 0)
8787 let claimHeight = valueOrElse(parseInt(data[6]), 0)
8888 let apy = valueOrElse(parseInt(data[7]), 0)
8989 [heightStart, heightEnd, claimHeight, amount, toClaim, claimed, apy]
9090 }
9191 }
9292
9393
9494 func setUserData (user,heightStart,heightEnd,claimHeight,amount,toClaim,claimed,apy) = {
9595 let key = getUserInvestKey(user)
9696 let data = makeString(["%d%d%d%d%d%d", toString(heightStart), toString(heightEnd), toString(claimHeight), toString(amount), toString(toClaim), toString(claimed), toString(apy)], separator)
9797 StringEntry(key, data)
9898 }
9999
100100
101101 func calculateToClaim (heightStart,heightEnd,claimHeight,amount,toClaim,claimed,apy) = {
102102 let fromClaimHeight = getMaxVal(claimHeight, heightStart)
103103 let toEndHeight = getMinVal(heightEnd, height)
104104 let delta = (toEndHeight - fromClaimHeight)
105105 let koeficient = fraction(apy, delta, year)
106106 let accumulate = fraction(koeficient, amount, 100000000)
107107 (accumulate + toClaim)
108108 }
109109
110110
111111 @Callable(i)
112112 func getApyReaOnly (interval,maxInterval) = {
113113 let currentApy = getApy(interval, maxInterval)
114114 $Tuple2(nil, currentApy)
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func claimReadonly (user) = {
121121 let data = readUserData(user)
122122 let toClaim = calculateToClaim(data[0], data[1], data[2], data[3], data[4], data[5], data[6])
123123 $Tuple2(nil, toClaim)
124124 }
125125
126126
127127
128128 @Callable(i)
129129 func setParams (apyFrom,apyTo,maxIntervalMonths,maxInvest,investAsset) = [StringEntry(investAssetKey, investAsset), IntegerEntry(apyToKey, apyTo), IntegerEntry(apyFromKey, apyFrom), IntegerEntry(maxIntervalKey, maxIntervalMonths), IntegerEntry(maxInvestKey, maxInvest)]
130130
131131
132132
133133 @Callable(i)
134134 func deposit (interval) = {
135135 let minInterval = getIntOrElse(investIntervalMinKey, 43200)
136136 let maxInvest = getIntOrZero(maxInvestKey)
137137 let totalInvested = getIntOrZero(totalInvestKey)
138138 let investAsset = getStringOrFail(investAssetKey)
139139 let userAddress = i.caller
140140 let userAddressString = toString(userAddress)
141141 let maxInterval = getIntOrZero(maxIntervalKey)
142142 let investStart = height
143143 let investEnd = (investStart + (minInterval * interval))
144144 let invalidAssetMessage = (("Invalid asset. " + investAsset) + " is expected")
145145 if (if ((1 > interval))
146146 then true
147147 else (interval > maxInterval))
148148 then throw("Wrong interval")
149149 else if ((size(i.payments) != 1))
150150 then throw("Invalid payments size")
151151 else {
152152 let payment = i.payments[0]
153153 let amount = payment.amount
154154 let assetId = valueOrErrorMessage(payment.assetId, invalidAssetMessage)
155155 if ((toBase58String(assetId) != investAsset))
156156 then throw(invalidAssetMessage)
157157 else if (((amount + totalInvested) > maxInvest))
158158 then throw("The max invest limit has been reached")
159159 else {
160160 let currentApy = getApy(interval, maxInterval)
161161 let userData = readUserData(userAddressString)
162- let claimHeight = userData[2]
162+ let noClaimed = calculateToClaim(userData[0], userData[1], userData[2], userData[3], userData[4], userData[5], userData[6])
163163 let allAmount = (amount + userData[3])
164164 let claimed = userData[4]
165165 let toClaim = userData[5]
166-[setUserData(userAddressString, investStart, investEnd, claimHeight, allAmount, toClaim, claimed, currentApy), IntegerEntry(totalInvestKey, (amount + totalInvested))]
166+[setUserData(userAddressString, investStart, investEnd, investStart, allAmount, noClaimed, claimed, currentApy), IntegerEntry(totalInvestKey, (amount + totalInvested))]
167167 }
168168 }
169169 }
170170
171171
172172
173173 @Callable(i)
174174 func claim () = {
175175 let investAsset = getStringOrFail(investAssetKey)
176176 let data = readUserData(toString(i.caller))
177177 if ((7 > size(data)))
178178 then throw("User has't invest")
179179 else {
180180 let toClaim = calculateToClaim(data[0], data[1], data[2], data[3], data[4], data[5], data[6])
181181 let claimed = (data[4] + toClaim)
182182 let claimHeight = height
183183 if ((toClaim == 0))
184184 then throw("Nothing to claim")
185185 else [ScriptTransfer(i.caller, toClaim, fromBase58String(investAsset)), setUserData(toString(i.caller), data[0], data[1], claimHeight, data[3], 0, claimed, data[6])]
186186 }
187187 }
188188
189189
190190
191191 @Callable(i)
192192 func deleteAmount () = [IntegerEntry(totalInvestKey, 0)]
193193
194194

github/deemru/w8io/026f985 
76.00 ms