|
| 1 | +const { |
| 2 | + deploymentWithGovernanceProposal, |
| 3 | + deployWithConfirmation, |
| 4 | +} = require("../../utils/deploy"); |
| 5 | +const { parseUnits } = require("ethers/lib/utils.js"); |
| 6 | + |
| 7 | +module.exports = deploymentWithGovernanceProposal( |
| 8 | + { |
| 9 | + deployName: "135_vault_wousd_upgrade", |
| 10 | + proposalId: |
| 11 | + "62736766423374672768580940310861921323283907575465980811344596309308068769219", |
| 12 | + }, |
| 13 | + async ({ ethers }) => { |
| 14 | + const cVaultProxy = await ethers.getContract("VaultProxy"); |
| 15 | + const cwOUSDProxy = await ethers.getContract("WrappedOUSDProxy"); |
| 16 | + const cOUSDProxy = await ethers.getContract("OUSDProxy"); |
| 17 | + |
| 18 | + const cOUSDVault = await ethers.getContractAt( |
| 19 | + "IVault", |
| 20 | + cVaultProxy.address |
| 21 | + ); |
| 22 | + |
| 23 | + // Deploy new implementation |
| 24 | + const dOUSDVaultCore = await deployWithConfirmation("VaultCore", []); |
| 25 | + const dVaultAdmin = await deployWithConfirmation("VaultAdmin", []); |
| 26 | + |
| 27 | + const dwOUSD = await deployWithConfirmation("WrappedOusd", [ |
| 28 | + cOUSDProxy.address, // OUSD token |
| 29 | + ]); |
| 30 | + |
| 31 | + const cwOUSD = await ethers.getContractAt( |
| 32 | + "WrappedOusd", |
| 33 | + cwOUSDProxy.address |
| 34 | + ); |
| 35 | + |
| 36 | + // ---------------- |
| 37 | + // Governance Actions |
| 38 | + // ---------------- |
| 39 | + return { |
| 40 | + name: "Add rate limiting to Origin Vault and upgrade Wrapped OUSD", |
| 41 | + actions: [ |
| 42 | + // 1. Upgrade Vault proxy to VaultCore |
| 43 | + { |
| 44 | + contract: cVaultProxy, |
| 45 | + signature: "upgradeTo(address)", |
| 46 | + args: [dOUSDVaultCore.address], |
| 47 | + }, |
| 48 | + // 2. Set the VaultAdmin |
| 49 | + { |
| 50 | + contract: cOUSDVault, |
| 51 | + signature: "setAdminImpl(address)", |
| 52 | + args: [dVaultAdmin.address], |
| 53 | + }, |
| 54 | + // 3. Default to a short dripper, since currently we are running zero dripper. |
| 55 | + { |
| 56 | + contract: cOUSDVault, |
| 57 | + signature: "setDripDuration(uint256)", |
| 58 | + args: [4 * 60 * 60], |
| 59 | + }, |
| 60 | + // 4. Default to a 20% APR rebase rate cap |
| 61 | + { |
| 62 | + contract: cOUSDVault, |
| 63 | + signature: "setRebaseRateMax(uint256)", |
| 64 | + args: [parseUnits("20", 18)], |
| 65 | + }, |
| 66 | + { |
| 67 | + // 5. Upgrade wOUSD proxy |
| 68 | + contract: cwOUSDProxy, |
| 69 | + signature: "upgradeTo(address)", |
| 70 | + args: [dwOUSD.address], |
| 71 | + }, |
| 72 | + // 6. Run the second initializer |
| 73 | + { |
| 74 | + contract: cwOUSD, |
| 75 | + signature: "initialize2()", |
| 76 | + args: [], |
| 77 | + }, |
| 78 | + ], |
| 79 | + }; |
| 80 | + } |
| 81 | +); |
0 commit comments