tx · Cn926qYzCguhiwet5fkjp8W14KPi4eEL1QDpW6xiatLh

3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1:  -0.01000000 Waves

2024.01.09 14:17 [2923866] smart account 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1 > SELF 0.00000000 Waves

{ "type": 13, "id": "Cn926qYzCguhiwet5fkjp8W14KPi4eEL1QDpW6xiatLh", "fee": 1000000, "feeAssetId": null, "timestamp": 1704799071482, "version": 2, "chainId": 84, "sender": "3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1", "senderPublicKey": "7c3qLtcJ7EaPS2JDjXv8MBbd4kpyc6R27wcn5GgvZhur", "proofs": [ "6wHLPpNw4rnqjDv37bQY5qdaXraSE5X3S2sfBUWCsb3FxeJU6SHkyRCMHU8znc8ANqgmnfkcd9yxgWrR7ii9ee9" ], "script": "base64:BgIMCAISBgoECAEBARIAFQAMY29udHJhY3RGaWxlAhB2ZXN0aW5nX25lby5yaWRlAANTRVACAl9fAAhJRFNfTElTVAkAzAgCAAAJAMwIAgABCQDMCAIAAgkAzAgCAAMJAMwIAgAECQDMCAIABQkAzAgCAAYJAMwIAgAHCQDMCAIACAkAzAgCAAkJAMwIAgAKCQDMCAIACwkAzAgCAAwJAMwIAgANCQDMCAIADgkAzAgCAA8JAMwIAgAQCQDMCAIAEQkAzAgCABIJAMwIAgATCQDMCAIAFAkAzAgCABUJAMwIAgAWCQDMCAIAFwkAzAgCABgJAMwIAgAZCQDMCAIAGgkAzAgCABsJAMwIAgAcCQDMCAIAHQUDbmlsABFNQVhfVkVTVElOR19DT1VOVAkAkAMBBQhJRFNfTElTVAEIdGhyb3dFcnIBA21zZwkAAgEJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cACmtleUFzc2V0SWQJALkJAgkAzAgCAgIlcwkAzAgCAgdhc3NldElkBQNuaWwFA1NFUAANYXNzZXRJZFN0cmluZwkBC3ZhbHVlT3JFbHNlAgkAnQgCBQR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N0b3J5AwIGdmVzdGVkBQt1c2VyQWRkcmVzcwkA2AQBCAUBaQ10cmFuc2FjdGlvbklkBQ12ZXN0aW5nQW1vdW50BQNuaWwJAM4IAgkBFGdldE5ld1Zlc3RpbmdBY3Rpb25zBQULdXNlckFkZHJlc3MFAmlkBQ12ZXN0aW5nQW1vdW50BQpzdGFydEJsb2NrBQpsb2NrTGVuZ3RoBQ5oaXN0b3J5QWN0aW9ucwkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQhjbGFpbUFsbAAEC3VzZXJBZGRyZXNzCQClCAEIBQFpBmNhbGxlcgQLJHQwNTU4MTU2NTAJARZnZXRBbGxVc2VyQ2xhaW1BY3Rpb25zAQULdXNlckFkZHJlc3MEDGNsYWltQWN0aW9ucwgFCyR0MDU1ODE1NjUwAl8xBAt0b3RhbEFtb3VudAgFCyR0MDU1ODE1NjUwAl8yBA5oaXN0b3J5QWN0aW9ucwkAzAgCCQEMSW50ZWdlckVudHJ5AgkBEWtleVZlc3RpbmdIaXN0b3J5AwIHY2xhaW1lZAULdXNlckFkZHJlc3MJANgEAQgFAWkNdHJhbnNhY3Rpb25JZAULdG90YWxBbW91bnQFA25pbAkAzggCBQxjbGFpbUFjdGlvbnMFDmhpc3RvcnlBY3Rpb25zADRa9Os=", "height": 2923866, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3LB3tmSRUfrmX3LjX6WwGzUsF7o4VWnoYtGsiBYNjQcU Next: 7hmnd21idCYknowb9sEYeKDBrtGLDQeHpe8FTa2kj6MA Diff:
OldNewDifferences
124124
125125 func getAllUserClaimActions (userAddress) = {
126126 func actionsHelper (acc,a) = {
127- let $t039123939 = acc
128- let allActions = $t039123939._1
129- let sum = $t039123939._2
130- let $t039444013 = getUserClaimActions(userAddress, a)
131- let claimActions = $t039444013._1
132- let claimAmount = $t039444013._2
127+ let $t039483975 = acc
128+ let allActions = $t039483975._1
129+ let sum = $t039483975._2
130+ let $t039804049 = getUserClaimActions(userAddress, a)
131+ let claimActions = $t039804049._1
132+ let claimAmount = $t039804049._2
133133 $Tuple2((allActions ++ claimActions), (sum + claimAmount))
134134 }
135135
150150
151151 func getAvailableVestingId (userAddress) = {
152152 func helper (availableId,id) = {
153- let $t042214300 = parseUserVesting(userAddress, id)
154- let vestingAmount = $t042214300._1
155- let startBlock = $t042214300._2
156- let lockLength = $t042214300._3
153+ let $t042574336 = parseUserVesting(userAddress, id)
154+ let vestingAmount = $t042574336._1
155+ let startBlock = $t042574336._2
156+ let lockLength = $t042574336._3
157157 if ((vestingAmount > 0))
158158 then availableId
159159 else if ((availableId == -1))
197197 if ((check == check))
198198 then {
199199 let id = getAvailableVestingId(userAddress)
200- getNewVestingActions(userAddress, id, vestingAmount, startBlock, lockLength)
200+ let historyActions = [IntegerEntry(keyVestingHistory("vested", userAddress, toBase58String(i.transactionId)), vestingAmount)]
201+ (getNewVestingActions(userAddress, id, vestingAmount, startBlock, lockLength) ++ historyActions)
201202 }
202203 else throw("Strict value is not equal to itself.")
204+ }
205+
206+
207+
208+@Callable(i)
209+func claimAll () = {
210+ let userAddress = toString(i.caller)
211+ let $t055815650 = getAllUserClaimActions(userAddress)
212+ let claimActions = $t055815650._1
213+ let totalAmount = $t055815650._2
214+ let historyActions = [IntegerEntry(keyVestingHistory("claimed", userAddress, toBase58String(i.transactionId)), totalAmount)]
215+ (claimActions ++ historyActions)
203216 }
204217
205218
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFile = "vesting_neo.ride"
55
66 let SEP = "__"
77
88 let IDS_LIST = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
99
1010 let MAX_VESTING_COUNT = size(IDS_LIST)
1111
1212 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1313
1414
1515 let keyAssetId = makeString(["%s", "assetId"], SEP)
1616
1717 let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES")
1818
1919 let assetIdBytes = if ((assetIdString == "WAVES"))
2020 then unit
2121 else fromBase58String(assetIdString)
2222
2323 let keyAdminList = makeString(["%s", "adminList"], SEP)
2424
2525 let adminList = match getString(this, keyAdminList) {
2626 case s: String =>
2727 split(s, SEP)
2828 case _ =>
2929 nil
3030 }
3131
3232 func isValidAddressString (addressString) = match addressFromString(addressString) {
3333 case a: Address =>
3434 true
3535 case _ =>
3636 false
3737 }
3838
3939
4040 func keyUserVesting (userAddress,id) = {
4141 let checks = [if (isValidAddressString(userAddress))
4242 then true
4343 else throwErr(makeString(["address is not valid:", userAddress], " ")), if (if ((id >= 0))
4444 then (MAX_VESTING_COUNT > id)
4545 else false)
4646 then true
4747 else throwErr(makeString(["id should be less than", toString(MAX_VESTING_COUNT), "got:", toString(id)], " "))]
4848 if ((checks == checks))
4949 then makeString(["%s%d", userAddress, toString(id)], SEP)
5050 else throw("Strict value is not equal to itself.")
5151 }
5252
5353
5454 func formatUserVesting (vestingAmount,startBlock,lockLength) = {
5555 let checks = [if ((vestingAmount >= 0))
5656 then true
5757 else throwErr("vesting amount cannot be negative"), if ((startBlock >= 0))
5858 then true
5959 else throwErr("start block cannot be negative"), if ((lockLength >= 0))
6060 then true
6161 else throwErr("lock length cannot be negative")]
6262 if ((checks == checks))
6363 then makeString(["%d%d%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP)
6464 else throw("Strict value is not equal to itself.")
6565 }
6666
6767
6868 func parseUserVesting (userAddress,id) = match getString(this, keyUserVesting(userAddress, id)) {
6969 case rawString: String =>
7070 let splitString = split(rawString, SEP)
7171 let vestingAmount = parseIntValue(splitString[1])
7272 let startBlock = parseIntValue(splitString[2])
7373 let lockLength = parseIntValue(splitString[3])
7474 $Tuple3(vestingAmount, startBlock, lockLength)
7575 case _ =>
7676 $Tuple3(0, 0, 0)
7777 }
7878
7979
8080 func keyVestingHistory (action,userAddress,txId) = makeString(["%s%s%s", action, userAddress, txId], SEP)
8181
8282
8383 func calcUnlockedAmount (amount,startBlock,lockLength) = {
8484 let elapsedBlocks = (height - startBlock)
8585 let unlockedAmount = if (if ((lockLength != 0))
8686 then (elapsedBlocks > 0)
8787 else false)
8888 then min([fraction(amount, elapsedBlocks, lockLength), amount])
8989 else 0
9090 $Tuple2(unlockedAmount, (amount - unlockedAmount))
9191 }
9292
9393
9494 func getUserUnlockedAmount (userAddress,id) = {
9595 let $t027472826 = parseUserVesting(userAddress, id)
9696 let vestingAmount = $t027472826._1
9797 let startBlock = $t027472826._2
9898 let lockLength = $t027472826._3
9999 let $t028292926 = calcUnlockedAmount(vestingAmount, startBlock, lockLength)
100100 let unlockedAmount = $t028292926._1
101101 let remainingAmount = $t028292926._2
102102 $Tuple2(unlockedAmount, remainingAmount)
103103 }
104104
105105
106106 func getUserClaimActions (userAddress,id) = {
107107 let $t030293108 = parseUserVesting(userAddress, id)
108108 let vestingAmount = $t030293108._1
109109 let startBlock = $t030293108._2
110110 let lockLength = $t030293108._3
111111 let $t031113189 = getUserUnlockedAmount(userAddress, id)
112112 let unlockedAmount = $t031113189._1
113113 let remainingAmount = $t031113189._2
114114 let remainingBlocks = max([((startBlock + lockLength) - height), 0])
115115 let actions = if ((unlockedAmount != 0))
116116 then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes), StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))]
117117 else nil
118118 $Tuple2(actions, unlockedAmount)
119119 }
120120
121121
122122 func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))]
123123
124124
125125 func getAllUserClaimActions (userAddress) = {
126126 func actionsHelper (acc,a) = {
127- let $t039123939 = acc
128- let allActions = $t039123939._1
129- let sum = $t039123939._2
130- let $t039444013 = getUserClaimActions(userAddress, a)
131- let claimActions = $t039444013._1
132- let claimAmount = $t039444013._2
127+ let $t039483975 = acc
128+ let allActions = $t039483975._1
129+ let sum = $t039483975._2
130+ let $t039804049 = getUserClaimActions(userAddress, a)
131+ let claimActions = $t039804049._1
132+ let claimAmount = $t039804049._2
133133 $Tuple2((allActions ++ claimActions), (sum + claimAmount))
134134 }
135135
136136 let $l = IDS_LIST
137137 let $s = size($l)
138138 let $acc0 = $Tuple2(nil, 0)
139139 func $f0_1 ($a,$i) = if (($i >= $s))
140140 then $a
141141 else actionsHelper($a, $l[$i])
142142
143143 func $f0_2 ($a,$i) = if (($i >= $s))
144144 then $a
145145 else throw("List size exceeds 30")
146146
147147 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30)
148148 }
149149
150150
151151 func getAvailableVestingId (userAddress) = {
152152 func helper (availableId,id) = {
153- let $t042214300 = parseUserVesting(userAddress, id)
154- let vestingAmount = $t042214300._1
155- let startBlock = $t042214300._2
156- let lockLength = $t042214300._3
153+ let $t042574336 = parseUserVesting(userAddress, id)
154+ let vestingAmount = $t042574336._1
155+ let startBlock = $t042574336._2
156+ let lockLength = $t042574336._3
157157 if ((vestingAmount > 0))
158158 then availableId
159159 else if ((availableId == -1))
160160 then id
161161 else min([availableId, id])
162162 }
163163
164164 let availableId = {
165165 let $l = IDS_LIST
166166 let $s = size($l)
167167 let $acc0 = -1
168168 func $f0_1 ($a,$i) = if (($i >= $s))
169169 then $a
170170 else helper($a, $l[$i])
171171
172172 func $f0_2 ($a,$i) = if (($i >= $s))
173173 then $a
174174 else throw("List size exceeds 30")
175175
176176 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30)
177177 }
178178 if ((availableId == -1))
179179 then throwErr(makeString(["user exceeded max active vesting count: ", userAddress], " "))
180180 else availableId
181181 }
182182
183183
184184 @Callable(i)
185185 func vestingForUser (userAddress,vestingAmount,startBlock,lockLength) = {
186186 let check = [if ((size(i.payments) == 1))
187187 then true
188188 else throwErr("should be with exactly 1 payment"), if ((i.payments[0].assetId == assetIdBytes))
189189 then true
190190 else throwErr(makeString(["payment assetId should be: ", assetIdString], " ")), if ((i.payments[0].amount == vestingAmount))
191191 then true
192192 else throwErr("payment amount should be equal to vestingAmount"), if (if ((adminList == nil))
193193 then true
194194 else containsElement(adminList, toString(i.caller)))
195195 then true
196196 else throwErr("you must be admin")]
197197 if ((check == check))
198198 then {
199199 let id = getAvailableVestingId(userAddress)
200- getNewVestingActions(userAddress, id, vestingAmount, startBlock, lockLength)
200+ let historyActions = [IntegerEntry(keyVestingHistory("vested", userAddress, toBase58String(i.transactionId)), vestingAmount)]
201+ (getNewVestingActions(userAddress, id, vestingAmount, startBlock, lockLength) ++ historyActions)
201202 }
202203 else throw("Strict value is not equal to itself.")
204+ }
205+
206+
207+
208+@Callable(i)
209+func claimAll () = {
210+ let userAddress = toString(i.caller)
211+ let $t055815650 = getAllUserClaimActions(userAddress)
212+ let claimActions = $t055815650._1
213+ let totalAmount = $t055815650._2
214+ let historyActions = [IntegerEntry(keyVestingHistory("claimed", userAddress, toBase58String(i.transactionId)), totalAmount)]
215+ (claimActions ++ historyActions)
203216 }
204217
205218

github/deemru/w8io/026f985 
37.34 ms