Skip to main content

EscrowTypes

EscrowTypes defines the structs and enums used within the Escrow contract as well as the SolverTracker struct used in the AtlasCore contract.

EscrowAccountBalance

struct EscrowAccountBalance {
uint112 balance;
uint112 unbonding;
}

Description

The EscrowAccountBalance struct represents the financial state of a user's escrow account within the Atlas Protocol. It tracks both the total bonded balance and the amount currently undergoing the unbonding process.

Fields

NameTypeDescription
balanceuint112Total bonded balance available in the escrow.
unbondinguint112Amount currently unbonding, pending withdrawal.

Usage Notes

  • Bond Management: This struct is essential for managing user bonds, ensuring accurate tracking of available and pending balances.
  • Security: By separating bonded and unbonding amounts, the protocol can enforce withdrawal restrictions and prevent unauthorized access to funds.

EscrowAccountAccessData

struct EscrowAccountAccessData {
uint112 bonded;
uint32 lastAccessedBlock;
uint24 auctionWins;
uint24 auctionFails;
uint64 totalGasValueUsed; // The cumulative ETH value spent on gas in metacalls. Measured in gwei.
}

Description

The EscrowAccountAccessData struct maintains metadata related to a user's escrow account, facilitating tracking of account usage and performance within the protocol.

Fields

NameTypeDescription
bondeduint112Amount of funds currently bonded in the escrow.
lastAccessedBlockuint32Block number when the escrow account was last accessed, aiding in tracking account activity.
auctionWinsuint24Number of auctions the user has won, indicating their participation and success in auctions.
auctionFailsuint24Number of auctions the user has failed, providing insights into their auction performance.
totalGasValueUseduint64Cumulative ETH value (in gwei) spent on gas during metacalls, useful for gas accounting and analytics.

Usage Notes

  • Performance Tracking: This struct helps in monitoring user engagement and performance in auction-based operations within the protocol.
  • Gas Accounting: Tracking totalGasValueUsed is crucial for accurate gas fee management and potential optimizations.

SolverTracker

struct SolverTracker {
uint256 bidAmount;
uint256 floor;
uint256 ceiling;
bool etherIsBidToken;
bool invertsBidValue;
}

Description

The SolverTracker struct is designed to manage and monitor the bidding and performance metrics of solvers participating in operations within the Atlas Protocol. It ensures solvers adhere to bid constraints and provides mechanisms to evaluate their effectiveness.

Fields

NameTypeDescription
bidAmountuint256The amount bid by the solver for a particular operation.
flooruint256The minimum acceptable bid amount for the operation.
ceilinguint256The maximum allowable bid amount for the operation, preventing overbidding.
etherIsBidTokenboolIndicates whether ETH is used as the bid token (true) or another ERC20 token (false).
invertsBidValueboolDetermines if lower bids are more favorable (true) or higher bids are more favorable (false).

Usage Notes

  • Bid Management: Ensures solvers place bids within defined limits, maintaining fairness and preventing excessive bids.
  • Performance Evaluation: By tracking bid amounts and constraints, the protocol can assess solver performance and make informed decisions during auction-based operations.

EscrowTypes - SolverOutcome Enum

SolverOutcome

enum SolverOutcome {
// No Refund (relay error or hostile user)
InvalidSignature,
InvalidUserHash,
DeadlinePassedAlt,
GasPriceBelowUsersAlt,
InvalidTo,
UserOutOfGas,
AlteredControl,
AltOpHashMismatch,
// Partial Refund but no execution
DeadlinePassed,
GasPriceOverCap,
InvalidSolver,
InvalidBidToken,
PerBlockLimit,
InsufficientEscrow,
GasPriceBelowUsers,
CallValueTooHigh,
PreSolverFailed,
// execution, with Full Refund
SolverOpReverted,
PostSolverFailed,
BidNotPaid,
InvertedBidExceedsCeiling,
BalanceNotReconciled,
CallbackNotCalled,
EVMError
}

Description

The SolverOutcome enumeration categorizes the various results that can occur during a solver's operation within the Atlas Protocol. Each outcome represents a specific scenario, facilitating detailed tracking and handling of solver performance and errors.

Enumeration Values

ValueCategoryDescriptionRefundExecution
InvalidSignatureNo RefundThe solver's signature is invalid or unauthorized.No RefundNo Execution
InvalidUserHashNo RefundThe provided user operation hash doesn't match the expected hash.No RefundNo Execution
DeadlinePassedAltNo RefundAn alternative deadline check has failed.No RefundNo Execution
GasPriceBelowUsersAltNo RefundThe gas price is below an alternative user-specified threshold.No RefundNo Execution
InvalidToNo RefundThe 'to' address in the solver operation is invalid.No RefundNo Execution
UserOutOfGasNo RefundThe user has run out of gas during the operation.No RefundNo Execution
AlteredControlNo RefundThe control parameters have been altered unexpectedly.No RefundNo Execution
AltOpHashMismatchNo RefundAn alternative operation hash mismatch has occurred.No RefundNo Execution
DeadlinePassedPartial RefundThe operation's deadline has passed.Partial RefundNo Execution
GasPriceOverCapPartial RefundThe gas price exceeds the maximum allowed cap.Partial RefundNo Execution
InvalidSolverPartial RefundThe solver address is not authorized or invalid.Partial RefundNo Execution
InvalidBidTokenPartial RefundThe token used for bidding is invalid.Partial RefundNo Execution
PerBlockLimitPartial RefundThe solver has exceeded the per-block operation limit.Partial RefundNo Execution
InsufficientEscrowPartial RefundThe solver's escrow balance is insufficient.Partial RefundNo Execution
GasPriceBelowUsersPartial RefundThe gas price is below the user-specified minimum.Partial RefundNo Execution
CallValueTooHighPartial RefundThe call value exceeds the allowed limit.Partial RefundNo Execution
PreSolverFailedPartial RefundPre-solver operations have failed.Partial RefundNo Execution
SolverOpRevertedFull RefundThe solver's operation was reverted during execution.Full RefundPartial Execution
PostSolverFailedFull RefundPost-solver operations have failed.Full RefundPartial Execution
BidNotPaidFull RefundThe solver's bid was not paid as required.Full RefundPartial Execution
InvertedBidExceedsCeilingFull RefundAn inverted bid has exceeded the specified ceiling.Full RefundPartial Execution
BalanceNotReconciledFull RefundThe solver's balance could not be reconciled after the operation.Full RefundPartial Execution
CallbackNotCalledFull RefundA required callback function was not called.Full RefundPartial Execution
EVMErrorFull RefundAn error occurred in the Ethereum Virtual Machine during execution.Full RefundPartial Execution

Usage Notes

  • Outcome Tracking: The SolverOutcome enum allows the protocol to monitor and respond to specific scenarios during solver operations, enhancing operational transparency and security.
  • Error Handling: By categorizing outcomes, the protocol can implement targeted error handling strategies, ensuring robust and resilient operations.
  • Refund Mechanisms: Different outcomes dictate varying refund strategies, balancing cost recovery and incentivization for solvers.
    • No Refund: Typically for errors that are considered the fault of the solver or user, or for potential malicious actions.
    • Partial Refund: For cases where the operation failed due to conditions that may not be entirely under the solver's control.
    • Full Refund: Applied when the solver operation partially executed but ultimately failed, ensuring solvers are not penalized for system-level issues.
  • Execution Status: Indicates whether any part of the solver's operation was executed before the failure occurred, which is crucial for understanding the state of the system and any potential side effects.