diff --git a/pkg/solana/chainwriter/chain_writer_test.go b/pkg/solana/chainwriter/chain_writer_test.go index fb3edc472..8631c2fe2 100644 --- a/pkg/solana/chainwriter/chain_writer_test.go +++ b/pkg/solana/chainwriter/chain_writer_test.go @@ -23,6 +23,7 @@ import ( idl "github.com/smartcontractkit/chainlink-ccip/chains/solana" "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_offramp" "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_router" + ccipconsts "github.com/smartcontractkit/chainlink-ccip/pkg/consts" "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" "github.com/smartcontractkit/chainlink-solana/pkg/monitoring/testutils" @@ -749,9 +750,9 @@ func TestChainWriter_CCIPOfframp(t *testing.T) { // simplified CCIP Config - does not contain full account list ccipCWConfig := chainwriter.ChainWriterConfig{ Programs: map[string]chainwriter.ProgramConfig{ - "ccip-offramp": { + ccipconsts.ContractNameOffRamp: { Methods: map[string]chainwriter.MethodConfig{ - "execute": { + ccipconsts.MethodExecute: { FromAddress: admin.String(), InputModifications: []codec.ModifierConfig{ &codec.RenameModifierConfig{ @@ -795,7 +796,7 @@ func TestChainWriter_CCIPOfframp(t *testing.T) { }, }, }, - "commit": { + ccipconsts.MethodCommit: { FromAddress: admin.String(), InputModifications: []codec.ModifierConfig{ &codec.RenameModifierConfig{ @@ -827,7 +828,7 @@ func TestChainWriter_CCIPOfframp(t *testing.T) { IDL: ccipOfframpIDL, }, // Requires only the IDL for the CCIPArgsTransform to fetch the TokenAdminRegistry - "ccip-router": { + ccipconsts.ContractNameRouter: { IDL: ccipRouterIDL, }, }, @@ -899,7 +900,7 @@ func TestChainWriter_CCIPOfframp(t *testing.T) { }, } - submitErr := cw.SubmitTransaction(ctx, "ccip-offramp", "execute", args, txID, offrampAddr.String(), nil, nil) + submitErr := cw.SubmitTransaction(ctx, ccipconsts.ContractNameOffRamp, ccipconsts.MethodExecute, args, txID, offrampAddr.String(), nil, nil) require.NoError(t, submitErr) }) @@ -947,7 +948,7 @@ func TestChainWriter_CCIPOfframp(t *testing.T) { return true }), &txID, mock.Anything).Return(nil).Once() - submitErr := cw.SubmitTransaction(ctx, "ccip-offramp", "commit", args, txID, offrampAddr.String(), nil, nil) + submitErr := cw.SubmitTransaction(ctx, ccipconsts.ContractNameOffRamp, ccipconsts.MethodCommit, args, txID, offrampAddr.String(), nil, nil) require.NoError(t, submitErr) }) } diff --git a/pkg/solana/chainwriter/transform_registry.go b/pkg/solana/chainwriter/transform_registry.go index 1cd8008bd..aff7ebac3 100644 --- a/pkg/solana/chainwriter/transform_registry.go +++ b/pkg/solana/chainwriter/transform_registry.go @@ -6,6 +6,7 @@ import ( "github.com/gagliardetto/solana-go" "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_offramp" + ccipconsts "github.com/smartcontractkit/chainlink-ccip/pkg/consts" "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" ) @@ -38,9 +39,9 @@ func FindTransform(id string) (func(context.Context, *SolanaChainWriterService, // with the indexes of the token pool addresses in the accounts slice. func CCIPArgsTransform(ctx context.Context, cw *SolanaChainWriterService, args any, accounts solana.AccountMetaSlice, toAddress string) (any, error) { // Fetch offramp config to use to fetch the router address - offrampProgramConfig, ok := cw.config.Programs["ccip-offramp"] + offrampProgramConfig, ok := cw.config.Programs[ccipconsts.ContractNameOffRamp] if !ok { - return nil, fmt.Errorf("ccip-offramp program not found in config") + return nil, fmt.Errorf("%s program not found in config", ccipconsts.ContractNameOffRamp) } // PDA lookup to fetch router address routerAddrLookup := PDALookups{ @@ -67,9 +68,9 @@ func CCIPArgsTransform(ctx context.Context, cw *SolanaChainWriterService, args a } // Fetch router config to use to fetch TokenAdminRegistry - routerProgramConfig, ok := cw.config.Programs["ccip-router"] + routerProgramConfig, ok := cw.config.Programs[ccipconsts.ContractNameRouter] if !ok { - return nil, fmt.Errorf("ccip-router program not found in config") + return nil, fmt.Errorf("%s program not found in config", ccipconsts.ContractNameRouter) } routerAddress := accountMetas[0].PublicKey