Questions tagged [smart-contract]
Everything smart contract related, either WASM or EVM based.
27
questions with no upvoted or accepted answers
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?
3
votes
0
answers
28
views
Is there a way to instantiate a contract from code_hash without ContractRef
From the documentation, we have 2 ways of instantiating a contract from a code_hash, but both require a ContractRef.
In order to obtain ContractRef we have to import the contract crate as a dependency ...
3
votes
0
answers
57
views
Can we define ink_e2e tests outside of contracts module?
devs. I am writing the e2e tests for my smart contracts using ink_e2e
In contracts, I define the e2e-tests like this.
#[openbrush::contract]
pub mod controller {
...
#[cfg(all(test, ...
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 ...
3
votes
0
answers
29
views
How can I use complex structure in ink! version3
how can i use the complex structure(like Mapping<String, Vec<Map<String, String>>>) in ink!
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
#[ink::...
3
votes
0
answers
30
views
How to migrate / backup & restore ink smart contract storage?
Is there a way to backup ink smart contract storage and later restore on another chain? Lets say we have chain with 3 validators and deployed smart contract containing certain information in its ...
2
votes
0
answers
17
views
How can I mint new token from ink smart contract calling pallet-balances function?
How can I mint a new native token (not a custom token) from the ink smart contract calling one of the functions from pallet-balances pallet?
2
votes
0
answers
37
views
How to upload the same ink! smart contract to a different code hash?
I've written this ink! quickstart script that I can repeatedly call to run these steps to flood my local testnet with instances of Flipper contracts:
Kills an existing substrate-contracts-node ...
2
votes
0
answers
29
views
Error Type { registry: TypeRegistry {}, initialU8aLength: 6 } when try to query ink! smart contract by @polkadotjs/api-contract
My code:
const main = async() => {
//Get wasm
// This file wasm I already build through "cargo contract build"
let wasm = fs.readFileSync("../../res/incrementer.wasm&...
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 ...
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 ...
1
vote
1
answer
23
views
How to send fix amount of balance to contract address
I'm working on a smart contract where I need to send a balance from a user account to the contract address. The amount to be sent is fixed and hardcoded in the contract. I have tried to figure out ...
1
vote
0
answers
14
views
"ContractTrapped" Error even with successful cross-contract call
let result_call = ink::env::call::build_call::<Environment>()
.call(self.escrow_address)
.gas_limit(0)
.transferred_value(0)
...
1
vote
0
answers
40
views
What could be the reason for my contract throwing "ContractTrapped"? Other cross contract calls are successful, but not in this code
The force_vote function in voting contract places a call to a different contract easily, but when I want to get some data from the other contract as well, it fails. Similarly in the function where the ...
1
vote
0
answers
19
views
error build_call
#[ink(message)]
pub fn get_flip2_buill_call(&mut self, token_contract_address: AccountId, account_id: AccountId )-> i32 {
let my_return_value = build_call::<DefaultEnvironment>()
...
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 ...
1
vote
1
answer
26
views
I'm trying to access another contract's struct X in my contract. It is throwing error: panicked at 'Cross-contract call failed with Decode(Error)'
#![cfg_attr(not(feature = "std"), no_std, no_main)]
#[ink::contract]
mod arm {
use ink::prelude::vec::Vec;
#[derive(scale::Decode, scale::Encode)]
#[cfg_attr(
feature = ...
1
vote
0
answers
22
views
How to resolve "mismatched types" error while ink_e2e test : expected String, found Vec<u8>
I am working with ink_e2e testing framework in ink smart contract, and I have encountered an error message that's a bit confusing. The error says: mismatched types - expected String, found Vec<u8&...
0
votes
0
answers
15
views
How to do cross contract e2e tests on ink?
I have made a contract in ink! that build fine, and I am trying to make e2e tests. I don't manage to do this even by using the examples in ink! repertory.
My contract is a swap contract: it takes the ...
0
votes
0
answers
10
views
How to test smart contract timestamp dependent behavior?
how can I test block_timestamp-dependent smart contract behavior?
The substrate contact node doesn't allow block_timestamp manipulations.
For context, in the EVM ecosystem, one can use hardhat helpers ...
0
votes
0
answers
20
views
Encountering Error "Encountered Unknown Ink! attribute argument: path" in Ink! Smart Contract
I am working on an Ink! smart contract in Rust, and I've encountered an error that I'm having trouble resolving. I followed a solution from a source [provide link here if applicable], but the problem ...
0
votes
0
answers
18
views
Could not decode `ContractInfo::storage_item_deposit
When I am doing runtime-upgrade from polkadot-v0.9.38 to polkadot-v0.9.39 .I am getting one issue of smart contract in my terminal
2023-09-18 11:36:25 Corrupted state at `[67, 66, 25, 62, 73, 111, ...
0
votes
0
answers
44
views
Unable to verify WASM contract in Substrate Astar
I'm encountering difficulties while attempting to verify my WASM smart contract through Astar's Subscan tool. Despite multiple attempts using various options, the verification process remains ...
0
votes
0
answers
22
views
Selling token to any third party tools
When user stake his NFT, then he earns certain amount of $EGGS token which is in-game currency. He can to sell those token to third party tools. How to implement selling token to any third party tools ...
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 ...
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 ...
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 ...