Context
First concrete implementation of LendingProtocol. Venus doesn't expose a direct health factor — we compute it from collateral × collateral factor / debt, using the Comptroller and vToken ABIs. Also the proving ground for the charon-protocols crate that future adapters (Aave, Compound, Morpho) will live in.
Scope
- Create
crates/charon-protocols/ crate and add to workspace members
sol! macro bindings for Venus Comptroller (getAccountLiquidity, getAssetsIn, markets) and VToken (borrowBalanceCurrent, balanceOfUnderlying, underlying)
VenusAdapter struct implementing LendingProtocol
fetch_positions(borrowers) — multicall to query position state in one RPC round
- Compute health factor from collateral value × collateral factor / debt value
- Seed a small hardcoded list of known BSC borrowers for initial testing
- Subscribe to Venus
Borrow events to accumulate the borrower set over time
Acceptance criteria
References
Context
First concrete implementation of
LendingProtocol. Venus doesn't expose a direct health factor — we compute it from collateral × collateral factor / debt, using the Comptroller and vToken ABIs. Also the proving ground for thecharon-protocolscrate that future adapters (Aave, Compound, Morpho) will live in.Scope
crates/charon-protocols/crate and add to workspace memberssol!macro bindings for VenusComptroller(getAccountLiquidity,getAssetsIn,markets) andVToken(borrowBalanceCurrent,balanceOfUnderlying,underlying)VenusAdapterstruct implementingLendingProtocolfetch_positions(borrowers)— multicall to query position state in one RPC roundBorrowevents to accumulate the borrower set over timeAcceptance criteria
charon-protocolscrate compiles independentlyVenusAdapter::new(config)connects to BSC and can query the Comptrollerfetch_positions(&[borrower])returns a populatedPositionwith non-zero collateral/debt for a known borrowerhealth_factor(> 0, ≤ ~10 for real accounts)Borrowevents runs without errorsReferences