I'm new here and code with openzeppelin framework 2.2.0. There is no error occurred when compiling with solidity 0.5.8. But when I'm going to deploy the contract, I have no bytecode and cannot interact with contract "This contract does not implement all functions and thus cannot be created."

contract SampleCrowdsale is ERC20Detailed, Ownable, FinalizableCrowdsale, TokenTimelock {
    constructor () public ERC20Detailed("SampleCrowdsale", "SCRT", 15) {


    mapping (address => uint256) private balances;

    uint256 public totalSupply = 1000000000000000000000000; 
    uint256 public constant TOKENS_SALE_HARD_CAP = 650000000000000000000000;
    uint256 public constant BASE_RATE = 32500000;

    uint64 private constant dateHOTSale = 1517961600;
    uint64 private constant dateSaleA = 1557991800 - 7 hours;
    uint64 private constant dateSaleB = 1557993600 - 7 hours;
    uint64 private constant dateSaleC = 1557995400 - 7 hours;
    uint64 private constant dateSaleD = 1557999000 - 7 hours;
    uint64 private constant date17May2019 = 1557999180 - 7 hours;

    uint256[4] private roundCaps = [
    uint8[4] private roundDiscountPercentages = [50, 25, 12, 6];

    uint64 private constant dateTeamTokensLockedTill = 1557999360 - 7 hours;

    bool public _finalized = false;

    address public timelockContractAddress;

    modifier inProgress {
        require(totalSupply < TOKENS_SALE_HARD_CAP && !_finalized && now >= dateHOTSale);

    modifier beforeEnd {

    function sampleCrowdSale() public {

    modifier tradingOpen {

    function () external payable {

    function purchaseTokens(address _beneficiary) public payable inProgress {
        require(msg.value >= 0.05 ether);
        uint256 tokens = computeTokenAmount(msg.value);
        require(totalSupply.add(tokens) <= TOKENS_SALE_HARD_CAP);
        doIssueTokens(_beneficiary, tokens);

    function issueTokens(address _beneficiary, uint256 _tokens) public onlyOwner beforeEnd {
        doIssueTokens(_beneficiary, _tokens);

    function doIssueTokens(address _beneficiary, uint256 _tokens) internal {
        require(_beneficiary != address(0));

        totalSupply = totalSupply.add(_tokens);
        balances[_beneficiary] = balances[_beneficiary].add(_tokens);

        emit Transfer(address(0), _beneficiary, _tokens);

    function price() public view returns (uint256 tokens) {
        return computeTokenAmount(1 ether);

    function computeTokenAmount(uint256 ethAmount) internal view returns (uint256 tokens) {
        uint256 tokenBase = (ethAmount.mul(BASE_RATE)/10000000000000)*10000000000;//18 decimals to 15 decimals, set precision to 5 decimals
        uint8 roundNum = currentRoundIndex();
        tokens = tokenBase.mul(100)/(100 - (roundDiscountPercentages[roundNum]));
        while(tokens.add(totalSupply) > roundCaps[roundNum] && roundNum < 4){
           tokens = tokenBase.mul(100)/(100 - (roundDiscountPercentages[roundNum]));

    function currentRoundIndex() internal view returns (uint8 roundNum) {
        roundNum = currentRoundIndexByDate();

        while(roundNum < 4 && totalSupply > roundCaps[roundNum]) {

    function currentRoundIndexByDate() internal view returns (uint8 roundNum) {
        require(now <= date17May2019);
        if(now > dateSaleD) return 4;
        if(now > dateSaleC) return 3;
        if(now > dateSaleB) return 2;
        if(now > dateSaleA) return 1;
        else return 0;

    function finalize() public onlyOwner beforeEnd {
        uint256 lockedTokens = 230000000000000000000000;
        uint256 partnerTokens = 260000000000000000000000;


        totalSupply = totalSupply.add(lockedTokens+partnerTokens);

        _finalized = true;


    function issueLockedTokens(uint lockedTokens) internal {
        TokenTimelock lockedTeamTokens = new TokenTimelock(this, address(0), dateTeamTokensLockedTill);
        timelockContractAddress = address(lockedTeamTokens);
        balances[timelockContractAddress] = balances[timelockContractAddress].add(lockedTokens);
        emit Transfer(address(0), timelockContractAddress, lockedTokens);

    function issuePartnerTokens(uint partnerTokens) internal{
        balances[address(0)] = partnerTokens;
        emit Transfer(address(0), address(0), partnerTokens);

    function transferFrom(address _from, address _to, uint256 _value) public tradingOpen returns (bool) {
        return transferFrom(_from, _to, _value);

    function transfer(address _to, uint256 _value) public tradingOpen returns (bool) {
        return transfer(_to, _value);

2 Answers 2


If you deploying contract from Remix IDE you should select SampleCrowdsale in Run Tab.

Remix IDE

  • For the first, sorry if i replying or commenting your answer with a mess, please check my pictures out. May 17, 2019 at 22:04

The message means what it says.

This is not a good project to learn on considering the volume and complexity of the code you are working with. I hope this is only for practice and you are not contemplating enticing others to place their funds in the hands of code you don't fully understand.

It's a lot of code to explore so I will explain what you should look for.

When a contract inherits and undefined function from another contract, it is committed to providing a function implementation. A contract with undefined functions will compile but it cannot be deployed. This is because a contract with a function that doesn't know what to do wouldn't make sense on the chain.

Study this little example in Remix.

pragma solidity 0.5.1;

contract Interface {
    function something() public;
    function somethingElse() public;

// does not implement all functions
contract Undeployable is Interface {
    uint x;
    function something() public {
        // do something

contract Deployable is Undeployable {
    uint y;
    function somethingElse() public {
        // do something

The function contents are just stubs of no importance. The inheritance graph starts with a committment to implementation two undefined functions. One of those functions is defined in Undeployable and picked up by the next contract Deployable that implements the missing function and inherits something(). This fulfills the commitments that start by inheriting Interface. Deployable is Interface, in case that isn't clear.

So, you are looking for something, probably in the interface, that is not implemented. This is a safety system in any case. Your contract will not present an ERC20-compatible interface until all functions defined in the spec are implemented. This safety-stop is the purpose of structuring the code with an interface contract that describes the necessary functions. It can be a bit of time-consuming effort to spot the function that is missing, but that is what you need to pinpoint.

Hope it helps.

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.