All Questions
Tagged with smart-contract testing
9 questions
0
votes
1
answer
20
views
Creation of a smart contract in contracts pallet
I need to create a smart contract using contracts pallet. I look at the source code of the contracts pallet and see:
pub fn upload_code(
origin: OriginFor<T>,
code: Vec<u8>,
...
0
votes
0
answers
12
views
How to call function with the same name but from different trait inside ink-e2e-test
Let's say I have the following impl of my Contract:
impl Contract{
#[ink(message)]
pub fn my_fun(&self);
}
impl MyTrait1 for Contract {
#[ink(message)]
pub fn my_fun(&self);
}
...
1
vote
0
answers
25
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&...
3
votes
1
answer
71
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, ...
2
votes
4
answers
109
views
ink-e2e: Metadata artifacts not generated when importing crate
Context:
I am trying to detach end-to-end tests from my main contract lib.rs. I created a new module in tests_e2e.rs.
I import the module in main contract like so:
lib.rs...vvv
#[cfg(all(test, feature ...
1
vote
1
answer
35
views
Constructor not found when testing smart contract
I am implementing a project using the directory structure proposed by openbrush.
The contract compiles without a problem, but when it comes to testing I run
into the following error:
error[E0599]: no ...
0
votes
1
answer
154
views
Best way to provide mock data for cross-contract calls
This question is more about best practices, and if there is a better method for providing mock data for off-chain ink! tests.
The goal is to use mock data for off-chain unit testing for ink! contracts....
1
vote
1
answer
49
views
How to change the caller of a method when testing smart contracts in rust?
I am implementing a smart contract according to the psp34 openbrush standard.
Now I want to do some testing.
I want to mint a token and then use it in some methods.
Some of the methods of my smart ...
1
vote
2
answers
59
views
Are there any tools available for creating a mock version of a contract in JS/TS?
Currently, we use "live" versions of our contracts running on a substrate contracts node in our JavaScript tests. This makes them integration tests and difficult to include in simple GitHub ...