ab_contracts_test_utils/
dummy_wallet.rs1#![allow(
2 unexpected_cfgs,
3 reason = "Intentionally not adding `guest` feature, this is a test utility not to be deployed"
4)]
5
6use ab_contracts_common::env::{Env, MethodContext, TransactionHeader};
7use ab_contracts_common::{Address, ContractError};
8use ab_contracts_io_type::trivial_type::TrivialType;
9use ab_contracts_macros::contract;
10use ab_contracts_standards::tx_handler::{
11 TxHandler, TxHandlerPayload, TxHandlerSeal, TxHandlerSlots,
12};
13use ab_system_contract_simple_wallet_base::SimpleWalletBaseExt;
14
15#[derive(Debug, Copy, Clone, TrivialType)]
16#[repr(C)]
17pub struct DummyWallet;
18
19#[contract]
20impl TxHandler for DummyWallet {
21 #[view]
22 fn authorize(
23 #[env] _env: &Env<'_>,
24 #[input] _header: &TransactionHeader,
25 #[input] _read_slots: &TxHandlerSlots,
26 #[input] _write_slots: &TxHandlerSlots,
27 #[input] _payload: &TxHandlerPayload,
28 #[input] _seal: &TxHandlerSeal,
29 ) -> Result<(), ContractError> {
30 Ok(())
32 }
33
34 #[update]
35 fn execute(
36 #[env] env: &mut Env<'_>,
37 #[input] header: &TransactionHeader,
38 #[input] read_slots: &TxHandlerSlots,
39 #[input] write_slots: &TxHandlerSlots,
40 #[input] payload: &TxHandlerPayload,
41 #[input] seal: &TxHandlerSeal,
42 ) -> Result<(), ContractError> {
43 env.simple_wallet_base_execute(
44 MethodContext::Replace,
45 Address::SYSTEM_SIMPLE_WALLET_BASE,
46 header,
47 read_slots,
48 write_slots,
49 payload,
50 seal,
51 )
52 }
53}
54
55#[contract]
56impl DummyWallet {}