Skip to main content

Questions tagged [pallet-contracts]

Filter by
Sorted by
Tagged with
1 vote
1 answer
41 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
102 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
  • 923
3 votes
3 answers
104 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
123 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
33 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
250 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
34 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.
Non-named's user avatar
  • 304
8 votes
1 answer
409 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
55 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
109 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
60 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,514
0 votes
3 answers
250 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 ...
Non-named's user avatar
  • 304
3 votes
1 answer
80 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
242 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,514
1 vote
2 answers
224 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(...
Non-named's user avatar
  • 304
3 votes
1 answer
269 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
194 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
100 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
4 votes
1 answer
103 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 ...
Non-named's user avatar
  • 304
3 votes
1 answer
86 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
  • 539
1 vote
1 answer
217 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
174 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
42 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
  • 600
-1 votes
1 answer
163 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
101 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
  • 331
0 votes
1 answer
83 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
188 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
  • 539
0 votes
1 answer
44 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
  • 321
0 votes
2 answers
112 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
  • 539
0 votes
1 answer
138 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
  • 207
3 votes
1 answer
452 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
303 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
  • 465
1 vote
1 answer
70 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
110 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
6 votes
2 answers
213 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
5 votes
1 answer
543 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
  • 467
0 votes
3 answers
214 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
4 votes
1 answer
154 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
571 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
  • 63
3 votes
2 answers
173 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,514
3 votes
1 answer
256 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 ...
vadersfather's user avatar
2 votes
1 answer
83 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
148 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
  • 467
2 votes
1 answer
172 views

Instantiating and Calling a contract using the Contracts Pallet

I find myself needing to do two things with the Contracts pallet, which each raise a question: I want to call the instantiate_with_code extrinsic from another Rust function. What is the correct way ...
jpataylor's user avatar
  • 321
1 vote
2 answers
135 views

How can I increase contract memory in pallet-contracts + chain-extension?

I am exposing some external functions to ink! contracts via a chain-extension in pallet-contracts. I am essentially passing a vector of bytes as a parameter to a contract method and directly ...
Petar Ivanov's user avatar
2 votes
1 answer
34 views

Is it feasible to modify the contracts pallet to integrate it into a non-substrate rust-based blockchain?

Is it feasible to modify the contracts pallet to integrate it into a non-substrate rust-based blockchain? Say one that runs on Tendermint.
Paul DeLucia's user avatar
3 votes
1 answer
184 views

Dispatching a runtime call from an ink! smart contract

Disc: I know about the existence of ChainExtension feature. Here I would like to ask about the other way. There is this CallFilter thing in Config for pallet-contracts and IIUC it defines what kind of ...
hansu's user avatar
  • 108
1 vote
1 answer
113 views

Contract CodeRejected when using chain extension

I've recently upgraded my chain to the latest substrate master, however, I'm unable to deploy contracts that use a chain extension. When I try to use a chain extension, the contract fails to deploy ...
Tony's user avatar
  • 527
2 votes
3 answers
150 views

How do I find the gas consumed by a contracts extrinsic?

I am querying extrinsic data and I am able to fetch gasLimit and gasPrice out of Extrinsic.method.args. But how do I fetch the amount of gas used from an extrinsic?
user2395's user avatar
5 votes
2 answers
91 views

Why would a cross contract call be giving `NotCallable`?

I'm hitting an error when trying to do a cross contract call with two contracts running on substrate branch monthly-2022-03 and compiled with "language": "ink! 3.0.0-rc8", &...
forgetso's user avatar
  • 1,514