Skip to main content

Questions tagged [ink]

eDSL to write smart contracts in Rust for blockchains built on the Substrate framework

Filter by
Sorted by
Tagged with
0 votes
1 answer
10 views

How Can I Scale Token Distribution in an INK! Custody Smart Contract Using OpenBrush?

community! I am a beginner in INK! and I am developing a custody contract using OpenBrush. This contract receives token (X) as collateral for another token (Y) contract. At regular intervals, the ...
0 votes
1 answer
70 views

How to do cross contract e2e tests on ink?

I have made a contract in ink! that build fine, and I am trying to make e2e tests. I don't manage to do this even by using the examples in ink! repertory. My contract is a swap contract: it takes the ...
0 votes
1 answer
23 views

XVM Ink Wasm to EVM: Contract Reverted. Decoding Failed

I tried to deploy a XVM Wasm contract wrapping around a deployed EVM Solidity contract in my local node. Steps Deploy my EVM Solidity contract via Remix connecting to my local node //SPDX-License-...
0 votes
0 answers
14 views

How to get the ink! examples working

I have been banging my head in over the last couple of days trying to understand Rust and ink! I would really like to start writing smart contracts in the substrate ecosystem but I can't even get the ...
3 votes
3 answers
135 views

Unable to deploy INK 4.0 beta smart contract

I'm trying to deploy INK 4.0 smart contract with cargo-contract 2.0 beta to a network but I'm getting the following error contracts.CodeRejected. Whenever i try to upload the contract to my local ...
0 votes
1 answer
30 views

How can I properly use scale::Decode to get consistent results?

I'm trying to process a result from a contract call using what's here. It works totally fine when I'm trying to get a u32 result from an ink_e2e test. E.g. // -- Snip -- let number_of_items = client ...
3 votes
1 answer
76 views

Block_timestamp in contract's e2e_tests

Is it possible to get / set block_timestamp in contract's e2e-tests? Like ink::env::test::set_block_timestamp.
2 votes
2 answers
177 views

