Questions tagged [cross-contract-call]
The cross-contract-call tag has no usage guidance.
30
questions
1
vote
1
answer
27
views
Issues with Cross Contracts calls
I am trying to compile my Rust (ink!) source code for an AMM DEX on Substrate (Aleph Zero), but this is the error I am receiving from the logs:
The following are the files:
[azero_trading_pair/cargo....
1
vote
0
answers
14
views
"ContractTrapped" Error even with successful cross-contract call
let result_call = ink::env::call::build_call::<Environment>()
.call(self.escrow_address)
.gas_limit(0)
.transferred_value(0)
...
1
vote
0
answers
40
views
What could be the reason for my contract throwing "ContractTrapped"? Other cross contract calls are successful, but not in this code
The force_vote function in voting contract places a call to a different contract easily, but when I want to get some data from the other contract as well, it fails. Similarly in the function where the ...
1
vote
1
answer
26
views
I'm trying to access another contract's struct X in my contract. It is throwing error: panicked at 'Cross-contract call failed with Decode(Error)'
#![cfg_attr(not(feature = "std"), no_std, no_main)]
#[ink::contract]
mod arm {
use ink::prelude::vec::Vec;
#[derive(scale::Decode, scale::Encode)]
#[cfg_attr(
feature = ...
0
votes
1
answer
34
views
Deriving Contract Reference from `ink::trait_definition`
Is it possible to create a Contract Reference to perform a Cross-Contract call from ink::trait_definition?
If it is, how can I do so?
If it is not, why it is not possible? It seems strange that we can ...
1
vote
1
answer
55
views
Why is this cross-contract call misbehaving?
#[ink(message)]
pub fn create_new_better_payment(
&mut self,
_value: Balance,
_arbiter_provider: AccountId,
_deadline: u64,
//...
2
votes
1
answer
55
views
What type should an ink! contract use to store a `uint256` block number retrieved from a Solidity contract?
In Solidity, if we get the block.number it returns type uint256 (alias uint), so I use type uint256 to store the block number in a Solidity contract.
However, in ink! the equivalent u256 is not ...
2
votes
1
answer
42
views
Usage of XVM in ink! smart contract
Since the early stages of Polkadot development, I've been intrigued by the promise of cross-chain smart contract communication. I've successfully built simple but a fully functioning decentralized ...
5
votes
0
answers
29
views
Cross-contract call failed with TransferFailed
After instantiating a contract using the CreateBuilder as shown here.
If I then try to call the contract using CallBuilder as shown here and use #[ink(message, payable)] in the callee message of the ...
3
votes
1
answer
29
views
How to use the Builders Approach in the basic-contract-caller example without using the Contract References approach?
This question is an extension of this previous question where this commit of this Pull Request I used a modified version of this ink! basic-contract-caller example where there is a BasicContractCaller ...
1
vote
0
answers
23
views
Why can't I still directly call method in sub-contract of basic-contract-caller example after removing method that allows calling from main contract?
In this commit of this Pull Request I'm using a modified version of this ink! basic-contract-caller example where there is a BasicContractCaller main contract and a OtherContract sub-contract.
To run ...
4
votes
0
answers
71
views
Upload and Deploy code in Rococo Contract (Testnet) and Shibuya Testnet not working?
I am experimenting with cross contract with a combination of psp22 and psp37 in my project. But there is a problem when uploading json file and wasm file and deploying. It just shows the "...
4
votes
1
answer
56
views
How do I call a diamond facet ink message with PolkadotJS?
_fallback method panics with the following error when attempting to execute a delegate call to the diamond facet contract:
2023-05-20 16:16:58.992 DEBUG tokio-runtime-worker runtime::contracts: ...
2
votes
2
answers
76
views
How to get the ContractRef from AccountId or codehash with Ink!
From the ink! cross-contract docs, contract references give developers a type-safe way of interacting with a contract. However, this is not only available when the contract is already instantiated.
My ...
4
votes
1
answer
72
views
Cross contract calls - Difference between {Contract}Ref and build_call().delegate()
What is the difference in these two approaches for cross contract calls? One uses the {Contract}Ref and the other uses the build_call().delegate() method. Both methods do not require the contract to ...
2
votes
1
answer
67
views
Cross-contract instantiation failed with TransferFailed
I am getting an error attempting to deploy my delegator smart contract. Not sure how to debug this issue.
I use the deploy.sh to upload all smart contract code hashes and pass it afterwards to the ...
3
votes
1
answer
85
views
Call a smart contract ink! as a argument of another smart contract
I have a question about ink!. Is it possible from a smart contract A to manage the transfer of tokens of contract B IF contract B will be deployed later ?
I want a user to call a function of smart ...
2
votes
1
answer
50
views
What should the end-user expect after a cross contract call failure
I was attempting to comprehend the workings of cross-contract calling in substrate ink contracts using this particular sample code.
If I provide u64::MAX as the calls_count value, it will result in a ...
7
votes
1
answer
125
views
How to properly handle cross contract call errors
In the scenario where a cross-contract call from contract A to contract B fails, how can we manage the resulting errors? Specifically, if the call from A to B is unsuccessful, what are the options for ...
3
votes
1
answer
89
views
ContractTrapped, transfer_from CalleeTrapped
DispatchError: ContractTrapped
DispatchError docs: Contract trapped during execution.
Debug message:
panicked at 'encountered error while calling <AccountId as PSP22>::transfer_from: ...
1
vote
1
answer
53
views
Accessing values in cross-crontact calling
I have followed this tutorial to create a cross-contract calling in ink. There are two contracts in the example accumulator and delegator. The accumulator contract has two functions and the delegator ...
0
votes
1
answer
87
views
Cross-Contract execution in Ink contracts
#[ink(message)]
pub fn test_cross_contract_call(
&mut self,
calls_count: u64,
) {
let selector: Selector = Selector::new([0x6b, 0x25, 0xcb, 0x19]);
let ...
0
votes
1
answer
92
views
ink! cross-contract calling tutorial does not compile
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-...
0
votes
1
answer
75
views
How can we make a cross contract call to a payable message from parent contract?
Contract A has a Payable Method and contract B has ContractRef of A saved in storage. I can call other methods on Contract A but not sure how to call the payable method from Contract B.
Tried with ...
2
votes
1
answer
354
views
How to implement cross contract calls correctly?
I've been trying for a few days now to implement cross contract calls but somehow I can't seem to make it right. So here is my code and I hope one of you can point out my mistake to me.
I want to call ...
4
votes
1
answer
253
views
How does cross contract calling with openbrush work exactly?
The title of the question is a bit open ended, but I am trying to make cross contract calling work right now and realised, that there is a lot of open question on how it exactly works and how the ...
4
votes
1
answer
262
views
What is the best way to make a cross contract call on Ink!
I found 2 ways to make cross contract calls on ink!.
The first is in this link here where another contract is called directly,
The second is in this link here where a reference(ref) is being used.
I ...
3
votes
1
answer
93
views
How to emit events from inner contracts
let's say we have a contract which calls other contract's function that emits an event. What is the approach to emit the event coming from the inner contract's message?
Currently, there is only an ...
5
votes
2
answers
86
views
Why would a cross contract call be giving `NotCallable`?
I'm hitting an error when trying to do a cross contract call with two contracts running on substrate branch monthly-2022-03 and compiled with
"language": "ink! 3.0.0-rc8",
&...
13
votes
2
answers
360
views
How to test cross-contract Ink! contracts
In the latest master of Ink! examples there is only one main contract, delegator, for understanding cross-contract calls. Unfortunately, there are no tests either for this system.
https://github.com/...