Skip to content

Commit

Permalink
Fix roles.
Browse files Browse the repository at this point in the history
  • Loading branch information
LybraFinance committed Aug 28, 2023
1 parent 8e75d59 commit a7d48f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 6 additions & 0 deletions contracts/lybra/configuration/LybraConfigurator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ contract LybraConfigurator is Initializable {
event SendProtocolRewards(address indexed token, uint256 amount, uint256 timestamp);
event EUSDOracleChanged(address oldAddr, address newAddr, uint256 timestamp);
event CurvePoolChanged(address oldAddr, address newAddr, uint256 timestamp);
event GovernanceTimelockChanged(address newAddr, uint256 timestamp);

/// @notice Emitted when the fees for flash loaning a token have been updated
/// @param fee The new fee for this token as a percentage and multiplied by 100 to avoid decimals (for example, 10% is 10_00)
Expand Down Expand Up @@ -112,6 +113,11 @@ contract LybraConfigurator is Initializable {
_;
}

function setGovernanceTimelock(address _governance) external onlyRole(DAO) {
GovernanceTimelock = IGovernanceTimelock(_governance);
emit GovernanceTimelockChanged(_governance, block.timestamp);
}

/**
* @notice Initializes the eUSD and peUSD address. This function can only be executed once.
*/
Expand Down
13 changes: 5 additions & 8 deletions contracts/lybra/governance/GovernanceTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ contract GovernanceTimelock is TimelockController {
bytes32 public constant DAO = keccak256("DAO");
bytes32 public constant TIMELOCK = keccak256("TIMELOCK");
bytes32 public constant ADMIN = keccak256("ADMIN");
bytes32 public constant GOV = keccak256("GOV");

constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) TimelockController(minDelay, proposers, executors, admin) {

_setRoleAdmin(DAO, GOV);
_setRoleAdmin(TIMELOCK, GOV);
_setRoleAdmin(ADMIN, GOV);
_grantRole(DAO, address(this));
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address timeLock) TimelockController(minDelay, proposers, executors, msg.sender) {
_setRoleAdmin(DAO, DAO);
_setRoleAdmin(TIMELOCK, DAO);
_setRoleAdmin(ADMIN, DAO);
_grantRole(DAO, msg.sender);
_grantRole(GOV, msg.sender);
_grantRole(TIMELOCK, timeLock);
}

function checkRole(bytes32 role, address _sender) public view returns(bool){
Expand Down

0 comments on commit a7d48f4

Please sign in to comment.