@@ -18,7 +18,7 @@ mod events;
1818mod test;
1919
2020use soroban_sdk:: token:: TokenInterface ;
21- use soroban_sdk:: { contract, contractimpl, contracttype, Address , Env , String } ;
21+ use soroban_sdk:: { contract, contractimpl, contracttype, Address , BytesN , Env , String } ;
2222
2323/// Storage keys for the token contract state.
2424#[ derive( Clone ) ]
@@ -214,10 +214,47 @@ impl BcForgeToken {
214214 events:: emit_unpaused ( & env, & admin) ;
215215 }
216216
217+ /// Upgrades the contract to a new WASM hash. Admin-only.
218+ pub fn upgrade ( env : Env , new_wasm_hash : BytesN < 32 > ) {
219+ let admin = Self :: read_admin ( & env) ;
220+ admin. require_auth ( ) ;
221+
222+ env. deployer ( ) . update_current_contract_wasm ( new_wasm_hash. clone ( ) ) ;
223+ events:: emit_upgrade ( & env, & admin, & new_wasm_hash) ;
224+ }
225+
217226 /// Returns the contract version.
218227 pub fn version ( env : Env ) -> String {
219228 String :: from_str ( & env, "1.0.0" )
220229 }
230+
231+ /// Updates the token name. Admin-only.
232+ pub fn update_name ( env : Env , new_name : String ) {
233+ let admin = Self :: read_admin ( & env) ;
234+ admin. require_auth ( ) ;
235+
236+ let old_name = env. storage ( )
237+ . instance ( )
238+ . get ( & DataKey :: Name )
239+ . unwrap_or_else ( || String :: from_str ( & env, "bc-forge" ) ) ;
240+
241+ env. storage ( ) . instance ( ) . set ( & DataKey :: Name , & new_name) ;
242+ events:: emit_update_name ( & env, & admin, & old_name, & new_name) ;
243+ }
244+
245+ /// Updates the token symbol. Admin-only.
246+ pub fn update_symbol ( env : Env , new_symbol : String ) {
247+ let admin = Self :: read_admin ( & env) ;
248+ admin. require_auth ( ) ;
249+
250+ let old_symbol = env. storage ( )
251+ . instance ( )
252+ . get ( & DataKey :: Symbol )
253+ . unwrap_or_else ( || String :: from_str ( & env, "SFG" ) ) ;
254+
255+ env. storage ( ) . instance ( ) . set ( & DataKey :: Symbol , & new_symbol) ;
256+ events:: emit_update_symbol ( & env, & admin, & old_symbol, & new_symbol) ;
257+ }
221258}
222259
223260// ─────────────────────────────────────────────────────────────────────────────
0 commit comments