MontRewardManager

MontRewardManager

Inherits: IMontRewardManager, Ownable

Manages the distribution of MONT rewards to players based on game outcomes

State Variables

mont

Address of the MONT token

IMONT public immutable mont;

usdc

Address of the USDC token

IERC20 public immutable usdc;

vault

Address of the Vault contract

address public immutable vault;

poolFee

Fee of the Uniswap V3 pool for MONT-USDC

uint24 public immutable poolFee;

uniswapPool

Address of the Uniswap V3 pool for MONT-USDC

address public immutable uniswapPool;

gameFactory

Address of the GameFactory contract

GameFactory public immutable gameFactory;

twapInterval

TWAP interval in seconds for getting the price from Uniswap Oracle

uint32 public twapInterval;

balances

Claimable balances of players in MONT token

mapping(address => uint256) public balances;

Functions

constructor

Constructor to initialize contract state variables

constructor(
    address _vault,
    IMONT _mont,
    IERC20 _usdc,
    GameFactory _gameFactory,
    address _uniswapFactory,
    uint24 _poolFee,
    uint32 _twapInterval
) Ownable(msg.sender);

Parameters

Name
Type
Description

_vault

address

Address of the Vault contract

_mont

IMONT

Address of the MONT token contract

_usdc

IERC20

Address of the USDC token contract

_gameFactory

GameFactory

Address of the GameFactory contract

_uniswapFactory

address

Address of the UniswapV3Factory

_poolFee

uint24

Uniswap pool fee tier

_twapInterval

uint32

TWAP interval in seconds

setTwapInterval

Changes the TWAP interval in seconds

Emits TwapIntervalChanged event

function setTwapInterval(uint32 _twapInterval) external onlyOwner;

Parameters

Name
Type
Description

_twapInterval

uint32

The new TWAP interval in seconds

claim

Claims MONT tokens of the caller (player)

Emits MontClaimed event

function claim() external returns (uint256 amount);

Returns

Name
Type
Description

amount

uint256

Amount of MONT tokens transferred to caller

transferPlayerRewards

Transfers MONT rewards to the player based on game outcome

Emits MontRewardAssigned event

function transferPlayerRewards(
    uint256 _betAmount,
    uint256 _totalAmount,
    uint256 _houseEdgeAmount,
    address _player,
    bool _isPlayerWinner
) external returns (uint256 reward);

Parameters

Name
Type
Description

_betAmount

uint256

Amount of the bet

_totalAmount

uint256

Total amount of the bet multiplied by the odds

_houseEdgeAmount

uint256

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

_player

address

Address of the player

_isPlayerWinner

bool

Flag indicating whether the player won the bet

Returns

Name
Type
Description

reward

uint256

Amount of MONT rewards transferred to the player

Last updated