tx · 8bP92YyAG111dLAhgnToJPZjydh7iYjARKyp4D5U7JsK

3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1:  -0.01000000 Waves

2024.01.09 12:06 [2923745] smart account 3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1 > SELF 0.00000000 Waves

{ "type": 13, "id": "8bP92YyAG111dLAhgnToJPZjydh7iYjARKyp4D5U7JsK", "fee": 1000000, "feeAssetId": null, "timestamp": 1704791184205, "version": 2, "chainId": 84, "sender": "3MwyBKGZcdChEK9Z55HwLn3A2EgwEJJpqC1", "senderPublicKey": "7c3qLtcJ7EaPS2JDjXv8MBbd4kpyc6R27wcn5GgvZhur", "proofs": [ "yiFktKnahbL13SHdwUdAQ16VvFQLoURU3DyCMTvc7oNciswyysRSth7jcQBKFJ5pHmfKm7MDMs6UJZEHnRgFGxP" ], "script": "base64:BgIKCAISBgoECAEBARAADGNvbnRyYWN0RmlsZQIQdmVzdGluZ19uZW8ucmlkZQADU0VQAgJfXwARTUFYX1ZFU1RJTkdfQ09VTlQACgEIdGhyb3dFcnIBA21zZwkAAgEJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cACmtleUFzc2V0SWQJALkJAgkAzAgCAgIlcwkAzAgCAgdhc3NldElkBQNuaWwFA1NFUAANYXNzZXRJZFN0cmluZwkBC3ZhbHVlT3JFbHNlAgkAnQgCBQR0aGlzBQprZXlBc3NldElkAgVXQVZFUwAMYXNzZXRJZEJ5dGVzAwkAAAIFDWFzc2V0SWRTdHJpbmcCBVdBVkVTBQR1bml0CQDZBAEFDWFzc2V0SWRTdHJpbmcBFGlzVmFsaWRBZGRyZXNzU3RyaW5nAQ1hZGRyZXNzU3RyaW5nBAckbWF0Y2gwCQCmCAEFDWFkZHJlc3NTdHJpbmcDCQABAgUHJG1hdGNoMAIHQWRkcmVzcwQBYQUHJG1hdGNoMAYHAQ5rZXlVc2VyVmVzdGluZwILdXNlckFkZHJlc3MCaWQEBmNoZWNrcwk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9ucwEBaQEDZm9vBAt1c2VyQWRkcmVzcw12ZXN0aW5nQW1vdW50CnN0YXJ0QmxvY2sKbG9ja0xlbmd0aAkBFGdldE5ld1Zlc3RpbmdBY3Rpb25zBQULdXNlckFkZHJlc3MAAAUNdmVzdGluZ0Ftb3VudAUKc3RhcnRCbG9jawUKbG9ja0xlbmd0aAAeA+ni", "height": 2923745, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AkJqAGEiwucVRK15PBpN6JH2StKnrt4teCcLNTt6qVNF Next: 4K6cyaXp2pbGoWJ1rWXvfN1ipf3eoyL7zEkRGnBRrQoh Diff:
OldNewDifferences
55
66 let SEP = "__"
77
8-let MAX_VESTING_COUNT = 100
8+let MAX_VESTING_COUNT = 10
99
1010 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1111
7878
7979
8080 func getUserUnlockedAmount (userAddress,id) = {
81- let $t022322311 = parseUserVesting(userAddress, id)
82- let vestingAmount = $t022322311._1
83- let startBlock = $t022322311._2
84- let lockLength = $t022322311._3
85- let $t023142411 = calcUnlockedAmount(vestingAmount, startBlock, lockLength)
86- let unlockedAmount = $t023142411._1
87- let remainingAmount = $t023142411._2
81+ let $t022312310 = parseUserVesting(userAddress, id)
82+ let vestingAmount = $t022312310._1
83+ let startBlock = $t022312310._2
84+ let lockLength = $t022312310._3
85+ let $t023132410 = calcUnlockedAmount(vestingAmount, startBlock, lockLength)
86+ let unlockedAmount = $t023132410._1
87+ let remainingAmount = $t023132410._2
8888 $Tuple2(unlockedAmount, remainingAmount)
8989 }
9090
9191
9292 func getUserClaimActions (userAddress,id) = {
93- let $t025142593 = parseUserVesting(userAddress, id)
94- let vestingAmount = $t025142593._1
95- let startBlock = $t025142593._2
96- let lockLength = $t025142593._3
97- let $t025962674 = getUserUnlockedAmount(userAddress, id)
98- let unlockedAmount = $t025962674._1
99- let remainingAmount = $t025962674._2
93+ let $t025132592 = parseUserVesting(userAddress, id)
94+ let vestingAmount = $t025132592._1
95+ let startBlock = $t025132592._2
96+ let lockLength = $t025132592._3
97+ let $t025952673 = getUserUnlockedAmount(userAddress, id)
98+ let unlockedAmount = $t025952673._1
99+ let remainingAmount = $t025952673._2
100100 let remainingBlocks = max([((startBlock + lockLength) - height), 0])
101101 if ((unlockedAmount != 0))
102102 then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes), StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))]
107107 func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))]
108108
109109
110+func getAllUserClaimActions (userAddress) = {
111+ func actionsHelper (accum,a) = {
112+ let $t033783409 = accum
113+ let allActions = $t033783409._1
114+ let index = $t033783409._2
115+ $Tuple2((allActions ++ getUserClaimActions(userAddress, index)), (index + 1))
116+ }
117+
118+ let $t035073566 = {
119+ let $l = nil
120+ let $s = size($l)
121+ let $acc0 = $Tuple2(nil, 0)
122+ func $f0_1 ($a,$i) = if (($i >= $s))
123+ then $a
124+ else actionsHelper($a, $l[$i])
125+
126+ func $f0_2 ($a,$i) = if (($i >= $s))
127+ then $a
128+ else throw("List size exceeds 10")
129+
130+ $f0_2($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)
131+ }
132+ let allActions = $t035073566._1
133+ let _a = $t035073566._2
134+ allActions
135+ }
136+
137+
110138 @Callable(i)
111139 func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, 0, vestingAmount, startBlock, lockLength)
112140
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
8-let MAX_VESTING_COUNT = 100
8+let MAX_VESTING_COUNT = 10
99
1010 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1111
1212
1313 let keyAssetId = makeString(["%s", "assetId"], SEP)
1414
1515 let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES")
1616
1717 let assetIdBytes = if ((assetIdString == "WAVES"))
1818 then unit
1919 else fromBase58String(assetIdString)
2020
2121 func isValidAddressString (addressString) = match addressFromString(addressString) {
2222 case a: Address =>
2323 true
2424 case _ =>
2525 false
2626 }
2727
2828
2929 func keyUserVesting (userAddress,id) = {
3030 let checks = [if (isValidAddressString(userAddress))
3131 then true
3232 else throwErr(makeString(["address is not valid:", userAddress], " ")), if (if ((id >= 0))
3333 then (MAX_VESTING_COUNT > id)
3434 else false)
3535 then true
3636 else throwErr(makeString(["id is invalid:", toString(id)], " "))]
3737 if ((checks == checks))
3838 then makeString(["%s%d", userAddress, toString(id)], SEP)
3939 else throw("Strict value is not equal to itself.")
4040 }
4141
4242
4343 func formatUserVesting (vestingAmount,startBlock,lockLength) = {
4444 let checks = [if ((vestingAmount >= 0))
4545 then true
4646 else throwErr("vesting amount cannot be negative"), if ((startBlock >= 0))
4747 then true
4848 else throwErr("start block cannot be negative"), if ((lockLength >= 0))
4949 then true
5050 else throwErr("lock length cannot be negative")]
5151 if ((checks == checks))
5252 then makeString(["%d%d%d", toString(vestingAmount), toString(startBlock), toString(lockLength)], SEP)
5353 else throw("Strict value is not equal to itself.")
5454 }
5555
5656
5757 func parseUserVesting (userAddress,id) = match getString(this, keyUserVesting(userAddress, id)) {
5858 case rawString: String =>
5959 let splitString = split(rawString, SEP)
6060 let vestingAmount = parseIntValue(splitString[1])
6161 let startBlock = parseIntValue(splitString[2])
6262 let lockLength = parseIntValue(splitString[3])
6363 $Tuple3(vestingAmount, startBlock, lockLength)
6464 case _ =>
6565 $Tuple3(0, 0, 0)
6666 }
6767
6868
6969 func calcUnlockedAmount (amount,startBlock,lockLength) = {
7070 let elapsedBlocks = (height - startBlock)
7171 let unlockedAmount = if (if ((lockLength != 0))
7272 then (elapsedBlocks > 0)
7373 else false)
7474 then min([fraction(amount, elapsedBlocks, lockLength), amount])
7575 else 0
7676 $Tuple2(unlockedAmount, (amount - unlockedAmount))
7777 }
7878
7979
8080 func getUserUnlockedAmount (userAddress,id) = {
81- let $t022322311 = parseUserVesting(userAddress, id)
82- let vestingAmount = $t022322311._1
83- let startBlock = $t022322311._2
84- let lockLength = $t022322311._3
85- let $t023142411 = calcUnlockedAmount(vestingAmount, startBlock, lockLength)
86- let unlockedAmount = $t023142411._1
87- let remainingAmount = $t023142411._2
81+ let $t022312310 = parseUserVesting(userAddress, id)
82+ let vestingAmount = $t022312310._1
83+ let startBlock = $t022312310._2
84+ let lockLength = $t022312310._3
85+ let $t023132410 = calcUnlockedAmount(vestingAmount, startBlock, lockLength)
86+ let unlockedAmount = $t023132410._1
87+ let remainingAmount = $t023132410._2
8888 $Tuple2(unlockedAmount, remainingAmount)
8989 }
9090
9191
9292 func getUserClaimActions (userAddress,id) = {
93- let $t025142593 = parseUserVesting(userAddress, id)
94- let vestingAmount = $t025142593._1
95- let startBlock = $t025142593._2
96- let lockLength = $t025142593._3
97- let $t025962674 = getUserUnlockedAmount(userAddress, id)
98- let unlockedAmount = $t025962674._1
99- let remainingAmount = $t025962674._2
93+ let $t025132592 = parseUserVesting(userAddress, id)
94+ let vestingAmount = $t025132592._1
95+ let startBlock = $t025132592._2
96+ let lockLength = $t025132592._3
97+ let $t025952673 = getUserUnlockedAmount(userAddress, id)
98+ let unlockedAmount = $t025952673._1
99+ let remainingAmount = $t025952673._2
100100 let remainingBlocks = max([((startBlock + lockLength) - height), 0])
101101 if ((unlockedAmount != 0))
102102 then [ScriptTransfer(addressFromStringValue(userAddress), unlockedAmount, assetIdBytes), StringEntry(keyUserVesting(userAddress, id), formatUserVesting(remainingAmount, height, remainingBlocks))]
103103 else nil
104104 }
105105
106106
107107 func getNewVestingActions (userAddress,id,vestingAmount,startBlock,lockLength) = [StringEntry(keyUserVesting(userAddress, id), formatUserVesting(vestingAmount, startBlock, lockLength))]
108108
109109
110+func getAllUserClaimActions (userAddress) = {
111+ func actionsHelper (accum,a) = {
112+ let $t033783409 = accum
113+ let allActions = $t033783409._1
114+ let index = $t033783409._2
115+ $Tuple2((allActions ++ getUserClaimActions(userAddress, index)), (index + 1))
116+ }
117+
118+ let $t035073566 = {
119+ let $l = nil
120+ let $s = size($l)
121+ let $acc0 = $Tuple2(nil, 0)
122+ func $f0_1 ($a,$i) = if (($i >= $s))
123+ then $a
124+ else actionsHelper($a, $l[$i])
125+
126+ func $f0_2 ($a,$i) = if (($i >= $s))
127+ then $a
128+ else throw("List size exceeds 10")
129+
130+ $f0_2($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)
131+ }
132+ let allActions = $t035073566._1
133+ let _a = $t035073566._2
134+ allActions
135+ }
136+
137+
110138 @Callable(i)
111139 func foo (userAddress,vestingAmount,startBlock,lockLength) = getNewVestingActions(userAddress, 0, vestingAmount, startBlock, lockLength)
112140
113141

github/deemru/w8io/169f3d6 
31.88 ms