Skip to main content

o2_tools/
test_contracts.rs

1use fuels::{
2    accounts::{
3        signers::private_key::PrivateKeySigner,
4        wallet::{
5            Unlocked,
6            Wallet,
7        },
8    },
9    macros::abigen,
10    programs::contract::Contract,
11    types::{
12        ContractId,
13        Salt,
14        transaction::TxPolicies,
15    },
16};
17
18abigen!(Contract(
19    name = "LargeContract",
20    abi = "artifacts/test_artifacts/large_contract-abi.json"
21));
22pub const LARGE_CONTRACT_BYTECODE: &[u8] =
23    include_bytes!("../artifacts/test_artifacts/large_contract.bin");
24
25pub async fn setup_large_contract(
26    wallet: &Wallet<Unlocked<PrivateKeySigner>>,
27) -> (
28    LargeContract<Wallet<Unlocked<PrivateKeySigner>>>,
29    ContractId,
30) {
31    let id = Contract::regular(LARGE_CONTRACT_BYTECODE.to_vec(), Salt::default(), vec![])
32        .deploy(wallet, TxPolicies::default())
33        .await
34        .unwrap()
35        .contract_id;
36
37    let instance = LargeContract::new(id, wallet.clone());
38
39    (instance, id)
40}