GelatoLiquidator.sol
GelatoLiquidator
A contract that handles the liquidation and claiming of positions in Chromatic markets. It extends the AutomateReady contracts and implements the ILiquidator interface.
waitPositionClaim
uint256 waitPositionClaim
WaitPositionClaimUpdated
event WaitPositionClaimUpdated(uint256 waitingTime)
Emitted when the waiting time of the claim task is updated.
Parameters:
Name Type Description waitingTime uint256 The new waiting time of the claim task.
constructor
constructor(contract IChromaticMarketFactory _factory, address _automate) public
Constructor function.
Parameters:
Name Type Description _factory contract IChromaticMarketFactory The address of the Chromatic Market Factory contract. _automate address The address of the Gelato Automate contract.
updateWaitPositionClaim
function updateWaitPositionClaim(uint256 waitingTime) external
Updates the waiting time of the claim task.
Parameters:
Name Type Description waitingTime uint256 The new waiting time of the claim task.
createLiquidationTask
function createLiquidationTask(uint256 positionId) external
Creates a liquidation task for a given position.
Can only be called by a registered market.
Parameters:
Name Type Description positionId uint256 The ID of the position to be liquidated.
cancelLiquidationTask
function cancelLiquidationTask(uint256 positionId) external
Cancels a liquidation task for a given position.
Can only be called by a registered market.
Parameters:
Name Type Description positionId uint256 The ID of the position for which to cancel the liquidation task.
resolveLiquidation
function resolveLiquidation(address _market, uint256 positionId, bytes) external view returns (bool canExec, bytes execPayload)
Resolves the liquidation of a position.
This function is called by the automation system.
Parameters:
Name Type Description _market address positionId uint256 The ID of the position to be liquidated. bytes Return Values:
Name Type Description canExec bool Whether the liquidation can be executed. execPayload bytes The encoded function call to execute the liquidation.
createClaimPositionTask
function createClaimPositionTask(uint256 positionId) external
Creates a claim position task for a given position.
Can only be called by a registered market.
Parameters:
Name Type Description positionId uint256 The ID of the position to be claimed.
cancelClaimPositionTask
function cancelClaimPositionTask(uint256 positionId) external
Cancels a claim position task for a given position.
Can only be called by a registered market.
Parameters:
Name Type Description positionId uint256 The ID of the position for which to cancel the claim position task.
resolveClaimPosition
function resolveClaimPosition(address _market, uint256 positionId, bytes) external view returns (bool canExec, bytes execPayload)
Resolves the claim of a position.
This function is called by the automation system.
Parameters:
Name Type Description _market address positionId uint256 The ID of the position to be claimed. bytes Return Values:
Name Type Description canExec bool Whether the claim can be executed. execPayload bytes The encoded function call to execute the claim.
cancelGelatoTask
function cancelGelatoTask(bytes32 taskId) external
_cancelTask
function _cancelTask(mapping(address => mapping(uint256 => bytes32)) registry, uint256 positionId) internal
Internal function to cancel a Gelato task.
Parameters:
Name Type Description registry mapping(address => mapping(uint256 => bytes32)) The mapping storing task IDs. positionId uint256 The ID of the position.
getLiquidationTaskId
function getLiquidationTaskId(address market, uint256 positionId) external view returns (bytes32 taskId)
getClaimPositionTaskId
function getClaimPositionTaskId(address market, uint256 positionId) external view returns (bytes32 taskId)
_getFeeInfo
function _getFeeInfo() internal view returns (uint256 fee, address feePayee)