Invocation failed: "Reentrant call" - Intercontract call failure in Sophia

Hello All,
I am trying to use the AEX-141 NFT standard for one of the projects that I am building.(here is the SC link from aeternity - aex141-examples/base_nft.aes at dev · aeternity/aex141-examples · GitHub).

My requirement is to interact with the deployed nft contract(whose address is passed in as a param) to my base contract and my base contract(a marketplace sortof) be controlling the nft’s ownership and other attributes.
But when I am making a intercontract contract call(my base contract to already deployed nft contract), I am getting an exception shown below.

Here is my base contract:

@compiler >= 6

include "String.aes"
include "Option.aes"
include "List.aes"
include "core/interfaces.aes"

payable contract SampleNFTInterContract =

    function tokensTransferable(_token : NFT, _tokenId : int) : bool =
        require(_token.is_approved_for_all(Call.caller, Contract.address) == true, "The HTLC contract must have been designated as an approved spender for the token")
        true
    
    public payable stateful entrypoint newContract(_tokenContract: NFT, _tokenId : int) : int = 
        tokensTransferable(_tokenContract, _tokenId)
      

What can be reason for this exception? How do I make the inter-contract call?

The error means that you have contract A that calls contract B and then contract B calls back into contract A - this is not allowed in Sophia/FATE.

1 Like

Hi @hanssv.chain ,
in my contract B(NFT Contract), I am not making any other inter-contract calls.
My contract A from where I am trying to invoke B is the only inter-contract call and I am sure of it.

Given the situation, what do you think would be causing this?

You asked what the error meant, and I explained that. I have not looked at your particular example and I have no insight there, sorry.

1 Like

Maybe @zkvonsnarkenstein.chain could help here as this is an AEX-141 contract?