osmosis-labs / osmosis-rust

Rust libraries for osmosis
Apache License 2.0
59 stars 52 forks source link

Queriers should not take ownership of `QuerierWrapper` #36

Closed larry0x closed 2 years ago

larry0x commented 2 years ago

Currently queriers such as GammQuerier takes ownership of a QuerierWrapper object. I'm wondering if it's possible to let it take a reference instead:

pub struct GammQuerier<'a> {
-   querier: QuerierWrapper<'a, Empty>,
+   querier: &'a QuerierWrapper<'a, Empty>,
}

This way we avoid cloning the querier wrapper when creating multiple queriers, which saves gas.

iboss-ptk commented 2 years ago

Nice catch! Thank you :D @larry0x