Giter Site home page Giter Site logo

memebet-backend's Introduction

MemeBet

MemeBet is a decentralized application (DApp) built on the Cartesi platform, enabling users to create and participate in meme-based betting games. With MemeBet, you can create betting pools around popular memes, place bets using cryptocurrencies, and earn rewards based on the outcome of the bets.

Features

  • Create Meme Betting Games: DAO members can create new betting games by submitting a game and defining the betting options (e.g., "Doge" vs "Pepe", Corinthians Vs Palmeiras; Real Madrid vs Barcelona; etc.).

  • Place Bets: Participants can place bets on their preferred option using various cryptocurrencies, such as Ether (ETH) or ERC-20 tokens.

  • Decentralized Governance: MemeBet is governed by a decentralized autonomous organization (DAO), ensuring fair and transparent decision-making processes.

  • Validator Functions: Custom validator functions can be created and deployed to determine the winning meme option based on predefined criteria.

  • Secure Payouts: Winning bets are automatically paid out to the respective participants, leveraging the security and transparency of the Cartesi blockchain.

How to build and run the application

Endpoints

MemeBet exposes the following endpoints for interacting with the application:

Advance Handlers

  • createGame: DAO users can create a new meme betting game with the specified options (home and away picks), token for betting, start and end times, and the validator function to determine the winner.

  • closeGame: Closes an existing game with the specified gameId.

  • placeBet: Users can place a bet on the specified pick (option) for the game with gameId, using the provided token and amount.

Inspect Handlers

  • wallet/ether/:sender: Returns the Ether balance of the specified sender address.
  • wallet/erc20/:token/:sender: Returns the ERC-20 token balance of the specified token for the sender address.
  • games/:gameId: Returns information about the game with the specified gameId, including picks, start and end times, fees, player IDs, and current odds.
  • governance/members: Returns a list of all DAO members.

Governance Handlers

  • addMember: Adds a new member to the DAO with the specified address.
  • removeMember: Removes a member from the DAO with the specified address.

Getting Started

To get started with MemeBet, you need the Development environment for Cartesi Installed. Specially Cartesi CLI and Nonodo (For testing).

  • Fork this repository

  • Install the required dependencies by running the yarn command in the dApp folder:

cd dapp
yarn
  • Running with Cartesi CLI (inside the dapp folder):
cartesi build

And then

cartesi run

If everything is correctly installed, you shall have the application running in the terminal like this:

prompt-1     | Anvil running at http://localhost:8545
prompt-1     | GraphQL running at http://localhost:8080/graphql
prompt-1     | Inspect running at http://localhost:8080/inspect/
prompt-1     | Explorer running at http://localhost:8080/explorer/
prompt-1     | Press Ctrl+C to stop the node

With that, the node is up and ready to receive transactions. In the dApp Readme, you can find more details about the use cases currently working.

Contributing

We welcome contributions from the community! If you'd like to contribute to MemeBet, please follow these steps:

  • Fork the repository.
  • Create a new branch for your feature or bug fix.
  • Make your changes and commit them with descriptive commit messages.
  • Push your changes to your forked repository.
  • Submit a pull request to the main repository.
  • Please ensure that your code adheres to the project's coding standards and includes appropriate tests.

License

MemeBet is released under the MIT License.

Acknowledgments

MemeBet is built on top of the Cartesi platform and utilizes various open-source libraries and tools. We would like to express our gratitude to the developers and contributors of these projects.

memebet-backend's People

Contributors

souzavinny avatar gbarros avatar marcusmugen avatar jjhbk avatar maseh87 avatar osmanrodrigues avatar

Stargazers

 avatar Fabio Issamu Oshiro avatar

Watchers

 avatar

Forkers

osmanrodrigues

memebet-backend's Issues

Insufficient balance error

What happen?

Given a place a bet request from an account with insufficient balance
When the input transaction is sent
Then it resolves successfully in the browser wallet API (transaction status confirmed) but fails in dapp backend without error response

What SHOULD happen?

The dapp backend return some error response and the browser wallet API receive a fail transaction status

Logs

validator-1  | [INFO  rollup_http_server::http_service] Received new request of type ADVANCE
validator-1  | [INFO  actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 465 "-" "undici" 0.001088
validator-1  | Error: insufficient balance of user 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
validator-1  |     at WalletAppImpl.transferEther (/opt/cartesi/dapp/index.js:30386:17)
validator-1  |     at BetPool.addBet (/opt/cartesi/dapp/index.js:47899:19)
validator-1  |     at Game.makeBet (/opt/cartesi/dapp/index.js:48019:18)
validator-1  |     at placeBet (/opt/cartesi/dapp/index.js:47759:10)
validator-1  |     at /opt/cartesi/dapp/index.js:47860:14
validator-1  |     at HttpApp.handleAdvance (/opt/cartesi/dapp/index.js:523:34)
validator-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
validator-1  |     at async HttpApp.start (/opt/cartesi/dapp/index.js:562:26)

Records

Screencast.from.06-06-2024.23.50.54.webm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.