Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L2mp leasing patch #460

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ride/l2mp_leasing.ride
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]
Expand All @@ -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())
]
}

Expand Down
Loading