Skip to content

Commit

Permalink
feat: Lp Pricer - add_pools (#128)
Browse files Browse the repository at this point in the history
* feat: add_pools

* fix: format code
  • Loading branch information
JordyRo1 authored Oct 25, 2024
1 parent a25d926 commit dbaeadd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/lp_pricer/lp_pricer.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ trait ILpPricer<TContractState> {

/// Register a pool into the supported list.
fn add_pool(ref self: TContractState, pool_address: ContractAddress);

/// Register multiple pools into the supported list.
fn add_pools(ref self: TContractState, pool_addresses: Span<ContractAddress>);

/// Removes a pool from the supported list.
fn remove_pool(ref self: TContractState, pool_address: ContractAddress);
/// Retrieves information about a Pool, i.e its name, the symbol, the address, the
Expand Down Expand Up @@ -201,6 +205,26 @@ mod LpPricer {
);
}

/// Register multiple pool into the supported list.
///
/// Can only be called by the admin.
fn add_pools(ref self: ContractState, pool_addresses: Span<ContractAddress>) {
// [Check] Only admin
assert_only_admin();

// [Effect] Add pools to the storage
let mut cur_idx = 0;
loop {
if (cur_idx == pool_addresses.len()) {
break;
}
let pool = *pool_addresses.at(cur_idx);
self.add_pool(pool);
cur_idx += 1;
}
}


/// Removes a pool from the supported list.
///
/// Can only be called by the admin.
Expand Down

0 comments on commit dbaeadd

Please sign in to comment.