Skip to content

Commit

Permalink
Merge pull request #252 from ethereum-push-notification-service/fixes…
Browse files Browse the repository at this point in the history
…-updatechannelMeta-and-onlyChannelOwner

Fixes updatechannel meta and only channel owner
  • Loading branch information
zaryab2000 authored Jan 9, 2024
2 parents 68e452e + 172cd73 commit 456f657
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contracts/PushCore/PushCoreV2_5.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 3 additions & 5 deletions contracts/PushCore/PushCoreV2_Temp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
└── it should increase the fees linearly for every update

0 comments on commit 456f657

Please sign in to comment.