From 4c0a4fd0b914e29ebf48c43c1d82be225dce0da4 Mon Sep 17 00:00:00 2001 From: Md Zartaj Afser Date: Tue, 9 Jan 2024 10:42:58 +0530 Subject: [PATCH 1/2] fixed updateChannelMeta and onlyChannelOwner --- contracts/PushCore/PushCoreV2_5.sol | 2 +- contracts/PushCore/PushCoreV2_Temp.sol | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/contracts/PushCore/PushCoreV2_5.sol b/contracts/PushCore/PushCoreV2_5.sol index 5170bb1f..fe177098 100644 --- a/contracts/PushCore/PushCoreV2_5.sol +++ b/contracts/PushCore/PushCoreV2_5.sol @@ -185,7 +185,7 @@ contract PushCoreV2_5 is Initializable, PushCoreStorageV1_5, PausableUpgradeable channelUpdateCounter[_channel] = updateCounter; channels[_channel].channelUpdateBlock = block.number; - IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(_channel, address(this), _amount); + IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(msg.sender, address(this), _amount); emit UpdateChannel(_channel, _newIdentity, _amount); } diff --git a/contracts/PushCore/PushCoreV2_Temp.sol b/contracts/PushCore/PushCoreV2_Temp.sol index 264c5dc1..8477916f 100644 --- a/contracts/PushCore/PushCoreV2_Temp.sol +++ b/contracts/PushCore/PushCoreV2_Temp.sol @@ -93,10 +93,8 @@ contract PushCoreV2_Temp is Initializable, PushCoreStorageV1_5, PausableUpgradea function onlyChannelOwner(address _channel) private view { if ( - ( - (channels[_channel].channelState != 1 || msg.sender != _channel) - || (msg.sender != pushChannelAdmin && _channel == address(0x0)) - ) + !((channels[_channel].channelState == 1 && msg.sender == _channel) || + (msg.sender == pushChannelAdmin && _channel == address(0x0))) ) { revert Errors.UnauthorizedCaller(msg.sender); } @@ -207,7 +205,7 @@ contract PushCoreV2_Temp is Initializable, PushCoreStorageV1_5, PausableUpgradea channelUpdateCounter[_channel] = updateCounter; channels[_channel].channelUpdateBlock = block.number; - IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(_channel, address(this), _amount); + IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(msg.sender, address(this), _amount); emit UpdateChannel(_channel, _newIdentity, _amount); } From 172cd739cba2d7204f431ab327e8e114f70b0e21 Mon Sep 17 00:00:00 2001 From: Md Zartaj Afser Date: Tue, 9 Jan 2024 10:43:28 +0530 Subject: [PATCH 2/2] minor change --- .../PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testFoundry/PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree b/testFoundry/PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree index 85feb483..a4eb6504 100644 --- a/testFoundry/PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree +++ b/testFoundry/PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree @@ -13,4 +13,4 @@ updateChannelMeta.t.sol └── when amount passed is accurate ├── it should update the channel successfully ├── it should update variables correctly - └── fees should increase linearly for every update \ No newline at end of file + └── it should increase the fees linearly for every update \ No newline at end of file