Skip to content

Commit 456f657

Browse files
authored
Merge pull request #252 from ethereum-push-notification-service/fixes-updatechannelMeta-and-onlyChannelOwner
Fixes updatechannel meta and only channel owner
2 parents 68e452e + 172cd73 commit 456f657

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

contracts/PushCore/PushCoreV2_5.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ contract PushCoreV2_5 is Initializable, PushCoreStorageV1_5, PausableUpgradeable
185185
channelUpdateCounter[_channel] = updateCounter;
186186
channels[_channel].channelUpdateBlock = block.number;
187187

188-
IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(_channel, address(this), _amount);
188+
IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(msg.sender, address(this), _amount);
189189
emit UpdateChannel(_channel, _newIdentity, _amount);
190190
}
191191

contracts/PushCore/PushCoreV2_Temp.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ contract PushCoreV2_Temp is Initializable, PushCoreStorageV1_5, PausableUpgradea
9393

9494
function onlyChannelOwner(address _channel) private view {
9595
if (
96-
(
97-
(channels[_channel].channelState != 1 || msg.sender != _channel)
98-
|| (msg.sender != pushChannelAdmin && _channel == address(0x0))
99-
)
96+
!((channels[_channel].channelState == 1 && msg.sender == _channel) ||
97+
(msg.sender == pushChannelAdmin && _channel == address(0x0)))
10098
) {
10199
revert Errors.UnauthorizedCaller(msg.sender);
102100
}
@@ -207,7 +205,7 @@ contract PushCoreV2_Temp is Initializable, PushCoreStorageV1_5, PausableUpgradea
207205
channelUpdateCounter[_channel] = updateCounter;
208206
channels[_channel].channelUpdateBlock = block.number;
209207

210-
IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(_channel, address(this), _amount);
208+
IERC20(PUSH_TOKEN_ADDRESS).safeTransferFrom(msg.sender, address(this), _amount);
211209
emit UpdateChannel(_channel, _newIdentity, _amount);
212210
}
213211

testFoundry/PushCore/unit_tests/ChannelUpdation/updateChannelMeta.tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ updateChannelMeta.t.sol
1313
└── when amount passed is accurate
1414
├── it should update the channel successfully
1515
├── it should update variables correctly
16-
└── fees should increase linearly for every update
16+
└── it should increase the fees linearly for every update

0 commit comments

Comments
 (0)