Skip to main content
9 votes

How to test cross-contract Ink! contracts

I'm posting a link to the discussion on GitHub: https://github.com/paritytech/ink/issues/1125. AFAIK there is currently only the the possibility to do this with the redspot tool mentioned in the issue....
cmichi's user avatar
  • 2,800
7 votes
Accepted

How to properly handle cross contract call errors

All the code I mention here is available in this repo. There are three types of errors that you need to may want to handle when doing cross-contract calls Contract Errors: defined by the smart ...
HCastano's user avatar
  • 1,071
4 votes

What type should an ink! contract use to store a `uint256` block number retrieved from a Solidity contract?

In ink! you can use self.env().block_number() or Self::env().block_number() in the constructor. If you want to use XVM (only available in Shibuya) and query an solidity contract, you can deploy a ...
P.Ossun's user avatar
  • 1,219
4 votes
Accepted

Usage of XVM in ink! smart contract

There is no way at the moment to do ink! cross-chain contract. Astar & Parity are actively working on this. In the meantime this is Astar roadmap regarding ink! XCM:
P.Ossun's user avatar
  • 1,219
4 votes
Accepted

Call a smart contract ink! as a argument of another smart contract

Yes this is possible. When instantiating a smart contract it gets an account id, just like a user has an account id. This means that transfering tokens to/from smart contracts works the same. ...
Daan van der Plas's user avatar
4 votes
Accepted

What should the end-user expect after a cross contract call failure

The call to dummy_function is going to overflow because n * u64::MAX > u64, meaning your contract will trap. Since you're using CallBuilder::invoke(), which panics upon any encountering any error, ...
HCastano's user avatar
  • 1,071
3 votes

How to implement cross contract calls correctly?

I could not get the openbrush apporach get to work by using a wrapper. However I found a low level approach (here) which works just fine for now. let method_selector = [0xDE, 0xAD, 0xBE, 0xEF]; ...
rajohs's user avatar
  • 491
3 votes
Accepted

How does cross contract calling with openbrush work exactly?

During work on your project, you may have two kinds of cross-contract interactions: When one contract instantiates another contract. When one contract calls the method of another already instantiated ...
Green Baneling's user avatar
3 votes
Accepted

What is the best way to make a cross contract call on Ink!

Point one is deprecated, and you can use only the second right now. In the future ink! will support dyn Trait notation. So you will be enough to have a trait to do cross-contract calls. Right now ...
Green Baneling's user avatar
2 votes

How to get the ContractRef from AccountId or codehash with Ink!

From the snippet you gave, it looks like you want to call a contract, not create it. You can't convert CodeHash into a ContractRef b/c they're different things. CodeHash represents the code of the ...
deuszx's user avatar
  • 96
2 votes

Cross contract calls - Difference between {Contract}Ref and build_call().delegate()

You don't need the contract interface reference object in advance for using buil_call. You just pass the contract address with function selector and its parameter in low-level call format.
Nimish Agrawal's user avatar
2 votes
Accepted

Cross-contract instantiation failed with TransferFailed

The following changes to the endowment parameter value fixed the problem. it would be good to know what endowment is and why it made my build fail. endowment documentation is really not clear. ....
Snowmead's user avatar
  • 625
2 votes
Accepted

How do I call a diamond facet ink message with PolkadotJS?

There is an issue with delegate call (described in OpenBrush repo): https://github.com/Brushfam/openbrush-contracts/issues/36
P.Ossun's user avatar
  • 1,219
1 vote

Issues with Cross Contracts calls

I simply fixed this problem by removing the crate-type = [] For some reason, new versions of ink! must not be provisioned with crate-types as cdylib, rlib, or both as the case may be. It now works ...
Edinyanga Ottoho's user avatar
1 vote

Deriving Contract Reference from `ink::trait_definition`

There is a macro that based on ink trait creates an associated type for safe cross-contract calls: https://paritytech.github.io/ink/ink/macro.contract_ref.html
hansu's user avatar
  • 108
1 vote

Why is this cross-contract call misbehaving?

You need to call approve before transfer_from. Most likely ERC20 contract returned an error. You need to handle errors from the cross contract call. See more about error handling here and here
Bobo K.'s user avatar
  • 386
1 vote

How to use the Builders Approach in the basic-contract-caller example without using the Contract References approach?

I do not think resolving the error ContractTrapped needs Contracts Ref to be fully removed when using the Builders Approach. I tried using try_invoke() instead of invoke() here as suggested in the ink!...
Luke Schoen's user avatar
  • 2,346
1 vote

How to get the ContractRef from AccountId or codehash with Ink!

You cannot obtain ContractRef from code-hash or AccountId but you may determine whether a given function (function selector; to be precise) exists at a given address to some extend by using try_invoke ...
Nimish Agrawal's user avatar
1 vote

ContractTrapped, transfer_from CalleeTrapped

CalleeTrapped means that the contract you are calling (the PSP22 contract in this case) trapped. Trapped just means its aborted its execution and rolled back all changes. A panic/assert in Rust will ...
Alexander Theißen's user avatar
1 vote

Accessing values in cross-crontact calling

The reason why you are getting a different value is because the accumulator contract is instantiated twice. First, when you uploaded and instantiated the accumulator contract. Second, when you ...
Daan van der Plas's user avatar
1 vote

Cross-Contract execution in Ink contracts

Instead of cross contract calling, what you are doing here is Reentrancy guard which is the process to prevent specific type of attack (i.e reentrancy attack where attacker can repeatedly call ...
go11li's user avatar
  • 1,241
1 vote
Accepted

ink! cross-contract calling tutorial does not compile

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 ...
go11li's user avatar
  • 1,241
1 vote
Accepted

How can we make a cross contract call to a payable message from parent contract?

Thank you all for help. The issue was being caused by contract trying to make a balance transfer less than existential deposit.
lordofdalords's user avatar
1 vote

How to emit events from inner contracts

Each contract can emit events. If you don't see the events in ABI, that doesn't mean that events are not emitted. It means that you don't know right now how to decode those events. Currently, only ...
Green Baneling's user avatar
1 vote

How to test cross-contract Ink! contracts

Have a look in this link , Phala-Network is working on test cross-contract Ink! contracts and they have implemented cross-contract test in ink/examples/delegator/adder/ example
go11li's user avatar
  • 1,241

Only top scored, non community-wiki answers of a minimum length are eligible