Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initiate bonds for another address #8

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading