Skip to content

Commit

Permalink
check governor
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Jan 10, 2025
1 parent 67b0d91 commit f2afad7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions contracts/partners/tokenWrappers/SonicFragment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ contract SonicFragment is ERC2O {
// ================================= MODIFIERS =================================

/// @notice Checks whether the `msg.sender` has the governor role or the guardian role
modifier isGovernor() {
modifier onlyGovernor() {
if (!accessControlManager.isGovernor(msg.sender)) revert Errors.NotAllowed();
_;
}

/// @notice Activates the contract settlement and enables redemption of fragments into S
function settleContract(uint256 sTokenAmount) external isGovernor {
function settleContract(uint256 sTokenAmount) external onlyGovernor {
if (contractSettled > 0) revert Errors.NotAllowed();
IERC20(sToken).safeTransferFrom(msg.sender, address(this), sTokenAmount);
contractSettled = 1;
Expand All @@ -52,20 +52,20 @@ contract SonicFragment is ERC2O {

/// @notice Sets the S address
/// @dev Cannot be set once redemption is activated
function setSTokenAddress(address sTokenAddress) external isGovernor {
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);
exchangeRate = 0;
}

/// @notice Redeems fragments against S
function redeem(uint256 amount, address recipient) external {
_burn(msg.sender, amount);
uint256 amountToSend = (amount * exchangeRate) / 1 ether;
IERC20(sToken).safeTransfer(recipient, amount);
}

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

0 comments on commit f2afad7

Please sign in to comment.