Skip to content

Commit

Permalink
removed unnecessary receive function
Browse files Browse the repository at this point in the history
  • Loading branch information
iChristwin committed Mar 11, 2024
1 parent 42bad08 commit 28be5ef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
7 changes: 0 additions & 7 deletions src/Solaxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
*/
Expand Down
13 changes: 2 additions & 11 deletions src/XRC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ import "@openzeppelin/[email protected]/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);
}
}

1 change: 0 additions & 1 deletion src/interfaces/ISolaxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.24;
import {IERC4626} from "@openzeppelin/[email protected]/interfaces/IERC4626.sol";
import {UD60x18} from "@prb/[email protected]/src/UD60x18.sol";

error PayableErr();
error Undersupply();
error CannotBeZero();
error SlippageError();
Expand Down
10 changes: 3 additions & 7 deletions test/Solaxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/interfaces/IERC20.sol";
import {IERC721} from "@openzeppelin/[email protected]/interfaces/IERC721.sol";

contract SolaxyTestWithoutM3ter is Test {
contract SolaxyUnitTest is Test {
Solaxy public SLX;
IERC20 public sDAI;
address public here;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 28be5ef

Please sign in to comment.