Hey guys!
The problem is that if I add some types to the storage, then my abigen
crashes with an error like parameter 'V' is never used
src/main.sw
contract;
use std::{storage::StorageVec};
abi MyContract {
fn name() -> StorageVec<u8>;
fn set_name(name: StorageVec<u8>);
}
storage {
name: StorageVec<u8> = StorageVec {},
}
impl MyContract for Contract {
fn name() -> StorageVec<u8> {
storage.name
}
fn set_name(name: StorageVec<u8>) {}
// storage.name = name; // TODO: implement set_name
}
tests/harness.rs
use fuels::{prelude::*, tx::ContractId};
abigen!(MyContract, "out/debug/name_contract-abi.json");
async fn get_contract_instance() -> (MyContract, ContractId) {
let mut wallets = launch_custom_provider_and_get_wallets(
WalletsConfig::new(Some(1), Some(1), Some(1_000_000_000)),
None,
None,
)
.await;
let wallet = wallets.pop().unwrap();
let id = Contract::deploy(
"./out/debug/name_contract.bin",
&wallet,
TxParameters::default(),
StorageConfiguration::with_storage_path(Some(
"./out/debug/name_contract-storage_slots.json".to_string(),
)),
)
.await
.unwrap();
let instance = MyContract::new(id.clone(), wallet);
(instance, id.into())
}
#[tokio::test]
async fn can_get_contract_id() {
let (_instance, _id) = get_contract_instance().await;
}
The error
error[E0392]: parameter `V` is never used
--> tests/harness.rs:3:1
|
3 | abigen!(MyContract, "out/debug/name_contract-abi.json");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused parameter
|
= help: consider removing `V`, referring to it in a field, or using a marker such as `PhantomData`
= note: this error originates in the macro `abigen` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0392`.
error: could not compile `name-contract` due to previous error