Questions tagged [contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
56 views

contracts-ui cannot connect to local node

When following ink getting started tutorial at https://use.ink/getting-started/running-substrate I am stuck at one of the steps. After starting contracts node in dev mode with the following command: ...
jangorecki's user avatar
1 vote
0 answers
18 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
  • 549
0 votes
1 answer
34 views

Deriving Contract Reference from `ink::trait_definition`

Is it possible to create a Contract Reference to perform a Cross-Contract call from ink::trait_definition? If it is, how can I do so? If it is not, why it is not possible? It seems strange that we can ...
Yrefef's user avatar
  • 73
5 votes
1 answer
104 views

After doing runtime upgrade getting contract not found in substrate contracts ui

I am doing runtime upgrade of substrate blockchain from 0.9.36 --> 0.9.37 --->0.9.43 . And i have some contracts deployed on the running blockchain which is running on 36 version . After doing ...
Karanvir Singh's user avatar
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
30 views

How to entirely clear a pallet storage on a living chain?

Would it be possible to clear a pallet storage with a call on a live chain ? Precisely I would like to remove all contracts and code hash existing on my chain (as sudo).
SailorSnoW's user avatar
3 votes
1 answer
59 views

What is a Storage Deposit?

When developing ink smart contracts, I've often seen a Storage Deposit charge. What is this, and how does it relate to contract storage? My guess is it's a charge related to the size of the contract's ...
goastler's user avatar
  • 549
0 votes
1 answer
8 views

cxxbridge error on cargo contract

I was developing things yesterday and during that development I had briefly a file named "asset_extension.rs", that I renamed later. I finished that development, tests passed and everyone ...
shredding's user avatar
  • 294
1 vote
1 answer
28 views

How to get and modify cross-chain asset in contract?

I am preparing to create a smart-contract on Astar using ink! programming language. The contract's main logic involves modifying the cross-chain asset USDT on the statemint chain. After going through ...
jeffery xu's user avatar
5 votes
1 answer
64 views

How do I upgrade an ink contract with storage changes?

Let's say I have a simple/contrived ink contract: #[ink(storage) pub struct MyContract { a: u8, b: u8, } Now let's say it's in production and a == 1 and b == 2. I've done some work and ...
goastler's user avatar
  • 549
3 votes
1 answer
57 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
5 votes
0 answers
74 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
  • 509
2 votes
1 answer
63 views

How to run ink! e2e tests in GitHub CI

The directory structure for my project is something like this ink - contract runtime node and so on I want to run the contract ink/contract e2e tests in GitHub CI using my own node instead of the ...
Discardo's user avatar
  • 382
2 votes
1 answer
92 views

What is this strange balance transfer that occurs during utility.batch?

I'm putting a single transaction into a batch utility call with zero value. The batch extrinsic is shown below. Each time I submit the batch transaction, a huge value is submitted to an unknown ...
forgetso's user avatar
  • 1,462
3 votes
1 answer
72 views

What's the difference between `paymentInfo` and `gasRequired`?

In polkadotJS there are two ways of getting gas estimates (specifically WeightV2) before you send a contract transaction. The first uses query and returns a gasRequired value in the result. const ...
forgetso's user avatar
  • 1,462
5 votes
2 answers
76 views

Is it possible to use ink! with Ethereum-style accounts?

Wondering if anyone knows whether ink! supports AccountIds which are ethereum-style accounts? Let's assume this would be a chain with a Unified Accounts setup, similar to Moonbeam. In specific, we ...
Justin Frevert's user avatar
0 votes
1 answer
27 views

Auto-upload Contracts To UI OR Pre-Populate Dropzone In Modal For Adding Contracts on Polkadot-JS/apps

We are using a clone of the Polkadot-JS/apps. Our users will need to have several contracts loaded to the UI in order to use the apps. We want our users to be able to add an existing contract to their ...
KathrynColleen's user avatar
1 vote
2 answers
155 views

StorageDepositLimitExhausted error when trying to deploy contract on Rococo

I got this error when I was trying to deploy my ink! smart contract on Rococo: **StorageDepositLimitExhausted More storage was created than allowed by the storage deposit limit.** What might be the ...
Julyp Julius's user avatar
1 vote
2 answers
98 views

How to fix Contract.outOfGas error

I'm trying to call a message on my ink! v3 smart contract using the polkadot-js ContractPromise but I'm getting the error: system.ExtrinsicFailed::ExtrinsicFailed:: contracts.OutOfGas This is how I'm ...
islami00's user avatar
  • 561
1 vote
2 answers
74 views

While executing contracts functions getting out of gas error

I have deployed a wasm smart contract on chain using version polkadot-v0.9.36, after deploying the contract when I tried to execute its function i got error out of gas as shown below. When I tried ...
Shubham Gupta's user avatar
2 votes
1 answer
48 views

Is it possible to prove that an account deployed contract A from within contract B without the account being stored in contract A?

Account A deploys Contract A. Account A then calls Contract B function register, passing the address of Contract A. Is it possible to prove that Account A deployed Contract A from within the register ...
forgetso's user avatar
  • 1,462
0 votes
1 answer
60 views

Is it possible to sign a message using the private key of a contract account?

For example, I have deployed an ink! contract via polkadot apps. Is it possible to obtain the private key of the contract account and sign an arbitrary message?
forgetso's user avatar
  • 1,462
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
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
50 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
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
2 votes
1 answer
63 views

How do I query the state of a contract at a given block number given the deprecation of contracts_getStorage?

The previous answer is now incorrect due to the deprecation of the RPCs. How do we query the historic contract state now? In the PR comment it states: The high level contracts API in polkadot.js ...
forgetso's user avatar
  • 1,462
2 votes
1 answer
151 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
0 votes
1 answer
157 views

How do we work with polkadot-js enums in TypeScript?

I used typegen to generate my types from definitions. Definition Person: { status: 'Status', balance: 'u128', }, Status: { _enum: ['Active',...
forgetso's user avatar
  • 1,462
2 votes
1 answer
48 views

The crate "pallet-contracts-rpc" does not exists for the branch "polkadot-v0.9.31". Is there any replacement?

Branch(polkadot-v0.9.31) https://github.com/paritytech/substrate/tree/polkadot-v0.9.31/frame/contracts Branch(polkadot-v0.9.30) https://github.com/paritytech/substrate/tree/polkadot-v0.9.30/frame/...
Evil Kyle's user avatar
  • 149
0 votes
1 answer
77 views

PSP34Mintable::mint() as payable function

I'm using PSP34 from openbrush in ink! contract and want to override mint() function that comes with PSP34Mintable trait. Since this contract should accept payments for the mint() call, a payable is ...
Maario's user avatar
  • 659
3 votes
1 answer
153 views

Error when compiling a contract using the XCM chain extension

I'm trying to implement this xcm chain extension mvp to send a XCM call from a simple contract. The problem i'm facing is when i try to compile the contract with the given Cargo.toml, i get the ...
Hector Bulgarini's user avatar
1 vote
1 answer
68 views

ERROR: Your wasm-opt version is 91, but we require a version >= 99

I am doing the prepare your first contract tutorial on subtrate and i am getting the following error ERROR: Your wasm-opt version is 91, but we require a version >= 99.Can anyone please tell me how ...
Vitthal agarwal's user avatar
0 votes
3 answers
179 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
1 vote
1 answer
27 views

AssemblyScript Contracts with Javascript Standard Library

I am trying to implement a non-Rust contract using WASM.. Can anyone provide an example, please, of a small contract which returns the balance of an account, completely written in TypeScript / ...
Smagula's user avatar
  • 11
3 votes
1 answer
165 views

Emiting events does not work with cross contract calling

When using cross contract calling on another contract which also emits events the events of the original contract do not work anymore. I get the following error. error[E0283]: type annotations needed ...
rajohs's user avatar
  • 491
2 votes
1 answer
27 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
1 vote
1 answer
248 views

How do I call the RPC method `contractInfoOf` using curl?

The docs state that the RPC comes with a few defaultRPCs and then links to polkadotJS documentation on the available API calls. This doesn't help me if I want to call a method using curl. Does anyone ...
forgetso's user avatar
  • 1,462
1 vote
2 answers
141 views

How do I get the code hash of a smart contract using Polkadot{.js} API?

I know polkadot{.js} has an API to access contract storage here: https://polkadot.js.org/docs/substrate/storage#contracts How do I get the code hash via the account?
Bruno's user avatar
  • 8,130
5 votes
1 answer
162 views

How to call runtime functions from a contract

A chain_extension is one way to call into the runtime from a smart contract on the contracts pallet. What other methods exist, and why might you use them instead of the extension pattern?
Bernardo Rodrigues's user avatar
5 votes
2 answers
101 views

Why can't I decode an extrinsic created with the contracts tab in Polkadot JS apps?

I am running the substrate-contracts-node and using the contracts UI to interact with it in Polkadot JS Apps. The contract call is failing when I try using the UI, although the same call works from a ...
extraymond's user avatar
6 votes
1 answer
343 views

How to get an ink! contract's AccountId in unit tests?

From what I understand from the docs, every contract gets its own AccountId. But in the contract-transfer tests, I'm getting the same AccountId from both accounts.alice and contract_id(). I modified ...
Kanishka's user avatar
  • 465
4 votes
2 answers
125 views

Correct way to use dynamic sized types in chain extension

I'm writing chain extensions for my pallets and I have a few functions that require dynamic sized types, for example Vec<u8> for metadata and Vec<u64> for a list of asset ids. The way I am ...
Gabe's user avatar
  • 115