Skip to content

Commit

Permalink
Updated ccip transform args to use predefined contract names
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-momin committed Feb 11, 2025
1 parent 7b12e56 commit 31d460f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/solana/chainwriter/transform_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand Down

0 comments on commit 31d460f

Please sign in to comment.