docs
Searchโ€ฆ
๐ŸŽฒ
Dice Game Contract
โ€‹
The Dice Game Contract contains the logic of the double dice game with the betting and distribution of the rewards to the players, the interaction with the reserve contract to handle the funds, and checking up the randomness from the terrand smart contract. This contract also handles the taxes on player wins and the casino advantage.
This contract is managed by the governance contract. Many of its execute messages are only allowed to be called from the governance contract
Key
Type
Description
gov_contract_address
CanonicalAddr
Address of the gov contract to be able to change parameters through voting
reserve_address
CanonicalAddr
Address of the terra-vegas reserve contract
terrand_address
CanonicalAddr
Address of the terrand contract to pull the randomness from
max_cashflow
Decimal
maximum amount of UST to keep in the contract above which we send to the reserve contract
max_number_of_bets
Decimal
Maximum number of bets per player per round
win_tax
Decimal
tax to be applied on the players rewards after the round bets are settled
native_denom
String
the native coin to use for the bets
round_duration
vec
duration of the round in seconds

InstantiateMsg

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InstantiateMsg {
3
pub native_denom: String,
4
pub advantage_value: String,
5
pub win_tax: String,
6
pub max_number_of_bets: u64,
7
pub max_betting_ratio: u64,
8
pub round_duration: u64,
9
pub max_cashflow: Uint128,
10
pub terrand_address: String,
11
pub reserve_address: String,
12
pub gov_contract_address: String,
13
}
Copied!
Key
Type
Description
gov_contract_address
CanonicalAddr
Address of the gov contract to be able to change parameters through voting
reserve_address
CanonicalAddr
Address of the terra-vegas reserve contract
terrand_address
CanonicalAddr
Address of the terrand contract to pull the randomness from
max_cashflow
Decimal
maximum amount of UST to keep in the contract above which we send to the reserve contract
max_number_of_bets
Decimal
Maximum number of bets per player per round
win_tax
Decimal
tax to be applied on the players rewards after the round bets are settled
native_denom
String
the native coin to use for the bets
round_duration
vec
duration of the round in seconds

ExecuteMsg

ChangeAdvantageValue

Changes the advantage ratio of the casino against the player

ChangeMaxCashflow

chenages the maximum amount of UST to keep in the contract above which we send to the reserve contract

Bet

To be called by a player to bet on a Live round. or to start a new round if some conditions are met.

ReceiveRewards

To be called by a player to claim their accumulated rewards from the previous round(s) if they have any

DrainGame

Sends all the contract balance to the reserve contract

StopGame

Halts the game so no player can bet anymore

QueryMsg

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
WinConfficients {},
5
PlayerRewards {
6
addr: String,
7
},
8
CurrentRound {},
9
Bets {
10
addr: String,
11
round: u64,
12
},
13
OutcomeHistory {},
14
GetConfig {},
15
GetBettingLimit{},
Copied!

WinConfficients

Returns the winning multiplier per dice roll bet. it is a vector that depends on the distribution of probability of the double dice and the casino advantage.

PlayerRewards

Returns the wins of the player who calls this function.

CurrentRound

Returns the current dice game round.

OutcomeHistory

Returns the outcome history of the dice. based on what terrand has generated.

Bets

Returns all the bets of a specific wallet for a specific dice round.

GetConfig

returns the dice game contract config

GetBettingLimit

Returns the maximum betting amount per round. This value is calculated every round based on how much money the reserve holds. This parameter is there to prevent players from betting higher than what the casino holds. The ratio is calculated based on some simulations the terra-vegas team has conducted.
โ€‹