Skip to content

Commit

Permalink
Deploy 117 - OETH Fixed Rate Dripper (#2351)
Browse files Browse the repository at this point in the history
* feat: add OETH Fixed Rate Dripper.

* feat: add new function to Dripper.

* fix: adjust deployment file.

* fix: allow to transferERC20 to custom receiver.

* prettier.

* fix: adjust deployment script.

* fix: remove hardcoded addresses.

* docs: adjust comments.

* Deploy OETH Fixed Rate Dripper

* fix: add proposal description.

* feat: add proposal Id.

* fix: adjust proposal id.

---------

Co-authored-by: Shah <[email protected]>
  • Loading branch information
clement-ux and shahthepro authored Jan 16, 2025
1 parent 82baad3 commit 5ff14c4
Show file tree
Hide file tree
Showing 12 changed files with 1,760 additions and 56 deletions.
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 @@ contract Dripper is Governable {
// 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)
external
onlyGovernor
{
IERC20(_asset).safeTransfer(
_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)
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

0 comments on commit 5ff14c4

Please sign in to comment.