-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
47bc216
commit acf9a12
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
script/contracts/RoninValidatorSetREP10MigratorLogicDeploy.s copy.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,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { ISharedArgument } from "script/interfaces/ISharedArgument.sol"; | ||
import { RoninValidatorSetREP10Migrator } from | ||
"@ronin/contracts/ronin/validator/migrations/RoninValidatorSetREP10Migrator.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { RoninMigration } from "script/RoninMigration.s.sol"; | ||
import { LibProxy } from "@fdk/libraries/LibProxy.sol"; | ||
import { RoninValidatorSetDeploy } from "./RoninValidatorSetDeploy.s.sol"; | ||
import { RoninRandomBeaconDeploy } from "./RoninRandomBeaconDeploy.s.sol"; | ||
import { IMigrationScript } from "@fdk/interfaces/IMigrationScript.sol"; | ||
|
||
contract RoninValidatorSetREP10MigratorLogicDeploy is RoninMigration { | ||
using LibProxy for *; | ||
|
||
uint256 private _activatedAtPeriod; | ||
address private _prevImpl; | ||
|
||
function _injectDependencies() internal virtual override { | ||
_setDependencyDeployScript(Contract.RoninValidatorSet.key(), new RoninValidatorSetDeploy()); | ||
_setDependencyDeployScript(Contract.RoninRandomBeacon.key(), new RoninRandomBeaconDeploy()); | ||
} | ||
|
||
function overrideActivatedAtPeriod(uint256 activatedAtPeriod) | ||
public | ||
returns (RoninValidatorSetREP10MigratorLogicDeploy) | ||
{ | ||
_activatedAtPeriod = activatedAtPeriod; | ||
return RoninValidatorSetREP10MigratorLogicDeploy(address(this)); | ||
} | ||
|
||
function overridePrevImpl(address prevImpl) public returns (RoninValidatorSetREP10MigratorLogicDeploy) { | ||
_prevImpl = prevImpl; | ||
return RoninValidatorSetREP10MigratorLogicDeploy(address(this)); | ||
} | ||
|
||
function _logicArgs() internal returns (bytes memory args) { | ||
ISharedArgument.RoninValidatorSetREP10MigratorParam memory param = | ||
config.sharedArguments().roninValidatorSetREP10Migrator; | ||
|
||
address payable currProxy = loadContractOrDeploy(Contract.RoninValidatorSet.key()); | ||
address prevImpl = _prevImpl == address(0x0) ? currProxy.getProxyImplementation() : _prevImpl; | ||
address newImpl = _deployLogic(Contract.RoninValidatorSet.key()); | ||
uint256 activatedAtPeriod = _activatedAtPeriod > 0 ? _activatedAtPeriod : param.activatedAtPeriod; | ||
args = abi.encode(currProxy, prevImpl, newImpl, activatedAtPeriod); | ||
} | ||
|
||
function run() public virtual returns (address instance) { | ||
instance = _deployLogic(Contract.RoninValidatorSetREP10Migrator.key(), _logicArgs()); | ||
} | ||
} |