@@ -55,6 +55,72 @@ pub fn invoice_refunded(env: &Env, invoice_id: u64) {
5555 ) ;
5656}
5757
58+ /// Emitted when a release-condition preimage is verified.
59+ /// Topics: (split, cond_ok, invoice_id)
60+ /// Data: preimage_hash
61+ pub fn condition_verified ( env : & Env , invoice_id : u64 , preimage_hash : & BytesN < 32 > ) {
62+ env. events ( ) . publish (
63+ (
64+ symbol_short ! ( "split" ) ,
65+ symbol_short ! ( "cond_ok" ) ,
66+ invoice_id,
67+ ) ,
68+ preimage_hash. clone ( ) ,
69+ ) ;
70+ }
71+
72+ /// Emitted when an invoice expires.
73+ /// Topics: (split, expired, invoice_id)
74+ /// Data: (deadline, funded)
75+ pub fn invoice_expired ( env : & Env , invoice_id : u64 , deadline : u64 , funded : i128 ) {
76+ env. events ( ) . publish (
77+ (
78+ symbol_short ! ( "split" ) ,
79+ symbol_short ! ( "expired" ) ,
80+ invoice_id,
81+ ) ,
82+ ( deadline, funded) ,
83+ ) ;
84+ }
85+
86+ /// Emitted when a recipient is added to an invoice whitelist.
87+ /// Topics: (split, rcp_wl, invoice_id)
88+ /// Data: address
89+ pub fn recipient_whitelisted ( env : & Env , invoice_id : u64 , address : & Address ) {
90+ env. events ( ) . publish (
91+ (
92+ symbol_short ! ( "split" ) ,
93+ symbol_short ! ( "rcp_wl" ) ,
94+ invoice_id,
95+ ) ,
96+ address. clone ( ) ,
97+ ) ;
98+ }
99+
100+ /// Emitted when a recipient is removed from an invoice whitelist.
101+ /// Topics: (split, rcp_rl, invoice_id)
102+ /// Data: address
103+ pub fn recipient_removed_from_whitelist ( env : & Env , invoice_id : u64 , address : & Address ) {
104+ env. events ( ) . publish (
105+ (
106+ symbol_short ! ( "split" ) ,
107+ symbol_short ! ( "rcp_rl" ) ,
108+ invoice_id,
109+ ) ,
110+ address. clone ( ) ,
111+ ) ;
112+ }
113+
114+ /// Emitted when rebate is accrued for a creator.
115+ /// Topics: (split, rbt_acr, creator)
116+ /// Data: (amount, tier_bps)
117+ pub fn rebate_accrued ( env : & Env , creator : & Address , amount : i128 , tier_bps : u32 ) {
118+ env. events ( ) . publish (
119+ ( symbol_short ! ( "split" ) , symbol_short ! ( "rbt_acr" ) , creator. clone ( ) ) ,
120+ ( amount, tier_bps) ,
121+ ) ;
122+ }
123+
58124/// Emitted once per payer when their refund is transferred.
59125/// Topics: (split, pay_ref, invoice_id)
60126/// Data: (payer, amount)
@@ -487,12 +553,14 @@ pub fn invoice_state_changed(
487553 Some ( InvoiceStatus :: Pending ) => symbol_short ! ( "pending" ) ,
488554 Some ( InvoiceStatus :: Released ) => symbol_short ! ( "released" ) ,
489555 Some ( InvoiceStatus :: Refunded ) => symbol_short ! ( "refunded" ) ,
556+ Some ( InvoiceStatus :: Expired ) => symbol_short ! ( "expired" ) ,
490557 Some ( InvoiceStatus :: Cancelled ) => symbol_short ! ( "cancld" ) ,
491558 } ;
492559 let to_sym = match to_status {
493560 InvoiceStatus :: Pending => symbol_short ! ( "pending" ) ,
494561 InvoiceStatus :: Released => symbol_short ! ( "released" ) ,
495562 InvoiceStatus :: Refunded => symbol_short ! ( "refunded" ) ,
563+ InvoiceStatus :: Expired => symbol_short ! ( "expired" ) ,
496564 InvoiceStatus :: Cancelled => symbol_short ! ( "cancld" ) ,
497565 } ;
498566 env. events ( ) . publish (
0 commit comments