mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-22 09:47:13 +01:00
check that eth value in ERC20 deposit is zero
This commit is contained in:
parent
bec65f217f
commit
b578213b0c
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user