mirror of
https://github.com/vacp2p/staking-reward-streamer.git
synced 2026-01-09 15:27:55 -05:00
This renames `RewardsStreamerMP` to `StakeManager`. The original name only exists because the project has started with different versions of the contract. Since the contract is no longer just dealing with MPs but actually distributes rewards, it makes sense to make this the official stake manager of the protocol. **BREAKING CHANGE:** - `RewardsStreamerMP` is now `StakeManager` - `StakingManager__*` error selectors are now `StakeManager__*` selectors
44 lines
1.7 KiB
Solidity
44 lines
1.7 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.26;
|
|
|
|
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
import { Clones } from "@openzeppelin/contracts/proxy/Clones.sol";
|
|
|
|
import { BaseScript } from "./Base.s.sol";
|
|
import { DeploymentConfig } from "./DeploymentConfig.s.sol";
|
|
|
|
import { TransparentProxy } from "../src/TransparentProxy.sol";
|
|
import { StakeManager } from "../src/StakeManager.sol";
|
|
import { StakeVault } from "../src/StakeVault.sol";
|
|
import { VaultFactory } from "../src/VaultFactory.sol";
|
|
|
|
contract DeployStakeManagerScript is BaseScript {
|
|
function run() public returns (StakeManager, VaultFactory, DeploymentConfig) {
|
|
DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster);
|
|
(address deployer, address stakingToken,) = deploymentConfig.activeNetworkConfig();
|
|
|
|
bytes memory initializeData = abi.encodeCall(StakeManager.initialize, (deployer, stakingToken));
|
|
|
|
vm.startBroadcast(deployer);
|
|
|
|
// Deploy StakeManager logic contract
|
|
address impl = address(new StakeManager());
|
|
// Create upgradeable proxy
|
|
address proxy = address(new TransparentProxy(impl, initializeData));
|
|
|
|
// Create vault implementation for proxy clones
|
|
address vaultImplementation = address(new StakeVault(IERC20(stakingToken)));
|
|
address proxyClone = Clones.clone(vaultImplementation);
|
|
|
|
// Whitelist vault implementation codehash
|
|
StakeManager(proxy).setTrustedCodehash(proxyClone.codehash, true);
|
|
|
|
// Create vault factory
|
|
VaultFactory vaultFactory = new VaultFactory(deployer, proxy, vaultImplementation);
|
|
|
|
vm.stopBroadcast();
|
|
|
|
return (StakeManager(proxy), vaultFactory, deploymentConfig);
|
|
}
|
|
}
|