diff --git a/src/admin.rs b/src/admin.rs index 8a817ea..05db018 100644 --- a/src/admin.rs +++ b/src/admin.rs @@ -20,6 +20,22 @@ multiversx_sc::derive_imports!(); pub trait AdminModule: crate::config::ConfigModule + storage::StorageModule + events::EventsModule { + #[endpoint(initiateBond)] + fn initiate_bond_for_address( + &self, + address: ManagedAddress, + token_identifier: TokenIdentifier, + nonce: u64, + ) { + only_privileged!(self, ERR_NOT_PRIVILEGED); + + let bond_id = self + .bonds_ids() + .get_id_or_insert((token_identifier.clone(), nonce)); + + self.address_bonds(&address).insert(bond_id); + } + #[endpoint(setBlacklist)] fn add_to_black_list( &self, diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index c2ae1d2..3e55911 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -5,9 +5,9 @@ //////////////////////////////////////////////////// // Init: 1 -// Endpoints: 46 +// Endpoints: 47 // Async Callback (empty): 1 -// Total number of exported functions: 48 +// Total number of exported functions: 49 #![no_std] #![allow(internal_features)] @@ -41,6 +41,7 @@ multiversx_sc_wasm_adapter::endpoints! { getCompensationsLen => get_compensations_len getLockPeriodsBonds => get_lock_periods_bonds getContractConfiguration => get_contract_configuration + initiateBond => initiate_bond_for_address setBlacklist => add_to_black_list removeBlacklist => remove_from_black_list initiateRefund => initiate_refund