BridgeServiceManager

Git Source

Inherits: ECDSAServiceManagerBase, Vault

Manages bridge operations and attestation validations

Extends ECDSAServiceManagerBase and Vault for bridging and staking functionality

State Variables

operatorResponses

Tracks bridge requests that this operator has responded to once to avoid duplications

Double attestations would technically be valid and allow operators to recursively call until funds are released

mapping(address => mapping(uint256 => bool)) public operatorResponses;

bridgeRequestWeights

Tracks the total operator weight attested to a bridge request

Helpful for determining when enough attestations have been collected to release funds.

mapping(uint256 => uint256) public bridgeRequestWeights;

Functions

constructor

Initializes the contract with the necessary addresses and parameters

constructor(
    address _avsDirectory,
    address _stakeRegistry,
    address _rewardsCoordinator,
    address _delegationManager,
    uint256 _crankGasCost,
    uint256 _AVSReward,
    uint256 _bridgeFee,
    string memory _name,
    string memory _version
)
    ECDSAServiceManagerBase(_avsDirectory, _stakeRegistry, _rewardsCoordinator, _delegationManager)
    Vault(_crankGasCost, _AVSReward, _bridgeFee, _name, _version);

Parameters

NameTypeDescription
_avsDirectoryaddressThe address of the AVS directory contract, managing AVS-related data for registered operators
_stakeRegistryaddressThe address of the stake registry contract, managing registration and stake recording
_rewardsCoordinatoraddressThe address of the rewards coordinator contract, handling rewards distributions
_delegationManageraddressThe address of the delegation manager contract, managing staker delegations to operators
_crankGasCostuint256The estimated gas cost for calling release funds, used to calculate rebate and incentivize users to call
_AVSRewarduint256The total reward for AVS attestation
_bridgeFeeuint256The total fee charged to the user for bridging
_namestringThe name of the contract, used for EIP-712 domain construction
_versionstringThe version of the contract, used for EIP-712 domain construction

onlyOperator

Ensures that only registered operators can call the function

modifier onlyOperator();

rewardAttestation

Rewards the operator for providing a valid attestation

Placeholder for actual AVS reward distribution pending Eigen M2 implementation

function rewardAttestation(address operator) internal;

Parameters

NameTypeDescription
operatoraddressThe address of the operator to be rewarded

publishAttestation

Publishes an attestation for a bridge request

function publishAttestation(bytes memory attestation, uint256 _bridgeRequestId) public nonReentrant onlyOperator;

Parameters

NameTypeDescription
attestationbytesThe signed attestation
_bridgeRequestIduint256The ID of the bridge request

slashMaliciousAttestor

Slashes a malicious attestor's stake

Placeholder for slashing logic pending Eigen implementations

function slashMaliciousAttestor(address operator, uint256 penalty) internal;

Parameters

NameTypeDescription
operatoraddressThe address of the operator to be slashed
penaltyuint256The penalty amount to be slashed

challengeAttestation

Challenges a potentially fraudulent attestation

function challengeAttestation(
    bytes memory fraudulentSignature,
    Structs.BridgeRequestData memory fraudulentBridgeRequest
) public nonReentrant;

Parameters

NameTypeDescription
fraudulentSignaturebytesThe signature of the fraudulent attestation
fraudulentBridgeRequestStructs.BridgeRequestDataThe data of the fraudulent bridge request

payoutCrankGasCost

Payouts the crank gas cost to the caller

function payoutCrankGasCost() internal;

_releaseFunds

Releases funds to the destination address

function _releaseFunds(bytes memory data) public override nonReentrant;

Parameters

NameTypeDescription
databytesThe bridge request data and signatures

releaseFunds

Releases funds to the destination address with typed data for ABI construction

function releaseFunds(bytes[] memory signatures, Structs.BridgeRequestData memory data) public nonReentrant;

Parameters

NameTypeDescription
signaturesbytes[]The signatures of the operators attesting to the bridge request
dataStructs.BridgeRequestDataThe bridge request data

operatorHasMinimumWeight

Checks if the operator has the minimum required weight

function operatorHasMinimumWeight(address operator) public view returns (bool);

Parameters

NameTypeDescription
operatoraddressThe address of the operator

Returns

NameTypeDescription
<none>boolTrue if the operator has the minimum weight, false otherwise

getOperatorWeight

Gets the weight of an operator

function getOperatorWeight(address operator) public view returns (uint256);

Parameters

NameTypeDescription
operatoraddressThe address of the operator

Returns

NameTypeDescription
<none>uint256The weight of the operator

receive

Fallback function to receive ether

receive() external payable;