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:AAIFAAAAAAAAACwIAhIDCgEIEgASBAoCCAESAwoBCBIDCgEIEgASAwoBCBIDCgEIEgMKAQgSAAAAABYAAAAAA1NFUAIAAAACX18BAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAAAAB2tleVVzZXIAAAABAAAAB2FkZHJlc3MJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAKa2V5UmV2b2tlZAAAAAEAAAAHYWRkcmVzcwkABLkAAAACCQAETAAAAAICAAAABCVzJXMJAARMAAAAAgIAAAAHcmV2b2tlZAkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAPa2V5UmV2b2tlZFRvdGFsAAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAADHJldm9rZWR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C01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5JjZFUA==", "chainId": 84, "height": 2045570, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2N7vhN6jBWpR38ucttgJjCUxjp2TsfVz17HD1iPN8nCr Next: 9yS2XqdA2CSaP83fdiEnXmLdKDuMuwtToZQYyBcSvyHr Diff:
Old | New | Differences | |
---|---|---|---|
12 | 12 | func keyUser (address) = makeString(["%s", address], SEP) | |
13 | 13 | ||
14 | 14 | ||
15 | - | func keyRevoked (address) = makeString(["%s", "revoked", address], SEP) | |
15 | + | func keyRevoked (address) = makeString(["%s%s", "revoked", address], SEP) | |
16 | 16 | ||
17 | 17 | ||
18 | - | func | |
18 | + | func keyRevokedTotal () = makeString(["%s", "revokedTotal"], SEP) | |
19 | 19 | ||
20 | 20 | ||
21 | - | func | |
21 | + | func keyUserVestingStart (address) = makeString(["%s%s", "vestingStart", address], SEP) | |
22 | 22 | ||
23 | 23 | ||
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) | |
25 | 28 | ||
26 | 29 | ||
27 | 30 | func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP) | |
106 | 109 | } | |
107 | 110 | ||
108 | 111 | ||
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 | + | ||
109 | 133 | @Callable(i) | |
110 | 134 | func constructor (wxAssetId) = { | |
111 | 135 | let check = mustManager(i) | |
117 | 141 | ||
118 | 142 | ||
119 | 143 | @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) | |
120 | 158 | func createDepositFor (address,blocksDuration) = { | |
159 | + | let amount = i.payments[0].amount | |
121 | 160 | let endHeight = (height + blocksDuration) | |
122 | - | let amount = i.payments[0].amount | |
123 | 161 | let vestingLen = (endHeight - height) | |
124 | 162 | let amountPerBlock = (amount / vestingLen) | |
125 | 163 | let checks = [mustManager(i), if ((endHeight > height)) | |
139 | 177 | ||
140 | 178 | ||
141 | 179 | @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)) | |
147 | 186 | 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.") | |
153 | 208 | } | |
154 | 209 | else throw("Strict value is not equal to itself.") | |
155 | 210 | } | |
157 | 212 | ||
158 | 213 | ||
159 | 214 | @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)) | |
166 | 225 | 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))] | |
178 | 231 | else throw("Strict value is not equal to itself.") | |
179 | 232 | } | |
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | @Callable(i) | |
237 | + | func claim () = claimInternal(toBase58String(i.caller.bytes)) | |
180 | 238 | ||
181 | 239 | ||
182 | 240 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyUser (address) = makeString(["%s", address], SEP) | |
13 | 13 | ||
14 | 14 | ||
15 | - | func keyRevoked (address) = makeString(["%s", "revoked", address], SEP) | |
15 | + | func keyRevoked (address) = makeString(["%s%s", "revoked", address], SEP) | |
16 | 16 | ||
17 | 17 | ||
18 | - | func | |
18 | + | func keyRevokedTotal () = makeString(["%s", "revokedTotal"], SEP) | |
19 | 19 | ||
20 | 20 | ||
21 | - | func | |
21 | + | func keyUserVestingStart (address) = makeString(["%s%s", "vestingStart", address], SEP) | |
22 | 22 | ||
23 | 23 | ||
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) | |
25 | 28 | ||
26 | 29 | ||
27 | 30 | func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP) | |
28 | 31 | ||
29 | 32 | ||
30 | 33 | func throwErr (msg) = throw(makeString(["vesting.ride:", msg], " ")) | |
31 | 34 | ||
32 | 35 | ||
33 | 36 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
34 | 37 | case s: String => | |
35 | 38 | fromBase58String(s) | |
36 | 39 | case _: Unit => | |
37 | 40 | unit | |
38 | 41 | case _ => | |
39 | 42 | throw("Match error") | |
40 | 43 | } | |
41 | 44 | ||
42 | 45 | ||
43 | 46 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
44 | 47 | case s: String => | |
45 | 48 | fromBase58String(s) | |
46 | 49 | case _: Unit => | |
47 | 50 | unit | |
48 | 51 | case _ => | |
49 | 52 | throw("Match error") | |
50 | 53 | } | |
51 | 54 | ||
52 | 55 | ||
53 | 56 | func mustManager (i) = { | |
54 | 57 | let pd = throwErr("permission denied") | |
55 | 58 | match managerPublicKeyOrUnit() { | |
56 | 59 | case pk: ByteVector => | |
57 | 60 | if ((i.callerPublicKey == pk)) | |
58 | 61 | then true | |
59 | 62 | else pd | |
60 | 63 | case _: Unit => | |
61 | 64 | if ((i.caller == this)) | |
62 | 65 | then true | |
63 | 66 | else pd | |
64 | 67 | case _ => | |
65 | 68 | throw("Match error") | |
66 | 69 | } | |
67 | 70 | } | |
68 | 71 | ||
69 | 72 | ||
70 | 73 | func valueUserS (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, "0", claimedWXAmount, lastClaimedHeight], SEP) | |
71 | 74 | ||
72 | 75 | ||
73 | 76 | func valueUser (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = valueUserS(toString(totalAmount), toString(remainingAmount), toString(claimedWXAmount), toString(lastClaimedHeight)) | |
74 | 77 | ||
75 | 78 | ||
76 | 79 | func getUserTotalAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[1]) | |
77 | 80 | ||
78 | 81 | ||
79 | 82 | func getUserRemainingAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[2]) | |
80 | 83 | ||
81 | 84 | ||
82 | 85 | func getUserClaimedAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[3]) | |
83 | 86 | ||
84 | 87 | ||
85 | 88 | func getUserLastClaimedHeight (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[5]) | |
86 | 89 | ||
87 | 90 | ||
88 | 91 | func availableToClaimNow (address) = { | |
89 | 92 | let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false) | |
90 | 93 | if (isRevokedUser) | |
91 | 94 | then getUserRemainingAmount(address) | |
92 | 95 | else { | |
93 | 96 | let lastHeight = getUserLastClaimedHeight(address) | |
94 | 97 | if ((lastHeight >= height)) | |
95 | 98 | then 0 | |
96 | 99 | else { | |
97 | 100 | let end = value(getInteger(keyUserVestingEnd(address))) | |
98 | 101 | if ((height > end)) | |
99 | 102 | then getUserRemainingAmount(address) | |
100 | 103 | else { | |
101 | 104 | let unclaimedPeriod = (height - lastHeight) | |
102 | 105 | (value(getInteger(keyUserAmountPerBlock(address))) * unclaimedPeriod) | |
103 | 106 | } | |
104 | 107 | } | |
105 | 108 | } | |
106 | 109 | } | |
107 | 110 | ||
108 | 111 | ||
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 | + | ||
109 | 133 | @Callable(i) | |
110 | 134 | func constructor (wxAssetId) = { | |
111 | 135 | let check = mustManager(i) | |
112 | 136 | if ((check == check)) | |
113 | 137 | then [StringEntry(keyWxAssetId(), wxAssetId)] | |
114 | 138 | else throw("Strict value is not equal to itself.") | |
115 | 139 | } | |
116 | 140 | ||
117 | 141 | ||
118 | 142 | ||
119 | 143 | @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) | |
120 | 158 | func createDepositFor (address,blocksDuration) = { | |
159 | + | let amount = i.payments[0].amount | |
121 | 160 | let endHeight = (height + blocksDuration) | |
122 | - | let amount = i.payments[0].amount | |
123 | 161 | let vestingLen = (endHeight - height) | |
124 | 162 | let amountPerBlock = (amount / vestingLen) | |
125 | 163 | let checks = [mustManager(i), if ((endHeight > height)) | |
126 | 164 | then true | |
127 | 165 | else throwErr("endHeight must be more than height"), if ((getString(keyUser(address)) == unit)) | |
128 | 166 | then true | |
129 | 167 | else throwErr("deposit for user already exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId())))) | |
130 | 168 | then true | |
131 | 169 | else throwErr("attached payment is not WX"), if ((amountPerBlock != 0)) | |
132 | 170 | then true | |
133 | 171 | else throwErr("attached amount too small or blocksDuration too large — will claimed zero per block")] | |
134 | 172 | if ((checks == checks)) | |
135 | 173 | then [StringEntry(keyUser(address), valueUser(amount, amount, 0, height)), IntegerEntry(keyUserVestingStart(address), height), IntegerEntry(keyUserVestingEnd(address), endHeight), IntegerEntry(keyUserAmountPerBlock(address), amountPerBlock)] | |
136 | 174 | else throw("Strict value is not equal to itself.") | |
137 | 175 | } | |
138 | 176 | ||
139 | 177 | ||
140 | 178 | ||
141 | 179 | @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)) | |
147 | 186 | 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.") | |
153 | 208 | } | |
154 | 209 | else throw("Strict value is not equal to itself.") | |
155 | 210 | } | |
156 | 211 | ||
157 | 212 | ||
158 | 213 | ||
159 | 214 | @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)) | |
166 | 225 | 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))] | |
178 | 231 | else throw("Strict value is not equal to itself.") | |
179 | 232 | } | |
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | @Callable(i) | |
237 | + | func claim () = claimInternal(toBase58String(i.caller.bytes)) | |
180 | 238 | ||
181 | 239 | ||
182 | 240 | ||
183 | 241 | @Callable(i) | |
184 | 242 | func claimREADONLY (address) = { | |
185 | 243 | let amount = availableToClaimNow(address) | |
186 | 244 | $Tuple2(nil, amount) | |
187 | 245 | } | |
188 | 246 | ||
189 | 247 | ||
190 | 248 | ||
191 | 249 | @Callable(i) | |
192 | 250 | func stats (address) = $Tuple2(nil, [value(getInteger(keyUserVestingStart(address))), value(getInteger(keyUserVestingEnd(address))), getUserTotalAmount(address), getUserClaimedAmount(address), getUserRemainingAmount(address), availableToClaimNow(address)]) | |
193 | 251 | ||
194 | 252 | ||
195 | 253 | ||
196 | 254 | @Callable(i) | |
197 | 255 | func setManager (pendingManagerPublicKey) = { | |
198 | 256 | let checkCaller = mustManager(i) | |
199 | 257 | if ((checkCaller == checkCaller)) | |
200 | 258 | then { | |
201 | 259 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
202 | 260 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
203 | 261 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
204 | 262 | else throw("Strict value is not equal to itself.") | |
205 | 263 | } | |
206 | 264 | else throw("Strict value is not equal to itself.") | |
207 | 265 | } | |
208 | 266 | ||
209 | 267 | ||
210 | 268 | ||
211 | 269 | @Callable(i) | |
212 | 270 | func confirmManager () = { | |
213 | 271 | let pm = pendingManagerPublicKeyOrUnit() | |
214 | 272 | let hasPM = if (isDefined(pm)) | |
215 | 273 | then true | |
216 | 274 | else throwErr("no pending manager") | |
217 | 275 | if ((hasPM == hasPM)) | |
218 | 276 | then { | |
219 | 277 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
220 | 278 | then true | |
221 | 279 | else throwErr("you are not pending manager") | |
222 | 280 | if ((checkPM == checkPM)) | |
223 | 281 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
224 | 282 | else throw("Strict value is not equal to itself.") | |
225 | 283 | } | |
226 | 284 | else throw("Strict value is not equal to itself.") | |
227 | 285 | } | |
228 | 286 | ||
229 | 287 | ||
230 | 288 | @Verifier(tx) | |
231 | 289 | func verify () = { | |
232 | 290 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
233 | 291 | case pk: ByteVector => | |
234 | 292 | pk | |
235 | 293 | case _: Unit => | |
236 | 294 | tx.senderPublicKey | |
237 | 295 | case _ => | |
238 | 296 | throw("Match error") | |
239 | 297 | } | |
240 | 298 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
241 | 299 | } | |
242 | 300 |
github/deemru/w8io/026f985 58.04 ms ◑