Questions tagged [ink]
eDSL to write smart contracts in Rust for blockchains built on the Substrate framework
494
questions
0
votes
0
answers
11
views
Issue launching a local node & instantiating a contract [duplicate]
I'm trying to build a contract and the artifacts are built successfully. However, I keep getting the following error message:
Local node started successfully:
│ portal: https://polkadot.js.org/apps/?...
0
votes
0
answers
25
views
ERROR: Chain configuration not found in ink getting-started in cargo contract upload
I was trying the tutorial at
https://use.ink/getting-started/deploy-your-contract#using-cargo-contract
I have substrate node running in another terminal, I already had built the contract and have ...
1
vote
1
answer
19
views
Dedot Flipper contract flip() operation not working
I am trying to work with the default flipper contract with react js based on the link: https://github.com/dedotdev/dedot.
I am trying to follow the Submitting transactions section.
First of all, I am ...
0
votes
0
answers
14
views
Getting Wrong ABI for the openbrush contracts
openbrush Library
when I am building the openbrush examples i am getting wrong ABI for the input of all the functions that are in the libraray.
Can anyone tell why it is happening.
e.g.
This is in ...
0
votes
0
answers
16
views
What should `data` be decoded to in ExecReturnValue?
What does data represent? In other words, to what type could I decode it?
0
votes
0
answers
10
views
openbrush::implementation(PSP34Ownable) not implemented!
when building I get this error:
error: custom attribute panicked |
4 | #[openbrush::implementation(PSP34, PSP34Ownable, PSP34Mintable, PSP34Enumerable, PSP34Metadata)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
0
votes
0
answers
10
views
calldata in the substrate contract ui
how can I get the calldata of the function in the wasm contract in the substrate contract UI ?
I was trying to mimic the behaviour of the upgradeToAndCall() of the solidity,but in that they are ...
0
votes
0
answers
26
views
Unable to query transactions on ink contracts using !@Polkadot/api-contract
I am having troubles querying my smart contract transaction using the @polkadot/api-contract. I have a NextJS application setup and I have a private key that can be used to sign transactions. I have ...
0
votes
1
answer
19
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
0
answers
18
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 ...
0
votes
1
answer
27
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
1
answer
36
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
...
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 ...
0
votes
1
answer
27
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(
...
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 ...
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 ...
0
votes
1
answer
46
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/...
1
vote
0
answers
50
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: '...
1
vote
1
answer
50
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
0
answers
22
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 ...
0
votes
1
answer
54
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 ...
2
votes
1
answer
34
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
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
65
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
47
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
38
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
24
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
78
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 ...
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 ...
1
vote
0
answers
13
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 ...
1
vote
0
answers
69
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 ...
1
vote
0
answers
57
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 ...
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 ...
1
vote
1
answer
36
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-...
3
votes
0
answers
36
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, ...
1
vote
1
answer
37
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....
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 ...
2
votes
1
answer
60
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?
0
votes
1
answer
27
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?
1
vote
1
answer
68
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 ...
0
votes
1
answer
34
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.
...
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
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
0
answers
20
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 ...
2
votes
1
answer
30
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 ...
1
vote
0
answers
29
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, ...
0
votes
1
answer
45
views
Can we call pallet function somehow from Ink smart contract?
Can we call one of the pallet functions somehow, from Ink smart contract?
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?
1
vote
1
answer
98
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?