Sorter
The Sorter
contract in the Atlas Protocol is responsible for evaluating and organizing solver bids within a metacall transaction. By assessing the eligibility and bid amounts of solvers, the Sorter ensures that the most qualified and competitive solvers are selected for execution, thereby enhancing the protocol's efficiency and fairness.
State Variables
Variable | Type | Visibility | Description |
---|---|---|---|
ATLAS | IAtlas | public | Immutable instance of the Atlas protocol. |
VERIFICATION | IAtlasVerification | public | Immutable instance of the Atlas verification contract. |
Structs
SortingData
Field | Type | Description |
---|---|---|
amount | uint256 | The bid amount associated with a solver operation. |
valid | bool | Indicates whether the solver operation is eligible. |
Constructor
constructor(address _atlas)
Description
Initializes the Sorter contract by setting the immutable ATLAS and VERIFICATION instances.
Parameters
Name | Type | Description |
---|---|---|
_atlas | address | Address of the deployed Atlas protocol contract. |
External Functions
sortBids
function sortBids(
UserOperation calldata userOp,
SolverOperation[] calldata solverOps
) external view returns (SolverOperation[] memory)
Description
Processes and sorts solver bids based on their eligibility and bid amounts.
Parameters
Name | Type | Description |
---|---|---|
userOp | UserOperation | The user operation containing user and dApp details. |
solverOps | SolverOperation[] | Array of solver operations to be evaluated and sorted. |
Return Values
Name | Type | Description |
---|---|---|
solverOpsSorted | SolverOperation[] | Array of sorted and eligible solver operations. |
Requirements
- None explicitly stated. Invalid solver operations are handled internally.
Usage Notes
- Filters out invalid solver operations.
- Sorts eligible solvers in descending order of their bid amounts.
- Prioritizes the highest bidders.
Error Handling
The Sorter contract leverages the underlying AtlasErrors for consistent and efficient error reporting. Common scenarios include:
- Invalid Solver Operations
- Bid Format Mismatch
- Insufficient Bonded Funds