tx · 6iMHavscDYT1uv5PncfW99MvxNABQqhdJrK4XiQGg6T4

3MqV2hxYA4F3eyVzMPfpPXkmvQMVjhWJ2Zz:  -0.01400000 Waves

2022.05.10 15:30 [2045570] smart account 3MqV2hxYA4F3eyVzMPfpPXkmvQMVjhWJ2Zz > SELF 0.00000000 Waves

{ "type": 13, "id": "6iMHavscDYT1uv5PncfW99MvxNABQqhdJrK4XiQGg6T4", "fee": 1400000, "feeAssetId": null, "timestamp": 1652185843124, "version": 1, "sender": "3MqV2hxYA4F3eyVzMPfpPXkmvQMVjhWJ2Zz", "senderPublicKey": "E7cYpzqL1fF9VQjL3m4zr3xXfV289rCkrfE2fJyAHMqR", "proofs": [ "67KKA6uLumjgkiwBU7HD1a5cSRT7qyL9c5Z3WtRo2VGkFx6RFdxnoprXwDLBDM1XR3EDTHYeadMY9MGgjoHxKMBp" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASBAoCCAESAwoBCBIDCgEIEgASAwoBCBIDCgEIEgMKAQgSAAAAABYAAAAAA1NFUAIAAAACX18BAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAAAAB2tleVVzZXIAAAABAAAAB2FkZHJlc3MJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAKa2V5UmV2b2tlZAAAAAEAAAAHYWRkcmVzcwkABLkAAAACCQAETAAAAAICAAAABCVzJXMJAARMAAAAAgIAAAAHcmV2b2tlZAkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAPa2V5UmV2b2tlZFRvdGFsAAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAADHJldm9rZW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AC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5JjZFUA==", "chainId": 84, "height": 2045570, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2N7vhN6jBWpR38ucttgJjCUxjp2TsfVz17HD1iPN8nCr Next: 9yS2XqdA2CSaP83fdiEnXmLdKDuMuwtToZQYyBcSvyHr Diff:
OldNewDifferences
1212 func keyUser (address) = makeString(["%s", address], SEP)
1313
1414
15-func keyRevoked (address) = makeString(["%s", "revoked", address], SEP)
15+func keyRevoked (address) = makeString(["%s%s", "revoked", address], SEP)
1616
1717
18-func keyUserVestingStart (address) = makeString(["%s", "vestingStart", address], SEP)
18+func keyRevokedTotal () = makeString(["%s", "revokedTotal"], SEP)
1919
2020
21-func keyUserVestingEnd (address) = makeString(["%s", "vestingEnd", address], SEP)
21+func keyUserVestingStart (address) = makeString(["%s%s", "vestingStart", address], SEP)
2222
2323
24-func keyUserAmountPerBlock (address) = makeString(["%s", "amountPerBlock", address], SEP)
24+func keyUserVestingEnd (address) = makeString(["%s%s", "vestingEnd", address], SEP)
25+
26+
27+func keyUserAmountPerBlock (address) = makeString(["%s%s", "amountPerBlock", address], SEP)
2528
2629
2730 func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP)
106109 }
107110
108111
112+func claimInternal (address) = {
113+ let addr = Address(value(fromBase58String(address)))
114+ let wx = fromBase58String(value(getString(keyWxAssetId())))
115+ let amount = availableToClaimNow(address)
116+ let ensureAmount = if ((amount != 0))
117+ then true
118+ else throwErr("nothing to claim")
119+ if ((ensureAmount == ensureAmount))
120+ then {
121+ let totalAmount = getUserTotalAmount(address)
122+ let remainingAmount = getUserRemainingAmount(address)
123+ let claimedWXAmount = getUserClaimedAmount(address)
124+ let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false)
125+ if (isRevokedUser)
126+ then [ScriptTransfer(addr, remainingAmount, wx), StringEntry(keyUser(address), valueUser(totalAmount, 0, (claimedWXAmount + remainingAmount), height))]
127+ else [ScriptTransfer(addr, amount, wx), StringEntry(keyUser(address), valueUser(totalAmount, (remainingAmount - amount), (claimedWXAmount + amount), height))]
128+ }
129+ else throw("Strict value is not equal to itself.")
130+ }
131+
132+
109133 @Callable(i)
110134 func constructor (wxAssetId) = {
111135 let check = mustManager(i)
117141
118142
119143 @Callable(i)
144+func withdrawRevoked () = {
145+ let amount = valueOrElse(getInteger(keyRevokedTotal()), 0)
146+ let wx = fromBase58String(value(getString(keyWxAssetId())))
147+ let checks = [mustManager(i), if ((amount > 0))
148+ then true
149+ else throwErr("revoked amount is zero, nothing to withdraw")]
150+ if ((checks == checks))
151+ then [ScriptTransfer(i.caller, amount, wx), IntegerEntry(keyRevokedTotal(), 0)]
152+ else throw("Strict value is not equal to itself.")
153+ }
154+
155+
156+
157+@Callable(i)
120158 func createDepositFor (address,blocksDuration) = {
159+ let amount = i.payments[0].amount
121160 let endHeight = (height + blocksDuration)
122- let amount = i.payments[0].amount
123161 let vestingLen = (endHeight - height)
124162 let amountPerBlock = (amount / vestingLen)
125163 let checks = [mustManager(i), if ((endHeight > height))
139177
140178
141179 @Callable(i)
142-func revokeDepositFor (address) = {
143- let checks = [mustManager(i), if ((getString(keyUser(address)) != unit))
144- then true
145- else throwErr("deposit for user is not exists")]
146- if ((checks == checks))
180+func increaseDepositFor (address) = {
181+ let availableToClaim = availableToClaimNow(address)
182+ let forceClaim = if ((availableToClaim > 0))
183+ then claimInternal(address)
184+ else unit
185+ if ((forceClaim == forceClaim))
147186 then {
148- let totalAmount = getUserTotalAmount(address)
149- let amount = availableToClaimNow(address)
150- let claimedWXAmount = getUserClaimedAmount(address)
151- let lastClaimedHeight = getUserLastClaimedHeight(address)
152-[BooleanEntry(keyRevoked(address), true), StringEntry(keyUser(address), valueUser(totalAmount, amount, claimedWXAmount, lastClaimedHeight))]
187+ let amount = i.payments[0].amount
188+ let endHeight = value(getInteger(keyUserVestingEnd(address)))
189+ let vestingLen = (endHeight - height)
190+ let amountPerBlock = value(getInteger(keyUserAmountPerBlock(address)))
191+ let incAmountPerBlock = (amount / vestingLen)
192+ let userTotalAmount = getUserTotalAmount(address)
193+ let userRemainingAmount = getUserRemainingAmount(address)
194+ let userClaimedAmount = getUserClaimedAmount(address)
195+ let userLastClaimedHeight = getUserLastClaimedHeight(address)
196+ let checks = [mustManager(i), if ((valueOrElse(getBoolean(keyRevoked(address)), false) == false))
197+ then true
198+ else throwErr("deposit for user is revoked"), if ((getString(keyUser(address)) != unit))
199+ then true
200+ else throwErr("deposit for user doesn't exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId()))))
201+ then true
202+ else throwErr("attached payment is not WX"), if ((incAmountPerBlock != 0))
203+ then true
204+ else throwErr("attached amount too small — increase is zero per block")]
205+ if ((checks == checks))
206+ then [StringEntry(keyUser(address), valueUser((userTotalAmount + amount), (userRemainingAmount + amount), userClaimedAmount, userLastClaimedHeight)), IntegerEntry(keyUserAmountPerBlock(address), (amountPerBlock + incAmountPerBlock))]
207+ else throw("Strict value is not equal to itself.")
153208 }
154209 else throw("Strict value is not equal to itself.")
155210 }
157212
158213
159214 @Callable(i)
160-func claim () = {
161- let addr = i.caller
162- let addrStr = toString(addr)
163- let wx = fromBase58String(value(getString(keyWxAssetId())))
164- let amount = availableToClaimNow(addrStr)
165- let ensureAmount = if ((amount != 0))
215+func revokeDepositFor (address) = {
216+ let totalAmount = getUserTotalAmount(address)
217+ let remainingAmount = getUserRemainingAmount(address)
218+ let claimedWXAmount = getUserClaimedAmount(address)
219+ let lastClaimedHeight = getUserLastClaimedHeight(address)
220+ let unclaimedAmountNow = availableToClaimNow(address)
221+ let revokedTotal = valueOrElse(getInteger(keyRevokedTotal()), 0)
222+ let amountToRevoke = (remainingAmount - unclaimedAmountNow)
223+ let newRevokedTotal = (revokedTotal + amountToRevoke)
224+ let checks = [mustManager(i), if ((getString(keyUser(address)) != unit))
166225 then true
167- else throwErr("nothing to claim")
168- if ((ensureAmount == ensureAmount))
169- then {
170- let totalAmount = getUserTotalAmount(addrStr)
171- let remainingAmount = getUserRemainingAmount(addrStr)
172- let claimedWXAmount = getUserClaimedAmount(addrStr)
173- let isRevokedUser = valueOrElse(getBoolean(keyRevoked(addrStr)), false)
174- if (isRevokedUser)
175- then [ScriptTransfer(addr, remainingAmount, wx), StringEntry(keyUser(addrStr), valueUser(totalAmount, 0, (claimedWXAmount + remainingAmount), height))]
176- else [ScriptTransfer(addr, amount, wx), StringEntry(keyUser(addrStr), valueUser(totalAmount, (remainingAmount - amount), (claimedWXAmount + amount), height))]
177- }
226+ else throwErr("deposit for user is not exists"), if ((newRevokedTotal > revokedTotal))
227+ then true
228+ else throwErr("newRevokedTotal can't be less or equal than revokedTotal")]
229+ if ((checks == checks))
230+ then [BooleanEntry(keyRevoked(address), true), IntegerEntry(keyRevokedTotal(), newRevokedTotal), StringEntry(keyUser(address), valueUser(totalAmount, unclaimedAmountNow, claimedWXAmount, lastClaimedHeight))]
178231 else throw("Strict value is not equal to itself.")
179232 }
233+
234+
235+
236+@Callable(i)
237+func claim () = claimInternal(toBase58String(i.caller.bytes))
180238
181239
182240
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func keyManagerPublicKey () = "%s__managerPublicKey"
77
88
99 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
1010
1111
1212 func keyUser (address) = makeString(["%s", address], SEP)
1313
1414
15-func keyRevoked (address) = makeString(["%s", "revoked", address], SEP)
15+func keyRevoked (address) = makeString(["%s%s", "revoked", address], SEP)
1616
1717
18-func keyUserVestingStart (address) = makeString(["%s", "vestingStart", address], SEP)
18+func keyRevokedTotal () = makeString(["%s", "revokedTotal"], SEP)
1919
2020
21-func keyUserVestingEnd (address) = makeString(["%s", "vestingEnd", address], SEP)
21+func keyUserVestingStart (address) = makeString(["%s%s", "vestingStart", address], SEP)
2222
2323
24-func keyUserAmountPerBlock (address) = makeString(["%s", "amountPerBlock", address], SEP)
24+func keyUserVestingEnd (address) = makeString(["%s%s", "vestingEnd", address], SEP)
25+
26+
27+func keyUserAmountPerBlock (address) = makeString(["%s%s", "amountPerBlock", address], SEP)
2528
2629
2730 func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP)
2831
2932
3033 func throwErr (msg) = throw(makeString(["vesting.ride:", msg], " "))
3134
3235
3336 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
3437 case s: String =>
3538 fromBase58String(s)
3639 case _: Unit =>
3740 unit
3841 case _ =>
3942 throw("Match error")
4043 }
4144
4245
4346 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
4447 case s: String =>
4548 fromBase58String(s)
4649 case _: Unit =>
4750 unit
4851 case _ =>
4952 throw("Match error")
5053 }
5154
5255
5356 func mustManager (i) = {
5457 let pd = throwErr("permission denied")
5558 match managerPublicKeyOrUnit() {
5659 case pk: ByteVector =>
5760 if ((i.callerPublicKey == pk))
5861 then true
5962 else pd
6063 case _: Unit =>
6164 if ((i.caller == this))
6265 then true
6366 else pd
6467 case _ =>
6568 throw("Match error")
6669 }
6770 }
6871
6972
7073 func valueUserS (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, "0", claimedWXAmount, lastClaimedHeight], SEP)
7174
7275
7376 func valueUser (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = valueUserS(toString(totalAmount), toString(remainingAmount), toString(claimedWXAmount), toString(lastClaimedHeight))
7477
7578
7679 func getUserTotalAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[1])
7780
7881
7982 func getUserRemainingAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[2])
8083
8184
8285 func getUserClaimedAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[3])
8386
8487
8588 func getUserLastClaimedHeight (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[5])
8689
8790
8891 func availableToClaimNow (address) = {
8992 let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false)
9093 if (isRevokedUser)
9194 then getUserRemainingAmount(address)
9295 else {
9396 let lastHeight = getUserLastClaimedHeight(address)
9497 if ((lastHeight >= height))
9598 then 0
9699 else {
97100 let end = value(getInteger(keyUserVestingEnd(address)))
98101 if ((height > end))
99102 then getUserRemainingAmount(address)
100103 else {
101104 let unclaimedPeriod = (height - lastHeight)
102105 (value(getInteger(keyUserAmountPerBlock(address))) * unclaimedPeriod)
103106 }
104107 }
105108 }
106109 }
107110
108111
112+func claimInternal (address) = {
113+ let addr = Address(value(fromBase58String(address)))
114+ let wx = fromBase58String(value(getString(keyWxAssetId())))
115+ let amount = availableToClaimNow(address)
116+ let ensureAmount = if ((amount != 0))
117+ then true
118+ else throwErr("nothing to claim")
119+ if ((ensureAmount == ensureAmount))
120+ then {
121+ let totalAmount = getUserTotalAmount(address)
122+ let remainingAmount = getUserRemainingAmount(address)
123+ let claimedWXAmount = getUserClaimedAmount(address)
124+ let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false)
125+ if (isRevokedUser)
126+ then [ScriptTransfer(addr, remainingAmount, wx), StringEntry(keyUser(address), valueUser(totalAmount, 0, (claimedWXAmount + remainingAmount), height))]
127+ else [ScriptTransfer(addr, amount, wx), StringEntry(keyUser(address), valueUser(totalAmount, (remainingAmount - amount), (claimedWXAmount + amount), height))]
128+ }
129+ else throw("Strict value is not equal to itself.")
130+ }
131+
132+
109133 @Callable(i)
110134 func constructor (wxAssetId) = {
111135 let check = mustManager(i)
112136 if ((check == check))
113137 then [StringEntry(keyWxAssetId(), wxAssetId)]
114138 else throw("Strict value is not equal to itself.")
115139 }
116140
117141
118142
119143 @Callable(i)
144+func withdrawRevoked () = {
145+ let amount = valueOrElse(getInteger(keyRevokedTotal()), 0)
146+ let wx = fromBase58String(value(getString(keyWxAssetId())))
147+ let checks = [mustManager(i), if ((amount > 0))
148+ then true
149+ else throwErr("revoked amount is zero, nothing to withdraw")]
150+ if ((checks == checks))
151+ then [ScriptTransfer(i.caller, amount, wx), IntegerEntry(keyRevokedTotal(), 0)]
152+ else throw("Strict value is not equal to itself.")
153+ }
154+
155+
156+
157+@Callable(i)
120158 func createDepositFor (address,blocksDuration) = {
159+ let amount = i.payments[0].amount
121160 let endHeight = (height + blocksDuration)
122- let amount = i.payments[0].amount
123161 let vestingLen = (endHeight - height)
124162 let amountPerBlock = (amount / vestingLen)
125163 let checks = [mustManager(i), if ((endHeight > height))
126164 then true
127165 else throwErr("endHeight must be more than height"), if ((getString(keyUser(address)) == unit))
128166 then true
129167 else throwErr("deposit for user already exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId()))))
130168 then true
131169 else throwErr("attached payment is not WX"), if ((amountPerBlock != 0))
132170 then true
133171 else throwErr("attached amount too small or blocksDuration too large — will claimed zero per block")]
134172 if ((checks == checks))
135173 then [StringEntry(keyUser(address), valueUser(amount, amount, 0, height)), IntegerEntry(keyUserVestingStart(address), height), IntegerEntry(keyUserVestingEnd(address), endHeight), IntegerEntry(keyUserAmountPerBlock(address), amountPerBlock)]
136174 else throw("Strict value is not equal to itself.")
137175 }
138176
139177
140178
141179 @Callable(i)
142-func revokeDepositFor (address) = {
143- let checks = [mustManager(i), if ((getString(keyUser(address)) != unit))
144- then true
145- else throwErr("deposit for user is not exists")]
146- if ((checks == checks))
180+func increaseDepositFor (address) = {
181+ let availableToClaim = availableToClaimNow(address)
182+ let forceClaim = if ((availableToClaim > 0))
183+ then claimInternal(address)
184+ else unit
185+ if ((forceClaim == forceClaim))
147186 then {
148- let totalAmount = getUserTotalAmount(address)
149- let amount = availableToClaimNow(address)
150- let claimedWXAmount = getUserClaimedAmount(address)
151- let lastClaimedHeight = getUserLastClaimedHeight(address)
152-[BooleanEntry(keyRevoked(address), true), StringEntry(keyUser(address), valueUser(totalAmount, amount, claimedWXAmount, lastClaimedHeight))]
187+ let amount = i.payments[0].amount
188+ let endHeight = value(getInteger(keyUserVestingEnd(address)))
189+ let vestingLen = (endHeight - height)
190+ let amountPerBlock = value(getInteger(keyUserAmountPerBlock(address)))
191+ let incAmountPerBlock = (amount / vestingLen)
192+ let userTotalAmount = getUserTotalAmount(address)
193+ let userRemainingAmount = getUserRemainingAmount(address)
194+ let userClaimedAmount = getUserClaimedAmount(address)
195+ let userLastClaimedHeight = getUserLastClaimedHeight(address)
196+ let checks = [mustManager(i), if ((valueOrElse(getBoolean(keyRevoked(address)), false) == false))
197+ then true
198+ else throwErr("deposit for user is revoked"), if ((getString(keyUser(address)) != unit))
199+ then true
200+ else throwErr("deposit for user doesn't exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId()))))
201+ then true
202+ else throwErr("attached payment is not WX"), if ((incAmountPerBlock != 0))
203+ then true
204+ else throwErr("attached amount too small — increase is zero per block")]
205+ if ((checks == checks))
206+ then [StringEntry(keyUser(address), valueUser((userTotalAmount + amount), (userRemainingAmount + amount), userClaimedAmount, userLastClaimedHeight)), IntegerEntry(keyUserAmountPerBlock(address), (amountPerBlock + incAmountPerBlock))]
207+ else throw("Strict value is not equal to itself.")
153208 }
154209 else throw("Strict value is not equal to itself.")
155210 }
156211
157212
158213
159214 @Callable(i)
160-func claim () = {
161- let addr = i.caller
162- let addrStr = toString(addr)
163- let wx = fromBase58String(value(getString(keyWxAssetId())))
164- let amount = availableToClaimNow(addrStr)
165- let ensureAmount = if ((amount != 0))
215+func revokeDepositFor (address) = {
216+ let totalAmount = getUserTotalAmount(address)
217+ let remainingAmount = getUserRemainingAmount(address)
218+ let claimedWXAmount = getUserClaimedAmount(address)
219+ let lastClaimedHeight = getUserLastClaimedHeight(address)
220+ let unclaimedAmountNow = availableToClaimNow(address)
221+ let revokedTotal = valueOrElse(getInteger(keyRevokedTotal()), 0)
222+ let amountToRevoke = (remainingAmount - unclaimedAmountNow)
223+ let newRevokedTotal = (revokedTotal + amountToRevoke)
224+ let checks = [mustManager(i), if ((getString(keyUser(address)) != unit))
166225 then true
167- else throwErr("nothing to claim")
168- if ((ensureAmount == ensureAmount))
169- then {
170- let totalAmount = getUserTotalAmount(addrStr)
171- let remainingAmount = getUserRemainingAmount(addrStr)
172- let claimedWXAmount = getUserClaimedAmount(addrStr)
173- let isRevokedUser = valueOrElse(getBoolean(keyRevoked(addrStr)), false)
174- if (isRevokedUser)
175- then [ScriptTransfer(addr, remainingAmount, wx), StringEntry(keyUser(addrStr), valueUser(totalAmount, 0, (claimedWXAmount + remainingAmount), height))]
176- else [ScriptTransfer(addr, amount, wx), StringEntry(keyUser(addrStr), valueUser(totalAmount, (remainingAmount - amount), (claimedWXAmount + amount), height))]
177- }
226+ else throwErr("deposit for user is not exists"), if ((newRevokedTotal > revokedTotal))
227+ then true
228+ else throwErr("newRevokedTotal can't be less or equal than revokedTotal")]
229+ if ((checks == checks))
230+ then [BooleanEntry(keyRevoked(address), true), IntegerEntry(keyRevokedTotal(), newRevokedTotal), StringEntry(keyUser(address), valueUser(totalAmount, unclaimedAmountNow, claimedWXAmount, lastClaimedHeight))]
178231 else throw("Strict value is not equal to itself.")
179232 }
233+
234+
235+
236+@Callable(i)
237+func claim () = claimInternal(toBase58String(i.caller.bytes))
180238
181239
182240
183241 @Callable(i)
184242 func claimREADONLY (address) = {
185243 let amount = availableToClaimNow(address)
186244 $Tuple2(nil, amount)
187245 }
188246
189247
190248
191249 @Callable(i)
192250 func stats (address) = $Tuple2(nil, [value(getInteger(keyUserVestingStart(address))), value(getInteger(keyUserVestingEnd(address))), getUserTotalAmount(address), getUserClaimedAmount(address), getUserRemainingAmount(address), availableToClaimNow(address)])
193251
194252
195253
196254 @Callable(i)
197255 func setManager (pendingManagerPublicKey) = {
198256 let checkCaller = mustManager(i)
199257 if ((checkCaller == checkCaller))
200258 then {
201259 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
202260 if ((checkManagerPublicKey == checkManagerPublicKey))
203261 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
204262 else throw("Strict value is not equal to itself.")
205263 }
206264 else throw("Strict value is not equal to itself.")
207265 }
208266
209267
210268
211269 @Callable(i)
212270 func confirmManager () = {
213271 let pm = pendingManagerPublicKeyOrUnit()
214272 let hasPM = if (isDefined(pm))
215273 then true
216274 else throwErr("no pending manager")
217275 if ((hasPM == hasPM))
218276 then {
219277 let checkPM = if ((i.callerPublicKey == value(pm)))
220278 then true
221279 else throwErr("you are not pending manager")
222280 if ((checkPM == checkPM))
223281 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
224282 else throw("Strict value is not equal to itself.")
225283 }
226284 else throw("Strict value is not equal to itself.")
227285 }
228286
229287
230288 @Verifier(tx)
231289 func verify () = {
232290 let targetPublicKey = match managerPublicKeyOrUnit() {
233291 case pk: ByteVector =>
234292 pk
235293 case _: Unit =>
236294 tx.senderPublicKey
237295 case _ =>
238296 throw("Match error")
239297 }
240298 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
241299 }
242300

github/deemru/w8io/026f985 
58.04 ms