Skip to content

Commit

Permalink
Merge pull request #577 from hats-finance/exclude-addrc-from-timelock
Browse files Browse the repository at this point in the history
Exclude addRewardController from timelock
  • Loading branch information
jellegerbrandy authored Jul 4, 2024
2 parents 385bf0a + b96576f commit b05b7db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/HATTimelockController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ contract HATTimelockController is TimelockController {
external onlyRole(PROPOSER_ROLE) {
_rewardController.setAllocPoint(address(_vault), _allocPoint);
}

function addRewardController(IHATVault _vault, IRewardController _rewardController) external onlyRole(PROPOSER_ROLE) {
_vault.addRewardController(_rewardController);
}

function swapAndSend(
IHATVaultsRegistry _registry,
Expand Down
17 changes: 17 additions & 0 deletions docs/dodoc/HATTimelockController.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,23 @@ function TIMELOCK_ADMIN_ROLE() external view returns (bytes32)
|---|---|---|
| _0 | bytes32 | undefined |

### addRewardController

```solidity
function addRewardController(contract IHATVault _vault, contract IRewardController _rewardController) external nonpayable
```





#### Parameters

| Name | Type | Description |
|---|---|---|
| _vault | contract IHATVault | undefined |
| _rewardController | contract IRewardController | undefined |

### approveClaim

```solidity
Expand Down
20 changes: 20 additions & 0 deletions test/hattimelockcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,26 @@ contract("HatTimelockController", (accounts) => {
await vault.deposit(web3.utils.toWei("1"), staker, { from: staker });
});

it("Add reward controller", async () => {
await setup(accounts);
try {
await hatTimelockController.addRewardController(vault.address, accounts[1], {
from: accounts[1],
});
assert(false, "only governance");
} catch (ex) {
assertVMException(ex);
}

try {
await vault.addRewardController(accounts[1]);
assert(false, "only governance");
} catch (ex) {
assertVMException(ex);
}
await hatTimelockController.addRewardController(vault.address, accounts[1], { from: accounts[0] });
});

it("swapAndSend", async () => {
await setup(accounts);
var staker = accounts[4];
Expand Down

0 comments on commit b05b7db

Please sign in to comment.