Skip to content

Commit

Permalink
Merge 29abaa4 into f009da5
Browse files Browse the repository at this point in the history
  • Loading branch information
uri-99 authored Feb 10, 2025
2 parents f009da5 + 29abaa4 commit d5155ba
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
6 changes: 6 additions & 0 deletions contracts/script/output/devnet/batcher_deployment_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"addresses": {
"batcherPaymentService": "0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650",
"batcherPaymentServiceImplementation": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0"
}
}

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions contracts/src/core/BatcherPaymentService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ contract BatcherPaymentService is

// PAYABLE FUNCTIONS
receive() external payable {
userData[msg.sender].balance += msg.value;
userData[msg.sender].unlockBlockTime = 0;
emit PaymentReceived(msg.sender, msg.value);
if (msg.sender != address(alignedLayerServiceManager)) { // `alignedLayerServiceManager.withdraw()` triggers `receive()` (and with only 2300 gas)
userData[msg.sender].balance += msg.value;
userData[msg.sender].unlockBlockTime = 0;
emit PaymentReceived(msg.sender, msg.value);
}
}

// PUBLIC FUNCTIONS
Expand Down Expand Up @@ -178,6 +180,18 @@ contract BatcherPaymentService is
emit FundsWithdrawn(msg.sender, amount);
}


function withdrawFromServiceManager(
uint256 amount,
address withdrawAddress
) public payable onlyOwner {
alignedLayerServiceManager.withdraw(amount); // reverts if InsufficientBalance
// money is now in this contract
// we transfer it to the withdraw address
payable(withdrawAddress).transfer(amount); // non-reentrant since .transfer() has low gas limit. Also, Owner is a multisig.
// this.balance is unchanged
}

function pause() public onlyOwner {
_pause();
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/core/IAlignedLayerServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ interface IAlignedLayerServiceManager {

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

function withdraw(uint256 amount) external;

function setAggregator(address _aggregator) external;

function isVerifierDisabled(
Expand Down

0 comments on commit d5155ba

Please sign in to comment.