tx · HXEVaFZjVZVsCSUayqrGuySUdynyZZmHHc8LP4VP8eip

3Mz7AZHqAeMecF7aaE9HVsK94XVQKf1QCKg:  -0.01400000 Waves

2022.03.11 17:10 [1959386] smart account 3Mz7AZHqAeMecF7aaE9HVsK94XVQKf1QCKg > SELF 0.00000000 Waves

{ "type": 13, "id": "HXEVaFZjVZVsCSUayqrGuySUdynyZZmHHc8LP4VP8eip", "fee": 1400000, "feeAssetId": null, "timestamp": 1647007807933, "version": 1, "sender": "3Mz7AZHqAeMecF7aaE9HVsK94XVQKf1QCKg", "senderPublicKey": "9o6mYaNcbcTi647J8XhDQg2VsHJCv5Jon1QFPCbFPoFh", "proofs": [ "56yyFFA8frHqQRqVn4MALLricxH5Zxz5q7L7tYG8MaBa28JDH3bmZRmKZZaCivWzavb9ox2AgJsDYHqbaFbpRnk9" ], "script": "base64:AAIFAAAAAAAAABcIAhIFCgMBAQgSABIDCgEIEgMKAQgSAAAAABIBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAACXNlcGFyYXRvcgIAAAACX18BAAAAD2dldFN0cmluZ09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAKbWFuZGF0b3J5IAkABCUAAAABBQAAAAdhZGRyZXNzAgAAAAEuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAAAAAAIa2V5U3RhcnQJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAAAVzdGFydAUAAAADbmlsBQAAAAlzZXBhcmF0b3IAAAAAC2tleU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XJQdWJsaWNLZXlPclVuaXQAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAJwawUAAAAHJG1hdGNoMAUAAAACcGsDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA90YXJnZXRQdWJsaWNLZXmx4s+t", "chainId": 84, "height": 1959386, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BftZoJ9A1HJVoXugiK3WneSojGCKKXCpRGr318jUfmY6 Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func keyManagerPublicKey () = "%s__managerPublicKey"
55
66
77 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
88
99
1010 let separator = "__"
1111
1212 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
1313
1414
1515 let keyStart = makeString(["%s", "start"], separator)
1616
1717 let keyDuration = makeString(["%s", "duration"], separator)
1818
1919 let keyAsset = makeString(["%s", "asset"], separator)
2020
2121 let keyIsDataReady = makeString(["%s", "isDataReady"], separator)
2222
2323 func keyUserRewardInfo (address) = makeString(["%s%s", "userRewardInfo", toString(address)], separator)
2424
2525
2626 func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator)
2727
2828
2929 func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator)
3030
3131
3232 func dataUserRewardInfo (totalAmt,claimedAmt) = makeString(["%d%d", toString(totalAmt), toString(claimedAmt)], separator)
3333
3434
3535 func readUserRewardInfo (userAddr) = split(getStringOrFail(this, keyUserRewardInfo(userAddr)), separator)
3636
3737
3838 func checkIfDataIsReady () = {
3939 let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false)
4040 if (isDataReady)
4141 then true
4242 else throw("Data is not ready")
4343 }
4444
4545
4646 func getUserRewards (address) = {
4747 let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified")
4848 let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified")
4949 let userRewardInfo = readUserRewardInfo(address)
5050 let total = parseIntValue(userRewardInfo[1])
5151 let claimed = parseIntValue(userRewardInfo[2])
5252 let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration)
5353 let available = max([0, (availableTotal - claimed)])
5454 $Tuple3(total, claimed, available)
5555 }
5656
5757
5858 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
5959 case s: String =>
6060 fromBase58String(s)
6161 case _: Unit =>
6262 unit
6363 case _ =>
6464 throw("Match error")
6565 }
6666
6767
6868 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
6969 case s: String =>
7070 fromBase58String(s)
7171 case _: Unit =>
7272 unit
7373 case _ =>
7474 throw("Match error")
7575 }
7676
7777
7878 func mustManager (i) = {
7979 let pd = throw("Permission denied")
8080 match managerPublicKeyOrUnit() {
8181 case pk: ByteVector =>
8282 if ((i.callerPublicKey == pk))
8383 then true
8484 else pd
8585 case _: Unit =>
8686 if ((i.caller == this))
8787 then true
8888 else pd
8989 case _ =>
9090 throw("Match error")
9191 }
9292 }
9393
9494
9595 @Callable(i)
9696 func constructor (start,duration,assetId) = {
9797 let checkCaller = mustManager(i)
9898 if ((checkCaller == checkCaller))
9999 then [IntegerEntry(keyStart, start), IntegerEntry(keyDuration, duration), StringEntry(keyAsset, assetId), BooleanEntry(keyIsDataReady, false)]
100100 else throw("Strict value is not equal to itself.")
101101 }
102102
103103
104104
105105 @Callable(i)
106106 func claim () = {
107107 let $t030183077 = getUserRewards(i.caller)
108108 let total = $t030183077._1
109109 let claimed = $t030183077._2
110110 let available = $t030183077._3
111111 let asset = fromBase58String(getStringOrFail(this, keyAsset))
112112 let balance = assetBalance(this, asset)
113113 let checks = [checkIfDataIsReady(), if ((available > 0))
114114 then true
115115 else throw("No reward available"), if ((balance >= available))
116116 then true
117117 else throw("Insufficient funds. Contact support")]
118118 if ((checks == checks))
119119 then [ScriptTransfer(i.caller, available, asset), StringEntry(keyUserRewardInfo(i.caller), dataUserRewardInfo(total, (claimed + available))), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))]
120120 else throw("Strict value is not equal to itself.")
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func getUserRewardsREADONLY (address) = {
127127 let checks = [checkIfDataIsReady()]
128128 if ((checks == checks))
129129 then {
130130 let $t037563839 = getUserRewards(addressFromStringValue(address))
131131 let total = $t037563839._1
132132 let claimed = $t037563839._2
133133 let available = $t037563839._3
134134 $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator))
135135 }
136136 else throw("Strict value is not equal to itself.")
137137 }
138138
139139
140140
141141 @Callable(i)
142142 func setManager (pendingManagerPublicKey) = {
143143 let checkCaller = mustManager(i)
144144 if ((checkCaller == checkCaller))
145145 then {
146146 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
147147 if ((checkManagerPublicKey == checkManagerPublicKey))
148148 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
149149 else throw("Strict value is not equal to itself.")
150150 }
151151 else throw("Strict value is not equal to itself.")
152152 }
153153
154154
155155
156156 @Callable(i)
157157 func confirmManager () = {
158158 let pm = pendingManagerPublicKeyOrUnit()
159159 let hasPM = if (isDefined(pm))
160160 then true
161161 else throw("No pending manager")
162162 if ((hasPM == hasPM))
163163 then {
164164 let checkPM = if ((i.callerPublicKey == value(pm)))
165165 then true
166166 else throw("You are not pending manager")
167167 if ((checkPM == checkPM))
168168 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
169169 else throw("Strict value is not equal to itself.")
170170 }
171171 else throw("Strict value is not equal to itself.")
172172 }
173173
174174
175175 @Verifier(tx)
176176 func verify () = {
177177 let targetPublicKey = match managerPublicKeyOrUnit() {
178178 case pk: ByteVector =>
179179 pk
180180 case _: Unit =>
181181 tx.senderPublicKey
182182 case _ =>
183183 throw("Match error")
184184 }
185185 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
186186 }
187187

github/deemru/w8io/169f3d6 
38.92 ms