Questions tagged [pallet-contracts]
The pallet-contracts tag has no usage guidance.
108 questions
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 ...
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())...
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 ...
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 ...
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, ...
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 ...
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.
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. ...
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....
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 ...
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 ...
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 ...
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 ...
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, ...
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(...
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/...
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 ...
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 ...
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 ...
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{
...
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 ...
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/...
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 ...
-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
...
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 ...
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 ...
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 ...
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 ...
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?
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::&...
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.
...
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....
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 ...
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!...
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 ...
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?
...
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:...
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 ...
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?
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. ...
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 ...
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
...
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?
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 ...
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 ...
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.
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 ...
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 ...
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?
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",
&...