Skip to content

Commit

Permalink
add solana config
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Jan 7, 2025
1 parent fea59dc commit b0e1bf1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
20 changes: 13 additions & 7 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"

"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-solana/pkg/solana/chainwriter"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key"
Expand Down Expand Up @@ -492,12 +493,18 @@ func createChainWriter(
execBatchGasLimit uint64,
chainFamily string,
) (types.ContractWriter, error) {
var err error
transmitter, ok := transmitters[types.NewRelayID(chainFamily, chainID)]
chainWriterConfig := make([]byte, 0)
if chainFamily == relay.NetworkSolana {
var chainWriterConfig []byte

if chainFamily == relay.NetworkSolana {
// TODO once onchain account lookup address are available, create construct function that initialize the config
solConfig := chainwriter.ChainWriterConfig{}
if chainWriterConfig, err = json.Marshal(solConfig); err != nil {
return nil, fmt.Errorf("failed to marshal Solana chain writer config: %w", err)
}
} else {
var fromAddress common.Address
fromAddress := common.Address{}
if ok {
fromAddress = common.HexToAddress(transmitter[0])
}
Expand All @@ -507,11 +514,10 @@ func createChainWriter(
execBatchGasLimit,
)
if err != nil {
return nil, fmt.Errorf("failed to create chain writer config: %w", err)
return nil, fmt.Errorf("failed to create EVM 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)
if chainWriterConfig, err = json.Marshal(chainWriterRawConfig); err != nil {
return nil, fmt.Errorf("failed to marshal EVM chain writer config: %w", err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ require (
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3
github.com/smartcontractkit/chainlink-feeds v0.1.1
github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250103164418-319e58e52798
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8
github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,8 @@ github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2Lp
github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250103164418-319e58e52798 h1:Ea+cqrzM2EVVwcYTVtvlEZHlulo1xUOcKhY1zf9/hfU=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250103164418-319e58e52798/go.mod h1:52U0UH8K0Qwu+HB1LMc+5V27ru2Tgy29YPT+2HkMevY=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
Expand Down

0 comments on commit b0e1bf1

Please sign in to comment.