-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(script): add deployment script for new StakeManager
s
#72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.19 <=0.9.0; | ||
|
||
import { BaseScript } from "./Base.s.sol"; | ||
import { StakeManager } from "../contracts/StakeManager.sol"; | ||
|
||
contract DeployMigrationStakeManager is BaseScript { | ||
error DeployMigrationStakeManager_InvalidStakeTokenAddress(); | ||
|
||
address public prevStakeManager; | ||
|
||
address public stakeToken; | ||
|
||
constructor(address _prevStakeManager, address _stakeToken) { | ||
prevStakeManager = _prevStakeManager; | ||
stakeToken = _stakeToken; | ||
} | ||
|
||
function run() public returns (StakeManager) { | ||
prevStakeManager = vm.envOr({ name: "PREV_STAKE_MANAGER", defaultValue: prevStakeManager }); | ||
stakeToken = vm.envOr({ name: "STAKE_TOKEN_ADDRESS", defaultValue: stakeToken }); | ||
|
||
if (stakeToken == address(0)) { | ||
revert DeployMigrationStakeManager_InvalidStakeTokenAddress(); | ||
} | ||
|
||
vm.startBroadcast(broadcaster); | ||
StakeManager stakeManager = new StakeManager(stakeToken, prevStakeManager); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another thing I've just realised, it probably makes sense to extend this so that it automatically activates migration in the old manager. If we make this part of this script, however, it's probably less usable in the testing context (which I think would be fine, as in tests we can always just do Let me know what you think. |
||
vm.stopBroadcast(); | ||
|
||
return stakeManager; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically, we can extend this and say, if
prevStakeManager != address(0)
, then we query thestakeToken()
address from the old manager.