Timelocked Functions
A timelock delays an action with significant effects so that anyone it affects has time to react. Maple uses two mechanisms.
Governor Timelock
Every Governor function
The GovernorTimelock contract, which is the Governor
Scheduled calls in Globals
Pool Delegate upgrades
isValidScheduledCall in MapleGlobals, checked by the target contract
Governor Timelock
The Governor address in Globals is the GovernorTimelock contract. Proposals are scheduled, wait out a delay, and are executed within a window. Every function on the Governor page is delayed this way, including PoolManager.addStrategyManager(), PoolManager.addStrategy(), role and allowlist changes in Globals, and registering upgrade paths on factories. See Governor Timelock for roles and the proposal lifecycle.
Scheduled calls in Globals
Affected actions
LoanManager.upgrade(), function idLM:UPGRADE, when the Pool Delegate calls itWithdrawalManager.upgrade(), function idWM:UPGRADE, when the Pool Delegate calls it
The Security Admin can call both functions without a scheduled call. Only the Security Admin can call PoolManager.upgrade(), with no scheduled call. Strategy Managers and strategies likewise have Security Admin only upgrades with no timelock.
How the check works
The Pool Delegate calls
scheduleCall(contract, functionId, callData)on Globals. Globals storesblock.timestampandkeccak256(abi.encode(callData))under the caller, contract and function id.After the delay, the Pool Delegate calls the target function with the same calldata.
The target calls
isValidScheduledCall(msg.sender, address(this), functionId, msg.data). The call is valid whenblock.timestampis within[timestamp + delay, timestamp + delay + duration]and the calldata hash matches.The target then calls
unscheduleCall(caller, functionId, callData)so the same schedule cannot be reused.
The delay and duration come from timelockParametersOf[contract][functionId]. When that entry has a zero duration, defaultTimelockParameters applies.
Configuration
The Governor sets the windows with setTimelockWindow, setTimelockWindows and setDefaultTimelockParameters. Changes apply to calls that are already scheduled, because the check reads the current parameters at execution time. The Governor can also remove any scheduled call with the four-argument unscheduleCall(caller, contract, functionId, callData).
Last updated
Was this helpful?