Skip to content

Commit

Permalink
feat(storage): remove address index on pins state
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Mar 3, 2023
1 parent 3f26651 commit 05e07ec
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions contracts/cw-storage/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ pub struct Pin {

pub struct PinIndexes<'a> {
pub object: MultiIndex<'a, String, Pin, (String, Addr)>,
pub address: MultiIndex<'a, Addr, Pin, (String, Addr)>,
}

impl IndexList<Pin> for PinIndexes<'_> {
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<Pin>> + '_> {
Box::new(vec![&self.object as &dyn Index<Pin>, &self.address].into_iter())
Box::new(vec![&self.object as &dyn Index<Pin>].into_iter())
}
}

Expand All @@ -113,7 +112,6 @@ pub fn pins<'a>() -> IndexedMap<'a, (String, Addr), Pin, PinIndexes<'a>> {
"PIN",
PinIndexes {
object: MultiIndex::new(|_, pin| pin.id.clone(), "PIN", "PIN__OBJECT"),
address: MultiIndex::new(|_, pin| pin.address.clone(), "PIN", "PIN__ADDRESS"),
},
)
}

0 comments on commit 05e07ec

Please sign in to comment.