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.
CappedCrowdsale
you defined another_token
field? I can't see any_token
field in ERC721-related OpenZeppelin1.12.0
code, but you may want to check your version too. Can you showCappedCrowdsale
?CappedCrowdsale
doesnt have a_token
field,Crowdsale
does but it inheritsCrowdsale
so it has to be passed. Btw I am using the new release candidate they have released 5 days ago, tho no changes onCappedCrowdsale
.IERC721
come from? Can thatI
be just a typo? OpenZeppelin's master branch doesn't have any interfaces namedISomething
: github.com/OpenZeppelin/openzeppelin-solidity/tree/master/…