Summary
blend-adapter and defindex-adapter both implement the vault's YieldAdapterInterface, but they duplicate storage-key definitions, initialize(), and admin/pool-getter boilerplate rather than sharing a common base. The two contracts' actual yield-source logic legitimately differs (that shouldn't be merged), but the surrounding scaffolding is copy-pasted.
Motivation
Right now a change to the shared scaffolding (e.g. how the admin address is stored, or how require_auth() is applied on init) has to be made twice and can silently drift between the two contracts. This is maintenance risk, not a correctness bug today, but it's the kind of thing that turns into a real inconsistency the next time someone touches one adapter without remembering to mirror the other.
Proposed Solution
Extract the shared scaffolding (storage keys, initialize(), admin storage/read helpers, any other boilerplate common to both adapters) into a shared crate or module under packages/contracts that both blend-adapter and defindex-adapter depend on. Each adapter keeps its own yield-source-specific logic (accrue(), rate conversion, pool/vault interaction) implementing the interface on top of the shared base.
Scope
| Field |
Value |
| Area |
Contracts |
| Protocol affected |
Both |
| Network |
testnet |
| Breaking change? |
No (internal structure only, same ABI) |
Alternatives Considered
Leaving the duplication as-is: acceptable short-term since both adapters are small and the interface keeps them aligned externally, but doesn't scale if a third adapter is added.
Acceptance Criteria
Summary
blend-adapteranddefindex-adapterboth implement the vault'sYieldAdapterInterface, but they duplicate storage-key definitions,initialize(), and admin/pool-getter boilerplate rather than sharing a common base. The two contracts' actual yield-source logic legitimately differs (that shouldn't be merged), but the surrounding scaffolding is copy-pasted.Motivation
Right now a change to the shared scaffolding (e.g. how the admin address is stored, or how
require_auth()is applied on init) has to be made twice and can silently drift between the two contracts. This is maintenance risk, not a correctness bug today, but it's the kind of thing that turns into a real inconsistency the next time someone touches one adapter without remembering to mirror the other.Proposed Solution
Extract the shared scaffolding (storage keys,
initialize(), admin storage/read helpers, any other boilerplate common to both adapters) into a shared crate or module underpackages/contractsthat bothblend-adapteranddefindex-adapterdepend on. Each adapter keeps its own yield-source-specific logic (accrue(), rate conversion, pool/vault interaction) implementing the interface on top of the shared base.Scope
Alternatives Considered
Leaving the duplication as-is: acceptable short-term since both adapters are small and the interface keeps them aligned externally, but doesn't scale if a third adapter is added.
Acceptance Criteria
initialize(), admin helpers) lives in one place, not twoblend-adapteranddefindex-adapterstill pass their full existing test suites unmodified in behaviorcargo clippy --all-targets -- -D warnings,cargo fmt --all -- --check, andcargo testpass inpackages/contracts