Ii am getting this error when running the tests:
running 1 test
test can_get_contract_id ... FAILED
failures:
---- can_get_contract_id stdout ----
thread 'can_get_contract_id' panicked at 'called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "Revert(0)", revert_id: 0, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: c193c4a7e19cbd4a29179f7e589d8dde6069186385ebf418f6decfd9e7107e26, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 1000000, param1: 1480782270, param2: 1, pc: 11624, is: 11624 }, Revert { id: c193c4a7e19cbd4a29179f7e589d8dde6069186385ebf418f6decfd9e7107e26, ra: 0, pc: 12172, is: 11624 }, ScriptResult { result: Revert, gas_used: 355 }] }', tests/harness.rs:40:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
can_get_contract_id
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.26s```
in this link there is a discussion for the same problem, but that doesn't work for me:
https://forum.fuel.network/t/mismatched-types-storagekey-u64/2498/13
my contract:
contract;
storage{
counter: u64 = 0,
}
abi Counter {
#[storage(read, write)]
fn increment();
#[storage(read)]
fn count() -> u64;
}
impl Counter for Contract {
#[storage(read)]
fn count() → u64 {
storage.counter.try_read().unwrap_or(0)
}
#[storage(read, write)]
fn increment() {
storage.counter.write(storage.counter.try_read().unwrap_or(0) + 1)
}
}
my test:
#[tokio::test]
async fn can_get_contract_id() {
let (instance, _id) = get_contract_instance().await;
// Increment the counter
instance.methods().increment().call().await.unwrap();
// Get the current value of the counter
let result = instance.methods().count().call().await.unwrap();
// Check that the current value of the counter is 1.
// Recall that the initial value of the counter was 0.
assert_eq!(result.value, 1);
// Now you have an instance of your contract you can use to test each function
}