From 2b31f9d58262933984d9271c7d87b9b0287e8734 Mon Sep 17 00:00:00 2001 From: bra1nsurfer Date: Thu, 7 Nov 2024 18:04:10 +0300 Subject: [PATCH] Changed vesting init --- ride/l2mp_leasing.ride | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ride/l2mp_leasing.ride b/ride/l2mp_leasing.ride index 38398cef..08fb0582 100644 --- a/ride/l2mp_leasing.ride +++ b/ride/l2mp_leasing.ride @@ -686,15 +686,15 @@ func stakeFor(userAddress: String) = { } @Callable(i) -func startUnitsVesting(unitsClaimNewInterval: Int, totalL2String: String) = { - let totalUnits = i.payments[0].amount +func startUnitsVesting(unitsClaimNewInterval: Int, totalL2String: String, unitsAssetIdstring: String, unitsAmountString: String) = { + let unitsAmount = unitsAmountString.parseIntValue() let totalL2 = totalL2String.parseIntValue() + let unitsAsset = unitsAssetIdstring.assetStringToBytes() - let unitsPerBlockScale16 = fraction(totalUnits, scale16, totalL2) / unitsClaimNewInterval + let unitsPerBlockScale16 = fraction(unitsAmount, scale16, totalL2) / unitsClaimNewInterval strict check = [ isInAdminList(i.caller.toString()) || "caller is not in adminList".throwErr(), - i.payments.size() == 1 || "should be 1 payment".throwErr(), unitsPerBlockScale16 > 0 || "units per block should be greated than 0".throwErr(), totalL2 > 0 || "total l2 should be greated than 0".throwErr() ] @@ -703,7 +703,7 @@ func startUnitsVesting(unitsClaimNewInterval: Int, totalL2String: String) = { IntegerEntry(keyUnitsPerBlockScale16, unitsPerBlockScale16), IntegerEntry(keyUnitsClaimStartHeight, height), IntegerEntry(keyUnitsClaimInterval, unitsClaimNewInterval), - StringEntry(keyUnitsAssetId, i.payments[0].assetId.assetBytesToString()) + StringEntry(keyUnitsAssetId, unitsAsset.assetBytesToString()) ] }