Fix & Optimize contract
This commit is contained in:
@@ -18,6 +18,11 @@ import "../../interfaces/IUSDY.sol";
|
||||
contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgradeable {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow constructor
|
||||
constructor() {
|
||||
_disableInitializers();
|
||||
}
|
||||
|
||||
error Forbidden();
|
||||
error InvalidAddress();
|
||||
error InvalidDuration();
|
||||
@@ -64,6 +69,8 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
|
||||
);
|
||||
event CooldownDurationSet(uint256 duration);
|
||||
event HandlerSet(address indexed handler, bool isActive);
|
||||
event GovChanged(address indexed oldGov, address indexed newGov);
|
||||
event AumAdjustmentChanged(uint256 addition, uint256 deduction);
|
||||
|
||||
modifier onlyGov() {
|
||||
if (msg.sender != gov) revert Forbidden();
|
||||
@@ -109,7 +116,9 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
|
||||
|
||||
function setGov(address _gov) external onlyGov {
|
||||
if (_gov == address(0)) revert InvalidAddress();
|
||||
address oldGov = gov;
|
||||
gov = _gov;
|
||||
emit GovChanged(oldGov, _gov);
|
||||
}
|
||||
|
||||
function setHandler(address _handler, bool _isActive) external onlyGov {
|
||||
@@ -126,6 +135,7 @@ contract YTPoolManager is Initializable, UUPSUpgradeable, ReentrancyGuardUpgrade
|
||||
function setAumAdjustment(uint256 _addition, uint256 _deduction) external onlyGov {
|
||||
aumAddition = _addition;
|
||||
aumDeduction = _deduction;
|
||||
emit AumAdjustmentChanged(_addition, _deduction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user