it's easy to add these conditions
- don't exceed maxTotalSupply
- make a method buy() which will transferFrom(msg.sender, token, amount) and mint-send ITR or revert if exceeding maxTotalSupply
function buy(amount) {
if (buyPrice == 0) {
revert BuyNotAvailable();
}
if (buyToken == address(0)) {
_mint(msg.sender, msg.value / buyPrice); // ignore amount
} else {
IERC20(buyToken).transferFrom(msg.sender, amount);
_mint(msg.sender, amount / buyPrice);
}
};
function _mint() {
if (maxTotalSupply > 0 && totalSupply > maxTotalSupply) {
revert MaxTotalSupplyExceeded();
}
}
it's easy to add these conditions