Skip to content

Commit 8c6262e

Browse files
committed
calculate best taking amount fusion order
1 parent d7788d9 commit 8c6262e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/oneinch/auctioncalculator/amount_calculator.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ func (c AmountCalculator) GetRequiredTakingAmount(
6363
return c.getAuctionBumpedAmount(withFee, ts, blockBaseFee)
6464
}
6565

66+
func (c AmountCalculator) GetBestRequiredTakingAmount(
67+
takingAmount *big.Int,
68+
ts *big.Int,
69+
blockBaseFee *big.Int,
70+
) *big.Int {
71+
return c.getAuctionBumpedAmount(big.NewInt(0), ts, blockBaseFee)
72+
}
73+
6674
func (c AmountCalculator) GetRequiredMakingAmount(
6775
taker common.Address,
6876
makingAmount *big.Int,

pkg/oneinch/fusionorder/fusion_order.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ func (o FusionOrder) CalcTakingAmount(
3737
return o.amountCalculator.GetRequiredTakingAmount(taker, takingAmount, blockTime, baseFee)
3838
}
3939

40+
func (o FusionOrder) CalcBestTakingAmount(
41+
makingAmount *big.Int,
42+
blockTime,
43+
baseFee *big.Int,
44+
) *big.Int {
45+
takingAmount := util.CalcTakingAmount(makingAmount, o.LimitOrder.MakingAmount, o.LimitOrder.TakingAmount)
46+
return o.amountCalculator.GetBestRequiredTakingAmount(takingAmount, blockTime, baseFee)
47+
}
48+
4049
func (o FusionOrder) CalcMakingAmount(
4150
taker common.Address,
4251
takingAmount *big.Int,

0 commit comments

Comments
 (0)