Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy 117 - OETH Fixed Rate Dripper #2351

Merged
merged 13 commits into from
Jan 16, 2025
12 changes: 12 additions & 0 deletions contracts/contracts/harvest/Dripper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,16 @@
// Send funds
IERC20(token).safeTransfer(vault, amountToSend);
}

/// @dev Transfer out all ERC20 held by the contract. Governor only.
/// @param _asset ERC20 token address
function transferAllToken(address _asset, address _receiver)

Check warning on line 143 in contracts/contracts/harvest/Dripper.sol

View check run for this annotation

Codecov / codecov/patch

contracts/contracts/harvest/Dripper.sol#L143

Added line #L143 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its ok for now, but ideally the feature change PR would be separate from the deploy PR of that feature. Like you had a separate feature PR here then you can fork off of the feature branch to create the deployment branch that only has the deployment related files.

external
onlyGovernor
{
IERC20(_asset).safeTransfer(

Check warning on line 147 in contracts/contracts/harvest/Dripper.sol

View check run for this annotation

Codecov / codecov/patch

contracts/contracts/harvest/Dripper.sol#L147

Added line #L147 was not covered by tests
_receiver,
IERC20(_asset).balanceOf(address(this))
);
}
}
14 changes: 14 additions & 0 deletions contracts/contracts/harvest/OETHFixedRateDripper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { FixedRateDripper } from "./FixedRateDripper.sol";

/**
* @title OETH FixedRateDripper Contract
* @author Origin Protocol Inc
*/
contract OETHFixedRateDripper is FixedRateDripper {
constructor(address _vault, address _token)

Check warning on line 11 in contracts/contracts/harvest/OETHFixedRateDripper.sol

View check run for this annotation

Codecov / codecov/patch

contracts/contracts/harvest/OETHFixedRateDripper.sol#L11

Added line #L11 was not covered by tests
FixedRateDripper(_vault, _token)
{}
}
7 changes: 7 additions & 0 deletions contracts/contracts/proxies/Proxies.sol
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,10 @@ contract MorphoGauntletPrimeUSDTStrategyProxy is
{

}

/**
* @notice OETHFixedRateDripperProxy delegates calls to a OETHFixedRateDripper implementation
*/
contract OETHFixedRateDripperProxy is InitializeGovernedUpgradeabilityProxy {

}
100 changes: 100 additions & 0 deletions contracts/deploy/mainnet/117_oeth_fixed_rate_dripper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
const addresses = require("../../utils/addresses");
const { deploymentWithGovernanceProposal } = require("../../utils/deploy");

module.exports = deploymentWithGovernanceProposal(
{
deployName: "117_oeth_fixed_rate_dripper",
forceDeploy: false,
//forceSkip: true,
reduceQueueTime: true,
deployerIsProposer: false,
proposalId:
"27194273192096049001033521868815029294031516460891881333743928574609945488001",
},
async ({ deployWithConfirmation, withConfirmation }) => {
const cOETHVaultProxy = await ethers.getContractAt(
"VaultAdmin",
addresses.mainnet.OETHVaultProxy
);

// Deployer Actions
// ----------------
const { deployerAddr } = await getNamedAccounts();
const sDeployer = await ethers.provider.getSigner(deployerAddr);

// 1. Deploy new implementation of OETH Dripper (with transferAllToken function)
// 2. Deploy new OETH fixed rate dripper (proxy + implementation)
// 3. Upgrade Dripper to the new version (with transferAll token function)
// 4. Transfer all funds from old dripper to new dripper
// 5. Set new dripper on the vault

// --- 1 ---
// 1.a. Get the current OETH Dripper Proxy
const cOETHDripperProxy = await ethers.getContract("OETHDripperProxy");

// 1.b. Deploy the new OETH Dripper implementation (with transferAllToken function)
const dOETHDripper = await deployWithConfirmation(
"OETHDripper",
[addresses.mainnet.OETHVaultProxy, addresses.mainnet.WETH],
undefined,
true // due to changing name from `perBlock` to `perSecond`
);

const cOETHDripper = await ethers.getContractAt(
"OETHDripper",
cOETHDripperProxy.address
);

// --- 2 ---
// 2.a Deploy the Fixed Rate Dripper Proxy
const dOETHFixedRateDripperProxy = await deployWithConfirmation(
"OETHFixedRateDripperProxy"
);

const cOETHFixedRateDripperProxy = await ethers.getContract(
"OETHFixedRateDripperProxy"
);

// 2.b. Deploy the OETH Fixed Rate Dripper implementation
const dOETHFixedRateDripper = await deployWithConfirmation(
"OETHFixedRateDripper",
[addresses.mainnet.OETHVaultProxy, addresses.mainnet.WETH]
);

// 2.c. Initialize the Fixed Rate Dripper Proxy
const initFunction = "initialize(address,address,bytes)";
await withConfirmation(
cOETHFixedRateDripperProxy.connect(sDeployer)[initFunction](
dOETHFixedRateDripper.address,
addresses.mainnet.Timelock, // governor
"0x" // no init data
)
);
// --- 3 & 4 & 5 ---
// Governance Actions
// ----------------
return {
name: "Migrate OETH Dripper to Fixed Rate Dripper",
actions: [
// 3. Upgrade the Dripper to the new version
{
contract: cOETHDripperProxy,
signature: "upgradeTo(address)",
args: [dOETHDripper.address],
},
// 4. Transfer all funds from the old dripper to the new dripper
{
contract: cOETHDripper,
signature: "transferAllToken(address,address)",
args: [addresses.mainnet.WETH, cOETHFixedRateDripperProxy.address],
},
// 5. Set new dripper address on the vault
{
contract: cOETHVaultProxy,
signature: "setDripper(address)",
args: [dOETHFixedRateDripperProxy.address],
},
],
};
}
);
3 changes: 2 additions & 1 deletion contracts/deployments/mainnet/.migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@
"111_morpho_wrap_and_transfer": 1732639817,
"112_ousd_morpho_gauntlet_usdc": 1734483227,
"113_ousd_morpho_gauntlet_usdt": 1734560711,
"114_simple_harvester": 1736329331
"114_simple_harvester": 1736329331,
"117_oeth_fixed_rate_dripper": 1736875175
}
108 changes: 68 additions & 40 deletions contracts/deployments/mainnet/OETHDripper.json

Large diffs are not rendered by default.

Loading
Loading