Skip to content

Commit

Permalink
use chain Id as opposed to chain type to identify Mantle
Browse files Browse the repository at this point in the history
  • Loading branch information
matYang committed Oct 6, 2024
1 parent 047109f commit 4f05710
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sync"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/chaintype"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/estimatorconfig/interceptors/mantle"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip"
Expand Down Expand Up @@ -413,12 +413,14 @@ func (r *Relayer) NewCCIPCommitProvider(rargs commontypes.RelayArgs, pargs commo

// CCIPCommit reads only when source chain is Mantle, then reports to dest chain
// to minimize misconfigure risk, might make sense to wire Mantle only when Commit + Mantle + IsSourceProvider
if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && commitPluginConfig.IsSourceProvider {
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
if iErr != nil {
return nil, iErr
if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 {
if commitPluginConfig.IsSourceProvider {
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
if iErr != nil {
return nil, iErr
}
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
}
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
}

// The src chain implementation of this provider does not need a configWatcher or contractTransmitter;
Expand Down Expand Up @@ -494,12 +496,14 @@ func (r *Relayer) NewCCIPExecProvider(rargs commontypes.RelayArgs, pargs commont

// CCIPExec reads when dest chain is mantle, and uses it to calc boosting in batching
// to minimize misconfigure risk, make sense to wire Mantle only when Exec + Mantle + !IsSourceProvider
if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && !execPluginConfig.IsSourceProvider {
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
if iErr != nil {
return nil, iErr
if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 {
if !execPluginConfig.IsSourceProvider {
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
if iErr != nil {
return nil, iErr
}
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
}
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
}

// The src chain implementation of this provider does not need a configWatcher or contractTransmitter;
Expand Down

0 comments on commit 4f05710

Please sign in to comment.