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

feat: liquidity mining - use underlying asset's oracle for bonds distribution #762

Merged
merged 6 commits into from
Feb 22, 2024

Conversation

martinfridrich
Copy link
Contributor

Description

This PR added support to use underlying asset's oracle as PriceAdjustment if farm distributes Bond as RewardCurrency.

…g asset if rewards currency is bond. pallet-bonds: added fn to parse underlying asset id from bond's name
Copy link

github-actions bot commented Feb 15, 2024

Crate versions that have been updated:

  • runtime-integration-tests: v1.18.1 -> v1.19.0
  • pallet-bonds: v2.1.0 -> v2.2.0
  • hydradx-adapters: v1.1.1 -> v1.2.0
  • hydradx-runtime: v212.0.0 -> v213.0.0

Runtime version has been increased.

Comment on lines 643 to 647
let rew_curr = pallet_asset_registry::Assets::<Runtime>::get(global_farm.reward_currency.into())
.ok_or(pallet_omnipool_liquidity_mining::Error::<Runtime>::PriceAdjustmentNotAvailable)?;

let reward_currency_id = if rew_curr.asset_type == AssetType::Bond {
pallet_bonds::Pallet::<Runtime>::parse_bond_name(rew_curr.name.into())?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let rew_curr = pallet_asset_registry::Assets::<Runtime>::get(global_farm.reward_currency.into())
.ok_or(pallet_omnipool_liquidity_mining::Error::<Runtime>::PriceAdjustmentNotAvailable)?;
let reward_currency_id = if rew_curr.asset_type == AssetType::Bond {
pallet_bonds::Pallet::<Runtime>::parse_bond_name(rew_curr.name.into())?
let asset_detail = pallet_asset_registry::Assets::<Runtime>::get(global_farm.reward_currency.into())
.ok_or(pallet_omnipool_liquidity_mining::Error::<Runtime>::PriceAdjustmentNotAvailable)?;
let reward_currency_id = if asset_detail.asset_type == AssetType::Bond {
pallet_bonds::Pallet::<Runtime>::parse_bond_name(asset_detail.name.into())?

Copy link
Member

@mrq1911 mrq1911 left a comment

Choose a reason for hiding this comment

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

Bump versions and LGTM

@martinfridrich martinfridrich merged commit dd578de into master Feb 22, 2024
4 checks passed
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.

4 participants