I was using the opensea CreatureFactory.sol contract (https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/CreatureFactory.sol) to test on Rinkeby.Opensea.
What the CreatureFactory.sol does is to interface with Opensea allowing users to buy an NFT which then mints the actual NFT on the Creature.sol contract that gets sent to the buyer. Specifically this function:
function mint(uint256 _optionId, address _toAddress) override public {
// Must be sent from the owner proxy or owner.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
assert(
address(proxyRegistry.proxies(owner())) == _msgSender() ||
owner() == _msgSender()
);
require(canMint(_optionId));
Creature openSeaCreature = Creature(nftAddress);
if (_optionId == SINGLE_CREATURE_OPTION) {
openSeaCreature.mintTo(_toAddress);
} else if (_optionId == MULTIPLE_CREATURE_OPTION) {
for (
uint256 i = 0;
i < NUM_CREATURES_IN_MULTIPLE_CREATURE_OPTION;
i++
) {
openSeaCreature.mintTo(_toAddress);
}
}
}
function canMint(uint256 _optionId) override public view returns (bool) {
if (_optionId >= NUM_OPTIONS) {
return false;
}
Creature openSeaCreature = Creature(nftAddress);
uint256 creatureSupply = openSeaCreature.totalSupply();
uint256 numItemsAllocated = 0;
if (_optionId == SINGLE_CREATURE_OPTION) {
numItemsAllocated = 1;
} else if (_optionId == MULTIPLE_CREATURE_OPTION) {
numItemsAllocated = NUM_CREATURES_IN_MULTIPLE_CREATURE_OPTION;
}
return creatureSupply < (CREATURE_SUPPLY - numItemsAllocated);
}
Everything works up to the point where I used another account to try buying an item, this error message appears:
Oops, the Ethereum network rejected this transaction :( The OpenSea devs have been alerted, but this problem is typically due an item being locked or untransferrable. The exact error was "execution reverted..."
i then tried using remix to directly mint from the factory contract, and this error appears:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted { "originalError": { "code": 3, "data": "0x4e487b710000000000000000000000000000000000000000000000000000000000000001", "message": "execution reverted" } }
Please let me know what this error code is trying to say. Thanks!