I created a simple smart contract using OpenZeppelin and deployed the contract to the Kovan testnet. However, when I send KEth to the contract using MetaMask, nothing happens (I believe the buyTokens function is not being called). Using EtherScan, the contract address balance is just incremented with the amount sent and new tokens are not being minted.
When I tested the same contract on a local network, everything worked as expected, i.e. I sent ETH to the contract and received tokens. Could you please help me figure out the issue?
The Kovan transaction hash is: 0x2f5473270df1a9f4bf9f6f8934740518d292fe3003f79f9a4fb06618ad94b6a0
Here is the contract:
pragma solidity 0.5.2;
import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
contract TestCrowdsale is Crowdsale, TimedCrowdsale, CappedCrowdsale, MintedCrowdsale {
constructor(
uint256 rate,
address payable wallet,
IERC20 token,
uint256 openingTime,
uint256 closingTime,
uint256 cap
)
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
CappedCrowdsale(cap)
public
{
}
}