Skip to content

Commit

Permalink
fix: sToken immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Jan 10, 2025
1 parent f2afad7 commit 6416e23
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions contracts/partners/tokenWrappers/SonicFragment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ contract SonicFragment is ERC2O {
using SafeERC20 for IERC20;

/// @notice `AccessControlManager` contract handling access control
IAccessControlManager public accessControlManager;
IAccessControlManager public immutable accessControlManager;
address public immutable sToken;

uint256 public exchangeRate;
address public sToken;
uint8 public contractSettled;

constructor(
address _accessControlManager,
address recipient,
address _sToken,
uint256 _totalSupply,
string memory _name,
string memory _symbol
) ERC20(_name, _symbol) {
// Zero address check
if (_sToken == address(0)) revert ZeroAddress();
IAccessControlManager(_accessControlManager).isGovernor(msg.sender);
sToken = _sToken;
accessControlManager = IAccessControlManager(_accessControlManager);
_mint(recipient, _totalSupply);
}
Expand All @@ -50,12 +54,6 @@ contract SonicFragment is ERC2O {
exchangeRate = (sTokenAmount * 1 ether) / _totalSupply;
}

/// @notice Sets the S address
/// @dev Cannot be set once redemption is activated
function setSTokenAddress(address sTokenAddress) external onlyGovernor {
if (contractSettled == 0) sToken = sTokenAddress;
}

/// @notice Recovers leftover tokens after sometime
function recover(uint256 amount, address recipient) external onlyGovernor {
IERC20(sToken).safeTransfer(recipient, amount);
Expand Down

0 comments on commit 6416e23

Please sign in to comment.