Skip to content

Commit

Permalink
feat: implement aligned layer service manager interface (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRampoldi authored Aug 21, 2024
1 parent dfa1449 commit fff0b91
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions contracts/src/core/AlignedLayerServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import {IStakeRegistry} from "eigenlayer-middleware/interfaces/IStakeRegistry.so
import {Merkle} from "eigenlayer-core/contracts/libraries/Merkle.sol";
import {IRewardsCoordinator} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {AlignedLayerServiceManagerStorage} from "./AlignedLayerServiceManagerStorage.sol";
import {IAlignedLayerServiceManager} from "./IAlignedLayerServiceManager.sol";

/**
* @title Primary entrypoint for procuring services from Aligned.
*/
contract AlignedLayerServiceManager is
IAlignedLayerServiceManager,
ServiceManagerBase,
BLSSignatureChecker,
AlignedLayerServiceManagerStorage
Expand Down
21 changes: 9 additions & 12 deletions contracts/src/core/BatcherPaymentService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/Ownabl
import {PausableUpgradeable} from "@openzeppelin-upgrades/contracts/security/PausableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin-upgrades/contracts/proxy/utils/UUPSUpgradeable.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {IAlignedLayerServiceManager} from "./IAlignedLayerServiceManager.sol";

contract BatcherPaymentService is
Initializable,
Expand Down Expand Up @@ -33,9 +34,10 @@ contract BatcherPaymentService is
}

// STORAGE
address public AlignedLayerServiceManager;
address public BatcherWallet;

IAlignedLayerServiceManager public AlignedLayerServiceManager;

// map to user data
mapping(address => UserInfo) public UserData;

Expand All @@ -56,7 +58,9 @@ contract BatcherPaymentService is
__UUPSUpgradeable_init();
_transferOwnership(_BatcherPaymentServiceOwner);

AlignedLayerServiceManager = _AlignedLayerServiceManager;
AlignedLayerServiceManager = IAlignedLayerServiceManager(
_AlignedLayerServiceManager
);
BatcherWallet = _BatcherWallet;
}

Expand Down Expand Up @@ -105,18 +109,11 @@ contract BatcherPaymentService is

// call alignedLayerServiceManager
// with value to fund the task's response
(bool success, ) = AlignedLayerServiceManager.call{
value: feeForAggregator
}(
abi.encodeWithSignature(
"createNewTask(bytes32,string)",
batchMerkleRoot,
batchDataPointer
)
AlignedLayerServiceManager.createNewTask{value: feeForAggregator}(
batchMerkleRoot,
batchDataPointer
);

require(success, "createNewTask call failed");

payable(BatcherWallet).transfer(
(feePerProof * signaturesQty) - feeForAggregator
);
Expand Down
29 changes: 29 additions & 0 deletions contracts/src/core/IAlignedLayerServiceManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.12;

import {IBLSSignatureChecker} from "eigenlayer-middleware/interfaces/IBLSSignatureChecker.sol";

interface IAlignedLayerServiceManager {
function createNewTask(
bytes32 batchMerkleRoot,
string calldata batchDataPointer
) external payable;

function respondToTask(
bytes32 batchMerkleRoot,
IBLSSignatureChecker.NonSignerStakesAndSignature
memory nonSignerStakesAndSignature
) external;

function verifyBatchInclusion(
bytes32 proofCommitment,
bytes32 pubInputCommitment,
bytes32 provingSystemAuxDataCommitment,
bytes20 proofGeneratorAddr,
bytes32 batchMerkleRoot,
bytes memory merkleProof,
uint256 verificationDataBatchIndex
) external view returns (bool);

function balanceOf(address account) external view returns (uint256);
}

0 comments on commit fff0b91

Please sign in to comment.