Skip to content
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
5 changes: 4 additions & 1 deletion src/WEETHModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.21;

import { AccessControlEnumerable } from "openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol";
import { IERC20Metadata as IERC20 } from "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

import { Ethereum } from "spark-address-registry/Ethereum.sol";

Expand All @@ -16,6 +17,8 @@ interface IWithdrawRequestNFTLike {

contract WEETHModule is AccessControlEnumerable {

using SafeERC20 for IERC20;

address public immutable almProxy;

/**********************************************************************************************/
Expand Down Expand Up @@ -58,7 +61,7 @@ contract WEETHModule is AccessControlEnumerable {
// Wrap ETH to WETH.
IWETHLike(Ethereum.WETH).deposit{value: ethReceived}();

IERC20(Ethereum.WETH).transfer(almProxy, ethReceived);
IERC20(Ethereum.WETH).safeTransfer(almProxy, ethReceived);
}

function onERC721Received(address, address, uint256, bytes calldata) external returns (bytes4) {
Expand Down
1 change: 0 additions & 1 deletion src/libraries/WEETHLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface ILiquidityPoolLike {

interface IWEETHLike is IERC20 {
function eETH() external view returns (address);
function getEETHByWeETH(uint256 weETHAmount) external view returns (uint256);
function unwrap(uint256 amount) external returns (uint256);
function wrap(uint256 amount) external returns (uint256);
}
Expand Down
7 changes: 6 additions & 1 deletion test/mainnet-fork/weETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity >=0.8.0;

import { ReentrancyGuard } from "../../lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol";

import { IWEETHLike, IEETHLike } from "../../src/libraries/WEETHLib.sol";
import { IEETHLike } from "../../src/libraries/WEETHLib.sol";

import { WEETHModule } from "../../src/WEETHModule.sol";

Expand All @@ -26,6 +26,11 @@ interface IWithdrawRequestNFTLike {
function roleRegistry() external view returns (address);
}

interface IWEETHLike is IERC20 {
function eETH() external view returns (address);
function getEETHByWeETH(uint256 weETHAmount) external view returns (uint256);
}

contract MainnetControllerWeETHTestBase is ForkTestBase {

IWEETHLike weETH = IWEETHLike(Ethereum.WEETH);
Expand Down
Loading