Hey @Riki, hope you are well.
I think the problem in your contract comes from the Ownable
contract, you did not specify which is the owner
, therefore, there is no owner set and then when you call the createKittyGen0
function, it does revert, without an error message because you did not specify any on your require
Ownable:
// SPDX-License-Identifier: MIT
pragma solidity 0.5.12;
contract Ownable {
address owner;
modifier onlyOwner(){
require(owner == msg.sender);
_;
}
}
You need to add the constructor to sent the account of the deployer:
constructor() public {
owner = msg.sender;
}
Then your contract works fine, I made this little unit test to help me test your contract functionality properly:
const Kittycontract = artifacts.require("Kittycontract");
contract('Kittycontract', () => {
describe('Kittycontract Unit Test', () => {
// Global variable declarations
let contractInstance
//set contracts instances
before(async () => {
// Deploy to testnet
contractInstance = await Kittycontract.deployed()
})
it('CreateGen0 Kitties', async () =>{
await contractInstance.createKittyGen0(1212121212)
})
// it('should show info about tokenId 1', async () =>{
// const first_token = await contractInstance.getKitty("1");
// console.log("info about tokenId 1", first_token);
// })
});
});
Carlos Z