Skip to main content
added 4 characters in body
Source Link
Arunjot Singh
  • 837
  • 2
  • 10
  • 34

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 contract being called as shown here it only compiles if I use .transferred_value(0) with a transfer value of 0.

But if I follow the ink! cross-contract documentation here and change the transfer value to a non-zero value as they use in their examples, it always results in TransferFailed error. Note: I also get the error when just using the Contracts Ref Approach without the Builders Approach.

Why can't I pass a non-zero value to transferred_value?

After instantiating a contract using 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 contract being called as shown here it only compiles if I use .transferred_value(0) with a transfer value of 0.

But if I follow the ink! cross-contract documentation here and change the transfer value to a non-zero value as they use in their examples, it always results in TransferFailed error. Note: I also get the error when just using the Contracts Ref Approach without the Builders Approach.

Why can't I pass a non-zero value to transferred_value?

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 contract being called as shown here it only compiles if I use .transferred_value(0) with a transfer value of 0.

But if I follow the ink! cross-contract documentation here and change the transfer value to a non-zero value as they use in their examples, it always results in TransferFailed error. Note: I also get the error when just using the Contracts Ref Approach without the Builders Approach.

Why can't I pass a non-zero value to transferred_value?

Source Link
Luke Schoen
  • 2.4k
  • 10
  • 26

Cross-contract call failed with TransferFailed

After instantiating a contract using 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 contract being called as shown here it only compiles if I use .transferred_value(0) with a transfer value of 0.

But if I follow the ink! cross-contract documentation here and change the transfer value to a non-zero value as they use in their examples, it always results in TransferFailed error. Note: I also get the error when just using the Contracts Ref Approach without the Builders Approach.

Why can't I pass a non-zero value to transferred_value?