Money market hook is a liquidity hook contract to handle basic interactions (create position, deposit/withdraw, add/remove collateral, and borrow/repay) via multicall to InitCore in a single transaction. Money market hook stores its running position id for each user, starting from 1, when a user creates a new position via the contract.
The interaction flow consists of:
Create a position on the hook and InitCore, if not existed
Perform multicall to InitCore, which performs:
Decollateralize inToken from the position and redeem token in lending pool
Withdraw from lending pool
Change position mode, if specified
Borrow tokens from lending pool
Mint inToken from lending pool and collateralize to the position
Unwrap rebase tokens, if specified
Unwrap wrapped native token to native token, if specified