Inspiration

This is something I wish I'd had available to me in 2018 when I was accumulating Chainlink all year with each paycheck I received. I asked my brother, who is much wealthier than I am, for a $100k loan to buy Chainlink tokens below 40 cents. Of course, he didn't let me borrow the money and the rest is history, but if a structure like this project existed, he may have been more willing to let me borrow some money to invest in my well-researched investment thesis.

What it does

This project allows two parties to come together and ideally both benefit. I have, in a sort of tongue in cheek way, named the parties using this application Big Money and Wagie. Big Money, as the name implies, is someone that has a lot of capital available, and Wagie is someone who might not have a lot of available capital, but has a steady and reliable income stream available. In this initial implementation, I've modeled the scenario as in the "Inspiration" section above, where I really would have liked to buy a lot of Chainlink tokens, but didn't have the capital to buy them all readily available. With this project, I could have gone to Big Money (my brother in this example) and he could have market bought a bunch of Chainlink, and deposited it into this smart contract to hold. So essentially Big Money and Wagie come to an agreement before hand, and Big Money is able to create a new "financial agreement" with which Wagie can interact. When launching a new Financial Agreement, Big Money configures the following information: -The asset that is going to be deposited into the agreement and the amount of that asset (Chainlink tokens in this case) -The client (i.e. Wagie's) wallet address with which the client will interact with this agreement -The terms of the agreement, which in includes the number of payments to be made, the premium rate, any security deposit rate, the payment period (i.e. a payment due every week, every month, etc), and the "grace period" (if the payment period is 1 month, and the grace period is 5 days, then if 5 days pass after the payment is due, the payment is considered delinquent, and at that point, Big Money can execute a "terminate agreement" function and retrieve his funds, plus any security deposit from the conract)

Once all of that is configured, the agreement is live and Big Money is given an "Agreement ID" which will be used for both parties to interact with the agreement in the future.

From here, both Wagie and Big Money can interact with the agreement if they are using the proper wallet addresses as configured. Wagie can access the agreement information through the ClientInteraction component. Things are very simple for Wagie here and all he needs to do is click the "make a payment" button and all of the calculations are taken care of for him. So if Big Money, for example, has deposited 10 Link tokens into the contract, the value, in ethereum, of those tokens is recorded at the time of deposit. And say it is configured that 5 payments will be made, with a 10% premium and a 5% security deposit. When Wagie clicks the "make a payment" button, he is sending 1/5 the amount of ethereum based on the time of deposit (plus a 10% premium) directly to Big Money, the 5% security deposit gets sent to the contract to be held. Once Wagie has made his final (i.e. fifth) payment, the 10 Link tokens are sent to Wagie, and his security deposit gets returned to him in full, and Big Money has made his initial investment back, plus a 10% return (i.e. the premium rate).

Big Money can also interact with the agreement from the FinancierInteraction component. Here, Big Money can see all of the information related to the financial agreement in question including whether or not it is delinquent (i.e. the payment is past due). If the payment IS delinquent, Big Money can execute the Terminate Agreement function, at which point, the Chainlink Tokens will be returned to him, plus he will receive whatever amount of security has been deposited to the contract (if a security deposit was configured).

How we built it

I built this using a simple React front end (I'm not really that great of a front end developer, but am working on it), and using a node.js backend to interact with the smart contract launched on Sepolia

Challenges we ran into

This really was just a learning process, and it is something I've really wanted to build and tinker around with for quite some time. I fortunately didn't run into many challenges with this one like I did with my other project that I'm submitting, Via Dappia.

Accomplishments that we're proud of

I'm honestly just really proud that I was able to get this working so cleanly since I was building it at the same time as my other project entirely in my free time, while working a full time job that I'm not really a huge fan of. I was fortunate enough to attend Consensus this year, and really want to get my foot in the door of the industry. I've applied to several roles at Chainlink Labs and have unfortunately been denied on the two interviews I've had, but I'm extremely passionate about this space and I have been for a long time, so I'm really trying to go above and beyond to submit two MVP projects that I worked on ENTIRELY on my own with no help from anyone else in my free time. It was a lot of long, late nights, lots of coffee, and lots of research to bring these projects to fruition, and I hope that that is what shows even though I know they aren't perfect projects (yet) and I have a lot of features I can add to enhance them.

What we learned

I learned a lot along the way with this project about little idiosyncrasies of Solidity. I initially built this project out to have two separate smart contracts that were interacting with each other and it was really just kind of inefficient as far as gas goes and everything, so then instead of having a bunch of separate SCs handling all of the payment logic, and other SCs mostly acting as Escrow contracts, I decided to use structs to handle all of it and it was really annoying at first constantly getting a sort of "stack too full" error in that I was trying to load functions with too many variables (but I really wanted to have a lot of information available to the users about these agreements), so I just had to get creative with trimming things up and making my functions pass fewer parameters and such.

What's next for Investment Installments

My friend Camronn is actually in discussion with a patent attorney about the unique patentability of this sort of financial agreement as it doesn’t appear to be something that has been implemented before. So we actually have the ball rolling toward that end to see what we are able to accomplish and we have a financial specialist looking into it and will be hearing back before the end of June. From a more technical perspective, I just want to add more and more different tokens that can be invested in and it would be really cool to plug in a payment API that accepts USD via CC or cash app or something. I also have the functionality built out in another iteration of the project such that after each payment is made, a proportionate amount of the invested asset gets sent to the paying party (i.e. Wagie). Finally, I’d like to implement a sort of multisig strategy by which both parties can agree to terminate the agreement early in an automatically-executing way. I think back to the inspiration for this project where if my brother would have let me borrow $100k in 2018 to buy Chainlink. At one point, that would have been worth upwards of $20M, so I’d like there to be a way for both parties to benefit from unique situations like this and cash out early.

Built With

Share this project:

Updates