I want to pass a contract address as parameter to a function in sophia.
but address only access account address and not contract addresses.
Somewhere in the community I read we can use the keyword contract literal inplace of address. But, it’s not working for me. I am getting an exception, Unexpected token 'contract'.
NOTE: I am testing the contracts on my local(macos) with aeternity javascript sdk version - 4.0.0.
From what I understand what you want to know is how de specify to some arbitrary contract to accept parameters of some other contracts.
For example, If you have a contract named MyContract and you have another contract that has an entrypoint expecting as parameter a MyContract address, you simply have to set the type of the parameter as MyContract.
Let’s say you have: entrypoint my_function(the_contract_address: MyContract) = ....
Do not forget to have MyContract definition included in the contract file that needs it include './MyContract.aes'
in the javascript side, you just have to call the function with the contract address