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
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 ...
HAGO's user avatar
  • 1
0 votes
1 answer
22 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-...
Russo's user avatar
  • 1,193
0 votes
1 answer
28 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 ...
Kofi's user avatar
  • 143
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 ...
Davy King's user avatar
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( ...
Priyanshu Mishra's user avatar
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 ...
KathrynColleen's user avatar
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 ...
Luca Auet's user avatar
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/...
CocDap's user avatar
  • 678
1 vote
0 answers
45 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: '...
Woodfish's user avatar
  • 121
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 ...
KathrynColleen's user avatar
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 ...
castle_chain's user avatar
0 votes
1 answer
45 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 ...
castle_chain's user avatar
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?
Sebastian Dine's user avatar
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?
Yrefef's user avatar
  • 75
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); } ...
Yrefef's user avatar
  • 75
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?
Boleng's user avatar
  • 497
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 }...
jasl's user avatar
  • 31
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 ...
Szegoo's user avatar
  • 657
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 ...
Muhammad Salman Sarwar's user avatar
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 ...
Nico John's user avatar
1 vote
0 answers
34 views

I am having issues with implementing swap fees on transfer for DEX

Below is my lib.rs file for the token contract and it uses the Cardinal Cryptography PSP22 sample at https://github.com/Cardinal-Cryptography/PSP22 I am trying to implement swap for the transfer taxes ...
Edinyanga Ottoho's user avatar
1 vote
0 answers
11 views

What happens to smart contracts when breaking changes are introduced to ink?

I've seen breaking changes mentioned in this issue for upgrading set_code_hash. This got me thinking, what happens to existing contracts when a breaking change to ink is introduced? For example, we're ...
goastler's user avatar
  • 569
1 vote
0 answers
67 views

Substrate account abstraction

I'm interested in learning about account abstraction in Substrate using Ink!. As far as I understand, smart contracts in Substrate cannot store keys or sign transactions. However, I came across this ...
qqrm's user avatar
  • 11
1 vote
0 answers
55 views

I want to clone a stable coin project in Rust but having a lot of errors

I am facing too much errors when I clone this project, I want to create a stable coin in substrate I found this repository https://github.com/1010adigupta/ink-Stable-Coin But after installing rust ...
Shah Dost's user avatar
0 votes
0 answers
24 views

can cross contract calls be done across different polkadot chains?

I have two smart contracts, one for off-chain computations (Phat Contracts) and the other from Ink which will be deployed on the Astar network. I want to access data from the phat contracts, how do I ...
HunnyPawt's user avatar
1 vote
1 answer
33 views

Issue with cargo test and ink! Flipper contract

