1

I have a little problem here. I have the address of a contract (PSP22 token) with the {}Ref associated with it.

I want to make a cross-contract call to get the decimals of the contract.

Its Ref is use lp_token::LpTokenRef;

Wondering how I can call another contract using an already deployed address to get the metadata such as psp22Metadata::tokenSymbol() and so on.

1

2 Answers 2

1

You can find an example of using the *Ref pattern to call another contract, given its AccountId in this Bulletin Board example link from Aleph Zero network.

1

Ink has a great example in the repo's examples folder called the Delegator

Its 4 contracts that all work together. The delegator even instantiates the other contracts then calls them later. Looks pretty cool.

1
  • I understand. I do not see any as robust as PSP22 token metadata interaction. Do you have a direct example that shows how to get the metadata of a PSP22 token from another contract, say using psp22Metadata::tokenSymbol() or a similar approach? Dec 10, 2022 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.