Skip to content

Commit

Permalink
Use onlyAdmin modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmkm committed Dec 17, 2024
1 parent 2165da9 commit bc737b8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/token/SonicBeetsMigrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ contract SonicBeetsMigrator is ReentrancyGuard {
admin = msg.sender;
}

modifier onlyAdmin() {
require(msg.sender == admin, NotAdmin());
_;
}

function exchangeOperaToSonic(uint256 amount) external nonReentrant {
require(operaToSonicEnabled, MigrationDisabled());
require(OPERABEETS.balanceOf(msg.sender) >= amount, UserBalanceInsufficient());
Expand All @@ -43,28 +48,23 @@ contract SonicBeetsMigrator is ReentrancyGuard {
OPERABEETS.transfer(msg.sender, amount);
}

function setAdmin(address _admin) external {
require(msg.sender == admin, NotAdmin());
function setAdmin(address _admin) external onlyAdmin {
admin = _admin;
}

function enableOperaToSonic(bool _toggle) external {
require(msg.sender == admin, NotAdmin());
function enableOperaToSonic(bool _toggle) external onlyAdmin {
operaToSonicEnabled = _toggle;
}

function enableSonicToOpera(bool _toggle) external {
require(msg.sender == admin, NotAdmin());
function enableSonicToOpera(bool _toggle) external onlyAdmin {
sonicToOperaEnabled = _toggle;
}

function withdrawOperaBeets() external {
require(msg.sender == admin, NotAdmin());
function withdrawOperaBeets() external onlyAdmin {
OPERABEETS.transfer(TREASURY, OPERABEETS.balanceOf(address(this)));
}

function withdrawSonicBeets() external {
require(msg.sender == admin, NotAdmin());
function withdrawSonicBeets() external onlyAdmin {
SONICBEETS.transfer(TREASURY, SONICBEETS.balanceOf(address(this)));
}
}

0 comments on commit bc737b8

Please sign in to comment.