From f60fbf132f81e56ffb34014c24aa0057b91aa467 Mon Sep 17 00:00:00 2001 From: ichristwin Date: Mon, 8 Apr 2024 14:04:46 +0100 Subject: [PATCH] set fee account as constant --- src/Solaxy.sol | 18 ++++++++---------- test/Solaxy.invariant.t.sol | 4 ++-- test/Solaxy.t.sol | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Solaxy.sol b/src/Solaxy.sol index 39dcd8d..2eba0e3 100644 --- a/src/Solaxy.sol +++ b/src/Solaxy.sol @@ -12,20 +12,18 @@ import {IERC721} from "@openzeppelin/contracts@5.0.2/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(); } /** @@ -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); } diff --git a/test/Solaxy.invariant.t.sol b/test/Solaxy.invariant.t.sol index 28c4bb7..4ab603f 100644 --- a/test/Solaxy.invariant.t.sol +++ b/test/Solaxy.invariant.t.sol @@ -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(); @@ -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(), diff --git a/test/Solaxy.t.sol b/test/Solaxy.t.sol index 7c037b7..ecd7a6f 100644 --- a/test/Solaxy.t.sol +++ b/test/Solaxy.t.sol @@ -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(); @@ -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); } @@ -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); }