Repository navigation
[Chore] Deduplicate adapter boilerplate between blend-adapter and defindex-adapter #460
Description
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
- Shared scaffolding (storage keys,
initialize(), admin helpers) lives in one place, not two -
blend-adapteranddefindex-adapterstill pass their full existing test suites unmodified in behavior - No change to either contract's external ABI or deployed interface
-
cargo clippy --all-targets -- -D warnings,cargo fmt --all -- --check, andcargo testpass inpackages/contracts
Activity
Adecom16 commentedon Aug 4, 2026
I'll extract the shared adapter scaffolding into a reusable module while preserving the existing contract behavior and ABI. I'll ensure both adapters continue to pass their current test suites and validate the changes with cargo fmt, cargo clippy, and cargo test before submitting the PR.
I will like to jump on this
PrevailUgah commentedon Aug 5, 2026
Hey maintainer! I'd love to work on this issue.
collinsezedike commentedon Aug 6, 2026
@PrevailUgah before I assign this, what's your read on why
blend-adapteranddefindex-adaptercurrently duplicate theirinitialize()/storage-key boilerplate instead of already sharing it? And concretely, what would you pull into the shared piece versus leave separate?playmaker410 commentedon Aug 7, 2026
Hi Maintainer,
I’d love to take this on. I have hands-on experience with Rust, Soroban, Cairo, and TypeScript, and I’m confident I can deliver a solid solution within 24 hours.
Adecom16 commentedon Aug 8, 2026
I'll extract the shared adapter scaffolding into a reusable module while preserving the existing contract behavior and ABI. I'll ensure both adapters continue to pass their current test suites and validate the changes with cargo fmt, cargo clippy, and cargo test before submitting the PR.
I will like to jump on this
collinsezedike commentedon Aug 8, 2026
@Adecom16 I'm impressed by your contributions.
Would love you to take this one.
grantfox-oss commentedon Aug 8, 2026
🦊 GrantFox — @Adecom16 has been assigned to this issue!
Next steps:
Closes #460)Good luck! Track your progress on GrantFox.
collinsezedike commentedon Aug 16, 2026
@Adecom16 checking in, any progress on this? Let me know if you're still working on it or if you'd like to hand it off.
Adecom16 commentedon Aug 18, 2026
I'm almost done boss
refactor: deduplicate adapter boilerplate
grantfox-oss commentedon Aug 21, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@Adecom16's PR #541 was approved and merged by @collinsezedike.
🏆 @Adecom16: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (118 total points). Track your full progress on GrantFox.
👏 Great work, @Adecom16! Keep contributing to drydocs.