levana_perpswap_cosmos/contracts/faucet/
events.rs1use super::entry::FaucetAsset;
2use crate::prelude::*;
3use cosmwasm_std::Addr;
4
5pub struct TapEvent {
6 pub recipient: Addr,
7 pub amount: Number,
8 pub asset: FaucetAsset,
9}
10
11impl From<TapEvent> for cosmwasm_std::Event {
12 fn from(src: TapEvent) -> Self {
13 let evt = cosmwasm_std::Event::new("faucet-tap").add_attributes(vec![
14 ("recipient", src.recipient.to_string()),
15 ("amount", src.amount.to_string()),
16 ]);
17
18 match src.asset {
19 FaucetAsset::Cw20(addr) => {
20 evt.add_attributes(vec![("asset-kind", "cw20"), ("asset-addr", addr.as_str())])
21 }
22 FaucetAsset::Native(denom) => {
23 evt.add_attributes(vec![("asset-kind", "native"), ("asset-denom", &denom)])
24 }
25 }
26 }
27}