Function: modifyRailLockup(uint256 railId, uint256 period, uint256 lockupFixed)
This function modifies a rail’s lockup configuration. If the rail is terminated, only the fixed lockup may be reduced and the period must remain unchanged. If the rail is active, the period and/or fixed lockup may be adjusted subject to account-funding and operator-allowance constraints. The function settles the payer’s account before and after.
Inputs
railIdControl: Chosen by the operator.
Constraints: Must reference an active rail (
validateRailActive(railId)), andonlyRailOperator(railId)must hold. Account lockup is settled before/after viasettleAccountLockupBeforeAndAfterForRail(railId, false, 0).Impact: Selects which
Railis modified and which event is emitted.
periodControl: Chosen by the operator.
Constraints: If the rail is terminated, it must equal
rail.lockupPeriod. If the rail is active and the payer’s account is not fully settled, it must also equalrail.lockupPeriod. When increasing the period on an active rail, it must be ≤operatorApproval.maxLockupPeriod.Impact: Determines the dynamic component of the new lockup — may change
rail.lockupPeriod(active rails only) and adjustpayer.lockupCurrentand operator lockup usage accordingly.
lockupFixedControl: Chosen by the operator.
Constraints: If the rail is terminated, it must be ≤ current
rail.lockupFixed. If the rail is active and the payer’s account is not fully settled, it must be ≤ currentrail.lockupFixed. Any increase requires sufficient operator lockup allowance and sufficient payer funds.Impact: Contributes to the new lockup — updates
payer.lockupCurrent, operator lockup usage, andrail.lockupFixed.
Branches and code coverage
Intended branches
For a terminated rail — reduce
lockupFixedonly, keepperiodunchanged, update payer lockup and operator usage, and emitRailLockupModified.For an active rail, payer fully settled — change
periodand/orlockupFixedwithin operator limits, adjust payer lockup and operator usage, and emit event.For an active rail, payer not fully settled — only allow
lockupFixedto decrease andperiodto remain unchanged and emit event.Revert — terminated rail with
periodchange orlockupFixedincrease.Revert — increasing
periodbeyondoperatorApproval.maxLockupPeriod.Revert — insufficient
payer.lockupCurrentfor old/new lockup requirements or postsettlement check failure.