diff --git a/contracts/PointTokenVault.sol b/contracts/PointTokenVault.sol index d2b25e9..fd6f5f6 100644 --- a/contracts/PointTokenVault.sol +++ b/contracts/PointTokenVault.sol @@ -243,4 +243,6 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall } function _authorizeUpgrade(address _newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} + + receive() external payable {} } diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index b0b2f8e..2f5970d 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -53,13 +53,13 @@ contract PointTokenVaultScripts is BatchScript { function run(string memory version) public returns (PointTokenVault) { PointTokenVault pointTokenVaultImplementation = new PointTokenVault{salt: keccak256(abi.encode(version))}(); - PointTokenVault pointTokenVault = PointTokenVault( + PointTokenVault pointTokenVault = PointTokenVault(payable( address( new ERC1967Proxy{salt: keccak256(abi.encode(version))}( address(pointTokenVaultImplementation), abi.encodeCall(PointTokenVault.initialize, (msg.sender)) // msg.sender is admin ) - ) + )) ); return pointTokenVault; @@ -69,7 +69,7 @@ contract PointTokenVaultScripts is BatchScript { vm.startBroadcast(JIM_PRIVATE_KEY); ERC20 token = ERC20(0x791a051631c9c4cDf4E03Fb7Aec3163AE164A34B); - PointTokenVault pointTokenVault = PointTokenVault(0xbff7Fb79efC49504afc97e74F83EE618768e63E9); + PointTokenVault pointTokenVault = PointTokenVault(payable(0xbff7Fb79efC49504afc97e74F83EE618768e63E9)); token.symbol(); token.approve(address(pointTokenVault), 2.5e18); @@ -83,7 +83,7 @@ contract PointTokenVaultScripts is BatchScript { function upgrade() public { vm.startBroadcast(); - PointTokenVault currentPointTokenVault = PointTokenVault(0xbff7Fb79efC49504afc97e74F83EE618768e63E9); + PointTokenVault currentPointTokenVault = PointTokenVault(payable(0xbff7Fb79efC49504afc97e74F83EE618768e63E9)); PointTokenVault PointTokenVaultImplementation = new PointTokenVault(); @@ -95,7 +95,7 @@ contract PointTokenVaultScripts is BatchScript { function deployPToken() public { vm.startBroadcast(JIM_PRIVATE_KEY); - PointTokenVault pointTokenVault = PointTokenVault(0xbff7Fb79efC49504afc97e74F83EE618768e63E9); + PointTokenVault pointTokenVault = PointTokenVault(payable(0xbff7Fb79efC49504afc97e74F83EE618768e63E9)); pointTokenVault.deployPToken(LibString.packTwo("ETHERFI Points", "pEF")); diff --git a/contracts/test/PointTokenVault.t.sol b/contracts/test/PointTokenVault.t.sol index 351ac20..05a4ee8 100644 --- a/contracts/test/PointTokenVault.t.sol +++ b/contracts/test/PointTokenVault.t.sol @@ -497,6 +497,22 @@ contract PointTokenVaultTest is Test { assertEq(rewardToken.balanceOf(vitalik), 2e18); assertEq(pointTokenVault.pTokens(eigenPointsId).balanceOf(vitalik), 0); } + + function test_ReceiveETH() public payable { + // Amount of ETH to send + uint256 amountToSend = 1 ether; + + // Record the initial balance of the PointTokenVault + uint256 initialBalance = address(pointTokenVault).balance; + + // Send ETH to the PointTokenVault + (bool sent,) = address(pointTokenVault).call{value: 1 ether}(""); + require(sent, "Failed to send Ether"); + + // Check the new balance of the PointTokenVault + uint256 newBalance = address(pointTokenVault).balance; + assertEq(newBalance, initialBalance + amountToSend); + } } contract Echo {