tx · 81FfyMfwhifgSh933ZGAbRCsjJ3QEXURjpddssyUtyM4

3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv:  -0.00400000 Waves

2024.09.01 21:13 [3264839] smart account 3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv > SELF 0.00000000 Waves

{ "type": 13, "id": "81FfyMfwhifgSh933ZGAbRCsjJ3QEXURjpddssyUtyM4", "fee": 400000, "feeAssetId": null, "timestamp": 1725214411296, "version": 2, "chainId": 84, "sender": "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv", "senderPublicKey": "2fNSk5gmWbXBDTkSYSKd66xSgVvAYzrJnP9YSAFNvTwC", "proofs": [ "dcjpyDmWxAufvgKzrGCQUen8EFTorXf69PARVESqRVhENcCQqMWvToygCo1aS2nYjT7CDJ62HLVuTps8m8rkB5D" ], "script": "base64:BgIMCAISAwoBGBIDCgEIGwADU0VQAgJfXwAFTVVMVDgAgMLXLwAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAFWRlZmF1bHRSZXN0QWRkcmVzc1N0cgQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAIFM1AuLi4DCQAAAgEBVAUHJG1hdGNoMAIFM00uLi4JAAIBAg1Vbmtub3duIGNoYWluAQ9nZXRTdHJpbmdPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUHYWRkcmVzcwUDa2V5CQC5CQIJAMwIAgIKbWFuZGF0b3J5IAkAzAgCCQClCAEFB2FkZHJlc3MJAMwIAgIBLgkAzAgCBQNrZXkJAMwIAgIPIGlzIG5vdCBkZWZpbmVkBQNuaWwCAAAPSWR4Q2ZnQWNyZXNEYXBwAAEADUlkeENmZ1dsZ0RhcHAAAgEKa2V5UmVzdENmZwACDiVzX19yZXN0Q29uZmlnAQ5rZXlSZXN0QWRkcmVzcwACDCVzX19yZXN0QWRkcgERcmVhZFJlc3RDZmdPckZhaWwBBH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AAkAuQkCCQDMCAIFBWRlc2NyBQljb250cmFjdHMFA1NFUAkAzAgCCQELU3RyaW5nRW50cnkCCQEOa2V5UmVzdEFkZHJlc3MACQClCAEFBHRoaXMFA25pbAFpARJ3YWxsZXRJbmZvUkVBRE9OTFkBDnVzZXJBZGRyZXNzT3B0CQCUCgIFA25pbAkBDndhbGxldEludGVybmFsAQUOdXNlckFkZHJlc3NPcHQAAwirlw==", "height": 3264839, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: Cn4jbpdfoMf4rZ8MCxmeN4ym3gbS74XA2CTzkuFiuRWK Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+let MULT8 = 100000000
7+
8+let chain = take(drop(this.bytes, 1), 1)
9+
10+let defaultRestAddressStr = match chain {
11+ case _ =>
12+ if ((base58'2W' == $match0))
13+ then "3P..."
14+ else if ((base58'2T' == $match0))
15+ then "3M..."
16+ else throw("Unknown chain")
17+}
18+
19+func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
20+
21+
22+let IdxCfgAcresDapp = 1
23+
24+let IdxCfgWlgDapp = 2
25+
26+func keyRestCfg () = "%s__restConfig"
27+
28+
29+func keyRestAddress () = "%s__restAddr"
30+
31+
32+func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
33+
34+
35+func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
36+
37+
38+let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
39+
40+let restCfg = readRestCfgOrFail(restContract)
41+
42+let stakingContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp)
43+
44+let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
45+
46+func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr)
47+
48+
49+let wlgAssetIdKey = "wlg_assetId"
50+
51+let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet")
52+
53+let acresAssetIdKey = "acresAssetId"
54+
55+let acresAssetId = valueOrErrorMessage(getBinary(stakingContract, acresAssetIdKey), "ACRES is not issued yet")
56+
57+let levels = [10, 20, 40, 80, 150, 250, 400, 700, 1000]
58+
59+func getLevelByAcres (acres) = {
60+ let acr = (acres / MULT8)
61+ func checker (acc,item) = if ((item > acr))
62+ then acc
63+ else (acc + 1)
64+
65+ let idx = {
66+ let $l = levels
67+ let $s = size($l)
68+ let $acc0 = 0
69+ func $f0_1 ($a,$i) = if (($i >= $s))
70+ then $a
71+ else checker($a, $l[$i])
72+
73+ func $f0_2 ($a,$i) = if (($i >= $s))
74+ then $a
75+ else throw("List size exceeds 10")
76+
77+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
78+ }
79+ (idx + 1)
80+ }
81+
82+
83+func keyAddressToCustomName (addr) = ("accountCustomNameByAddr_" + addr)
84+
85+
86+func keyAddressRefBy (addr) = ("accRefBy_" + addr)
87+
88+
89+func keyAddressReferrals (addr) = ("accReferrals_" + addr)
90+
91+
92+func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr)
93+
94+
95+func walletInternal (userAddressOpt) = {
96+ let addr = addressFromString(userAddressOpt)
97+ let balance = if (isDefined(addr))
98+ then wavesBalance(value(addr))
99+ else BalanceDetails(0, 0, 0, 0)
100+ let wlgoldBalance = if (isDefined(addr))
101+ then assetBalance(value(addr), wlgAssetId)
102+ else 0
103+ let customName = valueOrElse(getString(stakingContract, keyAddressToCustomName(userAddressOpt)), userAddressOpt)
104+ let refByKey = keyAddressRefBy(userAddressOpt)
105+ let refBy = getString(stakingContract, refByKey)
106+ let refs = valueOrElse(getString(stakingContract, keyAddressReferrals(userAddressOpt)), "")
107+ let lastTxId = valueOrElse(getString(stakingContract, keyLastTxIdByUser(userAddressOpt)), "")
108+ let acresBalance = if (isDefined(addr))
109+ then assetBalance(value(addr), acresAssetId)
110+ else 0
111+ let stakedAcres = valueOrElse(getInteger(stakingContract, keyAcresStakedAmountByUser(userAddressOpt)), 0)
112+ let lvl = getLevelByAcres(acresBalance)
113+[("%s%s__customName__" + customName), ("%s%s__referredBy__" + valueOrElse(refBy, "")), ("%s%s__referrals__" + refs), ("%s%s__lastTxId__" + lastTxId), ("%s%d__wavesBalance__" + toString(balance.available)), ("%s%d__wlgoldBalance__" + toString(wlgoldBalance)), ("%s%d__acresBalance__" + toString(acresBalance)), ("%s%d__stakedAcres__" + toString(stakedAcres)), ("%s%d__currentLvl__" + toString(lvl))]
114+ }
115+
116+
117+@Callable(i)
118+func constructorV1 (contracts) = if ((i.caller != this))
119+ then throw("permissions denied")
120+ else {
121+ func descriptor (acc,ignoredItem) = (acc + "%s")
122+
123+ let descr = {
124+ let $l = contracts
125+ let $s = size($l)
126+ let $acc0 = ""
127+ func $f0_1 ($a,$i) = if (($i >= $s))
128+ then $a
129+ else descriptor($a, $l[$i])
130+
131+ func $f0_2 ($a,$i) = if (($i >= $s))
132+ then $a
133+ else throw("List size exceeds 10")
134+
135+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
136+ }
137+[StringEntry(keyRestCfg(), makeString(descr :: contracts, SEP)), StringEntry(keyRestAddress(), toString(this))]
138+ }
139+
140+
141+
142+@Callable(i)
143+func walletInfoREADONLY (userAddressOpt) = $Tuple2(nil, walletInternal(userAddressOpt))
144+
145+

github/deemru/w8io/026f985 
16.69 ms