transact to FpsCrowdsale.buyTokens errored: VM error: revert.
revert
The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information.
Code to reproduce
function buyTokens() public payable {
require(publicBuyActivated == true);
address payable transaction_sender = msg.sender;
uint256 weiAmount = msg.value;
_preValidatePurchase(transaction_sender, weiAmount);
// calculate token amount to be created
uint256 tokens = msg.value / _rate;
_processPurchase(transaction_sender, tokens);
emit TokensPurchased(transaction_sender, address(this), weiAmount, tokens);
if (firstBuyTime[transaction_sender] == 0) {
firstBuyTime[transaction_sender] = block.timestamp;
}
//dai.transferFrom(msg.sender, __wallet, msg.value);
__wallet.transfer(msg.value);
}
Environment
REMIX