The CallBits
library provides utility functions and constants for encoding and decoding call configurations within the Atlas Protocol. It facilitates the management of various execution phase flags by encoding them into a compact uint32
format and decoding them back into a structured CallConfig
object. This library is essential for ensuring that calls adhere to the protocol's safety and operational requirements during different execution phases.
State Variables
Constants
Constant Name | Type | Description |
---|
_ONE | uint32 | Represents the value 1 used for bit shifting operations. |
Functions
buildCallConfig
function buildCallConfig(address control) internal view returns (uint32 callConfig)
Description
Retrieves the call configuration from the specified DAppControl contract. This configuration determines the behavior and restrictions of calls within different execution phases.
Parameters
Name | Type | Description |
---|
control | address | The address of the DAppControl contract. |
Returns
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
encodeCallConfig
function encodeCallConfig(CallConfig memory callConfig) internal pure returns (uint32 encodedCallConfig)
Description
Encodes a CallConfig struct into a uint32 representation by setting specific bits corresponding to each configuration flag.
Parameters
Name | Type | Description |
---|
callConfig | CallConfig memory | The call configuration struct containing various flags. |
Returns
Name | Type | Description |
---|
encodedCallConfig | uint32 | The encoded call configuration as a uint32 value. |
decodeCallConfig
function decodeCallConfig(uint32 encodedCallConfig) internal pure returns (CallConfig memory callConfig)
Description
Decodes a uint32 encoded call configuration back into a CallConfig struct by extracting each flag based on its bit position.
Parameters
Name | Type | Description |
---|
encodedCallConfig | uint32 | The encoded call configuration to decode. |
Returns
Name | Type | Description |
---|
callConfig | CallConfig memory | The decoded call configuration struct. |
Getter Functions
The following functions are used to check specific flags in the call configuration. Each function takes a uint32 callConfig
as input and returns a bool
indicating whether the specific flag is set in the configuration.
needsSequentialUserNonces
function needsSequentialUserNonces(uint32 callConfig) internal pure returns (bool sequential)
Description
Determines if sequential user nonces are required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
sequential | bool | true if sequential user nonces are required. |
needsSequentialDAppNonces
function needsSequentialDAppNonces(uint32 callConfig) internal pure returns (bool sequential)
Description
Determines if sequential DApp nonces are required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
sequential | bool | true if sequential DApp nonces are required. |
needsPreOpsCall
function needsPreOpsCall(uint32 callConfig) internal pure returns (bool needsPreOps)
Description
Determines if a pre-operations call is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsPreOps | bool | true if a pre-operations call is required. |
needsPreOpsReturnData
function needsPreOpsReturnData(uint32 callConfig) internal pure returns (bool needsReturnData)
Description
Determines if return data from pre-operations calls should be tracked based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsReturnData | bool | true if return data from pre-operations calls should be tracked. |
needsUserReturnData
function needsUserReturnData(uint32 callConfig) internal pure returns (bool needsReturnData)
Description
Determines if return data from user operations should be tracked based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsReturnData | bool | true if return data from user operations should be tracked. |
needsDelegateUser
function needsDelegateUser(uint32 callConfig) internal pure returns (bool delegateUser)
Description
Determines if user delegation is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
delegateUser | bool | true if user delegation is required. |
needsPreSolverCall
function needsPreSolverCall(uint32 callConfig) internal pure returns (bool needsPreSolver)
Description
Determines if a pre-solver call is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsPreSolver | bool | true if a pre-solver call is required. |
needsPostSolverCall
function needsPostSolverCall(uint32 callConfig) internal pure returns (bool needsPostSolver)
Description
Determines if a post-solver call is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsPostSolver | bool | true if a post-solver call is required. |
needsPostOpsCall
function needsPostOpsCall(uint32 callConfig) internal pure returns (bool needsPostOps)
Description
Determines if a post-operations call is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
needsPostOps | bool | true if a post-operations call is required. |
allowsZeroSolvers
function allowsZeroSolvers(uint32 callConfig) internal pure returns (bool zeroSolvers)
Description
Determines if zero solvers are allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
zeroSolvers | bool | true if zero solvers are allowed. |
allowsReuseUserOps
function allowsReuseUserOps(uint32 callConfig) internal pure returns (bool reuseUserOp)
Description
Determines if user operations can be reused based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
reuseUserOp | bool | true if user operations can be reused. |
allowsUserAuctioneer
function allowsUserAuctioneer(uint32 callConfig) internal pure returns (bool userAuctioneer)
Description
Determines if a user auctioneer is allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
userAuctioneer | bool | true if user auctioneer is allowed. |
allowsSolverAuctioneer
function allowsSolverAuctioneer(uint32 callConfig) internal pure returns (bool solverAuctioneer)
Description
Determines if a solver auctioneer is allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
solverAuctioneer | bool | true if solver auctioneer is allowed. |
allowsUnknownAuctioneer
function allowsUnknownAuctioneer(uint32 callConfig) internal pure returns (bool unknownAuctioneer)
Description
Determines if an unknown auctioneer is allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
unknownAuctioneer | bool | true if unknown auctioneer is allowed. |
verifyCallChainHash
function verifyCallChainHash(uint32 callConfig) internal pure returns (bool verify)
Description
Determines if the call chain hash verification is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Name | Type | Description |
---|
verify | bool | true if call chain hash verification is required. |
forwardReturnData
function forwardReturnData(uint32 callConfig) internal pure returns (bool)
Description
Determines if return data should be forwarded based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if return data should be forwarded. |
needsFulfillment
function needsFulfillment(uint32 callConfig) internal pure returns (bool)
Description
Determines if fulfillment is required based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if fulfillment is required. |
allowsTrustedOpHash
function allowsTrustedOpHash(uint32 callConfig) internal pure returns (bool)
Description
Determines if a trusted operation hash is allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if trusted operation hash is allowed. |
invertsBidValue
function invertsBidValue(uint32 callConfig) internal pure returns (bool)
Description
Determines if the bid value should be inverted based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if bid value should be inverted. |
exPostBids
function exPostBids(uint32 callConfig) internal pure returns (bool)
Description
Determines if ex-post bids are enabled based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if ex-post bids are enabled. |
allowAllocateValueFailure
function allowAllocateValueFailure(uint32 callConfig) internal pure returns (bool)
Description
Determines if failures during value allocation are allowed based on the call configuration.
Parameters
Name | Type | Description |
---|
callConfig | uint32 | The encoded call configuration flags. |
Returns
Type | Description |
---|
bool | true if allocation value failures are allowed. |