Skip to main content

Questions tagged [smart-contract]

Everything smart contract related, either WASM or EVM based.

Filter by
Sorted by
Tagged with
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 ...
user26021116's user avatar
0 votes
1 answer
20 views

Creation of a smart contract in contracts pallet

I need to create a smart contract using contracts pallet. I look at the source code of the contracts pallet and see: pub fn upload_code( origin: OriginFor<T>, code: Vec<u8>, ...
Tomasz Waszczyk's user avatar
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)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
MarlessDev's user avatar
0 votes
0 answers
10 views

Decimals in the psp22 contract

What is the role of decimals in the PSP22 contract ?? as by default Balance data-type will automatically take the number of decimal places that we have set in the chain, so what is the role of ...
Shivam Varshney's user avatar
1 vote
1 answer
61 views

error: System.ExtrinsicFailed: NoProvider when deploying smart contract

I just installed pallet-contracts on my Frontier node. From the Polkadot js app interface, I can send transactions with tokens without problems, but if I try to deploy a new smart contract (inside ...
Jacopo Mosconi's user avatar
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 ...
Lucas Cardeal's user avatar
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 ...
Kofi's user avatar
  • 143
0 votes
0 answers
20 views

Gas Limit is over estimated for dex contract

i've been working with the dex smart contracts. Whenever i try to use the add liquidity function of the contract ,it has been calculating the gas limit of 1.3 billion in frontier1.1.0. In frontier v1....
Arunjot Singh's user avatar
2 votes
1 answer
38 views

How to impl FindAuthor<H160> with Babe

I want add pallet-evm in my substrate node. and my substrate node use Babe instead of Aura. How can I Impl FindAuthor whih Babe ? this is the example of Aura. I want to impl it with Babe pub struct ...
robin y's user avatar
  • 21
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( ...
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
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/...
CocDap's user avatar
  • 718
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?
Sebastian Dine's user avatar
2 votes
0 answers
54 views

Deployment of contract and calling its function is taking too much fees

I have configured the transaction fees to be approximately 40. However, when deploying a smart contract on an EVM-compatible chain, the fees amount to be 2300, and when calling this function, the ...
Arunjot Singh's user avatar
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
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?
Boleng's user avatar
  • 557
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 ...
Muhammad Salman Sarwar's user avatar
0 votes
1 answer
77 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
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 ...
goastler's user avatar
  • 579
0 votes
0 answers
15 views

How to test smart contract timestamp dependent behavior?

how can I test block_timestamp-dependent smart contract behavior? The substrate contact node doesn't allow block_timestamp manipulations. For context, in the EVM ecosystem, one can use hardhat helpers ...
Yrefef's user avatar
  • 75
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?
Tahlil's user avatar
  • 341
2 votes
0 answers
17 views

How can I mint new token from ink smart contract calling pallet-balances function?

How can I mint a new native token (not a custom token) from the ink smart contract calling one of the functions from pallet-balances pallet?
Tahlil's user avatar
  • 341
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 ...
Tahlil's user avatar
  • 341
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
  • 718
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 ...
the dev's user avatar
  • 477
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 ...
Ariful Islam's user avatar
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?
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
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?
Tahlil's user avatar
  • 341
1 vote
0 answers
22 views

"ContractTrapped" Error even with successful cross-contract call

let result_call = ink::env::call::build_call::<Environment>() .call(self.escrow_address) .gas_limit(0) .transferred_value(0) ...
Parth's user avatar
  • 11
1 vote
0 answers
44 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
55 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
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
1 vote
0 answers
28 views

How to curl `ink!` contract storage?

I'm trying to use curl to query an ink contract's storage using the RPC of substrate. I've looked at the below question How do I call the RPC method `contractInfoOf` using curl? but it does not ...
goastler's user avatar
  • 579
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 = ...
ATV3320's user avatar
  • 31
2 votes
1 answer
47 views

How to restrict ink! contracts code upgrade?

What is the best way to disable ink! smart contracts code upgradability for a class of contracts? Below I describe what I need it for, just in case. Thank you! For my use case, I need my pallet to ...
khassanov's user avatar
  • 105
1 vote
1 answer
32 views

Can contract create and control a proxy account?

Can a smart contract create and control a proxy account? If yes, how can I create a proxy account for a contract and how can I send transactions from my contract on behalf of my contract's proxy ...
Yrefef's user avatar
  • 75
0 votes
0 answers
24 views

Encountering Error "Encountered Unknown Ink! attribute argument: path" in Ink! Smart Contract

I am working on an Ink! smart contract in Rust, and I've encountered an error that I'm having trouble resolving. I followed a solution from a source [provide link here if applicable], but the problem ...
the dev's user avatar
  • 477
0 votes
0 answers
19 views

Could not decode `ContractInfo::storage_item_deposit

When I am doing runtime-upgrade from polkadot-v0.9.38 to polkadot-v0.9.39 .I am getting one issue of smart contract in my terminal 2023-09-18 11:36:25 Corrupted state at `[67, 66, 25, 62, 73, 111, ...
Arunjot Singh's user avatar
1 vote
1 answer
60 views

Contract Trapped on Single Message

I am getting a Contract Trapped error on one specific message in my ink contract. I tried putting overflow-checks = false into the Cargo.toml. That made no difference. This is the first time I have ...
KathrynColleen's user avatar
4 votes
0 answers
36 views

Is there a way to instantiate a contract from code_hash without ContractRef

From the documentation, we have 2 ways of instantiating a contract from a code_hash, but both require a ContractRef. In order to obtain ContractRef we have to import the contract crate as a dependency ...
Thang X. Vu's user avatar
1 vote
1 answer
120 views

how to call smart contract function in custom pallet?

Is there any way to call ink! smart contract function in substrate custom pallet? We've found this answer where bare_call function is based on older version of contract_pallet. // This ends up calling ...
go11li's user avatar
  • 1,253
1 vote
1 answer
29 views

Call ink! smart contracts from hardware devices that use embedded rust

What would be the best rust crate or c++ libraries to call ink! smart contracts from hardware devices that use embedded rust?
Evil Kyle's user avatar
  • 149
1 vote
1 answer
80 views

Cross-Contract Calls and Events don't work (ink 4.2.1)

I have replicate this error using the MultiContractCaller from the ink-examples In the multi_contract_caller we have a FakeEvent. #[ink(event)] pub struct FakeEvent { account_id: AccountId, } ...
Evil Kyle's user avatar
  • 149
3 votes
1 answer
133 views

What is a Storage Deposit?

When developing ink smart contracts, I've often seen a Storage Deposit charge. What is this, and how does it relate to contract storage? My guess is it's a charge related to the size of the contract's ...
goastler's user avatar
  • 579
1 vote
0 answers
25 views

How to resolve "mismatched types" error while ink_e2e test : expected String, found Vec<u8>

I am working with ink_e2e testing framework in ink smart contract, and I have encountered an error message that's a bit confusing. The error says: mismatched types - expected String, found Vec<u8&...
the dev's user avatar
  • 477
0 votes
0 answers
25 views

Selling token to any third party tools

When user stake his NFT, then he earns certain amount of $EGGS token which is in-game currency. He can to sell those token to third party tools. How to implement selling token to any third party tools ...
go11li's user avatar
  • 1,253
0 votes
1 answer
27 views

Error in deploying call_runtime contract from ink!

I am running call_runtime from ink. It builds successfully, but when trying to upload contract, It gives system.ExtrinsicFailed contracts.CodeRejected error. Someone please advice what I am doing ...
go11li's user avatar
  • 1,253
1 vote
1 answer
28 views

How to write integration test cases for ink?

I am new to substrate and ink, while following ink documentation I got to the testing part and want to write integration tests. Can someone help me with it or point to the documentation or resources ...
Shivam Varshney's user avatar

1
2 3 4 5 6