@@ -15,7 +15,19 @@ const KEY_INIT: &str = "init";
1515
1616const KEY_OWNER : & str = "owner" ;
1717
18-
18+ /// Initializes the contract, setting the owner and dependent contract addresses.
19+ /// This function can only be called once. It sets an initialization flag to prevent re-runs.
20+ ///
21+ /// # Arguments
22+ ///
23+ /// * `env` - The Soroban environment object.
24+ /// * `caller` - The address of the contract initializer, who will be set as the owner.
25+ /// * `user_mgmt_addr` - The address of the User Management contract.
26+ /// * `course_registry_addr` - The address of the Course Registry contract.
27+ ///
28+ /// # Panics
29+ ///
30+ /// * This function will call `handle_error` with `Error::Initialized` if the contract has already been initialized.
1931pub fn initialize (
2032 env : Env ,
2133 caller : Address ,
@@ -44,7 +56,20 @@ pub fn initialize(
4456 . publish ( ( INIT_EVENT , ) , ( caller, user_mgmt_addr, course_registry_addr) ) ;
4557}
4658
47-
59+ /// Updates the addresses of the User Management and Course Registry contracts.
60+ /// This function can only be called by the contract owner.
61+ ///
62+ /// # Arguments
63+ ///
64+ /// * `env` - The Soroban environment object.
65+ /// * `caller` - The address of the caller. Must be the current owner of the contract.
66+ /// * `user_mgmt_addr` - The new address for the User Management contract.
67+ /// * `course_registry_addr` - The new address for the Course Registry contract.
68+ ///
69+ /// # Panics
70+ ///
71+ /// * This function will panic with the message "not initialized" if the contract has not been initialized.
72+ /// * This function will panic with the message "only owner" if the caller is not the owner.
4873pub fn set_contract_addrs (
4974 env : Env ,
5075 caller : Address ,
0 commit comments