Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contracts/src/AviatorGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ contract AviatorGame is Initializable, UUPSUpgradeable, ReentrancyGuard, Ownable
uint32 numPlayers
);

event HouseFunded(address indexed sender, uint256 amount);
event HouseWithdrawn(address indexed recipient, uint256 amount);


// ============ Errors ============
error InvalidBetAmount();
error InsufficientHouseBalance();
Expand Down Expand Up @@ -159,13 +163,15 @@ contract AviatorGame is Initializable, UUPSUpgradeable, ReentrancyGuard, Ownable
function fundHouse(uint256 amount) external onlyOwner {
bool success = usdcToken.transferFrom(msg.sender, address(this), amount);
if (!success) revert TransferFailed();
emit HouseFunded(msg.sender, amount);
}

function withdrawHouseProfits(uint256 amount) external onlyOwner {
if (amount > usdcToken.balanceOf(address(this))) revert InsufficientBalance();

bool success = usdcToken.transfer(owner(), amount);
if (!success) revert TransferFailed();
emit HouseWithdrawn(owner(), amount);
}

// ============ Snapshot Functions ============
Expand Down