LAYs - A Simple Borrowing DApp

LAYs - A Simple Borrowing DApp

Turn in your ETHs and get LAYed. A stable coin as airy as LAYs.

27

The problem LAYs - A Simple Borrowing DApp solves

LAYs is a proof of concept and a very simple borrowing smart contract.
LAY tokens are stable coins pegged to the US Dollar by using ETH as collateral and the Chainlnk pricefeeds.

Issuance

When the users deposit

ETH

or borrow

LAYs

from the smart contract, their

ETH

is locked up as collateral. The chainlink price feeds are used to fetch price of

ETH/USD

. This price is used to calculate the amount of LAYs that should be issued as loan to the user.

Repayment

Let's say you're done getting LAYed and you want your collateral back. Just call the

withdraw

function and specify the amount of LAYs you want to give back. LAYs will be burned and ETH will be returned to your account proportional to it's worth.

UI

The UI is fairly simple and it consists of one tab each for borrowing and withdrawing. The code uses Moralis for fetching data and ChakraUI to make everything look nice and smooth.

Quick Links

LAYs Token Contract


SimpleVault Token Contract

Challenges I ran into

The most challenging part about web3 and crypto projects it keeping yourself from falling into a rabbit hole. I couldn't and I did fall for quite some time with this project.

Spent a lot of time researching borrowing and lending protocols for this project. Although my limited knowledge in building smart contracts created a challenge to come up with a better architecture than this one.

I also struggled a little with handling all the decimal calculations and using the pricefeeds to allocate appropriate amounts of tokens.

Discussion