Questions tagged [rust-ink]

ink! is a Rust eDSL for developing Wasm smart contracts on the Parity Substrate blockchain development framework

GitHub: https://github.com/paritytech/ink

Wiki: https://github.com/paritytech/ink/wiki

48 questions
1
vote
1 answer

How to deposit into an Ink! Smart Contract

I have a few ideas for smart contracts that I will be implementing using Ink! on Substrate. Most of these ideas involve callers making deposits into the smart contract which will be held indefinitely, and then the caller may be able to withdraw at…
Sasha Zimm
  • 73
  • 1
  • 5
1
vote
1 answer

Rust ink, cross contract call returns ConctractTrapped error

As the title suggests, I'm trying to call a function on already deployed contract with a very simple String return function. Deployed contract1 function: #[ink(message)] #[ink(selector = 0xDEADBEEF)] pub fn test(&self) -> String { return…
1
vote
1 answer

How can I query contract info with the latest polkadot-js and substrate contracts node?

I've been unable to query my existing contract recently due to Unable to create Enum via index 128, in Alive, Tombstone when using api.query.contracts.contractInfoOf. I get this error both on the command line and in the polkadot-js apps…
forgetso
  • 2,194
  • 14
  • 33
1
vote
0 answers

Making ink! Smart Contracts Revert

I'm tweaking with ink! Smart contracts and deployed some test contracts through https://polkadot.js.org/. However, despite setting conditional statements within smart contracts, calls to them still pass without reverting. Am I doing something wrong…
1
vote
2 answers

When using Flutter Container, everything ok but no ripple effect - but Ink draws beyond its parent

I want to provide a few buttons inside a singlechildscrollview Column( children: < Widget > [ SizedBox(height: constraints.maxHeight / 8.0), AnimationConfiguration.staggeredList( position: 1, duration: const…
Defarine
  • 681
  • 8
  • 19
1
vote
0 answers

struct mapping in ink substrate

In solidity we can do the mapping of structure like this struct BookEntry { string bookId; string bookName; string authorName; bool released; } mapping (string => BookEntry) keyval; and set the values…
Aditya Bharti
  • 61
  • 2
  • 5
1
vote
5 answers

When execute Delegator example, I get a "ContractTrapped" error

Build Delegator Contracts... Git clone "https://github.com/paritytech/ink.git". Move "examples/delegator". Build contracts by using "build-all.sh". Deploy & Execute Excecute Substrate-Node-Template with Contract Pallet. Visit Polkadot/Substrate…
s.Takahashi
  • 469
  • 4
  • 15
1
vote
1 answer

How do I access chain state data from a contract?

Ho do I access storages or constants in a substrate chain from !ink smart contract? For example, in the chain, the timestamp(in Moment) is set as an extrinsic. How do I access the timestamp and put the variable in the smart contract? let…
Afeez Aziz
  • 1,337
  • 2
  • 12
  • 26
1
vote
1 answer

Ink :: What is the right way to add the debug trace prints | ink_env::debug_println?

Ink :: What is the right way to add the debug trace prints | ink_env::debug_println ? Was trying ERC20 sample example from https://substrate.dev/substrate-contracts-workshop/#/2/transferring-tokens #[ink(message)] pub fn…
shamb0
  • 21
  • 3
1
vote
2 answers

On Substrate ink! How can I get Debug information?

I want to get Debug Information. I implemented this code,but I can not get. Please tell me how can I get Debug Infomation. #[ink(message)] fn set_test_data(&mut self, value: String) { ink_core::env::println(value); …
s.Takahashi
  • 469
  • 4
  • 15
1
vote
0 answers

Extrinsic failed when invoke HashMap/BTreeMap insert() in ink! contract via Polkadot JS api

I got an issue when invoke a contract call from Polkadot JS api. If the function include HashMap insert() or BTreeMap insert() in contract, when call it via api, I'll get: {"ApplyExtrinsic":1} [ An extrinsic…
Yun Chen
  • 11
  • 3
1
vote
1 answer

Can't deploy contract (Substrate) system.ExtrinsicFailed Other

I downloaded the smart contract from the Ink repository (erc20) build it, and build metadata. After which I downloaded it, and when I try to deploy, I get such an error: Logs from the browser console sendExtrinsic:: {"args":["10.000M…
STALER
  • 186
  • 2
  • 14
0
votes
0 answers

Error calling si.currentLoad(); inside setInterval

The behaviour is weird, i get as output: Número de Núcleos: 8 Núcleo1: 2.17% Núcleo2: 8.02% Núcleo3: 8.45% Núcleo4: 5.02% Núcleo5: 4.66% Núcleo6: 4.24% Núcleo7: 7.76% Núcleo8: 1.70% But when the setInterval calls it again: Número de Núcleos: 8…
0
votes
0 answers

Unable to upload smart contract in Polkadot.js - contracts.instantiateWithCode: ready the whole time

When I try to upload smart contract to Polkadot (local and testnet), this will popup after submitting contracts.instantiateWithCode: ready and it will be look like that the whole time and will not proceed following with this error: TypeError:…
0
votes
1 answer

How can I calculate a percentage of a number using Parity Ink?

So my problem is, that I am trying to calculate a percentage for a share, but ink! doesn't support floating points and I have no clue on how I can get a non-floating value that UI will denominate for me later. For an example, this code will not…