Invoking super._mint
function from Mocha javascript test case is reverted and I suspect _ownedTokensCount[to].increment();
in ERC721contract from "../../drafts/Counters.sol";
library might have some negative influence on it due to the linkage problem at deployment which is mentioned here:
I’ve already checked from Truffle debug that msg.sender and tokenId are properly allocated inside contracts and also super._mint
function properly works from the CLI.
A contract
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
contract ABNMarket is Initializable, ERC721Full {
constructor() public ERC721Full(){
// here goes the constructor
}
string public tokenName;
uint256 internal nextTokenId = 1;
function mint() public returns (){
uint256 tokenId = nextTokenId;
super._mint(msg.sender, tokenId);
}
function initialize(string memory _tokenName) public {
tokenName = _tokenName;
}
}
A javascript Mocha test code (Not all)
const ABNToken = Contracts.getFromLocal('ABNToken');
beforeEach(async function () {
this.project = await TestHelper();
proxy = await this.project.createProxy(ABNToken, { initMethod: "initialize", initArgs: ["CLR"] });
})
describe('Mint Function Test', () => {
it('Check mint function', async () => {
await proxy.methods.mint().send({from: sender});
})
})
My basic setting environment is as follows:
Truffle v5.0.30 (core: 5.0.30)
Solidity v0.5.0 (solc-js)
Node v11.14.0
Web3.js v^1.2.0
"@openzeppelin/cli": "^2.5.2",
"@openzeppelin/contracts-ethereum-package": "^2.2.1",
"@openzeppelin/upgrades": "^2.5.2",
Any suggestion or advise is helpful and appreciated.