tx · Di5CWbCqwbXZRkVmouMKnvWxM2aBCpGgnib3564CTmBe

3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4:  -0.05000000 Waves

2022.06.07 03:32 [2085220] smart account 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4 > SELF 0.00000000 Waves

{ "type": 13, "id": "Di5CWbCqwbXZRkVmouMKnvWxM2aBCpGgnib3564CTmBe", "fee": 5000000, "feeAssetId": null, "timestamp": 1654561950223, "version": 2, "chainId": 84, "sender": "3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4", "senderPublicKey": "5nJ4v4Wx6sdXhiDZNrpW7m1aSDsTgTgFJVBgmPMPtbUM", "proofs": [ "CJz8pJTg51LE15ixhBZKBp5qWDrLBfLVwrfYJ6iuEvDXN9h5Wn5ze8Fj2Vsu5W8VwWZL93UXDahb9dT8G1asKym" ], "script": "base64:AAIFAAAAAAAAACMIAhIFCgMICAESBgoECAgBARIGCgQICAEBEgMKAQgSAwoBCAAAABUAAAAABnN0YWtlcgIAAAAGc3Rha2VyAAAAAAVhZG1pbgIAAAAGYWRtaW5fAAAAAAthc3NldElkQ2FsbAIAAAAIQXNzZXQgSUQAAAAACmVudHJ5SW5kZXgCAAAADF9FbnRyeV9JbmRleAEAAAAEZ2V0SQAAAAEAAAADa2V5CQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAEZ2V0UwAAAAEAAAADa2V5CQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAFZ2V0SVYAAAABAAAAA2tleQkBAAAABXZhbHVlAAAAAQkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkBAAAABWdldFNWAAAAAQAAAANrZXkJAQAAAAV2YWx1ZQAAAAEJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAd0aHJvd0lmAAAAAgAAAAljb25kaXRpb24AAAAFZXJyb3IDBQAAAAljb25kaXRpb24JAAACAAAAAQUAAAAFZXJyb3IGAAAAABR0aGlydHlEYXlz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AADcnVuCQAD/AAAAAQJAQAAAAdBZGRyZXNzAAAAAQUAAAANc3Rha2VyQWRkcmVzcwIAAAATX2dldEFzc2V0SWRCeVRpY2tlcgkABEwAAAACBQAAAAtBc3NldFRpY2tlcgUAAAADbmlsBQAAAANuaWwEAAAAByRtYXRjaDAFAAAAA3J1bgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAC2Fzc2V0SWRDYWxsBQAAAAFhBQAAAANuaWwFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAb6ygog==", "height": 2085220, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BdqtMbDCNtdJcdzZWkxnE5Nb9BAACt7T7o5g3u9JZYqf Next: BAUj1veMh3iKeynzKiTdzN7V8Ex7YpuTDm2Gu9A7RhqY Diff:
OldNewDifferences
66 let admin = "admin_"
77
88 let assetIdCall = "Asset ID"
9+
10+let entryIndex = "_Entry_Index"
911
1012 func getI (key) = getInteger(this, key)
1113
9799 }
98100
99101
102+func incrementEntryIndex (key) = {
103+ let uIndex = getI(key)
104+ if (isDefined(uIndex))
105+ then (value(uIndex) + 1)
106+ else 0
107+ }
108+
109+
110+@Callable(i)
111+func getAPYAmount (user,AssetTicker,AmountLocked) = {
112+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
113+ let uIndex = incrementEntryIndex(uEntryIndex)
114+ let uUser = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
115+ let uAPYAmount = valueOrErrorMessage(getI(uUser), ("APY not computed for " + user))
116+ $Tuple2(nil, uAPYAmount)
117+ }
118+
119+
120+
121+@Callable(i)
122+func storeAPYAmount (user,AssetTicker,AmountLocked,APYAmount) = {
123+ let check = adminOnly(i)
124+ if ((check == check))
125+ then {
126+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
127+ let uIndex = incrementEntryIndex(uEntryIndex)
128+ let uAPY = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
129+[writeConstInteger(uAPY, value(APYAmount))]
130+ }
131+ else throw("Strict value is not equal to itself.")
132+ }
133+
134+
135+
136+@Callable(i)
137+func deleteAPYAmount (user,AssetTicker,AmountLocked,APYAmount) = {
138+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
139+ let uIndex = incrementEntryIndex(uEntryIndex)
140+ let uAPY = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
141+[DeleteEntry(uAPY)]
142+ }
143+
144+
145+
100146 @Callable(i)
101147 func init (stakerAddress) = [writeConstString(staker, stakerAddress), writeConstString(admin, toBase58String(this.bytes))]
102148
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let staker = "staker"
55
66 let admin = "admin_"
77
88 let assetIdCall = "Asset ID"
9+
10+let entryIndex = "_Entry_Index"
911
1012 func getI (key) = getInteger(this, key)
1113
1214
1315 func getS (key) = getString(this, key)
1416
1517
1618 func getIV (key) = value(getInteger(this, key))
1719
1820
1921 func getSV (key) = value(getString(this, key))
2022
2123
2224 func throwIf (condition,error) = if (condition)
2325 then throw(error)
2426 else true
2527
2628
2729 let thirtyDaysLockPeriod = 30
2830
2931 let sixtyDaysLockPeriod = 60
3032
3133 let ninetyDaysLockPeriod = 90
3234
3335 func throwOrReturnI (val,error) = match val {
3436 case val: Int =>
3537 val
3638 case _ =>
3739 throw(error)
3840 }
3941
4042
4143 func throwOrReturnS (val,error) = match val {
4244 case val: String =>
4345 val
4446 case _ =>
4547 throw(error)
4648 }
4749
4850
4951 func writeInt (key,value) = if ((0 > value))
5052 then throw(((("writing negative value " + toString(value)) + " for key ") + key))
5153 else IntegerEntry(key, value)
5254
5355
5456 func writeStr (key,value) = if ((" " == value))
5557 then throw(("writing an empty string " + value))
5658 else StringEntry(key, value)
5759
5860
5961 func writeConstString (key,value) = if (!(isDefined(getS(key))))
6062 then writeStr(key, value)
6163 else throw(("already initialized: " + key))
6264
6365
6466 func writeConstInteger (key,value) = if (!(isDefined(getS(key))))
6567 then writeInt(key, value)
6668 else throw(("already initialized: " + key))
6769
6870
6971 func adminOnly (i) = {
7072 let inputAddress = toBase58String(i.caller.bytes)
7173 let otherAdmin = (admin + inputAddress)
7274 match getS(admin) {
7375 case a: String =>
7476 if ((inputAddress != getS(admin)))
7577 then throw("unauthorized")
7678 else true
7779 case _ =>
7880 match getS(otherAdmin) {
7981 case b: String =>
8082 if ((inputAddress != getS(otherAdmin)))
8183 then throw("unauthorized")
8284 else true
8385 case _ =>
8486 throw("unauthorizd")
8587 }
8688 }
8789 }
8890
8991
9092 func writeConfigValue (key,data) = match data {
9193 case data: String =>
9294 writeConstString(key, data)
9395 case data: Int =>
9496 writeConstInteger(key, data)
9597 case _ =>
9698 throw("unsupported config type")
9799 }
98100
99101
102+func incrementEntryIndex (key) = {
103+ let uIndex = getI(key)
104+ if (isDefined(uIndex))
105+ then (value(uIndex) + 1)
106+ else 0
107+ }
108+
109+
110+@Callable(i)
111+func getAPYAmount (user,AssetTicker,AmountLocked) = {
112+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
113+ let uIndex = incrementEntryIndex(uEntryIndex)
114+ let uUser = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
115+ let uAPYAmount = valueOrErrorMessage(getI(uUser), ("APY not computed for " + user))
116+ $Tuple2(nil, uAPYAmount)
117+ }
118+
119+
120+
121+@Callable(i)
122+func storeAPYAmount (user,AssetTicker,AmountLocked,APYAmount) = {
123+ let check = adminOnly(i)
124+ if ((check == check))
125+ then {
126+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
127+ let uIndex = incrementEntryIndex(uEntryIndex)
128+ let uAPY = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
129+[writeConstInteger(uAPY, value(APYAmount))]
130+ }
131+ else throw("Strict value is not equal to itself.")
132+ }
133+
134+
135+
136+@Callable(i)
137+func deleteAPYAmount (user,AssetTicker,AmountLocked,APYAmount) = {
138+ let uEntryIndex = ((((user + "_") + AssetTicker) + "_APY_") + entryIndex)
139+ let uIndex = incrementEntryIndex(uEntryIndex)
140+ let uAPY = (((((((((user + "_") + AssetTicker) + "_APY_Amount_") + "(") + toString(AmountLocked)) + AssetTicker) + ")") + "_") + toString(uIndex))
141+[DeleteEntry(uAPY)]
142+ }
143+
144+
145+
100146 @Callable(i)
101147 func init (stakerAddress) = [writeConstString(staker, stakerAddress), writeConstString(admin, toBase58String(this.bytes))]
102148
103149
104150
105151 @Callable(i)
106152 func getAssetIdByTicker (AssetTicker) = {
107153 let checks = adminOnly(i)
108154 if ((checks == checks))
109155 then {
110156 let stakerAddress = fromBase58String(getSV("staker"))
111157 let run = invoke(Address(stakerAddress), "_getAssetIdByTicker", [AssetTicker], nil)
112158 match run {
113159 case a: String =>
114160 [StringEntry(assetIdCall, a)]
115161 case _ =>
116162 nil
117163 }
118164 }
119165 else throw("Strict value is not equal to itself.")
120166 }
121167
122168

github/deemru/w8io/026f985 
30.32 ms