## Inspiration

This idea was something I saw from a documentary where farmers in South America play this sort of zero-sum or win-win lottery to be able to afford farming equipment. I say zero-sum or win-win because in the end there are no winners or losers.

## What it does

Saving Box uses Marlowe to create a fun alternative to savings. How it works is participants deposit a predetermined amount of ADA in a pool. A winner is selected and wins the pool of ADA. Repeat the last step, but the winner can not win again. Repeat until all participate win once. In the end, no one wins or loses more than the others. But it gives people that chance to win early which gives them the funds sooner than saving.

## How I built it

The contract begins with each of the players sequentially depositing a fixed amount of ADA into the contract, this was done using deposit actions written in series of When contracts. The players would have to make the deposit within 10 slots after the contract begins, if not the contract closes, and all the money is refunded accordingly. The state of each person's win is stored using the Let contract with suitable identifiers. For eg. "player-1" -> 0 if not won, and 1 if won. At the beginning of the contract, all the player's win state is initialized to 0. After the deposits have been made, there is a "savings period" of 80 slots during which all the deposits are locked up. On the 91 slot and onwards, each player depending on whether he/she has won has a chance to claim all the ADA locked up in the contract, this is facilitated by the user choice action. Depending on who was the first to make a choice (a number between 1 -> 5) within slot 100, wins the lottery!. This whole process is repeated with the exception that that player who claimed the previous lottery will now not be able to make a choice. This is facilitated by the If contract checking the state of the win state of each player. The slots will also be offset accordingly for the next round.

## Challenges I ran into

The challenges we ran into were mainly learning Marlowe and understanding the programming language.

## Accomplishments that I'm proud of

I am proud that our team was able to come together in a short period of time and put together a great proposal using a new programming language that neither of us was familiar with at the start. It really is an accomplishment to a great Cardano community. I met Arjun, one of our team members on the Chicago Cardano Meetup Group. I came to him with an idea and no longer than a day later he was on board and excited to help. I think that speaks volumes about the Cardano ecosystem with the willingness to develop on Cardano.

## What I learned

I learned from a macro prospect that Cardano truly has the best community. There are so many proposals for multiple challenges that are really exciting to see since Project Catalyst just launched. We also learned how to use Marlowe which is new to all of us. And just by doing research for the pitch deck learned about the economics of developing countries.

## What's next for Savings Box

It will be great to hear what the feedback is from the judges. But we would like to test the code in a real-world situation to make sure it works with adversaries. Then reach out to the target audience and test and see if they find value and have feedback. Then scale the number of participates that can join and expand the audience.

## Built With

Share this project:

## Basic Idea of the Marlowe contract

The contract begins with each of the players sequentially depositing a fixed amount of ADA into the contract, this was done using deposit actions written in series of When contracts. The players would have to make the deposit within 10 slots after the contract begins, if not the contract closes and the all the money is refunded accordingly. The state of each person's win is stored using the Let contract with suitable identifiers. For eg. "player-1" -> 0 if not won, and 1 if won. At the beginning of the contract all the player's win state is initialized to 0. After the deposits have been made, there is a "savings period" of 80 slots during which all the deposits are locked up. On the 91 slot and on wards, each player depending on whether he/she has won has a chance to claim all the ADA locked up in the contract, this is facilitated by the user choice action. Depending on who was the first to make a choice (a number between 1 -> 5) within slot 100, wins the lottery!. This whole process is repeated with the exception that that player who claimed the previous lottery will now not be able to make a choice. This is facilitated by the If contract checking the state of the win state of each player. The slots will also be offset accordingly for the next round.

Log in or sign up for Devpost to join the conversation.