Skip to content

Commit

Permalink
add events in ynBase
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Mar 26, 2024
1 parent 03c0d0f commit f3b922e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/ynBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ pragma solidity ^0.8.24;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";


interface IynBaseEvents {
event TransfersUnpaused();
event PauseWhitelistUpdated(address indexed account, bool isWhitelisted);
}

/// @title ynBase
/// @dev This contract serves as the base for the YieldNest protocol, providing core functionalities such as
/// ERC20 token mechanics, access control, and transfer pause capabilities.
/// It integrates with OpenZeppelin's upgradeable contracts for ERC20 and AccessControl functionalities.
/// The contract includes mechanisms to pause transfers, manage a whitelist for paused transfers, and handle initialization processes.
contract ynBase is ERC20Upgradeable, AccessControlUpgradeable {
contract ynBase is ERC20Upgradeable, AccessControlUpgradeable, IynBaseEvents {

//--------------------------------------------------------------------------------------
//---------------------------------- ERRORS ------------------------------------------
Expand Down Expand Up @@ -89,6 +95,7 @@ contract ynBase is ERC20Upgradeable, AccessControlUpgradeable {
function unpauseTransfers() external onlyRole(PAUSER_ROLE) {
ynBaseStorage storage $ = _getYnBaseStorage();
$.transfersPaused = false;
emit TransfersUnpaused();
}

/**
Expand Down Expand Up @@ -117,7 +124,9 @@ contract ynBase is ERC20Upgradeable, AccessControlUpgradeable {
function _updatePauseWhitelist(address[] memory whitelistedForTransfers, bool whitelisted) internal {
ynBaseStorage storage $ = _getYnBaseStorage();
for (uint256 i = 0; i < whitelistedForTransfers.length; i++) {
$.pauseWhiteList[whitelistedForTransfers[i]] = whitelisted;
address targetAddress = whitelistedForTransfers[i];
$.pauseWhiteList[targetAddress] = whitelisted;
emit PauseWhitelistUpdated(targetAddress, whitelisted);
}
}

Expand Down

0 comments on commit f3b922e

Please sign in to comment.