diff --git a/listings/applications/crowdfunding/src/campaign.cairo b/listings/applications/crowdfunding/src/campaign.cairo index 2ab3f9fb..e5b5faf6 100644 --- a/listings/applications/crowdfunding/src/campaign.cairo +++ b/listings/applications/crowdfunding/src/campaign.cairo @@ -243,7 +243,7 @@ pub mod Campaign { } fn get_pledgers(self: @ContractState) -> Array { - self.pledges.get_pledgers_as_arr() + self.pledges.array() } fn pledge(ref self: ContractState, amount: u256) { @@ -339,7 +339,7 @@ pub mod Campaign { } fn _refund_all(ref self: ContractState, reason: ByteArray) { - let mut pledges = self.pledges.get_pledgers_as_arr(); + let mut pledges = self.pledges.array(); while let Option::Some(pledger) = pledges.pop_front() { self._refund(pledger); }; diff --git a/listings/applications/crowdfunding/src/campaign/pledgeable.cairo b/listings/applications/crowdfunding/src/campaign/pledgeable.cairo index 2e74d1a0..4000057a 100644 --- a/listings/applications/crowdfunding/src/campaign/pledgeable.cairo +++ b/listings/applications/crowdfunding/src/campaign/pledgeable.cairo @@ -6,7 +6,7 @@ pub trait IPledgeable { fn add(ref self: TContractState, pledger: ContractAddress, amount: u256); fn get(self: @TContractState, pledger: ContractAddress) -> u256; fn get_pledger_count(self: @TContractState) -> u32; - fn get_pledgers_as_arr(self: @TContractState) -> Array; + fn array(self: @TContractState) -> Array; fn get_total(self: @TContractState) -> u256; fn remove(ref self: TContractState, pledger: ContractAddress) -> u256; } @@ -58,7 +58,7 @@ pub mod pledgeable_component { self.pledger_count.read() } - fn get_pledgers_as_arr(self: @ComponentState) -> Array { + fn array(self: @ComponentState) -> Array { let mut result = array![]; let mut index = self.pledger_count.read(); @@ -485,7 +485,7 @@ mod tests { } #[test] - fn test_get_pledgers_as_arr() { + fn test_array() { let mut pledgeable: TestingState = Default::default(); let pledger_1 = contract_address_const::<'pledger_1'>(); let pledger_2 = contract_address_const::<'pledger_2'>(); @@ -497,7 +497,7 @@ mod tests { // 2nd pledge by pledger_2 *should not* increase the pledge count pledgeable.add(pledger_2, 1500); - let pledgers_arr = pledgeable.get_pledgers_as_arr(); + let pledgers_arr = pledgeable.array(); assert_eq!(pledgers_arr.len(), 3); assert_eq!(pledger_3, *pledgers_arr[0]); @@ -509,7 +509,7 @@ mod tests { } #[test] - fn test_get_pledgers_as_arr_1000_pledgers() { + fn test_array_1000_pledgers() { let mut pledgeable: TestingState = Default::default(); // set up 1000 pledgers @@ -523,7 +523,7 @@ mod tests { i -= 1; }; - let pledgers_arr: Array:: = pledgeable.get_pledgers_as_arr(); + let pledgers_arr: Array:: = pledgeable.array(); assert_eq!(pledgers_arr.len(), pledgers.len()); diff --git a/listings/applications/crowdfunding/src/mock_upgrade.cairo b/listings/applications/crowdfunding/src/mock_upgrade.cairo index c1be549e..33348d16 100644 --- a/listings/applications/crowdfunding/src/mock_upgrade.cairo +++ b/listings/applications/crowdfunding/src/mock_upgrade.cairo @@ -184,7 +184,7 @@ pub mod MockUpgrade { } fn get_pledgers(self: @ContractState) -> Array { - self.pledges.get_pledgers_as_arr() + self.pledges.array() } fn pledge(ref self: ContractState, amount: u256) { @@ -279,7 +279,7 @@ pub mod MockUpgrade { } fn _refund_all(ref self: ContractState, reason: ByteArray) { - let mut pledges = self.pledges.get_pledgers_as_arr(); + let mut pledges = self.pledges.array(); while let Option::Some(pledger) = pledges.pop_front() { self._refund(pledger); };