Skip to content

Commit

Permalink
[CCIP-3376] reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
valerii-kabisov-cll committed Sep 20, 2024
1 parent 143a126 commit 24d05c4
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,18 @@ func NewInterceptor(ctx context.Context, client evmClient.Client) (*Interceptor,
callData: tokenRatioCallData,
}

interceptor.tokenRatio, err = interceptor.getMantleGasPrice(ctx)
if err != nil {
return nil, fmt.Errorf("could not get token ratio from the Mantle oracle %v", err)
}

return interceptor, nil
}

// ModifyGasPriceComponents returns modified gasPrice.
func (i *Interceptor) ModifyGasPriceComponents(ctx context.Context, gasPrice, daGasPrice *big.Int) (*big.Int, *big.Int, error) {
if time.Since(i.tokenRatioLastUpdate) > tokenRatioUpdateInterval {
var err error
if i.tokenRatio, err = i.getMantleGasPrice(ctx); err != nil {
mantleTokenRatio, err := i.getMantleGasPrice(ctx)
if err != nil {
return nil, nil, err
}
i.tokenRatioLastUpdate = time.Now()

i.tokenRatio, i.tokenRatioLastUpdate = mantleTokenRatio, time.Now()
}

newGasPrice := new(big.Int).Add(gasPrice, daGasPrice)
Expand Down

0 comments on commit 24d05c4

Please sign in to comment.