I need to call mint()
function in MyNFToken.sol via MyContract.sol.
Ownable.sol
pragma solidity ^0.4.20;
contract Ownable {
address public owner;
function Ownable()
public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
MyNFToken.sol
pragma solidity ^0.4.20;
import "../tokens/NFTokenMetadata.sol";
import "../../node_modules/@0xcert/ethereum-utils/contracts/ownership/Ownable.sol";
contract MyNFToken is
NFTokenMetadata,
Ownable
{
function MyNFToken(
string _name,
string _symbol
)
public
{
nftName = _name;
nftSymbol = _symbol;
}
function mint(
address _owner,
uint256 _id
)
onlyOwner
external
{
super._mint(_owner, _id);
}
}
MyContract.sol
pragma solidity ^0.4.20;
import "../tokens/MyNFToken.sol";
contract MyContract{
address nftaddress;
function MyContract (address _nftaddress) public {
nftaddress = _nftaddress;
}
function createToken(address _owner,uint256 _tokenId) onlyOwner public payable returns(bool){
MyNFToken instance = MyNFToken(nftaddress);
instance.mint(_owner,_tokenId);
return true;
}
I'm able to execute mint()
directly from MYNFToken.sol by accurately checking the owner of contract(Ownable.sol). But not able call mint()
via MyContract.sol. Is there something missing or beyond my understanding?..Please help to resolve this issue.