mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-24 19:01:11 +01:00
commit
896fc224ff
@ -143,10 +143,10 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
|
|
||||||
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerBefore = await token.balanceOf(relayer)
|
const balanceRelayerBefore = await token.balanceOf(relayer)
|
||||||
const balanceRecieverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
|
|
||||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRelayerBefore = await web3.eth.getBalance(relayer)
|
const ethBalanceRelayerBefore = await web3.eth.getBalance(relayer)
|
||||||
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
||||||
isSpent.should.be.equal(false)
|
isSpent.should.be.equal(false)
|
||||||
@ -166,18 +166,18 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerAfter = await token.balanceOf(relayer)
|
const balanceRelayerAfter = await token.balanceOf(relayer)
|
||||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRelayerAfter = await web3.eth.getBalance(relayer)
|
const ethBalanceRelayerAfter = await web3.eth.getBalance(relayer)
|
||||||
const feeBN = toBN(fee.toString())
|
const feeBN = toBN(fee.toString())
|
||||||
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
||||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore).add(feeBN))
|
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore).add(feeBN))
|
||||||
balanceRecieverAfter.should.be.eq.BN(
|
balanceReceiverAfter.should.be.eq.BN(
|
||||||
toBN(balanceRecieverBefore).add(toBN(tokenDenomination).sub(feeBN)),
|
toBN(balanceReceiverBefore).add(toBN(tokenDenomination).sub(feeBN)),
|
||||||
)
|
)
|
||||||
|
|
||||||
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore))
|
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore))
|
||||||
ethBalanceRecieverAfter.should.be.eq.BN(toBN(ethBalanceRecieverBefore).add(toBN(refund)))
|
ethBalanceReceiverAfter.should.be.eq.BN(toBN(ethBalanceReceiverBefore).add(toBN(refund)))
|
||||||
ethBalanceRelayerAfter.should.be.eq.BN(toBN(ethBalanceRelayerBefore).sub(toBN(refund)))
|
ethBalanceRelayerAfter.should.be.eq.BN(toBN(ethBalanceRelayerBefore).sub(toBN(refund)))
|
||||||
|
|
||||||
logs[0].event.should.be.equal('Withdrawal')
|
logs[0].event.should.be.equal('Withdrawal')
|
||||||
@ -225,10 +225,10 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
|
|
||||||
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerBefore = await token.balanceOf(relayer)
|
const balanceRelayerBefore = await token.balanceOf(relayer)
|
||||||
const balanceRecieverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
|
|
||||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRelayerBefore = await web3.eth.getBalance(relayer)
|
const ethBalanceRelayerBefore = await web3.eth.getBalance(relayer)
|
||||||
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
||||||
isSpent.should.be.equal(false)
|
isSpent.should.be.equal(false)
|
||||||
@ -246,18 +246,18 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerAfter = await token.balanceOf(relayer)
|
const balanceRelayerAfter = await token.balanceOf(relayer)
|
||||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRelayerAfter = await web3.eth.getBalance(relayer)
|
const ethBalanceRelayerAfter = await web3.eth.getBalance(relayer)
|
||||||
const feeBN = toBN(fee.toString())
|
const feeBN = toBN(fee.toString())
|
||||||
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
||||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore).add(feeBN))
|
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore).add(feeBN))
|
||||||
balanceRecieverAfter.should.be.eq.BN(
|
balanceReceiverAfter.should.be.eq.BN(
|
||||||
toBN(balanceRecieverBefore).add(toBN(tokenDenomination).sub(feeBN)),
|
toBN(balanceReceiverBefore).add(toBN(tokenDenomination).sub(feeBN)),
|
||||||
)
|
)
|
||||||
|
|
||||||
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore))
|
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore))
|
||||||
ethBalanceRecieverAfter.should.be.eq.BN(toBN(ethBalanceRecieverBefore))
|
ethBalanceReceiverAfter.should.be.eq.BN(toBN(ethBalanceReceiverBefore))
|
||||||
ethBalanceRelayerAfter.should.be.eq.BN(toBN(ethBalanceRelayerBefore))
|
ethBalanceRelayerAfter.should.be.eq.BN(toBN(ethBalanceRelayerBefore))
|
||||||
|
|
||||||
logs[0].event.should.be.equal('Withdrawal')
|
logs[0].event.should.be.equal('Withdrawal')
|
||||||
@ -369,8 +369,8 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoBefore = await usdtToken.balanceOf(tornado.address)
|
const balanceTornadoBefore = await usdtToken.balanceOf(tornado.address)
|
||||||
const balanceRelayerBefore = await usdtToken.balanceOf(relayer)
|
const balanceRelayerBefore = await usdtToken.balanceOf(relayer)
|
||||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverBefore = await usdtToken.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverBefore = await usdtToken.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
let isSpent = await tornado.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
let isSpent = await tornado.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
||||||
isSpent.should.be.equal(false)
|
isSpent.should.be.equal(false)
|
||||||
|
|
||||||
@ -390,14 +390,14 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoAfter = await usdtToken.balanceOf(tornado.address)
|
const balanceTornadoAfter = await usdtToken.balanceOf(tornado.address)
|
||||||
const balanceRelayerAfter = await usdtToken.balanceOf(relayer)
|
const balanceRelayerAfter = await usdtToken.balanceOf(relayer)
|
||||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverAfter = await usdtToken.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverAfter = await usdtToken.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const feeBN = toBN(fee.toString())
|
const feeBN = toBN(fee.toString())
|
||||||
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
||||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||||
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore).add(feeBN))
|
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore).add(feeBN))
|
||||||
balanceRecieverAfter.should.be.eq.BN(toBN(balanceRecieverBefore).add(toBN(tokenDenomination)))
|
balanceReceiverAfter.should.be.eq.BN(toBN(balanceReceiverBefore).add(toBN(tokenDenomination)))
|
||||||
ethBalanceRecieverAfter.should.be.eq.BN(toBN(ethBalanceRecieverBefore).add(toBN(refund)).sub(feeBN))
|
ethBalanceReceiverAfter.should.be.eq.BN(toBN(ethBalanceReceiverBefore).add(toBN(refund)).sub(feeBN))
|
||||||
|
|
||||||
logs[0].event.should.be.equal('Withdrawal')
|
logs[0].event.should.be.equal('Withdrawal')
|
||||||
logs[0].args.nullifierHash.should.be.eq.BN(toBN(input.nullifierHash.toString()))
|
logs[0].args.nullifierHash.should.be.eq.BN(toBN(input.nullifierHash.toString()))
|
||||||
@ -456,8 +456,8 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
const balanceTornadoBefore = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerBefore = await token.balanceOf(relayer)
|
const balanceRelayerBefore = await token.balanceOf(relayer)
|
||||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverBefore = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
let isSpent = await tornado.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
let isSpent = await tornado.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
||||||
isSpent.should.be.equal(false)
|
isSpent.should.be.equal(false)
|
||||||
|
|
||||||
@ -478,14 +478,14 @@ contract('ERC20Tornado', (accounts) => {
|
|||||||
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
const balanceTornadoAfter = await token.balanceOf(tornado.address)
|
||||||
const balanceRelayerAfter = await token.balanceOf(relayer)
|
const balanceRelayerAfter = await token.balanceOf(relayer)
|
||||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
const balanceReceiverAfter = await token.balanceOf(toFixedHex(recipient, 20))
|
||||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const ethBalanceReceiverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const feeBN = toBN(fee.toString())
|
const feeBN = toBN(fee.toString())
|
||||||
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(tokenDenomination)))
|
||||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||||
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore).add(feeBN))
|
ethBalanceOperatorAfter.should.be.eq.BN(toBN(ethBalanceOperatorBefore).add(feeBN))
|
||||||
balanceRecieverAfter.should.be.eq.BN(toBN(balanceRecieverBefore).add(toBN(tokenDenomination)))
|
balanceReceiverAfter.should.be.eq.BN(toBN(balanceReceiverBefore).add(toBN(tokenDenomination)))
|
||||||
ethBalanceRecieverAfter.should.be.eq.BN(toBN(ethBalanceRecieverBefore).add(toBN(refund)).sub(feeBN))
|
ethBalanceReceiverAfter.should.be.eq.BN(toBN(ethBalanceReceiverBefore).add(toBN(refund)).sub(feeBN))
|
||||||
|
|
||||||
logs[0].event.should.be.equal('Withdrawal')
|
logs[0].event.should.be.equal('Withdrawal')
|
||||||
logs[0].args.nullifierHash.should.be.eq.BN(toBN(input.nullifierHash.toString()))
|
logs[0].args.nullifierHash.should.be.eq.BN(toBN(input.nullifierHash.toString()))
|
||||||
|
@ -195,7 +195,7 @@ contract('ETHTornado', (accounts) => {
|
|||||||
const balanceTornadoBefore = await web3.eth.getBalance(tornado.address)
|
const balanceTornadoBefore = await web3.eth.getBalance(tornado.address)
|
||||||
const balanceRelayerBefore = await web3.eth.getBalance(relayer)
|
const balanceRelayerBefore = await web3.eth.getBalance(relayer)
|
||||||
const balanceOperatorBefore = await web3.eth.getBalance(operator)
|
const balanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const balanceReceiverBefore = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
let isSpent = await tornado.isSpent(toFixedHex(input.nullifierHash))
|
||||||
isSpent.should.be.equal(false)
|
isSpent.should.be.equal(false)
|
||||||
|
|
||||||
@ -215,12 +215,12 @@ contract('ETHTornado', (accounts) => {
|
|||||||
const balanceTornadoAfter = await web3.eth.getBalance(tornado.address)
|
const balanceTornadoAfter = await web3.eth.getBalance(tornado.address)
|
||||||
const balanceRelayerAfter = await web3.eth.getBalance(relayer)
|
const balanceRelayerAfter = await web3.eth.getBalance(relayer)
|
||||||
const balanceOperatorAfter = await web3.eth.getBalance(operator)
|
const balanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||||
const balanceRecieverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
const balanceReceiverAfter = await web3.eth.getBalance(toFixedHex(recipient, 20))
|
||||||
const feeBN = toBN(fee.toString())
|
const feeBN = toBN(fee.toString())
|
||||||
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(value)))
|
balanceTornadoAfter.should.be.eq.BN(toBN(balanceTornadoBefore).sub(toBN(value)))
|
||||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||||
balanceOperatorAfter.should.be.eq.BN(toBN(balanceOperatorBefore).add(feeBN))
|
balanceOperatorAfter.should.be.eq.BN(toBN(balanceOperatorBefore).add(feeBN))
|
||||||
balanceRecieverAfter.should.be.eq.BN(toBN(balanceRecieverBefore).add(toBN(value)).sub(feeBN))
|
balanceReceiverAfter.should.be.eq.BN(toBN(balanceReceiverBefore).add(toBN(value)).sub(feeBN))
|
||||||
|
|
||||||
logs[0].event.should.be.equal('Withdrawal')
|
logs[0].event.should.be.equal('Withdrawal')
|
||||||
logs[0].args.nullifierHash.should.be.equal(toFixedHex(input.nullifierHash))
|
logs[0].args.nullifierHash.should.be.equal(toFixedHex(input.nullifierHash))
|
||||||
|
Loading…
Reference in New Issue
Block a user