From 7174924066dcab1874cf1d6b558da2288dc5a989 Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:55:03 -0300 Subject: [PATCH 1/3] feat: add lock on receive --- contracts/src/core/BatcherPaymentService.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/src/core/BatcherPaymentService.sol b/contracts/src/core/BatcherPaymentService.sol index fa3abefa7..a06a95af9 100644 --- a/contracts/src/core/BatcherPaymentService.sol +++ b/contracts/src/core/BatcherPaymentService.sol @@ -65,6 +65,7 @@ contract BatcherPaymentService is // PAYABLE FUNCTIONS receive() external payable { UserData[msg.sender].balance += msg.value; + user_data.unlockBlock = 0; emit PaymentReceived(msg.sender, msg.value); } From fb6ffa78388024b7bca7991dd2cab062d84d90ff Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 27 Aug 2024 18:13:16 -0300 Subject: [PATCH 2/3] fix: UserInfo data type --- contracts/src/core/BatcherPaymentService.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/src/core/BatcherPaymentService.sol b/contracts/src/core/BatcherPaymentService.sol index 6ae4ab838..268959e3f 100644 --- a/contracts/src/core/BatcherPaymentService.sol +++ b/contracts/src/core/BatcherPaymentService.sol @@ -98,9 +98,9 @@ contract BatcherPaymentService is // PAYABLE FUNCTIONS receive() external payable { - user_data = userData[msg.sender]; - user_data.balance += msg.value; - user_data.unlockBlock = 0; + UserInfo storage senderData = userData[msg.sender]; + senderData.balance += msg.value; + senderData.unlockBlock = 0; emit PaymentReceived(msg.sender, msg.value); } From f458212b57f3734518e1eaac59483089b83959ea Mon Sep 17 00:00:00 2001 From: Urix <43704209+uri-99@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:44:13 -0300 Subject: [PATCH 3/3] chore: remove unnecesary unreference --- contracts/src/core/BatcherPaymentService.sol | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contracts/src/core/BatcherPaymentService.sol b/contracts/src/core/BatcherPaymentService.sol index 268959e3f..5247f4f00 100644 --- a/contracts/src/core/BatcherPaymentService.sol +++ b/contracts/src/core/BatcherPaymentService.sol @@ -98,9 +98,8 @@ contract BatcherPaymentService is // PAYABLE FUNCTIONS receive() external payable { - UserInfo storage senderData = userData[msg.sender]; - senderData.balance += msg.value; - senderData.unlockBlock = 0; + userData[msg.sender].balance += msg.value; + userData[msg.sender].unlockBlock = 0; emit PaymentReceived(msg.sender, msg.value); }