55//! controlled token transfers by an admin who can allow or disallow specific
66//! accounts.
77
8- use soroban_sdk:: { contract, contractimpl, symbol_short, Address , Env , String } ;
8+ use soroban_sdk:: {
9+ contract, contractimpl, symbol_short, Address , Env , MuxedAddress , String , Symbol , Vec ,
10+ } ;
911use stellar_access:: access_control:: { self as access_control, AccessControl } ;
10- use stellar_macros:: { default_impl , only_role} ;
12+ use stellar_macros:: only_role;
1113use stellar_tokens:: fungible:: {
1214 allowlist:: { AllowList , FungibleAllowList } ,
1315 burnable:: FungibleBurnable ,
@@ -19,18 +21,20 @@ pub struct ExampleContract;
1921
2022#[ contractimpl]
2123impl ExampleContract {
22- pub fn __constructor ( e : & Env , admin : Address , manager : Address , initial_supply : i128 ) {
23- Base :: set_metadata (
24- e,
25- 18 ,
26- String :: from_str ( e, "AllowList Token" ) ,
27- String :: from_str ( e, "ALT" ) ,
28- ) ;
24+ pub fn __constructor (
25+ e : & Env ,
26+ name : String ,
27+ symbol : String ,
28+ admin : Address ,
29+ manager : Address ,
30+ initial_supply : i128 ,
31+ ) {
32+ Base :: set_metadata ( e, 18 , name, symbol) ;
2933
3034 access_control:: set_admin ( e, & admin) ;
3135
3236 // create a role "manager" and grant it to `manager`
33- access_control:: grant_role_no_auth ( e, & admin , & manager, & symbol_short ! ( "manager" ) ) ;
37+ access_control:: grant_role_no_auth ( e, & manager, & symbol_short ! ( "manager" ) , & admin ) ;
3438
3539 // Allow the admin to transfer tokens
3640 AllowList :: allow_user ( e, & admin) ;
@@ -40,8 +44,7 @@ impl ExampleContract {
4044 }
4145}
4246
43- #[ default_impl]
44- #[ contractimpl]
47+ #[ contractimpl( contracttrait) ]
4548impl FungibleToken for ExampleContract {
4649 type ContractType = AllowList ;
4750}
@@ -62,10 +65,8 @@ impl FungibleAllowList for ExampleContract {
6265 }
6366}
6467
65- #[ default_impl]
66- #[ contractimpl]
68+ #[ contractimpl( contracttrait) ]
6769impl AccessControl for ExampleContract { }
6870
69- #[ default_impl]
70- #[ contractimpl]
71+ #[ contractimpl( contracttrait) ]
7172impl FungibleBurnable for ExampleContract { }
0 commit comments