0

I am thinking of building a capped crowd sale using CappedCrowdsale and MintableERC721 of OpenZeppelin. I wonder if its better to mint the tokens once the cap is reached or to mint seperately once a payment is received? I've started to build it by assuming to mint at the end of crowd sale but I am not certain about few things. I've come up with the following:

pragma solidity ^0.4.24;
import "./openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol"; 
import "./openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";
import "./openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";
import "./openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";

contract SSale is CappedCrowdsale, ERC721Full {

using SafeMath for uint256;
/*
??? using ERC721Mintable for ERC721Full; ???
uint256 private _rate;
address private _wallet;
*/
IERC721 private _token;

/* @param _rate for Crowdsale
   @param _wallet for Crowdsale
   @param _token for Crowdsale
   @param _cap for CappedCrowdsale
   @param name for ERC721Full
   @param symbol for ERC721Full
*/
constructor(uint256 _rate, address _wallet, IERC721 token,
uint _cap,
string name, string symbol) public
Crowdsale(_rate, _wallet, _token)
CappedCrowdsale(_cap)
ERC721Full(name, symbol){}
}

The current version gives a DeclarationError: Identifier not found or not unique at line 17:

IERC721Full private _token;

Cause CappedCrowdsale is inheriting Crowdsale contract which takes (uint256 rate, address wallet, IERC20 token) as parameters in addition to _cap of CappedCrowdsale. In my case I'd have to replace IERC20 with IERC721.

I am not sure if/how I should import ERC721Full and interface ERC721Mintable, cause ERC721Mintable takes no constructor parameters but inherits ERC721Full which takes two strings name, symbol respectively. I'd appreciate any hints, corrections and suggestions on importing the relevant libraries and building the constructor accordingly. Feel free to comment about my choice of library as well, let me know what you think of 0xcert, Modular-Networks.

4
  • Can it be that somewhere in CappedCrowdsale you defined another _token field? I can't see any _token field in ERC721-related OpenZeppelin 1.12.0 code, but you may want to check your version too. Can you show CappedCrowdsale?
    – Utgarda
    Commented Sep 12, 2018 at 19:22
  • Right, CappedCrowdsale doesnt have a _token field, Crowdsale does but it inherits Crowdsale so it has to be passed. Btw I am using the new release candidate they have released 5 days ago, tho no changes on CappedCrowdsale.
    – heildever
    Commented Sep 12, 2018 at 19:37
  • Where does IERC721 come from? Can that I be just a typo? OpenZeppelin's master branch doesn't have any interfaces named ISomething: github.com/OpenZeppelin/openzeppelin-solidity/tree/master/…
    – Utgarda
    Commented Sep 13, 2018 at 8:14
  • They've recently renamed interfaces github.com/OpenZeppelin/openzeppelin-solidity/pull/1252
    – heildever
    Commented Sep 13, 2018 at 16:45

1 Answer 1

0

Apparently, using Crowdsale.sol, CappedCrowdsale.sol for a potential mintable ERC721 crowdsale is not the best idea as they are written keeping ERC20's in mind. The PR #776 on OpenZeppelin's repo is designed to address this case, however the new commits of ERC721s brings the need to modify the code. I'll try to put some thing up and I'll edit this answer once I am done.

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.