Questions tagged [pallet-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
52 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 get the error message that states the node does not support ...
Snowmead's user avatar
  • 183
0 votes
1 answer
26 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
25 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
  • 339
2 votes
1 answer
34 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
7 votes
1 answer
65 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
3 votes
1 answer
61 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
186 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
  • 311
1 vote
1 answer
22 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
49 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
  • 491
2 votes
3 answers
66 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
114 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
26 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
81 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
1 vote
1 answer
25 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
  • 274
7 votes
1 answer
178 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
45 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
4 votes
2 answers
84 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
41 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,192
0 votes
3 answers
108 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
  • 274
3 votes
1 answer
55 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
  • 939
1 vote
2 answers
149 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,192
1 vote
2 answers
93 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
  • 274
3 votes
1 answer
127 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
  • 53
2 votes
1 answer
85 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
88 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
  • 392
3 votes
1 answer
64 views

What are the fees associated with ink! contract deployment?

I see that there are many events emitted during the process of deploying my contract on Substrate local chain (SNOW Network to be specific). 4 ICZ was reserved from deployer account 1 ICZ & 2 ICZ ...
Bukks's user avatar
  • 274
1 vote
1 answer
66 views

How to return uint256 datatype from ink! wasm contract? How to make compatibility with IERC20?

IERC20 interface contains methods with uint256 datatype. If you try to call ink! wasm contract from Solidity (compiled by solang to target subtrate) you will have an issue. interface IERC20{ ...
Rust Dev's user avatar
  • 313
1 vote
1 answer
103 views

unable to upload ink! contract in polkadot-JS

I add pallet-contract into substrate-node-template, and use polkadot-JS to upload ink! contracts. But I get something wrong when I upload a contract. logs like this: createType(Call):: Call: failed ...
Briza's user avatar
  • 55
2 votes
1 answer
103 views

unresolved import `pallet_contracts::DefaultContractAccessWeight`

Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/briza/...
Briza's user avatar
  • 55
0 votes
2 answers
27 views

Fund transferred to smart contract address not showing in balances

I deploy an ink smart contract through a properly configured pallet_contracts (4.0.0-dev from the Substrate branch polkadot-v0.9.29) on chain. Then I use the unique address of that smart contract and ...
Alex Sed's user avatar
  • 363
-1 votes
1 answer
84 views

Error while running the RPC call

while running the flipper contract I get the following error { Err: { Module: { index: '9', error: '0x06000000' } } } What does it mean? I searched https://wiki.polkadot.network/docs/maintain-errors ...
Stanly Wilson's user avatar
3 votes
1 answer
68 views

Gas costs of performing cross-contract calls

I have a question regarding costs of executing a cross-contract call, in which one contract calls the method of another, already instantiated contract. Specifically how much more overhead (understood ...
fbielejec's user avatar
  • 311
0 votes
1 answer
49 views

I'm getting an error with the gas limit definition when deploying a smart contract using CodePromise

Problem The following program does not work with pallet-contract "polkadot-v0.9.29". "polkadot-v0.9.27" in pallet-contract works as expected. Anyone know how to get around this ...
s.Takahashi's user avatar
0 votes
1 answer
96 views

Expected input with 32 bytes (256 bits), found 48 bytes

I have a solidity smart contract that I compile using Solang to substrate wasm. contract Pool { address xxx; constructor(address _test){ xxx = _test; } function callFoo(address _test) external ...
Rust Dev's user avatar
  • 313
0 votes
1 answer
29 views

Why is so much more gas used by instantiate than instantiateWithCode in the contracts pallet?

When I call instantiateWithCode, I need around 288,000,000 gas. But to call instantiate (having already uploaded the code separately) I need 75,000,000,000. I would have expected the more simple ...
jpataylor's user avatar
  • 311
0 votes
2 answers
82 views

Is it possible call wasm from evm smart contract on substrate chain?

Is it technically possible to call wasm contract from evm contract inside substrate chain that include pallet-contracts and pallet-evm?
Rust Dev's user avatar
  • 313
0 votes
1 answer
106 views

Upload compiled smart contract got 'f.rpc.contracts.instantiate is not a function'

I implemented contract-pallet in runtime: use pallet_contracts::migration; pub struct Migrations; impl OnRuntimeUpgrade for Migrations { fn on_runtime_upgrade() -> Weight { migration::migrate::&...
marethyu's user avatar
2 votes
1 answer
438 views

error[E0158] when testing default contract from flipper

https://docs.substrate.io/tutorials/smart-contracts/prepare-your-first-contract/ Hi, I'm working on the above tutorial and after running the cargo +nightly test command, I see the following error. ...
kenta_desu's user avatar
0 votes
1 answer
226 views

How to do contract RPC call?

I'm having trouble doing an RPC call using polkadot.js. My contract is here: https://github.com/kanishkatn/ink-test/tree/master/flipper I tried making the RPC call using the selector from metadata....
Kanishka's user avatar
  • 415
1 vote
1 answer
66 views

Use SpreadAllocate in cross-contract calling

I'm trying to call an erc20 contract from another custom erc20 contract. Both, the original contract and calling contract have the following macros: #[ink(storage)] #[derive(SpreadAllocate)] In the ...
Rajdeep Bharati's user avatar
1 vote
1 answer
57 views

How to inherit Ink! traits/contracts

I am trying to inherit a trait in ink! as follows: #[ink::trait_definition] trait Erc20 { // ... } #[ink::trait_definition] trait CustomErc20: Erc20 { // ... } However, I get this error: ink!...
Rajdeep Bharati's user avatar
5 votes
2 answers
147 views

What's the different between "Extrinsic" and "RPC" methods for pallets?

I notice that for the nicks pallet there is no need to write a custom RPC or configure that, while with the contracts pallet that need seems to be there. It also seems that in the Substrate Front End ...
Darian Foulds's user avatar
4 votes
1 answer
262 views

How can I call my contract methods inside a pallet?

Can someone tell me how can you execute a smart contract method inside your custom pallet? You can call your smart contract tx/query through the RPC API but how can you call it inside a custom pallet? ...
hgminerva's user avatar
  • 437
0 votes
3 answers
134 views

error[E0405]: cannot find trait `Trait` in crate pallet_contracts

I am performing the (add the contracts pallet to a runtime) substrate tutorial and I am getting this error error[E0405]: cannot find trait Trait in crate pallet_contracts --> runtime/src/lib.rs:279:...
Vitthal agarwal's user avatar
2 votes
1 answer
88 views

Pending Extrinsic not executed on block producing parachain

I have followed the tutorial and have reached the step where parachain is now producing and finalising block with a local relay chain. Transactions on chain and DMP (teleport asset) all works well. I ...
whalelephant's user avatar
2 votes
2 answers
308 views

Can you query the state of a contract at a given block number?

I was wondering if its possible to query the state of a contract at an old block?
petreze's user avatar
  • 53
3 votes
2 answers
167 views

Are there any publicly available test nets that run pallet contracts?

We are looking to deploy a demo dapp to a live test net. Do any of these exist or are we better using a service like onfinality or deploying our own test net? Data persistence is not that important. ...
forgetso's user avatar
  • 1,192
3 votes
1 answer
193 views

Unable to add pallets-contracts-rpc crate

When going through this tutorial for adding contracts to the default node template, adding pallets-contracts-rpc, the 4th recommended crate to install, I receive various errors. Things compile fine ...
garrettmaring's user avatar
2 votes
1 answer
70 views

ink! contract extrinsics only take 10-11% block weights when stress test

I have an ink! contract project and I'm doing stress test to benchmark the performance of this ink! contract project in a production chain. My stress test includes these steps: Deploy ink! projects ...
Daniel Lam's user avatar
1 vote
1 answer
101 views

Can I add pallet-contracts in substrate-node-template?

Is there a way to add a pallet-contracts to substrate-node-template?
hgminerva's user avatar
  • 437