Skip to content
Open
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
Binary file modified docs/plantuml/EthenaContracts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 2 additions & 10 deletions docs/plantuml/EthenaContracts.puml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ object "StakedUSDe" as susde <<Ethena>><<Proxy>> #$thirdPartyColor {
asset: USDe
}

' object "Aave Market" as aMarket <<Origin>><<Proxy>> #$originColor {
' asset: USDe
' }

object "Aave Vault" as aVault <<Aave>><<Proxy>> #$thirdPartyColor {
asset: USDe
}
Expand All @@ -48,15 +44,11 @@ object "aUSDe" as aUSDe <<Aave>> #$thirdPartyColor {
asset: USDe
}

arm <.> capMan
capMan <.> arm
arm ..> adapter
adapter ..> unstaker
adapter .> unstaker
adapter ..> susde
unstaker ..> susde
' arm ..> aMarket
' aMarket ..> aVault
' aVault ..> aUSDe
' aMarket ...> aUSDe
arm ..> aVault
aVault ..> aUSDe

Expand Down
Binary file modified docs/plantuml/usdcContracts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions docs/plantuml/usdcContracts.puml
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ object "CapManager" as capMan <<Origin>><<Proxy>> #$originColor {
}

object "PaxosAssetAdapter\n(PYUSD)" as pyusdAdapter <<Origin>><<Proxy>> #$originColor {
base asset: PYUSD
asset: PYUSD
}

object "PaxosAssetAdapter\n(USDG)" as usdgAdapter <<Origin>><<Proxy>> #$originColor {
base asset: USDG
asset: USDG
}

object "PYUSD" as pyusd <<Paxos>> #$thirdPartyColor {
base asset
object "PYUSD Deposit" as pyusd <<Paxos>> #$thirdPartyColor {
asset: PYUSD
}

object "USDG" as usdg <<Paxos>> #$thirdPartyColor {
base asset
object "USDG Deposit" as usdg <<Paxos>> #$thirdPartyColor {
asset: USDG
}

arm <.> capMan : deposit caps
arm ..> pyusdAdapter : request / claim
arm ..> usdgAdapter : request / claim
capMan <.> arm : deposit caps
arm ..> pyusdAdapter : transfer
arm ..> usdgAdapter : transfer

pyusdAdapter ..> pyusd : queues and submits
pyusdAdapter ..> pyusd : transfer

usdgAdapter ..> usdg : queues and submits
usdgAdapter ..> usdg : transfer

@enduml
Binary file modified docs/plantuml/wethContracts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion docs/plantuml/wethContracts.puml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ object "MultiAssetARM\n(WETH ARM)" as arm <<Origin>><<Proxy>> #$originColor {
base assets: stETH, wstETH, eETH, weETH
}

object "Morpho Market" as morphoMarket <<Origin>><<Proxy>> #$originColor {
asset: WETH
}

object "Yearn WETH ARM Vault" as morphoVault <<Morpho>> #$thirdPartyColor {
asset: WETH
}

object "CapManager" as capMan <<Origin>><<Proxy>> #$originColor {
total-assets cap
liquidity-provider caps
Expand Down Expand Up @@ -59,8 +67,10 @@ object "Ether.fi\nWithdrawal NFT" as etherfiNft <<EtherFi>><<Proxy>> #$thirdPart
}

zapper ..> arm : deposits for receiver
arm .right.> morphoMarket : deposit /\nredeem
morphoMarket ...> morphoVault : deposit /\nredeem

arm <.> capMan : deposit caps
capMan <.> arm : deposit caps
arm ..> stethAdapter : request / claim
arm ..> wstethAdapter : request / claim
arm ..> eethAdapter : request / claim
Expand Down
87 changes: 87 additions & 0 deletions script/deploy/mainnet/043_AddOriginAssetsToWETHARMScript.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

// Contracts
import {Proxy} from "contracts/Proxy.sol";
import {Mainnet} from "contracts/utils/Addresses.sol";
import {MultiAssetARM} from "contracts/MultiAssetARM.sol";
import {OriginAssetAdapter} from "contracts/adapters/OriginAssetAdapter.sol";
import {WrappedOriginAssetAdapter} from "contracts/adapters/WrappedOriginAssetAdapter.sol";

// Deployment
import {AbstractDeployScript} from "script/deploy/helpers/AbstractDeployScript.s.sol";

/// @title Add Origin assets to the WETH ARM
/// @notice Deploys OETH and wOETH adapters that redeem through the OETH Vault's asynchronous
/// withdrawal queue, then registers both tokens as base assets on the existing WETH ARM.
/// @dev The adapter proxies are owned by the mainnet 2/8 multisig. The same multisig owns the WETH
/// ARM and performs the base-asset registration actions simulated by `_fork()`.
contract $043_AddOriginAssetsToWETHARMScript is AbstractDeployScript("043_AddOriginAssetsToWETHARMScript") {
/// 0.99998e36 = base asset valued at 0.99998 WETH in totalAssets().
uint256 internal constant CROSS_PRICE = 0.99998e36;
/// 0.9997e36 = ARM pays 0.9997 WETH per base asset bought from traders.
uint256 internal constant BUY_PRICE = 0.9997e36;
/// 1e36 = ARM charges 1 WETH per base asset sold to traders.
uint256 internal constant SELL_PRICE = 1e36;

function _execute() internal override {
address wethARM = resolver.resolve("WETH_ARM");

// 1. Deploy the adapter for rebasing OETH.
OriginAssetAdapter oethAdapterImpl =
new OriginAssetAdapter(wethARM, Mainnet.OETH, Mainnet.WETH, Mainnet.OETH_VAULT);
_recordDeployment("WETH_ARM_OETH_ADAPTER_IMPL", address(oethAdapterImpl));

Proxy oethAdapterProxy = new Proxy();
oethAdapterProxy.initialize(
address(oethAdapterImpl), Mainnet.MULTISIG_2_OF_8, abi.encodeWithSignature("initialize()")
);
_recordDeployment("WETH_ARM_OETH_ADAPTER", address(oethAdapterProxy));

// 2. Deploy the adapter that unwraps wOETH before requesting an OETH Vault withdrawal.
WrappedOriginAssetAdapter woethAdapterImpl =
new WrappedOriginAssetAdapter(wethARM, Mainnet.WOETH, Mainnet.OETH, Mainnet.WETH, Mainnet.OETH_VAULT);
_recordDeployment("WETH_ARM_WOETH_ADAPTER_IMPL", address(woethAdapterImpl));

Proxy woethAdapterProxy = new Proxy();
woethAdapterProxy.initialize(
address(woethAdapterImpl), Mainnet.MULTISIG_2_OF_8, abi.encodeWithSignature("initialize()")
);
_recordDeployment("WETH_ARM_WOETH_ADAPTER", address(woethAdapterProxy));
}

function _fork() internal override {
MultiAssetARM wethARM = MultiAssetARM(payable(resolver.resolve("WETH_ARM")));

// Idempotent: the deployment runner can replay pending multisig actions on forks.
(,,,,,,,, address oethAdapter) = wethARM.baseAssetConfigs(Mainnet.OETH);
if (oethAdapter == address(0)) {
vm.prank(Mainnet.MULTISIG_2_OF_8);
wethARM.addBaseAsset(
Mainnet.OETH,
resolver.resolve("WETH_ARM_OETH_ADAPTER"),
BUY_PRICE,
SELL_PRICE,
0, // buyAmount: no swaps until the operator sets swap limits.
0, // sellAmount
CROSS_PRICE,
true // OETH is accounted for 1:1 with WETH.
);
}

(,,,,,,,, address woethAdapter) = wethARM.baseAssetConfigs(Mainnet.WOETH);
if (woethAdapter == address(0)) {
vm.prank(Mainnet.MULTISIG_2_OF_8);
wethARM.addBaseAsset(
Mainnet.WOETH,
resolver.resolve("WETH_ARM_WOETH_ADAPTER"),
BUY_PRICE,
SELL_PRICE,
0, // buyAmount: no swaps until the operator sets swap limits.
0, // sellAmount
CROSS_PRICE,
false // wOETH is valued through its ERC-4626 conversion rate.
);
}
}
}
28 changes: 25 additions & 3 deletions src/js/tasks/actions/setPricesWETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import { mainnet } from "../../utils/addresses";
const multiAssetARMAbi = require("../../../abis/MultiAssetARM.json");

const LIDO_BASES = new Set(["STETH", "WSTETH"]);
const SUPPORTED_BASES = new Set(["STETH", "WSTETH", "EETH", "WEETH"]);
const ORIGIN_BASES = new Set(["OETH", "WOETH"]);
const SUPPORTED_BASES = new Set([
"STETH",
"WSTETH",
"EETH",
"WEETH",
"OETH",
"WOETH",
]);

const lidoDefaults = {
maxBuyPrice: 0.9999,
Expand All @@ -30,6 +38,16 @@ const etherFiDefaults = {
kyber: true,
};

const originDefaults = {
maxBuyPrice: 0.9995,
minBuyPrice: 0.996,
maxSellPrice: 0.9999,
minSellPrice: 0.9995,
tolerance: 0.3,
inch: false,
kyber: true,
};

action({
name: "setPricesWETH",
description: "Set prices for WETH ARM",
Expand All @@ -39,7 +57,7 @@ action({
.addOptionalParam(
"bases",
"Comma-separated list of base assets to set prices for.",
"STETH,WSTETH,EETH,WEETH",
"STETH,WSTETH,EETH,WEETH,OETH,WOETH",
types.string,
)
.addOptionalParam(
Expand Down Expand Up @@ -160,7 +178,11 @@ action({

log.info("Setting prices for WETH ARM");
for (const base of bases) {
const defaults = LIDO_BASES.has(base) ? lidoDefaults : etherFiDefaults;
const defaults = LIDO_BASES.has(base)
? lidoDefaults
: ORIGIN_BASES.has(base)
? originDefaults
: etherFiDefaults;
await setPricesForBases({
setPrices,
bases: [base],
Expand Down
Loading