From 28be5efd612980083979816e3cb0b9717fdd6714 Mon Sep 17 00:00:00 2001 From: ichristwin Date: Tue, 12 Mar 2024 00:29:33 +0100 Subject: [PATCH] removed unnecessary receive function --- src/Solaxy.sol | 7 ------- src/XRC20.sol | 13 ++----------- src/interfaces/ISolaxy.sol | 1 - test/Solaxy.t.sol | 10 +++------- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/Solaxy.sol b/src/Solaxy.sol index 14e7d09..db7e20c 100644 --- a/src/Solaxy.sol +++ b/src/Solaxy.sol @@ -28,13 +28,6 @@ contract Solaxy is XRC20, ISolaxy { FEE_ADDRESS = feeAccount; } - /** - * @dev Fallback function to revert Ether transfers directly to the contract. - */ - receive() external payable { - revert PayableErr(); - } - /** * @dev See {IERC4626-deposit}. */ diff --git a/src/XRC20.sol b/src/XRC20.sol index d058ae4..8c29a39 100644 --- a/src/XRC20.sol +++ b/src/XRC20.sol @@ -9,20 +9,11 @@ import "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/ERC20FlashMint.sol" abstract contract XRC20 is ERC20, ERC20Permit, ERC20Votes, ERC20FlashMint { // The following functions are overrides required by Solidity. - function _update(address from, address to, uint256 value) - internal - override(ERC20, ERC20Votes) - { + function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Votes) { super._update(from, to, value); } - function nonces(address owner) - public - view - override(ERC20Permit, Nonces) - returns (uint256) - { + function nonces(address owner) public view override(ERC20Permit, Nonces) returns (uint256) { return super.nonces(owner); } } - diff --git a/src/interfaces/ISolaxy.sol b/src/interfaces/ISolaxy.sol index 5054bb7..a39162c 100644 --- a/src/interfaces/ISolaxy.sol +++ b/src/interfaces/ISolaxy.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.24; import {IERC4626} from "@openzeppelin/contracts@5.0.2/interfaces/IERC4626.sol"; import {UD60x18} from "@prb/math@4.0.2/src/UD60x18.sol"; -error PayableErr(); error Undersupply(); error CannotBeZero(); error SlippageError(); diff --git a/test/Solaxy.t.sol b/test/Solaxy.t.sol index 7df5186..4d25d42 100644 --- a/test/Solaxy.t.sol +++ b/test/Solaxy.t.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.19; import {Test} from "forge-std/Test.sol"; import {Solaxy} from "../src/Solaxy.sol"; -import {PayableErr, RequiresM3ter} from "../src/interfaces/ISolaxy.sol"; +import {RequiresM3ter} from "../src/interfaces/ISolaxy.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts@5.0.2/interfaces/IERC721.sol"; -contract SolaxyTestWithoutM3ter is Test { +contract SolaxyUnitTest is Test { Solaxy public SLX; IERC20 public sDAI; address public here; @@ -41,26 +41,22 @@ contract SolaxyTestWithoutM3ter is Test { } function testSendEtherToContract() public { - vm.expectRevert(PayableErr.selector); // expect a transaction revert during test. + vm.expectRevert(); // expect a transaction revert during test. payable(SLX_address).transfer(1 ether); // Sending 1 Ether to the contract assertEq(SLX_address.balance, 0 ether, "asset ether balance is still equal to zero"); } function testNonM3terHolder() public { vm.expectRevert(RequiresM3ter.selector); - // Deposit sDAI to Solaxy contract SLX.deposit(sDAI_amountDeposited, here); vm.expectRevert(RequiresM3ter.selector); - // Withdraw sDAI from Solaxy contract SLX.withdraw(sDAI_amountWithdrawn, here, here); vm.expectRevert(RequiresM3ter.selector); - // Mint new SLX tokens SLX.mint(SLX_amountMinted, here); vm.expectRevert(RequiresM3ter.selector); - // Redeem SLX tokens SLX.redeem(SLX_amountIn, here, here); }