This project uses SuperTokens which are like ERC20s and SuperfluidTokens combined. It doesn't lose any functionality and is very versatile. The project has 3 functions for the average user: borrow where the user chooses and the number of tokens to collateralize and to borrow, and which tokens. The protocol will then confirm whether the amount is safe for the protocol after checking the price, predetermined collateralization ratio and the number of tokens the loan has. The user can also fund their loan with the original token they chose to remain in a healthy spot to avoid liquidation. The user can also take out all their collateral as their money is non-custodial within the protocol. The user must pay back the token they borrowed in order to get the tokens back. There are also liquidation functions, one is a view where you check an individual loan's position to see if it is eligible for complete liquidation. The caller can now call the liquidate function to repurchase the undercollateralized position at a discount. This will make sure the protocol avoids insolvency and that the liquidators are rewarded for helping the protocol remain afloat.

SuperToken Lending showcase

How it's made

We used super tokens, chainlink oracles, erc20, NEXT.js, ethers.js, hardhat, etc etc to make this protocol. Supertokens for the collateral and borrowing tokens, erc20s for the ABIs as super tokens inherit erc20 functionality. Chainlink's oracles get called after every function to make sure prices are regularly updated. NEXT.js for full-stack and front-end, ethers.js to call super token approval functions and communicate with the blockchain/smart-contract/ABI. HardHat was used to deploy, compile, and test the code. Remix was used for testing and iterating quickly. SuperFluid's Super token will allow us to add flows in the future to make our protocol a super app so users can stream tokens to collateral and to take the amount they wan to borrow overtime.