Skip to main content

Questions tagged [smart-contract]

Everything smart contract related, either WASM or EVM based.

38 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
95 views

I want to use Parity SCALE codec in Solidity? Is there any implementation of scale codec to decode bytes?

I want to decode bytes on the Solidity side that was decoded with scale codec. Is the any implementation of scale codec (decode) on the Solidity side?
rust.dev's user avatar
  • 539
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
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, ...
Wolf's user avatar
  • 61
3 votes
1 answer
82 views

Build the data bytes to query a contract with the api state_call

I would like to use the rpc call to query a contract. I try to use the method "call" from the endpoint "state" with the first parameter "ContractsApi_call" but I am not ...
GuiGou's user avatar
  • 31
3 votes
0 answers
33 views

How can I use complex structure in ink! version3

how can i use the complex structure(like Mapping<String, Vec<Map<String, String>>>) in ink! #![cfg_attr(not(feature = "std"), no_std)] use ink_lang as ink; #[ink::...
user4298's user avatar
3 votes
0 answers
31 views

How to migrate / backup & restore ink smart contract storage?

Is there a way to backup ink smart contract storage and later restore on another chain? Lets say we have chain with 3 validators and deployed smart contract containing certain information in its ...
Alex 's user avatar
  • 83
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
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
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
0 answers
51 views

How to upload the same ink! smart contract to a different code hash?

I've written this ink! quickstart script that I can repeatedly call to run these steps to flood my local testnet with instances of Flipper contracts: Kills an existing substrate-contracts-node ...
Luke Schoen's user avatar
  • 2,346
2 votes
0 answers
35 views

Error Type { registry: TypeRegistry {}, initialU8aLength: 6 } when try to query ink! smart contract by @polkadotjs/api-contract

My code: const main = async() => { //Get wasm // This file wasm I already build through "cargo contract build" let wasm = fs.readFileSync("../../res/incrementer.wasm&...
CocDap's user avatar
  • 718
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
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
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
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
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
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
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
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
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
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
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
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 ...
Nico John's user avatar
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
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
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
0 answers
69 views

How to wrap an ink::env::Error in a Custom Error?

In my contract, I have a requirement to call messages from external contracts without knowing their specific identities beforehand. To achieve this, I utilize the call builder, enabling the execution ...
Luca Auet's user avatar
0 votes
1 answer
58 views

How to deploy a contract on your chain

Hi i have cloned the node-template and also added the pallet-contract in it, now i want to know that how can i deploy a smart contract on my chain i have also deployed it on EC2 instance but i want to ...
Abubakar Mujahid's user avatar