Elix Lending — Smart Contract Interfacing

ELIX
3 min readNov 28, 2017

--

This week, we continued working on our smart contracts and app. We have now implemented the ability to pay back loans and added automatic refreshing. We plan to demo this next week. We would like to focus on our smart contract progress in this blog post.

First, we have added the ability for lenders to cancel loan requests. This is a small feature but makes sense because lenders should be able to reject requests. Additionally, we have now made holding periods optional, allowing each borrower-lender pair to specify whether they wish to mine after a loan is repaid. For large loans, mining will be useful, but for small day to day payments holding periods might not be desirable.

In addition, we modified our converter to communicate directly with the main contract. The main contract restricts the total supply of tokens. Currently in the MVP contract, if X Elixir are converted to the new token at a conversion ratio — producing Y new tokens, Y tokens can be mined. This places an upper limit on the supply of the next token. The conversion ratio will scale the supply down. There will also be vested developer tokens available to fund development, exchanges and marketing. These tokens will be issued over intervals by the converter. We’re also looking into the logistics of setting up exchange-like features within the app, and we’ve added forward compatibility into the token manager to enable burning of tokens should we choose to take that route.

We’ve also added the ability to specify interest when requesting a loan. When loans are paid back, the smart contracts check whether the principal plus interest have been paid. Larger loans with installments can already be represented by our token manager as multiple smaller loan objects. As an extra feature, borrowers can also pass messages via the blockchain when requesting a loan. This is a feature we’re experimenting with; we may or may not choose to implement this on a blockchain level.

Next, we altered the reward function to give 65% of the mining reward to the lender, and 35% to the borrower. This reflects the fact that lenders take greater risk. In the future, the reward function can be more sophisticated and dependent on factors of each loan within the token manager. We’ve also continually tested our converter contracts and token manager. The below diagram shows how each of the smart contracts interact and are connected:

This setup is similar to the common “Model-View-Controller” (MVC) setup used in mobile development. In our case, our model is embedded in the blockchain. Note that the token manager is restricted to issuing rewards by the main contract, and the main contract determines the mineable amount from the amount of Elixir converted. The Elixir conversion process will be handled by the UI of our app — you will simply be able to send your Elixir to your wallet address, and then we will provide an easy flow to make the conversion.

Over the next few weeks, we’re continuing work on the app and moving into the alpha stage. The website is concurrently in development, and everything is on track for our in house alpha beginning around January 2018.

Be sure to checkout our website as well as connect to our social media on Reddit, Twitter, Discord, and Telegram. If you have any questions, let us know and we’d be glad to help clear things up!

--

--