diff --git a/contracts/ERC20Mixer.sol b/contracts/ERC20Mixer.sol index 5941f0e..fdee640 100644 --- a/contracts/ERC20Mixer.sol +++ b/contracts/ERC20Mixer.sol @@ -28,6 +28,7 @@ contract ERC20Mixer is Mixer { } function _processDeposit() internal { + require(msg.value == 0, "ETH value is supposed to be 0 for ETH mixer"); safeErc20TransferFrom(msg.sender, address(this), denomination); } diff --git a/test/ERC20Mixer.test.js b/test/ERC20Mixer.test.js index 8e0d42d..8818a79 100644 --- a/test/ERC20Mixer.test.js +++ b/test/ERC20Mixer.test.js @@ -102,6 +102,14 @@ contract('ERC20Mixer', accounts => { logs[0].args.commitment.should.be.eq.BN(toBN(commitment)) logs[0].args.leafIndex.should.be.eq.BN(toBN(0)) }) + + it('should not allow to send ether on deposit', async () => { + const commitment = 43 + await token.approve(mixer.address, tokenDenomination) + + let error = await mixer.deposit(commitment, { from: sender, value: 1e6 }).should.be.rejected + error.reason.should.be.equal('ETH value is supposed to be 0 for ETH mixer') + }) }) describe('#withdraw', () => {