-
Notifications
You must be signed in to change notification settings - Fork 4
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
db9d7ba
commit 56288de
Showing
10 changed files
with
39 additions
and
60 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ import {Addresses} from "contracts/utils/Addresses.sol"; | |
import "forge-std/console.sol"; | ||
|
||
import {TimelockController} from "OpenZeppelin/[email protected]/contracts/governance/TimelockController.sol"; | ||
import "OpenZeppelin/[email protected]/contracts/utils/Strings.sol"; | ||
|
||
library GovFive { | ||
struct GovFiveAction { | ||
|
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 |
---|---|---|
|
@@ -5,11 +5,10 @@ pragma solidity 0.8.10; | |
import {Addresses} from "contracts/utils/Addresses.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
import "OpenZeppelin/[email protected]/contracts/utils/Strings.sol"; | ||
import {IGovernor} from "OpenZeppelin/[email protected]/contracts/governance/IGovernor.sol"; | ||
import {Governance} from "../Governance.sol"; | ||
|
||
import "contracts/utils/VmHelper.sol"; | ||
import {Vm} from "forge-std/Vm.sol"; | ||
|
||
struct GovAction { | ||
address target; | ||
|
@@ -24,8 +23,6 @@ struct GovProposal { | |
} | ||
|
||
library GovProposalHelper { | ||
using VmHelper for Vm; | ||
|
||
function id(GovProposal memory prop) internal view returns (uint256 proposalId) { | ||
bytes32 descriptionHash = keccak256(bytes(prop.description)); | ||
(address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = getParams(prop); | ||
|
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
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
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 |
---|---|---|
|
@@ -12,20 +12,18 @@ import {Governance} from "contracts/Governance.sol"; | |
|
||
import {GovFive} from "contracts/utils/GovFive.sol"; | ||
|
||
import {VmHelper} from "utils/VmHelper.sol"; | ||
|
||
import {MigrationZapper} from "contracts/MigrationZapper.sol"; | ||
|
||
import "OpenZeppelin/[email protected]/contracts/token/ERC20/extensions/ERC20Votes.sol"; | ||
import "OpenZeppelin/[email protected]/contracts/governance/TimelockController.sol"; | ||
|
||
contract MigrationZapperScript is BaseMainnetScript { | ||
using GovFive for GovFive.GovFiveProposal; | ||
using VmHelper for Vm; | ||
|
||
GovFive.GovFiveProposal public govProposal; | ||
|
||
string public constant override DEPLOY_NAME = "012_MigrationZapper"; | ||
bool public constant override proposalExecuted = true; | ||
|
||
constructor() {} | ||
|
||
|
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 |
---|---|---|
|
@@ -3,30 +3,21 @@ | |
pragma solidity 0.8.10; | ||
|
||
import "./BaseMainnetScript.sol"; | ||
import {Vm} from "forge-std/Vm.sol"; | ||
|
||
import {Addresses} from "contracts/utils/Addresses.sol"; | ||
|
||
import {Timelock} from "contracts/Timelock.sol"; | ||
import {Governance} from "contracts/Governance.sol"; | ||
|
||
import {GovFive} from "contracts/utils/GovFive.sol"; | ||
|
||
import {VmHelper} from "utils/VmHelper.sol"; | ||
|
||
import {Migrator} from "contracts/Migrator.sol"; | ||
import {OgvStaking} from "contracts/OgvStaking.sol"; | ||
|
||
import "OpenZeppelin/[email protected]/contracts/token/ERC20/extensions/ERC20Votes.sol"; | ||
import "OpenZeppelin/[email protected]/contracts/governance/TimelockController.sol"; | ||
|
||
contract UpgradeMigratorScript is BaseMainnetScript { | ||
using GovFive for GovFive.GovFiveProposal; | ||
using VmHelper for Vm; | ||
|
||
GovFive.GovFiveProposal public govProposal; | ||
|
||
string public constant override DEPLOY_NAME = "013_UpgradeMigrator"; | ||
bool public constant override proposalExecuted = false; | ||
|
||
constructor() {} | ||
|
||
|
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 |
---|---|---|
|
@@ -12,18 +12,16 @@ import {Governance} from "contracts/Governance.sol"; | |
|
||
import {GovFive} from "contracts/utils/GovFive.sol"; | ||
|
||
import {VmHelper} from "utils/VmHelper.sol"; | ||
|
||
import "OpenZeppelin/[email protected]/contracts/token/ERC20/extensions/ERC20Votes.sol"; | ||
import "OpenZeppelin/[email protected]/contracts/governance/TimelockController.sol"; | ||
|
||
contract XOGNGovernanceScript is BaseMainnetScript { | ||
using GovFive for GovFive.GovFiveProposal; | ||
using VmHelper for Vm; | ||
|
||
GovFive.GovFiveProposal public govProposal; | ||
|
||
string public constant override DEPLOY_NAME = "014_xOGNGovernance"; | ||
bool public constant override proposalExecuted = false; | ||
|
||
uint256 public constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT | ||
|
||
|
@@ -88,6 +86,6 @@ contract XOGNGovernanceScript is BaseMainnetScript { | |
|
||
function skip() external view override returns (bool) { | ||
// Don't deploy on Mainnet for now | ||
return !vm.isForkEnv(); | ||
return !this.isForked(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,20 +2,18 @@ | |
|
||
pragma solidity 0.8.10; | ||
|
||
import "forge-std/Script.sol"; | ||
import "OpenZeppelin/[email protected]/contracts/utils/Strings.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {Vm, VmSafe} from "forge-std/Vm.sol"; | ||
|
||
import {Addresses} from "contracts/utils/Addresses.sol"; | ||
import {GovProposal, GovProposalHelper} from "contracts/utils/GovProposalHelper.sol"; | ||
|
||
import "utils/VmHelper.sol"; | ||
|
||
abstract contract BaseMainnetScript is Script { | ||
using VmHelper for Vm; | ||
using GovProposalHelper for GovProposal; | ||
|
||
uint256 public deployBlockNum = type(uint256).max; | ||
bool isForked = false; | ||
|
||
// DeployerRecord stuff to be extracted as well | ||
struct DeployRecord { | ||
|
@@ -42,6 +40,10 @@ abstract contract BaseMainnetScript is Script { | |
deployedContracts[name] = addr; | ||
} | ||
|
||
function isForked() public view returns (bool) { | ||
return vm.isContext(VmSafe.ForgeContext.ScriptDryRun) || vm.isContext(VmSafe.ForgeContext.TestGroup); | ||
} | ||
|
||
function setUp() external {} | ||
|
||
function run() external { | ||
|
@@ -54,9 +56,7 @@ abstract contract BaseMainnetScript is Script { | |
return; | ||
} | ||
|
||
isForked = vm.isForkEnv(); | ||
|
||
if (isForked) { | ||
if (this.isForked()) { | ||
address impersonator = Addresses.INITIAL_DEPLOYER; | ||
console.log("Running script on mainnet fork impersonating: %s", impersonator); | ||
vm.startPrank(impersonator); | ||
|
@@ -69,7 +69,7 @@ abstract contract BaseMainnetScript is Script { | |
|
||
_execute(); | ||
|
||
if (isForked) { | ||
if (this.isForked()) { | ||
vm.stopPrank(); | ||
_buildGovernanceProposal(); | ||
_fork(); | ||
|
@@ -80,6 +80,8 @@ abstract contract BaseMainnetScript is Script { | |
|
||
function DEPLOY_NAME() external view virtual returns (string memory); | ||
|
||
function proposalExecuted() external view virtual returns (bool); | ||
|
||
function skip() external view virtual returns (bool) { | ||
return false; | ||
} | ||
|
@@ -91,6 +93,10 @@ abstract contract BaseMainnetScript is Script { | |
function _buildGovernanceProposal() internal virtual {} | ||
|
||
function handleGovernanceProposal() external virtual { | ||
if (this.proposalExecuted()) { | ||
return; | ||
} | ||
|
||
_buildGovernanceProposal(); | ||
_fork(); | ||
} | ||
|