Open Action | Blackjack
How to use the Blackjack open action for Lens Protocol
Last updated
How to use the Blackjack open action for Lens Protocol
Last updated
The Blackjack open action lets you create a post that functions as a blackjack table. As the post creator you take the role of the dealer and when other people act on the post they play against you. Since the dealer's choices are rigidly defined in the rules its entirely automated and you don't have to do anything beyond create the post with some $BONSAI tokens (to be paid out if you lose a hand).
First you create a post with the open action attached on https://app.bonsai.meme/blackjack. You specify the amount of $BONSAI tokens to start the pool off with and the bet size - the number of tokens that will be at stake for each game
When someone comes to your post to play they will first have to approve the contract to spend their tokens. This is beause they will have to deposit their bet in the contract in order to start the game.
Next you'll be able to start playing by dealing the first cards
After that you can "Hit" to get a new card until you go over 21 and bust or "Stand" whenever you wish to stop.
Win or loss, you'll be able to see the final hand of yourself and the dealer. If you lose the tokens you deposited at the beginning are forfeit. If you win then when you send the transaction to close the game you'll also get back the bet you placed at the beginning plus your winnings from the table minus the protocol fee of 5%. For example in the above screenshots the bet size is 1 so your winnings would be 1.95 $BONSAI, including the 1 $BONSAI you deposit to start the game.
Randomness is provided by random.org and a signed message verifies the origin
5% protocol fee from each game goes to the contract owner
Games will expire 24 hours after being created if they aren't completed
The post creator (dealer) can withdraw their tokens + winnings from the table at any time however they need to pause the table first. This will prevent new games from being started and after 24 hours any outstanding games will have expired and they can claim their tokens. You can do this on the bonsai app (https://app.bonsai.meme/blackjack)
The post creator can add more tokens to a table if they want to allow more games. You can do this on the bonsai app (https://app.bonsai.meme/blackjack)
Smart contract is at: https://polygonscan.com/address/0x03782Fa409Df0Ec0262915878C3eEFD5292b2FC4