Failed to run custom build command for `contracts-node-runtime v0.17.0

I want to setup my local environment for ink! development and I follow the link, during execution of cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --tag ...
2 votes
1 answer
152 views

How can I decode this error message {"ok":{"flags":["Revert"],"data":"0x000110"}}?

I'm using polkadotjs to call my ink! smart contracts and I seem to be having trouble with calls that require parameters. For the call below I am getting the revert flag {"ok":{"flags&...
1 vote
1 answer
41 views

Is there an `OrderedMapping` storage type available in ink?

I'm new to ink! smart contracts, and trying to figure out how to set up my storage. I have a basic DAO. The DAO has members, and each member has a score (a u128) associated. So far a mapping sounds ...
2 votes
1 answer
32 views

How to Modify static buffer size for my ink smart contract to Resolving 'OutputBufferTooSmall' Error for Larger Vectors in ink smart contract

I'm facing an 'OutputBufferTooSmall' error in my [Language/Framework] code when working with larger vectors. I suspect this is related to the maximum allowed input/output sizes. I need guidance on how ...
0 votes
1 answer
24 views

getting CouldNotReadInput while creating cross invocation call when passing Vec<u8> as argument

This is how i am trying to invoke call.. where Bytes is Vec<u8> let res = build_call::<DefaultEnvironment>() .call(handler_acc_id) .exec_input( ...
3 votes
1 answer
93 views

Cargo-contract forcibly calls nightly-2022-06-30 regardless of specified toolchain

I am experiencing an issue when using cargo-contract (version 1.5.1) to build a project (command: cargo +nightly contract build). The specified toolchain is not being recognized, and the process is ...
2 votes
1 answer
27 views

How to send fix amount of balance to contract address

I'm working on a smart contract where I need to send a balance from a user account to the contract address. The amount to be sent is fixed and hardcoded in the contract. I have tried to figure out ...
0 votes
1 answer
37 views

duplicate lang item in crate `core`

Unable to build ink! smart contract My command: cargo contract build --release Issue: attempted to define built-in macro more than once /Users/xxx/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/...
3 votes
1 answer
67 views

duplicate lang item in crate `ink_env` - astar-frame/astar

Trying to build Astar shibuya-runtime crate is failing after adding the ink_env dependency an astar-frame chain-extension. Here are the changes to both Astar and astar-frame. Run: cargo build --...
0 votes
1 answer
24 views

Writing Test in ink! smart contract

I have two contract nft_contract and staking_contract. I want to write test for staking_contract but while staking I need to mint nft and approve, then only I can use it to stake. How can this be done?...
0 votes
2 answers
68 views

Do we have CLI support for ink! smart contract deployment on configured test-net?

I want to deploy my contract on Rococo contract test net. Apart from polkadot.js/apps, do we have any other way to upload and then instantiate the contract? My goal is to create a script for the ...
0 votes
1 answer
81 views

ENOENT: no such file or directory on compile and deploy swanky contract

This issue display when I clone the swanky project from GH and try to compile. swanky contract compile {project_name} I try to ignore the issue which display while compiling and try to deploy and got ...
1 vote
1 answer
61 views

Error running swanky suite contract query

I get this error running swanky contract tx flipper flip -a alice -g 1000000000. I have increased the gas, I have no clue what else to try. Also is there a place to check for { Err: { Module: { index: ...
0 votes
1 answer
55 views

How to deploy smart contract in ink which constructor takes value in params

I have written an erc20 smart contract in ink(Rust). The contract has been compiled successfully. But I got an error while deploying my smart contract. Basically, the contract constructor takes ...
0 votes
1 answer
25 views

Error while creating Vector

#![cfg_attr(not(feature = "std"), no_std, no_main)] // use ink_lang as ink; #[ink::contract] mod memory_game { use ink::{ prelude::vec::Vec }; #[ink(storage)] pub ...
3 votes
1 answer
40 views

A function returning Result::Error will not revert the execution

I used the example Flipper, and changed the code like this: #[ink(message)] pub fn flip(&mut self) -> Result<(), Error> { self.value = !self.value; return ...
1 vote
0 answers
14 views

How To Increase Static Buffer Size in Ink 5.0 Contract

In Ink 5.0, the Static Buffer size can be increased. Does anyone know HOW to do that? This PR mentions several methods they were considering: https://github.com/paritytech/ink/pull/1869 I tried the ...
3 votes
1 answer
46 views

No caller has been set

I write tests for my smart contract and got this error: no caller has been set The error comes from: ink_engine-4.2.0/src/ext.rs:325:14. In function that I want to write tests I have following line: ...
1 vote
1 answer
27 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
0 answers
15 views

Tool for Automatic Generation of Contract Wrapper Code from Ink Metadata

I am currently exploring ways to streamline the process of interacting with contracts on the Pallet Contracts. One challenge I've encountered is the need to manually write wrapper code for contracts ...
1 vote
0 answers
46 views

How to decode contract storage returned data

How do i decode this Hex string to String. It is storage data returned from a contract, using Polkadot-JS. { Ok: { flags: [], data: '...
0 votes
0 answers
21 views

is it necessary to download all the dependencies and the full target file to compile and build any contract?

due to I have limited internet in my country , I can not download the full building files after I wrote the contract and need to only see if there are any errors and need to run the tests . so if I ...
1 vote
1 answer
47 views

ContractTrapped Error That Affects Additional Messages Over Time

Have you ever seen a ContractTrapped error that does not initially exist on a deployed contract, but starts later after some use of the contract, and gets worse over time, affecting one contract ...
0 votes
1 answer
32 views

Auto-upload Contracts To UI OR Pre-Populate Dropzone In Modal For Adding Contracts on Polkadot-JS/apps

We are using a clone of the Polkadot-JS/apps. Our users will need to have several contracts loaded to the UI in order to use the apps. We want our users to be able to add an existing contract to their ...
3 votes
1 answer
65 views

Can we define ink_e2e tests outside of contracts module?

devs. I am writing the e2e tests for my smart contracts using ink_e2e In contracts, I define the e2e-tests like this. #[openbrush::contract] pub mod controller { ... #[cfg(all(test, ...
1 vote
1 answer
36 views

Need help in Ink e2e tests

I need help with that code. Can anyone pls help me out ?? mod p{ #[ink(storage)] pub struct Foobar { /// Stores a single `bool` value on the storage. value: ...
1 vote
2 answers
108 views

"the wasm*-unknown-unknown targets are not supported by default" -error while compiling ink smart contract

I am attempting to build a smart contract for an imaginary burger shop. But I keep getting this error when I run the build command. The test compiles, and cargo check compiles successfully too. Here ...
1 vote
1 answer
70 views

Failing to run ink! e2e tests

I am trying to run e2e tests but getting the following error. Example of running the e2e tests of the flipper contract: running 4 tests test flipper::tests::it_works ... ok test flipper::tests::...
2 votes
1 answer
32 views

Are web3.js & ethers.js compatible with ink! smart contracts?

I am pretty new to Substrate and wonder if we can communicate with ink! smart contracts via established libraries such as web3.js or ethers.js? Is the underlying RPC-based communication the same?
0 votes
1 answer
78 views

Get contract address from instantiated ContractRef

Based on this example I'm doing something similar: #[ink(message)] pub fn new_multisig(&mut self, threshold: u8, owners_list: Vec<AccountId>, salt: Vec<u8>) { let ...
2 votes
1 answer
114 views

Error while trying to run e2e rust ink! tests

I'm getting the following error while trying to run e2e rust ink! smart contracts tests: #![feature(min_specialization)] using the following command: cargo test --features e2e-tests I'm using this ...
0 votes
1 answer
48 views

I have an error while compiling the substrate node

I got this error after trying to install the substrate-contract-node : 1) I download rustc rustc --version rustc 1.75.0 (82e1608df 2023-12-21) 2) I cloned the repo I followed the instruction to ...
4 votes
1 answer
75 views

polkadot canvas testnet contract deploy error "contracts.contractTrapped"

I'm trying to deploy basic erc20 example contract on rococo canvas but "contracts.ContractTrapped" error popped on deployment? most probably it's a problem in INK release version. I'm using ...
0 votes
0 answers
23 views

How can I manually build message in ink-e2e test?

I would like to manually build a message and send it in my ink-e2e test. I'd like to construct and pass a selector and call data by myself. How can I do it using ink 5.0.0-rc and ink-e2e 5.0.0-rc?
0 votes
0 answers
11 views

How to call function with the same name but from different trait inside ink-e2e-test

Let's say I have the following impl of my Contract: impl Contract{ #[ink(message)] pub fn my_fun(&self); } impl MyTrait1 for Contract { #[ink(message)] pub fn my_fun(&self); } ...
0 votes
0 answers
62 views

How to execute smart contract from offchain-worker?

Would it be possible to execute smart contract call from an offchain-worker, either using ink! or pallet-contracts? Can someone please help me to provide the solution? is there any example?
0 votes
0 answers
46 views

How to call a contract from pallet with specific interface

I'm trying to use Ink as a programmable hook for my pallet. TD;LR; My pallet will store Agreement. struct Agreement<T> { // ... pub on_approve: T::AccountId // this point to an Ink contract }...
0 votes
0 answers
33 views

Ink e2e tests with custom environment

I have an ink! contract that uses a custom environment that contains custom chain extensions. I am trying to write e2e tests for this contract however there is a problem. Instantiate the contract how ...
0 votes
0 answers
23 views

contracts.ContractReverted: The contract ran to completion but decided to revert its storage changes. Ink nft smart contract

I am trying to call the set_base_uri function and the mint_next function of the ink! NFT smart contract. When calling from polkadot-ui it is working correctly but when I call it using nextjs it gives ...
0 votes
1 answer
180 views

"CodeRejected" when trying to deploy INK smart contract using M1 pro

I'm trying to deploy INK! 3.3.0 smart contract to my local substrate node and Im getting CodeRejected; Can't decode wasm code. When I compile my code i get no errors and using the following command ...
3 votes
1 answer
168 views

Contract call returns error "Found input with 28 bits, expected 8". Polkadot.js and ink contracts

As the title suggest, I'm trying to call PSP22 token contract and read balanceOf() function, but I get error that I'm passing a too big of a input (27 instead of 8) When I initializing the token it ...
1 vote
1 answer
32 views

Calculation gives the wrong result

After doing a simple calculation in rust ink! 4.0 smart contract, the result is incorrect and doesn't match the expected result. Here is the simple formula: let a0_balance_mul:U256 = U256::from(...
3 votes
1 answer
112 views

Mapping throws error when trying to use custom struct INK 4.0 beta

I'm trying to use a custom struct inside a Mapping, but I get many errors when trying to compile my code. Here is the custom struct I want to use inside a Mapping: #[ink::storage_item] pub struct ...

1
2 3 4 5
10