Good morning.
In order to create a sort of renting service I need to a mirrored version of an ERC721 contract.
The mirrored version is the token that will be transferred to the borrower wallet after the accepting the loaning agreement.
Since is fundamental to have the mirrored ERC721 into the original smart contract (mirrored version) I was wondering is it is possible to mint the tokens into the contract itself and then transfer them at a later stage.
Step by step target example:
1.Deploy MirroredContract
2. Mint full tokens supply into the MirroredContract
3. Transfer a token from the MirroredContract to an external wallet
My question is: is possible to do the operation at the point 3 with an ERC721 contract?
Not sure what you mean with mirrored contract. However your contract can mint an erc721 for itself and your contract can transfer erc721’s to another contract if you implement that functionality. So to answer the question, yes that is possible.
Doesn’t really matter, functionally for this situation there is no difference between a contract and a wallet. You can see a wallet just as a smart contract without any logic
Thank you for the response!
I try to clarify the question.
I have the logic contract for handling the loaning and the ERC721 that represents the avatars to loan.
I need to call from within the loaning contract a function that transfer a token that is currently into the ERC721 to another wallet.
The relevant code should be about 3 lines (and the error - probably just 1 line).
There shouldn't be any proprietary non-generic information to disclose here, but suit yourself...
I don't think that you can act as a smart contract to approve another...
At least I've never heard about something like this.
In this case I would need the ERC721 itself to approve the logic contract, but since the approval (and setApprovalForAll) function get the approver as the msg.sender I don't see it feasible at all.
In my experiences I've worked with ERC20 in this way and I confirm that this is possible.
On the other hand, talking about ERC721 I don't think that this is possible at all starting from the ERC721 implementation of Openzeppelin. Is something that needs a deep change, but is better to don't do it I think.
The original owner sends something to the logic contract. The logic contract mints a token, the logic contract sends the minted token to another address. As the logic contract is the owner of the minted token it is allowed to approve its own stuff if needed.
Even if the minted token is not created by the logic contract, whoever/whatever mints the token can also call the approve for the logic contract for that token.
I’m confused as tovert you think that’s not possible? Also this logic is used a lot in contracts with borrowlending platforms that use NFT’s
I've figured out a possible solution that involves to mint all the tokens to an external owned wallet that acts as a temporary pool with limitations in transferring the tokens.
Having full access to this wallet I can approve the logic contract to send the tokens reaching a nice tradeoff.
One of my requirements is that the owner of the original avatar cannot own at the same time the avatar and the mirrored version.
Moreover, I've a question. Who can call the setApproveForAll function? The owner of the token or the minter?
This for me is probably wrong, or at least I don't know how to call the approval acting as the logic contract.
Do you have any suggestions?
Thank you for your help by the way!