Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions script/deploy/DeployManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {UpgradeLidoARMSetBufferScript} from "./mainnet/009_UpgradeLidoARMSetBuff
import {UpgradeOriginARMSetBufferScript} from "./sonic/005_UpgradeOriginARMSetBufferScript.sol";
import {UpgradeLidoARMAssetScript} from "./mainnet/010_UpgradeLidoARMAssetScript.sol";
import {DeployEtherFiARMScript} from "./mainnet/011_DeployEtherFiARMScript.sol";
import {UpgradeEtherFiARMScript} from "./mainnet/012_UpgradeEtherFiARMScript.sol";

contract DeployManager is Script {
using stdJson for string;
Expand Down Expand Up @@ -84,6 +85,7 @@ contract DeployManager is Script {
_runDeployFile(new DeployPendleAdaptor());
_runDeployFile(new UpgradeLidoARMAssetScript());
_runDeployFile(new DeployEtherFiARMScript());
_runDeployFile(new UpgradeEtherFiARMScript());
} else if (block.chainid == 17000) {
// Holesky
_runDeployFile(new DeployCoreHoleskyScript());
Expand Down
55 changes: 55 additions & 0 deletions script/deploy/mainnet/012_UpgradeEtherFiARMScript.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

// Foundry imports
import {console} from "forge-std/console.sol";

// Contract imports
import {Proxy} from "contracts/Proxy.sol";
import {EtherFiARM} from "contracts/EtherFiARM.sol";
import {Mainnet} from "contracts/utils/Addresses.sol";
import {MorphoMarket} from "contracts/markets/MorphoMarket.sol";

// Deployment imports
import {GovProposal, GovSixHelper} from "contracts/utils/GovSixHelper.sol";
import {AbstractDeployScript} from "../AbstractDeployScript.sol";

contract UpgradeEtherFiARMScript is AbstractDeployScript {
using GovSixHelper for GovProposal;

GovProposal public govProposal;

string public constant override DEPLOY_NAME = "012_UpgradeEtherFiARMScript";
bool public constant override proposalExecuted = false;

Proxy morphoMarketProxy;
EtherFiARM etherFiARMImpl;
MorphoMarket morphoMarket;

function _execute() internal override {
console.log("Deploy:", DEPLOY_NAME);
console.log("------------");

// 1. Deploy new EtherFiARM implementation
uint256 claimDelay = tenderlyTestnet ? 1 minutes : 10 minutes;
etherFiARMImpl = new EtherFiARM(
Mainnet.EETH,
Mainnet.WETH,
Mainnet.ETHERFI_WITHDRAWAL,
claimDelay,
1e7, // minSharesToRedeem
1e18, // allocateThreshold
Mainnet.ETHERFI_WITHDRAWAL_NFT,
Mainnet.ETHERFI_REDEMPTION_MANAGER
);
_recordDeploy("ETHERFI_ARM_IMPL", address(etherFiARMImpl));

console.log("Finished deploying", DEPLOY_NAME);
}

function _fork() internal override {
vm.startPrank(Proxy(payable(deployedContracts["ETHER_FI_ARM"])).owner());
Proxy(payable(deployedContracts["ETHER_FI_ARM"])).upgradeTo(address(etherFiARMImpl));
vm.stopPrank();
}
}
14 changes: 12 additions & 2 deletions src/contracts/AbstractARM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,21 @@ abstract contract AbstractARM is OwnableOperable, ERC20Upgradeable {
* @param amountIn The amount of input tokens to send.
* @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
* @param to Recipient of the output tokens.
* @return amounts The input and output token amounts.
*/
function swapExactTokensForTokens(
IERC20 inToken,
IERC20 outToken,
uint256 amountIn,
uint256 amountOutMin,
address to
) external virtual {
) external virtual returns (uint256[] memory amounts) {
uint256 amountOut = _swapExactTokensForTokens(inToken, outToken, amountIn, to);
require(amountOut >= amountOutMin, "ARM: Insufficient output amount");

amounts = new uint256[](2);
amounts[0] = amountIn;
amounts[1] = amountOut;
}

/**
Expand Down Expand Up @@ -297,17 +302,22 @@ abstract contract AbstractARM is OwnableOperable, ERC20Upgradeable {
* @param amountOut The amount of output tokens to receive.
* @param amountInMax The maximum amount of input tokens that can be required before the transaction reverts.
* @param to Recipient of the output tokens.
* @return amounts The input and output token amounts.
*/
function swapTokensForExactTokens(
IERC20 inToken,
IERC20 outToken,
uint256 amountOut,
uint256 amountInMax,
address to
) external virtual {
) external virtual returns (uint256[] memory amounts) {
uint256 amountIn = _swapTokensForExactTokens(inToken, outToken, amountOut, to);

require(amountIn <= amountInMax, "ARM: Excess input amount");

amounts = new uint256[](2);
amounts[0] = amountIn;
amounts[1] = amountOut;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/contracts/Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ interface IOethARM {
* @param amountIn The amount of input tokens to send.
* @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
* @param to Recipient of the output tokens.
* @return amounts The input and output token amounts.
*/
function swapExactTokensForTokens(
IERC20 inToken,
IERC20 outToken,
uint256 amountIn,
uint256 amountOutMin,
address to
) external;
) external returns (uint256[] memory amounts);

/**
* @notice Uniswap V2 Router compatible interface. Swaps an exact amount of
Expand Down Expand Up @@ -68,14 +69,15 @@ interface IOethARM {
* @param amountOut The amount of output tokens to receive.
* @param amountInMax The maximum amount of input tokens that can be required before the transaction reverts.
* @param to Recipient of the output tokens.
* @return amounts The input and output token amounts.
*/
function swapTokensForExactTokens(
IERC20 inToken,
IERC20 outToken,
uint256 amountOut,
uint256 amountInMax,
address to
) external;
) external returns (uint256[] memory amounts);

/**
* @notice Uniswap V2 Router compatible interface. Receive an exact amount of
Expand Down
Loading