1use alloy::{primitives::Log, sol_types::SolEvent};
2use signet_extract::ExtractedEvent;
3use signet_zenith::{Transactor, MINTER_ADDRESS};
4
5alloy::sol! {
6 event MintNative(
7 bytes32 indexed txHash,
8 uint64 indexed logIndex,
9 address indexed recipient,
10 uint256 amount,
11 );
12
13 event MintToken(
14 bytes32 indexed txHash,
15 uint64 indexed logIndex,
16 address indexed recipient,
17 address hostToken,
18 uint256 amount,
19 );
20
21 event Transact(
22 bytes32 indexed txHash,
23 uint64 indexed logIndex,
24 address indexed sender,
25 uint256 value,
26 uint256 gas,
27 uint256 maxFeePerGas,
28 );
29}
30
31impl From<MintNative> for Log {
32 fn from(value: MintNative) -> Self {
33 Log { address: MINTER_ADDRESS, data: value.encode_log_data() }
34 }
35}
36
37impl From<MintToken> for Log {
38 fn from(value: MintToken) -> Self {
39 Log { address: MINTER_ADDRESS, data: value.encode_log_data() }
40 }
41}
42
43impl From<Transact> for Log {
44 fn from(value: Transact) -> Self {
45 Log { address: MINTER_ADDRESS, data: value.encode_log_data() }
46 }
47}
48
49impl<R> From<&ExtractedEvent<'_, R, Transactor::Transact>> for Transact {
50 fn from(event: &ExtractedEvent<'_, R, Transactor::Transact>) -> Self {
51 Transact {
52 sender: event.event.sender,
53 txHash: event.tx_hash(),
54 logIndex: event.log_index as u64,
55 value: event.value(),
56 gas: event.event.gas,
57 maxFeePerGas: event.event.maxFeePerGas,
58 }
59 }
60}