Hello all,
I am just starting to get to grips with manifold and extensions.
For this I took one of the extensions from the manifold documentation (see below) and wanted to add it to a manifold core contract. Unfortunately I run into a problem:
After deploying the extension in remix, when initializing (the extension has an init function which I run with the core contract as the core address), remix tells me that the transaction has been undone (‘The transaction has been reverted to the initial state’).
I deployed on testnet, deployed contract 0xcD6a42782d230D7c13A74ddec5dD140e55499Df9 ,
also, I tryed to register the extension first (before initializing it core contract on testnet 0x4720383323E00651bB8c4555989cc9389C77abc1) - same behaviour when running the initialization function.
Does anybody has any idea what the problem is?
I should be glad about any idea …
thanks a lot,
Frank
Here’s what I di in short:
-create a core contract
-deployed the extension code thru remix - ok
-run the function to set the two tokenUri required - ok
-(tryed) to registr the deployed extensioncontract (error in manifold studio: transaction failed, please try again later)
-(tryed) unregister the extension and register it - unregistration transaction ok, registration failed
-(tryed) to initialize the deployed extension by running the initialization- function - failed
Here’s the extension code from manifold documentation:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import “@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol”;
import “@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol”;
import “@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol”;
import “@openzeppelin/contracts/utils/introspection/ERC165.sol”;
contract Tutorial is AdminControl, ICreatorExtensionTokenURI{
address private _core;
string private _firstURI;
string private _secondURI;
function initialize(address core) public adminRequired {
_core = core;
IERC721CreatorCore(_core).mintExtension(msg.sender);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, IERC165) returns (bool) {
return interfaceId == type(ICreatorExtensionTokenURI).interfaceId || AdminControl.supportsInterface(interfaceId) || super.supportsInterface(interfaceId);
}
function setURIs(string memory firstURI, string memory secondURI) public adminRequired {
_firstURI = firstURI;
_secondURI = secondURI;
}
function tokenURI(address core, uint256 tokenId) external view override returns (string memory) {
require(core == _core, "Invalid token");
if (block.timestamp % 2 == 0) {
return _firstURI;
} else {
return _secondURI;
}
}
}