@@ -5,12 +5,13 @@ import (
55 "fmt"
66 "sync"
77
8+ "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
9+ "github.com/xssnick/tonutils-go/ton"
10+
811 "github.com/smartcontractkit/chainlink-common/pkg/logger"
912 "github.com/smartcontractkit/chainlink-common/pkg/services"
1013 commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
1114 "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
12- "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
13- "github.com/xssnick/tonutils-go/ton"
1415
1516 "github.com/smartcontractkit/chainlink-ton/pkg/ccip/chainaccessor"
1617 "github.com/smartcontractkit/chainlink-ton/pkg/ccip/codec"
@@ -37,37 +38,41 @@ type Provider struct {
3738 services.StateMachine
3839}
3940
40- func NewCCIPProvider (lggr logger.Logger ,
41+ func NewCCIPProvider (
42+ lggr logger.Logger ,
4143 chainSelector ccipocr3.ChainSelector ,
4244 client ton.APIClientWrapped ,
4345 txm txm.TxManager ,
4446 logPoller logpoller.Service ,
45- offRampAddr string ,
46- pluginType uint32 ) (* Provider , error ) {
47- var err error
47+ cargs commontypes.CCIPProviderArgs ,
48+ ) (* Provider , error ) {
49+ addressCodec := codec .NewAddressCodec ()
50+ offRampAddrStr , err := addressCodec .AddressBytesToString (cargs .OffRampAddress )
51+ if err != nil {
52+ return nil , fmt .Errorf ("failed to decode offRamp address: %w" , err )
53+ }
54+
4855 var ct ocr3types.ContractTransmitter [[]byte ]
49- switch pluginType {
56+ switch cargs . PluginType {
5057 case CCIPPluginTypeCommit :
51- ct , err = ocr .NewCCIPTransmitter (txm , lggr , offRampAddr , ocr .CommitCallData )
58+ ct , err = ocr .NewCCIPTransmitter (txm , lggr , offRampAddrStr , ocr .CommitCallData )
5259 if err != nil {
5360 return nil , fmt .Errorf ("failed to create a CCIP ContractTransmitter for commit plugin: %w" , err )
5461 }
5562
5663 case CCIPPluginTypeExecute :
57- ct , err = ocr .NewCCIPTransmitter (txm , lggr , offRampAddr , ocr .ExecuteCallData )
64+ ct , err = ocr .NewCCIPTransmitter (txm , lggr , offRampAddrStr , ocr .ExecuteCallData )
5865 if err != nil {
5966 return nil , fmt .Errorf ("failed to create a CCIP ContractTransmitter for execute plugin: %w" , err )
6067 }
6168 default :
62- return nil , fmt .Errorf ("unknown plugin type: %d" , pluginType )
69+ return nil , fmt .Errorf ("unknown plugin type: %d" , cargs . PluginType )
6370 }
6471
65- // TODO this is pretty much ignored in the core, we need to redesign core to resolve the extraDataCodec map issue if we want to use
66- // this codec
6772 c := ccipocr3.Codec {
68- ChainSpecificAddressCodec : codec . NewAddressCodec () ,
73+ ChainSpecificAddressCodec : addressCodec ,
6974 CommitPluginCodec : codec .NewCommitPluginCodecV1 (),
70- ExecutePluginCodec : codec .NewExecutePluginCodecV1 (nil ), // TODO extraDataCodec map can't be empty
75+ ExecutePluginCodec : codec .NewExecutePluginCodecV1 (cargs . ExtraDataCodecBundle ),
7176 TokenDataEncoder : codec .NewTokenDataEncoder (),
7277 SourceChainExtraDataCodec : codec .NewExtraDataDecoder (),
7378 }
0 commit comments