Questions tagged [pallet-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
9 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
  • 549
0 votes
0 answers
12 views

How do I predict an address given a salt in python?

I have python code that does deploy a few ink! contracts that depend on each other. In order to do this in a batch call, I want to predict the contract address given the salt. How would I do this, ...
CHristian's user avatar
0 votes
1 answer
39 views

Error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `panic_impl`

I am building a solo chain from Substrate node template, I have made some changes to switch from PoA to PoS just like this repo. Now, I am trying to add pallet-contracts on the runtime. I added the ...
Tahlil's user avatar
  • 341
1 vote
2 answers
52 views

How to add pallet contract for polkadot-v1.0.0?

How to add pallet contract for polkadot-v1.0.0? Do I only need to change the node/runtime folder or the runtime folder at root or both?
Tahlil's user avatar
  • 341
1 vote
0 answers
14 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 ...
UPENDRA SINGH's user avatar
2 votes
1 answer
37 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
2 votes
1 answer
27 views

Appropriate Substrate Pallets for voting proposal

In my custom blockchain, i want to offer a feature where i will provide some proposals to my users. The users can vote on to the proposal they find considerate. To accept the proposal, there will be a ...
Ariful Islam's user avatar
1 vote
0 answers
26 views

Uncaught error. Something went wrong with the query and rendering of this component

I am getting this error while adding pallet_contracts in my chain. This is my github-code. Can you please describe me why I am getting this issue? Edit As @forgetso suggested in comment, I change ...
Ganesh11's user avatar
  • 1,208
2 votes
1 answer
73 views

How to customize pallet_contracts?

We have our own chain where we've added pallet_contracts pallet for writing and deploying smart contract. We just want to give permission to upload smart contract for few users only. Someone please ...
Ganesh11's user avatar
  • 1,208
1 vote
0 answers
48 views

Extrinsic Read Smartcontract Data

I would try to replicate the Extrinsics that is thrown when using this This is the ABI of my smart contract { "args": [ { "label": "code", ...
FedeC87p's user avatar
1 vote
1 answer
107 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 ...
Ganesh11's user avatar
  • 1,208
2 votes
1 answer
62 views

Incompatibility between subxt_signer and subxt

https://github.com/paritytech/subxt/blob/master/subxt/examples/tx_basic.rs I want to call a function in my substrate pallet. I am using the substrate-node-template subxt subxt_signer use subxt::{...
Haider's user avatar
  • 51
0 votes
0 answers
33 views

Event on factory can't be emitted

I'm working on an an ink! contract and trying to establish a factory contract to enable indexing for each deployment using a subquery subgraph. For this purpose, we emit an event whenever a successful ...
Gabriel Gonzalez's user avatar
2 votes
0 answers
26 views

Uncaught error substrate-node-template pallet-contract

I am trying to use latest substrate node template. I have added pallet-contract. The code compile but when accessing contracts from polkadotjs Developer menu, I got this issue. Uncaught error. ...
Ganesh11's user avatar
  • 1,208
0 votes
1 answer
55 views

Get contract address from instantiated ContractRef

Based on this example: https://docs.rs/ink/latest/ink/struct.EnvAccess.html#method.instantiate_contract Im doing something similar: #[ink(message)] pub fn new_multisig(&mut self, threshold:...
Luca Auet's user avatar
1 vote
2 answers
97 views

Not able to upload contract in substrate node template

I have added pallet-contract in our chain. Build contract works fine and run chain in dev mode also works fine. But when I try to deploy contract it doesn't work and doesn't throw any error. Can ...
Ganesh11's user avatar
  • 1,208
0 votes
0 answers
59 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
24 views

Could not find `CollectiveEvents` in `pallet_contracts`

Error: const CONTRACTS_EVENTS: pallet_contracts::CollectEvents = ^^^^^^^^^^^^^ not found in `pallet_contracts Cargo.toml File pallet-contracts = { version ...
Abubakar Mujahid's user avatar
1 vote
1 answer
60 views

How to mint multiple characters randomly?

Let me give scenario, let's say: There are 2 types of playable characters Chickens (90% chance to mint) Foxes (10% chance to mint) and total supply is 15,000 units : 13,500 chickens 1,500 foxes ...
Ganesh11's user avatar
  • 1,208
0 votes
1 answer
33 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
3 votes
1 answer
64 views

How to "graceful terminate" a smart contract from the "rococo-contracts-rpc.polkadot.io" chain?

In theory we could use this command: cargo contract remove --execute --code-hash '******' --url 'wss://rococo-contracts-rpc.polkadot.io' --suri 'seeds' But in order to do that we have first to ...
Evil Kyle's user avatar
  • 149
0 votes
1 answer
27 views

"TooManyTopics" Dispatch Error and Contract Revert when Minting in OpenBrush PSP37 Smart Contract

I am facing an issue with the OpenBrush PSP37 smart contract while calling the mint function. I receive a Contract Reverted! error with a TooManyTopics dispatch error. However, upon inspecting the ...
UPENDRA SINGH's user avatar
1 vote
1 answer
64 views

Getting "Contract Reverted!" error with "TooManyTopics" dispatch error when calling mint function in OpenBrush PSP37 smart contract

I'm working on adding events to an OpenBrush PSP37 smart contract and deploying it using Substrate Contract UI. However, when I try to call the mint function, I encounter the following error: Contract ...
UPENDRA SINGH's user avatar
3 votes
1 answer
58 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
1 answer
33 views

Off chain worker for https:// request

I have a simple question if i use off chain workers to get calls to https://somecoinexchange/ to get data for some calculation, what will be the gas usage. I was presuming that since no chain work is ...
Nöörah Smith's user avatar
8 votes
1 answer
113 views

Support WeightV2 in a substrate chain?

I started working from the substrate-parachain-template and added the pallet_contracts to the runtime. When I open the Contracts UI, I'm getting the error message that states the node does not support ...
Snowmead's user avatar
  • 615
0 votes
1 answer
57 views

upgrading substrate node from Polkadot 0.9.28 to 0.9.40

I have a substrate node of Polkadot 0.9.28. It is customised to enable contracts, and I have enabled the contract and runtime pallets. The tutorial I worked on is no more available in substrate docs. ...
Stanly Wilson's user avatar
4 votes
1 answer
35 views

How can i query pallet contract to give the Scale codec value of a Contract Root Storage Key

According to ink!: "Storage data is always encoded with the SCALE codec. The storage API operates by storing and loading entries into and from a single storage cells, where each storage cell is ...
dharjeezy's user avatar
  • 419
2 votes
1 answer
54 views

Error when implementing contract-pallet into substrate-node-template

I was looking to implement smart-contract into substrate-node-template as I do not want to use substrate-contracts-node. I was trying to follow this guide - https://substrate-developer-hub.github.io/...
BHappy's user avatar
  • 45
9 votes
1 answer
117 views

Smart Contract blockspace allocation in Hybrid Chains

In Rob Habermeier's blogpost about Hybrid Chains, he mentions allocating contract execution to a limited fraction of the chain's blockspace. Is that some functionality that pallet-contracts provides? ...
Bernardo Rodrigues's user avatar
2 votes
1 answer
73 views

How to decrease wasm smart contract deployment fee without decreasing Transaction fee?

i am using substrate pallet_contracts for wasm contract deployment how can i set the fees for contract deployment?
Amit Kumar Yadav's user avatar
4 votes
1 answer
197 views

Caching of smart contract storage reads

Wanted to get some clarity on repeated reads. Assuming this is the contract storage, two values both under the default 0x00000000 key in the storage. #[ink(storage)] pub struct MyContract { pub ...
fbielejec's user avatar
  • 331
1 vote
1 answer
31 views

contract pallet installation issues

A few months back, I added contract-pallet to the Polkadot using the link. At that time, I used Polkadot 0.9.28 as the node version. There was another link from the substrate that uas also useful. At ...
Stanly Wilson's user avatar
1 vote
1 answer
79 views

method not found" and "associated item not found" errors in a Substrate pallet function?

I am working on a Substrate-based blockchain project and I have the following function in my custom pallet: #[pallet::call_index(8)] #[pallet::weight(<T as Config>::WeightInfo::create_exchange())...
Mr Coder's user avatar
  • 883
3 votes
3 answers
92 views

How to sign an extrinsic as a smart contract in the browser?

When working with smart contracts in Contracts UI you sometimes need to call a message as the contract itself. For example the addOwner message of the Multisig ink! example. How can I add the contract ...
Andreea Eftene's user avatar
2 votes
1 answer
122 views

Can I deploy an old ink! v3.x contract on the latest version of substrate/polkadot (pallet-contracts >= polkadot-v0.9.37)?

I have old smart contracts written in ink! v3.x, and I need to update the substrate version (including pallet-contracts) to >= polkadot-v0.9.37. After the update, I'll need to redeploy my smart ...
Yahor Tsaryk's user avatar
0 votes
2 answers
30 views

How To Alter A Clone of Add.tsx To Add One Specific Contract in Polkadot-JS?

We are trying to modify the Polkadot-JS/apps UI to add an app of our own. We have cloned the Contracts page to make our own page so that we can easily call the contract message functions. Contract, ...
KathrynColleen's user avatar
0 votes
1 answer
185 views

How to Call a Smart Contract on the Backend

What is the best way to call a contract (based on the Substrate Blokchain) on the backend side from the code? I know there is Polkadot.js but it's rather a frontend focused tool, and there is also ...
Pawel's user avatar
  • 41
2 votes
1 answer
30 views

What exactly is the "data" field required as arg while instantiating an ink contract?

The image below shows a decoded finalized transaction that deploys a flipper contract on my local substrate network. I am not sure what the data field represents here.
Bukks's user avatar
  • 304
8 votes
1 answer
313 views

How to estimate gas for ink contracts transactions for Weights V2?

For ink contracts with weight v2 it requires refTime and proofSize. For this we are first querying(dry run) the transaction method, getting gasRequired from query result and sending it to transaction. ...
Nikhil Ranjan's user avatar
1 vote
1 answer
51 views

In the runtime chain extension, should we be charging weight if we are reading a `StorageMap`?

If we have the storage map DummyStorageMap in pallet-example And we read its value under the key key by calling DummyStorageMap::<T>::get(key) in the runtime chain extension (https://paritytech....
aang114's user avatar
  • 43
0 votes
2 answers
101 views

Balance got Reserved while deploying wasm contracts?

i am using pallet-contracts in my substrate based chain when i am deploying the wasm smart-contract some balance is getting reserved.How can i stop this i don't want to reserve the balance,Or is there ...
Amit Kumar Yadav's user avatar
0 votes
1 answer
51 views

How do we resolve the InvalidScheduleVersion error?

From the contracts pallet: /// A new schedule must have a greater version than the current one. InvalidScheduleVersion, The context of this error is sending batch transactions from ...
forgetso's user avatar
  • 1,462
0 votes
3 answers
179 views

How to estimate gas limit required for ink contract deployment?

I could find the JS code to deploy an ink contract here. The code however, seems to be using a fixed gas limit to deploy the contract. Is there a way to estimate the gas limit that is required to ...
Bukks's user avatar
  • 304
3 votes
1 answer
75 views

Charge weight and weight Info in chain-extension

I am writing a chain-extension that is a 1 to 1 map of a pallet. Based on this: [...] charging the appropriate amount of weight. In order to do so benchmarks must be written and the charge_weight ...
P.Ossun's user avatar
  • 1,219
3 votes
2 answers
231 views

How can I generate a random seed now that self.env.random() is removed in ink?

We were using self.env.random() in our contract to generate a random number. The calling user's AccountId was used to give additional entropy to the random generation. fn get_random_number(&self, ...
forgetso's user avatar
  • 1,462
1 vote
2 answers
157 views

How to decode error that occurred while calling a write method on ink contract, on the client side?

While calling a read only method on my ink contract, I get an error that looks like following On my contract, I have a check to throw an error like: if paid <= MIN_VESTING_AMOUNT{ return Err(...
Bukks's user avatar
  • 304
3 votes
1 answer
206 views

Error: no matching package named 'pallet-contracts-rpc' found

I am trying to add the pallet-contracts-rpc dependency but keep getting this error. ''' error: no matching package named pallet-contracts-rpc found location searched: https://github.com/paritytech/...
Kaioh33's user avatar
  • 63
2 votes
1 answer
155 views

Need Help Understanding ink! Contract Storage And Data Access

There are some aspects of ink! contract storage and data access that I cannot find the answers to in the documentation or by experimentation. Here are my questions... Is it true that there can be ...
KathrynColleen's user avatar
2 votes
1 answer
96 views

pallet-contracts and ink! version (v3.x.x & v4.0.0) compatibility

ink! v4.0.0 release is incoming. As mentioned in v4.0.0 pre-release page, substrate pallet-contracts later than this commit (shows up in polkadot-v0.9.32 branch for the first time) start to support ...
Shunsuke's user avatar
  • 432