Vault

Vault

Inherits: IVault, Ownable

Manages USDC deposits, withdrawals, and game rewards

All deposits and withdrawals happen through this contract

State Variables

ETH

Address of ETH, used for events

address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

mont

Address of the MONT token

IMONT public immutable mont;

usdc

Address of the USDC token

IERC20 public immutable usdc;

burner

Address of the Burner contract

gameFactory

Address of the GameFactory contract

montRewardManager

Address of the MontRewardManager contract

maximimBetRate

Maximum total bet amount in percentage. Default is 200, means 2%

minimumBetAmount

Minimum bet amount. Default is 1000000, means 1 USDC

Functions

constructor

Constructor to set initial values

Parameters

Name
Type
Description

_mont

IMONT

Address of the Dumont token contract

_usdc

IERC20

Address of the USDC token contract

_burner

IBurner

Address of the burner contract used to sell USDC and burn MONT tokens

_gameFactory

IGameFactory

Address of the GameFactory contract

_montRewardManager

IMontRewardManager

Address of the RewardManager contract

_minimumBetAmount

uint256

Minimum amount of USDC that a player can place as a bet

setBurner

Changes the address of the Burner contract

Emits BurnerChanged event

Parameters

Name
Type
Description

_burner

IBurner

The new address of the Burner contract

setGameFactory

Changes the address of the GameFactory contract

Emits GameFactoryChanged event

Parameters

Name
Type
Description

_gameFactory

IGameFactory

The new address of the GameFactory contract

setMontRewardManager

Changes the address of the MontRewardManager contract

Emits RewardManagerChanged event

Parameters

Name
Type
Description

_montRewardManager

IMontRewardManager

The address of the new MontRewardManager contract

deposit

Allows admins to deposit USDC into the contract

Emits Deposited event

Parameters

Name
Type
Description

_amount

uint256

The amount of USDC to deposit

withdraw

Allows the owner to withdraw a specified amount of tokens

Emits Withdrawn event

Parameters

Name
Type
Description

_token

address

The address of the ERC20 token to withdraw

_amount

uint256

The amount of tokens to withdraw

_recipient

address

The address to receive the withdrawn tokens

withdrawETH

Allows the owner to withdraw ETH from the contract

Emits Withdrawn event

Parameters

Name
Type
Description

_recipient

address

The address to receive the withdrawn ETH

transferPlayerRewards

Notifies the Vault contract that a player lost a bet and sends USDC if player is the winner

Emits PlayerRewardsTransferred event

Parameters

Name
Type
Description

_gameId

uint256

Id of the game

_betAmount

uint256

Amount of the bet in USDC

_totalAmount

uint256

Amount of the bet multiplied by the odds

_houseEdgeAmount

uint256

The house edge amount reducted from the total amount if the player wins

_isPlayerWinner

bool

Whether or not the player won or not

setMinimumBetAmount

Changes the minimum bet amount of USDC

Emits MinimumBetAmountChanged event

Parameters

Name
Type
Description

_minimumBetAmount

uint256

The new minimum bet amount

setMaximumBetRate

Changes the percentage of USDC in the Vault that can be sent as the reward

Emits MaximumBetRateChanged event

Parameters

Name
Type
Description

_maximumBetRate

uint256

The new maximim bet rate

getMaximumBetAmount

Returns the maximum bet amount a player can place

getMinimumBetAmount

Returns the minimum bet amount a player can place

receive

Last updated