Skip to content

Commit

Permalink
chore: fix forge build broken
Browse files Browse the repository at this point in the history
  • Loading branch information
tringuyenskymavis committed Aug 22, 2024
1 parent 47bc216 commit acf9a12
Showing 1 changed file with 52 additions and 0 deletions.
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());
}
}

0 comments on commit acf9a12

Please sign in to comment.