// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./SellTixToken.sol"; contract SellTixRewardDistributor is Ownable{ SellTixToken public token; address public sellTixManager; constructor(address _sellTixManager) Ownable(msg.sender) { sellTixManager = _sellTixManager; } function getTokenBalance() public view returns (uint256) { return token.balanceOf(address(this)); } function setTokenAddress(address _token) external onlyOwner { token = SellTixToken(_token); } // Function that will be called when the event occurs function retribute(address recipient, uint256 amount) external { require(msg.sender == sellTixManager, "Only SellTix manager can do that"); require(recipient != address(0), "Invalid recipient"); // We need to check there is enough balance in the contract require(amount > 0, "Amount must be greater than 0"); require(token.balanceOf(address(this)) >= amount, "Insufficient balance"); token.transfer(recipient, amount); } }