cargo contract build works just fine and produces the correct outputs in the /target folder. Running cargo test however throws the following error: error: failed to run custom build command for `wasm-...
WhisperingZebra's user avatar
3 votes
0 answers
35 views

How to use enum with associated value(s) in ink smart contract

I have an ink smart contract message that takes an enum as argument. The code is shown below; #[derive(Encode, Decode)] #[cfg_attr( feature = "std", derive(Debug, PartialEq, Eq, ...
Ahmad Bolaji's user avatar
1 vote
1 answer
35 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....
Edinyanga Ottoho's user avatar
1 vote
1 answer
19 views

Is there a library similar to ERC-165, In OpenBrush or Ink smart contracts, used to identify the implemented interfaces of a smart contract?

"I'm working on developing smart contracts using OpenBrush and the Ink programming language, and I'm in need of a mechanism to detect and identify the interfaces that a particular smart contract ...
the dev's user avatar
  • 477
2 votes
1 answer
59 views

How to iterate over a vector in ink smart contract

I initialized a vector in ink smart contract like this: bidders: Vec<AccountId> What is the best way to iterate over the vector?
Tahlil's user avatar
  • 341
0 votes
1 answer
23 views

Swanky throws error on inititating smart contract:- error install deps "ERROR: [Errno 2] No such file or directory: 'install' "

I'm trying to init a smart contract using swanky and i get this error below. I even tried changing my node version to 18.10.0. It doesn't fix it. Am I missing anything?
HunnyPawt's user avatar
1 vote
1 answer
64 views

How do you add mapping of struct array in ink?

How to create a mapping of a vector of struct, also how to assign value and get the value in this data structure. I didn't find the documentation on the official doc. Is there any downside to using ...
Tahlil's user avatar
  • 341
0 votes
1 answer
33 views

Error installing deps on swanky phala

I'm having issues initiating my swanky phala project. I keep getting this error below. Is there anything i'm missing? update: I went to the tests directory to run npm install and I got these errors. ...
HunnyPawt's user avatar
1 vote
1 answer
41 views

is there any ways to automatically trigger ink smart contract based on certain conditions?

How to auto-execute smart contract based on certain conditions ? For example: The contract period has exceeded the deadline -> auto-execute pay without interfering from user
CocDap's user avatar
  • 678
2 votes
1 answer
30 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 ...
the dev's user avatar
  • 477
0 votes
0 answers
18 views

How do i run ```npx @727-ventures/typechain-compiler --config typechain.config.json``` for a nightly version

So i am running this command npx @727-ventures/typechain-compiler --config typechain.config.json to get to compile so i can write my test file for my contracts and use the typechain gotten. This is ...
Mite's user avatar
  • 21
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 ...
Ariful Islam's user avatar
1 vote
0 answers
28 views

How do I scale decode a Vec<u8> within an ink smart contract?

This is within my smart contract's module: // THIS IS BEING USED: use ink::prelude::vec::Vec; #[ink(message)] pub fn test_encoding(&mut self) -> Result<u32, ...
Jeremy Boetticher's user avatar
0 votes
0 answers
237 views

could not compile `proc-macro2` (lib) due to 3 previous errors

I run cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --tag v0.23.0 --force --locked and then got an error, version of the proc-macro2 library is ...
user4809's user avatar
0 votes
1 answer
41 views

Can we call pallet function somehow from Ink smart contract?

Can we call one of the pallet functions somehow, from Ink smart contract?
Tahlil's user avatar
  • 341
0 votes
1 answer
18 views

Can I send native token in the contract just after deployment by calling the constructor on Ink smart contract?

Is it possible to transmit the native token to the contract immediately after deployment by invoking the constructor on the Ink smart contract?
Tahlil's user avatar
  • 341
1 vote
1 answer
97 views

How can I send a native token from a contract to an externally owned account in an ink smart contract?

How can I send native tokens from a contract address to a user/externally owned account using an Ink smart contract?
Tahlil's user avatar
  • 341
0 votes
1 answer
22 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?...
Ganesh11's user avatar
  • 1,241
1 vote
0 answers
22 views

What is the principle of Code Hash generation in ink?

I come from ChainIDE, and I have some confusion regarding the generation mechanism of code hash. I tried to compile Flipper and PSP22 in different folders, but I obtained different code hashes. cargo ...
user4790's user avatar
1 vote
0 answers
43 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 ...
ATV3320's user avatar
  • 31
3 votes
1 answer
53 views

Can we mint native token from root account on Smart contract?

After building a chain from Substrate node template there are some initial native token balances in the predefined accounts. Can I mint the native token on a smart contract level using the root ...
Tahlil's user avatar
  • 341
1 vote
0 answers
25 views

How to change the gas cost in ink! e2e tests

I want to be able to adjust the gas cost used in specific ink! end-to-end (e2e) tests, but my attempts to do so have consistently resulted in a return value of zero when using the weight_to_fee ...
Brian Ramirez's user avatar
1 vote
0 answers
21 views

error build_call

#[ink(message)] pub fn get_flip2_buill_call(&mut self, token_contract_address: AccountId, account_id: AccountId )-> i32 { let my_return_value = build_call::<DefaultEnvironment>() ...
pablo blanco's user avatar
2 votes
1 answer
82 views

How do set the appropriate refTime and proofSize when create asMulti?

We had a big problem after upgrading weight -> weight v2. I understood that weight v2 uses refTime and proofSize. However, I wonder if there is a way to properly look up these two values. We are ...
hs1228's user avatar
  • 45
2 votes
0 answers
62 views

Deploy ink! contracts with unified accounts

I have a chain similar to mentioned in this question, where I'm trying to deploy ink! smart contracts. I'm setting my Environment like this: use ink::env::{Environment, DefaultEnvironment}; use ...
Discardo's user avatar
  • 436

1
2 3 4 5
10