Skip to content

Commit

Permalink
set fee account as constant
Browse files Browse the repository at this point in the history
  • Loading branch information
iChristwin committed Apr 8, 2024
1 parent 5e2890c commit f60fbf1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 8 additions & 10 deletions src/Solaxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ import {IERC721} from "@openzeppelin/[email protected]/interfaces/IERC721.sol";
* @dev Adheres to ERC-20 token standard and uses the ERC-4626 tokenized vault interface for bonding curve operations.
*/
contract Solaxy is ERC20ABC, ISolaxy {
address public immutable FEE_ADDRESS;
UD60x18 public constant SLOPE = UD60x18.wrap(0.0025e18);
UD60x18 public constant HALF_SLOPE = UD60x18.wrap(0.00125e18);
ERC20 public constant SDAI = ERC20(0xaf204776c7245bF4147c2612BF6e5972Ee483701);
address public constant FEE_ACCOUNT = 0xbCFeFea1e83060DbCEf2Ed0513755D049fDE952C; // TODO: fee Address
IERC721 public constant M3TER = IERC721(0xbCFeFea1e83060DbCEf2Ed0513755D049fDE952C); // TODO: M3ter Address
ERC20 public constant SDAI = ERC20(0xaf204776c7245bF4147c2612BF6e5972Ee483701);
UD60x18 public constant HALF_SLOPE = UD60x18.wrap(0.00125e18);
UD60x18 public constant SLOPE = UD60x18.wrap(0.0025e18);

/**
* @dev Constructs the Solaxy contract, initializing the sDAI token and the fee address.
* @param feeAccount The address where fees will be sent to.
* @dev Constructs the Solaxy contract, checks the sDAI token address and the fee account address.
*/
constructor(address feeAccount) ERC20("Solaxy", "SLX") ERC20Permit("Solaxy") {
constructor() ERC20("Solaxy", "SLX") ERC20Permit("Solaxy") {
if (address(SDAI) == address(0)) revert CannotBeZero();
if (feeAccount == address(0)) revert CannotBeZero();
FEE_ADDRESS = feeAccount;
if (FEE_ACCOUNT == address(0)) revert CannotBeZero();
}

/**
Expand Down Expand Up @@ -310,7 +308,7 @@ contract Solaxy is ERC20ABC, ISolaxy {
}
_burn(owner, shares);

if (!transfer(FEE_ADDRESS, fee)) revert TransferError();
if (!transfer(FEE_ACCOUNT, fee)) revert TransferError();
if (!SDAI.transfer(receiver, assets)) revert TransferError();
emit Withdraw(msg.sender, receiver, owner, assets, shares);
}
Expand Down
4 changes: 2 additions & 2 deletions test/Solaxy.invariant.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ contract SolaxyInvarantTest is Test {
string memory url = vm.rpcUrl("gnosis-mainnet");
vm.createSelectFork(url);

SLX = new Solaxy(address(99));
SLX = new Solaxy();
SLX_address = address(SLX);

sDAI_address = SLX.asset();
Expand All @@ -84,7 +84,7 @@ contract SolaxyInvarantTest is Test {
uint256 solaxyTVL = sDAI_balanceOneBillion - sDAI_balanceAfterTest;
assertEq(SLX.totalAssets(), solaxyTVL, "Total value locked should be strictly equal to total reserve assets");

uint256 totalFees = SLX.balanceOf(address(99));
uint256 totalFees = SLX.balanceOf(SLX.FEE_ACCOUNT());
uint256 totalHoldings = SLX.balanceOf(handlerAddress);
assertEq(
SLX.totalSupply(),
Expand Down
6 changes: 3 additions & 3 deletions test/Solaxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract SolaxyUnitTest is Test {
vm.createSelectFork(url);
here = address(this);

SLX = new Solaxy(address(99));
SLX = new Solaxy();
SLX_address = address(SLX);

sDAI_address = SLX.asset();
Expand Down Expand Up @@ -98,7 +98,7 @@ contract SolaxyUnitTest is Test {
);

// Check for fees
uint256 SLX_feeBalance = SLX.balanceOf(address(99));
uint256 SLX_feeBalance = SLX.balanceOf(SLX.FEE_ACCOUNT());
assertEq(SLX_feeBalance, 1795000000000000000);
}

Expand Down Expand Up @@ -149,7 +149,7 @@ contract SolaxyUnitTest is Test {
);

// Check for fees
uint256 SLX_feeBalance = SLX.balanceOf(address(99));
uint256 SLX_feeBalance = SLX.balanceOf(SLX.FEE_ACCOUNT());
assertEq(SLX_feeBalance, 1793880000000000000);
}

Expand Down

0 comments on commit f60fbf1

Please sign in to comment.