Fee buyback: Limit MNGO price by stable price (#485)
This makes it much harder to temporarily manipulate the MNGO price to get a more favorable buyback deal.
This commit is contained in:
parent
c48d9c94d9
commit
255c6fb138
|
@ -74,7 +74,7 @@ pub fn account_buyback_fees_with_mngo(
|
|||
&AccountInfoRef::borrow(&ctx.accounts.mngo_oracle.as_ref())?,
|
||||
Some(Clock::get()?.slot),
|
||||
)?;
|
||||
let mngo_buyback_price = mngo_oracle_price * bonus_factor;
|
||||
let mngo_buyback_price = mngo_oracle_price.min(mngo_bank.stable_price()) * bonus_factor;
|
||||
// mngo is exchanged at a discount
|
||||
let mut max_buyback_mngo = max_buyback / mngo_buyback_price;
|
||||
// buyback is restricted to account's token position
|
||||
|
|
Loading…
Reference in New Issue