Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
uri-99 committed Jan 28, 2025
1 parent 1c253fa commit 847a4d6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 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.

22 changes: 13 additions & 9 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,14 +180,16 @@ contract BatcherPaymentService is
emit FundsWithdrawn(msg.sender, amount);
}


function withdraw_from_service_manager(
uint256 amount
) public onlyOwner { // or onlyBatcher ??
alignedLayerServiceManager.withdraw(amount); // reverts on InsufficientBalance
uint256 amount,
address withdrawAddress
) public payable onlyOwner {
alignedLayerServiceManager.withdraw(amount); // reverts if InsufficientBalance
// money is now in this contract
// now transfer to hardcoded batcher wallet
payable(batcherWallet).transfer(amount);
// todo test
// 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 {
Expand Down

0 comments on commit 847a4d6

Please sign in to comment.