Not enough resources to fit the target

Getting

thread 'can_get_contract_id' panicked at 'called `Result::unwrap()` on an `Err` value: ProviderError("Provider error: Response errors; not enough resources to fit the target")', packages/voting_vault/tests/harness.rs:46:6

when deploying a contract.


// Load abi from json
abigen!(
    Contract(
        name = "VotingVault",
        abi = "packages/voting_vault/out/debug/voting_vault-abi.json"
    ),
);

pub const TOKEN_A: AssetId = AssetId::new([1u8; 32]);

async fn get_wallets() -> Vec<WalletUnlocked> {
    let assets = vec![AssetConfig {
        id: TOKEN_A,
        num_coins: 1,
        coin_amount:  10_000_000_000 * 10u64.pow(9),
    }];
    let wallet_config = WalletsConfig::new_multiple_assets(1, assets);
    let wallets = launch_custom_provider_and_get_wallets(wallet_config, None, None).await;
    wallets
}

async fn setup() {
    let mut wallets = get_wallets().await;
    let wallet = wallets.pop().unwrap();

    let voting_vault_id = Contract::deploy(
        "./out/debug/voting_vault.bin",
        &wallet,
        DeployConfiguration::default()
    )
    .await
    .unwrap();

    println!("Contract deployed @ {voting_vault_id}");
}
zzz

The wallet that deploys must be funded with some of the base asset as well (0 address). If you change AssetId::new([1u8; 32]) to AssetId::new([0u8; 32]) it should work.

1 Like