ab_contracts_test_utils/
dummy_wallet.rs
1#![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::ContractError;
7use ab_contracts_common::env::{Env, MethodContext};
8use ab_contracts_macros::contract;
9use ab_contracts_standards::tx_handler::{
10 TxHandler, TxHandlerPayload, TxHandlerSeal, TxHandlerSlots,
11};
12use ab_core_primitives::address::Address;
13use ab_core_primitives::transaction::TransactionHeader;
14use ab_io_type::trivial_type::TrivialType;
15use ab_system_contract_simple_wallet_base::SimpleWalletBaseExt;
16
17#[derive(Debug, Copy, Clone, TrivialType)]
18#[repr(C)]
19pub struct DummyWallet;
20
21#[contract]
22impl TxHandler for DummyWallet {
23 #[view]
24 fn authorize(
25 #[env] _env: &Env<'_>,
26 #[input] _header: &TransactionHeader,
27 #[input] _read_slots: &TxHandlerSlots,
28 #[input] _write_slots: &TxHandlerSlots,
29 #[input] _payload: &TxHandlerPayload,
30 #[input] _seal: &TxHandlerSeal,
31 ) -> Result<(), ContractError> {
32 Ok(())
34 }
35
36 #[update]
37 fn execute(
38 #[env] env: &mut Env<'_>,
39 #[input] header: &TransactionHeader,
40 #[input] read_slots: &TxHandlerSlots,
41 #[input] write_slots: &TxHandlerSlots,
42 #[input] payload: &TxHandlerPayload,
43 #[input] seal: &TxHandlerSeal,
44 ) -> Result<(), ContractError> {
45 env.simple_wallet_base_execute(
46 MethodContext::Replace,
47 Address::SYSTEM_SIMPLE_WALLET_BASE,
48 header,
49 read_slots,
50 write_slots,
51 payload,
52 seal,
53 )
54 }
55}
56
57#[contract]
58impl DummyWallet {}