tx · Gq6g9kNamjcx57ZpyYzMm9swP53w7PdkmpudiZeMQVYW

3MuPFyxhwEW9APdW69TSSkmZZgEGZYYQ8K7:  -0.01000000 Waves

2021.11.12 13:39 [1787678] smart account 3MuPFyxhwEW9APdW69TSSkmZZgEGZYYQ8K7 > SELF 0.00000000 Waves

{ "type": 13, "id": "Gq6g9kNamjcx57ZpyYzMm9swP53w7PdkmpudiZeMQVYW", "fee": 1000000, "feeAssetId": null, "timestamp": 1636713766061, "version": 2, "chainId": 84, "sender": "3MuPFyxhwEW9APdW69TSSkmZZgEGZYYQ8K7", "senderPublicKey": "43iGb3SaGqe6VyayZiLjc91eHgtvf9upiUYF9wNsdqPE", "proofs": [ "4NdK9BnjVRpuNse4y3ZcfxEFfCex11D2hy4iUG7g6miTu2gFpuMNkiG1s5TtACDVemMP3ppRo7yeTxBh7sqnVehS" ], "script": "base64:AAIFAAAAAAAAABMIAhIAEgMKAQgSBAoCAQgSABIAAAAAHgAAAAAJa2V5QWN0aXZlAgAAAAZhY3RpdmUAAAAADGtleUVuZEhlaWdodAIAAAAKZW5kX2hlaWdodAAAAAAPa2V5UHJpemVzUHJpY2VzAgAAAA1wcml6ZXNfcHJpY2VzAAAAAAxrZXlQcml6ZXNJZHMCAAAACnByaXplc19pZHMAAAAAEGtleVByaXplc0Ftb3VudHMCAAAADXByaXplc19hbW91bnQAAAAADmtleUxldmVsUHJpY2VzAgAAAAxsZXZlbF9wcmljZXMAAAAAC2tleUxldmVsSWRzAgAAAAlsZXZlbF9pZHMAAAAACWtleVNXT1BpZAIAAAAHU1dPUF9pZAAAAAAOa2V5VG90YWxCdXJuZWQCAAAADHRvdGFsX2J1cm5lZAAAAAANa2V5VmVyaWZ5SGFzaAIAAAALdmVyaWZ5X2hhc2gAAAAAEWtleUZpbmFsaXplSGVpZ2h0AgAAAA9maW5hbGl6ZV9oZWlnaHQAAAAAEmtleVVzZXJUb3RhbEJ1cm5lZAIAAAANX3RvdGFsX2J1cm5lZAAAAAAGb3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Hpq+M=", "height": 1787678, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let keyActive = "active"
5+
6+let keyEndHeight = "end_height"
7+
8+let keyPrizesPrices = "prizes_prices"
9+
10+let keyPrizesIds = "prizes_ids"
11+
12+let keyPrizesAmounts = "prizes_amount"
13+
14+let keyLevelPrices = "level_prices"
15+
16+let keyLevelIds = "level_ids"
17+
18+let keySWOPid = "SWOP_id"
19+
20+let keyTotalBurned = "total_burned"
21+
22+let keyVerifyHash = "verify_hash"
23+
24+let keyFinalizeHeight = "finalize_height"
25+
26+let keyUserTotalBurned = "_total_burned"
27+
28+let oracle = Address(base58'3PEbqViERCoKnmcSULh6n2aiMvUdSQdCsom')
29+
30+let farming = Address(base58'3P73HDkPqG15nLXevjCbmXtazHYTZbpPoPw')
31+
32+let achievements = Address(base58'3PD88Svu91aKyBX1dnYVhkQyDXc8pg2EHFa')
33+
34+let keyAdminPubKey1 = "admin_pub_1"
35+
36+let keyAdminPubKey2 = "admin_pub_2"
37+
38+let keyAdminPubKey3 = "admin_pub_3"
39+
40+func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) {
41+ case string: String =>
42+ fromBase58String(string)
43+ case nothing =>
44+ throw("Admin public key is empty")
45+}
46+
47+
48+let adminPubKey1 = getAdminPub(keyAdminPubKey1)
49+
50+let adminPubKey2 = getAdminPub(keyAdminPubKey2)
51+
52+let adminPubKey3 = getAdminPub(keyAdminPubKey3)
53+
54+let adminPubKeyStaking = base58'Czn4yoAuUZCVCLJDRfskn8URfkwpknwBTZDbs1wFrY7h'
55+
56+let swopId = fromBase58String(getStringValue(farming, keySWOPid))
57+
58+let isActive = valueOrElse(getBoolean(this, keyActive), true)
59+
60+let totalBurned = valueOrElse(getInteger(this, keyTotalBurned), 0)
61+
62+func inListToStr (acc,next) = if ((acc == ""))
63+ then (acc + toString(next))
64+ else ((acc + ",") + toString(next))
65+
66+
67+func inListToInt (acc,next) = (acc :+ parseIntValue(next))
68+
69+
70+func calcPrizesAmounts (acc,next) = (acc :+ (totalBurned / next))
71+
72+
73+func calcLevel (burned) = {
74+ let levelPrices = {
75+ let $l = split(getStringValue(this, keyLevelPrices), ",")
76+ let $s = size($l)
77+ let $acc0 = nil
78+ func 1 ($a,$i) = if (($i >= $s))
79+ then $a
80+ else inListToInt($a, $l[$i])
81+
82+ func 2 ($a,$i) = if (($i >= $s))
83+ then $a
84+ else throw("List size exceeds 5")
85+
86+ 2(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5)
87+ }
88+ if ((levelPrices[3] >= burned))
89+ then 4
90+ else if ((levelPrices[2] >= burned))
91+ then 3
92+ else if ((levelPrices[1] >= burned))
93+ then 2
94+ else if ((levelPrices[0] >= burned))
95+ then 1
96+ else 0
97+ }
98+
99+
100+@Callable(i)
101+func add () = {
102+ let $t020992174 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
103+ let pmtAmount = $t020992174._1
104+ let pmtAssetId = $t020992174._2
105+[IntegerEntry(keyTotalBurned, (totalBurned + pmtAmount))]
106+ }
107+
108+
109+
110+@Callable(i)
111+func hashingRandom (hash) = if (!(isActive))
112+ then throw("DApp is inactive at this moment")
113+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
114+ then throw("Only admin can call this function")
115+ else [StringEntry(keyVerifyHash, hash)]
116+
117+
118+
119+@Callable(i)
120+func finalize (vrfHeight,secretWord) = {
121+ let savedHash = getStringValue(this, keyVerifyHash)
122+ let calcHash = toBase58String(sha256((toBytes(vrfHeight) + toBytes(secretWord))))
123+ if (!(isActive))
124+ then throw("DApp is inactive at this moment")
125+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
126+ then throw("Only admin can call this function")
127+ else if ((calcHash != savedHash))
128+ then throw("vrf Height hash not matching")
129+ else {
130+ let burnAmount = getIntegerValue(this, keyTotalBurned)
131+[Burn(swopId, burnAmount), IntegerEntry(keyFinalizeHeight, height)]
132+ }
133+ }
134+
135+
136+
137+@Callable(i)
138+func shutdown () = if (!(isActive))
139+ then throw("DApp already inactive")
140+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
141+ then throw("Only admin can call this function")
142+ else [BooleanEntry(keyActive, false)]
143+
144+
145+
146+@Callable(i)
147+func activate () = if (isActive)
148+ then throw("DApp already active")
149+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)))
150+ then throw("Only admin can call this function")
151+ else [BooleanEntry(keyActive, true)]
152+
153+
154+@Verifier(tx)
155+func verify () = true
156+

github/deemru/w8io/169f3d6 
34.32 ms