safeTransferFrom isn't virtual.
zendevil opened this issue · comments
I want to change the functionality of safeTransferFrom
to run some code that changes the NFT's on-chain stored data. But both the safeTransferFrom
s aren't virtual and making them virtual in order to override the function in an inherited contract breaks the minting functionality on OpenSea website. Changing the function body itself and deploying ERC721SeaDrop also breaks the minting functionality.
making it virtual shouldn't break the minting functionality on OpenSea if you don't interfere with the original functionality of safeTransferFrom, can you give an example of what you are trying to do?
I changed
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
to
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override virtual onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
and the Minting now page doesn't show.
My goal is to make this work with Opensea's minting functionality whether on ERC721SeaDrop or in an inherited contract:
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
_runGameOfLife(tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId, data);
_runGameOfLife(tokenId);
}
function _runGameOfLife(uint256 tokenId){
for(uint16 i=0;i<3;i++){
uint16[a*a] memory C;
for(uint16 k=a+1;k<(a-1)*a-1;k++)
if(k%a>0 && k%a<a-1){
uint16 s=I[tokenId][N_*i+k-a-1]+
I[tokenId][N_*i+k-a]+
I[tokenId][N_*i+k-a+1]+
I[tokenId][N_*i+k-1]+
I[tokenId][N_*i+k+1]+
I[tokenId][N_*i+k+a-1]+
I[tokenId][N_*i+k+a]+
I[tokenId][N_*i+k+a+1];
if(I[tokenId][N_*i+k]==1){if(s==2||s==3)C[k]=1;}else if(s==3)C[k]=1;}
for(uint16 p=0;p<N_;p++)I[tokenId][N_*i+p]=C[p];}
}
that should be fine. after you deploy the token, you should see it appear on opensea.io/studio and you can click View drop page
then Edit drop
. "Minting now" won't show on the collection page unless the drop is actively minting after configuration
unless you share the actual verified contracts and addresses it's difficult for me to help you further