How to get balance of unsold token in PostDeliveryCrowdsale

Hey , Is there any way to get the number token that are not bought. Here’s the token contract , I am providing initial supply.

contract MyToken is ERC20, ERC20Detailed, ERC20Burnable,Ownable {
    constructor(uint256 initialSupply,uint256 teamSupply) ERC20Detailed("My Token", "MTK", 18) public {
        _mint(msg.sender, initialSupply);
    }
}
1 Like

Welcome to the community @hardsuccess

The token contract you provided mints the initial supply of tokens to the deployer of the contract. The contract as is (without any other functions), means no more tokens can be minted, so the token has a fixed supply. The teamSupply parameter in the constructor is not used currently by your contract.

The OpenZeppelin token contracts don’t include any sale mechanism. For crowdsales, you could use the OpenZeppelin crowdsale contracts.

If you haven’t already, suggest you have a look at the OpenZeppelin documentation on tokens and crowdsales.

Please ask all the questions that you need.

1 Like

I do have Created Crowdsale contract , i just didn’t posted here.

What I meant was is there any function to get the detailed of how many tokens are being sold or are still remaining ?

1 Like

It really depends on your token and crowdsale, e.g. If you have a token with fixed supply and a crowdsale with default emission and the entire supply is transferred to the crowdsale, then the balance of tokens held by the crowdsale is how many are remaining.

1 Like

But what if my crowdsale is PostDeliveryCrowdsale and TimedCrowdsale.

1 Like

The balance of tokens held by the PostDeliveryCrowdsale is how many tokens are remaining to be sold.

This is because sold tokens are held in an internal vault until withdrawn after the closing time of the crowdsale.

2 Likes

Got it Now. Things are getting to come together.
Thanks :slight_smile:

2 Likes