Skip to content

Commit

Permalink
add solana and remove evm specific
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Jan 6, 2025
1 parent 44435a5 commit fea59dc
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/smartcontractkit/chainlink/v2/core/services/relay"

chainsel "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"
Expand Down Expand Up @@ -491,25 +492,27 @@ func createChainWriter(
execBatchGasLimit uint64,
chainFamily string,
) (types.ContractWriter, error) {
var fromAddress common.Address
transmitter, ok := transmitters[types.NewRelayID(chainFamily, chainID)]
if ok {
// TODO: remove EVM-specific stuff
fromAddress = common.HexToAddress(transmitter[0])
}

chainWriterRawConfig, err := evmconfig.ChainWriterConfigRaw(
fromAddress,
defaultCommitGasLimit,
execBatchGasLimit,
)
if err != nil {
return nil, fmt.Errorf("failed to create chain writer config: %w", err)
}
chainWriterConfig := make([]byte, 0)
if chainFamily == relay.NetworkSolana {

Check failure on line 497 in core/capabilities/ccip/oraclecreator/plugin.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

empty-block: this block is empty, you can remove it (revive)

chainWriterConfig, err := json.Marshal(chainWriterRawConfig)
if err != nil {
return nil, fmt.Errorf("failed to marshal chain writer config: %w", err)
} else {
var fromAddress common.Address
if ok {
fromAddress = common.HexToAddress(transmitter[0])
}
chainWriterRawConfig, err := evmconfig.ChainWriterConfigRaw(
fromAddress,
defaultCommitGasLimit,
execBatchGasLimit,
)
if err != nil {
return nil, fmt.Errorf("failed to create chain writer config: %w", err)
}
chainWriterConfig, err = json.Marshal(chainWriterRawConfig)
if err != nil {
return nil, fmt.Errorf("failed to marshal chain writer config: %w", err)
}
}

cw, err := relayer.NewContractWriter(ctx, chainWriterConfig)
Expand Down

0 comments on commit fea59dc

Please sign in to comment.