defindex-strategy adapter maps each DeFindex vault to a controller supply
account for one underlying asset. The strategy calls the controller. The
DeFindex vault implements share accounting and inflation protection.
Read Vault integrations for lending
balances, nested authorization, rounding, and account lifecycle.
Deploy an instance
Deploy one strategy instance per asset, hub, and spoke combination. The same Wasm can be reused with different constructor arguments:#401 NotInitialized. The
constructor verifies that the configured market has an index, resolves the
pool address through the controller, and stores the configuration.
Each vault gets its own lending account. The adapter records that id in
VaultAccount(vault_address); vaults do not share an account.
Call the strategy API
The adapter implementsDeFindexStrategyTrait with five entrypoints. It exposes
no account-id lookup view.
Deposit and withdrawal return collateral balances, not vault shares. An
existing balance or unsolicited supply is included in a deposit’s returned
total; do not treat that total as the deposit increment.
Deposit and withdraw
A deposit measures tokens received fromfrom, resolves the vault’s account,
and authorizes its token transfer to the pool. It calls controller.supply
with the stored id or 0, persists the returned id, and returns the resulting
collateral balance. See the
supply authorization recipe.
Resolve the account before authorizing the pool transfer. After a full
withdrawal, the next deposit can recreate the account and use its current
authorization tree.
Withdrawal reads the account balance and rejects requests above it. An amount
exactly equal to that balance is converted to the controller’s 0 full-close
sentinel. The pool pays to directly; no strategy token-transfer authorization
is needed. A full withdrawal clears the vault mapping.
The controller’s full-close payout rounds down, so a request for the displayed
balance can pay one native unit less. The adapter returns the remaining
collateral balance rather than the amount paid.
Read harvest events
harvest emits HarvestEvent at ["strategy", "harvest"]. Its
price_per_share is the configured market’s supply index rescaled from RAY to
12 decimals:
amount is always 0. Harvest moves no funds and changes no
position balances. It renews the strategy instance’s storage lifetime and emits
the event.
Vault share accounting remains the vault’s responsibility.
Preserve the vault-to-account mapping
VaultAccount(vault) is the adapter’s only link to that vault’s collateral.
There is no entrypoint for assigning a replacement id. Clearing a mapping while
its account remains live makes those funds unreachable through the adapter.
Account resolution distinguishes three outcomes:
The constructor and all five methods renew instance storage. Mapping writes
and successful live-account resolution renew the mapping. Harvest renews the
instance only; it does not renew vault mappings. Maintain the vault and lending
account storage described in Vault integrations.

