-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
259 additions
and
285 deletions.
There are no files selected for viewing
55 changes: 0 additions & 55 deletions
55
...ntracts/script/AccessManagerMigrations/05_GenerateRestakingRewardsDepositorCalldata.s.sol
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
mainnet-contracts/script/AccessManagerMigrations/05_GenerateRevenueDepositorCalldata.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity >=0.8.0 <0.9.0; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { AccessManager } from "@openzeppelin/contracts/access/manager/AccessManager.sol"; | ||
import { Multicall } from "@openzeppelin/contracts/utils/Multicall.sol"; | ||
import { ROLE_ID_DAO, ROLE_ID_OPERATIONS_MULTISIG, ROLE_ID_RESTAKING_REWARDS_DEPOSITOR } from "../../script/Roles.sol"; | ||
import { PufferRevenueDepositor } from "../../src/PufferRevenueDepositor.sol"; | ||
|
||
contract GenerateRevenueDepositorCalldata is Script { | ||
function run(address revenueDepositorProxy, address operationsMultisig) public pure returns (bytes memory) { | ||
bytes[] memory calldatas = new bytes[](5); | ||
|
||
bytes4[] memory daoSelectors = new bytes4[](3); | ||
daoSelectors[0] = PufferRevenueDepositor.setRnoRewardsBps.selector; | ||
daoSelectors[1] = PufferRevenueDepositor.setTreasuryRewardsBps.selector; | ||
daoSelectors[2] = PufferRevenueDepositor.setRewardsDistributionWindow.selector; | ||
|
||
calldatas[0] = | ||
abi.encodeCall(AccessManager.setTargetFunctionRole, (revenueDepositorProxy, daoSelectors, ROLE_ID_DAO)); | ||
|
||
bytes4[] memory revenueDepositorSelectors = new bytes4[](1); | ||
revenueDepositorSelectors[0] = PufferRevenueDepositor.depositRevenue.selector; | ||
|
||
calldatas[1] = abi.encodeCall( | ||
AccessManager.setTargetFunctionRole, | ||
(revenueDepositorProxy, revenueDepositorSelectors, ROLE_ID_RESTAKING_REWARDS_DEPOSITOR) | ||
); | ||
|
||
calldatas[2] = | ||
abi.encodeCall(AccessManager.grantRole, (ROLE_ID_RESTAKING_REWARDS_DEPOSITOR, operationsMultisig, 0)); | ||
|
||
calldatas[3] = abi.encodeCall( | ||
AccessManager.labelRole, (ROLE_ID_RESTAKING_REWARDS_DEPOSITOR, "Restaking Rewards Depositor") | ||
); | ||
|
||
bytes4[] memory opsMultisigSelectors = new bytes4[](2); | ||
opsMultisigSelectors[0] = PufferRevenueDepositor.removeRestakingOperator.selector; | ||
opsMultisigSelectors[1] = PufferRevenueDepositor.addRestakingOperators.selector; | ||
|
||
calldatas[4] = abi.encodeCall( | ||
AccessManager.setTargetFunctionRole, | ||
(revenueDepositorProxy, opsMultisigSelectors, ROLE_ID_OPERATIONS_MULTISIG) | ||
); | ||
|
||
bytes memory encodedMulticall = abi.encodeCall(Multicall.multicall, (calldatas)); | ||
|
||
return encodedMulticall; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
mainnet-contracts/script/DeployRestakingRewardsDepositor.s.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity >=0.8.0 <0.9.0; | ||
|
||
import "forge-std/Script.sol"; | ||
import { DeployerHelper } from "./DeployerHelper.s.sol"; | ||
import { PufferRevenueDepositor } from "../src/PufferRevenueDepositor.sol"; | ||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import { GenerateRevenueDepositorCalldata } from "./AccessManagerMigrations/05_GenerateRevenueDepositorCalldata.s.sol"; | ||
|
||
/** | ||
* forge script script/DeployRevenueDepositor.s.sol:DeployRevenueDepositor --rpc-url=$RPC_URL --private-key $PK | ||
*/ | ||
contract DeployRevenueDepositor is DeployerHelper { | ||
PufferRevenueDepositor public revenueDepositor; | ||
|
||
bytes public encodedCalldata; | ||
|
||
function run() public { | ||
GenerateRevenueDepositorCalldata calldataGenerator = new GenerateRevenueDepositorCalldata(); | ||
|
||
vm.startBroadcast(); | ||
|
||
//@todo Get from RNOs | ||
address[] memory operatorsAddresses = new address[](7); | ||
operatorsAddresses[0] = makeAddr("RNO1"); | ||
operatorsAddresses[1] = makeAddr("RNO2"); | ||
operatorsAddresses[2] = makeAddr("RNO3"); | ||
operatorsAddresses[3] = makeAddr("RNO4"); | ||
operatorsAddresses[4] = makeAddr("RNO5"); | ||
operatorsAddresses[5] = makeAddr("RNO6"); | ||
operatorsAddresses[6] = makeAddr("RNO7"); | ||
|
||
PufferRevenueDepositor revenueDepositorImpl = | ||
new PufferRevenueDepositor({ vault: _getPufferVault(), weth: _getWETH(), treasury: _getTreasury() }); | ||
|
||
revenueDepositor = PufferRevenueDepositor( | ||
( | ||
payable( | ||
new ERC1967Proxy{ salt: bytes32("RevenueDepositor") }( | ||
address(revenueDepositorImpl), | ||
abi.encodeCall( | ||
PufferRevenueDepositor.initialize, (address(_getAccessManager()), operatorsAddresses) | ||
) | ||
) | ||
) | ||
) | ||
); | ||
|
||
vm.label(address(revenueDepositor), "PufferRevenueDepositorProxy"); | ||
vm.label(address(revenueDepositorImpl), "PufferRevenueDepositorImplementation"); | ||
|
||
encodedCalldata = calldataGenerator.run({ | ||
revenueDepositorProxy: address(revenueDepositor), | ||
operationsMultisig: _getOPSMultisig() | ||
}); | ||
|
||
console.log("Queue from Timelock -> AccessManager", _getAccessManager()); | ||
console.logBytes(encodedCalldata); | ||
|
||
if (block.chainid == holesky) { | ||
(bool success,) = address(_getAccessManager()).call(encodedCalldata); | ||
require(success, "AccessManager.call failed"); | ||
} | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.