linter fixes

This commit is contained in:
Drygin 2022-01-22 03:23:33 +03:00
parent bd4500d7ff
commit 1f1964417a
6 changed files with 52 additions and 43 deletions

View File

@ -5,11 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WETH is ERC20 {
constructor(
string memory name,
string memory ticker
) ERC20(name, ticker) {}
constructor(string memory name, string memory ticker) ERC20(name, ticker) {}
function deposit() external payable {
_mint(msg.sender, msg.value);
@ -17,7 +13,7 @@ contract WETH is ERC20 {
function withdraw(uint256 value) external {
_burn(msg.sender, value);
(bool success, ) = msg.sender.call{value: value}("");
(bool success, ) = msg.sender.call{ value: value }("");
require(success, "WETH: ETH transfer failed");
}
}

View File

@ -276,7 +276,11 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard,
if (_extData.extAmount < 0) {
require(_extData.recipient != address(0), "Can't withdraw to zero address");
if (_extData.isL1Withdrawal) {
token.transferAndCall(omniBridge, uint256(-_extData.extAmount), abi.encodePacked(l1Unwrapper, _extData.recipient, _extData.l1Fee));
token.transferAndCall(
omniBridge,
uint256(-_extData.extAmount),
abi.encodePacked(l1Unwrapper, _extData.recipient, _extData.l1Fee)
);
} else {
token.transfer(_extData.recipient, uint256(-_extData.extAmount));
}

View File

@ -78,7 +78,7 @@ contract L1Unwrapper is WETHOmnibridgeRouter {
address _token,
uint256 _value,
bytes memory _data
) override external {
) external override {
require(_token == address(WETH));
require(msg.sender == address(bridge));
require(_data.length == 52);

View File

@ -26,8 +26,7 @@ library BytesHelper {
* @param _start start index of slice
* @return x uint included in the 32 length slice of the bytes array in parameter.
*/
function sliceToUint(bytes memory _bytes, uint _start) internal pure returns (uint x)
{
function sliceToUint(bytes memory _bytes, uint256 _start) internal pure returns (uint256 x) {
require(_bytes.length >= _start + 32, "slicing out of range");
assembly {
x := mload(add(_bytes, add(0x20, _start)))

View File

@ -16,7 +16,17 @@ async function buildMerkleTree({ tornadoPool }) {
return new MerkleTree(MERKLE_TREE_HEIGHT, leaves, { hashFunction: poseidonHash2 })
}
async function getProof({ inputs, outputs, tree, extAmount, fee, recipient, relayer, isL1Withdrawal, l1Fee }) {
async function getProof({
inputs,
outputs,
tree,
extAmount,
fee,
recipient,
relayer,
isL1Withdrawal,
l1Fee,
}) {
inputs = shuffle(inputs)
outputs = shuffle(outputs)

View File

@ -35,7 +35,7 @@ describe('TornadoPool', function () {
await token.mint(sender.address, utils.parseEther('10000'))
const l1Token = await deploy('WETH', 'Wrapped ETH', 'WETH')
await l1Token.deposit({value: utils.parseEther('3')})
await l1Token.deposit({ value: utils.parseEther('3') })
const amb = await deploy('MockAMB', gov.address, l1ChainId)
const omniBridge = await deploy('MockOmniBridge', amb.address)