Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farm concentrated liq (part 3) #843

Open
wants to merge 10 commits into
base: feat/concentrated-liq
Choose a base branch
from

Conversation

dorin-iancu
Copy link
Contributor

No description provided.

Base automatically changed from farm-concentrated-liq-part-2 to feat/concentrated-liq February 22, 2024 11:42
@dorin-iancu dorin-iancu marked this pull request as ready for review February 22, 2024 11:42
dex/farm-concentrated-liq/src/cocentrated_liq.rs Outdated Show resolved Hide resolved
@@ -12,6 +13,12 @@ use crate::{
pub const DEFAULT_SAFE_PRICE_ROUNDS_OFFSET: u64 = 10 * 60;
pub const SECONDS_PER_ROUND: u64 = 6;

#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode)]
pub struct SafePriceLpToken<M: ManagedTypeApi> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use a struct instead of MultiValue2?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not change the implementation here, as there may be a lot of external contracts that have implemented this feature as it is right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way easier to integrate into other contracts. You don't need to look into the source code to see what each multi-value means, you simply import the struct.


fn get_price_bounds(&self, price: &BigUint) -> PriceBounds<Self::Api> {
let min_ticker = self.min_ticker().get();
let lower_bound = price / &min_ticker * &min_ticker;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct

{
#[init]
fn init(
&self,
reward_token_id: TokenIdentifier,
farming_token_id: TokenIdentifier,
division_safety_constant: BigUint,
min_ticker: BigUint,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Does it need to be a variable? Maybe have it as a constant?

Copy link

github-actions bot commented Feb 23, 2024

Contract comparison - from aed9246 to c1ed510

Path                                                                                             size                  has-allocator                     has-format
mx-exchange-sc
- pause-all/pause-all.wasm 5548 No No
mx-exchange-sc/dex
- farm/farm.wasm 38165 ➡️ 38168 🔴 No No
- farm-concentrated-liq/farm-concentrated-liq.wasm 38347 ➡️ 39161 🔴 No No
- farm-with-locked-rewards/farm-with-locked-rewards.wasm 37842 ➡️ 37845 🔴 No No
- governance/governance.wasm 17355 No No
- pair
- - pair.wasm 31271 ➡️ 31370 🔴 No No
- - pair-full.wasm 32650 ➡️ 32779 🔴 No No
- - safe-price-view.wasm 7888 ➡️ 7994 🔴 No No
- pair-mock/pair-mock.wasm 5470 No No
- price-discovery/price-discovery.wasm 16381 No No
- proxy-deployer/proxy-deployer.wasm 4502 No No
- router/router.wasm 26718 No No
mx-exchange-sc/energy-integration
- energy-factory-mock/energy-factory-mock.wasm 4277 No No
- energy-update/energy-update.wasm 1558 No No
- fees-collector/fees-collector.wasm 18953 No No
- governance-v2/governance-v2.wasm 16680 ➡️ 16607 🟢 No No
mx-exchange-sc/farm-staking
- farm-staking/farm-staking.wasm 42846 ➡️ 42852 🔴 No No
- farm-staking-proxy/farm-staking-proxy.wasm 19393 ➡️ 19416 🔴 No No
- metabonding-staking/metabonding-staking.wasm 10176 No No
mx-exchange-sc/locked-asset
- distribution/distribution.wasm 14292 No No
- energy-factory/energy-factory.wasm 35029 No No
- factory/factory.wasm 30471 No No
- lkmex-transfer/lkmex-transfer.wasm 11288 No No
- locked-token-wrapper/locked-token-wrapper.wasm 14586 No No
- proxy_dex/proxy_dex.wasm 36917 No No
- simple-lock/simple-lock.wasm 24491 No No
- simple-lock-whitelist/simple-lock-whitelist.wasm 26210 No No
- token-unstake/token-unstake.wasm 14288 No No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants