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
9 changes: 3 additions & 6 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Linting: `forge fmt --check` (Solidity), `pnpm lint` (JS), `pnpm prettier:check`

## Environment Setup

Copy `.env.example` to `.env` and set `MAINNET_URL` (Ethereum RPC) and `SONIC_URL` (Sonic RPC). Fork tests require these RPC endpoints.
Copy `.env.example` to `.env` and set `MAINNET_URL` (Ethereum RPC). Fork tests require this RPC endpoint.

## Architecture

Expand All @@ -53,14 +53,13 @@ Concrete implementations (`LidoARM.sol`, `EtherFiARM.sol`, `EthenaARM.sol`, `Ori
- **CapManager.sol** - Manages capital limits (total assets cap and per-LP caps)
- **EthenaUnstaker.sol** - Helper allowing multiple parallel sUSDe cooldowns for EthenaARM
- **ZapperARM.sol / ZapperLidoARM.sol** - Convenience wrappers for depositing native ETH
- **SonicHarvester.sol** - Collects rewards from strategies and swaps them for ARM liquidity tokens on Sonic
- **PendleOriginARMSY.sol** (`src/contracts/pendle/`) - Pendle SY adapter for ARM integration
- **Interfaces.sol** - Shared interface definitions
- **Addresses.sol** (`src/contracts/utils/`) - On-chain address registry

### Market Adapters (`src/contracts/markets/`)

`Abstract4626MarketWrapper.sol` wraps ERC-4626 lending markets (Morpho, Silo) so the ARM can deposit idle liquidity. Concrete: `MorphoMarket.sol`, `SiloMarket.sol`.
`Abstract4626MarketWrapper.sol` wraps ERC-4626 lending markets (Morpho) so the ARM can deposit idle liquidity. Concrete: `MorphoMarket.sol`.

### Proxy Pattern

Expand All @@ -80,13 +79,11 @@ All ARMs are deployed behind `Proxy.sol` (EIP-1967) for upgradeability.

## Deployment

Deployment scripts are in `script/deploy/` organized by chain (`mainnet/`, `sonic/`). Numbered scripts (e.g. `011_DeployEtherFiARMScript.s.sol`) are auto-discovered and ordered by `DeployManager.s.sol`. See `script/deploy/ARCHITECTURE.md` for the full deployment framework documentation.
Deployment scripts are in `script/deploy/` organized by chain (`mainnet/`). Numbered scripts (e.g. `011_DeployEtherFiARMScript.s.sol`) are auto-discovered and ordered by `DeployManager.s.sol`. See `script/deploy/ARCHITECTURE.md` for the full deployment framework documentation.

```bash
make deploy-mainnet # Mainnet with verification
make deploy-sonic # Sonic chain
make simulate # Dry run mainnet (default)
make simulate NETWORK=sonic # Dry run Sonic
```

## Key Conventions
Expand Down
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ MAINNET_URL=

# [Optional] RPC URLs for other networks
TESTNET_URL=
SONIC_URL=
HOLESKY_URL=
LOCAL_URL=

Expand All @@ -17,7 +16,6 @@ LOCAL_URL=

# [Optional] Pin fork tests to specific block numbers for reproducibility
FORK_BLOCK_NUMBER_MAINNET=
FORK_BLOCK_NUMBER_SONIC=

# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ EXTERNAL APIS ║
Expand All @@ -26,9 +24,6 @@ FORK_BLOCK_NUMBER_SONIC=
# [Optional] Etherscan API key for contract verification
# ETHERSCAN_API_KEY=

# [Optional] Fly.io API key
# FLY_API_KEY=

# [Optional] 1inch API key for swap quotes
# ONEINCH_API_KEY=

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ jobs:
runs-on: ubuntu-latest
env:
MAINNET_URL: ${{ secrets.MAINNET_URL }}
FLY_API_KEY: ${{ secrets.FLY_API_KEY }}
SONIC_URL: ${{ secrets.SONIC_URL }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -111,8 +109,6 @@ jobs:
runs-on: ubuntu-latest
env:
MAINNET_URL: ${{ secrets.MAINNET_URL }}
FLY_API_KEY: ${{ secrets.FLY_API_KEY }}
SONIC_URL: ${{ secrets.SONIC_URL }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 3 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Linting: `forge fmt --check` (Solidity), `pnpm lint` (JS), `pnpm prettier:check`

## Environment Setup

Copy `.env.example` to `.env` and set `PROVIDER_URL` (Ethereum RPC) and `SONIC_URL` (Sonic RPC). Fork tests require these RPC endpoints.
Copy `.env.example` to `.env` and set `PROVIDER_URL` (Ethereum RPC). Fork tests require this RPC endpoint.

## Architecture

Expand All @@ -50,7 +50,7 @@ Concrete implementations (`LidoARM.sol`, `EtherFiARM.sol`, `EthenaARM.sol`, `Ori

### Market Adapters (`src/contracts/markets/`)

`Abstract4626MarketWrapper.sol` wraps ERC-4626 lending markets (Morpho, Silo) so the ARM can deposit idle liquidity. Concrete: `MorphoMarket.sol`, `SiloMarket.sol`.
`Abstract4626MarketWrapper.sol` wraps ERC-4626 lending markets (Morpho) so the ARM can deposit idle liquidity. Concrete: `MorphoMarket.sol`.

### Proxy Pattern

Expand All @@ -69,13 +69,11 @@ All ARMs are deployed behind `Proxy.sol` (EIP-1967) for upgradeability.

## Deployment

Deployment scripts are in `script/deploy/` organized by chain (`mainnet/`, `sonic/`). `DeployManager.sol` orchestrates execution based on chain ID.
Deployment scripts are in `script/deploy/mainnet/`. `DeployManager.sol` orchestrates execution based on chain ID.

```bash
make deploy # Mainnet with verification
make deploy-sonic # Sonic chain
make simulate-deploys # Dry run mainnet
make simulate-sonic-deploys # Dry run Sonic
```

## Key Conventions
Expand Down
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,14 @@ deploy-testnet:
forge build
@forge script $(DEPLOY_SCRIPT) --rpc-url $(TESTNET_URL) --broadcast --slow --unlocked -vvvv

deploy-sonic:
forge build
@forge script $(DEPLOY_SCRIPT) --rpc-url $(SONIC_URL) $(DEPLOY_BASE) --verify -vvv

# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ SIMULATE ║
# ╚══════════════════════════════════════════════════════════════════════════════╝

# Simulate deployment: make simulate (mainnet) or make simulate NETWORK=sonic
NETWORK ?= mainnet
# Simulate deployment on a fork of mainnet
simulate:
forge build
@forge script $(DEPLOY_SCRIPT) --fork-url $(if $(filter sonic,$(NETWORK)),$(SONIC_URL),$(MAINNET_URL)) -vvvv
@forge script $(DEPLOY_SCRIPT) --fork-url $(MAINNET_URL) -vvvv

# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ UPDATE DEPLOYMENTS ║
Expand Down Expand Up @@ -184,5 +179,5 @@ frame:

.PHONY: test test-base test-unit test-fork test-smoke test-invariants \
coverage coverage-html gas snapshot \
deploy-mainnet deploy-local deploy-testnet deploy-sonic simulate \
deploy-mainnet deploy-local deploy-testnet simulate \
update-deployments match clean clean-crytic clean-all install frame
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,7 @@ In the `.env` file, set `DEPLOYER_ADDRESS` (should match the privateKey you regi
make deploy-mainnet
```

### Sonic

In the `.env` file, set `DEPLOYER_ADDRESS` (should match the privateKey you registered wit `cast wallet import deployerKey`) and `SONIC_URL` to the mainnet values.

```bash
make deploy-sonic
```

## Contract Verification
## Contract Verification

If the verification doesn't work with the deployment, it can be done separately with forge `verify-contract`.
Expand All @@ -303,10 +296,9 @@ environment.
```bash
# Sync all deployment aliases from the current chain's deployment file
yarn hardhat tenderlySync --network mainnet
yarn hardhat tenderlySync --network sonic

# Upload a deployment alias from the current chain's deployment file
yarn hardhat tenderlyUpload --network sonic --name ORIGIN_ARM
yarn hardhat tenderlyUpload --network mainnet --name ETH_ARM
```

## Automated Actions (Talos)
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://nonce:nonce@postgres:5432/nonce_queue}
- MAINNET_URL=${MAINNET_URL:-}
- SONIC_URL=${SONIC_URL:-}
- HOLESKY_URL=${HOLESKY_URL:-}
- ACTION_API_BEARER_TOKEN=${ACTION_API_BEARER_TOKEN:-test-token}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
Expand Down
1 change: 0 additions & 1 deletion dockerfile-actions
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ RUN cd /app \
RUN chown -R runner:runner /app

ENV MAINNET_URL="" \
SONIC_URL="" \
HOLESKY_URL=""

# Git commit this image was built from. CI passes
Expand Down
17 changes: 2 additions & 15 deletions docs/ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ range, tolerance, and quote-amount flags apply to every selected base.

Every `allocate*` action accepts an optional `--threshold` in the ARM's
liquidity asset and defaults to: Lido `100 WETH`, EtherFi `20 WETH`, Ethena
`30,000 USDe`, USDC `15,000 USDC`, WETH `100 WETH`, OETH `100 WETH`, and
Sonic `10,000 wS`. The threshold skips small liquidity
`30,000 USDe`, USDC `15,000 USDC`, WETH `100 WETH`, OETH `100 WETH`. The threshold skips small liquidity
deltas; the ARM contract determines the actual amount allocated.

The allocation actions also accept an optional `--max-gas-price` in gwei. It
defaults to `5` for Lido, EtherFi, Ethena, USDC, and WETH, and `500` for OETH
and Sonic.
defaults to `5` for Lido, EtherFi, Ethena, USDC, and WETH, and `500` for OETH.

## Lido ARM — mainnet

Expand Down Expand Up @@ -118,17 +116,6 @@ and Sonic.
| `setPricesWETH --bases STETH,WSTETH --fee 0.6 --inch false --kyber true --tolerance 0.1 --amount 30 --offset 0.3 --max-buy-price 0.99996 --min-sell-price 0.99998` | `*/10 * * * *` | Set WETH ARM prices for Lido base assets |
| `setPricesWETH --bases EETH,WEETH --fee 0.6 --inch false --kyber true --tolerance 0.1 --amount 30 --offset 0.3 --max-buy-price 0.99996 --min-sell-price 0.99998` | `2-59/10 * * * *` | Set WETH ARM prices for Ether.fi base assets |

## Origin ARM — Sonic

| Action | Cron | Description |
| -------------------------- | --------------- | ------------------------------------------------------- |
| `autoRequestWithdrawSonic` | `48,18 * * * *` | Request withdrawals from Origin ARM on Sonic |
| `autoClaimWithdrawSonic` | `10 * * * *` | Claim withdrawals from Origin ARM on Sonic and allocate |
| `collectFeesSonic` | `55 23 * * *` | Collect fees from Origin ARM on Sonic |
| `allocateSonic` | `1,31 * * * *` | Allocate liquidity for Origin ARM on Sonic |
| `setOSSiloPriceAction` | `*/30 * * * *` | Set prices on Sonic ARM |
| `collectRewardsSonic` | `45 23 * * *` | Collect rewards from the Sonic harvester |

## System

| Action | Cron | Description |
Expand Down
Binary file removed docs/plantuml/sonicContracts.png
Binary file not shown.
137 changes: 0 additions & 137 deletions docs/plantuml/sonicContracts.puml

This file was deleted.

1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,5 @@ remappings_location = "config"

[rpc_endpoints]
mainnet = "${MAINNET_URL}"
sonic = "${SONIC_URL}"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
4 changes: 0 additions & 4 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ module.exports = {
url: `${process.env.HOLESKY_URL}`,
chainId: 17000,
},
sonic: {
url: `${process.env.SONIC_URL}`,
chainId: 146,
},
testnet: {
url: `${process.env.TESTNET_URL}`,
chainId: 1,
Expand Down
8 changes: 1 addition & 7 deletions migrations/seed_schedules.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,5 @@ INSERT INTO schedules (product, name, command, cron_expr, timezone, enabled, not
-- ARM cap changes: manual-only (enabled=false). Edit `--arm`, `--accounts`,
-- and/or `--cap` before using "Run now".
('arm-oeth', 'Set Liquidity Provider Caps - Mainnet','cd /app && pnpm hardhat setLiquidityProviderCapsAction --arm lido --accounts 0x0000000000000000000000000000000000000000 --cap 20000 --network mainnet', '0 0 * * *', 'UTC', false, NULL),
('arm-oeth', 'Set Total Assets Cap - Mainnet', 'cd /app && pnpm hardhat setTotalAssetsCapAction --arm lido --cap 100000 --network mainnet', '0 0 * * *', 'UTC', false, NULL),
('arm-oeth', 'sonic_auto_request_withdraw', 'cd /app && pnpm hardhat autoRequestWithdrawSonic --network sonic', '48,18 * * * *', 'UTC', false, NULL),
('arm-oeth', 'sonic_auto_claim_withdraw', 'cd /app && pnpm hardhat autoClaimWithdrawSonic --network sonic', '10 * * * *', 'UTC', false, NULL),
('arm-oeth', 'sonic_collect_fees', 'cd /app && pnpm hardhat collectFeesSonic --network sonic', '55 23 * * *', 'UTC', false, NULL),
('arm-oeth', 'sonic_allocate', 'cd /app && pnpm hardhat allocateSonic --network sonic', '1,31 * * * *', 'UTC', false, NULL),
('arm-oeth', 'os_silo_set_prices', 'cd /app && pnpm hardhat setOSSiloPriceAction --network sonic', '*/30 * * * *', 'UTC', false, NULL),
('arm-oeth', 'sonic_collect_rewards', 'cd /app && pnpm hardhat collectRewardsSonic --network sonic', '45 23 * * *', 'UTC', false, NULL)
('arm-oeth', 'Set Total Assets Cap - Mainnet', 'cd /app && pnpm hardhat setTotalAssetsCapAction --arm lido --cap 100000 --network mainnet', '0 0 * * *', 'UTC', false, NULL)
ON CONFLICT (product, name) DO NOTHING;
Loading
Loading