99 "strconv"
1010 "time"
1111
12+ "github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/operations/cctp_verifier"
13+ "github.com/smartcontractkit/chainlink-ccv/verifier/token/cctp"
14+
1215 "github.com/BurntSushi/toml"
1316 "github.com/Masterminds/semver/v3"
1417
@@ -50,6 +53,8 @@ type TokenVerifierInput struct {
5053 DefaultExecutorOnRampAddresses map [string ]string `toml:"default_executor_on_ramp_addresses"`
5154 // Maps to rmn_remote_addresses in the verifier config toml.
5255 RMNRemoteAddresses map [string ]string `toml:"rmn_remote_addresses"`
56+
57+ CCTPVerifierAddresses map [string ]string `toml:"cctp_verifier_addresses"`
5358}
5459
5560type TokenVerifierOutput struct {
@@ -85,6 +90,9 @@ func NewTokenVerifier(in *TokenVerifierInput) (*TokenVerifierOutput, error) {
8590 return nil , fmt .Errorf ("failed to generate verifier config for token verifier %w" , err )
8691 }
8792
93+ fmt .Println ("kurczaki - token verifier config:" )
94+ fmt .Println (string (config ))
95+
8896 confDir := util .CCVConfigDir ()
8997 configFilePath := filepath .Join (confDir , "verifier-config.toml" )
9098 if err := os .WriteFile (configFilePath , config , 0o644 ); err != nil {
@@ -202,6 +210,26 @@ func (v *TokenVerifierInput) buildVerifierConfiguration(config *token.Config) er
202210 config .VerifierID = v .ContainerName
203211 config .OnRampAddresses = v .OnRampAddresses
204212 config .RMNRemoteAddresses = v .RMNRemoteAddresses
213+ if len (config .TokenVerifiers ) == 0 {
214+ config .TokenVerifiers = make ([]token.VerifierConfig , 0 )
215+ }
216+
217+ if len (v .CCTPVerifierAddresses ) > 0 {
218+ verifiers := make (map [string ]any )
219+ for k , addr := range v .CCTPVerifierAddresses {
220+ verifiers [k ] = addr
221+ }
222+ config .TokenVerifiers = append (config .TokenVerifiers , token.VerifierConfig {
223+ Type : "cctp" ,
224+ Version : "2.0" ,
225+ CCTPConfig : & cctp.CCTPConfig {
226+ AttestationAPI : "localhost:8080" ,
227+ AttestationAPIInterval : 60 * time .Second ,
228+ AttestationAPITimeout : 10 * time .Second ,
229+ Verifiers : verifiers ,
230+ },
231+ })
232+ }
205233
206234 return nil
207235}
@@ -210,6 +238,7 @@ func ResolveContractsForTokenVerifier(ds datastore.DataStore, blockchains []*blo
210238 ver .OnRampAddresses = make (map [string ]string )
211239 ver .DefaultExecutorOnRampAddresses = make (map [string ]string )
212240 ver .RMNRemoteAddresses = make (map [string ]string )
241+ ver .CCTPVerifierAddresses = make (map [string ]string )
213242
214243 for _ , chain := range blockchains {
215244 networkInfo , err := chainsel .GetChainDetailsByChainIDAndFamily (chain .ChainID , chainsel .FamilyEVM )
@@ -218,6 +247,20 @@ func ResolveContractsForTokenVerifier(ds datastore.DataStore, blockchains []*blo
218247 }
219248 selectorStr := strconv .FormatUint (networkInfo .ChainSelector , 10 )
220249
250+ cctpTokenVerifierAddressRef , err := ds .Addresses ().Get (datastore .NewAddressRefKey (
251+ networkInfo .ChainSelector ,
252+ datastore .ContractType (cctp_verifier .ResolverType ),
253+ semver .MustParse (cctp_verifier .Deploy .Version ()),
254+ "CCTP" ,
255+ ))
256+ if err != nil {
257+ framework .L .Info ().
258+ Str ("chainID" , chain .ChainID ).
259+ Msg ("Failed to get CCTP Verifier address from datastore" )
260+ } else {
261+ ver .CCTPVerifierAddresses [selectorStr ] = cctpTokenVerifierAddressRef .Address
262+ }
263+
221264 onRampAddressRef , err := ds .Addresses ().Get (datastore .NewAddressRefKey (
222265 networkInfo .ChainSelector ,
223266 datastore .ContractType (onrampoperations .ContractType ),
0 commit comments