Contract invocation contract problem

I have a problem, I now have a deployed AEX9 protocol token running
Now I want to create a new smart contract, how to write if I want to call the method in the previously deployed contract (AEX9)?

I think @hanssv.chain can help you.THX

Hi @Baixin.chain
Have you looked at remote contract calls? I believe this is what you’re looking for :slight_smile:

1 Like

Maybe this will help you

https://github.com/aeternity/tipping-contract/blob/feature/remove-owner/contracts/v2/Tipping_v2.aes#L23-L25
https://github.com/aeternity/tipping-contract/blob/feature/remove-owner/contracts/v2/Tipping_v2.aes#L143-L144

1 Like

TokenContract Where did it come from?

How does he know which AEX9 contract I’m calling?

as you can see from the code it is passed as an argument

2 Likes
// A contract type
contract TokenContract =
  entrypoint meta_info : () => unit
  
contract TokenTest =

 record state = {
        index : int, 
        map_hamsters : map(string, string), 
        testvalue: int}
        
 stateful entrypoint init() = 
        { index = 1,
            map_hamsters = {},
            testvalue = 42}


 entrypoint test(v : TokenContract)  = 
    v.meta_info()

 entrypoint test2(v : TokenContract)  = 
    v.address

I get the general idea, but I’m returning an error, am I calling it the wrong way

Type of remote function does not match expected type\

that doesn’t return unit according to the interface aeternity-fungible-token/contracts/fungible-token-interface.aes at master · mradkov/aeternity-fungible-token · GitHub

1 Like

Thank you for solving my problem

1 Like