Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivate to send eth in messageBridge function #27

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/inheritedMainContracts/PolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ contract PolygonZkEVMBridge is
bool forceUpdateGlobalExitRoot,
bytes calldata metadata
) public virtual payable ifNotEmergencyState {
if (msg.value != 0 && !isDeployedOnL2) {
if (msg.value != 0) {
revert MsgValueNotZero();
}
if (
Expand Down
14 changes: 12 additions & 2 deletions test/contracts/bridge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
const depositCount = await polygonZkEVMBridgeContract.depositCount();
const originNetwork = networkIDMainnet;
const originAddress = deployer.address;
const amount = ethers.utils.parseEther('10');
const amount = ethers.utils.parseEther('0');
const destinationNetwork = networkIDRollup;
const destinationAddress = deployer.address;

Expand Down Expand Up @@ -246,7 +246,7 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
const depositCount = await polygonZkEVMBridgeContract.depositCount();
const originNetwork = networkIDMainnet;
const tokenAddress = tokenContract.address;
const amount = ethers.utils.parseEther('10');
const amount = ethers.utils.parseEther('0');
const destinationNetwork = networkIDRollup;
const destinationAddress = deployer.address;

Expand Down Expand Up @@ -1193,6 +1193,16 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
metadata,
)).to.be.revertedWith('AlreadyClaimed');
});
it('should not allow to send message with ether', async () => {
const amount = ethers.utils.parseEther('10');
await expect(polygonZkEVMBridgeContract.bridgeMessage(
networkIDRollup,
ethers.constants.AddressZero,
true,
'0x',
{ value: amount },
)).to.be.revertedWith('MsgValueNotZero()');
});
});

describe('PolygonZkEVMBridge Contract - for L1', () => {
Expand Down
Loading