0

I'm using Crowdsale.sol from OpenZeppelin / zeppelin-solidity. Here's a snippet:

import '../token/MintableToken.sol';
import '../math/SafeMath.sol';

/**
 * @title Crowdsale 
 * @dev Crowdsale is a base contract for managing a token crowdsale.
 * Crowdsales have a start and end block, where investors can make
 * token purchases and the crowdsale will assign them tokens based
 * on a token per ETH rate. Funds collected are forwarded to a wallet 
 * as they arrive.
 */
contract Crowdsale {
  using SafeMath for uint256;

  // The token being sold
  MintableToken public token;

Is this inheriting from MintableToken?

MintableToken.sol inherits from StandardToken.sol and Ownable.sol. StandardToken.sol inherits from BasicToken.sol and ERC20.sol. BasicToken.sol inherits from ERC20Basic.sol and SafeMath.sol.

I want to use function balanceOf from BasicToken.sol and uint256 public totalSupply from ERC20Basic.sol, but these do not appear on remix.ethereum.org (using "JavaScript VM") after creating the Crowdsale contract .

If I change Crowdsale.sol to any of the following:

contract Crowdsale is StandardToken {

contract Crowdsale is MintableToken {

contract Crowdsale is BasicToken {

...balanceOf and totalSupply appear (after creating contract), but they only return 0. I send some funds to the contract and enter the sender's address into balanceOf and it returns 0. I click on totalSupply and it returns zero. They do not seem to be working.

What do I need to do to get these to work?

1 Answer 1

1

I think you are misunderstanding that class. From the looks of it Crowdsale.sol is a token factory. It will take payment to generate a MintableToken contract dynamically.

You would then need to access the newly minted Token to access the actual token functions.

1
  • How do I access these Token functions and variables (balanceOf, transfer, totalSupply) from: 1) remix 2) wallet ? In remix, do I need to create MintableToken contract as well as Crowdsale contract, so that I can access them through the MintableToken contract?
    – Curt
    Commented Aug 3, 2017 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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