Skip to content

Commit

Permalink
feat: add_pools
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyRo1 committed Oct 25, 2024
1 parent a25d926 commit faf80d5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 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,28 @@ 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 faf80d5

Please sign in to comment.