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
IBurner public burner;
gameFactory
Address of the GameFactory contract
IGameFactory public gameFactory;
montRewardManager
Address of the MontRewardManager contract
IMontRewardManager public montRewardManager;
maximimBetRate
Maximum total bet amount in percentage. Default is 200, means 2%
uint256 public maximimBetRate;
minimumBetAmount
Minimum bet amount. Default is 1000000, means 1 USDC
uint256 public minimumBetAmount;
Functions
constructor
Constructor to set initial values
constructor(
IMONT _mont,
IERC20 _usdc,
IBurner _burner,
IGameFactory _gameFactory,
IMontRewardManager _montRewardManager,
uint256 _minimumBetAmount
) Ownable(msg.sender);
Parameters
_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
function setBurner(IBurner _burner) external onlyOwner;
Parameters
_burner
IBurner
The new address of the Burner contract
setGameFactory
Changes the address of the GameFactory contract
Emits GameFactoryChanged event
function setGameFactory(IGameFactory _gameFactory) external onlyOwner;
Parameters
_gameFactory
IGameFactory
The new address of the GameFactory contract
setMontRewardManager
Changes the address of the MontRewardManager contract
Emits RewardManagerChanged event
function setMontRewardManager(IMontRewardManager _montRewardManager) external onlyOwner;
Parameters
_montRewardManager
IMontRewardManager
The address of the new MontRewardManager contract
deposit
Allows admins to deposit USDC into the contract
Emits Deposited event
function deposit(uint256 _amount) external onlyOwner;
Parameters
_amount
uint256
The amount of USDC to deposit
withdraw
Allows the owner to withdraw a specified amount of tokens
Emits Withdrawn event
function withdraw(address _token, uint256 _amount, address _recipient) external onlyOwner;
Parameters
_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
function withdrawETH(address _recipient) external onlyOwner;
Parameters
_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
function transferPlayerRewards(
uint256 _gameId,
uint256 _betAmount,
uint256 _totalAmount,
uint256 _houseEdgeAmount,
bool _isPlayerWinner
) external;
Parameters
_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
function setMinimumBetAmount(uint256 _minimumBetAmount) external onlyOwner;
Parameters
_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
function setMaximumBetRate(uint256 _maximumBetRate) external onlyOwner;
Parameters
_maximumBetRate
uint256
The new maximim bet rate
getMaximumBetAmount
Returns the maximum bet amount a player can place
function getMaximumBetAmount() external view returns (uint256);
getMinimumBetAmount
Returns the minimum bet amount a player can place
function getMinimumBetAmount() external view returns (uint256);
receive
receive() external payable;
Last updated