1

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 
    { 

    }
}

bumped to the homepage by Community 22 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • 1
    Would you be able to provide the Kovan transaction hash? – Thomas Apr 22 at 20:38
0

You interact with non-contract address. The address doesn't contain any code. Make sure that the address of the contract you interacting with is correct.

0

If you look at the transaction history for the contract address 0x565ab5a3ff164e069cd1ed101b5d754104f89e69. The transfer was sent on Apr-22-2019 07:58:28 PM +UTC before the contract deployment on Apr-23-2019 07:09:16 PM +UTC.

  • 0x2f5473270df1a9f4bf9f6f8934740518d292fe3003f79f9a4fb06618ad94b6a0: Transfer on Apr-22-2019 07:58:28 PM +UTC at block 10799903.
  • 0xbe311ecbadd7b28c3d722c69def2d52550af1b5f9e6ff5a8683e738742a0c9fb: Contract creation on Apr-23-2019 07:09:16 PM +UTC at block 10806682.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.