0

Note: Having installed substrate-contracts-node and Contracts UI I can easily deploy and interact with an ink! Smart contract

I am following the ink! Tutorial here https://use.ink/basics/cross-contract-calling/

A> I cargo +nighlty create new both ink! smart contracts "other_contract" and "MyContract". After successful compilation of the "other_contract" when I try to compile "MyContract" it errors saying it cannot find the other_contract module

After doing all the above I also found this post What is the best way to make a cross contract call on Ink! which suggests this is deprecated. Is this correct or there is a way to fix this please?

I am only trying to achieve as per the tutorial example calling one ink! sc method from within another

B> Moved on to https://github.com/paritytech/ink/tree/master/examples/delegator

Trying to compile this using $ sh build-all.sh It errors ERROR: No 'ink_lang' dependency found

(similar to Delegator-based contract causes UI interface to crash )

I have tried replacing ink = { path = "../../crates/ink", default-features = false }

With

ink_primitives = { version = "3.3", default-features = false }
ink_metadata = { version = "3.3", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "3.3", default-features = false }
ink_storage = { version = "3.3", default-features = false }
ink_lang = { version = "3.3", default-features = false }
basically following the pattern ink! sc we get with the default contract cargo contract new flipper
But with no success

I would be grateful if anyone has a fix for either of the above solutions?

2
  • what version of rustc are you using? ink 3.3 had an issue where it did not compile with rustc later than 1.64, can you try using ink! 3.4 if you are using newer rustc?
    – kriko.eth
    Jan 10, 2023 at 0:57
  • All works well now ink! 3.3 rustc 1.65.0
    – Sokrates
    Jan 10, 2023 at 19:16

1 Answer 1

1

A: cannot find the other_contract module errors say that you haven't included other_contract model in Cargo.toml file. You can take a reference from this Cargo.toml file in line 19 & 40 for this specific issue and don't forgot to add "rlib" to the crate-type options under "cdylib" in your other_contract/Cargo.toml, "rlib" is used to generate ABI.

B: In order to compile ink! master branch code example, you must have installed cargo-contract v2.2.0-beta, then you can compile example code by using cargo contract build command.

5
  • Ganesh11 Many thanks for taking the time to respond A: I have followed the suggestions, triple checked everything but I still have an issue at compiling the MyContract. "endowment is not recognised" Here is my repo github.com/Entity54/ink--cross-contract-calling Reminder: I am following tutorial use.ink/basics/cross-contract-calling
    – Sokrates
    Jan 10, 2023 at 9:55
  • @Sokrates I have fixed your code but it didn't allow me to push updated code
    – Ganesh11
    Jan 10, 2023 at 11:11
  • @Sokrates anyway I uploaded the code in my account, you can get it from here
    – Ganesh11
    Jan 10, 2023 at 11:20
  • Many thanks Ganesh11 for your prompt assistance. Everything has now compiled and working as expected on a local substrate-contracts-node. If I may please ask one last thing please. Where can I learn more about the rust syntax OtherContractRef , i.e. what the Ref does instead of using OtherContract. Any good link please on this?
    – Sokrates
    Jan 10, 2023 at 19:13
  • 1
    have a look here and delegator smart contract, may be this could help
    – Ganesh11
    Jan 11, 2023 at 1:57

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.