ethereum-optimism / ethereum-optimism/actions
Lend provider blocklist and abstraction gaps
- Dominant language
- TypeScript
- Stars
- 32
- Forks
- 25
- Avg merge
- 10h 20m
- Merged PRs (30d)
- 16
Description
## Summary
The lend provider base class has several gaps in allowlist/blocklist enforcement and duplicated logic that should be shared with swap providers.
## Blocklist is non-functional
`marketBlocklist` is defined in `LendProviderConfig` but **never checked anywhere** in `LendProvider`. A developer could configure a blocklist and it silently does nothing.
- `validateConfigSupported()` only checks the allowlist (LendProvider.ts:233-255)
- `filterMarketConfigs()` only filters by chainId/asset, not allowlist or blocklist
- `getMarkets()` doesn't enforce allowlist when custom markets array is provided
## Shared logic to reuse from swap refactor
After the swap provider refactor (PR #311), shared utilities exist that lend providers should adopt:
- **`swap/core/markets.ts`** — `expandMarkets`, `findMarket`, `assetPairs` patterns can inform equivalent lend utilities
- **`utils/approve.ts`** — `buildErc20ApprovalTx`, `buildApprovalTxIfNeeded`, `getApprovalDeficit` — `LendProvider.buildApprovalTx` should delegate to `buildErc20ApprovalTx` (already done)
- **`supportedChainIds()` 3-level intersection** — identical code in both base classes, should be extracted to a shared utility
## What to do
1. Implement blocklist checking in `LendProvider.validateConfigSupported()`
2. Enforce allowlist/blocklist in `getMarkets()` and `getMarket()`
3. Extract shared `supportedChainIds()` filtering to a utility both base classes use
4. Ensure `filterMarketConfigs()` respects both allowlist and blocklist
Contributor guide
Research direction
Start in LendProvider.ts, especially validateConfigSupported(), filterMarketConfigs(), getMarkets(), and getMarket(), then compare the shared patterns in swap/core/markets.ts and utils/approve.ts. Done means allowlists and blocklists are enforced consistently and supportedChainIds() filtering is shared by both base classes without changing approval behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100