tx · HTxJqi7dKQfP4Hv4izxRpjLK6GuokUSqeT8BGEGX9Src

3P5x9RxuqbMaVFPsaycvXHeFZXPmcswxA1c:  -0.01000000 Waves

2022.11.02 13:18 [3364710] smart account 3P5x9RxuqbMaVFPsaycvXHeFZXPmcswxA1c > SELF 0.00000000 Waves

{ "type": 13, "id": "HTxJqi7dKQfP4Hv4izxRpjLK6GuokUSqeT8BGEGX9Src", "fee": 1000000, "feeAssetId": null, "timestamp": 1667384290540, "version": 2, "chainId": 87, "sender": "3P5x9RxuqbMaVFPsaycvXHeFZXPmcswxA1c", "senderPublicKey": "9uEm8fN7ZMqn6sPuc39LRogUGXKNPPmRThGEL4GAqGa3", "proofs": [ "3fQQYZSJqHuijtFzNWwAEUage3FoqhRiM1mq3wMwJRTKuk9GaY1k7Hja25Z62zcy6uoLxgSYHQYbmskFi5NZ3H2U" ], "script": "base64:BgIWCAISAwoBCBIDCgEBEgQKAgEBEgASAA4AC1NUQVJUX1BSSUNFAKDCHgAIUVVPVElFTlQAAgAIREVDSU1BTFMAgMLXLwEOa2V5VXNlckFkZHJlc3MBB2FkZHJlc3MJAKwCAgUHYWRkcmVzcwIGX2xldmVsARNrZXlVc2VyU3BlbnRPbkxldmVsAQdhZGRyZXNzCQCsAgIFB2FkZHJlc3MCDV9zcGVudE9uTGV2ZWwBFmtleVVzZXJTa2lsbFJlc2V0VGltZXMBB2FkZHJlc3MJAKwCAgUHYWRkcmVzcwIRX3NraWxsc1Jlc2V0VGltZXMBE2tleVVzZXJTcGVudE9uUmVzZXQBB2FkZHJlc3MJAKwCAgUHYWRkcmVzcwINX3NwZW50T25SZXNldAENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAEUdHJ5R2V0U3RyaW5nRXh0ZXJuYWwCB2FkZHJlc3MDa2V5BAckbWF0Y2gwCQCdCAIFB2FkZHJlc3M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ENdHJ5R2V0SW50ZWdlcgEFGWtleVVzZXJTcGVudE9uUmVzZXRGaWxsZWQEGGNhbGN1bGF0ZVJlc2V0Q2FsY3VsYXRlZAkBDmNhbGN1bGF0ZVJlc2V0AgULbGV2ZWxPZlVzZXIFDHJlc2V0c09mVXNlcgQFcHJpY2UIBRhjYWxjdWxhdGVSZXNldENhbGN1bGF0ZWQCXzIEDGZpcnN0UGF5bWVudAkBBXZhbHVlAQkAkQMCCAUBaQhwYXltZW50cwAABAZhbW91bnQIBQxmaXJzdFBheW1lbnQGYW1vdW50AwkBAiE9AggFDGZpcnN0UGF5bWVudAdhc3NldElkCQENZ2V0RWdnQXNzZXRJZAAJAAIBCQCsAgICQExSOiBZb3UgY2FuIGF0dGFjaCBvbmx5IEVHRyB0b2tlbnMgd2l0aCB0aGUgZm9sbG93aW5nIGFzc2V0IGlkOiAJANgEAQkBDWdldEVnZ0Fzc2V0SWQAAwkBAiE9AgUGYW1vdW50BQVwcmljZQkAAgEJAKwCAgIoTFI6IFBsZWFzZSBhdHRhY2ggdGhlIGV4YWN0IGFzc2V0IGFtb3VudAkApAMBBQVwcmljZQkAzggCCQDMCAIJAQxJbnRlZ2VyRW50cnkCBRxrZXlVc2VyU2tpbGxSZXNldFRpbWVzRmlsbGVkCQBkAgUMcmVzZXRzT2ZVc2VyAAEJAMwIAgkBDEludGVnZXJFbnRyeQIFGWtleVVzZXJTcGVudE9uUmVzZXRGaWxsZWQJAGQCBRRhbW91bnRPZlNwZW5kT25SZXNldAUGYW1vdW50BQNuaWwIBRhjYWxjdWxhdGVSZXNldENhbGN1bGF0ZWQCXzEAMhwDHg==", "height": 3364710, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3ZnqCPzxa59KrPfdLAgSo9H48bMhtCPvnfnvf53nk2PT Next: FqzC8FRHCiRjgzSDc4gSbdSSNRiEG6bT9RtaXg4UkDiB Diff:
OldNewDifferences
4444 func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), "static_eggAssetId"))
4545
4646
47-func calculateLevelUp (currentLevel) = {
48- let p1 = pow(START_PRICE, 8, (10000 / currentLevel), 4, 8, CEILING)
49- let p2 = pow(currentLevel, 0, (10000 / QUOTIENT), 4, 8, CEILING)
47+func calculateLevelUp (futureLevel) = {
48+ let p1 = pow(START_PRICE, 8, (10000 / futureLevel), 4, 8, CEILING)
49+ let p2 = pow(futureLevel, 0, (10000 / QUOTIENT), 4, 8, CEILING)
5050 let total = fraction(p1, p2, DECIMALS)
51- let debug = makeString([("level=" + toString(currentLevel)), ("p1=" + toString(p1)), ("p2=" + toString(p2)), ("total=" + toString(total))], ";")
51+ let debug = makeString([("newLevel=" + toString(futureLevel)), ("p1=" + toString(p1)), ("p2=" + toString(p2)), ("total=" + toString(total))], ";")
5252 $Tuple2([StringEntry("DEBUG", debug)], total)
5353 }
5454
7070
7171
7272 @Callable(i)
73-func levelUpMath (currentLevel) = calculateLevelUp(currentLevel)
73+func levelUpMath (futureLevel) = calculateLevelUp(futureLevel)
7474
7575
7676
8585 let keyUserSpentOnLevelFilled = keyUserSpentOnLevel(toString(i.caller))
8686 let levelOfUser = tryGetInteger(keyUserAddressFilled)
8787 let totalSpentUser = tryGetInteger(keyUserSpentOnLevelFilled)
88- let priceCalc = calculateLevelUp(levelOfUser)
88+ let priceCalc = calculateLevelUp((levelOfUser + 1))
8989 let price = priceCalc._2
9090 let firstPayment = value(i.payments[0])
9191 let amount = firstPayment.amount
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let START_PRICE = 500000
55
66 let QUOTIENT = 2
77
88 let DECIMALS = 100000000
99
1010 func keyUserAddress (address) = (address + "_level")
1111
1212
1313 func keyUserSpentOnLevel (address) = (address + "_spentOnLevel")
1414
1515
1616 func keyUserSkillResetTimes (address) = (address + "_skillsResetTimes")
1717
1818
1919 func keyUserSpentOnReset (address) = (address + "_spentOnReset")
2020
2121
2222 func tryGetInteger (key) = match getInteger(this, key) {
2323 case b: Int =>
2424 b
2525 case _ =>
2626 0
2727 }
2828
2929
3030 func tryGetStringExternal (address,key) = match getString(address, key) {
3131 case a: String =>
3232 a
3333 case _ =>
3434 ""
3535 }
3636
3737
3838 func tryGetString (key) = tryGetStringExternal(this, key)
3939
4040
4141 func getOracle () = Address(fromBase58String(tryGetString("static_oracleAddress")))
4242
4343
4444 func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), "static_eggAssetId"))
4545
4646
47-func calculateLevelUp (currentLevel) = {
48- let p1 = pow(START_PRICE, 8, (10000 / currentLevel), 4, 8, CEILING)
49- let p2 = pow(currentLevel, 0, (10000 / QUOTIENT), 4, 8, CEILING)
47+func calculateLevelUp (futureLevel) = {
48+ let p1 = pow(START_PRICE, 8, (10000 / futureLevel), 4, 8, CEILING)
49+ let p2 = pow(futureLevel, 0, (10000 / QUOTIENT), 4, 8, CEILING)
5050 let total = fraction(p1, p2, DECIMALS)
51- let debug = makeString([("level=" + toString(currentLevel)), ("p1=" + toString(p1)), ("p2=" + toString(p2)), ("total=" + toString(total))], ";")
51+ let debug = makeString([("newLevel=" + toString(futureLevel)), ("p1=" + toString(p1)), ("p2=" + toString(p2)), ("total=" + toString(total))], ";")
5252 $Tuple2([StringEntry("DEBUG", debug)], total)
5353 }
5454
5555
5656 func calculateReset (currentLevel,resetTimes) = {
5757 let DEVIDER = 4
5858 let resetTimesToUse = (resetTimes + 1)
5959 let result = fraction(resetTimesToUse, (currentLevel * DECIMALS), DEVIDER)
6060 let debug = makeString([("level=" + toString(currentLevel)), ("resetTimes=" + toString(resetTimes)), ("resetTimesToUse=" + toString(resetTimesToUse)), ("result=" + toString(result))], ";")
6161 $Tuple2([StringEntry("DEBUG", debug)], result)
6262 }
6363
6464
6565 @Callable(i)
6666 func configureOracle (oracle) = if ((i.caller != this))
6767 then throw("RCO: admin only")
6868 else [StringEntry("static_oracleAddress", oracle)]
6969
7070
7171
7272 @Callable(i)
73-func levelUpMath (currentLevel) = calculateLevelUp(currentLevel)
73+func levelUpMath (futureLevel) = calculateLevelUp(futureLevel)
7474
7575
7676
7777 @Callable(i)
7878 func resetSkillsMath (currentLevel,resetTimes) = calculateReset(currentLevel, resetTimes)
7979
8080
8181
8282 @Callable(i)
8383 func levelUp () = {
8484 let keyUserAddressFilled = keyUserAddress(toString(i.caller))
8585 let keyUserSpentOnLevelFilled = keyUserSpentOnLevel(toString(i.caller))
8686 let levelOfUser = tryGetInteger(keyUserAddressFilled)
8787 let totalSpentUser = tryGetInteger(keyUserSpentOnLevelFilled)
88- let priceCalc = calculateLevelUp(levelOfUser)
88+ let priceCalc = calculateLevelUp((levelOfUser + 1))
8989 let price = priceCalc._2
9090 let firstPayment = value(i.payments[0])
9191 let amount = firstPayment.amount
9292 if ((firstPayment.assetId != getEggAssetId()))
9393 then throw(("LLU: You can attach only EGG tokens with the following asset id: " + toBase58String(getEggAssetId())))
9494 else if ((amount != price))
9595 then throw(("LLU: Please attach the exact asset amount" + toString(price)))
9696 else ([IntegerEntry(keyUserAddressFilled, (levelOfUser + 1)), IntegerEntry(keyUserSpentOnLevelFilled, (totalSpentUser + amount))] ++ priceCalc._1)
9797 }
9898
9999
100100
101101 @Callable(i)
102102 func reset () = {
103103 let keyUserAddressFilled = keyUserAddress(toString(i.caller))
104104 let levelOfUser = tryGetInteger(keyUserAddressFilled)
105105 let keyUserSkillResetTimesFilled = keyUserSkillResetTimes(toString(i.caller))
106106 let resetsOfUser = tryGetInteger(keyUserSkillResetTimesFilled)
107107 let keyUserSpentOnResetFilled = keyUserSpentOnReset(toString(i.caller))
108108 let amountOfSpendOnReset = tryGetInteger(keyUserSpentOnResetFilled)
109109 let calculateResetCalculated = calculateReset(levelOfUser, resetsOfUser)
110110 let price = calculateResetCalculated._2
111111 let firstPayment = value(i.payments[0])
112112 let amount = firstPayment.amount
113113 if ((firstPayment.assetId != getEggAssetId()))
114114 then throw(("LR: You can attach only EGG tokens with the following asset id: " + toBase58String(getEggAssetId())))
115115 else if ((amount != price))
116116 then throw(("LR: Please attach the exact asset amount" + toString(price)))
117117 else ([IntegerEntry(keyUserSkillResetTimesFilled, (resetsOfUser + 1)), IntegerEntry(keyUserSpentOnResetFilled, (amountOfSpendOnReset + amount))] ++ calculateResetCalculated._1)
118118 }
119119
120120

github/deemru/w8io/fabc49c 
41.72 ms