Description

Majority of Defi users lack time and skills to look for the highest yield on the market and prefer hassle-free solutions as leaving their funds on a lending platform. In fact, over 80% of collateral on Aave is not used to borrow any tokens. On the other hand, professional investors can only access over-collateralised loans preventing them from scaling their activity. OSMOsis solves this problem bridging the gap between depositors and investors using a cashflow protocol. It enables borrowers to access funds through a smart-contract based brokerage account. Part of the profits generated by investors redistributed to depositors boosting their earnings. The investment portfolios are constantly assessed using on-chain chainlink price feeds and liquidated when their value is closed to the borrowed amount. The protocol is currently integrated with Balancer - allowing leveraged pools that could offer higher yield and direct more funds to Balancer. It is also integrated with m-saving from mStable encouraging funds to be locked as mUSD by offering multiplied earnings.

OSMOsis showcase

How it's made

Osmosis leverages Aave Credit delegation mechanism as the source of liquidity. As the credit delegation requires negotiating an off-chain lending agreement, there was a need for a solution to automate the process and enable scalability. I've implemented a "Credit Manager" contracts that pools all of the delegation and provides the funds to borrowers automatically. The borrowing costs and delegators rewards are set up by a market mechanism based on current supply and demand using a formula based on credit delegation utilisation rate. The key challenge was to create a mechanism maintaining the solvency of under-collateralised loans. Funds are only accessed through a smart-contract brokerage account which prohibits any actions that could bring the value of portfolio below the borrowed amount. Additionally, borrowers need to provide an extra margin while creating an account, which will act as a buffer when the price of the assets change in time. The pricing mechanism is powered by Chainlink on-chain price reference contract. The liquidation is incentivised by a bonus and capped to threshold protecting borrowers. The solution is currently integrated with Balancer and mStable protocols. Unification required to adapt Chainlink price feeds to support the balancer protocol tokens and mStable assets. The brokerage account also implements the investment process as a single method call, therefore streamlining all of the approvals and token transitions. The protocol could be relatively easy updated to support other integrations as it requires only to define valuation mechanism, and investing and redemption scripts which usually take few lines of code.

Technologies used

EthereumSolidityBalancer PoolsChainlinkMetastableUSDC