diff --git a/contracts/deploy/mainnet/110_transfer_morpho.js b/contracts/deploy/mainnet/110_transfer_morpho.js new file mode 100644 index 0000000000..42e554e5dc --- /dev/null +++ b/contracts/deploy/mainnet/110_transfer_morpho.js @@ -0,0 +1,69 @@ +const { deploymentWithGovernanceProposal } = require("../../utils/deploy"); + +module.exports = deploymentWithGovernanceProposal( + { + deployName: "110_transfer_morpho", + forceDeploy: false, + forceSkip: true, + skipSimulation: true, + reduceQueueTime: true, + deployerIsProposer: false, + proposalId: "", + }, + async () => { + const cOUSDMorphoAaveProxy = await ethers.getContract( + "MorphoAaveStrategyProxy" + ); + const cOUSDMorphoCompoundProxy = await ethers.getContract( + "MorphoCompoundStrategyProxy" + ); + const cOETHMorphoAaveProxy = await ethers.getContract( + "OETHMorphoAaveStrategyProxy" + ); + + const cOUSDMorphoAave = await ethers.getContractAt( + "InitializableAbstractStrategy", + cOUSDMorphoAaveProxy.address + ); + const cOUSDMorphoCompound = await ethers.getContractAt( + "InitializableAbstractStrategy", + cOUSDMorphoCompoundProxy.address + ); + const cOETHMorphoAave = await ethers.getContractAt( + "InitializableAbstractStrategy", + cOETHMorphoAaveProxy.address + ); + + const morpho = await ethers.getContractAt( + "IERC20", + "0x9994e35db50125e0df82e4c2dde62496ce330999" + ); + + const ousdAaveBalance = await morpho.balanceOf(cOUSDMorphoAave.address); + const ousdCompBalance = await morpho.balanceOf(cOUSDMorphoCompound.address); + const oethAaveBalance = await morpho.balanceOf(cOETHMorphoAave.address); + + // Governance Actions + // ---------------- + return { + name: "Transfer Morpho Tokens from Strategies to the Guardian", + actions: [ + { + contract: cOUSDMorphoAave, + signature: "transferToken(address,uint256)", + args: [morpho.address, ousdAaveBalance], + }, + { + contract: cOUSDMorphoCompound, + signature: "transferToken(address,uint256)", + args: [morpho.address, ousdCompBalance], + }, + { + contract: cOETHMorphoAave, + signature: "transferToken(address,uint256)", + args: [morpho.address, oethAaveBalance], + }, + ], + }; + } +); diff --git a/contracts/utils/deploy.js b/contracts/utils/deploy.js index 0642abbe39..b26861fca3 100644 --- a/contracts/utils/deploy.js +++ b/contracts/utils/deploy.js @@ -334,7 +334,7 @@ const executeProposalOnFork = async ({ /** * Successfully execute the proposal whether it is in * "Pending", "Active" or "Queued" state. - * Given a proposal Id, enqueues and executes it on OGV Governance. + * Given a proposal Id, enqueues and executes it on xOGN Governance. * @param {Number} proposalId * @returns {Promise} */ @@ -671,7 +671,7 @@ const configureGovernanceContractDurations = async (reduceQueueTime) => { }; /** - * In forked environment simulated that 5/8 multisig has submitted an OGV + * In forked environment simulated that 5/8 multisig has submitted an xOGN * governance proposal * * @param {Array} proposalArgs @@ -723,7 +723,7 @@ const submitProposalToOgvGovernance = async ( ); const proposalId = result.receipt.parsedLogs[0].args[0].toString(); - log(`Submitted governance proposal to OGV governance ${proposalId}`); + log(`Submitted governance proposal to xOGN governance ${proposalId}`); if (!isMainnet) { await advanceBlocks(1); } @@ -744,7 +744,7 @@ const sanityCheckOgvGovernance = async ({ deployerIsProposer = false, } = {}) => { if (isMainnet) { - // only applicable when OGV governance is the governor + // only applicable when xOGN governance is the governor if (deployerIsProposer) { const governorSix = await getGovernorSix(); const { deployerAddr } = await getNamedAccounts(); @@ -1162,9 +1162,10 @@ function deploymentWithGovernanceProposal(opts, fn) { onlyOnFork, forceSkip, proposalId, - deployerIsProposer = false, // The deployer issues the propose to OGV Governor + deployerIsProposer = false, // The deployer issues the propose to xOGN Governor reduceQueueTime = false, // reduce governance queue times executeGasLimit = null, + skipSimulation = false, // Skips simulating execution of proposal on fork } = opts; const runDeployment = async (hre) => { const oracleAddresses = await getOracleAddresses(hre.deployments); @@ -1217,8 +1218,8 @@ function deploymentWithGovernanceProposal(opts, fn) { // } if (isMainnet) { - // On Mainnet, only build the propose transaction for OGV governance - log("Building OGV governance proposal..."); + // On Mainnet, only build the propose transaction for xOGN governance + log("Building xOGN governance proposal..."); if (deployerIsProposer) { await submitProposalToOgvGovernance( propArgs, @@ -1230,23 +1231,28 @@ function deploymentWithGovernanceProposal(opts, fn) { } log("Proposal sent."); } else if (isFork) { - // On Fork we can send the proposal then impersonate the guardian to execute it. - log("Sending the governance proposal to OGV governance"); - propOpts.reduceQueueTime = reduceQueueTime; - const { proposalState, proposalId, proposalIdBn } = - await submitProposalToOgvGovernance( - propArgs, - propDescription, - propOpts - ); - log("Executing the proposal"); - await executeGovernanceProposalOnFork({ - proposalIdBn, - proposalState, - reduceQueueTime, - executeGasLimit, - existingProposal: false, - }); + if (skipSimulation) { + log("Building xOGN governance proposal..."); + await submitProposalGnosisSafe(propArgs, propDescription, propOpts); + } else { + // On Fork we can send the proposal then impersonate the guardian to execute it. + log("Sending the governance proposal to xOGN governance"); + propOpts.reduceQueueTime = reduceQueueTime; + const { proposalState, proposalId, proposalIdBn } = + await submitProposalToOgvGovernance( + propArgs, + propDescription, + propOpts + ); + log("Executing the proposal"); + await executeGovernanceProposalOnFork({ + proposalIdBn, + proposalState, + reduceQueueTime, + executeGasLimit, + existingProposal: false, + }); + } log("Proposal executed."); } else { throw new Error(