-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Deploy OETH Morpho AAVE contract * OETH Morpho Aave v2 Fork tests (#1544) * Add fork tests * Lint * Switch to new governor * Proxy init to change governor at the end (#1557) * Init of Morpho strategy from proxy init (cherry picked from commit 4fee664) * set governor on proxy init (cherry picked from commit d6d9fb9) * Proxy init to do gov change after init of impl Simplified oeth morpho deploy script (cherry picked from commit c38c6a7) * fix sol prettier (cherry picked from commit ecb7d00) * change governance in fork tests * reduce time with deployment script * skipping some fork tests * remove .only --------- Co-authored-by: Domen Grabec <[email protected]> --------- Co-authored-by: Shahul Hameed <[email protected]> Co-authored-by: Domen Grabec <[email protected]> Co-authored-by: Nick Addison <[email protected]>
- Loading branch information
1 parent
e3123f0
commit 36332fe
Showing
8 changed files
with
406 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
const { deploymentWithProposal } = require("../utils/deploy"); | ||
const addresses = require("../utils/addresses"); | ||
|
||
module.exports = deploymentWithProposal( | ||
{ | ||
deployName: "064_oeth_morpho_aave_v2", | ||
forceDeploy: false, | ||
reduceQueueTime: true, | ||
// proposalId: , | ||
}, | ||
async ({ | ||
assetAddresses, | ||
deployWithConfirmation, | ||
ethers, | ||
getTxOpts, | ||
withConfirmation, | ||
}) => { | ||
const { deployerAddr } = await getNamedAccounts(); | ||
const sDeployer = await ethers.provider.getSigner(deployerAddr); | ||
|
||
// Current contracts | ||
const cVaultProxy = await ethers.getContract("OETHVaultProxy"); | ||
const cVaultAdmin = await ethers.getContractAt( | ||
"VaultAdmin", | ||
cVaultProxy.address | ||
); | ||
|
||
// Deployer Actions | ||
// ---------------- | ||
|
||
// 1. Deploy new proxy | ||
// New strategy will be living at a clean address | ||
const dOETHMorphoAaveStrategyProxy = await deployWithConfirmation( | ||
"OETHMorphoAaveStrategyProxy" | ||
); | ||
const cOETHMorphoAaveStrategyProxy = await ethers.getContractAt( | ||
"OETHMorphoAaveStrategyProxy", | ||
dOETHMorphoAaveStrategyProxy.address | ||
); | ||
|
||
// 2. Reuse old OUSD impl | ||
const cMorphoAaveStrategyImpl = await ethers.getContract( | ||
"MorphoAaveStrategy" | ||
); | ||
const cMorphoAaveStrategy = await ethers.getContractAt( | ||
"MorphoAaveStrategy", | ||
cOETHMorphoAaveStrategyProxy.address | ||
); | ||
|
||
// 3. Construct initialize call data to init and configure the new Morpho strategy | ||
const initData = cMorphoAaveStrategyImpl.interface.encodeFunctionData( | ||
"initialize(address,address[],address[],address[])", | ||
[ | ||
cVaultProxy.address, | ||
[], // reward token addresses | ||
[assetAddresses.WETH], // asset token addresses | ||
[assetAddresses.aWETH], // platform tokens addresses | ||
] | ||
); | ||
|
||
// 4. Init the proxy to point at the implementation, set the governor, and call initialize | ||
const initFunction = "initialize(address,address,bytes)"; | ||
await withConfirmation( | ||
cOETHMorphoAaveStrategyProxy.connect(sDeployer)[initFunction]( | ||
cMorphoAaveStrategyImpl.address, | ||
addresses.mainnet.OldTimelock, // governor | ||
initData, // data for call to the initialize function on the Morpho strategy | ||
await getTxOpts() | ||
) | ||
); | ||
|
||
console.log( | ||
"OUSD Morpho Aave strategy address: ", | ||
cMorphoAaveStrategy.address | ||
); | ||
|
||
// Governance Actions | ||
// ---------------- | ||
return { | ||
name: "Deploy new OUSD Morpho Aave strategy", | ||
governorAddr: addresses.mainnet.OldTimelock, | ||
actions: [ | ||
// 1. Add new Morpho strategy to vault | ||
{ | ||
contract: cVaultAdmin, | ||
signature: "approveStrategy(address)", | ||
args: [cMorphoAaveStrategy.address], | ||
}, | ||
], | ||
}; | ||
} | ||
); |
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
Oops, something went wrong.