11use crate :: components:: {
22 admin as admin_component, core as core_component, invoice as invoice_component,
3- merchant as merchant_component,
3+ merchant as merchant_component, pausable as pausable_component ,
44} ;
55use crate :: errors:: ContractError ;
66use crate :: events;
77use crate :: interface:: ShadeTrait ;
8- use crate :: types:: { ContractInfo , DataKey , Invoice , Merchant } ;
9- use soroban_sdk:: { contract, contractimpl, panic_with_error, Address , Env , String } ;
8+ use crate :: types:: { ContractInfo , DataKey , Invoice , InvoiceFilter , Merchant , MerchantFilter } ;
9+ use soroban_sdk:: { contract, contractimpl, panic_with_error, Address , Env , String , Vec } ;
1010
1111#[ contract]
1212pub struct Shade ;
@@ -32,10 +32,12 @@ impl ShadeTrait for Shade {
3232 }
3333
3434 fn add_accepted_token ( env : Env , admin : Address , token : Address ) {
35+ pausable_component:: assert_not_paused ( & env) ;
3536 admin_component:: add_accepted_token ( & env, & admin, & token) ;
3637 }
3738
3839 fn remove_accepted_token ( env : Env , admin : Address , token : Address ) {
40+ pausable_component:: assert_not_paused ( & env) ;
3941 admin_component:: remove_accepted_token ( & env, & admin, & token) ;
4042 }
4143
@@ -44,13 +46,18 @@ impl ShadeTrait for Shade {
4446 }
4547
4648 fn register_merchant ( env : Env , merchant : Address ) {
49+ pausable_component:: assert_not_paused ( & env) ;
4750 merchant_component:: register_merchant ( & env, & merchant) ;
4851 }
4952
5053 fn get_merchant ( env : Env , merchant_id : u64 ) -> Merchant {
5154 merchant_component:: get_merchant ( & env, merchant_id)
5255 }
5356
57+ fn get_merchants ( env : Env , filter : MerchantFilter ) -> Vec < Merchant > {
58+ merchant_component:: get_merchants ( & env, filter)
59+ }
60+
5461 fn is_merchant ( env : Env , merchant : Address ) -> bool {
5562 merchant_component:: is_merchant ( & env, & merchant)
5663 }
@@ -62,10 +69,27 @@ impl ShadeTrait for Shade {
6269 amount : i128 ,
6370 token : Address ,
6471 ) -> u64 {
72+ pausable_component:: assert_not_paused ( & env) ;
6573 invoice_component:: create_invoice ( & env, & merchant, & description, amount, & token)
6674 }
6775
6876 fn get_invoice ( env : Env , invoice_id : u64 ) -> Invoice {
6977 invoice_component:: get_invoice ( & env, invoice_id)
7078 }
79+
80+ fn get_invoices ( env : Env , filter : InvoiceFilter ) -> Vec < Invoice > {
81+ invoice_component:: get_invoices ( & env, filter)
82+ }
83+
84+ fn pause ( env : Env , admin : Address ) {
85+ pausable_component:: pause ( & env, & admin) ;
86+ }
87+
88+ fn unpause ( env : Env , admin : Address ) {
89+ pausable_component:: unpause ( & env, & admin) ;
90+ }
91+
92+ fn is_paused ( env : Env ) -> bool {
93+ pausable_component:: is_paused ( & env)
94+ }
7195}
0 commit comments