Skip to main content
Helpful?

SafeCallback

Git Source | Generated with forge doc

Inherits: ImmutableState, IUnlockCallback

A contract that only allows the Uniswap v4 PoolManager to call the unlockCallback

Functions

constructor

constructor(IPoolManager _poolManager) ImmutableState(_poolManager);

onlyPoolManager

Only allow calls from the PoolManager contract

modifier onlyPoolManager();

unlockCallback

Called by the pool manager on msg.sender when the manager is unlocked

We force the onlyPoolManager modifier by exposing a virtual function after the onlyPoolManager check.

function unlockCallback(bytes calldata data) external onlyPoolManager returns (bytes memory);

Parameters

NameTypeDescription
databytesThe data that was passed to the call to unlock

Returns

NameTypeDescription
<none>bytesAny data that you want to be returned from the unlock call

_unlockCallback

to be implemented by the child contract, to safely guarantee the logic is only executed by the PoolManager

function _unlockCallback(bytes calldata data) internal virtual returns (bytes memory);

Errors

NotPoolManager

Thrown when calling unlockCallback where the caller is not PoolManager

error NotPoolManager();
Helpful?