Skip to content

Commit

Permalink
Merge pull request #8 from Itheum/initiateBond
Browse files Browse the repository at this point in the history
feat: initiate bonds for another address
  • Loading branch information
damienen authored Mar 15, 2024
2 parents 0847323 + e079275 commit 02cc0b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 02cc0b4

Please sign in to comment.