diff --git a/contracts/utils/GovProposalHelper.sol b/contracts/utils/GovProposalHelper.sol index 378b00a0..13ba78aa 100644 --- a/contracts/utils/GovProposalHelper.sol +++ b/contracts/utils/GovProposalHelper.sol @@ -118,9 +118,17 @@ library GovProposalHelper { uint256 snapshot = governance.proposalSnapshot(proposalId); if (snapshot == 0) { - // Proposal doesn't exists, create it - console.log("Creating proposal..."); bytes memory proposeData = getProposeCalldata(prop); + + console.log("----------------------------------"); + console.log("Create following tx on Governance:"); + console.log("To:", governanceAddr); + console.log("Data:"); + console.logBytes(proposeData); + console.log("----------------------------------"); + + // Proposal doesn't exists, create it + console.log("Creating proposal on fork..."); (bool success, bytes memory data) = governanceAddr.call(proposeData); } diff --git a/script/deploy/DeployManager.sol b/script/deploy/DeployManager.sol index 36a4ecbe..9e77a949 100644 --- a/script/deploy/DeployManager.sol +++ b/script/deploy/DeployManager.sol @@ -93,12 +93,6 @@ contract DeployManager is Script { scriptsExecuted[executionKeys[i]] = true; } - if (scriptsExecuted[deployScript.DEPLOY_NAME()]) { - // TODO: Handle any active governance proposal - console.log("Skipping already deployed script"); - return; - } - /** * Pre-deployment */ @@ -115,38 +109,44 @@ contract DeployManager is Script { deployScript.preloadDeployedContract(existingContracts[i], deployedAddr); } - // Deployment - deployScript.setUp(); - deployScript.run(); - - /** - * Post-deployment - */ - BaseMainnetScript.DeployRecord[] memory records = deployScript.getAllDeployRecords(); - - for (uint256 i = 0; i < records.length; ++i) { - string memory name = records[i].name; - address addr = records[i].addr; - - console.log(string(abi.encodePacked("> Recorded Deploy of ", name, " at")), addr); - networkDeployments = vm.serializeAddress(contractsKey, name, addr); - deployedContracts[name] = addr; + if (scriptsExecuted[deployScript.DEPLOY_NAME()]) { + // Governance handling + deployScript.handleGovernanceProposal(); + console.log("Skipping already deployed script"); + } else { + // Deployment + deployScript.setUp(); + deployScript.run(); + + /** + * Post-deployment + */ + BaseMainnetScript.DeployRecord[] memory records = deployScript.getAllDeployRecords(); + + for (uint256 i = 0; i < records.length; ++i) { + string memory name = records[i].name; + address addr = records[i].addr; + + console.log(string(abi.encodePacked("> Recorded Deploy of ", name, " at")), addr); + networkDeployments = vm.serializeAddress(contractsKey, name, addr); + deployedContracts[name] = addr; + } + + // Sleep 0.5s so that the previous write is complete + vm.sleep(500); + vm.writeJson(networkDeployments, deploymentsFilePath, contractsKey); + console.log("> Deployment addresses stored."); + + /** + * Write Execution History + */ + currentExecutions = vm.serializeUint(executionsKey, deployScript.DEPLOY_NAME(), block.timestamp); + + // Sleep 0.5s so that the previous write is complete + vm.sleep(500); + vm.writeJson(currentExecutions, deploymentsFilePath, executionsKey); + console.log("> Deploy script execution complete."); } - - // Sleep 0.5s so that the previous write is complete - vm.sleep(500); - vm.writeJson(networkDeployments, deploymentsFilePath, contractsKey); - console.log("> Deployment addresses stored."); - - /** - * Write Execution History - */ - currentExecutions = vm.serializeUint(executionsKey, deployScript.DEPLOY_NAME(), block.timestamp); - - // Sleep 0.5s so that the previous write is complete - vm.sleep(500); - vm.writeJson(currentExecutions, deploymentsFilePath, executionsKey); - console.log("> Deploy script execution complete."); } function getDeployment(string calldata contractName) external view returns (address) { diff --git a/script/deploy/mainnet/011_OgnOgvMigrationScript.sol b/script/deploy/mainnet/011_OgnOgvMigrationScript.sol index 87be6d6e..52166006 100644 --- a/script/deploy/mainnet/011_OgnOgvMigrationScript.sol +++ b/script/deploy/mainnet/011_OgnOgvMigrationScript.sol @@ -21,9 +21,9 @@ contract OgnOgvMigrationScript is BaseMainnetScript { string public constant override DEPLOY_NAME = "011_OgnOgvMigration"; - GovProposal govProposal; + GovProposal public govProposal; - uint256 constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT + uint256 public constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT // Ref: https://snapshot.org/#/origingov.eth/proposal/0x741893a4d9838c0b69fac03650756e21fe00ec35b5309626bb0d6b816f861f9b uint256 public constant OGN_TO_MINT = 409_664_846 ether; @@ -31,11 +31,9 @@ contract OgnOgvMigrationScript is BaseMainnetScript { // From `script/ExtraOGNForMigration.s.sol`, rounded off uint256 public constant EXTRA_OGN_FOR_MIGRATION = 3_000_000 ether; - // TODO: Find right number - uint256 public constant EXTRA_OGN_FOR_REWARDS = 300_000_000 ether; + uint256 public constant EXTRA_OGN_FOR_REWARDS = 344_736 ether; - // TODO: Confirm reward rate - uint256 constant REWARDS_PER_SECOND = 300000 ether / uint256(24 * 60 * 60); // 300k per day + uint256 public constant REWARDS_PER_SECOND = 0.57 ether; constructor() {} @@ -64,10 +62,10 @@ contract OgnOgvMigrationScript is BaseMainnetScript { console.log("- Migrator init"); migratorProxy.initialize(address(migratorImpl), Addresses.TIMELOCK, ""); - _buildGovernanceProposal(); + // _buildGovernanceProposal(); } - function _buildGovernanceProposal() internal { + function _buildGovernanceProposal() internal override { Timelock timelock = Timelock(payable(Addresses.TIMELOCK)); address ognRewardsSourceProxy = deployedContracts["OGN_REWARDS_SOURCE"]; diff --git a/script/deploy/mainnet/012_xOGNGovernanceScript.sol b/script/deploy/mainnet/012_xOGNGovernanceScript.sol index 508eda01..e37993c9 100644 --- a/script/deploy/mainnet/012_xOGNGovernanceScript.sol +++ b/script/deploy/mainnet/012_xOGNGovernanceScript.sol @@ -21,11 +21,11 @@ contract XOGNGovernanceScript is BaseMainnetScript { using GovFive for GovFive.GovFiveProposal; using VmHelper for Vm; - GovFive.GovFiveProposal govProposal; + GovFive.GovFiveProposal public govProposal; string public constant override DEPLOY_NAME = "012_xOGNGovernance"; - uint256 constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT + uint256 public constant OGN_EPOCH = 1717041600; // May 30, 2024 GMT constructor() {} @@ -42,7 +42,7 @@ contract XOGNGovernanceScript is BaseMainnetScript { _buildGovernanceProposal(); } - function _buildGovernanceProposal() internal { + function _buildGovernanceProposal() internal override { Timelock timelock = Timelock(payable(Addresses.TIMELOCK)); address xognGov = deployedContracts["XOGN_GOV"]; diff --git a/script/deploy/mainnet/BaseMainnetScript.sol b/script/deploy/mainnet/BaseMainnetScript.sol index 6498f016..795fb7b7 100644 --- a/script/deploy/mainnet/BaseMainnetScript.sol +++ b/script/deploy/mainnet/BaseMainnetScript.sol @@ -86,4 +86,11 @@ abstract contract BaseMainnetScript is Script { function _execute() internal virtual; function _fork() internal virtual; + + function _buildGovernanceProposal() internal virtual {} + + function handleGovernanceProposal() external virtual { + _buildGovernanceProposal(); + _fork(); + } }