Hermes is our off-chain yield optimizer (keeper) program, designed to dynamically allocate liquidity across lending platforms for optimal yield while managing risk. Below, we break down its algorithmic approach and the rationale behind each step.
#Off chain simulationportion ← x #x is minimally 100, set by admindeposit_amount ← vault.total_amount / portionlast_allocation[] ← current allocation of vault.total_amount in each lending platformallocation[] ← track allocation after simulation to each lending platformFOR each portion FOR each platform Simulate deposit_amount to platform APR[platform] ← APR of platform after simulated deposit ENDFOR highest_APR_platform ← Select platform with the highest APR in APR[platform] allocation[highest_APR_platform] ← deposit_amount + allocation[highest_APR_platform] Update deposit_amount to platformENDFOR#On Chain Rebalance crankIF diff(allocation[], last_allocation[]) > 0.1% THEN Send rebalance crank to allocate funds according to allocation[]ENDIF