Blackjack and Burn
Instructions
Approve AFFECTION™ with spender 0x1d51a6D59D6C1129492527977581705eE988BFA5
Deposit AFFECTION™ using playerDeposit()
Start a game by calling dealNewHand() with your bet amount
Hit or Stand, try to get 21 or as close as possible without going over
Aces will count when the player or dealer begins to bust
Features
True RNG using libAtropaMath v1.1
Total wins/losses/burns/incentives tracking
Burn contract wins + incentivize callers
Events emitted for every player action allows for easy implementation with Ethers.js
Demo
Contract Address
0x1d51a6D59D6C1129492527977581705eE988BFA5
Contract Code
[
{
"inputs": [
{
"internalType": "uint256",
"name": "_minBet",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_maxBet",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_incentivesPercent",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "DoubledDown",
"type": "error"
},
{
"inputs": [],
"name": "GameEnded",
"type": "error"
},
{
"inputs": [],
"name": "GameStarted",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientAllowance",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientBankReserveBalance",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientPlayerBalance",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientPlayerWalletBalance",
"type": "error"
},
{
"inputs": [],
"name": "InvalidBet",
"type": "error"
},
{
"inputs": [],
"name": "NoReentry",
"type": "error"
},
{
"inputs": [],
"name": "NothingToBurn",
"type": "error"
},
{
"inputs": [],
"name": "Standing",
"type": "error"
},
{
"inputs": [],
"name": "TooLate",
"type": "error"
},
{
"inputs": [],
"name": "Unauthorized",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Blackjack",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Burn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "DealNewHand",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "DoubleDown",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
}
],
"name": "Hit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Incentives",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Loss",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
}
],
"name": "Push",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
}
],
"name": "Stand",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Surrender",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Win",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Withdraw",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "bankWithdraw",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "bankWithdrawPLS",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_RNGContractAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "_minBet",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_maxBet",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_burnMode",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_burnIncentivePercent",
"type": "uint256"
}
],
"name": "config",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_betAmount",
"type": "uint256"
}
],
"name": "dealNewHand",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "doubleDown",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "hit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"name": "house",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "playerBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "playerDeposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "playerWithdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
}
],
"name": "setOwner",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "stand",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "surrender",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "viewGameState",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "result",
"type": "int256"
},
{
"internalType": "uint256",
"name": "round",
"type": "uint256"
},
{
"internalType": "string[2][]",
"name": "dealerCards",
"type": "string[2][]"
},
{
"internalType": "uint256",
"name": "dealerScore",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "playerBet",
"type": "uint256"
},
{
"internalType": "string[2][]",
"name": "playerCards",
"type": "string[2][]"
},
{
"internalType": "uint256",
"name": "playerScore",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "playerDoubleDown",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "playerStand",
"type": "uint256"
}
],
"internalType": "struct BlackjackAndBurn.gameState",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
Last updated