Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed May 24, 2024
1 parent f8001fb commit bdf5857
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 50 deletions.
12 changes: 10 additions & 2 deletions contracts/utils/GovProposalHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
74 changes: 37 additions & 37 deletions script/deploy/DeployManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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) {
Expand Down
14 changes: 6 additions & 8 deletions script/deploy/mainnet/011_OgnOgvMigrationScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ 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;

// 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() {}

Expand Down Expand Up @@ -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"];
Expand Down
6 changes: 3 additions & 3 deletions script/deploy/mainnet/012_xOGNGovernanceScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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"];
Expand Down
7 changes: 7 additions & 0 deletions script/deploy/mainnet/BaseMainnetScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit bdf5857

Please sign in to comment.